instruction
stringlengths
0
30k
You probably just forgot to include iomanip, but I can't be sure because you didn't include code for a complete program there. This complete program works fine over here using VS 2003: #include <sstream> #include <iomanip> int main() { int SomeInt = 1; std::stringstream StrStr...
I can use the Control key in either the west or south-west positions without any trouble. Many Emacsers swear that the control key belongs in the west position and the west position only, and that anything else will ruin your pinky. The only thing we know for sure causes RSI from typing is too much typing. Try type-...
I like [SQL Developer][1] from Oracle. Oh and its free! :) [1]: http://www.oracle.com/technology/products/database/sql_developer/index.html
Java Collections using wildcard
|java|
public class Generics { public static void main(String[] args) { List<? extends Object> mylist = new ArrayList<String>(); mylist.add("java"); // compile error } } The above code (obviously) does not allow you to add elements to the list and wild cards can only be used as a signature in me...
public static void main(String[] args) { List<? extends Object> mylist = new ArrayList<Object>(); mylist.add("Java"); // compile error } The above code (obviously) does not allow you to add elements to the list and wild cards can only be used as a signature in methods, again not for adding but only...
How do I use Javascript to locate by X-Y Coordinates in my browser?
|javascript|firefox|opera|coordinates|x-y|
I'm trying to make it so when a user scrolls down a page, click a link, do whatever it is they need to do, and then come back to the pages w/ links, they are at the same (x-y) location in the browser they were before. How do I do that? I'm a DOM Newbie so I don't know too much about how to do this. Target Brow...
I'm trying to make it so when a user scrolls down a page, click a link, do whatever it is they need to do, and then come back to the pages w/ links, they are at the same (x-y) location in the browser they were before. How do I do that? I'm a DOM Newbie so I don't know too much about how to do this. Target Brow...
|javascript|jquery|dom|
The only problem with using Triggers is that it adds to performance overhead of any insert/update/delete. For higher scalability and performance, you would like to keep the database transaction to a minimum. Auditing via triggers increase the time required to do the transaction and depending on the volume may cause per...
I remember having the same problem - After searching on the web, I found this solution - From the command line, 1. > adb shell 2. # sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db 3. sqlite> INSERT INTO system VALUES(99,’http_proxy', 'proxy:port'); 4. sqlite>.exit
I remember having the same problem - After searching on the web, I found this solution - From the command line, 1. > adb shell 2. # sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db 3. sqlite> INSERT INTO system VALUES(99,’http_proxy', 'proxy:port'); 4. sqlite>.exit ...
Does Server Core 2008 support asp.net?
|asp.net|server-core|
Does Server Core 2008 support asp.net? I see references online saying that it isn't supported, but they are all old references from CTPs.
You can try the [PHP PSD Reader][1], which should at least get you started. [1]: http://www.phpclasses.org/browse/package/3627.html
$argv is an array containing all your commandline parameters... You need to parse that array and set $param yourself. $tmp = $argv[1]; // $tmp="param=test" $tmp = explode("=", $tmp); // $tmp=Array( 0 => param, 1 => test) $param = $tmp[1]; // $param = "test";
[No][1] [1]: http://www.microsoft.com/windowsserver2008/en/us/compare-core-installation.aspx
Using Adrian's solution, but instead of incrementing by 1, increment by 10 or even 100. Then insertions can be calculated at half of the difference of what you're inserting between without having to update everything below the insertion. Pick a number large enough to handle your average number of insertions - if its ...
I use PC-Lint on my C++ projects and especially like how it references existing publications such as the MISRA guidelines or Scott Meyers' "Effective C++" and "More Effective C++". Even if you are planning on writing very detailed justifications for each rule your static analysis tool checks, it is a good idea to poin...
SysInternals may not help with Java class IO. Try getting a thread dump of the JVM (e.g., kill -3) while these logs are being written to. You should be able to catch a thread red handed with java.io packages near the top of the stack trace.
Have you checked the logs in runtime/.metadata folder?,<br><br> Also make sure to validate all plugins in the runtime. Having them as a dependency doesn't necessarily mean they are added to the runtime. This is probably the biggest gotcha when launching an rcp app.
Try the "libxslt-ruby" gem. It depends on the "libxmlr-ruby" bindings for libxml library, which you probably already have installed if you're developing on Linux.
I've been compiling a [list of the various Ruby on Rails search options in this other question][1]. I'm not sure how, or if to combine our questions. [1]: http://stackoverflow.com/questions/73527/whats-the-best-option-for-searching-in-ruby-on-rails
The inspect module has exactly what you want: inspect.isroutine( obj ) FYI, the code is: def isroutine(object): """Return true if the object is any kind of function or method.""" return (isbuiltin(object) or isfunction(object) or ismethod(object) ...
Trying to convert bunch of jpegs into a movie
|video|encoding|
I have 28,000 images I need to convert into a movie. I tried mencoder mf://*.jpg -mf w=640:h=480:fps=30:type=jpg -ovc lavc -lavcopts vcodec=msmpeg4v2 -nosound -o ../output-msmpeg4v2.avi But it seems to crap out at 7500 frames. The files are named webcam_2007-04-16_070804.jpg webcam_2007-04-16_071004.jp...
cd ^/a/^/another/
I'd recommend [Subversion](http://subversion.tigris.org/) because it is free and has great integration with most IDEs. For those in the organization who travel or prefer a more distributed model, they can use Git for all their local work but still commit to the SVN repository when they want to share code. This is a gre...
Well, I've used Enunciate quite a bit. It uses simple annotations to provide either REST and/or SOAP endpoints. http://enunciate.codehaus.org Plus, Ryan Heaton has always provided top-notch support for things, too.
I usually make my own control that extends WebControl or HtmlGenericControl, and I override ClientID - returning the ID property instead of the generated ClientID. This will cause any transformation that .NET does to the ClientID because of naming containers to be reverted back to the original id that you specified in...
The secret is to surround your whole thingie, label and widget, in a span whose class does the block and clear: &lt;style type="text/css"&gt;<br/> .lb {<br/> display:block;clear:both;<br/> }<br/> &lt;/style&gt;<br/> &lt;form&gt;<br/> <b>&lt;span class="lb"&gt;</B>Thingy 1: &lt;input class="a" type="text" ...
<style type="text/css"> label, input { float: left; } label { clear:left; } </style> <form> <label>thing 1:</label><input /> <label>thing 2:</label><input /> </form>
I'd second (or third) XStream. It reads and writes XML without needing any special binding configuration or placing lots of extraneous syntax in the XML.
Something along the lines of this: #include <stdio.h> main() { char buf[100]; char *p = buf; int n = 0; scanf("%s", buf); while (*p) { if (*p == '1') { n++; } ...
<p>Just use the Action, Action&lt;T&gt;, Action&lt;T1,T2,..&gt; delegates for methods not returning anything (void), or the Func&lt;TResult&gt;, Func&lt;T, TResult&gt;, Func&lt;T1, ..., TResult&gt; delegates for methods returning TResult.</p> <p>Those delegates are new in .net 3.5.</p>
Has anyone attempted to make PHP's system functions more Object-Oriented?
|php|
I'm just curious if any project exists that attempts to group all (or most) of PHP's built-in functions into a more object-oriented class hierarchy. For example, grouping all the string functions into a single String class, etc. I realize this won't actually solve any problems, since all the built-in functions would st...
I'm just curious if any project exists that attempts to group all (or most) of PHP's built-in functions into a more object-oriented class hierarchy. For example, grouping all the string functions into a single String class, etc. I realize this won't actually solve any problems (unless the modifications took place at...
For simple catch-all handling, you can use the following static method in [Thread][1]. From the Javadoc: > static void [**setDefaultUncaughtExceptionHandler**][2]([Thread.UncaughtExceptionHandler][3] eh) <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the default handler invoked when a thread ab...
I've decided to replace all instances of ViewData["blah"] with ViewData.Eval("blah"). However, I'd like to know the cause of this change if possible because: 1. If it happens on my other projects it'd be nice to be able to fix. 2. It would be nice to leave the deployed working code and not overwrite with these c...
The printdocument object fires the printpage event for each page to be printed. You can draw text/lines/etc into the print queue using the printpageeventargs event parameter: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx Dim it WithEvents when you pass it to the grid, so you ...
There are other language choices too. I've become quite fond of Python, which works well on Windows, Linux, and Mac, and has a rich set of libraries.
For standard colors (including common colors and default colors used by the operating system) Use Display.getSystemColor(int), and pass in the SWT.COLOR_* constant for the color you want. <code> Display display = Display.getCurrent(); Color blue = display.getSystemColor(SWT.COLOR_BLUE); Color listBa...
The manual for CakePHP has an excellent description of how Access Control Lists work. <http://manual.cakephp.org/view/320/Access-Control-Lists>
You have to use AsyncCallBacks. You can use AsyncCallBacks to specify a delegate to a method, and then specify CallBack Methods that get called once the execution of the target method completes. Here is a small Example, run and see it for yourself. class Program { public delegate void AsyncMethodC...
Python or Ruby. See Paul Graham's [thoughts on this][1] in the question "I like Lisp but my company won't let me use it. What should I do?". [1]: http://www.paulgraham.com/lispfaq1.html
* New separate types for Date and Time, instead of just Datetime * New geographic types for lattitude/longitude * Change Data Capture is pretty neat if you're doing anything where auditing is important * Configuration Servers, for maintaining multiple databases. That's what caught my attention at the Heroes H...
I've used it a lot in the past to work with input and output streams. You can nest them nicely and it takes away a lot of the potential problems you usually run into (by automatically calling dispose). For example: using (FileStream fs = new FileStream("c:\file.txt", FileMode.Open)) { ...
Could you add a harmless query parameter to the end of your URL? http://stackoverflow.com/?CacheBuster=1020am
The addition of the for-each loop construct in 1.5. I <3 it. // For each Object, instantiated as foo, in myCollection for(Object foo: myCollection) { System.out.println(foo.toString()); } And can be used in nested instances: for (Suit suit : suits) for (Rank rank : ranks) ...
PHP property's scope overridden by passing as reference?
|php|reference|
In PHP, if you return a reference to a protected/private property to a class outside the scope of the property does the reference override the scope? **e.g.** class foo { protected bar = array(); getBar() { return &bar; } } class foo2 { ...
In PHP, if you return a reference to a protected/private property to a class outside the scope of the property does the reference override the scope? **e.g.** class foo { protected bar = array(); getBar() { return &bar; } } class foo2 { ...
I like [Rapid SQL][1], you can debug SQL too [1]: http://www.embarcadero.com/products/rapidsql/index.html
If your business are non-English speakers, and you think Domain Driven Design has something to it, then there is another aspect: How do we, as developers, use the same domain language as our business without any translation overhead? That does not only mean translations between languages, say English and Norwegian, ...
But some at our place swear by [Toad][1] [1]: http://www.toadsoft.com/
You could try the `cloneNode` method. It might do a better job of copying the contents. It should also be faster in most cases var newBox; var sourceBox = document.getElementById(oldkey); if (sourceBox.cloneNode) newBox = sourceBox.cloneNode(true); else { newBox = document.creat...
Execute JavaScript from within a C# assembly
|javascript|csharp|.net|codedeom|
I'd like to execute JavaScript code from within a C# assembly and have the results of the JavaScript code returned to the calling C# code. It's easier to define things that I'm not trying to do: - I'm not trying to call a JavaScript function on a web page from my code behind. - I'm not trying...
The finally block is always executed unless there is abnormal program termination, either resulting from a JVM crash or from a call to System.exit(0). On top of that, any value returned from within the finnally block will override the value returned prior to execution of the finally block, so be careful of checking ...
A linked list can be stored using recursive pointers in the table. This is very much the same hierarchies are stored in Sql and this is using the recursive association pattern. You can learn more about it [here][1]. I hope this helps. [1]: http://www.tomjewett.com/dbdesign/dbdesign.php?page=recursive.php
I use [Greg_Photo][1] as an accessor to the underlying GD commands. For pretty basic resizing it works great. [1]: http://www.gregphoto.net/index.php/2007/02/03/announcing-gregphoto_image-a-php5gd2-thumbnail-class/
Not sure about .doc support in any open source library but ImageMagick (and the RMagick gem) can be compiled with pdf support (I think it's on by default)
Depends on what you mean by crash. You can do an infinite recursion to make it run out of stack space, but that'll crash "gracefully". You'll get an exception, but the JVM itself will be handling everything. You can also use JNI to call native code. If you don't do it just right then you can make it crash hard....
If you change that infinite for loop to a recursive call to the same function, then you would get a stack overflow exception: public static void main(String[] args) { causeStackOverflow(); } public void causeStackOverflow() { causeStackOverflow(); }
The closest thing to a single "answer" is System.exit() which terminates the JVM immediately without proper cleanup. But apart from that, native code and resource exhaustion are the most likely answers. Alternatively you can go looking on Sun's bug tracker for bugs in your version of the JVM, some of which allow for re...
Just a quick note, if you are using SQL Server, the examples that have: While (Select Count(*) From #Temp) > 0 Would be better served with While EXISTS(SELECT * From #Temp) The Count will have to touch every single row in the table, the `EXISTS` only needs to touch the first one.
create a table with two self referencing columns PreviousID and NextID. If the item is the first thing in the list PreviousID will be null, if it is the last, NextID will be null. The SQL will look something like this:<br/><br/> <code> create table tblDummy<br/>{<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PKColumn&nbsp;&nbs...
I always recommend specifying the columns you need, just in case your schema changes and you don't need the extra column. In addition, qualify the column names with the table name. This is critical when the query contains joins. Without the table qualifications, it can be difficult to remember which column comes fro...
You can't reference anything at all above the application's root folder.
There seems to be a catch-22 in that you must tokenize a field with an analyzer in order to strip punctuation and stop words, but you can't sort on tokenized fields. How then to strip the stop words without tokenizing?
All the code I have to maintain that still looks like it was written in vb6, showing complete ignorance of the newer styles. I'm talking things like CreateObject(), excessive &lt;% %> blocks, And/Or instead of AndAlso/OrElse, Len() instead of .Length(), s/o Hungarian prefix warts, Dim MyVariable with no type, functi...
why hash codes generated by this function are not unique?
|hash-function|hash-code-uniqueness|
I'm testing the below VB function, which I get from a Google search and plan to use it to generate hash codes for quick string comparison. However, there are occasion in which two different strings would have the same hash code. For example, these strings "122Gen 1 heap size (.NET CLR Memory w3wp):mccsmtpteweb025.20...
I'm testing the below VB function, which I get from a Google search and plan to use it to generate hash codes for quick string comparison. However, there are occasion in which two different strings would have the same hash code. For example, these strings "122Gen 1 heap size (.NET CLR Memory w3wp):mccsmtpteweb025.20...
It doesn't have #1, at least.
What if you put this at the top? <%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %>
Mail Quota Checker in C#
|.net|c#|ldap|exchange-server|outlook|
We have a requirement to build a tool for users in an Intranet scenario. The tool should check how much percentage of the Mailbox Quota (set in Active Directory) is being used. Currently, they can check their Folder size using Outlook 2003 but this does not show the Quota Limit set for them or the percentage being u...
Mail Storage Quota Checker in C#
We have a requirement to build a tool for users in an Intranet scenario. The tool should check how much percentage of the Mailbox Quota (set in Active Directory) is being used. Currently, they can check their Folder size using Outlook 2003 but this does not show the Quota Limit set for them or the percentage being u...
|c#|.net|outlook|exchange-server|ldap|
|c#|.net|outlook|ldap|exchange-server|
We have a requirement to build a tool for users in an Intranet scenario. The tool should check how much percentage of the Mailbox Quota (set in Active Directory) is being used. Currently, they can check their Folder size using Outlook 2003 but this does not show the Quota Limit set for them or the percentage being u...
|.net|javascript|codedeom|csharp|
I'd like to execute JavaScript code from within a C# assembly and have the results of the JavaScript code returned to the calling C# code. It's easier to define things that I'm not trying to do: - I'm not trying to call a JavaScript function on a web page from my code behind. - I'm not trying...
|c#|.net|javascript|codedeom|
|c#|.net|javascript|unit-testing|codedeom|
|c#|.net|javascript|unit-testing|codedom|
I'd like to execute JavaScript code from within a C# assembly and have the results of the JavaScript code returned to the calling C# code. It's easier to define things that I'm not trying to do: - I'm not trying to call a JavaScript function on a web page from my code behind. - I'm not trying...