instruction
stringlengths
0
30k
If you've never done any CGI programming before I think it would be worth doing one project - perhaps just a sample play site just for yourself - using the DIY approach. You'll learn a lot more about how all the various parts work than you would by using a framework. This will help in you design and debug and so on a...
If you've never done any CGI programming before I think it would be worth doing one project - perhaps just a sample play site just for yourself - using the DIY approach. You'll learn a lot more about how all the various parts work than you would by using a framework. This will help in you design and debug and so on a...
Erland Sommarskog has maintained the authoritative answer to this question for the last 12 years: [http://www.sommarskog.se/arrays-in-sql.html](http://www.sommarskog.se/arrays-in-sql.html) It's not worth reproducing all of the options here on StackOverflow, just visit his page and you will learn all you ever wanted...
could you redo that link in something like tinyurl.com? I need this info too but can get that mega-link to work.
Visual Studio is not needed, but for C++ you need the Platform SDK as well: [http://www.microsoft.com/downloads/details.aspx?familyid=484269E2-3B89-47E3-8EB7-1F2BE6D7123A&displaylang=en][1] Edit: There is also one for Windows 2008/Vista, not sure which is the correct one: [http://www.microsoft.com/downloads/de...
How do I make the jquery dialog work with the themeroller themes?
|javascript|jquery|dialog|
I am trying out the dialog from jquery ui. All the online [demos][1] use flora.css. I can't the dialog to display correctly with the css file generated by the [themeroller][2] application. Am I missing something? shouldn't these things work out of the box? [1]: http://dev.jquery.com/view/trunk/ui/demos/functio...
Have you looked at connecting to the server using [unixODBC][1]? If I remember correctly it has support for IBM DB2 and compiles on OpenBSD. Check out [http://www.php.net/odbc][2] for more information regarding the PHP side. If you can't get that to work the option to setup a web service on a Linux server may be all...
Embedded Database for .net that can run off a network
|.net|database|embedded|
I was (and still am) looking for an embedded database to be used in a .net (c#) application. The caveat: The Application (or at least the database) is stored on a Network drive, but only used by 1 user at a time. Now, my first idea was [SQL Server Compact edition][1]. That is really nicely integreated, but it can no...
[SQLite][1] came to my mind while reading your question, and I'm quite sure that it's possible to access it from a network drive *if* you keep yourself to the constraint of 1 user at a time. [edit:] added some more links to get you started with using SQLite with .NET: [http://www.mikeduncan.com/sqlite-on-dotnet-in...
Check out [VistaDB][1]. They have a very good product, the server version (3.4) is in Beta and is very close to release. [1]: http://www.vistadb.net
Scott Hanselman had a good Podcast about this, entitled "The Past, Present and Future of .NET Unit Testing Frameworks": [Hanselminutes #112][1] [1]: http://www.hanselminutes.com/default.aspx?showID=130
I think NUnit **is** your best bet. With TestDriven.NET, you get great integration within VS.NET. (Resharper also has a unit test runner if you're using it). NUnit it simple to use and follows an established paradigm. You'll also find plenty of projects/tutorials/guides using it which always helps. Your other main ...
VFP .NET OLEdb provider does not work in Win 64-Bits. Help
|.net|database|legacy|oledb|provider|visual-foxpro|
I wrote a windows service using VB that read some legacy data from Visual Foxpro Databases to be inserted in SQL 2005. The problem is this use to run fine in Windows server 2003 32-Bits, but the client recently moved to Windows 2003 64-Bits and now the service won't work. I'm getting a message the the VFP .NET OLEdb pr...
All you'll ever need to know (and then some): <http://msdn.microsoft.com/en-us/library/ms978498.aspx> Oh, and GC.Collect() forces a collect.
Depending on which sub directory of All Users you want, there's a couple different options [defined here][1]. For "All Users/Application Data" you would use System.Environment.GetEnvironmentVariable("%16419%") [1]: http://msdn.microsoft.com/en-us/library/ms933062.aspx
[Major Edit] You'll want to use the system.environment variables. Most of the predefined ones are [shown here][1]. For the "All Users" you would use System.Environment.GetEnvironmentVariable("ALLUSERSPROFILE") [1]: http://msdn.microsoft.com/en-us/library/system.environment.getenvironmentvariable.aspx
[Major Edit] You'll want to use the system.environment variables. Most of the predefined ones are [shown here][1]. For the "All Users" you would use System.Environment.GetEnvironmentVariable("ALLUSERSPROFILE") I know I got a lot of upmods and a correct answer for my other stuff, but this actually works. wher...
Summary of differences in Regular Expression syntax for various tools and languages?
|regex|grep|
I can never remember the differences in regular expression syntax used by tools like `grep` and `awk`, or languages like Python and PHP. Generally, Perl has the most expansive syntax, but I'm often hamstrung by the limitations of even `egrep` ("extended" `grep`). Anyone know of a site that lists the differences in a...
Try and break your own site before someone else does. Your web site is basically a publicly accessible API that allows access to a database and other backend systems. Test the URLs as if they were any other API. I like to start by cataloging all URLs that have some sort of permenant affect on the state of the system -...
Probably nothing in your example. My understanding is that "javascript:" is for anchor tags (in place of an actual href). You'd use it so that your script can execute when the user clicks the link, but without initiating a navigation back to the page (which a blank href coupled with an onclick will do). For example:...
I find this site helpful: <http://www.regular-expressions.info/> Other than that, I use the corresponding documentation extensively and I believe, all said and done, there's no way around that.
You can use the one built in, `hg view`. I believe you just have to enable it in your `.hgrc`. You'll also need tcl installed. I find it sometimes lags for a few seconds, but overall it's pretty decent.
You can use the one "built in", [`hg view`][1]. You'll need `TCL` installed though. >From the documentation: >>The hgk Tcl script is a direct port of the gitk tool used with git. The hgk.py extension allows hgk to interact with mercurial in a git-like manner. [1]: http://www.selenic.com/mercurial/wiki/index....
You can use the one "built in", [`hg view`][1]. You'll need `TCL` installed though. >From the documentation: >>The hgk Tcl script is a direct port of the gitk tool used with git. The hgk.py extension allows hgk to interact with mercurial in a git-like manner. _edit_ @ [Matthew][2]: yeah, that's why I linked to...
list.sort() It really is that simple :)
How do you unsubscribe from a ubiquity command
|ubiquity|
I can't seem to find details on how to unsubscribe from ubiquity commands. The command list page only seems to have information about the installed commands and there are no links to deleting them. Am I missing something?
I'm not clear exactly what you're asking, but variables will maintain their value for each iteration of a loop, as long as they're declared outside of the loop itself. For example: int a = 0; while(a < 10) { int b = 0; cout << "a: " << a << " b: " << b << "\n"; a++; b++; } In the above, t...
rix0rrr's answer is correct. However, if you find yourself wanting to do something slightly more complicated, you can pass a function to the sort method telling it how to sort. For example, mylist = ["b", "C", "A"] mylist.sort() print mylist # prints ['A', 'C', 'b'] myli...
Jeff Atwood himself described how StackOverflow.com sanitizes user input (in non-language-specific terms) on the Stack Overflow blog: <http://blog.stackoverflow.com/2008/06/safe-html-and-xss/> However, as Justin points out, if you use Django templates or something similar then they probably sanitize your HTML output...
|asp.net|asp.net-mvc|mvc|forms|routing|
> GUI-based command shell seems like an oxymoron to me. Not really? A command shell is just an encapsulated environment in which to execute commands. Why can't they have GUI extensions? We are in the 21st century! :) > Check out http://hotwire-shell.org/ This is along the lines of what I was thinking. It's a s...
All standard ASP.NET postbacks work by calling a __doPostBack javascript method on the page. That function submits the form (ASP.NET only really likes one form per page) which includes some hidden input field in which all the viewstate and other goodness lives. On the face of it I can't see anything in SimpalModal t...
Use a normalised colour histogram. (Read the section on applications [here](http://en.wikipedia.org/wiki/Color_histogram)), they are commonly used in image retrieval/matching systems and are a standard way of matching images that is very reliable and relatively fast. Essentially a colour histogram will capture the c...
I am trying out the dialog from jquery ui. All the online [demos][1] use flora.css. I can't the dialog to display correctly with the css file generated by the [themeroller][2] application. Am I missing something? shouldn't these things work out of the box? [1]: http://dev.jquery.com/view/trunk/ui/demos/functio...
Tool called Perforator will help you. See following article for details: [Performance Profiling Tools for WPF][1] [1]: http://msdn.microsoft.com/en-us/library/aa969767.aspx
No, you have to install the windows platform SDK. You'll need to download this: http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en **Edit:** @[Michael Stum][1] You need the Server 2008 / Vista / .NET 3.5 SDK version. [1]: http://stackoverflow.co...
WPF control performance
|.net|wpf|performance|unit-testing|testing|
What is a good (and preferably simple) way to test the rendering performance of WPF custom controls? I have several complex controls in which rendering performance is highly crucial. I want to be able to make sure that I can have lots of them drawwing out in a designer with a minimal impact on performance.
|.net|performance|wpf|
CGI is great for low-traffic websites, but it has some performance problems for anything else. This is because every time a request comes in, the server starts the CGI application in its own process. This is bad for two reasons: 1) Starting and stopping a process can take time and 2) you can't cache anything in mem...
<pre><code>object Enum.Parse(System.Type enumType, string value, bool ignoreCase); </code></pre> So if you had an enum named mood it would look like this: <pre><code> enum Mood { Angry, Happy, Sad } // ... Mood m = (Mood) Enum.Parse(typeof(Mood), "Happy", true); Cons...
C# Include Derived Control in Toolbox
|c#|visual-studio|winforms|textbox|
This is in reference to my other question [Auto Clearing Textbox][1]. If I choose to derive a new TextBox control from TextBox instead of implement a user control just containing my Textbox, how would I include that in the toolbox. [1]: http://stackoverflow.com/questions/16110/c-auto-clearing-winform-textbox
Right-click the toolbox, click "Choose Items" from the context menu, browse to your DLL, and select it.
OK, are you sure that is wise? I am picturing two scenarios here: 1. There is a default button on the form, which is "clicked" when enter is pushed". 2. There is no default button, and you want the user to have to press enter, regardless. Both of these raise the same questions: * Is there any validation that ...
I use [Analog][1] because it's free, but it is rather dated now (wow, last release was 4 years ago!) and I'm sure it doesn't have as many fancy features as newer ones. [1]: http://analog.cx
If you do take the rsync/filecopy approach with CVS, it is important to only sync the files at a time when there is not an active commit. Otherwise, the repository's lock file will get copied over and you will be unable to checkout/update on the target side until the next sync. This reason alone may make CVS a bad c...
The Best (and perhaps costliest) way is [Clearcase Multisite](http://www-01.ibm.com/software/awdtools/clearcase/multisite/) But if you are looking for opensource, [Git](http://git.or.cz/) is becoming quickly replacing svn everywhere..
> On the other hand, if there's a way to > move an existing window from one > X-server to another, that might solve > the problem. I think you can use <a href="http://ubuntuforums.org/showthread.php?t=202589">xmove</a> to move windows between two separate x-servers. So if it works, this should at least give you a...
C# Auto Clearing Winform Textbox
Visual Studio 2008 has a built in test project type that works in a similar way to NUnit, but obviously has much tighter integration with Visual Studio (can run on every build and shows the results in a similar way to the conversion results page when upgrading solution files), but it is obviously not as mature as NUnit...
Another important but subtle difference is in the way procs created with `lambda` and procs created with `Proc.new` handle the `return` statement: - In a `lambda`-created proc, the `return` statement returns only from the proc itself - In a `Proc.new`-created proc, the `return` statement is a little more surpri...
It sounds like you've covered all the server-side bases--maybe it's a client issue? I assume your users have integrated authentication enabled in IE7? (Tools -> Internet Options -> Advanced -> Security). This is enabled by default. Also, is your site correctly recognized by IE7 as being in the Local Intranet zone...
Why not use [SQL Server 2005 Express edition](http://www.microsoft.com/sql/editions/express/default.mspx)? It really depends on what you mean by "embedded" - but you can redistribute SQLServer2005E with your applications and the user never has to know it's there. <http://msdn.microsoft.com/en-us/library/ms165660.asp...
I think: #!/bin/python bar in dict(Foo) Is what you are thinking of. When trying to see if a certain key exists within a dictionary in python (python's version of a hash table) there are two ways to check. First is the **<code>has_key()</code>** method attached to the dictionary and second is the examp...
I beg to differ, there is ALWAYS another way.. And if you really _cannot_ refactor, then you need to break the problem down into smaller parts.. Like I said, establish which dimensions you need to sum, then hit them one at a time.. Also, stop changing the edits, they are correcting your spelling errors, they are ...
When you say you don't know how many dimensions there are, how exactly are you defining the data structures? At some point, someone needs to create this array, and to do that, they need to know the dimensions of the array. You can force the creator to pass in this data along with the array. Unless the question is...
First off, I think you need to be clearer in your question - what technology are you using and where is this process that is timing out - server-side or client-side? If you want to have the server-side code take a long time and you are using .NET, place this line in the method you call server-side: System.Thr...
Find out which process has an exclusive lock on a USB device handle
|c++|winapi|usb|device|
I have a library that reads/writes to a USB-device using CreateFile() API. The device happens to implement the HID-device profile, such that it's compatible with Microsoft's HID class driver. Some other application installed on the system is opening the device in read/write mode with no share mode. Which prevents my...
I have a library that reads/writes to a USB-device using CreateFile() API. The device happens to implement the HID-device profile, such that it's compatible with Microsoft's HID class driver. Some other application installed on the system is opening the device in read/write mode with no share mode. Which prevents my...
Jeff Atwood himself described how StackOverflow.com sanitizes user input (in non-language-specific terms) on the Stack Overflow blog: <http://blog.stackoverflow.com/2008/06/safe-html-and-xss/> However, as Justin points out, if you use Django templates or something similar then they probably sanitize your HTML output...
Have you tried using an HTML control instead of the server control? Does it also cause a compilation error? <input type="text" id="TextBox4" runat="server" value="<%=TextFromString%>" />
What are some real life examples of Design Patterns used in software
|design-patterns|
I'm reading through head first design patterns at the moment and while the book is excellent I also would like to see how these are actually used in the real world. If you know of a good example of design pattern usage (preferably in a OSS program so we can have a look :) then please list it below.
|design-patterns|
Go to about:ubiquity in Firefox. Under the section "subscribed feeds" there should be an option to unsubscribe to command feeds you no longer desire. Also, if you clear your entire browser history, it will delete all command feeds (this will be fixed by 0.2)
The way to delete commands is to find them in the Subscribed Feeds section of the main help page: 1. ubiq help | about:ubiquity 2. Scroll down to "Subscribed Feeds" in the right hand column 3. Click '[unsubscribe]' for the one you want to delete. 4. Profit!
An ah-ha moment for me for the observer pattern was to realize how closely associated it is with events. Consider a Windows program that needs to acheive loosely communications between two forms. That can easily be accomplished with the observer pattern. The code below shows how Form2 fires an event and any other cl...
DefaultValue for System.Drawing.SystemColors
|c#|user-controls|.net|
I have a line color property in my custom grid control. I want it to default to Drawing.SystemColors.InactiveBorder. I tried: [DefaultValue(typeof(System.Drawing.SystemColors), "InactiveBorder")] public Color LineColor { get; set; } But it doesn't seem to work. How do I do that with the default value a...
|c#|.net|winforms|user-controls|
I have implemented Access reports which were 'pretty' enough. The downside is that it takes a **lot** of time and effort, and trial and error to produce the desired output. You can definitely get there, but it requires the patience of a saint.
'method' vs. 'message' vs. 'function' vs. '???'
|language-agnostic|terminology|
I recently asked a question about what I called "method calls". The answer referred to "messages". As a self-taught hobby programmer trying to phrase questions that don't make me look like an idiot, I'm realizing that the terminology that I use reveals a lot about how I learned to program. Is there a distinction bet...
What is the replacement of Controller.ReadFromRequest in ASP.NET MVC?
|asp.net-mvc|
I am attempting to update a project from ASP.NET MVC Preview 3 to Preview 5 and it seems that Controller.ReadFromRequest(string key) has been removed from the Controller class. Does anyone know of any alternatives to retrieving information based on an identifier from a form?
|asp.net-mvc|.net-3.5|beta|entity-framework-ctp5|
Short answer: draw your system architecture in terms of modules, drawn side-by-side, with each module sliced vertically into layers (e.g. view, model, persistence). Then use a structure like *com.mycompany.myapp.somemodule.somelayer*, e.g. *com.mycompany.myapp.client.view* or *com.mycompany.myapp.server.model*. Usin...
Are you looking to get a list of objects that have a certain attribute? If so, a [list comprehension](http://docs.python.org/tut/node7.html#SECTION007140000000000000000) is the right way to do this. result = [obj for obj in listOfObjs if hasattr(obj, 'attributeName')]
Format string to title case
|language-agnostic|string|format|title-case|
How do I format a string to title case?