instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>In C++, is the return type considered part of the function signature? and no overloading is allowed with just return type modified.</p>
<p>Normal functions do not include the return type in their signature.</p> <p><sub>(<em>note</em>: i've rewritten this answer, and the comments below don't apply to this revision - see the edit-history for details).</sub></p> <h3>Introduction</h3> <p>However, the matter about functions and function declarations in the ...
<p>I find a useful way to implicitly make the return type part of a signature is to include a 'dummy' argument in the inputs.</p> <p>For example:</p> <pre><code>template &lt;typename T&gt; T f(double x, T dummy) { T output; output = x * 2; return output; } </code></pre> <p>In this case, if you want a double out...
36,960
<p>I thought I'd found the solution a while ago (see my <a href="https://tjrobinson.net/programming/technology/2006/09/03/cant-execute-code-from-a-freed-script.html" rel="noreferrer">blog</a>):</p> <blockquote> <p>If you ever get the JavaScript (or should that be JScript) error "Can't execute code from a freed scrip...
<p>You get this error when you call a function that was created in a window or frame that no longer exists. </p> <p>If you don't know in advance if the window still exists, you can do a try/catch to detect it:</p> <pre><code>try { f(); } catch(e) { if (e.number == -2146823277) // f is no longer available ...
<p>I got this error in IE9 within a page that eventually opens an iFrame. As long as the iFrame wasn't open, I could use localStorage. Once the iFrame was opened and closed, I wasn't able to use the localStorage anymore because of this error. To fix it, I had to add this code to in the Javascript that was inside the iF...
10,883
<p>I am investigating the design of a work queue processor where the QueueProcessor retrieves a Command Pattern object from the Queue and executes it in a new thread.</p> <p>I am trying to get my head around a potential Queue lockup scenario where nested Commands may result in a deadlock.</p> <p>E.G.</p> <p>A FooCom...
<p>For simple cases like this an additional monitoring thread that can spin off more threads on demand is helpful.</p> <p>Basically every N seconds check to see if any jobs have been finished, if not, add another thread.</p> <p>This won't necessarily handle even more complex deadlock problems, but it will solve this ...
<p>If you are building the Queue object yourself there are a few things you can try:</p> <ol> <li>Dynamically add new service threads. Use a timer and add a thread if the available thread count has been zero for too long.</li> <li>If a command is trying to queue another command and wait for the result then you should ...
15,297
<p>I know that in the original C++0x standard there was a feature called <code>export</code>.</p> <p>But I can't find a description or explanation of this feature. What is it supposed to do? Also: which compiler is supporting it?</p>
<p>Although Standard C++ has no such requirement, some compilers require that all function templates need to be made available in every translation unit that it is used in. In effect, for those compilers, the bodies of template functions must be made available in a header file. To repeat: that means those compilers won...
<p><a href="http://www.codeproject.com/KB/mcpp/stdexport.aspx" rel="nofollow noreferrer">Standard Features Missing From VC++ 7.1. Part II: export</a></p>
35,303
<p>If I am iterating over each file using :</p> <pre><code>@echo off FOR %%f IN (*\*.\**) DO ( echo %%f ) </code></pre> <p>how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code : <code>echo "%t:~-3%"</code> to print but with no success.</p>
<p>The FOR command has several built-in switches that allow you to modify file names. Try the following:</p> <pre><code>@echo off for %%i in (*.*) do echo "%%~xi" </code></pre> <p>For further details, use <code>help for</code> to get a complete list of the modifiers - there are quite a few!</p>
<p><a href="https://stackoverflow.com/questions/138819#138847">Sam</a>'s answer is definitely the easiest for what you want. But I wanted to add:</p> <p>Don't <code>set</code> a variable inside the <code>()</code>'s of a <code>for</code> and expect to use it right away, unless you have previously issued</p> <pre><cod...
16,807
<p>I have created a class to dynamically put together SQL function statements within a project. I have found this class to be pretty useful and would like to incorporate into future projects</p> <p>namespace connectionClass</p> <p>{</p> <pre><code> public class connClass { NpgsqlConnection conn = new N...
<p>Or simply make use of the Configuration Manager Connection Strings property:</p> <pre><code>String connStr = ConfigurationManager.ConnectionStrings["DefaultConnStr"].ConnectionString; </code></pre> <p>Then setup your app.config like so:</p> <pre><code>&lt;configuration&gt; &lt;connectionStrings&gt; &...
<p>One option is to have the connection class use the ConfigurationManager to get the name from the App.Config file - but this still means setting the name in there. Something like</p> <pre><code>ConfigurationManager.AppSettings["PROJECT_NAME"]; </code></pre>
39,238
<p>I'm using a <code>Dictionary&lt;string, int&gt;</code> where the <code>int</code> is a count of the key.</p> <p>Now, I need to access the last-inserted Key inside the Dictionary, but I do not know the name of it. The obvious attempt:</p> <pre><code>int LastCount = mydict[mydict.keys[mydict.keys.Count]]; </code></p...
<p>As @Falanwe points out in a comment, doing something like this is <strong><em>incorrect</em></strong>:</p> <pre><code>int LastCount = mydict.Keys.ElementAt(mydict.Count -1); </code></pre> <p>You <strong>should not</strong> depend on the order of keys in a Dictionary. If you need ordering, you should use an <a href...
<p>Visual Studio's <a href="https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/16494583-generic-ordereddictionary" rel="nofollow noreferrer">UserVoice</a> gives a link to <a href="https://github.com/mattmc3/dotmore/blob/master/dotmore/Collections/Generic/OrderedDictionary.cs" rel="nofollow ...
2,623
<p>I have a multi-user application that keeps a centralized logfile for activity. Right now, that logging is going into text files to the tune of about 10MB-50MB / day. The text files are rotated daily by the logger, and we keep the past 4 or 5 days worth. Older than that is of no interest to us.</p> <p>They're rea...
<p>I think that logging directly to a database is usually a bad idea, and I would avoid it.</p> <p>The main reason is this: a good log will be most useful when you can use it to debug your application post-mortem, once the error has already occurred and you can't reproduce it. To be able to do that, you need to make s...
<p>I could see it working well, provided you had the capability to filter <em>what</em> needs to be logged and <em>when</em> it needs to be logged. A log file (or table, such as it is) is useless if you can't find what you're looking for or contains unnecessary information.</p>
25,712
<p>I need to send hundreds of newsletters, but would like to check first if email exists on server. It's called <a href="http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol" rel="noreferrer">SMTP</a> validation, at least I think so, based on my research on Internet. </p> <p>There's several libraries that can d...
<p>Be aware that most MTAs (Mail Transfer Agent) will have the VRFY command turned off for spam protection reasons, they'll probably even block you if you try several RCPT TO in a row (see <a href="http://www.spamresource.com/2007/01/whatever-happened-to-vrfy.html" rel="noreferrer">http://www.spamresource.com/2007/01/w...
<p>You may need this <a href="http://www.componentsoft.net/component/emailvalidator.net/" rel="nofollow noreferrer">Email Validator component for .NET</a></p> <p>Here is the code example:</p> <pre><code> // Create a new instance of the EmailValidator class. EmailValidator em = new EmailValidator(); em.Messag...
4,707
<p>In one of the system (Windows), if I ping to a particular public forum site, [lets say testsite.com here], then I get a request timed out message. However, if I just put that site address in the browser (used IE6, but its not specific) with http://, then the link works fine and the browser goes to the web page. What...
<p>The site may be behind a firewall that blocks ICMP requests (e.g., ping). HTTP requests that your browser sends out goes over TCP/IP.</p>
<p>It's not the browser. There could be a firewall between you and the server that's blocking the ping requests or the server simply may not be responding to pings. It's a common security measure.</p>
27,194
<p>When I build my <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> web application I get a .dll file with the code for the website in it (which is great) but the website also needs all the .aspx files and friends, and these need to be placed in the correct directory structure. How c...
<p>One solution appears to be Web Deployment Projects (WDPs), an add-on for Visual Studio (and msbuild) available that builds a web project to a directory and can optionally merge assemblies and alter the web.config file. The output of building a WDP is all the files necessary to deploy the site in one directory.</p> ...
<p>Have you tried right clicking the website in Solution Explorer and clicking 'Publish Website'?</p>
7,905
<p>I'm using a WPF MediaElement to render HD video in an application. When the size of the MediaElement gets over about 300 units square the video stutters and the computer is nearly totally unresponsive. I need to render the video full screen.</p> <p>Has anybody had success rendering fullscreen video using the WPF ...
<p>Jeremiah Morrill has recently released a <a href="http://www.codeplex.com/WPFMediaKit" rel="nofollow noreferrer">specialized WPF library</a> that supports displaying HD Media (among other features)</p>
<p>It sure doesn't seem to work correctly. It may be that testing for the opacity of other layers slows it down too much. Have you tried running the test with Aero turned off?</p> <p>It has been suggested that hosting Windows Media Player may be the way to go.</p> <p><a href="http://msdn.microsoft.com/en-us/library...
18,091
<p>I would like to be able to control a flash movie stream using JavaScript in the same pages as the flash component including:</p> <ul> <li>Play and Pause stream</li> <li>Change Stream</li> </ul> <p>I can already load the player and set the flash args, but I don't know how to interact with the player once the stream...
<p>The SWF needs to expose functions to Javascript using the ExternalInterface API from the Flash libraries. This allows Javascript to call into Flash and vice-versa.</p> <p><a href="http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html" rel="noreferrer">http://livedocs.adobe.com/flex/3/langr...
<p>"Is this possible without modifying the SWF that is currently used to play the movie" .. it's only possible if the SWF you are using implements the ExternalInterface with documented functions suitable to your needs - as described by cliff.meyers ... otherwise, .... no</p>
42,533
<p>I have this code inside a class that is used by an application and by an applet.</p> <pre><code>static { if (System.getProperty("os.name").startsWith("Windows")) { System.loadLibrary("extmapi"); } } </code></pre> <p>Unfortunately, when the applet loads this code I get an error, because it can't...
<p>You need to understand that MVC doesn't directly reference .aspx pages like WebForms in its URLs. Its main purpose is to separate concerns, that is model (data), controller (logic), and view (presentation).</p> <p>First, you'd have to create a route matching your URLs, which would now look like this for example : /...
<p>You can use a simple javascript in the button's onclick to redirect to the search page:</p> <pre><code>Search &lt;input type="text" id="go" size="4" /&gt;&lt;input type="button" value="&lt;%=Html.Encode("&gt;&gt;") %&gt;" onclick="javascript:window.location='&lt;%=Url.Action("Search", "Home") %&gt;/' + document.get...
43,207
<p>In Flash, there seem to be two sets of mouse click events:</p> <ul> <li>onMouseUp, onMouseDown</li> <li>onPress, onRelease</li> </ul> <p>Is there any actual difference between these events? I can't tell from the documentation, and I haven't noticed anything in actual usage, but it seems odd to have two different ...
<p>onMouseDown and onMouseUp are general events that anything can listen to via Mouse.addListener(). They get triggered no matter where the mouse is clicked.</p> <p>onPress and onRelease are specific to a particular MovieClip. They only get triggered if the mouse is pressed or released while on top of that MovieClip. ...
<p>onPress and onRelease are hold overs from AS2 code, they have been supplanted by onMouseDown and onMouseUp in AS3, which you can read about in the <a href="http://livedocs.adobe.com/flex/2/langref/migration.html" rel="nofollow noreferrer">AS2 Migration Guide</a>.</p>
24,100
<p>How do you extract an RT_RCDATA section from a Win32 executable (preferably in C#)?</p> <p>The only way I know how to do this currently is opening up the EXE in Visual Studio. I'd love to be able to do this entirely in C# if possible.</p> <p>Thanks!</p>
<p>P/Invoke LoadResource will be your safest bet. </p> <p>Otherwise you'll have to write your own <a href="http://en.wikipedia.org/wiki/Portable_Executable_Format" rel="nofollow noreferrer">P/E</a> processor eg. <a href="http://www.devsource.com/c/a/Architecture/Retrieve-Resources-PE-II/" rel="nofollow noreferrer">PE...
<p>I assume that you are trying to read a resource of type RCDATA from an executable (be aware that "executable section" means a different thing - it refers to the .text, .data, .rdata, etc parts of the PE file). If you want to read it from the current assembly, here is a tutorial showing how: <a href="http://www.attil...
14,491
<p>I'm having a strange problem in Visual Studio 2008 where my "Pending Checkins" window never updates. I open it up, and it says "Updating..." like usual, but I never see the "X remaining" message, and nothing happens. It just sits there doing nothing.</p> <p>Checked-out stuff still shows as checked out in Solution...
<p>Hooray! I found a solution. For anyone else that stumbles across this, here's the deal.</p> <p>I discovered today that the Pending Checkins window wasn't broken for <em>all</em> solutions, but only for a particular one. Also, though I didn't realize it was related, every time I opened the solution, I was getting...
<p>Have you tried the Visual SourceSafe 2005 Update patch?</p>
14,750
<p>It seems like IDataReader.Read() is always true at least one time (If I'm wrong about this let me know.) So how do you tell if it has no records without just wrapping it in a try/catch?</p>
<pre><code>if(dr.Read()) { //do stuff } else { //it's empty } </code></pre> <p>usually you'll do this though:</p> <pre><code>while(dr.Read()) { } </code></pre>
<p>You can just cast <code>System.Data.IDataReader</code> to <code>System.Data.Common.DbDataReader</code> </p> <pre><code>using (System.Data.IDataReader IReader = ICommand.ExecuteReader()) { if (((System.Data.Common.DbDataReader)IReader).HasRows) { //do stuff } } // End Using IReader </code></pre>...
7,402
<p>I'm having issues with ripples on the first layer of big flat prints. The initial corner of a big flat print is fine, but then ripples begin to form as shown in the screenshot.</p> <p>I'm just a newbie, so I was thinking they might have something to do with heat or contraction or something. Normally, I use the defa...
<p>The main problem is solved (first layer thickness vs leveled nozzle height).</p> <p>The following image shows the problem. I was running with a default 0.3 mm first layer (the tooltip setting says a slightly thicker layer helps with adhesion). The build plate was correctly leveled with &quot;midrange&quot; friction ...
<ol> <li><p>The first that I have in mind was connected with an acceleration, so you could play with it (set to half the current value and see the results)</p></li> <li><p>The other source of that could be drive belt that is fiddling a little bit on the motor and idler shaft (visual check for any play on the motor/shaf...
1,073
<p>I need to replace the lid of my water kettle and am searching for a filament, that is suitable for this purpose. The requirements are:</p> <ol> <li>Stable at 100°C (212°F)</li> <li>Resistant to steam/moisture</li> <li>Food-safe</li> </ol> <p>Has anyone experimented with this or similar purposes?</p>
<p>Referring to the table provided in 0scar's answer, the key challenge with high temperature materials is the gap between the glass transition temperature (bed temperature) and the extruder temperature.</p> <p>Polycarbonate for example is listed as usable up to 121°C, printing on a bed at 80-120°C, but requiring an e...
<p>There are few materials that go up to that temperature and beyond.</p> <p>A very nice generic overview is given by <a href="https://www.simplify3d.com/support/materials-guide/properties-table/" rel="nofollow noreferrer">Simplify3d</a>:</p> <p><em>This figure shows an overview of many of the used materials in 3D pr...
976
<p>What is the difference between these two pieces of code</p> <pre><code>type IInterface1 = interface procedure Proc1; end; IInterface2 = interface procedure Proc2; end; TMyClass = class(TInterfacedObject, IInterface1, IInterface2) protected procedure Proc1; procedure Proc2; end; </cod...
<p>First off, I'm assuming that the second example's declaration for IInterface2 is a typo and should be</p> <pre><code>IInterface2 = interface(Interface1) </code></pre> <p>because inheriting from itself is nonsensical (even if the compiler accepted it).</p> <p>And "inheriting" is the key word there for answering yo...
<p>Assuming you meant</p> <pre><code>... IInterface2 = interface(Interface1) ... </code></pre> <p>I interpret it the same as you, <strong>the second form requires a class implementing Interface2 to implement Interface1 as well</strong>, while the first form does not.</p>
19,667
<p>I have a server with two different network interfaces, each with a different IP address. How can I create a socket so it'll go out a specific IP address?</p> <p>I'd prefer a python example, but the question is language agnostic, so shoot away.</p> <p>EDIT: Please don't give me "You can't" as an answer. I mean, it ...
<p>You can certainly bind a socket to a specific device.</p> <p>I don't know how to do it in python, but using the berkeley socket api (in C) you need to call <code>setsockopt()</code>, using the option <code>SO_BINDTODEVICE</code>.</p> <p>You pass in an interface descriptor, which is of type <code>struct ifreq</code...
<pre><code>import socket s = socket.socket() s.bind((get_ip_address('eth0'), 0)) </code></pre> <p>from <a href="http://www.quora.com/Which-Python-library-allows-us-to-specify-network-interface-to-connect-to-the-Internet" rel="nofollow">Quora</a></p>
43,538
<p>I'm using WatiN, NUnit and ReSharper to run my ASP.NET unit tests inside Visual Studio. I'd like (if it's not already running) to start Cassini to run my tests against.</p> <p>Is this possible? How would I do it?</p>
<p>I just released the CassiniDev 3.5.1/4.0.1 beta with a simple test fixture example if you are interested. </p> <p>Cassini for Developers and Testers: <a href="http://cassinidev.codeplex.com" rel="nofollow noreferrer">http://cassinidev.codeplex.com</a></p> <p>Mo betta, word.</p>
<p>The Cassini server is WebDev.WebServer.EXE. There are several blogs that show how to start it manually. Here is one:</p> <p><a href="http://www.dotnetjunkies.com/WebLog/saravana/archive/2005/06/18/126143.aspx" rel="nofollow noreferrer">http://www.dotnetjunkies.com/WebLog/saravana/archive/2005/06/18/126143.aspx</a><...
42,573
<p>What would be best practice to localize your ASP.NET MVC application?</p> <p>I would like to cover two situations:</p> <ul> <li>one application deployment in IIS which would handle multiple languages</li> <li>one language/application deployment.</li> </ul> <p>In first situation should you go with some kind of vie...
<p>You can also take a look here <a href="http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html" rel="noreferrer">ASP.NET MVC 2 Localization complete guide</a> and <a href="http://helios.ca/2010/02/17/asp-net-mvc-2-model-validation-with-localization/" rel="noreferrer">ASP.NET MVC 2 Model Validatio...
<p>And another tutorial for different solution</p> <p><a href="http://blog.kosev.net/2010/06/tutorial-create-aspnet-mvc-localization.html" rel="nofollow noreferrer">Tutorial: Create ASP.NET MVC localization with language detection</a></p>
23,389
<p>What good-practice-indicating idioms do you look for in a sequence of method invocations, as depicted on sequence diagrams?</p>
<p>Look for the telltale central controller. A well-factored system will tend to have an even allocation of responsibilities among the classes. A poorly factored system instead tends to have a sequence diagram with many messages going to or from a class in the middle, which is frantically getting messages, making dec...
<p>I would say the same as for good software-engineering:</p> <ul> <li>Naming (of Classes and Methods not of instance names)</li> <li>How many paramters do the methods have (if shown)?</li> <li>Do the call-chain makes sense regarding to the detail level (e. g. is the graining to fine or to rough?)</li> </ul>
48,440
<p>I'm writing a little arcade-like game in C++ (a multidirectional 2d space shooter) and I'm finishing up the collision detection part.</p> <p>Here's how I organized it (I just made it up so it might be a shitty system):</p> <p>Every ship is composed of circular components - the amount of components in each ship is ...
<p>You should absolutely try to avoid doing memory allocations for your component-vector on each call to the getter-function. Do the allocation as seldom as possible, instead. For instance, you could do it when the component composition of the ship changes, or even more seldom (by over-allocating).</p> <p>You could of...
<ol> <li>You can start by just returning a vector, and benchmark it. Who knows, it could be fast enough. With a profiler you can even see what part takes the run time.</li> <li>You can use a <a href="http://en.wikipedia.org/wiki/Memory_pool" rel="nofollow noreferrer">Memory Pool</a> to reuse vectors and reduce copying<...
43,197
<p>I've been using maven2 and hudson for a while to do my continuous integration, but I find that Eclipse and Maven do not play well together. Sure there's a plugin, but it's cranky to mash the maven project into something that eclipse likes and the build times and unit test are too long. I'm considering switching back...
<p>I managed find a good solution. I simply got infinitest (can be installed from the Eclipse marketplace) to work when using maven and eclipse</p> <p>In Eclipse->Project Properties->Java Build Path->Source uncheck the box called: "Allow output folders for source folders"</p> <p>That will enable your project to have ...
<p>I've had fair success using Eclipse + Ant with CruiseControl. If you want automation, you're probably going to need more than just pure Eclipse.</p> <p>CruiseControl can automatically check out a copy of your project from source control, build it, run tests, and then update a web application with the results. It ...
19,487
<p>There's a diagram depicting the difference between traditional MVC and Cocoa MVC here:</p> <p><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html#//apple_ref/doc/uid/TP40002974-CH6-SW1" rel="nofollow noreferrer">Cocoa Design Patterns: The...
<p>There's no reason <strong>not</strong> to do it that way, if it makes more sense to you. Be aware that a lot of things in the Cocoa framework are the way they are due to higher-level design decisions, for example favoring composition and delegation over subclassing.</p> <p>If you want, you can design C# software th...
<p>Isn't the "Cocoa version of MVC" the pattern used in ASP.NET MVC? So far, all the examples have pointed to communication b/w view and model through the controller with no direct interaction between V and M. Am I understanding this incorrectly?</p>
12,112
<p>I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.</p> <pre><code>private Hashtable htSettings_m = new Hashtable(); htSettings_m.Add("SizeWidth", "728"); htSettings_m.Add("SizeHeight", "450"); string sKey...
<p>you could read the collection of keys into another IEnumerable instance first, then foreach over that list</p> <pre><code> System.Collections.Hashtable ht = new System.Collections.Hashtable(); ht.Add("test1", "test2"); ht.Add("test3", "test4"); List&lt;string&gt; keys = new List&lt;...
<p>Maybe you can use Hashtable.Keys collection? Enumerating through that might be possible while changing the Hashtable. But it's only a guess...</p>
42,330
<p>I'm working on an iPhone application that would allow viewing and editing of data that I want to keep in sync with a desktop application. I don't see anything in the SDK that directly addresses data synchronization, nor can I find anything that allows my to "hook" into the iTunes sync process.</p> <p>I could do som...
<p>The two popular methods are:</p> <p>Sync with a desktop app directly via WiFi (using Bonjour etc. to discover the iPhone/desktop app endpoints as others have suggested here).</p> <p>The other option is to sync with a shared file location - either FTP, MobileMe, WebDAV, web services on another server, etc. So the ...
<p>I'm also working on an application that needs to share data, the only reasonable/non hack way I found to get information in and out of the iPhone is through NSURLConnection. </p> <p>(personal opinion) I don't foresee Apple providing hooks to the sync process.(/personal opinion)</p>
22,462
<p>I have created a clickonce deployment and published it to a website. I want to put the installer (version 1.0.0) on a cd for distribution to clients. A setup.exe was created in the route of the published folder but this is very small and cannot be the whole thing required for a cd. </p> <p>I passed this on to a co ...
<p>I think you need all the files in that folder, not just the setup.exe file.</p> <blockquote> <p>Application Files<br> autorun.inf<br> install.html<br> YourApp.application<br> setup.exe </p> </blockquote> <p>In the Application Files folder, I believe you can omit the old versions.</p>
<p>Just FYI, the setup.exe is the prerequisites, not the applicaiton. The .application file is the deployment manifest that is used to install the application. It will in turn call setup.exe for any prerequisites you have set up.</p>
34,203
<p>In .NET, is there a tool or some other method which would allow us to modify an assembly's manifest, without having to modify the AssemblyInfo and re-build the assembly?</p>
<p>You can use a binary editor to modify the manifest. I've used UltraEdit to open dlls and modify the manifest. It is a plain text section of the PE file - usually located near the end of the file.</p> <p>Also, you typically can not use this method to add to the assembly. It is safe for changing bytes but not addi...
<p>You could use the IL disassembler/assembler tools as described here:</p> <blockquote> <p><a href="http://www.codeproject.com/KB/msil/ManifestEdit.aspx" rel="nofollow noreferrer">Editing an assembly's manifest and more...</a></p> </blockquote>
40,932
<p>Well, I must be brain-damaged, because I can't find the java source for Sun's persistence.jar or JBoss's ejb3-persistence.jar JPA package. They <em>are</em> open-source aren't they?</p> <p>I looked all over the java.sun.com site as well as the GlassFish wiki, but came up empty.</p> <p>I'd like a src.zip or folder...
<p>I just did a search on <a href="http://www.mvnrepository.com" rel="noreferrer">http://www.mvnrepository.com</a> for persistence api</p> <p><a href="http://mirrors.ibiblio.org/pub/mirrors/maven2/javax/persistence/persistence-api/1.0/persistence-api-1.0-sources.jar" rel="noreferrer">http://mirrors.ibiblio.org/pub/mir...
<p>If all you're looking for is something to attach in eclipse, an SVN checkout should be all that you need, though I realise that this isn't exactly the answer you're looking for. The source for the JPA API for jboss can be found in <a href="http://anonsvn.jboss.org/repos/hibernate/jpa-api/" rel="nofollow noreferrer">...
39,638
<p>I'd like to be able to write a ruby program that can restart without dropping it's socket connections.</p>
<p>This program gets Google's homepage and then when you pass it SIG_INT via <kbd>Ctrl</kbd>-<kbd>C</kbd> it restarts the program and reads the output of the homepage from the open socket with Google.</p> <pre><code>#!/usr/bin/ruby #simple_connector.rb require 'socket' puts &quot;Started.&quot; if ARGV[0] == &quot;re...
<p>You're talking about network sockets, not UNIX sockets I assume?</p> <p>I'm not sure this suits your needs, but the way I would do it is by seperating the networking and logic part, and only restart the logic part, then reconnect the logic part to the networking part.</p>
5,947
<p>I need to avoid being vulnerable to SQL injection in my ASP.NET application. How might I accomplish this?</p>
<p>Even though your question is very generic, a few rules always apply:</p> <ul> <li>Use parameterized queries (<code>SqlCommand</code> with <code>SqlParameter</code>) and put user input into parameters.</li> <li>Don't build SQL strings out of unchecked user input.</li> <li>Don't assume you can build a sanitizing rout...
<p>Try to use Stored Procedures, and validate the input on your data. Do not use any direct SQL like INSERT INTO ...</p>
39,226
<p>Need a refresher on bits/bytes, hex notation and how it relates to programming (C# preferred).</p> <p>Looking for a good reading list (online preferably).</p>
<p>There are several layers to consider here:</p> <ul> <li>Electronic</li> </ul> <p>In the electronic paradigm, everything is a wire.</p> <p>A single wire represents a single bit. </p> <p>0 is the LOW voltage, 1 is the HIGH voltage. The voltages may be <code>[0,5], [-3.3, 3], [-5, 5], [0, 1.3]</code>, etc. The key ...
<p>A bit is either 1 or 0.</p> <p>A byte is 8 bits. </p> <p>Each character in hex is 4 bits represented as 0-F</p> <ul> <li>0000 is 0 </li> <li>0001 is 1</li> <li>0010 is 2</li> <li>0011 is 3</li> <li>...</li> <li>1110 is E</li> <li>1111 is F</li> </ul> <p>There's a pretty good intro to C#'s bit-munching operations...
25,294
<p>I am used to writing C# Windows applications. However, I have some free hosted PHP webspace that I would like to make use of. I have a basic understanding of PHP but have never used its object-oriented capabilities.</p> <p>Is there an easy way to convert C# classes to PHP classes or is it just not possible to write ...
<p>It is entirely possible to write a PHP application almost entirely in an object-oriented methodology. You will have to write some procedural code to create and launch your first object but beyond that there are plenty of MVC frameworks for PHP that are all object-oriented. One that I would look at as an example is <...
<p>I don't know about a tool to automate the process but you could use the Reflexion API to browse your C# class and generate a corresponding PHP class.</p> <p>Of course, the difficulty here is to correctly map C# types to PHP but with enough unit testing, you should be able to do what you want.</p> <p>I advice you t...
3,459
<p>Is it possible to embed the Windows Explorer file/folder browser view in a WPF or a WinForms window?</p> <p>I basically want to host the file/folder browser as part of my app window. I don't want to re-implement what the shell provides, especially the shell extensions such as TortoiseSVN.</p>
<p>As far as I know, there isn't any File/Folder browser control out of the box in Windows Forms nor WPF.<br/> However there are commercial third-party controls that offer a Windows Explorer-like interface to browse files and folders on disk. Take a look at these products from LogicNP:</p> <ul> <li><a href="http://www...
<p>The approach in my answer isn't one I would necessarily recommend, as it is basically a huge hack. However, it is possible to 'host' pretty much any Windows application inside another. Caveats:</p> <ul> <li>This is a big fat hack</li> <li>I'm not sure at all how well it plays with the various security features that...
43,055
<p>I'm looking for a method to grep for multiple atoms e.g. "foo" and "bar". I'm aware i can use <br /> <code>grep 'foo' file | grep 'bar'</code><br /> to get both of them but i was wondering if there was a more efficient way. Any googleing seems to only throw results for an 'or' based search rather than 'and'. </p...
<p>I doubt you'll get a more efficient way than the one you've selected. Given that the grep executable will already be mapped into memory when the second copy runs, and that you have no backtracking in your regex (unlike an <code>egrep 'foo.*bar|bar.*foo'</code> obvious solution), I think what you have is a fast as yo...
<p>This might be efficient. :) Loading <code>grep</code> again is probably free due to caching at the file system level. And, assuming the number of hits is small (in comparison to the number of lines of input), and most lines that contain 'foo' are going to be hits for 'bar' too, the second instance of <code>grep</cod...
43,706
<p>How can I use command line arguments in a <em>creationComplete</em> event handler? It seems the <em>invoke</em> event happens in my AIR app <strong>after</strong> creationComplete gets called, so I can't use the args in that function, although I really would like to. Any other event that might always fire <strong><e...
<p>I don't think that will be possible. I just checked the sources and the invokes are set up in an enterframe handler AFTER the creationcomplete event has fired. You could perhaps subclass WindowedApplication and try to change that order, but there will probably be a good reason why it is implemented that way.</p> <p>...
<p>While Christophe is right, you can actually get your parameters before creation complete. As Christophe said, in a WindowedApplication, invokeEvents are queued during initialization and dispatched after creation complete. However, you can perfectly listen for the invoke event of the underlying NativeApplication obj...
27,410
<p>WPF, Browserlike app.<br> I got one page containing a ListView. After calling a PageFunction I add a line to the ListView, and want to scroll the new line into view:</p> <pre><code> ListViewItem item = ItemContainerGenerator.ContainerFromIndex(index) as ListViewItem; if (item != null) ScrollIntoView(item); <...
<p>I think the problem here is that the ListViewItem is not created yet if the line is not visible. WPF creates the Visible on demand.</p> <p>So in this case you probably get <code>null</code> for the item, do you? (According to your comment, you do)</p> <p>I have found a <a href="http://social.msdn.microsoft.com/for...
<p>To overcome the virtualisation issue but still use <code>ScrollIntoView</code> and not hacking around in the guts of the ListView, you could also use your ViewModel objects to determine what is selected. Assuming that you have ViewModel objects in your list that feature an <code>IsSelected</code> property. You'd lin...
26,052
<p>My <a href="https://english.stackexchange.com/questions/19967/what-does-google-fu-mean">Google-fu</a> has failed me.</p> <p>In Python, are the following two tests for equality equivalent?</p> <pre><code>n = 5 # Test one. if n == 5: print 'Yay!' # Test two. if n is 5: print 'Yay!' </code></pre> <p>Does th...
<p><code>is</code> will return <code>True</code> if two variables point to the same object (in memory), <code>==</code> if the objects referred to by the variables are equal.</p> <pre><code>&gt;&gt;&gt; a = [1, 2, 3] &gt;&gt;&gt; b = a &gt;&gt;&gt; b is a True &gt;&gt;&gt; b == a True # Make a new copy of list `a` vi...
<p>As John Feminella said, most of the time you will use == and != because your objective is to compare values. I'd just like to categorise what you would do the rest of the time:</p> <p>There is one and only one instance of NoneType i.e. None is a singleton. Consequently <code>foo == None</code> and <code>foo is Non...
16,106
<p>I have a large collection of retro games consoles and computers, I want to create some sort of catalogue to keep track of them using Drupal. I could do it as a series of pages in Drupal, but would rather have some sort of more structured method.</p> <p>It'd be great if I could somehow define a record consisting of ...
<p>Look harder at the CCK module, it's exactly what you want.</p> <p>You can define records and then assign taxonomys and views to make it all work, just need your own creativity.</p> <p>CCK is THE module for doing this kind of stuff.</p> <p>Also, this link maybe helpful for pre-made modules.</p> <p><a href="http:/...
<p>You'll want CCK, yes, but you'll also want the Views module most likely, in order to more easily control how and what data from your CCK-based nodes show up at certain times. Panels might be nice too... These three are the triumvirate of must-haves for Drupal.</p>
16,880
<p>I have a function that includes a file based on the string that gets passed to it i.e. the action variable from the query string. I use this for filtering purposes etc so people can't include files they shouldn't be able to and if the file doesn't exist a default file is loaded instead. The problem is that when the...
<p><strong>Edit:</strong> Okay, I've re-read your question and I think I get what you're talking about now:<br> you want something like this to work:</p> <pre><code>// myInclude.php $x = "abc"; // ----------------------- // myRegularFile.php function doInclude() { include 'myInclude.php'; } $x = "A default value...
<p>When it comes to configuration options (especially file paths and such) I generally just define them with absolute paths using a define(). Something like:</p> <pre><code>define('MY_CONFIG_PATH', '/home/jschmoe/myfiles/config.inc.php'); </code></pre> <p>That way they're always globally accessible regardless of scop...
19,985
<p>I've been getting this undefined symbol building with this command line:</p> <pre><code>$ gcc test.cpp Undefined symbols: "___gxx_personality_v0", referenced from: etc... </code></pre> <p>test.cpp is simple and should build fine. What is the deal?</p>
<p>Use</p> <pre><code>g++ test.cpp </code></pre> <p>instead, since this is c++ code.</p> <hr> <p>Or, if you <em>really</em> want to use <code>gcc</code>, add <code>-lstdc++</code> to the command line, like so:</p> <pre><code>gcc test.cpp -lstdc++ </code></pre> <p>Running <code>md5</code> against the <code>a.out</...
<p>The <code>.cpp</code> extension causes <code>gcc</code> to compile your file as a C++ file. (See the <a href="http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Overall-Options.html#index-file-name-suffix-71" rel="nofollow noreferrer">GCC docs</a>.)</p> <p>Try compiling the same file, but rename it to have a <code>.c</cod...
24,905
<p>I'm consuming an axis 1.4 web service that returns soap responses that I want to unmarshal into my domain objects using jaxb annotations. My initial tests worked very well until some of the returned messages had multiRef elements. Objects that were marshalled using multiRef were showing up as null in my client side...
<p>In case of web services JAXB doesn't come alone, but as data binding part of ws client framework. So I assume your question is how to use JAXB as data binding within axis 1.4. In general I think there is no easy way to achieve that, have a look at the following thread in axis-user mailing list: <a href="http://www.n...
<p>If the Axis side of the web service is also under you control then maybe you can set the property <code>org.apache.axis.AxisEngine.PROP_DOMULTIREFS</code> to false. In that case Axis shouldn't create multiRef elements. I've used this property on client side Axis, hopefully it works on server side the same way.</p>
33,426
<p>I have a Flex application where I'm using a Canvas to contain several other components. On that Canvas there is a Button which is used to invoke a particular flow through the system. Clicking anywhere else on the Canvas should cause cause a details pane to appear showing more information about the record represent...
<p>The event continues on because event.bubbles is set to true. This means everything in the display heirarchy gets the event. To stop the event from continuing, you call </p> <pre><code>event.stopImmediatePropagation() </code></pre>
<p>I have 2 ideas, first try this:</p> <pre> <code> btn.addEventListener(MouseEvent.Click,function(event:MouseEvent):void{ event.stopImmediatePropagation(); ... }); </code> </pre> <p>if that doesn't work, see if you can add the click listener to the canvas and not the button and check the target property on t...
16,505
<p>Are <code>.css</code> files always needed? Or may I have a <code>.css</code> "basic" file and define other style items inside the HTML page?</p> <p>Does <code>padding</code>, <code>borders</code> and so on always have to be defined in a <code>.css</code> file that is stored separately, or may I embed then into an H...
<p>It is technically possible to use inline CSS formatting exclusively and have no external stylesheet. You can also embed the stylesheet within the HTML document. The best practice in web design is to separate out the CSS into a separate stylesheet. The reason for this is that the CSS stylesheet exists for the purp...
<p>You can use anywhere, css files are not a requirement. using css files however is recommended as it makes the site easier to maintain and change in the future</p>
13,014
<p>Sessions in PHP seemed to have changed since the last time I used them, so I'm looking for a simple way of using sessions but at the same time for it to be relatively secure and a good common practice.</p>
<p>Session management changed some time back (I think it was around 4.4). The old mechanism still works, but is deprecated. It's rather confusing, so I recommend staying clear of it. Today, you use sessions by accessing the global variable $_SESSION (It's an array). You <em>can</em> put object instances in there, but y...
<p>First off, use cookie based only unless you have a very specific good business reason not to. I had a client that insisted on url based sessions only for a project. very insecure and a pain to work with.</p> <p>One good idea is to regenerate the session on each request. this makes hijack much less likely. For examp...
12,207
<p>As usual, when my brain's messing with something I can't figure out myself, I come to you guys for help :)</p> <p>This time I've been wondering why stdafx.h works the way it does? To my understanding it does 2 things:</p> <ul> <li>Includes standard headers which we <em>might</em> (?) use and which are rarely chang...
<p>stdafx.h is ONE way of having Visual studio do precompiled headers. It's a simple to use, easy to automatically generate, approach that works well for smaller apps but can cause problems for larger more complex apps where the fact that it encourages, effectively, the use of a single header file it can cause coupling...
<p>It will help reduce long compilations.</p>
48,895
<p>I'm trying to automate the build of the project I'm working on. My ultimate goal is to eventually have a continuous integration server and so far everything was great. In order to find out what is the minimal setup I can have for my project, I started configuring a freshly installed system and stumbled with the requ...
<p>While I agree that it's not a good idea to install an IDE on a CI or build server, unfortunately you are correct. </p> <p>To install Mobile SDK 5 you need to install Visual Studio (2005 or 2008). You will also need to install Mobile Device Center / ActiveSync depending on your build machine OS. If you are runnin...
<p>I don't have experience with Windows Mobile build automation, but I do have experience with general purpose build servers.</p> <p>I'm fairly certain that you're going to need Visual Studio installed either way if you're planning on automating your build process using things like msbuild and mstest.</p>
34,531
<p>How are folks integrating various static analysis tools such as PMD, Checkstyle, and FindBugs so that they are used together in some uniform way? In particular, I'm interested in generating a single uniform report that includes warnings from all tools. Also, I want to be able to mark-up my code with reasonably consi...
<p>I stumbled across <a href="http://www.jcoderz.org/fawkez/wiki/JcReport" rel="nofollow noreferrer">JcReport</a> today, which I think does exactly what you are looking for. At least, it handles the reports in a combined way; suppressions are still tool-specific. This tool claims to support automatically integrating ...
<p>If you build your project with Maven, and you have those tools "plugged in" to your Maven build, then the Maven report that is generated for the build will include the output of those static analysis tools.</p>
10,532
<p>How do you keep the spoken languages strings in your program up to date? Is there an inexpensive way? Where can you find people to do the conversions over time?</p>
<p>There are companies which will translate resource files in the standard formats for fees; I think that's how most large companies do it.</p> <p>I asked a similar question recently <a href="https://stackoverflow.com/questions/185291/best-way-to-design-for-localization-of-strings">here</a> about the best way to struc...
<p>I think it depends on how accessible you want the languages to be, which probably depends very much on what the project is in the first place (professional, hobby, etc)</p> <p>In my hobby work I have the locale-specific strings stored in a simple external JSON file (XML or even a simple INI would work just as well,...
23,071
<p>Is it possible to create an inline delegate in vb.net like you can in c#?</p> <p>For example, I would like to be able to do something inline like this:</p> <pre><code>myObjects.RemoveAll(delegate (MyObject m) { return m.X &gt;= 10; }); </code></pre> <p>only in VB and without having to do something like this</p> ...
<pre><code>myObjects.RemoveAll(Function(m As MyObject) m.X &gt;= 10) </code></pre> <p>See <a href="http://msdn.microsoft.com/en-us/library/bb531253.aspx" rel="noreferrer">Lambda Expressions on MSDN</a></p>
<p>Try:</p> <pre><code>myObjects.RemoveAll(Function(m) m.X &gt;= 10) </code></pre> <p>This works in 3.5, not sure about the 2.0 syntax.</p>
45,810
<p>I'm starting with Python coming from java. </p> <p>I was wondering if there exists something similar to JavaDoc API where I can find the class, its methods and and example of how to use it.</p> <p>I've found very helpul to use <em>help( thing )</em> from the Python ( command line ) </p> <p>I have found this also:...
<p><a href="http://docs.python.org/library/pydoc.html" rel="nofollow noreferrer">pydoc</a>?</p> <p>I'm not sure if you're looking for something more sophisticated, but it does the trick.</p>
<p>If you're working on Windows <a href="http://www.activestate.com/Products/activepython/index.mhtml" rel="nofollow noreferrer">ActiveState Python</a> comes with the documentation, including the library reference in a searchable help file.</p>
16,546
<p>I'm looking into some possible options for unit testing C++ classes. </p> <p>So, short and to the point, what are you using?</p>
<p>I'm using <a href="http://sourceforge.net/projects/cppunit" rel="nofollow noreferrer">cppunit</a>. It is a pretty good port of the iconic JUnit to c++.</p>
<p>Simple console applications that link the lib / DLL, and use assert statements.</p> <p>It fits my main requirements: easy to set up, and when an error occurs you can immediately break into the debugger.</p> <p>To run an individual test repeatedly, the call to the routine is (temporary) copied to the top. </p> <p>...
29,026
<p>When I use the default java locale on my linux machine it comes out with the US locale settings, where do I change this so that it comes out with the correct locale?</p>
<p>With the <code>user.language</code>, <code>user.country</code> and <code>user.variant</code> properties.</p> <p>Example:</p> <p><code>java -Duser.language=th -Duser.country=TH -Duser.variant=TH SomeClass</code></p>
<p>One way to control the locale settings is to set the java system properties user.language and user.region.</p>
8,953
<p>While estimating straight row and table sizes are fairly simple math, we find it challenging to guess just how much space each index will occupy (for a given table size). What areas can we learn to calculate a better estimate and growth rate for indexes?</p>
<p>An index leaf has a preamble identifying the data page (7 bytes plus some directory information for variable length columns, if any) plus a copy of the key value (s) which will be the same size as the table data for those columns. There's one for each row in the table. The higher up levels of the index are much sm...
<p>when possible, I generally take 1000 records from the original table, insert them into my own table, and with the script below I have a sample to play with.</p> <p>Ok it is not accurate, but can give me a starting point.</p> <pre><code>--Find out the disk size of an index: --USE [DB NAME HERE] go SELECT OBJECT_N...
21,391
<p>How can I poll the keyboard from a console python app? Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.):</p> <pre><code>while True: # doing amazing pythonic embedded stuff # ... # periodically do a non-blocki...
<p>The standard approach is to use the <a href="https://docs.python.org/2/library/select.html" rel="noreferrer">select</a> module.</p> <p>However, this doesn't work on Windows. For that, you can use the <a href="https://docs.python.org/2/library/msvcrt.html#console-i-o" rel="noreferrer">msvcrt</a> module's keyboard p...
<p>If you combine time.sleep, threading.Thread, and sys.stdin.read you can easily wait for a specified amount of time for input and then continue, also this should be cross-platform compatible.</p> <pre><code>t = threading.Thread(target=sys.stdin.read(1) args=(1,)) t.start() time.sleep(5) t.join() </code></pre> <p>Yo...
37,267
<p>I am trying to find out which Hypervisor will allow me to grant access to specialized PCI cards (such as a telephony card) to a virtual machine. So far I have tried out VMWare ESXi server and it doesn't seem to allow me to do this. I have heard that Microsoft Virtual Server does allow this, but I haven't been able t...
<p>I'd look into <a href="http://www.xen.org" rel="nofollow noreferrer">Xen</a>, it appears that you can load a backend xen driver on the host OS which will then allow you to communicate directly with the hardware from the guest.</p> <p>See <a href="http://www.bestgrid.org/index.php/Xen:_assigning_PCI_devices_to_a_dom...
<p>Yes, Xen can do this successfully. It is called PCI Passthrough: <a href="http://wiki.xen.org/wiki/Xen_PCI_Passthrough" rel="nofollow">http://wiki.xen.org/wiki/Xen_PCI_Passthrough</a></p> <p>I've done this successfully for both Windows and Linux guests with Xen 4.x, using my system's IOMMU. There are some restric...
40,688
<p>I have a sea of weighted nodes with edges linking clusters of nodes together. This graph follows the typical small world layout.</p> <p>I wish to find a path finding algorithm, which isn't costly on processor power, to find a path along the best possible path where the nodes are the most favorably weighted, the fas...
<h3>General notes</h3> <p>Dijkstra's algorithm and it optimised variant A* find the path with "the" minimal cost through your graph. The important things are a) defining your graph correctly and b) defining an appropriate cost function.</p> <p>In the face of a changing cost function Dijksta requires one to re-calcula...
<p>Would a common Dijkstra's not be sufficient?</p> <p><a href="http://improve.dk/generic-dijkstras-algorithm/" rel="nofollow noreferrer">http://improve.dk/generic-dijkstras-algorithm/</a></p>
27,269
<p>So I have a <code>stored procedure</code> that accepts a product code like <code>1234567890</code>. I want to facilitate a wildcard search option for those products. (i.e. <code>123456*</code>) and have it return all those products that match. What is the best way to do this?</p> <p>I have in the past used somethin...
<p>What your doing already is about the best you can do.</p> <p>One optimization you might try is to ensure there's an index on the columns you're allowing this on. SQL Server will still need to do a full scan for the wildcard search, but it'll be only over the specific index rather than the full table.</p> <p>As alw...
<h2>A couple of random ideas</h2> <p>It depends, but you might like to consider:</p> <ul> <li><p>Always look for a substring by default. e.g. if the user enters &quot;1234&quot;, you search for:</p> <p>WHERE product like &quot;%1234%&quot;</p> </li> <li><p>Allow users full control. i.e. simply take their input and pa...
41,562
<p>I have a column with a "DEFAULT" constraint. I'd like to create a script that drops that column.</p> <p>The problem is that it returns this error:</p> <pre><code>Msg 5074, Level 16, State 1, Line 1 The object 'DF__PeriodSce__IsClo__4BCC3ABA' is dependent on column 'IsClosed'. Msg 4922, Level 16, State 9, Line 1...
<p>This query finds default constraints for a given table. It aint pretty, I agree:</p> <pre><code>select col.name, col.column_id, col.default_object_id, OBJECTPROPERTY(col.default_object_id, N'IsDefaultCnst') as is_defcnst, dobj.name as def_name from sys.columns col left outer join sys.o...
<p>Just Generate Scripts for the table. There you can find the name of all constraints.</p>
40,659
<p>I have a <code>textbox</code> whose input is being handled by jQuery.</p> <pre><code>$('input.Search').bind("keyup", updateSearchTextbox); </code></pre> <p>When I press <code>Enter</code> in the textbox, I get a postback, which messes everything up. How can I trap that Enter and ignore it?</p> <p>(Just to preempt...
<p>Your browser is automatically submitting the form when you press enter. To cancel this, add return false to your updateSearchTextBox function.</p> <p>if that doesn't work, try this:</p> <pre><code>&lt;script language="JavaScript"&gt; function disableEnterKey(e) { var key; if(window.event) ...
<p>Thanks to all who responded. Here's my new <code>updateSearchTextbox</code> function, which works perfectly:</p> <pre><code>updateSearchTextbox = function(e) { /// &lt;summary&gt; /// Handles keyup event on search textbox /// &lt;/summary&gt; if (e.which == "13") { // update now upd...
25,817
<p>I am developing a game for the web. The map of this game will be a minimum of 2000km by 2000km. I want to be able to encode elevation and terrain type at some level of granularity - 100m X 100m for example. </p> <p>For a 2000km by 2000km map storing this information in 100m<sup>2</sup> buckets would mean 20000 b...
<p>It depends on how you want to generate your terrain. For example, you could procedurally generate it all (using interpolation of a low resolution terrain/height map - stored as two "bitmaps" - with random interpolation seeded from the xy coords to ensure that terrain didn't morph), and use minimal storage. If you w...
<p>If you want the kind of granularity that you are looking for, then there is no obvious way of doing it.</p> <p>You could try a 2-dimensional wavelet transform, but that's pretty complex. Something like a Fourier transform would do quite nicely. Plus, you probably wouldn't go about storing the terrain with a one-rec...
42,309
<p>In vs2008, how can I (possibly with a macro) assign a shortcut key to collapse to definitons but leave regions expanded (they must expand if collapsed)?</p> <p><strong>EDIT:</strong> I hate regions but my co-workers does not (: So I want this to avoid the regions used by them.</p> <p>I read jeff's post. Ctrl M + O...
<p>I believe I have <em>finally</em> got the answer that I've been looking for, and I think it might help you as well, @Serhat. You said:</p> <blockquote> <p>I read jeff's post. Ctrl M + O is what I really want to do, if there were not regions.</p> </blockquote> <p>That was <em>exactly</em> what I was thinking to ...
<p>I find <kbd>Ctrl</kbd> + <kbd>M</kbd>, <kbd>Ctrl</kbd> + <kbd>O</kbd> is really useful to collapse everything.</p> <p>Have you read <a href="https://blog.codinghorror.com/the-problem-with-code-folding/" rel="nofollow noreferrer">Jeff's blog post about regions</a>? There's a few more useful shortcuts he lists.</p> ...
27,859
<p>I have object A which in turn has a property of type Object B</p> <pre><code>Class A property x as Object B End Class </code></pre> <p>On my ASP.NET page when I select a gridview item which maps to an object of type A I serialize the object onto the QueryString and pass it to the next page. </p> <p>However I ru...
<p>If displaying the url of the next page in the browser does not matter, you could use the context.items collection.</p> <pre><code>context.items.add("keyA", objectA) server.transfer("nextPage.aspx") </code></pre> <p>Then on the next page:</p> <pre><code>public sub page_load(...) dim objectA as A = ctype(contex...
<p>Here is what I do:</p> <p>Page1.aspx - Add a public property of an instance of my object. Add a button (Button1) with the PostBackURL property set to ~/Page2.aspx</p> <pre><code>Private _RP as ReportParameters Public ReadOnly Property ReportParams() as ReportParameters Get Return _RP End Get End Property ...
19,050
<p>Basically I have a small template that looks like:</p> <pre><code>&lt;xsl:template name="templt"&gt; &lt;xsl:param name="filter" /&gt; &lt;xsl:variable name="numOrders" select="count(ORDERS/ORDER[$filter])" /&gt; &lt;/xsl:template&gt; </code></pre> <p>And I'm trying to call it using</p> <pre><code>&lt;xsl...
<p>how about the following:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" indent="yes"/&gt; &lt;xsl:template name="templt"&gt; &lt;xsl:param name="filterNodeName" /&gt; &lt;xsl:p...
<p>Use the EXSLT library, specifically the <a href="http://exslt.org/dyn/functions/evaluate/index.html" rel="nofollow noreferrer">dyn:evaluate</a> function, which can evaluate a string as an XPath expression.</p>
42,151
<p>In Eclipse RCP way of doing things, where should I keep my model objects? And when they are loaded or changed, how should they talk to the views?</p> <p>I am attempting to port my existing application to Eclipse RCP. It could be viewed as an IDE-like application: I open a file, which contains links to source files....
<p>I believe this is best achieved through Listeners.</p> <p>Your data (model) is in private package, and only Interfaces of those data are exposed in a public package.</p> <p><img src="https://wiki.eclipse.org/images/1/10/Mvc.png" alt="alt text"></p> <p>You will find in this <a href="http://wiki.eclipse.org/JFace_D...
<p>We tend to use <code>IEditorPart</code>s to store keep a copy of the model (derived from the <code>IEditorInput</code>). </p> <p>If a view needs to know about the model, then use the ISelection framework and focus to move the model around from the editor to the view.</p>
34,990
<p>I have a domain class containing a couple of fields. I can access them from my .gsps. I want to add a method to the domain class, which I can call from the .gsps (this method is a kind of virtual field; it's data is not coming directly from the database).</p> <p>How do I add the method and how can I then call it fr...
<p>To add a method, just write it out like you would any other regular method. It will be available on the object when you display it in your GSP.</p> <pre><code>def someMethod() { return "Hello." } </code></pre> <p>Then in your GSP.</p> <pre><code>${myObject.someMethod()} </code></pre>
<p>Consider class like below</p> <p>class Job {</p> <pre><code>String jobTitle String jobType String jobLocation String state static constraints = { jobTitle nullable : false,size: 0..200 jobType nullable : false,size: 0..200 jobLocation nullable : false,size: 0..200 state nullable : false } ...
23,609
<p>Is there a way to force IE or FF into a handheld mode for testing "@media handheld" stylesheets?</p> <p>Or, do I have to publish the pages and test with my Blackberry?</p> <p>I'd prefer to test this without pushing the application to the live server as the application is already in use.</p> <p>Any ideas for me?</...
<p>Some help on this question: <a href="https://stackoverflow.com/questions/259330/what-do-you-use-to-test-the-handheld-css-on-your-website">What do you use to test the handheld css on your website?</a></p>
<p>I've found Blackberry browser to be so utterly broken, that testing in Firefox or even IE doesn't make sense. Netscape 4 seems like closest approximation.</p> <p>If you want achieve decent experience on BB, then you have to get a BB simulator. It's available for free from RIM website (you need to click through a fe...
38,490
<p>I'm trying to find a way to force Windows to reboot, and I am running into issues. I've tried </p> <p><pre><code><code>Set OpSysSet = GetObject("winmgmts:{authenticationlevel=Pkt," _ &amp; "(Shutdown)}").ExecQuery("select * from Win32_OperatingSystem where "_ &amp; "Primary=true") for each OpSys in OpSy...
<p>Try replacing:</p> <pre><code>retVal = OpSys.Reboot() </code></pre> <p>With:</p> <pre><code>retVal = OpSys.Win32Shutdown(6) </code></pre>
<pre><code>Set Reset= WScript.CreateObject (&quot;WScript.Shell&quot;) Reset.run &quot;shutdown -r -t 0&quot;, 0, True </code></pre> <p>Or..</p> <pre><code>Shell &quot;shutdown -r -f -t 0&quot; ' for restart Shell &quot;shutdown -s -f -t 0&quot; ' for Shutdown Shell &quot;shutdown -l -f -t 0&quot; ' for log off...
22,873
<p>One of my co-workers checked in a some files in SVN and one of the files has a password in it. The password has been removed from the file and a new version checked in but the password is obviously still in the repository if we look at the revision history and go to that revision. (We're using TortoiseSVN as the cli...
<p><a href="http://subversion.apache.org/faq.html#removal" rel="nofollow noreferrer">link to subversion FAQ entry on this</a></p>
<p>I'm not sure. You could always create a new file and copy the latest revision into that, wiping out prior revision history. </p>
5,387
<p>When a user goes to my site, my script checks for 2 cookies which store the user id + part of the password, to automatically log them in. </p> <p>It's possible to edit the contents of cookies via a cookie editor, so I guess it's possible to add some malicious content to a written cookie?</p> <p>Should I add <code>...
<p>What you <em>really</em> need to do is not send these cookie values that are hackable in the first place. Instead, why not hash the username and password and a (secret) salt and set that as the cookie value? i.e.:</p> <pre><code>define('COOKIE_SALT', 'secretblahblahlkdsfklj'); $cookie_value = sha1($username.$passwo...
<p>I would recommend using htmlentities($input, ENT_QUOTES) instead of mysql_real_escape_string as this will also prevent any accidental outputting of actual HTML code. Of course, you could use mysql_real_escape_string and htmlentities, but why would you?</p>
11,587
<p>Is there a way to hide table rows without affecting the overall table width? I've got some javascript that shows/hides some table rows, but when the rows are set to <code>display: none;</code>, the table with shrinks to fit the contents of the visible rows.</p>
<p>If you are looking to preserve the overall width of the table, you can check it prior to hiding a row, and explicitly set the width style property to this value:</p> <pre><code>table.style.width = table.clientWidth + "px"; table.rows[3].style.display = "none"; </code></pre> <p>However, this may cause the individua...
<p>You can do it using pure HTML</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table border="1"&gt; &lt;colgroup&gt; &lt;col width="150px" /&gt; &lt;col w...
17,725
<p>I am in the process of creating an XML Schema and one of my values is a year. As such, I'd like to ensure that all values have exactly 4 characters. To do so, I am using the following syntax:</p> <pre><code>&lt;xs:element name="publish_year" maxOccurs="1"&gt; &lt;xs:simpleType&gt; &lt;xs:restriction base="x...
<p>How about a plage of value as an additional restriction ?</p> <p>(<a href="http://www.w3.org/TR/xmlschema-2/#rf-minInclusive" rel="noreferrer">minInclusive</a> - <a href="http://www.w3.org/TR/xmlschema-2/#dc-maxInclusive" rel="noreferrer">maxInclusive</a>)</p> <p>For instance ?</p> <pre><code>&lt;xs:minInclusive ...
<p>I would use the base type xs:gYear, with additional constraining facets, as needed. For more info, <a href="http://www.w3.org/TR/xmlschema-2/#built-in-datatypes" rel="nofollow">this</a> might help.</p>
38,447
<p>I'm adding some lazy initialization logic to a const method, which makes the method in fact not const. Is there a way for me to do this without having to remove the "const" from the public interface?</p> <pre><code>int MyClass::GetSomeInt() const { // lazy logic if (m_bFirstTime) { m_bFirstTime...
<p>Make m_bFirstTime mutable:</p> <pre><code>class MyClass { : : mutable bool m_bFirstTime; }; </code></pre> <p>...but this is also very often an indication of a design flaw. So beware.</p>
<p>In any case - make note that this is no longer going to be thread safe. You can often rely on an object to be thread safe if it only has const methods (or you use only the const methods after initialization). But if those const methods are only logically const, then you lose that benefit (unless of course you star...
41,594
<p>I have a DataTable that queries out something like below</p> <pre><code>usergroupid...userid......username 1.............1...........John 1.............2...........Lisa 2.............3...........Nathan 3.............4...........Tim </code></pre> <p>What I'm trying to do is write a LINQ statement that will return a...
<p>Check this out, hope this helps</p> <pre><code>var users = new[] { new {UserGroupId = 1, UserId = 1, UserName = "John"}, new {UserGroupId = 1, UserId = 2, UserName = "Lisa"}, new {UserGroupId = 2, UserId = 3, UserName = "Nathan"}, new {UserGroupId = 3, UserId = 4, UserName = "Tim"} }; var userGrou...
<p>There is - look at GroupBy and Select methods.</p>
41,330
<p>What is currently the best tool for JavaME unit testing? I´ve never really used unit testing before (shame on me!), so learning curve is important. I would appreciate some pros and cons with your answer. :)</p>
<p>I think it will depend on what kind of tests are you planning to do. Will you be using continuous integration. Is running tests on handsets a must.</p> <p>If tests are more logic/data processing tests, the you can do fine with JUnit. But if you need to use some classes from javax.microedition.*, then the things wil...
<p>I'll be honest, the only unit tester I've used in Java is <a href="http://www.junit.org/" rel="nofollow noreferrer">JUnit</a> and a child project for it named <a href="http://www.dbunit.org/" rel="nofollow noreferrer">DBUnit</a> for database testing... which I'm assuming you won't need under J2ME.</p> <p>JUnit's pr...
15,608
<p>I noticed a number of cases where an application or database stored collections of files/blobs using a has to determine the path and filename. I believe the intended outcome is a situation where the path never gets too deep, or the folders ever get too full - too many files (or folders) in a folder making for slower...
<h3>Hash/B:Tree</h3> <p>A hash has the advantage of being faster to look at when you're only going to use the "=" operator for searchs.</p> <p>If you're going to use things like "&lt;" or ">" or anything else than "=", you'll want to use a B:Tree because it will be able to do that kind of searchs.</p> <h3>Directory ...
<p>A hash is faster to check than it is to traverse a B-tree. So if frequent existence checks are made, this method might be useful. Other than that, I don't really understand the situation because hash tables don't preserve ordering or hierarchies. Therefore, storing a directory structure in them doesn't seem feasable...
43,999
<p>In the past, on Windows XP machines, I was able to install P4V (the stupid platform-independent Perforce visual client that Perforce tries to shove down your throats), then after that, install P4Win (the wonderful clean robust mature visual client that Perforce is stupidly trying to deprecate).</p> <p>If I did the ...
<p>Okay I did this myself. The steps I followed were: 1. Uninstall every single Perforce product on my machine. 2. Reboot. 3. Install P4V. 4. Reboot. 5. Insteall P4Win. 6. Reboot.</p> <p>Then the Time-Lapse View (and the Revision Graph, another useful tool you can only get from the P4V tools) show up in P4Win. Huzzah!...
<p>This method also works for Windows 7 64 bit with 64 bit versions of P4V and P4Win</p>
47,196
<p>After making <a href="https://stackoverflow.com/questions/75882/what-in-your-mind-is-the-best-php-mvc-framework#89095">some comments</a>, I've been inspired to get some feedback on the PHP MVC framework <a href="http://pradosoft.com/" rel="nofollow noreferrer">PRADO</a>. I've been using it for over a year now and I'...
<p>The first time I looked into PRADO, I spent about 10 days using it and kept saying to myself: "This framework is amazing!". A couple of months later, I started working on a big project where the customer had chosen to use PRADO... And Hell began... As long as we kept using PRADO's base components, everything was per...
<p>We are working with PRADO framework since 4 years. We are developing huge (+4000 programs) web apps for e-Goverment with Oraracle and MySql databases containing more than 60 millon records. As infrastructure for development we use SVN+TRAC+ our own tools for project control AND phpEdit w/tortoiseSVN as client tools...
11,940
<p>Between Eclipse/SWT or Netbeans/Matisse, what does either Java GUI editor give you in terms of rapid development and maintainability?</p>
<p>You are really asking two different questions: SWT vs Swing, and Eclipse GUI Editor vs Netbeans GUI Editor (Matisse).</p> <p>First, the difference between SWT and Swing is that they are two fundamentally different GUI libraries. This akin to asking the difference between Tk and Win32, or Java Swing vs .NET Forms (n...
<p>This is definitely subjective -- we use both, Eclipse and Netbeans. I think it comes down to a matter of preference.</p>
13,793
<p>Consider the following code:</p> <pre><code>template &lt;int dim&gt; struct vec { vec normalize(); }; template &lt;&gt; struct vec&lt;3&gt; { vec cross_product(const vec&amp; second); vec normalize(); }; template &lt;int dim&gt; vec&lt;dim&gt; vec&lt;dim&gt;::normalize() { // code to normalize ve...
<p>You can't :) What you want is to specialize the member functions instead:</p> <pre><code>template &lt;int dim&gt; struct vec { // leave the function undefined for everything except dim==3 vec cross_product(const vec&amp; second); vec normalize(); }; template&lt;&gt; vec&lt;3&gt; vec&lt;3&gt;::cross_pro...
<p>You can't as far as I know call the "generic" version.</p> <p>Alternatively, you can define your generic implementations outside of the classes as functions: </p> <pre><code>template &lt;int dim&gt; struct vec { }; namespace impl { template &lt;int dim&gt; vec&lt;dim&gt; normalize(const vec&lt;dim&gt;&amp...
45,163
<p>I am wrapping up a project in which I used jQuery for the first time. I loved working with the library, and thought I understood one of the benefits was cross-browser compatibility. I had an unpleasant surprise waiting for me when I began testing the site in IE6 and IE7 because in many many instances, the JavaScript...
<p>I've seen very, very few differences in behavior across browsers. That said, jQuery is only good so long as you're using jQuery - once you step outside of built-in event handling and DOM traversal, you're gonna end up running into browser incompatibilities anyway.</p> <p>VS2008 works reasonably well for debugging J...
<p>The only xbrowser issues I've had is with keyup/press/down</p>
41,039
<p>How can polymorphism be described in an easy-to-understand way?</p> <p>We can find a lot of information about the subject on the Internet and books, like in <em><a href="http://en.wikipedia.org/wiki/Type_polymorphism" rel="noreferrer">Type polymorphism</a></em>. But let's try to make it as simple as we can.</p>
<p>This is from my <a href="https://stackoverflow.com/questions/154577/polymorphism-vs-overriding-vs-overloading#154628">answer</a> from a similiar question. Here's an example of polymorphism in pseudo-C#/Java:</p> <pre><code>class Animal { abstract string MakeNoise (); } class Cat : Animal { string MakeNoise...
<p>Polymorphism is the Object Oriented solution to problem of passing a function to another function. In C you can do</p> <pre><code> void h() { float x=3.0; printf("%f", x); } void k() { int y=5; printf("%i", y); } void g(void (*f)()) { f(); } g(h); // output 3.0 g(k); // output 5 </code></pre> <p>In C things ...
25,830
<p>There is no documentation on cakephp.org and I am unable to find one on google. Please link me some documentation or supply one!</p>
<p>The translate behavior is another of CakePHP's very useful but poorly documented features. I've implemented it a couple of times with reasonable success in multi-lingual websites along the following lines.</p> <p>Firstly, the translate behavior will only internationalize the database content of your site. If you've...
<p>For anyone searching the same thing, cakephp updated their documentation. For Translate Behavior go <a href="http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html" rel="nofollow">here..</a></p>
11,628
<p>I've got the directive</p> <pre><code>&lt;VirtualHost *&gt; &lt;Location /&gt; AuthType Digest AuthName "global" AuthDigestDomain / AuthUserFile /root/apache_users &lt;Limit GET&gt; Require valid-user &lt;/Limit&gt; &lt;/Location&gt; WSGIScript...
<p>add <code>WSGIPassAuthorization On</code>:</p> <pre><code>&lt;VirtualHost *&gt; &lt;Location /&gt; AuthType Digest AuthName "global" AuthDigestDomain / AuthUserFile /root/apache_users &lt;Limit GET&gt; Require valid-user &lt;/Limit&gt; &lt;/Locatio...
<p>Additional information about Apache/mod_wsgi and access, authentication and authorization mechanisms can be found in:</p> <p><a href="http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms" rel="nofollow noreferrer">http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms</a></p> <p>The information isn...
15,022
<p>I'm just learning how to do things, and want to start using some sort of version control for a web app.</p> <p>What's most appropriate for deploying a python or php web app on my own? I'm using linux and have a linux server.</p> <p>Thanks!</p>
<p>SVN, <strong><em>but</em></strong> you need to be able to easily <strong>deploy your webapp with SVN</strong>.</p> <p>Since it is not always a simple task, so I just point out <strong><a href="http://www.jejik.com/articles/2008/08/easily_develop_and_deploy_web_applications_from_subversion/" rel="nofollow noreferrer...
<p>Subversion is a good choice. For the client, there's TortoiseSVN (<a href="http://tortoisesvn.tigris.org/" rel="nofollow noreferrer">http://tortoisesvn.tigris.org/</a>) that integrates with the shell and lets you do things with a right click on a folder. For integration with Visual Studio (I'll assume that's your en...
42,853
<p>I'm using System.Windows.SplashScreen to add a splash screen to my WinForms app (it has a lot of WPF controls, but the 'main window' is still a System.Windows.Forms.Form object). When the splash screen closes the whole app goes as well.</p> <p>Can I stop it taking the whole app with it?</p>
<p>Yep, it is important to do the Application.Run call. That call transfers control of your program to the whatever main form you specify. The program will then remain running until that form is closed. If you don't make that call then the Main() function retains control and the application will exit when Main() exi...
<p>I was a bit too quick with that question - it looks like the problem here was down to how I was starting to app. If you do:</p> <pre><code>form.ShowDialog(); </code></pre> <p>Then the form's parent gets set to the splash screen, so when that closes it also closes the child window (in this case 'form'), but if you ...
33,255
<p>I am trying to passing in 3 pointers to a DLL function. I have:</p> <pre> { $code=1; $len=100; $str=" " x $len; $function = new Win32::API(DLLNAME,'dllfunction','PPP','V'); $function->Call($code,$str,$len); } </pre> <p>The DLL is defined as <code>void dllfunction(int* a, char* str, int* len);</code> The DLL wi...
<p>AH!! I figured it out.</p> <p>The problem was this </p> <blockquote> <ol start="5"> <li>And optionally you can specify the calling convention, this defaults to '__stdcall', alternatively you can specify '_cdecl'.</li> </ol> </blockquote> <p>The dll function was exported with extern "C" __declspec(dllexport)...
<p>IANAPH, but I think you need to do use a <a href="http://www.troubleshooters.com/codecorn/littperl/perlsub.htm#References" rel="nofollow noreferrer">reference</a>, like so:</p> <pre><code>$function-&gt;Call(\$code, \$str, \$len) </code></pre> <p>The one I'm least sure about is $str - it <em>may</em> not need a ref...
46,118
<p>I am attempting to use linq to shape list of data into a particular shape to be returned as Json from an ajax call.</p> <p>Given this data:</p> <pre><code>var data = new List&lt;string&gt;(); data.Add("One"); data.Add("Two"); data.Add("Three"); </code></pre> <p>And this code: ** Which is not correct and is what n...
<p>The decimal data type isn't supported in the default Jet 4.0 mdb file. You have to use the SQL Server compatibility syntax (ANSI 92) setting to use the decimal data type in the SQL Window.</p> <p>Click on the menu, Tools > Options. Click on the Tables/Query tab. Mark the check box for "This database" in the SQL ...
<p>The ALTER TABLE syntax is only supported in Jet 4.0/ACE while in ANSI-92 Query Mode. Try an ADO connection e.g.</p> <p>CurrentProject.Connection.Execute "ALTER TABLE myTbl ADD COLUMN myColumn DECIMAL(9,4)"</p>
21,828
<p>How do I view the history of an individual file with complete details of what has changed?</p> <p><code>git log -- [filename]</code> shows me the commit history of a file, but how do I see the file content that changed?</p>
<p>For a graphical view, use <a href="https://git-scm.com/docs/gitk/" rel="noreferrer"><code>gitk</code></a>:</p> <pre><code>gitk [filename] </code></pre> <p>To follow the file across file renames:</p> <pre><code>gitk --follow [filename] </code></pre>
<p>I'm probably about where the OP was when this started, looking for something simple that would let me use <em>git difftool</em> with <em>vimdiff</em> to review changes to files in my repo starting from a specific commit. I wasn't too happy with answers I was finding, so I threw this <strong>git inc</strong>remental...
35,126
<p>I want to see all the different ways you can come up with, for a factorial subroutine, or program. The hope is that anyone can come here and see if they might want to learn a new language.</p> <h2>Ideas:</h2> <ul> <li>Procedural</li> <li>Functional</li> <li>Object Oriented</li> <li>One liners</li> <li>Obfuscated</li...
<h1>Polyglot: 5 languages, all using bignums</h1> <p>So, I wrote a polyglot which works in the three languages I often write in, as well as one from my other answer to this question and one I just learned today. It's a standalone program, which reads a single line containing a nonnegative integer and prints a single ...
<h1>Haskell : Functional - Tail Recursive</h1> <pre><code>factorial n = factorial' n 1 factorial' 0 a = a factorial' n a = factorial' (n-1) (n*a) </code></pre>
4,372
<p>My company is in the process of starting down the <strong>Grails</strong> path. The reason for that is that the current developers are heavy on <strong>Java</strong> but felt the need for a <strong>MVC-style language</strong> for some future web development projects. Personally, I'm coming from the design/usability ...
<p>Mmh, I don't know how to say this. Some people might bash me over this. </p> <h2>Language (Groovy and Ruby)</h2> <p>As a language I reckon Ruby is more funky compared to Groovy. Groovy only exists to ease Java programmer as you don't need to learn too much new syntax. But overall I reckon is not as funky as Ruby. ...
<p>At a first glance you would think they are completely differente stories, since they are based on extremely different languages (Ruby and Groovy).</p> <p>Then, after reading a couple of tutorials, you'll realize they share the same principles, scaffolding, duck typing, .. and finally the same goal: <strong>maki...
2,708
<p>Is it possible to run the 32-bit version of Visual Studio 2008 Professional on a Windows Vista 64-bit system? </p> <ul> <li>Are there any known caveats that I would need to be aware of?</li> <li>Would have to install the x64 version of the .NET Framework?</li> <li>Would there be any issues on building software targ...
<p>There is no x64 version of Visual Studio 2008. I'm running the standard 32-bit version on Vista x64 Ultimate and it works fine. There really are no day-to-day issues that I've run across. You just install it and go.</p>
<p>The only downside is if you want to use SQL Express Management Studio on Vista x64. Mine is incredibly slow and I can't find any answers relating to why!</p> <p>EDIT:</p> <p>Nevermind, I have my problem while typing this.</p> <p>Vista has a TCP/IP auto tuning feature. By following this tutorial: <a href="http://w...
31,317
<p>I need to reinstall IIS 7.0 on Vista due to some unsolved configuration issues.</p> <p>I thought it was easy: I uninstalled all IIS-related stuff in Programs/Features, restarted system, installed all IIS modules again (installation cd wasn't needed) and hmm.. everything looks the same - I mean wrong. I see all conf...
<p>I've encountered the same problem and formatting my hard drive was not an option.</p> <p>The answer is already provided in a comment, and that is <strong>uninstalling</strong> the <strong>Windows Activation Services</strong> in the Windows Components <em>before</em> reinstalling IIS.</p> <p>I hope this helps some ...
<p>It is my understanding that all configuration in IIS7 is done in the different web.config files. So keeping them will keep your (miss-)configuration after a reinstall.</p>
49,856
<p>Say I want to create vb.net application in Visual studio 2005. What is the difference between <em>File->New->Project</em> vs <em>File->New->Web Site</em>?</p> <p><strong>EDIT</strong></p> <p>I am aware that when using New->Project there are many more options available but if one wants to create just .net web appli...
<p><a href="http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx" rel="nofollow noreferrer">Here's a good link about WAPs</a> (web application projects) and the differences between WAPs and website projects.</p> <p>In 2003, your only option (if I recall correctly) was the WAP. 2005 introduced the concept of w...
<p>If you create a project, all cs files in your project will be compiled into one DLL. Instead, if you choose to create a website, all your app_code will be compiled and cached on the fly.</p>
35,150
<p>I've got a canvas that's 800x600 inside a window that's 300x300. When I press a certain key, I want it the canvas to move in that direction.<br> I've done this inside the window's code behind:</p> <pre> protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); Key keyPressed = e.Key; if (k...
<p>Currently, your setup is accepting spammed keyinput (holding down a key). The way I've seen it done in most games with event based input is to use a boolean array, <code>keydown[256]</code>, mapping the keyboard (the index being the key value); all values initialized to <code>false</code>.</p> <p>When the key is pr...
<p>Yes, you could incorporate the time into your calculation. Currently you add/substract 5 whenever the event fires, and that's not really predictable.</p> <p>To smoothe the movement make sure you don't fire more often than X times per second by using a DateTime.</p> <p>like:</p> <pre><code>private static DateTime ...
32,533
<p>Which files should I include in <code>.gitignore</code> when using <em>Git</em> in conjunction with <em>Xcode</em>?</p>
<p>I was previously using the top-voted answer, but it needs a bit of cleanup, so here it is redone for Xcode 4, with some improvements.</p> <p>I've researched <em>every</em> file in this list, but several of them do not exist in Apple's official Xcode documentation, so I had to go on Apple mailing lists.</p> <p>Ap...
<blockquote> <p><em>A Structure of a standerd .gitignore file for Xcode project ></em></p> </blockquote> <pre><code>.DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db Thumbs.db build/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectiv...
7,209