input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Convert frames to NTSC Drop Frame Timecode <p>I'm looking for a function that converts an integer value in frames to NTSC Drop Frame Timecode (hh:mm:ss.ff).</p>
<p>I'm using Delphi, but could be in any language.</p>
<p>Thanks</p>
| <pre><code>function FramesToNTSCDropFrameCode(Frames:Integer;FramesPerSecond:Double):string;
var
iTH, iTM, iTS, iTF : word;
MinCount, MFrameCount : word;
begin
DivMod( Frames, Trunc(SecsPerMin * FramesPerSecond), MinCount, MFrameCount );
DivMod( MinCount, MinsPerHour, iTH, iTM );
DivMod( MFrameCount, Trunc(Fr... |
Regex not fitting with C# <p>I wrote simple program for getting info from web</p>
<pre><code>string loginName = null;
Regex rloginName = new Regex(@" <tr><td dir='rtl'><h1>(.*?)</h1><br /></td></tr> <!--.............. Titel der Referat ..............-->");
Match mloginN... | <p>It's the tiny whitespace at the start of your Regex pattern. If you remove it, you can get what you want using mloginName.Groups[1] .</p>
|
How to authenticate on ASP.NET <p>I'm developing an ASP.NET app (c#) that need to authenticate users. To do that I have a SQL Server database with the users of this application.</p>
<p>Which is the best way to do that?</p>
<p>I've been reading this:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/xdt4thhy.as... | <p>Membership is the easiest way to provide authentication IMO.
If you're interested in using it I recommend this <a href="http://aspnet.4guysfromrolla.com/articles/120705-1.aspx" rel="nofollow">tutorial</a> by Scott Mitchell:</p>
|
Resolving a parameter name at runtime <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/72121/finding-the-variable-name-passed-to-a-function-in-c-sharp">Finding the Variable Name passed to a Function in C#</a> </p>
</blockquote>
<p>In C#, is there a way (terser... | <p>One way:</p>
<pre><code>static void Main(string[] args)
{
Console.WriteLine("Name is '{0}'", GetName(new {args}));
Console.ReadLine();
}
</code></pre>
<p>This code also requires a supporting function:</p>
<pre><code>static string GetName<T>(T item) where T : class
{
var properties = typeof(T).GetPrope... |
Getting SimpleXMLElement to include the encoding in output <p>This:</p>
<pre><code>$XML = new SimpleXMLElement("<foo />");
echo($XML->asXML());
</code></pre>
<p>...outputs this:</p>
<pre><code><?xml version="1.0"?>
<foo/>
</code></pre>
<p>But I want it to output the encoding, too:</p>
<pre><co... | <p>You can try this, but you must use <strong>simplexml_load_string</strong> for $xml</p>
<pre><code>$xml // Your main SimpleXMLElement
$xml->addAttribute('encoding', 'UTF-8');
</code></pre>
<p>Or you can still use other means to add the encoding to your output.</p>
<p><strong>Simple Replacement</strong></p>
<pr... |
Send emails (using Postfix) from two different domains <p>I have two Ruby on Rails applications, and two virtual domains (mydomain1.com and mydomain2.com)(using Apache+REE+mod_rails).
I use Postfix as mail server.</p>
<p>So I have myhostname = mail.mydomain1.com in main.cf
And that's because why the sender is always m... | <p><code>Received:</code> headers are added by the receiving server, which is simply doing a reverse DNS lookup on the connecting (sender) IP address. You won't be able to get the result you desire unless you can force Postfix to make its outgoing connections on a specific IP, and then bind an IP per domain to your ser... |
Streaming Parsers (JSON/XML) for AS3/Flex/Adobe AIR application <p>Are there any stream-reading, parsing libraries available for json or xml formats in AS3? I'm setting up a long-polling application, using URLStream/URLRequest. I do not have control over the data I'm receiving other than a choice between formats. I'... | <p>Yup.</p>
<p>Have a look at the AS3 Corelib: <a href="http://code.google.com/p/as3corelib/" rel="nofollow">http://code.google.com/p/as3corelib/</a></p>
<p>It's an Adobe library. There should be more info on <a href="http://labs.adobe.com/wiki/index.php/ActionScript%5F3:resources:apis:libraries" rel="nofollow">labs.... |
Any ideas why incremental flex compilation would not work for successive compilations of identical source? <p>I am running mxmlc in the command-line with <em>-incremental=true</em>. Flex is building the cache file using a checksum the first time. Subsequent compilations fail with this message:</p>
<p><b>Failed to mat... | <p>I just ran across this issue myself and after not finding the answer anywhere on the web, I bashed my head against mxmlc in practically trail-and-error until finding the answer. In my case, I was regenerating the flex config xml file each time I compiled from within ant. It turns out that this is the error you get... |
Why are UNION queries so slow in MySQL? <p>When I optimize my 2 single queries to run in less than 0.02 seconds and then UNION them the resulting query takes over 1 second to run. Also, a UNION ALL takes longer than a UNION DISTINCT. I would assume allowing duplicates would make the query run faster and not slower. Am ... | <blockquote>
<p>When I optimize my 2 single queries to run in less than 0.02 seconds and then UNION them the resulting query takes over 1 second to run.</p>
</blockquote>
<p>Do your queries include <code>ORDER BY ⦠LIMIT</code> clauses?</p>
<p>If you put an <code>ORDER BY ⦠LIMIT</code> after a <code>UNION</cod... |
Using CurlPP with vs2008 <p>I'm trying to build a C++ console app in VS2008 using the static curlpp library. The code - which is curlpp example 00 - is as follows:</p>
<pre><code>#include "stdafx.h"
#include <curlpp/curlpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
using namesp... | <p>Take a look at <em>\include\curlpp\internal\buildconfig.h</em> file where there are the following macros defined</p>
<pre><code>CURLPPAPI
CURLPP_INCLUDE_TEMPLATE_DEFINITIONS
CURLPP_TEMPLATE_EXPLICIT_INSTANTIATION
</code></pre>
<p>based on values of these three macros</p>
<pre><code>CURLPP_STATICLIB
BUILDING_CURLP... |
Generate a business key <p>What is the best way to generate a unique number for a business key?</p>
<p>In the example below, our customer wants a number (OrderNumber) they can use to refer to an Order.</p>
<pre><code><class name="Order">
<id name="Id" ... />
<property name="OrderNumber" column="or... | <p>I've found that the best way to perform these tasks is to write them in code and not leak them into the data layer. I don't let NHibernate calculate it. I treat this concept as a fully fledged feature of the application. This is nice because I can write tests for it and have flexibility. Sometimes there are other... |
How to access static resources when mapping a global front controller servlet on /* <p>I've mapped the Spring MVC dispatcher as a global front controller servlet on <code>/*</code>.</p>
<pre class="lang-xml prettyprint-override"><code><servlet>
<servlet-name>home</servlet-name>
&l... | <p>Map the controller servlet on a more specific <code>url-pattern</code> like <code>/pages/*</code>, put the static content in a specific folder like <code>/static</code> and create a <code>Filter</code> listening on <code>/*</code> which transparently continues the chain for any static content and dispatches requests... |
Repost: Creating a RSS feed with PHP <p>I asked how to do this before but it seems I needed to put more code to really get an answer.</p>
<p>I have a reddit type site, and I am trying to create a rss feed this is the code, but I get a Fatal error: Uncaught exception 'Exception' with message 'Query failed'</p>
<p>Here... | <p>I'm not at a machine with php to test this, but you have queries with variables as follows...</p>
<pre><code>"select id from votes where username = '$user' and article_id = $this->id"
</code></pre>
<p>I'm fairly certain that you need to bracket or concatenate when using objects...</p>
<pre><code>"select id fr... |
Does JVM that services your web-app re-start on redeploy to an Application Server? <p>Is this something you can configure and/or dependent on your Application Server? I am wondering if a singleton object will be reconstructed when you re-deploy the application.</p>
<p>I would rather ask here and try and get a concise ... | <p>No, it will not (at least no app server that I know of). The servlet specification gives you the <a href="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContextListener.html" rel="nofollow">ServletContextListener</a> hook to manage app lifecycle. Some app servers like JBoss have special annota... |
How can a C# programmer build software for iPhone? <p>What should I learn to develop software for iPhone?</p>
<p>Thanks</p>
| <p><a href="http://scottcreynolds.com/archive/2009/02/05/beginning-objective-c-for-the-c-guy.aspx">Beginning Objective C for the C# guy</a></p>
|
How do I explain the different .NET versions to someone? <p>My boss keeps asking me "which version of .NET are we upgrading to", to which I answer "3.5, the latest one".</p>
<p>But then he sees things about how .NET 3.5 is just a set of libraries on top of .NET 2.0 and I find myself having to explain it to him.</p>
<... | <p>You should decompose .NET as a package of three different things:</p>
<ol>
<li>CLR, the runtime</li>
<li>Libraries</li>
<li>Languages, compilers and tools</li>
</ol>
<p>This way, it'll be pretty easier to explain.</p>
<p>For instance, in .NET 3.5 we have:</p>
<ol>
<li>.NET CLR v2.0</li>
<li>v3.5 assemblies</li>
... |
Running a threaded class as a daemon <p>I am writing a multi-threaded solution in Java to connect two systems, A & B. System A is completly serial, not threaded, and will supply data to send to system B. System B accepts data from multiple sources asynchronously all at the same time.</p>
<p>I am using ThreadPool... | <p>If you're running two separate processes, then you've got two separate types and two separate instances, regardless of whether it's a singleton.</p>
<p>If you want two different processes to talk to each other, you'll need to address that issue entirely separately. There are plenty of different IPC mechanisms avail... |
How does struts 2 includes javascript files in a jsp from their struts.jar? <p>I've noticed that the javascript client-side validation feature of the struts 2 framework uses a javascript file that comes inside the struts2 JAR file. The javascript file gets included somehow in the JSP page apparently by just using a tag... | <p>All right, I pulled some time from work and investigate how the framework does this. It turns out that Struts 2 has a implementation to serve static content. This is configured in the configuration file struts.properties by the property: <strong>struts.serve.static</strong>.</p>
<p>If that property is set to <stron... |
Is there a good natural language processing library <p>I need to implement some NLP in my current module. I am looking for some good library that can help me here. I came across 'LingPipe' but could not completely follow on how to use it.<br />
Basically, we need to implement a feature where the application can deciphe... | <p><a href="http://alias-i.com/lingpipe/">LingPipe</a> is very nice and well documented. You can also take a look at:</p>
<ul>
<li><a href="http://opennlp.sourceforge.net/">OpenNLP</a></li>
<li><a href="http://nlp.stanford.edu/">Stanford NLP</a></li>
<li><a href="http://incubator.apache.org/uima/">Apache UIMA</a></li>... |
How to register same type twice with different constructors in Unity? <p>I'm trying to register the same type but with two different constructors. When I trying to resolve, I get "<em>Resolution of the dependency failed</em>" on the second Resolve.</p>
<pre><code> var container = new UnityContainer();
contain... | <p>You need to give them names when registering. The parameter to <code>Resolve</code> is the name of the instance you want.</p>
<pre><code>var container = new UnityContainer();
container
.RegisterInstance<IBar>("BAR", new Bar())
.RegisterInstance<IBar>("FOOBAR", new Bar("foo"));
Bar bar1 = (Bar)... |
Do you expect Javascript to become widely used outside the browser? <p>With all the magic you can do in today's browser I wonder if Javascript will become much more prominent on the server side or as a viable alternative for application programming. I ask this because I have poked around with many programming languages... | <p>It's already widely used as a scripting language. I've heard that photoshop is scripted with it.
Also, flash's actionscript is javascript.</p>
<p>It's the cool little language, exactly the one you want for those cases.
People use it all over - I've heard it was using in the call center software, for example.</p>
<... |
In Python, How Do You Filter a String Such That Only Characters in Your List Are Returned? <p>Imagine a string, like 'Agh#$%#%2341- -!zdrkfd' and I only wish to perform some operating on it such that only the lowercase letters are returned (as an example), which in this case would bring 'ghzdrkfd'.</p>
<p>How do you... | <p>If you are looking for efficiency. Using the <a href="http://docs.python.org/library/stdtypes.html#str.translate">translate</a> function is the fastest you can get.</p>
<p>It can be used to quickly replace characters and/or delete them.</p>
<pre><code>import string
delete_table = string.maketrans(
string.asci... |
Deciphering errors in upgrading a Visual C++ 6 project to Visual Studio 2008 <p>I wanted to see if I could bring this defunct open source project called <a href="http://www.tomseddon.plus.com/mousetool/" rel="nofollow">MouseTool</a> up to date with Windows Vista. It's a dwell-clicker to help people (like myself) who ex... | <p>The member signatures for certain MFC event handlers were not properly checked in vc6 - code that compiled in error in VC6 needs to be fixed to compile in the updated compiler you are using. </p>
<p>The handler for an ON_MESSAGE target needs to conform to this signature:</p>
<pre><code>afx_msg LRESULT (CWnd::*)(WP... |
ChannelFactory Reuse Strategies <p>I've been reading that ChannelFactory creation is expensive and that unless there is a technical reason not to, one should reuse ChannelFactories when possible either by caching them someway, or by using static instances of the factories.</p>
<p>In your experience, what ChannelFactor... | <p>If you're using .NET 3.0 SP1 and up and don't need special stuff that requires handling channels directly, then the best option would be to just use client-side proxy classes derived from ClientBase<T> (like the ones generated when importing services). Those already cache the factory underneath. See <a href="h... |
Just in theory: How is the alpha component premultiplied into the other components of an PNG in iPhone OS, and how can it be unpremultiplied properly? <p>Actually, I thought that there would be an easy way to achieve that. What I need is pure alpha value information. For testing, I have a 50 x 55 px PNG, where on every... | <p>Premultiplication doesn't affect the alpha channel, it affects the color channels.</p>
<p>The formula for raster compositing (putting one raster image over another) is:</p>
<pre><code>dst.r = src.r * src.a + dst.r * (1.0 - src.a);
dst.g = src.g * src.a + dst.g * (1.0 - src.a);
dst.b = src.b * src.a + dst.b * (1.0 ... |
XML element unique id Schema repersentation <p>My XML looks likes this :</p>
<pre><code><company>
<employee id="1">Larsen</employee>
<employee id="2">Smith</employee>
<employee id="3">Sam</employee>
</company>
</code></pre>
<p>How to write a xml schema so that emp... | <pre><code><?xml version="1.0" encoding="utf-8"?>
<xs:schema id="XMLSchema1"
elementFormDefault="unqualified" attributeFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name... |
Is it possible to disconnect all event handlers in Dojo? <p>Some code I am working with replaces some HTML elements that have Dojo event listeners with new HTML coming from an AJAX call (using .innerHTML=). I have read that event listeners should be disconnected using the dojo.disconnect(handle) method before they are ... | <p>Actually if you are using widgets they normally should disconnect stuff in tehir destroy() method. If you are handling the nodes yourself, I see two ways you can go.</p>
<p>1) Manage all connects manually, means storing them somewhere.
2) Probably the safer one: store all the connect handlers in the node they conne... |
Automating certain repetive actions in IE based applications via a c# tool? <p><a href="http://www.xtremevbtalk.com/showthread.php?p=1221565#post1221565" rel="nofollow">http://www.xtremevbtalk.com/showthread.php?p=1221565#post1221565</a></p>
<p>This thread shows some discussion about what I'm trying to do. I can't use... | <p>look at this <a href="http://gruntbuggly.blogspot.com/2008/03/c-test-automation-with-internet.html" rel="nofollow">post</a>. On the way even <a href="http://google-opensource.blogspot.com/2009/05/introducing-webdriver.html" rel="nofollow">Google's WebDriver</a></p>
|
ADO.NET Madness and Nullable Types <p>I've seem to have gone down a rabbit hole. I would like to convert the data from ADO .NET datasets into a Nullable type. At first I assumed that a straight cast (int?) would do it. How naive I was. Wrong, badly wrong. Now I'm trying to write a generic converter but am getting hung ... | <p><code>T : Nullable<T></code> doesn't really make sense as a constraint - think about what <code>T</code> would have to be; it can't be nullable of itself. You could have:</p>
<pre><code>where T : Nullable<U> where U : struct
</code></pre>
<p>but that would be somewhat obscure. I think it's easier to ma... |
How can you get a variable's value given its name in korn shell? <p>Is there a way in ksh to get a variable's value when you have been given the name of the variable?</p>
<p>For example:</p>
<pre><code>#!/usr/bin/ksh
var_name=$1 #pretend here that the user passed the string "PATH"
echo ${$var_name} #echo value of $... | <pre>
eval `echo '$'$var_name`
</pre>
<p>echo concatenates a '$' to the variable name inside $var_name, eval evaluates it to show the value.</p>
<p>EDIT:
The above isn't quite right. The correct answer is with no backticks.</p>
<pre>
eval echo '$'$var_name
</pre>
|
Change dropdownlist CSS when clicked or hover? <p>Inspired by <a href="http://stackoverflow.com/questions/624102/enable-a-currently-disabled-dropdown-list-when-clicking-the-dropdown-list" rel="nofollow" title="this answer">http://stackoverflow.com/questions/624102/enable-a-currently-disabled-dropdown-list-when-clicking... | <p>The problem is that the click handler isn't being fired until you let go of the mouse button (and the drop-down vanishes), so the <code>label.disabled select</code> style is still applied.</p>
<p>There are two ways to fix this. First, you could add another CSS rule for <code>:focus</code>, which overrides the disa... |
Using Git to track Ruby on rails <p>Other than the database and log files are there any other files that should not be in the repository for security reasons?</p>
<p>The project will mostly be worked on by myself however the code is to be stored on a shared repository which will be available to a few other users shou... | <p>A typical <code>.gitignore</code> file in a "ruby on rails" context could look something like:</p>
<pre><code>config/database.yml
db/*.sqlite3
log/*.log
log/*.pid
tmp/**/*"
</code></pre>
<p>But, as pointed out by the article "<a href="http://rha7dotcom.blogspot.com/2008/08/rorgitignore.html" rel="nofollow">rorgi... |
How should business errors be handled in a web application? <p>Say that I've got a web application that can store Persons in a database. Every Person must have a unique email address (or username or whatever). If a user attempts to add a Person with an email address that already exists, the form should be returned wi... | <p>One way to handle this is to create a response object for your <code>addPerson</code> operation that has a status code. For example:</p>
<pre><code>class AddPersonResponse {
private Person person;
private AddPersonStatus status;
private AddPersonFailureReason failureReason;
}
enum AddPersonStatus {
... |
What is the name of this programming rule? <p>There is a programming "rule" that says that a method should instead of asking for 'x' when it needs to know 'x.y.z', ask directly for 'z'. I just can't remember the name.</p>
| <p>I'm not sure if it's exactly what you're after but this sounds very similar to <a href="http://en.wikipedia.org/wiki/Law%5Fof%5FDemeter" rel="nofollow">The Law of Demeter</a>.</p>
|
How do I use Linq in MonoDevelop 2.0 on OS X? <p>I installed MonoDevelop 2.0 on my Mac.</p>
<p>I created a new Console Application.</p>
<p>"Hello World" program runs fine.</p>
<p>But I can't use Linq.</p>
<p><code>using System.</code> doesn't show <code>Linq</code> option.</p>
<p>What should I do?</p>
| <p>You may need to right-click on your project in the solution view, do <code>Options</code>, <code>Build</code>, <code>General</code>, and set your Target Runtime to <code>Mono / .Net 3.5</code> or bigger.</p>
<p>Then you can right-click references, do Edit References, and add a reference to System.Core to your proje... |
jquery ignores response <p>Hi anyone see why my alert won't work?</p>
<pre><code> <script type="text/javascript">
function SubmitForm(method)
{
var login = document.form.login.value;
var password = document.form.password.value;
$.post("backend.php", {
login: login,
password: password,
... | <p>Why is 'backend' at the start of your response? I would start by removing that. Everything from { to } looks good.</p>
|
Need help understanding a C function <p>Here's the deal: I'm trying, as a learning experience, to convert a C program to C++. <a href="http://www.zompist.com/sounds.htm" rel="nofollow">This program</a> takes a text file and applies modifications to it according to user-inputted rules. Specifically, it applies sounds ch... | <p>This code is... tough to read. I looked at the original file, and it could really use some better variable names. I especially love this part from one of the function comments:</p>
<pre><code>/*
** (Stuff I removed)
**
** Warning: For now, we don't have a way to handle digraphs.
**
** We also return TRUE if (<-... |
How to get POST URL with parameters from HttpServletReqest in ServletFilter? (For proxy app) <p>Due to browser restrictions I need to use a proxy to make an openlayers map work.</p>
<p>The OpenLayers.ProxyHost javascript object handles the generation of a URL like:</p>
<p><a href="http://webhost:8080/app/proxy/?url=h... | <p>If the url parameter is sent in the POST body you can use:</p>
<pre><code>request.getParameter( "url" );
</code></pre>
|
perfomSelector: withObject: afterDelay: can I ask for a low priority? <p>Is there some way when sending this message to specify that I rather have my selector performed after all pending UI events, if any? Ie. give my aterDelay timer a lower priority in the event queue.</p>
| <p>Actually, <code>performSelector:withObject:afterDelay:</code> doesn't necessarily have to occur on the main thread; that's why there's a separate method <code>performSelectorOnMainThread:withObject:waitUntilDone:</code>. The documentation for <code>performSelector:withObject:afterDelay:</code> says </p>
<blockquot... |
Three20 TTTableViewController with a TTThumbsTableViewCell <p>It seems that you must use the TTThumbsViewController to accomplish this. However, in the example code, TTThumbsViewController is only ever used to manage a scrollview of thumbs. How do you configure it to display cells instead?</p>
<p><strong>_______Origin... | <p>I haven't really used Three20 myself, but took a quick look on the source code.</p>
<p>It seems that Three20 have abstracted a creation of table view cells in generic TTTableViewDataSource. It queries class of a table view cell to be created via tableView:cellClassForObject:. TTThumbsDataSource in <a href="http://g... |
Webkit JavaScript Reference <p>For Gecko there's Mozilla Developer Network</p>
<p>For IE there's MSDN.</p>
<p>For webkit there's...Apple Developer Connection? </p>
<p>There are a <a href="https://developer.apple.com/library/safari/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/WebKitJavaScript.html" ... | <p>How about the WebKit DOM Reference?</p>
<p><a href="http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/WebKitDOMRef/index.html" rel="nofollow">http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/WebKitDOMRef/index.html</a></p>
<p><strong>Update</stro... |
Help converting type - cannot implicitly convert type 'string' to 'bool' <p>I am fairly new to c# and asp.net and am having an issue converting type;</p>
<p>My situation is that I have a search engine that has a textbox for the search text and two radio buttons for the search location ( IE City1 or City2 )</p>
<p>Whe... | <p>try: c# equality operator == not =</p>
<pre><code>if (thecitytype == "City1")
</code></pre>
|
Does this. slow down code? <p>We were having the (never ending) underscore prefix versus no underscore prefix debate on member variables and someone mentioned that is you use "this." instead of "-", your code will be slower due to the "." in "this.". Is this true and can anyone quantify this?</p>
| <p>No, that makes no sense at all. Just look at the IL, and kick that developer in the ass.</p>
<p>Also FWIW, I like the underscore in member variables.</p>
|
How does Wolfram Alpha work? <p>Behind the tables and tables of raw data, how does Wolfram Alpha work?</p>
<p>I imagine there are various artificial intelligence mechanisms driving the site but I can't fathom how anyone would put something like this together. Are there any explanations that would help a programmer und... | <blockquote>
<p>Does the knowledge base learn on its
own or is it taught very specific
details in a very organized manner?</p>
</blockquote>
<p>AI systems are usually something distinctly in between. The system will usually learn in a directed way, where the developers can apply a metric that measures the qualit... |
Bitmap.Save, Huge Memory Leak <p>I have an application where I am taking a bitmap and compressing it using a GZipStream and sending it over a socket, all in memory. I have tracked down the dirty scumbag memory leak to the following line:</p>
<pre><code>frame.Save(inStream, jpegCodec, parameters);
</code></pre>
<p>Bro... | <p>I suggest running your code under CLR Profiler to locate the source of the leak. If it's a managed object of any type (even an unmanaged resource), as long as the bug isn't due to a managed type leaking an unmanaged handle, you'll be able to see where the leak is. If it's in framework code, you can probably work aro... |
Tips for developing an ASP.NET application that doesn't depend on JavaScript <p>Not sure if this belongs in community wiki...</p>
<p>Can somebody give some general guidelines on how to successfully build an ASP.NET site that isn't dependent on JavaScript? My understanding is that I should build a functional site init... | <p>Try ASP.NET MVC! sure most of the examples use JavaScript for the AJAX functionality, but it's easy to build a fully functioning site that doesn't use JavaScript.</p>
<p>Since ASP.NET MVC doesn't use server controls with all their embedded JavaScript, it's a great way to build a site with very minimal and lightweig... |
Hudson Continuous Integration Server with .Net 1.1 <p>Has anyone successfully used hudson to build .Net 1.1 Projects? If so, can you share the configuration. I am having trouble.</p>
<p>Hudson uses MSBuild which was introduced with .Net 2.0. I found <strong><a href="http://www.codeplex.com/MSBee" rel="nofollow">MSBee<... | <p>I'm using NAnt for 1.1 projects, which was simpler to integrate for me than MSBuild. You have a hudson <a href="http://wiki.hudson-ci.org/display/HUDSON/NAnt%2BPlugin" rel="nofollow">plugin</a> for it.</p>
|
Can VS_VERSION_INFO be added to non-exe files? <p>My windows co-workers were asking me if I could modify my non-windows binary files such that when their "Properties" are examined under Windows, they could see a "Version" tab like that which would show for a Visual Studio compiled exe.</p>
<p>Specifically, I have some... | <p>It is not supported by windows, since each file type has their own file format. But that doesn't mean you can't accomplish it. The resources stored inside dlls and exes are part of the file format. </p>
<p><strong>Display to the user:</strong> </p>
<p>If you wanted this information to be displayed to the user, ... |
MVC - How to structure views for a search form with results on same page <p>I have MVC 1.0 app on VS2008.</p>
<p>I have webpage that has a search form fields and then when search button clicked uses
Ajax.BeginForm to load results in a div. Works great!</p>
<p>But the results have a pager that just uses an anchor wit... | <p>I think I understand what you are saying.</p>
<p>Currently, you're using Ajax to dynamically update your results to a div. Kewl.</p>
<p>The trick here is to make sure each 'page' in the pager has a similar javascript function defined on the onclick event. This way, the pager doesn't do a 'postback' to the server, ... |
Redirecting to a "Thank you" page and offering the save dialog of downloaded file immediately <p>I am using ASP.NET2.0. I have created a download form with some input fields and a download button. When the download button is clicked, I want to redirect the user to a "Thank you for downloading..." page and immediately o... | <p>You could reference a download page from your thank you page using an IFrame</p>
<pre><code><iframe src="DownloadFile.aspx" style="display:none;" />
</code></pre>
<p>In this case, DownloadFile.aspx would have the code behind from your example.</p>
|
how to write data to socket channel <p>is there any small working program for recieving from and sending data to client using java nio.</p>
<p>Actually i am unable to write to socket channel but i am able to read the incoming data
how to write data to socket channel</p>
<p>Thanks
Deepak</p>
| <p>You can write data to a socket channel like so:</p>
<pre><code>import java.nio.*;
import java.nio.channels.*;
import java.nio.charset.*;
public class SocketWrite {
public static void main(String[] args) throws Exception{
// create encoder
CharsetEncoder enc = Charset.forName("US-ASCII").newEncoder(); ... |
NetBeans IDE 6.5 and Microsoft Access <p>I would like to know if there is anyone who has used NetBeansIDE 6.5 before, also connected a MS Access 2007 database to a system developed with java Application option in the NetBeans platform. i would appreciate help very much especially if it's a tutorial send to me(alanzomo@... | <p><a href="http://wiki.netbeans.org/DemoOnJDBC%5FODBC" rel="nofollow">This tutorial on the Netbeans Website</a> shows how you can connect Netbeans to an ODBC data source using the JDBC-ODBC bridge. This will work for Access databases.</p>
<p>Alternatively, you can use <a href="http://developers.sun.com/product/jdbc/... |
saving Btrees to a disk file and read it <p>I want to save a Btree(not sure a binary one) in a disk file.
and then read it to the memory.
some Level-order traversal may be a good way for a binary Btree.
but if it is not a binary one.
I build up the Btree from the leafnode to the rootnode in memory.
I believe that I hav... | <p>If you really want to do something similar, you can just assign at each node an id and save the nodes in that format:</p>
<p>[node-id value left-node-id right-node-id]</p>
<p>and then visit the tree with a breadth-first search. </p>
<p>When you want to reconstruct the tree, create a map id->node and then read <st... |
No reverse error in Google App Engine Django patch? <p>I am using <a href="http://en.wikipedia.org/wiki/Google%5FApp%5FEngine" rel="nofollow">Google App Engine</a> patch Django.</p>
<p>When I try to go to the admin site,</p>
<blockquote>
<p><a href="http://127.0.0.1:8080/admin/" rel="nofollow">http://127.0.0.1:8080... | <p>I could not find a proper answer to my question. Anyways I solved the problem temporarily by reinstalling the Django framework and the app engine SDK.</p>
|
c# external Exception in GDI+ <p>I want to run this piece of code</p>
<pre><code> Bitmap grayImage = (Bitmap)img.Clone();
for (int x = 0; x < arr.GetLength(0); x++)
{
for (int y = 0; y < arr.GetLength(1); y++)
{
int col = arr[x, y];
... | <p>I had a similar problem in the past where my cloned bitmap had some artifacts. After researching this problem for a while, I stumbled upon <a href="http://www.gamedev.net/community/forums/topic.asp?topic%5Fid=501121" rel="nofollow">this thread</a> which helped.</p>
<p>Try replacing your Clone()</p>
<pre><code>Bitm... |
Visual Studio Debugger Output - Same output but different formats (like decimal output in one project, hexidecimal in another) <p>I'm learning some DirectX programming by re-implementing some DirectX code into different projects, I did find however that the debugger seems to output data differently between the two proj... | <p>On the Debug toolbar (right click the toolbar and make sure Debug is selected) you can toggle the Hex button. This controls whether the debugger shows hex or dec values. You probably just have it set differently in different places. </p>
<p>You can also right click on a variable value in the little inspect toolt... |
How does system() exactly work in linux? <p>I've been reading its man page but haven't yet been successful in figuring out how it works. On calling system(), is a new child process forked and the shell binary exec()-ed in it? That may be a stupid guess though.</p>
| <p>Yes, system() is essentially a fork() and exec() "sh -c" for the passed command string. An example implementation (from eglibc, recently forked from glibc) can be found <a href="http://www.eglibc.org/cgi-bin/viewcvs.cgi/branches/eglibc-2%5F9/libc/sysdeps/posix/system.c?rev=7350&view=markup">here</a>.</p>
|
Ajax jquery confusion <p>This is probably straight forward but I'm a newbie and I need help!
If I make an Ajax request which when successful replaces a section of the DOM with other data, how do I make the new data accessable to jQuery?</p>
| <p>the Data will be available in the parameter you pass to the callback function</p>
<pre><code>$.ajax( {
type:'Get',
url:'http://mysite.com/mywebservice',
sucess:function(data) {
alert(data);
}
})
</code></pre>
<p>Which you could also express using the Ajax shorthand <code>get</code> </p>
<pre><code>$.get('http:/... |
Most Efficient Way to Find Whether a Large List Contains a Specific String (Python) <p>I have a file containing roughly all the words in English (~60k words, ~500k characters). I want to test whether a certain word I receive as input is "in English" (i.e. if this exact word is in the list).</p>
<p>What would be the mo... | <p>The python <a href="http://docs.python.org/library/stdtypes.html#set-types-set-frozenset" rel="nofollow">Set</a> is what you should try.</p>
<blockquote>
<p>A set object is an unordered collection of distinct hashable objects. Common uses include <strong>membership testing</strong>, removing duplicates from a seq... |
Javascript swap array elements <p>Is there any simpler way to swap two elements in an array?</p>
<pre><code>var a = list[x], b = list[y];
list[y] = a;
list[x] = b;
</code></pre>
| <p>You only need one temporary variable.</p>
<pre><code>var b = list[y];
list[y] = list[x];
list[x] = b;
</code></pre>
|
Wrap all <img>'s in <div>, take the alt attribute and add it into a <p> inside <p>Trying to replace <a href="http://jsbin.com/efidu" rel="nofollow">this jquery code</a> with some php server side magic:</p>
<pre><code>$(document).ready(function() {
$('#text img').each(function(){
source = $(this).attr('src');... | <p>I recommend you to use a parser such as <a href="http://docs.php.net/manual/en/class.domdocument.php" rel="nofollow">DOMDocument</a>. In addition with <a href="http://docs.php.net/manual/en/class.domxpath.php" rel="nofollow">DOMXPath</a> you can translate the jQuery code nearly one by one:</p>
<pre><code>$documentS... |
How do I display progress bars from a shell command over ssh <p>I've got a script thats supposed to mimic ffmpeg on my local machine, by sending the command of to a remote machine, running it there and then returning the results.
(see <a href="http://stackoverflow.com/questions/871296/how-do-i-use-ffmpeg-on-a-remote-ma... | <p>On the display side of your question, you can generate an updating progress bar in Ruby using the "\r" string char. This backs you up to the beginning of the current line allowing you to re-write it. For example:</p>
<pre><code>1.upto(100) { |i| sleep 0.05; print "\rPercent Complete #{i}%"}
</code></pre>
<p>Or if ... |
Querying real time data from an SQL database sudden latency problem <p>We are testing an application that is supposed to display real time data for multiple users on a 1 second basis. New data of 128 rows is inserted each one second by the server application into an SQL datatbase then it has to be queried by all users ... | <p>Warning: this answer is based on knowledge of MSSQL 2000 - not sure if it is still correct.</p>
<p>If you do a lot of inserts, the indexes will eventually get out of date and the server will automatically switch to table scans until the indexes are rebuilt. Some of this is done automatically, but you may want to fo... |
JavaScript build options/tools <p>These days I find myself shifting out more and more work to the client side and hence my JS files tend to get bigger and bigger. I have come to the point where most HTML pages have half a dozen or more JS imports in the header and I realised that this is hurting loading times.</p>
<p>... | <p>For PHP I certainly favour doing it dynamically just because if you introduce a build step you're losing one of the main benefits of using PHP. In fact, at the risk of self-promotion I've written <a href="http://www.cforcoding.com/2009/05/supercharging-javascript.html" rel="nofollow">Supercharging Javascript in PHP<... |
Can I use PowerShell in shell-mode for Emacs? <p>Can I use powershell as the shell, in shell mode for emacs?<br />
How?</p>
| <p>See Jeffrey Snover's blog post <a href="http://blogs.msdn.com/powershell/archive/2008/04/15/powershell-running-inside-of-emacs.aspx">PowerShell running inside of Emacs</a></p>
|
512x512 Texture causing huge GPU stress on iPhone, despite tiling <p>I'm testing my simple OpenGL ES implementation (a 2D game) on the iPhone and <strong>I notice a high render utilization</strong> while using the profiler. These are the facts:</p>
<ul>
<li>I'm displaying <strong>only one preloaded large texture</stro... | <p>I'm writing an app which displays five 512x512 textures on top of each other in a 2D environment using GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, and I can get about 14fps. Do you really need 60fps? For a game, I'd think 24-30 would be fine. Also, use PVR texture compression if at all possible. There's an example that do... |
Good Way to Secure File Uploads in PHP <p>Writing a small app that (<em>among other things</em>) lets users upload a file (<em>like an image, a .doc or a text file</em>) as part of their posting/submission.</p>
<p>Our current prototype just dumps the file into <strong>/{app_root}/files/</strong>, but of course, anyon... | <p>You have to do the following:</p>
<ol>
<li>Move all the files out of the webroot. You <em>could</em> disable access to the folder with .htaccess, but it is not worth the hassle and potential security risk. Just move it out there.</li>
<li>Keep a table of the files uploaded, storing the user's original file name the... |
Prettifying a conversion from m(metres) to feet(') and inches ('') <p>I'm creating table for defining an individual's <a href="http://en.wikipedia.org/wiki/Body_mass_index" rel="nofollow">BMI</a>. The chart (as yet) doesn't take input (because I want to make the thing work stand-alone, first), but it does show (on para... | <p>Here is an approach, in psuedo-code:</p>
<pre><code>inches_per_meter = 39.3700787
inches_total = round(meters * inches_per_meter) /* round to integer */
feet = inches_total / 12 /* assumes division truncates result; if not use floor() */
inches = inches_total % 12 /* modulus */
</code></pre>
<p>You could pull ou... |
Python generates an IO error while interleaving open/close/readline/write on the same file <p>I'm learning Python-this gives me an IO error-</p>
<pre><code>f = open('money.txt')
while True:
currentmoney = float(f.readline())
print(currentmoney, end='')
if currentmoney >= 0:
howmuch = (float(inpu... | <p>The <code>while True</code> is going to loop forever unless you break it with <code>break</code>.</p>
<p>The I/O error is probably because when you have run through the loop once the last thing you do is <code>f.close()</code>, which closes the file. When execution continues with the loop in the line <code>currentm... |
xmlns:soap attribute of SOAP element <p>I just now started learning web services.I cannot understand the use of xmlns:soap attribute of SOAP element.Thanks.</p>
| <p>Those "xmlns:" attributes are not specific to SOAP. They define prefixes that will later be used to refer to XML namespaces. Example:</p>
<pre><code><DTS:Executable xmlns:DTS="www.microsoft.com/SqlServer/Dts"
DTS:ExecutableType="SSIS.Package.2">
</code></pre>
<p>This defines DTS as a prefix that means t... |
Saving a web page from IE using Powershell <p>I use the automation interface of Internet Explorer from Powershell to open a web page in a supported format. I want to save this page back to disk in one of the formats supported by IE. Opening the page is easy:</p>
<pre><code>$ie = New-Object -ComObject "InternetExplorer... | <p><a href="http://msdn.microsoft.com/en-us/library/aa752117%28VS.85%29.aspx" rel="nofollow">You want to call ExecWB with the appropriate args</a>:</p>
<pre><code>$ie.ExecWB(4,0,$null,[ref]$null)
</code></pre>
<p>Explanation of the 4 params:</p>
<pre><code>4 = OLECMDID_SAVEAS
0 = OLECMDEXECOPT_DODEFAULT (This can al... |
Query SQL Server from Oracle - force metadata refresh <p>I am a SQL Server developer, with a task in Oracle. DBA set up a DBLink in Oracle that points at a SQL Server database. I am writing a view on the SQL Server data and then a view on the Oracle side to join it with additional Oracle data.</p>
<p>Problem: if I cha... | <p>This sounds like an issue with TOAD, not oracle. What happens if you do it in SQL*Plus?</p>
|
What free admin tools are available for SQL Server Express 2005? <p>I am developing in visual studio 2008 (new) and it would be convenient to to have an Enterprise Manager / SQL Server Development Studio like tool to manage the databases. I am wonder what other developers who don't have acccess to SSDS are using.</p>
| <p><a href="http://www.microsoft.com/downloads/details.aspx?familyid=08E52AC2-1D62-45F6-9A4A-4B76A8564A2B&displaylang=en" rel="nofollow">Microsoft SQL Server Management Studio Express</a></p>
<p>Documentation is <a href="http://msdn.microsoft.com/en-us/library/ms365247.aspx" rel="nofollow">here</a>.</p>
|
crossthread operations error <pre><code> if (listBox1.InvokeRequired)
{
listBox = new StringBuilder(this.listBox1.Text);
}
</code></pre>
<p>This is the code in c# which when executed produces an invalid cross thread operation error for listBox1 which is a listbox in my form.
Could u guys ... | <p>InvokeRequired only tells you that an Invoke is necessary in order to validly access the element. It doesn't make the access legal. You must use the invoke method to push the update to the appropriate thread</p>
<pre><code>Action update = () => listbox = new StringBuilder(this.listBox1.Text);
if (listBox1.Invo... |
Can't redirect output to /var/lib/varlibfile, but I can copy a varlibfile to /var/lib <p>I have a script which is running as root, it's supposed to store it's cache file (only modified by the script) at /var/lib/varlibfile. However the script does not seem to create the file, and my investigation led me to this:</p>
<... | <p>What</p>
<pre><code>$ sudo echo something >/var/lib/varlibfile
</code></pre>
<p>does, is pipe the output of "<code>sudo echo something</code>" to the file. So the file write operation is done as the current user, who doesn't have permission to write in <code>/var/lib</code>.</p>
<p>Try something like</p>
<pre... |
By modifying my DNS records, how can I have "test.mydomain.com" resolve to XXX.XXX.XXX.XXX:8080? <p>First, this is a programming question because I'm trying to set up a test/QA server running alongside a production server.</p>
<p>Second, yes I should post this on Serverfault, but I tried logging in with THREE differen... | <p>DNS A (address) record doesn't have port number. So, not, <strong>that</strong> is not possible.</p>
<p>What's possible is to have another IP for the same machine (e.g. 111.11.11.12) and let test.mydomain.com resolve to it. Then your first server should listen on the first IP only, and second on the second only.</p... |
Crystal Report - avoid Logon after server install <p>How I can fix the Crystal Report to update directly from the datasource.<br>
I'm using dataset to the rpt; after installing the report in another PC in the runtime, when loading the report it shows username and password.<br>
Actually I solved manually in the PC by op... | <p>Make sure you have a valid xsd for your .Net objects and your dataset.</p>
|
Is it possible to use @import in Adobe AIR CSS? <p>Trying to use @import url('myfile.css'); in my css file in Adobe AIR but it's not working.</p>
<p>I have tried variations such as url('file:///myfile.css') and url('file:///abs/path/myfile.css') and none of it seems to be working. </p>
| <p>It works for me, simply:</p>
<pre><code>@import 'myfile.css';
</code></pre>
<p>If this doesnât work (remember, that the path is relative to the CSS file, or HTML document if itâs in a <code>style</code> tag), try using the <code>app://</code> prefix, because thatâs the correct path to your projects document ... |
Do DeleteFile() Or CopyFile() throw exceptions? <p>I use the DeleteFile and CopyFile methods. Do these functions throw exceptions or just set errno and lastError? Do I need to surround this code with try and catch?</p>
| <p>If you're referring to the Win32 API functions, the answer is no. No Win32 functions throw, because it is a C API.</p>
|
C# tree/collection algorithm <p>I need to fill a tree-like UI control with some items (of course in parent-child1-child2-...childN relations) and before proceeding I want to ensure that the my collection that holds the content is ordered properly as follows:</p>
<p>Each object(in this case an instance of my Category c... | <p>I'm not sure if this is what you are looking for but hopefully it will help:</p>
<pre><code>using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class Program
{
public static void Main(string[] args)
{
/* Tree Structure
a
d
e ... |
access private method in a different assembly c# <p>This may be a daft question as I can see the security reason for it to happen the way it does...</p>
<p>I have a licensing c# project, this has a class which has a method which generates my license keys. I have made this method private as I do not want anybody else t... | <p>You could make it an internal method, and use <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx"><code>InternalsVisibleToAttribute</code></a> to give LicensingProject.UI extra access to LicensingProject.</p>
<p>Merhdad's point about enforcement is righ... |
Session Management in TWebModule <p>I am using a TWebModule with Apache. If I understand correctly Apache will spawn another instance of my TWebModule object if all previous created objects are busy processing requests. Is this correct?</p>
<p>I have created my own SessionObject and have created a TStringList to sto... | <p>As Stijn suggested, using a separate storage to hold the session data really is the best way to go. Even better is to try to write your application so that the web browser contains the state inherently in the design. This will greatly increase the ability to scale your application into the thousands or tens of tho... |
Memory management and performSelectorInBackground: <p>Which is right? This:</p>
<pre><code>NSArray* foo = [[NSArray alloc] initWithObjects:@"a", @"b", nil];
[bar performSelectorInBackground:@selector(baz:) withObject:foo];
- (void)baz:(NSArray*)foo {
...
[foo release];
}
</code></pre>
<p>Or:</p>
<pre><code>... | <p>First is wrong. </p>
<p>performSelectorInBackground:withObject: retains both bar and foo until task is performed. Thus, you should autorelease foo when you create it and let performSelectorInBackground:withObject take care of the rest. See <a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation... |
Symbols (pdb) for native dll are not loaded due to post build step <p>I have a native release dll that is built with symbols. There is a post build step that modifies the dll. The post build step does some compression and probably appends some data. The pdb file is still valid however neither WinDbg nor Visual Studi... | <p><a href="http://stackoverflow.com/questions/134866/windbg-dr-watson-minidump-requires-pdb-dll-originally-built-for-installed-vers">This post</a> led me to <a href="http://www.debuginfo.com/tools/chkmatch.html">chkmatch</a>. On the processed dll, chkmatch shows this info:</p>
<pre>
Executable:
TimeDateStamp: 4a0869... |
Designer rejecting DataTemplate.DataType <p>I am try to fit some WPF into my current Windows Forms application. When I use this simple user control, the designer for that control does not reload.</p>
<p>This only happens in this application. If I make a clean Windows Forms project, add these files, the designer works ... | <p>It was caused by having a space in the Assembly name.</p>
|
What's the easiest way to build an appointment booking website? <p>My wife is starting a new business and wants me to create a website for her that will allow clients to book appointments. I could obviously go ahead and start building something from scratch, but given that this is a fairly standard problem, I would pr... | <p>There are extensive tools for the <a href="http://code.google.com/apis/calendar/" rel="nofollow">Google Calendar API</a>. Specifically read the <a href="http://code.google.com/apis/calendar/docs/2.0/developers%5Fguide%5Fprotocol.html" rel="nofollow">Google Calendar Developer's Guide</a>.</p>
|
How to access main window element from iframe <p>I hope someone can help with this issue. I have a popup iframe using lytebox. I would like it that when i click a link in my iframe with the class "mylink" that it executes the ajax call and update a div in my main window with the id "mydiv".
I know how to do the onclick... | <p>You can simply use <code>window.parent.document</code> to access the parent document from the iframe.</p>
<p>jQuery allows you to <a href="http://docs.jquery.com/Core/jQuery#expressioncontext" rel="nofollow">specify a context</a> for searches, so you could then do:</p>
<pre><code>$(myselector, window.parent.docume... |
Partial transparency with C# .NET 3.5 WinForms? <p>I'm making a .NET 3.5 app with a form that draws a partially transparent black background. I'm overriding OnPaintBackground to accomplish this:</p>
<pre><code>protected override void OnPaintBackground( PaintEventArgs e )
{
using ( Brush brush = new SolidBrush( Col... | <p>I think I would call this expected behavior, actually. What I would do is render my background to an in-memory bitmap and, in the paint event, copy that to the form (basic double-buffering).</p>
<p>If I'm way off base, could you post a screenshot? I don't know that I'm imagining what you're describing correctly.</p... |
Why does java.util.Properties implement Map<Object,Object> and not Map<String,String> <p>The <code>java.util.Properties</code> class is meant to represent a map where the keys and values are both Strings. This is because <code>Properties</code> objects are used to read <code>.properties</code> files, which are text fil... | <p>Because they did it in a hurry in the early days of Java, and didn't realise what the implications would be four versions later.</p>
<p>Generics were supposed to be part of the design of Java from the beginning, but the feature was dropped as being too complicated and, at the time, unnecessary. As a result, lots of... |
How to display an image in a fixed div to make a scrollable image panel? <p>i am making a photo gallery script that involves displaying an image in fixed width/height box. now i want that image to display in its complete size. i mean, if the box is 700x300 px, the image should not resize to 700x300 but should display a... | <p>To make a draggable pane you need two elements, an outer div to act as a container, and an inner div to act as a 'canvas'. The outer container needs to have its style set to <code>overflow: hidden</code>.</p>
<pre><code><div id="drag-container">
<div id="drag-canvas"><img></div>
</di... |
How do I clear this array pointer in C? <p>I'm trying do to a basic bash with the use of system calls but I'm having some little problems with a pointer array.</p>
<p>To resume my code, I read commands from the stdin with read() to a buffer then I use strsep() to separate the command from the arguments and all the arg... | <pre><code>int i;
for (i = 0; i < 10; i++)
pArgs[i] = NULL;
</code></pre>
|
Unloading XIB from memory <p>So here's my setup:</p>
<ul>
<li>User spins PickerWheel, chooses which section of the app to navigate to.</li>
<li>The app loads a UIViewController from a XIB file and pushes it on to the navigationController stack</li>
<li>User can pop back at anytime and choose another section to navigat... | <pre><code>viewController.view = nil;
</code></pre>
<p>If <code>view</code> is nil on a NIB-controlled UIViewController, then it will automatically reload the NIB the next time it's requested. This is exactly how <code>-didReceiveMemoryWarning</code> works.</p>
<p>As I think about this more, this won't immediately dr... |
GitPython and sending commands to the Git object <p><a href="http://gitorious.org/git-python" rel="nofollow">GitPython</a> is a way of interacting with git from python. I'm trying to access the basic git commands (e.g. <code>git commit -m "message"</code>) from this module, which according to <a href="http://pysync.goo... | <p>I havn't tried it to verify yet but it seems git.Git.execute expects a list of commandline arguments (if you give it a string it'll look for an executable exactly matching the string, spaces and everything - which naturally wouldn't be found), so something like this I think would work:</p>
<pre><code>import git
imp... |
How do I get the application name from within a dll? <p>If I had a dll (foo.dll) that was LoadLibrary'd into an application (bar.exe), how do I get the string "bar.exe" from within foo.dll?</p>
| <p>Pass NULL as the first parameter to <a href="http://msdn.microsoft.com/en-us/library/ms683197%28VS.85%29.aspx" rel="nofollow">GetModuleFileName()</a>.</p>
|
Print space after each word <p>what is an easy/effective way to combine an array of words together with a space in between, but no space before or after?</p>
<p>I suppose it is possible to remove the space after combining everything in a loop (something like sum += (term + " "))...I don't like it though.</p>
<p>Prefe... | <p>Well, in Python it will be straightforward using <strong>join</strong>:</p>
<pre><code>values = ["this", "is", "your", "array"]
result = " ".join(values)
</code></pre>
|
Trouble print meta tags with ASP.NET MVC <p>I'm trying to make a meta tag in my view based on data in my model...my view code looks like this:</p>
<pre><code><meta name="description" content="<%=Html.Encode(Model.MetaDescription) %>" />
</code></pre>
<p>But my output looks like this: </p>
<pre><code>met... | <p>You are probably adding this <code>meta</code> tag to a <code><head></code> tag which is marked at <code>runat="server"</code>. Try: </p>
<pre><code><meta name="description" content='<%=Html.Encode(Model.MetaDescription) %>' />
</code></pre>
<p>I don't have a clear idea about what the actual prob... |
getResourceAsStream not working for every class? <p>I have a jar file that uses some txt files. In order to get them it uses <code>Class.getResourceAsStream</code> function.</p>
<pre><code>Class A
{
public InputStream getInputStream(String path) throws Exception {
try {
return new FileInputStream(path);... | <p>I suspect this is more to do with packages than inheritance.</p>
<p>If your class is in a package, then <code>getResourceAsStream()</code> will be relative to that package unless you start it with "/" (which makes it an "absolute" resource). An alternative is to use <code>getClass().getClassLoader().getResourceAsSt... |
ASP.NET web application - 5000 lines of code in 1 page - acceptable? <p>I'm building an ASP .NET 2.0 (C#) based web application, which is primarily intended for intra-net use, i.e. to be used inside an organization's Local Area Network.</p>
<p>With respect to the User Interface, there are 2 approaches which I need to ... | <p>Before I say what I intend to say I would like to state that I do not think this is a good idea. Any class (ASP.NET) or not that is 5k or 10k lines long needs to be refactored.
There are a lot of comments here that keep stating that your download times will be too long. Just because you have an .aspx file that has 5... |
Ways to determine returning "anonymous" guests in PHP <p>Two types of users visit my website: registered users and guests. Registered users are tracked and retained by PHP session, cookies and individual logins. Guests I find trickier to manage so I give little to no authority to contribute content.</p>
<p>I want to o... | <p>I think cookies would probably be the best option here as it's the only way you are going to be 100% sure requests are unique. Of course, you could possibly add a mix: if cookies are disabled you might be able to try other options of identification such as the IP address method, but that could make it overly-complex... |
Are there any USB stick runnable, no-install, cross platform software frameworks (with GUI)? <p>Does anyone know of a good software development framework or similar that has the following properties?</p>
<ul>
<li>Cross platform: it should be runnable on XP, Vista, OSX and common versions of Linux (such as Ubuntu and K... | <p>You mention <a href="http://www.wxwidgets.org" rel="nofollow">wxWidgets</a> but dismiss it as failing at least one of the requirements.</p>
<p>I don't know what your requirements are and in what way wxWidgets wouldn't work for you, but IMO it does fulfill them:</p>
<blockquote>
<p>Cross platform: it should be ru... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.