instruction
stringlengths
0
30k
If 'a' and 'b' are next to each other and have the same parent, you can use the prevSibling property of 'b' to find 'a'.
How to detect the presence of a default recording device in the system?
|winapi|audio|device|
How do I detect if the system has a default recording device installed? I bet this can be done through some calls to the Win32 API, anyone has any experience with this? I'm talking about doing this through code, not by opening the control panel and taking a look under sound options.
|winapi|audio|device|
Using GLUT bitmap fonts
|opengl|fonts|glut|bitmap|
I'm writing a simple OpenGL application that uses GLUT. I don't want to roll my own font rendering code, instead I want to use the simple bitmap fonts that ship with GLUT. What are the steps to get them working?
|opengl|fonts|glut|bitmaps|
Windows Mobile Device Emulator - how to save config permanently?
|visual-studio|windows-mobile|device|emulation|
I am working at a client site where there is a proxy server (HTTP) in place. If I do a hard reset of the emulator it forgets network connection settings for the emulator and settings in the hosted Windows Mobile OS. If I 'save state and exit' it will lose all of these settings. I need to do hard resets regularly which ...
If i understand well your needs, i think that the best way of doing it, is to have all maps as externals of the main trunk and then make a script that recursively tags each map (external) to it's current revision in the working copy (or the server if you want it that way).
[Raphael][1] is a javascript framework for manipulating vector graphics, either with SVG or VML, depending on what the browser supports. [1]: http://raphaeljs.com/
Your code looks fine, I would use the method `ADD_NODES_AND_ITEMS` myself if I were to add nodes and items ;) Beyond that, try to call `EXPAND_NODE` after you added the items/nodes and see if that helps. T.
Use `java.beans.XMLEncoder`. Its API is very simple (actually a little too simple; it'd be nice to wire it to a SAX ContentHandler), but it works on many graphs out of the box, and it's easy to create your own persistence delegate for any odd-ball classes you might encounter. - The syntax used by XMLDecoder allows...
Ah thank you Theo - indeed seems I was confused there. I think the root of the confustion came from the fact I was able to assign textInput.text = node; Which I know guess is just implicity calling XML.toString() to convert XML->String. setChildren() is what I was looking for.
Ah thank you Theo - indeed seems I was confused there. I think the root of the confustion came from the fact I was able to assign textInput.text = node; Which I now guess is just implicity calling XML.toString() to convert XML->String. setChildren() is what I was looking for.
Apache's commons lang is your friend here - it provides a join method very similar to the one you refer to in Ruby. [join(java.util.Collection,char)][1] [1]: http://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html#join(java.util.Collection,%20char)
The MFC feature pack is derived from [BCGSoft components][1]. [1]: http://www.bcgsoft.com/
[Raphael][1] looks like an interesting take on the problem of cross-browser vector graphics. [1]: http://raphaeljs.com/
Blocking part of a website
|dns|osx-leopard|google|
I am trying to block Google Reader: reader.google.com www.google.com/reader I blocked reader.google.com by changing my /etc/hosts file (this is for a Mac) Is there any way to block www.google.com/reader without buying software? Note this is for Safari so Greasemonkey won't work, and Leopard's Parental Contr...
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#listRoots() <pre> File[] roots = File.listRoots(); for(int i=0;i&lt;roots.length;i++) System.out.println("Root["+i+"]:" + roots[i]); </pre> google: list drives java, first hit:-)
For me, Wordpress is still the quickest & simplest to setup and get going. It can be extended to do pretty much anything or you can keep it real simple. Runs on PHP, but unless you want to write plugins for it, you never need to write code
For me, [Wordpress][1] is still the quickest & simplest to setup and get going. It can be extended to do pretty much anything or you can keep it real simple. Runs on PHP, but unless you want to write plugins for it, you never need to write code [1]: http://wordpress.org/
How can you handle an IN sub-query with LINQ to SQL?
|sql|linq|linq-to-sql|
I'm a bit stuck on this. Basically I want to do something like the following SQL query in LINQ to SQL: SELECT f.* FROM Foo f WHERE f.FooId IN ( SELECT fb.FooId FROM FooBar fb WHERE fb.BarId = 1000 ) Any help would be gratefully received. Thanks.
I don't know, but this sounds like a really "hard" problem (in the sense that all real-world) problems are really hard. I bet the underlying problem is something to do with the setting of the focus. Windows that manually do that are evil and generally suffer from all manner of bugs.
I am sure you can get to the serial number of the cpu on most os's; you could use that, after all if they transplant the cpu its safe to assume that the old machine would no longer be in use? Secondly a web service could be used to find out the current data capacity and what the client has paid for.
I've tried WordPress recently and am very disappointed. As long as you don't want to customize anything, all is well. But imagine you want to install a plugin to handle Markdown editing. There the trouble begins. The plugin architecture of WordPress is seriously screwd up. In the case of Markdown, this means that no go...
from f in Foo where f.FooID == ( FROM fb in FooBar WHERE fb.BarID == 1000 select fb.FooID ) select f;
You need a Rank field for each product (which could also be the DisplayOrder field). When the administrator ups or downs a product, update the rank value. When you need to list the products, do a select query which sorts in DESC order of rank.
The basic idea is that goto gives you too much freedom to do something you didn't intend to. It can cause errors in places that don't appear to be related to the goto statement, so it makes code maintenance more difficult. If you think you need a goto statement, you're wrong :) and you should instead rethink your code ...
$(function() { $("form#myForm input[type='radio']").click( fn ); }); function fn() { //do stuff here }
What you want is a <a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a> they are easy to create and should work in most major browsers.
What you want is a <a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a> they are easy to create and should work in most major browsers. you cal click <a href="javascript:window.location='http://www.google.com/search?q='+Date()">this</a> and drag to your bookmarks toolbar to get a bookmarklet that searc...
What you want is a <a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a> they are easy to create and should work in most major browsers. Edit: Stack overflow seems not to allow creating bookmarklets in the context of the site, basically you can create a new bookmark and type the following in the locatio...
What you want is a <a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a> they are easy to create and should work in most major browsers. Edit: Stack overflow seems not to allow creating bookmarklets in the context of the site, basically you can create a new bookmark and type the following in the locatio...
Best way to make a printer-friendly ASP.NET page?
|asp.net|
I'm just curious how most people make their ASP.NET pages printer-friendly? Do you create a separate printer-friendly version of the ASPX page, use CSS or something else? How do you handle situations like page breaks and wide tables? Is there one elegant solution that works for the majority of the cases?
Don't use Regex.Replace in this case... use.. foreach(Match in Regex.Matches(...)) { //do your stuff here }
I really like Thompson’s “Haskell: The Craft of Functional Programming” because it’s well written and Haskell allows an easier start than other functional languages while being completely pure (unlike Lisp or Scheme).
Have you added a prototype with parameters to your header file? I mean is there somewhere in fileA.h template<> SomeFunc<int>(); If not that's probably the reason.
I vote for IB. I've used them in the past as was quite happy. Pinnacle trading also has an api ( pcmtrading.com ) but I haven't used them.
**Lisp:** (defun palindrome(x) (string= x (reverse x)))
WCF Service support file jsdebug fails to load
|asp.net|wcf|javascript-debugger|
I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. Restarting IIS or clearing out the Temp ASP.Net files or setting batch...
I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. Restarting IIS or clearing out the Temp ASP.Net files or setting batch...
There are a few. I was looking into [MBTrading][1] for a friend. I didn't get too far, as my friend lost interest. Seemed relatively straigt forward with a C# and VB.Net SDK. They had some docs and everything. This was ~6 months ago, so it may be better (or worse) by now. IIRC, you can create a demo account for free...
Brandon: that's what I thought - the specialized function should never be called. Which is true for the second application I mentioned. The first app, however, clearly calls the specialized form even though the specialization is not declared in the header file! I mainly seek enlightenment here :-) because the first ...
For most needs on the desktop you wont need to know the Win32, however there is a LOT of Win32 not in .NET, but it is in the outlaying stuff that may end up being less than 1% of your application. USB support, HID support, Windows Media Foundation just off the top of my head. There are many cool Vista API's only ava...
Using ps is the right way. I've already done something similar before but don't have the source handy. Generally - ps has an option to tell it which fields to show and by which to sort. You can sort the output by running time, grep the process you want and then kill it. HTH
The file in the .svn directory that keeps track of what you have checked out, when, what revision, and from where, has gotten corrupted somehow, for that particular file. This is no more dangerous or critical than the normal odd file problem, and can be because of various problems, like a subversion program dying mi...
Separate the condition in several booleans and then use a master boolean as the condition. bool isOpaque = object.Alpha == 1.0f; bool isDrawable = object.CanDraw && object.Layer == currentLayer; bool isHidden = hideList.Find(object); bool isVisible = isOpaque && isDrawable && ! isHidde...
Separate the condition in several booleans and then use a master boolean as the condition. bool isOpaque = object.Alpha == 1.0f; bool isDrawable = object.CanDraw && object.Layer == currentLayer; bool isHidden = hideList.Find(object); bool isVisible = isOpaque && isDrawable && ! i...
I am trying to block Google Reader: reader.google.com www.google.com/reader I blocked reader.google.com by changing my /etc/hosts file (this is for a Mac) Is there any way to block www.google.com/reader without buying software? Note this is for Safari so Greasemonkey won't work, and Leopard's Parental Contr...
|google|dns|osx-leopard|
I am trying to block Google Reader: reader.google.com **www.google.com/reader** **The hard part is blocking the reader directory** I blocked reader.google.com by changing my /etc/hosts file (this is for a Mac) Is there any way to block www.google.com/reader without buying software? Note this is for Saf...
How to remove this parallel heirachy
|inheritance|oop|
I'm trying to find the best design for the following scenario - which is an application to store results of dance comeptitions. An event contains multiple rounds, each round contains a number of performances (one per dance). Each performance is judged by many judges, who return a scoresheet. There are two types ...
How to remove this parallel hierarchy
I'm trying to find the best design for the following scenario - an application to store results of dance competitions. An event contains multiple rounds, each round contains a number of performances (one per dance). Each performance is judged by many judges, who return a scoresheet. There are two types of rounds...
If you want to write your own, search for "formal automata" and/or "finite state machine grammar" In general what you will do is parse the string, pushing characters on a stack as you go. Then start popping the characters off and perform tasks based on what is popped. It's easier to code if you force equations to ...
For some reason I like the <a href="http://en.wikipedia.org/wiki/Schwartzian_transform">Schwartzian transform</a> @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_, foo($_)] } @unsorted; Where foo($_) represents a compute-intensive expression...
In your convert call, you need to specify a third style parameter, e.g., the format of the datetimes that are stored as varchar, as specified in this document: [CAST and CONVERT (T-SQL)][1] [1]: http://doc.ddart.net/mssql/sql70/ca-co_1.htm
Yes! You can throw events in C++/ActiveX land which makes the JavaScript code run an event handler function. I was even able to make an entire invisible (same as background color) ActiveX control with no buttons or visual feedback that did all of its GUI work through JavaScript and CSS. I will post my strategy for t...
Yes! You can throw events in C++/ActiveX land which makes the JavaScript code run an event handler function. I was even able to make an entire invisible (same as background color) ActiveX control with no buttons or visual feedback that did all of its GUI work through JavaScript and CSS. edit: Frank's advice is right...
Yes! You can throw events in C++/ActiveX land which makes the JavaScript code run an event handler function. I was even able to make an entire invisible ActiveX control (same color as page background) with no buttons or visual feedback that did all of its GUI work through JavaScript and CSS. edit: Frank's advice is ...
You basically make another CSS file that hide things or gives simpler "printer-friendly" style to things then add that with a "media=print" so that it only applies to print media (when it is printed) <link rel="stylesheet" type="text/css" media="print" href="print.css" />
If you do a Regex.Match, the resulting match objects group at the 0th index, is the subset of the intput that matched the regex. you can use this to stitch in the bold tags and encode it there.
A couple of additions to Mike Stone's reply: 1) The most frequent thing I use TestNG's groups for is when I want to run a single test method in a test suite. I simply add this test to the group "phil" and then run this group. When I was using JUnit 3, I would comment out the entries for all methods but the one I w...
@[John Millikin](#42997) gives a good answer, with the added complication of calculating the first day of the next month. This isn't particularly elegant, but to figure out the last day of the month that any given date lives in, you could try: def last_day_of_month(date): if date.month == 12: ...
EDIT: see [my other answer][1]. It has a better implementation than this one, which I leave here just in case someone's interested in seeing how one might "roll your own" calculator. @[John Millikin](#42997) gives a good answer, with the added complication of calculating the first day of the next month. This isn't p...
EDIT: see [my other answer][1]. It has a better implementation than this one, which I leave here just in case someone's interested in seeing how one might "roll your own" calculator. @[John Millikin](#42997) gives a good answer, with the added complication of calculating the first day of the next month. The follo...
That is not correct. Always best to come up with a test case that represents your data and see for yourself. If you want to really understand the Oracle SQL Optimizer google Jonathan Lewis, read his books, read his blog, check out his website, the guy is amazing, and he always generates test cases. create table ...
As far as I know, the "Create Dump" command was only added to Task Manager in Vista. The only process I know of to do this is using the adplus VBScript that comes with [Debugging Tools][1]. Short of hooking into dbghelp and programmatically doing it yourself. [1]: http://www.microsoft.com/whdc/devtools/debugging...
If you're control is a web user control, this is how you can get to the HTML it emits from another page or handler: public void GetHtmlFromMySweetControl(HttpContext context) { HttpRequest httpRequest = context.Request; HttpResponse httpResponse = context.Response; string foo = ...
If your control is a web user control, this is how you can get to the HTML it emits from another page or handler: public void GetHtmlFromMySweetControl(HttpContext context) { HttpRequest httpRequest = context.Request; HttpResponse httpResponse = context.Response; string foo = ht...
If you don't like shell extensions TortoiseSVN can be used as an application through its handy automation interface - one executable several command arguements. See [TortoiseSVN Manual][1] Each command raises a modal dialog for a specific task. [1]: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-a...
Dump the XML approach and use the import wizard / SSIS.
If you just need a static template, set the tsvn:logtemplate property. For dynamic generation, the /logmsgfile parameter does work, but it seems to need the full path. A batch file that looks like the following might work for you. GenerateLogMsg.exe > tmp.msg "C:\Program Files\TortoiseSVN\bin\TortoisePro...
|oop|inheritance|
I'm trying to find the best design for the following scenario - an application to store results of dance competitions. An event contains multiple rounds, each round contains a number of performances (one per dance). Each performance is judged by many judges, who return a scoresheet. There are two types of rounds...
In Lua: function f()return 1+f()end f() You've got to do something to the result of the recursive call, or else tail call optimization will allow it to loop forever. Weak for code golf, but nice to have! I guess that and the lengthy keywords mean Lua won't be winning the code golf anytime soon.
A Java solution is i-net Crystal-Clear: http://inetsoftware.de/products/crystalclear/ Supports Crystal Reports templates as well as any JDBC data source. Good price for what it does, especially in comparison to some of the "pricier" alternatives.
The simple answer is no. You can create a GraphicsPath in order to describe what you would like to draw, using AddPoint/AddLine/AddBezier and so forth as needed to describe the complex path of what you want to draw. When you draw the path you can provide a Brush which can be something like LinearGradientBrush or Radial...
One way would be to use the same location as the master database. You can query the SQL Server instance for that with the following SQL: select filename from master.dbo.sysdatabases where name = 'master' That will return the full path of the master database. With that path, you can use the FileInfo object t...
Looks like it was my own misunderstanding of the the API that caused by a problem. Solution:<br> 1. I've added a start commit hook script to TortoiseSVN using the hooks gui in the settings area of the right click menu. 2. The script receive 3 pieces of information: PATH MESSAGEFILE CWD For details s...
Looks like it was my own misunderstanding of the the API that caused by a problem. Solution:<br> 1) I've added a start commit hook script to TortoiseSVN using the hooks gui in the settings area of the right click menu. 2) The script receive 3 pieces of information: PATH MESSAGEFILE CWD For details s...
I do a lot of database work and rarely find cascade deletes useful. The one time I have used them effectively is in a reporting database that is updated by a nightly job. I make sure that any changed data is imported correctly by deleting any top level records that have changed since the last import, then reimport the ...
You'll have to configure apache for those static sub-domains. The "catch-all" site will be the default site configured, so that one will catch the other ones.
Couple of options here: 1. Attach to AppDomain.AssemblyResolve and do another LoadFile based on the requested assembly. 2. Spin up another AppDomain with the directory as its base and load the assemblies in that AppDomain. I'd highly recommend pursuing option 2, since that will likely be cleaner and allow you ...
Couple of options here: 1. Attach to `AppDomain.AssemblyResolve` and do another `LoadFile` based on the requested assembly. 2. Spin up another `AppDomain` with the directory as its base and load the assemblies in that `AppDomain`. I'd highly recommend pursuing option 2, since that will likely be cleaner and al...
You could write a little join-style utility method that works on java.util.Lists public static String join(List<String> list, String delim) { StringBuilder sb = new StringBuilder(); String loopDelim = ""; for(String s : list) { sb.append(loopDelim); sb...