instruction
stringlengths
0
30k
|javascript|html|css|ajax|xhtml|
I'm a front-end developer and I was looking for opinions about the best all-round online documentation for javascript/css/html/xhtml/dom/browser quirks and support. I've tried Sitepoint, Quirksmode, W3Schools but all of these seem to be lacking in certain aspects and have been using them in combination.
Have you looked at the ruby-debug gem? <pre> <code> % sudo gem install ruby-debug </code> </pre> The rdebug executable gives you a similar interface to gdb (breakpoint setting, etc). You just simply execute your script with rdebug instead of ruby. You can also do something like this to avoid manually sett...
You could also publish a service (via burlap, hessian, etc) on the second JVM that calls System.exit() and consume it from the watchdog JVM. If you only want to shut the second JVM down when it stops sending those periodic notifications, it might not be in a state to respond to the service call. Calling shell comma...
Get the max size for each column first. That way a varchar(255) column containing postal codes won't take up too much space. Maybe you can split the complete table instead of splitting single lines. Put the complete right part of the table in a second stringbuilder and put it beneath the first table. You can also...
How to effectively work with multiple files in vim?
|vim|vi|
I've started using vim to develop Perl scripts and am starting to find it very powerful. One thing I like is to be able to open multiple files at once with e.g. "vi main.pl maintenance.pl" and then hop between them with: :n :prev and see which file are open with :args And to add a file, I can say: ...
Rhino Mocks - How can I test that at least one of a group of methods is called?
|unit-testing|mocking|rhino-mocks|bdd|
Say I have an interface IFoo which I am mocking. There are 3 methods on this interface. I need to test that the system under test calls at least one of the three methods. I don't care how many times, or with what arguments it does call, but the case where it ignores all the methods and does not touch the IFoo mock is t...
`vim` (but not `vi`!) has tabs which I find far superior to buffers. You can say `:tabe [filename]` to open a file in a new tab. Cycling between tabs is done by klicking on the tab or by the key combinatons [*n*]`gt` and `gT`. Graphical vim even has graphical tabs.
Why not use tabs (introduced in Vim 7)? You can switch between tabs with :tabn and :tabp, With :tabe &lt;filepath&gt; you can add a new tab; and with a regular :(w)q you close a tab. If you map :tabn and :tabp to your F7/F8 keys you can easily switch between files. If it are not that many files and you don't have...
svec, use a PHP framework. Just any - there's plenty of them out there. This is the right way to do it. With framework you have single entry point for your application, so defining site-wide variables is easy and natural. Also you don't need to care about including header files nor checking if user is logged in on ...
Those two lines do different things. The first one creates a new set, and then merges a second set into it. The second one sets the ds reference to point to the second set, so: MyTypedDataSet ds1 = new MyTypedDataSet(); ds1.Merge(anotherDataSet); //ds1 is a copy of anotherDataSet ds1.Tables....
Those two lines do different things. The first one creates a new set, and then merges a second set into it. The second one sets the ds reference to point to the second set, so: MyTypedDataSet ds1 = new MyTypedDataSet(); ds1.Merge(anotherDataSet); //ds1 is a copy of anotherDataSet ds1.Tables....
In Windows XP, after windows has been updated, I use the following trick: run this command <pre> pssuspend wuauclt </pre> <a href="http://technet.microsoft.com/en-us/sysinternals/bb897540.aspx">pssuspend</a> is a free sys-internals tool. This way, you will not be prompted about restart.
I just found the following. It's standards compliant but it doesn't work in IE. sigh. empty-cells: show
Perhaps you can use the NTFS 5 Change Journal with DeviceIoControl as explained [here](http://www.microsoft.com/msj/0999/journal/journal.aspx)
Ideally, you shouldn't have any empty cells in a table. Either you have a table of data, and there's no data in that specific cell (which you should indicate with "-", or "n/a/", or something equally appropriate, or - if you must - &amp;nbsp;, as suggested), or you have a cell that needs to span a column or row, or you...
This is pretty .NET specific, but the Framework Design Guidelines book argues that in general classes give more flexibility in an evolving framework. Once an interface is shipped, you don't get the chance to change it without breaking code that used that interface. With a class however, you can modify it and not brea...
I like http://www.gotapi.com
Hash functions do not guarantee uniqueness of hash values. If the input value range (judging your sample strings) is larger than the output value range (eg 32 bit integer), then uniqueness is physically impossible.
Best way of constructing dynamic sql queries in C#/.NET3.5?
|c#|sql|.net-3.5|
A project I'm working on at the moment involves refactoring a C# Com Object which serves as a database access layer to some Sql 2005 databases. The author of the existent code has built all the sql queries manually using a string and many if-statements to construct the fairly complex sql statement (~10 joins, >10 su...
|c#|sql|linq|.net-3.5|
Struts 1.3: forward outside the application context?
|java|struts|
Struts 1.3 application. Main website is NOT served by struts/Java. I need to forward the result of a struts action to a page in the website, that is outside of the struts context. Currently, I forward to a JSP in context and use a meta-refresh to forward to the real location. That seems kinda sucky. Is there a bet...
Your best bet is to embed either lua (www.lua.org) or python (www.python.org). Both are used in the game industry and both access extern "C" functions relatively easily with lua having an edge here (because data types are easier to translate between lua and C). Interfacing to C++ objects will be a bit more work on yo...
The two Strings have the same characters. (Note the '2' and the '1' that are flip-flopped) That is why the hash value is the same. Make sure that the hash function is taking into account the order of the characters.
Can I submit a Struts form that references POJO (i.e. not just String or boolean) fields?
|java|jsp|struts|
I have a Struts (1.3x) ActionForm that has several String and boolean properties/fields, but also has some POJO fields. so my form looks something like: MyForm extends ActionForm { private String name; private int id; private Thing thing; ...getters/setters... ...
No offense, but the question is a little "misguided". There is no "silver bullet" solution. I would recommend to read up on cryptography in general and then do some threat modeling. Some questions (by no means a comprehensive list) you should ask yourself: - Is the module doing the encryption the one which needs t...
No offense, but the question is a little "misguided". There is no "silver bullet" solution. I would recommend to read up on cryptography in general and then do some threat modeling. Some questions (by no means a comprehensive list) you should ask yourself: - Is the module doing the encryption the one which needs t...
I'm not :) I'm using USERPROFILE in Windows and HOME in Mac/Linux. But even so, I need to know that those are the right places. Thanks!
Inherit from List&lt;T> and override the Add() and AddRange() methods to raise an event?
As mentioned, the [Wikipedia article on IEEE 754][1] does a good job of showing how floating point numbers are stored on most systems. Now, here are some common gotchas: * The biggest is that you almost never want to compare two floating point numbers for equality (or inequality). You'll want to use greater than/...
Sometimes you can get the modem's serial number using the AT command set. To see this in action, go to your control panel and open up Phone and Modem Options. Select the Modems tab, select the modem you're interested in, and choose Properties. In the modem window, select the Diagnostics tab, and press the Query Mo...
jQuery and Java applets
|java|javascript|jquery|applet|
I'm working on a project where we're using a Java applet for part of the UI (a map, specifically), but building the rest of the UI around the applet in HTML/JavaScript, communicating with the applet through LiveConnect/NPAPI. A little bizarre, I know, but let's presume that setup is not under discussion. I started out ...
How would you go about using the ASP.NET Control Toolkit in a project that doesn't use ASP.NET on the back end
|asp.net|ajax|javascript|
Your backend could be PHP or Python but you want to use the controls from the ASP.NET toolkit is there a successful way to do this?
How would you go about using the ASP.NET AJAX Control Toolkit in a project that doesn't use ASP.NET on the back end
|asp.net|javascript|ajax|
I came accross an implementation of the `amb` operator in [this post][1] from <http://www.randomhacks.net>, using continuations. Here's what the `amb` opeerator does: # amb will (appear to) choose values # for x and y that prevent future # trouble. x = amb 1, 2, 3 y = amb 4, 5, 6 ...
How to resolve ORA-011033: ORACLE initialization or shutdown in progress
|database|oracle-database|
When trying to connect to an ORACLE user via TOAD (Quest Software) or any other means (Oracle Enterprise Manager) I simply get the error: > ORA-011033: ORACLE initialization or > shutdown in progress ---------- [in the spirit of StackOverflow I will answer this one myself - at least I'll relate how I reso...
As it has already been said, you need to poke the System.Reflection namespace. If you know in advance the location/name of the DLL you want to load, you need to iterate through the Assembly.GetTypes(). In Pseudocode it would look something like this: Create and assembly object. Iterate through all the typ...
I don't quite see the environment you work in. Is this .Net code? If you really want good hash codes, I would recommend looking into cryptographic hashes (proven algorithms) instead of trying to write your own. Btw, could you edit your post and paste the code in as a Code Sample (see toolbar)? This would make it eas...
I tend to go to [http://msdn.microsoft.com/][1] first. [1]: http://msdn.microsoft.com/
Missing classes in WMI when non-admin
|wmi|nonadmin|
I'd like to be able to see Win32_PhysicalMedia information when logged in as a Limited User in XP (not admin rights). It works ok when logged in as Admin, WMIDiag has just given a clean bill of health, and Win32_DiskDrive class produces information correctly, but Win32_PhysicalMedia produces a count of 0 for this c...
I may have found a workaround for this. My ToolStrip was placed directly on the TabPage, docked to Top. However, I found [a thread on Microsoft Connect][1] that described the same problem when the ToolStrip was in a ToolStripContainer on the TabPage. That problem was observed in a release candidate of VS2005, but su...
Local System is not recommended, it is an administrator equivalent account and thus can lead to questionable coding that takes advantage of administrator privileges which would not be allowed in a production system since security conscious Admins/DBA's really don't like to run services as admin. Depending on if the ...
In windows you need to go another level deep than just the user profile. Use the Application Data folder.
Can't access variable in C++ DLL from a C app
|c|c++|interop|
I'm stuck on a fix to a legacy Visual C++ 6 app. In the C++ DLL source I have put extern "C" _declspec(dllexport) char* MyNewVariable = 0; which results in MyNewVariable showing up (nicely undecorated) in the export table (as shown by dumpbin /exports blah.dll). However, I can't figure out how to declare the vari...
I'm stuck on a fix to a legacy Visual C++ 6 app. In the C++ DLL source I have put extern "C" _declspec(dllexport) char* MyNewVariable = 0; which results in MyNewVariable showing up (nicely undecorated) in the export table (as shown by dumpbin /exports blah.dll). However, I can't figure out how to declare the ...
|c++|c|interop|
I'm stuck on a fix to a legacy Visual C++ 6 app. In the C++ DLL source I have put extern "C" _declspec(dllexport) char* MyNewVariable = 0; which results in MyNewVariable showing up (nicely undecorated) in the export table (as shown by dumpbin /exports blah.dll). However, I can't figure out how to declare the ...
I'm stuck on a fix to a legacy Visual C++ 6 app. In the C++ DLL source I have put extern "C" _declspec(dllexport) char* MyNewVariable = 0; which results in MyNewVariable showing up (nicely undecorated) in the export table (as shown by dumpbin /exports blah.dll). However, I can't figure out how to declare the ...
Not sure how to do it on a file type level, but you can do it on a folder level: Source: [http://lists.apple.com/archives/spotlight-dev/2008/Jul/msg00007.html][1] **Make spotlight ignore a folder** If you absolutely can't rename the folder because other software depends on it another technique is to go ahead a...
[DPack][1] can give you numbered bookmarks in VisualStudio. [1]: http://www.usysware.com/dpack/Bookmarks.aspx
Sort, then do something akin to a merge-sort. Basically you would do this: 1. Retrieve the first item from each list 2. Compare the items, if equal, output 3. If any of the items are before the others, sort-wise, retrieve a new item from the corresponding list to replace it, otherwise, retri...
Sort, then do something akin to a merge-sort. Basically you would do this: 1. Retrieve the first item from each list 2. Compare the items, if equal, output 3. If any of the items are before the others, sort-wise, retrieve a new item from the corresponding list to replace it, otherwise, retrieve new items to ...
Just to add one thing to all [1800 INFORMATION][1] already said. You might want to take a look at ["More Effective C++"][2] by Scott Mayers "Item 3: Never treat arrays polymorphically" in order to better understand this issue. [1]: http://stackoverflow.com/questions/41045/can-i-have-polymorphic-containers-wi...
DateTimeOffset was added to 2.0 SP1 - I'm not aware of any other new types. Given the coincidental timing, it's perhaps worth reminding people that 2.0 SP1 shipped with 3.5 RTM (i.e November 2007) and 2.0 SP2 shipped with 3.5 SP1.
Here's how it <i>might</i> work. <b>Note</b>: this is not a very good solution as a system update <i>will</i> overwrite changes you will perform. Get a list of all importers <pre> cristi:~ diciu$ mdimport -L 2008-09-03 10:42:27.144 mdimport[727:10b] Paths: id(501) ( "/System/Library/Spotlight/Audio.mdimpo...
I think that your second approach is very efficient. What's its problem? You have to add indexes to name and date.
After some googling I found the advice to do the following: \> sqlplus /nolog \> SQL> connect / as sysdba Connected. \> SQL> shutdown abort ORACLE Instance shut down. \> SQL> startup nomount ORACLE Instance started \> SQL> alter database mount; \> SQL> alter database open; Which still gave...
Why use SVK to mirror Perforce? Surely using a [Perforce Proxy][1] is the best way to make your repository distributed? [1]: http://www.perforce.com/perforce/products/p4p.html
> I wouldn't dismiss plain text, like CSV or tab-delimited. I'm really looking for alternatives that have a defined structure and (cross platform, multi language) library support. I'm interested in looking at different designs and their pros and cons. I like the idea of formats that can have a text and "binary" (com...
Niyaz is correct, unfortunately getting a customer buy-in is difficult until they have been burned like this once before. Additionally describe to the customer the scenario above and state how much extra it would cost if you went three or four weeks down the line and had to rewrite it due to a change and then let ...
You can do smth like this (if VB): Dim Str As String = "" 'Create File if doesn't exist Dim FILE_NAME As String = "C:\temp\Custom.txt" If System.IO.File.Exists(FILE_NAME) = False Then System.IO.File.Create(FILE_NAME) End If Dim objWr...
Here a little app which do more or less the functionnality you want : [http://www.anappaday.com/downloads/2006/09/day-10-jedi-concentrate.html][1] [1]: http://www.anappaday.com/downloads/2006/09/day-10-jedi-concentrate.html
For simple stuff I just use the following: unsigned TokenizeString(const std::string& i_source, const std::string& i_seperators, bool i_discard_empty_tokens, std::vector<std::string>& o_tokens) { unsigned prev_pos = 0; unsigned pos = 0; unsigned number_of_t...
There are a couple of open source projects that can create DVDs plus menus. I recently used [dvd-slideshow][1] to create a simple dvd with menus etc. Another one is [DVD Styler][2]. All of these programs are basically a front-end for various command-line tools for encoding, menu creation etc. Since these are open sourc...
How to make Emacs terminal colors the same as Emacs GUI colors?
|emacs|ubuntu|colors|
I program with Emacs on Ubuntu (Hardy Heron at the moment), and I like the default text coloration in the Emacs GUI. However, the default text coloration when Emacs is run in the terminal is different and garish. How do I make the colors in the terminal match the colors in the GUI? Thanks!
Well you could do this - have a wordpress installation. Get the users to post there and then use the RSS feed from it (or the XML RPC Blogging API) to update the Joomla installation. You will have to write the update piece once, but then all the headache is gone.
Not exactly process management, but you could start an rmi server in the java virtual machine you are launching, and bind a [remote](http://java.sun.com/j2se/1.5.0/docs/api/java/rmi/Remote.html) instance with a method that does whatever cleanup required and calls System.exit(). The first vm could then call that remote...
How about: long temp = 0; while(value > 0) // loop until value is empty { temp <<= 1; // shift whatever was in temp left to create room for the next bit temp &= (value & 0x01); // get the lsb from value and set as lsb in temp value >>= 1; /...
Which .Net collection for adding multiple objects at once and getting notified ?
|c#|.net-3.5|collections|
Was considering the `System.Collections.ObjectModel ObservableCollection<T>` class. This one is strange because - it has an Add Method which takes **one** item only. No AddRange or equivalent. - the Notification event arguments has a NewItems property, which is a **IList** (of objects.. not T) My need here ...
Was considering the `System.Collections.ObjectModel ObservableCollection<T>` class. This one is strange because - it has an Add Method which takes **one** item only. No AddRange or equivalent. - the Notification event arguments has a NewItems property, which is a **IList** (of objects.. not T) My need here ...
If you're wanting to inherit from a collection of some sort, you're probably better off inheriting from System.Collections.ObjectModel.Collection because it provides virtual methods for override. You'll have to shadow methods off of List if you go that route. I'm not aware of any built-in collections that provide th...
Never, ever store user data in the application folder. It's just a bad idea. Most operating systems have a $HOME (or %HOME%) environment variable. That would be the first place to look. If you want to cleanly support multiple operating systems, though, you're going to have to have some OS-specific code for ea...
I agree that if you can just dump the strings into a Set, then that might be the easiest solution. If you don't have access to a Set implementation for some reason, I would just sort the strings alphabetically and then go through once and remove the duplicates. How to sort them and remove duplicates from the list w...
I agree that if you can just dump the strings into a Set, then that might be the easiest solution. If you don't have access to a Set implementation for some reason, I would just sort the strings alphabetically and then go through once and remove the duplicates. How to sort them and remove duplicates from the list w...
You can do smth like this (if VB): Dim Str As String = "" 'Create File if doesn't exist Dim FILE_NAME As String = "C:\temp\Custom.txt" If System.IO.File.Exists(FILE_NAME) = False Then System.IO.File.Create(FILE_NAME) End If Dim objWr...