instruction
stringlengths
0
30k
Check Patrick's library to handle path operations [link text][1] This is the [codeplex project][2] [1]: http://codebetter.com/blogs/patricksmacchia/archive/2007/10/18/a-free-library-to-handle-common-path-operation.aspx [2]: http://www.codeplex.com/FileDirectoryPath
Try `chcp 65001 && start.bat`
All the code in the web folder should be backed by SVN commits, shouldn't it? If this is the case you should easily be able to track the problem down just by looking through your SVN logs at the last few changes that got committed. `svn info` will tell you which revision the working copy currently is at, so you kno...
How to retrieve an element from a set without removing it?
|python|
Suppose the following: >>>s = set([1, 2, 3]) How do I get a value (any value) out of s without doing s.pop()? I want to leave the item in the set until I am sure I can remove it - something I can only be sure of after an asynchronous call to another host. Quick and dirty: >>>elem = s.pop() >>>s...
Suppose the following: >>>s = set([1, 2, 3]) How do I get a value (any value) out of s without doing s.pop()? I want to leave the item in the set until I am sure I can remove it - something I can only be sure of after an asynchronous call to another host. Quick and dirty: >>>elem = s.pop() >>>s...
|python|set|
To say that `SELECT COUNT(*) vs COUNT(1)` results in your DBMS returning "columns" is pure bunk. That *may* have been the case long, long ago but any self-respecting query optimizer will choose some fast method to count the rows in the table - there is **NO** performance difference between `SELECT COUNT(*), COUNT(1), C...
To say that `SELECT COUNT(*) vs COUNT(1)` results in your DBMS returning "columns" is pure bunk. That *may* have been the case long, long ago but any self-respecting query optimizer will choose some fast method to count the rows in the table - there is **NO** performance difference between `SELECT COUNT(*), COUNT(1), C...
To say that `SELECT COUNT(*) vs COUNT(1)` results in your DBMS returning "columns" is pure bunk. That *may* have been the case long, long ago but any self-respecting query optimizer will choose some fast method to count the rows in the table - there is **NO** performance difference between `SELECT COUNT(*), COUNT(1), C...
I'm not sure about other databases, but for SQL Server I recommend the Execution Plan. It very clearly (albeit with lots of vertical and horizontal scrolling, unless you've got a 400" monitor!) shows what steps of your query are sucking up the time. If you've got one step that takes a crazy 80%, then maybe an index ...
Virtualbox host-guest network setup
|virtualbox|
How do I set up a network between the Host and the guest OS in Windows vista?
I think you're supposed to use the **float** property for positioning things like that. You can read about it here: [http://css.maxdesign.com.au/floatutorial/][1] [1]: http://css.maxdesign.com.au/floatutorial/
Null coalescing operator, like the C# *??* operator you can use `var a = b || c;` in JavaScript *a* will get the value of *c* if *b* is null
I've switched to Subversion and FogBugz so I am rusty on StarTeam. I think you need a View Label. 1. From `View` menu, select `Labels...` to open the Labels dialog. 2. On the `View` tab, click `New...` button to open View Label dialog. 3. Type in label name as "Release 1.2.3.4", check `Frozen`, and hit `OK`. ...
Recursive Lamba to Traverse a Tree in C#
|c#|
Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#.
Joyent's [**Slingshot**][1] might be a good bet. > Joyent Slingshot allows developers to deploy Rails applications like a standard desktop application, which work online and offline (with synchronization), have drag and drop, and interact with all the other desktop applications. > With Joyent Slingshot: >* Cre...
I've disabled UAC and now it seems to work.
One thing we have done with some success in the past in these kinds of situations is to hand the issues over to the client. > "OK, you want to change it - this is > what will happen if you do that. These > are the issues involved. You have a > think about how you'd like it to work > and then get back to us". ...
Testing 52! possibilities is of course impossible. Instead, try your shuffle on smaller numbers of cards, like 3, 5, and 10. Then you can test billions of shuffles and use a histogram and the chi-square statistical test to prove that each permutation is coming up an "even" number of times.
How about [Conditional breakpoints][1]? You could try for various conditions like first element value is zero or non zero, etc?? [1]: http://blogs.msdn.com/saraford/archive/2008/06/17/did-you-know-you-can-set-conditional-breakpoints-239.aspx
One cheapter alternative to Xoreax IB is the use of what I call uber-file builds. It's basically a .cpp file that has #include "file1.cpp" #include "file2.cpp" .... #include "fileN.cpp" Then you compile the uber units instead of the individual modules. We've seen compile times from from 10-15...
One cheaper alternative to Xoreax IB is the use of what I call uber-file builds. It's basically a .cpp file that has #include "file1.cpp" #include "file2.cpp" .... #include "fileN.cpp" Then you compile the uber units instead of the individual modules. We've seen compile times from from 10-15 ...
I'll take a stab at this. Python and Ruby are duck-typed. To generate any maintainable code in these languages, you pretty much have to use test driven development. As such, it is very important for a developer to easily inject dependencies into their code without having to create a giant supporting framework. S...
The url to the blog post mentioned above, for hiding the stp templates using the stsadm extention, is <http://stsadm.blogspot.com/2007/08/set-available-site-templates.html> > Here’s an example of how to remove a template from the list of available templates for a site collection: >>stsadm –o gl-removeavailablesit...
How to get file extension from string in C++
|c++|string|filenames|
Given a string "filename.conf", how to I check get the extension part?
Given a string "filename.conf", how to I verify the extension part? I need a cross platform solution.
It would be helpful if you can explain why you want to get this information. But I suspect that the method both most reliable and most general is going to be the PublicKeyToken. Yes, there's more than one, but it's going to be a finite list and one that doesn't change very often. **Edit:** for that matter, you cou...
For the iPhone there's currently no such notion as Open Source as the Apple iPhone SDK NDA forbids publishing code. They also forbid posting code on any non-Apple site or even non-Apple discussion forums on iPhone development. As soon as the NDA expires (will it ever?) we'll start having Open Source iPhone apps.
I think Flash should be limited to online games, videos and animation. Otherwise use html and Ajax. It's a web standard and supported by almost all devices. AFAIK, the iPhone doesn't support Flash. That's a fast growing segment you're blocking out already. Keep it simple and efficient.
To the best of my knowledge, there is not. It seems that you may be better off using another hash instead of %ENV. If you are calling many outside modules and want to track the same variables across them, a Factory pattern may work so that you're not breaking DRY, and are able to use a case-sensitive hash across mult...
- Correctly designed AJAX apps are more googleable than Flash - Correctly designed AJAX apps are more easily deep linkable than Flash - AJAX doesn't require a plugin (Flash is pretty ubiquitous, so it's not really a big deal) - AJAX isn't controlled by a single company the way Flash is
Yeah, those bastard crashes are the hardest to fix. Fortunatly, there are some steps you can do that will give you clues before you resort to manually looking at the code and hope to find the needle. When does it crash? At every test? At a specific test? What does that test does that the others don't? What's the ...
I don't think there is; in my experience, MDI in Delphi is very strictly limited and controlled by its implementation in the VCL (and perhaps also by the Windows API?). For example, don't try hiding an MDI child (you'll get an exception if you try, and you'll have to jump through a couple of API hoops to work around th...
Have you tried: [2007 Office System Document: UI Style Guide for Solutions and Add Ins][1] ? [1]: http://www.microsoft.com/downloads/details.aspx?FamilyId=19E3BF38-434B-4DDD-9592-3749F6647105&displaylang=en
HTTP works slightly differently than FTP though unfortunately. Although both may look the same in your browser, HTTP works off the basis of URI (i.e. to access resource A, you have an identifier which tells you how to access that). FTP is very old school server driven. Even anonymous FTP is a bit of a hack, since yo...
HTTP works slightly differently than FTP though unfortunately. Although both may look the same in your browser, HTTP works off the basis of URI (i.e. to access resource A, you have an identifier which tells you how to access that). FTP is very old school server driven. Even anonymous FTP is a bit of a hack, since yo...
@Daren Thomas: I agree, but you should use the [platform module][1] to determine which interpreter you're running. [1]: http://docs.python.org/dev/library/platform.html#platform.python_implementation
Automatic code quality tool for Ruby?
|ruby|ruby-on-rails|software-tools|code-analysis|
One thing I really miss about Java is the tool support. FindBugs, Checkstyle and PMD made for a holy trinity of code quality metrics and automatic bug checking. Is there anything that will check for simple bugs and / or style violations of Ruby code? Bonus points if I can adapt it for frameworks such as Rails so...
ScottGu has a bunch of tricks at http://weblogs.asp.net/scottgu/archive/2006/04/03/441787.aspx
OpenGl And Flickering
|opengl|
When objects from a CallList intersect the near plane I get a flicker..., what can I do? Im using OpenGL and SDL. Yes it is double buffered.
You need to append ";HttpOnly" to the Response cookies collection.
Try this site [www.iconsreview.com][1], they offer reviews for a variety of icon packages, both free and for purchase. [1]: http://www.iconsreview.com/
JVM choices on Windows Mobile..
|windows-mobile|jvm|
What are the JVM implementations available on Windows Mobile? [Esmertec JBed][1] is the one on my WinMo phone. Wondering how many other JVM vendors are in this zone. Are there any comparison or benchmarking data available? [1]: http://www.esmertec.com/40.html
Try to put the near clipping plane a little bit further : for example with gluPerspective -> third parameter **zNear** [http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/perspective.html][1] [1]: http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/perspective.html
Have you tried right clicking the website in Solution Explorer and clicking 'Publish Website'?
ASP.Net doesn't have _real_ xcopy deployment for _new_ sites. It depends on having a virtual directory/Application in IIS.
I tend to prefer attaching a trigger to the table using enterprise manager. That way you don't need to worry about writing out extra sql statements in your code. Mine look something like this: Create Trigger tblName On dbo.tblName For Insert As select new_id = @@IDENTITY Then, from within your code, treat y...
Ah, you meant the *near* plane. :) Well...another thing when drawing polygons in the same plane is to use [glPolygonOffset][1] From the description glPolygonOffset is useful for rendering hidden-line images, for applying decals to surfaces, and for rendering solids with highlighted edges. ...
Recursive lambda expression to traverse a tree in C#
|c#|lambda|
|c#|lambda|recursion|
<sourcecontrol type="starteam"> <executable>C:\Program Files\starbase\StarTeam 5.4\stcmd.exe</executable> <project>ProjectName/ViewName</project> <username>UserName</username> <password>Password</password> <host>127.0.0.1</host> <port>49201</port> <autoGetSource>true</autoGetSource> <overrideVi...
Consider refactoring your application to separate the user-interaction portions from the business logic. In my experience, such a separation is quite beneficial to the structure of your program. For the particular problem you're trying to solve here, it becomes straightforward for the user-interaction part to chang...
Override Working Folder with Starteam/CruiseControl
|cruisecontrol.net|starteam|
For some reason, I can't seem to get CruiseControl.net to checkout code to anywhere but the starteam working folder for a specificed view. I've tried both overrideViewWorkingDir and overrideFolderWorkingDir, and neither seem to work. Has anyone been able to do this?
|continuous-integration|cruisecontrol.net|starteam|
It's surprising how many people don't realize that its object oriented as well.
You could find an answer [here][1] [1]: http://stackoverflow.com/questions/53224/getting-international-characters-from-a-web-page#53246
You could find an answer [here][1] **EDIT**: It seems like `BeautifulSoup` doesn't convert entities written in hexadecimal form. >>> html = '<html>&#x01ce;&#462;</html>' >>> f = lambda html: BeautifulSoup(html, ... convertEntities=BeautifulSoup.HTML_ENTITIES).renderContents() >>> f(html) ...
You could find an answer [here][1] **EDIT**: It seems like `BeautifulSoup` doesn't convert entities written in hexadecimal form. It can be fixed. import copy, re from BeautifulSoup import BeautifulSoup hexentityMassage = copy.copy(BeautifulSoup.MARKUP_MASSAGE) hexentityMassage = [(re.compile(...
As a side note, you should be using [URI](http://java.sun.com/javase/6/docs/api/java/net/URI.html) because Java URL class is screwed up. (The equals method I believe)
Why don't you just use a Double?
For what purpose do you need this? Because disabling the backspace would be hell for typing urls or emails, etc. We could recommend other workarounds if we knew the problem better.
For what purpose do you need this? Because disabling the backspace would be hell for typing urls or emails, etc. We could recommend other workarounds if we knew the problem better. EDIT 1:<br /> This website seems to have some information as to how it's done. I can't verify it currently, but I'll look into it: ...
For what purpose do you need this? Because disabling the backspace would be hell for typing urls or emails, etc. We could recommend other workarounds if we knew the problem better. EDIT 1:<br /> This website seems to have some information as to how it's done. I can't verify it currently, but I'll look into it: ...
For what purpose do you need this? Because disabling the backspace would be hell for typing urls or emails, etc. We could recommend other workarounds if we knew the problem better. EDIT 1:<br /> This website seems to have some information as to how it's done. I can't verify it currently, but I'll look into it: ...
Will .NET MVC give me the HTML/CSS/JS separation I need?
|.net|javascript|html|css|mvc|
I'm working with my ASP.NET development team to try and create "better" (i.e. cleaner) HTML when rendering pages. At the moment, .NET has a nasty tendency to do things like dump JavaScript into the page, making it a mandatory requirement on form controls and not allowing forms to work when JS isn't available. In some...
[Tree Surgeon][1] is a great tool which creates an empty .NET development tree. It has been tweaked over years of use and implements lots of best practices. [1]: http://www.codeplex.com/treesurgeon
Trilsson made a separate topic about the testing part of the question http://stackoverflow.com/questions/56411/how-to-test-randomness-case-in-point-shuffling very good idea Trilsson:)
It's an easy test to see if the surface lock is the problem, just comment out the texture update and see if the framerate returns to 60hz. Unfortunately, writing to a locked surface and updating the resource kills perfomance, always has. Are you using mipmaps with the textures? I know DX9 added automatic generation o...
Nelson: "That's how foxpro does it and there is no way around it"? I'm using FOX since FoxPro 2.5 to Visual FoxPro 9, and you are NEVER forced in any way to hard-code a path, you can use SET PATH TO (sYourPath), you can embed the icons and bitmaps in your EXE / APP file and therefore there's no need of including ...
- Correctly designed AJAX apps are more googleable than Flash - Correctly designed AJAX apps are more easily deep linkable than Flash - AJAX doesn't require a plugin (Flash is pretty ubiquitous, so it's not really a big deal)* - AJAX isn't controlled by a single company the way Flash is Edited to add: * ...
SQL Server2005 memory locking
|sql-server|
I've noticed that SQL Server 2005 x64 does not seem to lock pages into memory the same way SQL Server 2000 did. In 2000 I could easily see from task manager that SQL had locked 8GB of ram with AWE. I'm fairly certain I've got 2005 setup in an equivalent way. Is this a normal x64 difference or am I forgetting a cru...
I've only listened to the first 6-7 minutes of the podcast that sparked your question. If their intent is to say that C# isn't a purely object-oriented language, that's actually correct. Everything in C# isn't an object (at least the primitives aren't, though boxing creates an object containing the same value). In R...
Although flash is pretty ubiquitous on desktop browsers, mobile support is very limited (flash lite? yeah, right). I get really frustrated looking up a restaurant on my phone only to find the entire site is flash based and I can't even get a phone number or address!
Thanks for the Oracle timings, that's the kind of stuff I'm looking for (disappointing though :-) Materialized views are probably worth considering as I think I can precompute the most interesting forms of this query for most users. I don't think query round trip time should be very high as i'm running the the qu...
This should prove difficult, since in VB6 all objects are COM (`IDispatch`) things. Thus they are only an interface. `TypeOf(object) is class` probably only does a COM get_interface call (I forgot the exact method name, sorry).
You could find an answer [here][1] **EDIT**: It seems like `BeautifulSoup` doesn't convert entities written in hexadecimal form. It can be fixed. import copy, re from BeautifulSoup import BeautifulSoup hexentityMassage = copy.copy(BeautifulSoup.MARKUP_MASSAGE) hexentityMassage = [(re.compile(...
I don't believe there is an established "best practice". I put my tests in another directory outside of the app code. I then add the main app directory to sys.path (allowing you to import the modules from anywhere) in my test runner script (which does some other stuff as well) before running all the tests. This way ...
### I want to clarify this situation. According to Microsoft guidelines, it's a good practice to provide Close method where suitable. Here is a citation from [Framework design guidelines][1] > Consider providing method Close(), in addition to the Dispose(), if close is standard terminology in the area. When doing ...
[JavaScript does not have block scope][1] (but it has [closure][2] so let's call it even?). var x = 1; { var x = 2; } alert(x); // outputs 2 [1]: http://developer.mozilla.org/En/Core_JavaScript_1.5_Guide:Block_Statement [2]: http://developer.mozilla.org/en/Core_JavaScript_1.5_Gui...