instruction
stringlengths
0
30k
Volatile would only be useful if you need absolutely no delay between when one thread writes something and another thread reads it. Without some sort of lock, though, you have no idea of *when* the other thread wrote the data, only that it's the most recent possible value. For simple values (int and float in their v...
Why are you not using a Windows Forms TreeView control? If you are using this control, set the control's CheckBoxes property to true to enable check boxes, and set the Checked property on the nodes you want to display checked. To get the collection of root nodes, use the TreeView's Nodes property. This returns a Tre...
Compiling mxml files with ant and flex sdk
|apache-flex|ant|mxml|
I am just getting started with flex and am using the SDK (not Flex Builder). I was wondering what's the best way to compile a mxml file from an ant build script.
Security is conflated with your example: You shouldn't tell an attacker that a username exists, but the password is wrong. That's extra information you don't need to share. Just say "the username or password is incorrect."
I found the answer... The link to cream gave me some additional areas to search around. from http://genotrance.wordpress.com/2008/02/04/my-vim-customization/ there is a vim.reg registry file that contains the following <code> Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Edit with Vim] @=""...
OPENGL User Interface Programming
|python|opengl|user-interface|
I'm developing a graphical application to present data (not a game but a real workhorse app). It needs to be cross platform, so I have chosen: - python - openGL (I need 3D, blending, textures etc) - pyopengl - wx/pywx - windowing, dialogs etc. The last component - WX - raises the question. I can put together a v...
We, at itemis (www.itemis.com) use model-driven Software Development alot. So far we had really good experiences. Shure it isn't a silver bullet, but it helps improving software quality hence more use for our customers.
Ctrl+A ? - show the help screen!
What is GNU Screen? Great! Erm, a slightly more useful answer: it allows you to run multiple console applications, or commands, in one terminal. Kind of like a tabbed terminal emulator. In fact, that's exactly what it is (just not done with the regular GUI toolkits) Why is it so great? Simple, you can run a progr...
If you use the HEAD request it will send the headers for the resource, there you can check the cache control headers which will tell you if the resource has been modified, last modification time, size (content-length) and date. $ telnet www.google.com 80 Trying 216.239.59.103... Connected to www.l.goo...
[Vimperator][] makes Firefox act very much like VIM: > Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor. It has similar key bindings, and you could call it a modal web browser, as key bindings differ according to which mode you are in. [vimperator]: http://v...
This is a general problem with the way Microsoft handled the ANSI vs. Unicode APIs. Since they are all (or pretty much all) done by defining macros for the function names that resolve to the 'A' or 'W' versions of the function names you cannot safely have an identifier in your namespace/class/struct/enum/function that...
The parseDate and formatDate tags work, but they work with Date objects. You can call new java.util.Date(longvalue) to get a date object, then pass that to the standard tag. somewhere other than the jsp create your date object. long longvalue = ...;//from database. java.util.Date dateValue = new java.ut...
As far as I know there's no real option to do what you want in gcc. The main problem being that all the code you want to strip debug symbols for is defined in headers. Otherwhise it would be possible to build a library separatly, strip that, and link with the stripped version. But only getting debug symbols from ...
Check to see if your editor has some kind of annotations feature. Ideally you could link a particular location in code with a small note, and store it in a centralized place. If it doesn't, that kind of plugin wouldn't be too hard to build, your biggest hurdle is going to be how to link the piece of code to a file (du...
You need to make sure that the display object you're removing: - has no listeners registered on the stage, e.g. you need to call `stage.removeEventListener(...)` for any corresponding `stage.addEventListener(...)` - doesn't have a listener for the `Event.ENTER_FRAME` event - doesn't listen for events on any ...
You want to create an SqlCeDataAdapter and use it .Fill() a dataset. Then serialize the entire dataset via it's .WriteXml() method.
[Big Nerd Ranch][1] The definitive class to take...well worth it! [1]: http://www.bignerdranch.com/classes/cocoa.shtml
As already mentioned by another, I reference this [post][1] whenever I need to change the .NET settings for a site. As for your question, the following steps (summarized from the linked post) should achieve what you need: 1. Run `aspnet_regiis -lk` from any .NET framework folder to list your current settings to ...
As already mentioned by another, I reference this [post][1] whenever I need to change the .NET settings for a site. As for your question, the following steps (summarized from the linked post) should achieve what you need: 1. Run `aspnet_regiis -lk` from any .NET framework folder to list your current settings to ...
If we are not interested in cross platform-ability, in windows you can use the MultiByteToWideChar function, or the helpful macros A2W (ref. [example][1]). [1]: http://weblogs.asp.net/kennykerr/archive/2008/07/24/visual-c-in-short-converting-between-unicode-and-utf-8.aspx
The webserver might send a last-modified and/or etag header for that purpose. And you might send an if-modified-since header in your request. see <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html> sections 14.19, 14.25 and 14.29
I have battled this problem myself last week and consider myself somewhat of an expert now ;) I'm 99% sure that not all dlls and static libraries were recompiled with the SP1 version. You need to put #define _BIND_TO_CURRENT_MFC_VERSION 1<br> #define _BIND_TO_CURRENT_CRT_VERSION 1 into *every* project you'r...
MDA is a bit of an overloaded concept. Sometimes it means turning UML or another type of diagrams in to executable code. I've never seen this work out well with the tools available nowadays. It usually causes projects to get results really fast and then cause a maintanance nightmare because the tools available don't re...
var = raw_input("Enter something: ") print "you entered ", var
Using Asp.Net MVC with SharePoint
|asp.net-mvc|sharepoint|
Is it possible to use the Asp.Net MCV framework within SharePoint sites?
Really consider why you need a singleton before writing it. There is a quasi-religious debate about using them which you can quite easily stumble over if you google singletons in Java. Personally I try to avoid singletons as often as possible for many reasons, again most of which can be found by googling singletons....
Looking at Reflector, the SelectNodes() method on XmlDocument's base class, XmlNode, can return null if its attempt to create a navigator returns null. CreateNavigator() is pretty complex and will indeed return null under a few circumstances. Those circumstances appear to be around a malformed XML document - so there...
var area = { "Texas" : { "Cities" : ['Austin','Dallas','San Antonio'] }, "Arkansas" : { "Cities" : ['Little Rock','Texarkana','Hot Springs'] } }; Then you can do: area["Texas"].Cities[0];
This would give you the array of cities based on knowing the state's name: var area = { "Texas" : ["Austin","Dallas","San Antonio"], "Arkansas" : ["Little Rock","Texarkana","Hot Springs"] }; // area["Texas"] would return ["Austin","Dallas","San Antonio"]
Accessing Tomcat Context Path from Servlet
|java|javascript|tomcat|servlets|
In my Servlet I would like to access the root of the context so that I can do some JavaScript minifying. It would be possible to do the minify as part of the install process but I would like to do it on Servlet startup to reduce the implementation cost. Does anyone know of a method for getting the context directo...
Try taking a look at a couple of tools that I think could get you most of what you need: 1) [p4pr][1] Perl script by Bob Sidebotham. 2) [Emacs Perforce][2] interface has a command 'p4-print-with-rev-history' (bound to `C-x p V'). [1]: ftp://ftp.perforce.com/pub/perforce/contrib/misc/p4pr.perl [2]: http...
I have been evaluating Gallio and it is truly a great concept. Now I don't have to tell my developers what unit testing framework they have to use, because it has integration with all the major ones that I know of. They can use which ever they are most comfortable with and I get unit tested code. The [Resharper][1...
It looks like you can treat it just like an external hard drive (plug the memory card in and figure out where the mount point is).
ifs its a large code base try apc if you're not already. http://pecl.php.net/package/APC
OK, I am unsure what you are trying to do here: - The code you are posting is **NOT** .NET, are you trying to port? - DateTime's cannot be declared as constants. - DateTime's are a data type, so once init'ed, the format that they were init'ed from is irrelevant. - If you need a constant value, then just c...
This functionality was misplaced in mod\_gzip anyway. In Apache 2.x, [you do that with content negotiation](http://httpd.apache.org/docs/2.2/content-negotiation.html). Specifically, you need to enable `MultiViews` with the [`Options` directive](http://httpd.apache.org/docs/2.2/mod/core.html#options) and you need to spe...
[It's All Text!](https://addons.mozilla.org/en-US/firefox/addon/4125) will let you use whatever editor you want. To use vim with it, you'll need a small shell script to open it in a terminal: #!/bin/sh exec xterm -e /usr/bin/vim "$@" If you have GVim, you won't need the shell, script, obviously.
LinqPad is great for testing linq to objects/xml/sql. Free download.
how do i take picture from a digital camera attached to my computer throught USB cable using vb.net or asp.net or C#?
|c#|vb.net|image-capture|
I am writing picture editing windows forms application using vb.net/c#. i have a client requirement to capture the photo from digital still camera attached to computer. how can i capture a photo from USB connected digital still camera device in my windows application ?
If the database schema changes often, prefer the Entity Framework over LINQ2SQL. If the schema changes, using L2S you have to 1) Remove and re-add you table (loosing your customizations) 2) Modify the model by hand (as done here in stackoverflow) The EF is a super-set of L2S, giving you more flexibility of usa...
Is it possible to offline a disk in a raidz zfs pool?
|linux|filesystems|solaris|zfs|
When i try to offline a disk in a zfs raidz pool (the raidz pool is not mirrored), zfs says that the disk cannot be taken offline because it has no valid mirror. Isn't one of the properties of raidz that it has a redundant disk (or even 2 disks in raidz2)...?
You could do a select on the tables inserting commas after each field to produce a csv, or use a GUI tool to return all the data and save it to a csv.
Donald Norman, 'The Design of Everyday Things' Not about programming, per se, but about how things in the world should *work* -- kind of the psychology of usability. It's been invaluable for me in designing both end-user interfaces and APIs.
PostgreSQL 8.3 privileges not updated - wrong usage?
|authentication|postgresql|user|privileges|roles|
I'm having trouble granting privileges to another user in PostgreSQL 8.3. While the GRANT command gives me no error, the privileges do not show up. Do I need to "flush" them? sirprize=# CREATE DATABASE testdb; CREATE DATABASE sirprize=# GRANT ALL PRIVILEGES ON DATABASE testdb TO testuser; GRANT ...
How To Generate A Javascript File From The Server
|c#|asp.net|javascript|tinymce|blogengine.net|
I'm using BlogEngine.NET (a fine, fine tool) and I was playing with the TinyMCE editor and noticed that there's a place for me to create a list of external links, but it has to be a javascript file: `external_link_list_url : "example_link_list.js"` this is great, of course, but the list of links I want to use nee...
Changing the default folder in emacs
|emacs|directory|
I am fairly new to emacs and I have been trying to figure out how to change the default folder for c-x c-f on start up. For instance when I first load emacs and hit c-x c-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the desktop. I believe there is some way to customize the .emacs file to do...
|emacs|directory|
I am fairly new to emacs and I have been trying to figure out how to change the default folder for c-x c-f on start up. For instance when I first load emacs and hit c-x c-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the desktop. I believe there is some way to customize the .emacs file to do...
I am fairly new to emacs and I have been trying to figure out how to change the default folder for c-x c-f on start up. For instance when I first load emacs and hit c-x c-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the desktop. I believe there is some way to customize the .emacs file to do...
Jeff's ultimate developer rig series is great, but it's out of date. If you want to build your own ultimate developer rig, you can do hours of research to get the perfect list or use the tricks below to come up with a great component list in a short time. <br><br>**Credits**: [Mehul](http://stackoverflow.com/users/103...
How would I host an external application in WPF?
|wpf|hosting|external|
How can I host a (.Net, Java, VB6, MFC, etc) application in a WPF window. I have a need to use WPF windows to wrap external applications and control the window size and location. does anyone have any ideas on how to accomplish this or a direction to research in?
Instead of the messy fiddling with `%SIG` proposed by everyone else, just <code>use [Carp::Always](http://search.cpan.org/perldoc?Carp::Always)</code> and be done. Note that you can inject modules into a script without source modifications simply by running it with <code>perl&#160;-MCarp::Always</code>; furthermore,...
Actionscript 3: All done with arrays... var i=[]; i[i.push(i)]=i; trace(i); Maybe not the smallest but I think it's cute.
Actionscript 3: All done with arrays... var i=[]; i[i.push(i)]=i; trace(i); Maybe not the smallest but I think it's cute. Especially the push method returning the new array length!
Best way is two use a named [mutex][1]. 1. Start your application. 2. Create a new named mutex and take ownership over it 3. Start a new process (process not thread) or a new application, what you preffer. 4. From that process / application try to aquire the mutex. The process will block 5. When application...
I believe that this is **not** safe to do with NSManagedObjects (or subclasses) that are managed by a CoreData NSManagedObjectContext. In general, CoreData may do many tricky things with the sate of managed objects, including firing faults related to those objects in separate threads. Using CoreData with multiple th...
I believe that this is **not** safe to do with NSManagedObjects (or subclasses) that are managed by a CoreData NSManagedObjectContext. In general, CoreData may do many tricky things with the sate of managed objects, including firing faults related to those objects in separate threads. In particular, `[NSManagedObject i...
I guess what I really need here is not a Question/Answer format but some kind of poll. While I agree (and accepted) that because they are getting two different views of the same content, that different urls are ok, but I'm thinking more of sharing these urls out. Thanks for the reply though!
In C++, there's no reason for constructors to ever be virtual, because they are static functions. That means they're statically bound, so you have to identify the very constructor function you're calling in order to call it at all. There's no uncertainty and nothing virtual about it. This also means that, no matte...
Off the top of my head, advantages of Visual Studio 2008 over Visual C++ 6.0: - Much better standards-compliant compiler - Much improved STL implementation - Secure C runtime library - Improved code navigation - Improved debugger - Updated MFC library (in VS2008 Service Pack 1) Disadvantages of m...
Advantages of Visual Studio 2008 over Visual C++ 6.0: - Much more standards compliant C++ compiler, with better template handling - Support for x64 / mobile / XBOX targets - Improved STL implementation - Secure C runtime library - Improved code navigation - Improved debugger; possibility to run rem...
Advantages of Visual Studio 2008 over Visual C++ 6.0: - Much more standards compliant C++ compiler, with better template handling - Support for x64 / mobile / XBOX targets - Improved STL implementation - Secure C runtime library - Improved code navigation - Improved debugger; possibility to run rem...
OK, I am unsure what you are trying to do here: - The code you are posting is **NOT** .NET, are you trying to port? - DateTime's cannot be declared as constants. - DateTime's are a data type, so once init'ed, the format that they were init'ed from is irrelevant. - If you need a constant value, then just c...
In my experience the biggest overhead is in actually throwing an exception and handling it. I once worked on a project where code similar to the following was used to check if someone had a right to edit some object. This HasRight() method was used everywhere in the presentation layer, and was often called for 100s of ...
In my experience the biggest overhead is in actually throwing an exception and handling it. I once worked on a project where code similar to the following was used to check if someone had a right to edit some object. This HasRight() method was used everywhere in the presentation layer, and was often called for 100s of ...
You can use [<code>mod\_cache</code>][1] to proxy local content in memory or on disk. I don't know if this will work as expected with <code>mod\_deflate</code>. [1]: http://httpd.apache.org/docs/2.2/mod/mod_cache.html
I wasn't able to locate the runtime/.metadata folder, but [this very helpful post][1] directed me to add -consoleLog and -noExit to my runtime arguments, which dumped the errors to the console. Configuration problems. [1]: http://www.eclipsezone.com/eclipse/forums/t99010.rhtml
What happens to global variables declared in a DLL?
|c++|windows|dll|
Let's say I write a DLL in C++, and declare a global object of a class with a non-trivial destructor. Will the destructor be called when the DLL is unloaded?
Assuming cmd is your SqlCeCommand.... using(var dr = cmd.ExecuteReader()) { DataSet ds = new DataSet(); DataTable dt = ds.Tables.Add(); dt.Load(dr); ds.WriteXML(...); }
If you wanted to stick with Classic ASP then I would suggest creating a Database handling object via ASP Classes then just use that object to do your recordset creations. This would centralize your database handling code and make it so that you only have to handle SQL Injection attacks in a single location. A simpl...
How do I check to see if a value is an integer in MySQL?
|mysql|
I see that within MySQL there are Cast() and Convert() functions to create integers from values, but is there any way to check to see if a value is an integer? Something like is_int() in PHP is what I am looking for. Thanks! Craig
Advantages of Visual Studio 2008 over Visual C++ 6.0: - Much more standards compliant C++ compiler, with better template handling - Support for x64 / mobile / XBOX targets - Improved STL implementation - Secure C runtime library - Improved code navigation - Improved debugger; possibility to run rem...
Advantages of Visual Studio 2008 over Visual C++ 6.0: - Much more standards compliant C++ compiler, with better template handling - Support for x64 / mobile / XBOX targets - Improved STL implementation - Secure C runtime library - Improved code navigation - Improved debugger; possibility to run rem...
Advantages of Visual Studio 2008 over Visual C++ 6.0: - Much more standards compliant C++ compiler, with better template handling - Support for x64 / mobile / XBOX targets - Improved STL implementation - Support for C++0x TR1 (smart pointers, regular expressions, etc) - Secure C runtime library - ...
GPS and Embedded Development - Where to find resources?