instruction
stringlengths
0
30k
For handling uncaught exceptions you can provide a new ThreadGroup which provides an implementation of ThreadGroup.uncaughtException(...). You can then catch any uncaught exceptions and handle them appropriately (e.g. send a crash log home). I can't help you on the JNI front, there's probably a way using a native wr...
Expose an event handler to VBScript users of my COM object
|com|vbscript|bcb|
Suppose I have a COM object which users can access via a call such as: Set s = CreateObject("Server") What I'd like to be able to do is allow the user to specify an event handler for the object, like so: Function ServerEvent MsgBox "Event handled" End Function s.OnDoSome...
|com|vbscript|bcb|event|
|events|com|vbscript|bcb|
Since @dF: mentioned that PowerShell has tee, I thought I'd show a way to do this in PowerShell. PS > "123" | % { $_.Replace( "1", "a"), $_.Replace( "2", "b" ) } a23 1b3 Note that each object coming out of the first command is processed before the next object is created...
Not sure if this is what you needing, but you can also detect if an exception has occurred from within your native code. See [http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/functions.html#wp5234][1] for more info. [1]: http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/functions.html#wp523...
It depends on what you mean by "user friendly", and what you want out of a text editor. I personally use emacs for editing xml, but I'm willing to put up with the learning curve of the editor for the sheer power it gives me - editing XML is now rather easy and painless for me, but it took me a bit to get it to that poi...
Rewriting document content using document.write does now execute the javascript in IE6
|javascript|internet-explorer-6|
I have a multi-frame layout. One of the frames contains a form, which I am submitting through XMLHttpRequest. Now when I use document.write() to rewrite the frame with the form, and the new page I am adding contains any javascript then the javascript is not exectuted in IE6? For example: document.write("<html><he...
How do I get JavaScript created with document.write() to execute?
I have a multi-frame layout. One of the frames contains a form, which I am submitting through XMLHttpRequest. Now when I use document.write() to rewrite the frame with the form, and the new page I am adding contains any javascript then the javascript is not exectuted in IE6? For example: document.write("<html...
Which PHP open source shopping cart solutions have features that benefit me as the web developer?
|php|e-commerce|shopping-cart|
There are hundreds of shopping cart solutions available for every platform, and all hosting plans come with several already installed. As a developer I understand that most of these are fairly similar from a user perspective. But which ones are built with the developer in mind? For example, which ones have a decent...
type -a PROG in order to find all the places where PROG is available, usually somewhere in ~/bin rather than the one in /usr/bin/PROG that might have been expected.
Give vim a try with a suitable plugin ([http://www.vim.org/scripts/script.php?script_id=301][1]). /Allan [1]: http://www.vim.org/scripts/script.php?script_id=301
CTRL+SPACE, for anything, anywhere. Generate getters and setters. Create Constructors using Fields Extract Method... Refactor->Rename CTRL+O for the quick outline. CTRL+O+CTRL+O for the inherited outline. F4 to display a type hierarchy Open Call Hierarchy to display where a method is called from. ...
In what order are locations searched to load referenced DLLs?
|.net|dll|
I know that the .NET framework looks for referenced DLLs in several locations * Global assembly cache (GAC) * Environment variables > System variables > PATH * Any private paths added to the AppDomain * The current directory of the executing assembly What order are those locations searched? Is the search f...
I know that the .NET framework looks for referenced DLLs in several locations * Global assembly cache (GAC) * Any private paths added to the AppDomain * The current directory of the executing assembly What order are those locations searched? Is the search for a DLL ceased if a match is found or does it conti...
There are 4 basic ways to do threading in .Net: * BackgroundWorker control * WaitHandles * Callback functions * polling an ASyncResult object Generally you want to start at the top of that list and work down. That means, first look and see if a backgroundworker control is appropriate to the situation. If not...
There are 4 basic ways to do threading in .Net: * BackgroundWorker control * WaitHandles * Callback functions * polling an ASyncResult object Generally you want to start at the top of that list and work down. That means, first look and see if a backgroundworker control is appropriate to the situation. Howeve...
There are 4 basic ways to do threading in .Net: * BackgroundWorker control * WaitHandles * Callback functions * polling an ASyncResult object Generally you want to start at the top of that list and work down. That means first look and see if a backgroundworker control is appropriate to the situation. However...
[This][1] article has some good discussion on the problem of parsing an array to a stored procedure since stored procedures only allow valid table column data-types as parameters. There are some neat things you can do with the [csv][2] table type in mysql - that is if you are loading a flat file into the db. You ...
Post the rules you already have as a starting point so people don't have to recreate it to help you. I would suggest testing [L] on the rule that maps .php to .cfm files as the first thing to try.
Timer classes can start behaving strangely when the timer 'tick' event code is not finished executing by the time the next 'tick' occurs. One way to combat this is to disable the timer at the beginning of the tick event, then re-enable it at the end. However, this approach is not suitable in cases where the executio...
In addition to many of the other great ones listed, here are a couple of others for specific technologies that I regularly listen to: - [This Week in Django][1] - [VMware Communities Roundtable][2] [1]: http://blog.michaeltrier.com/tags/twid [2]: http://blogs.vmware.com/vmtn/podcasts/index.html
The way MDI works doesn't gel with what you're trying to do. If you need the "MDI" format, you should consider using either the built-in or a [commercial][1] docking package, and use the docking setup to mimic the MDI feel. In my Delphi apps, I frequently use TFrames and parent them to the main form, and maximiz...
Deleting certain classes on running an external tool in eclipse?
|eclipse|sablecc|
I've set an external tool (sablecc) in eclipse (3.4) that generates a bunch of classes in the current project. I need to run this tool and regenerate these classes fairly frequently. This means that every time I want to run sablecc, I have to manually delete the packages/classes that sablecc creates in order to ensure ...
Talking to a Serial Port in OS X
|serial|port|os|x|python|
I have a Prolite LED sign that I like to set up to show scrolling search queries from a apache logs and other fun statistics. The problem is, my G5 does not have a serial port, so I have to use a usb to serial dongle. It shows up as /dev/cu.usbserial and /dev/tty.usbserial . When i do this everything seems to be hu...
I have a Prolite LED sign that I like to set up to show scrolling search queries from a apache logs and other fun statistics. The problem is, my G5 does not have a serial port, so I have to use a usb to serial dongle. It shows up as /dev/cu.usbserial and /dev/tty.usbserial . When i do this everything seems to be hu...
Programmatically talking to a Serial Port in OS X or Linux
|python|os|port|x|serial|
I use this class when I need to have a list box that updates. Update the object in the list and then call either of the included methods, depending on if you have the index available or not. If you are updating an object that is contained in the list, but you don't have the index, you will have to call RefreshItems...
For simple database applications I find using [SQLite](http://www.sqlite.org/) invaluable. It allows you to have a unique and standalone database for each test. However it does only work if you're using simple generic SQL functionality or can easily hide the slight differences between SQLite and your production data...
Transactions. What the ruby on rails unit test framework does is this: Load all fixture data. For each test: BEGIN TRANSACTION # Yield control to user code ROLLBACK TRANSACTION End for each This means that 1. Any changes your test makes to the database won't af...
I wanted to accept both Free Wildebeest's and Orion Edwards' answers but it would not let me. The reason I wanted to do this is that I'd come to the conclusion that these were the two main ways to do it, but which one to chose depends on the individual case (mostly the size of the database).
I'm a little hazy on the details, but maybe the link below might help: http://msdn.microsoft.com/en-us/library/ms974564.aspx It looks like your server object needs to implement `IProvideClassInfo` and then you call `ConnectObject` in your VBScript code. See also: http://blogs.msdn.com/ericlippert/archive/2005/...
I'm going to say Java as well. If you look at it in terms of maturity, a lot more time and effort has been expended by Sun (and others) in getting the JVM to work on non-Windows platforms. In contrast, Mono is definitely a second class citizen in the .Net ecosystem. Depending on who your target customers are, yo...
The profiler is only available in the Team System editions of Visual Studio 2008. The last version that I used that included a profiler was Visual C++ 6.0.
The profiler is only available in the Team System editions of Visual Studio 2008. The last version that I used that included a profiler was Visual C++ 6.0. For Visual Studio 2005, there's [Compuware DevPartner Performance Analysis Community Edition](http://www.compuware.com/media.asp?cid=701000000004ej0).
I'll cast a vote for jBPM. We used it on a larg-ish ETL platform in-house and it seemed to work quite well. I don't have anything to compare it to, however.
C# compare algorithms
|c#|algorithm|difference|
Are there any open source algorithms in c# that solve the problem of creating a difference between two text files? It would be super cool if it had some way of highlighting what exact areas where changed in the text document also.
How do you crash a JVM?
|java|jvm|
Newbie here... Also not sure whether the question belongs to a site that prefers questions that can be answered and not discussed. Still... I was reading a book on programming skills wherein the author asks the interviewee, "How do you crash a JVM?" I thought that you could do so by writing an infinite for-loop that...
Formally SysInternal's, now Microsoft's Process Explorer http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx "Find" menu item -> "Find Handle or DLL..."
Using JQuery, how can I dynamically set the size attribute of a select box?
|jquery|
I would like to include it in this code: $("#mySelect").bind("click", function() { $("#myOtherSelect").children().remove() ; var options = '' ; for (var i = 0; i < myArray[this.value].length; i++) { options += '<option value="' + myArray[this.value][i] + '">' + myArray[this....
Since getting this to work requires me to only change the encoding attribute of the first XML element to have the value UTF-8 instead of UTF-16, the XML file is actually UTF-8 and labelled wrongly by the application that generates it. The XML file is a FileMaker DDR export produced by FileMaker Pro Advanced 8.5 on O...
jQuery has a noConflict() method as a part of the core, but it then requires that you either use jQuery as your named function or something else of your choosing (instead of the dollar selector). However, I will say that the method is often dependent on the implementation of the "competing" library. I have tried to use...
Work with PSDs in PHP
|php|psd|
I was recently asked to come up with a script that will allow the end user to upload a PSD (Photoshop) file, and split it up and create images from each of the layers. I would love to stay with PHP for this, but I am open to Python or Perl as well. Any ideas would be greatly appreciated.
I can't seem to reproduce this bug. Can you give more details? I have my copy of Opera masquerading as Firefox so the validation should be executing: >>> $.browser.opera false When I go to the edit profile page and enter a malformed date, the red text comes up and says "Please enter a valid date". Th...
I can't seem to reproduce this bug. Can you give more details? I have my copy of Opera masquerading as Firefox so the validation should be executing: >>> $.browser.opera false When I go to the edit profile page and enter a malformed date, the red text comes up and says "Please enter a valid date". Th...
[According to Wikipedia][1], Fogbugz is the only product currently offering EBS. [1]: http://en.wikipedia.org/wiki/Evidence_Based_Scheduling
Get list of domains on the network
|winapi|
Using the Windows API, how can I get a list of domains on my network?
@lassevk It only looks hard because you aren't using common indentation conventions (defun quicksort (lis) (if (null lis) nil (let* ((x (car lis)) (r (cdr lis)) (fn (lambda (a) (< a x)))) (append (quicksort (remove-i...
@lassevk It only looks hard because you aren't using common indentation conventions (defun quicksort (lis) (if (null lis) nil (let* ((x (car lis)) (r (cdr lis)) (fn (lambda (a) (< a x)))) (append (quicksort (remove-i...
@lassevk It only looks hard because you aren't using common indentation conventions (note, this isn't quite right because the preview lies a little; the r's should align with the fns in the recursive quicksort argument) (defun quicksort (lis) (if (null lis) nil (let* ((x (car lis)...
Answered my own question: Use the [NetServerEnum][1] function, passing in the SV_TYPE_DOMAIN_ENUM constant for the "servertype" argument. In Delphi, the code looks like this: <snip> type NET_API_STATUS = DWORD; PSERVER_INFO_100 = ^SERVER_INFO_100; SERVER_INFO_100 = packed record ...
|python|linux|macos|port|serial|
What about [IncrediBuild][1]? This is a nice distributed build system with visual studio integration. [1]: http://www.xoreax.com/main.htm "IncrediBuild"
I use Google Reader for the feeds. Split it up in multiple categories, 'A' with the more unique stuff, 'B' with the spam (Digg for example, easy to ignore because the important stuff shows up in 'A'), 'C' for my webcomics. I always read the stuff in 'A', when bored I read 'C' and 'B' when I have spare time. It happe...
When using ADO.NET you can use the keywork for things like your connection object or reader object. That way when the code block completes it will automatically dispose of your connection.
You can also create sql triggers.
You know there is a new JCP API for Accessing RESTful Services, also: JAX-RS JCP311 https://jsr311.dev.java.net/ The open source version is called Project Jersey
Use the Context.addServlet overload that takes a ServletHolder. ServletHolder is a class that accepts either a Class or a Servlet instance. Servlet myServlet = new MyServlet(); ServletHolder holder = new ServletHolder(myServlet); context.addServlet(holder, "/"); This assumes Jetty 6. I think it wi...
Things like this: using conn As New SqlConnection("connection string") { conn.Open() // execute sql statement here on the connection you created } This SqlConnection will be closed _even if an exception is thrown_, without the need for a try/catch/finally.
mmc could not create the snap in error when launching internet information services
|iis-5|
I am getting this error when trying to run internet information services on a Virtual Machine running windows XP. Anyone have any idea?
Depending on your library, you can usually just put both queries in one Command String, seperated by a semi-colon.
You get the line with <tt>C-k</tt>, you make the next command happen ten times with <tt>C-u 10</tt>, then you paste the line with <tt>C-y</tt>. Pretty simple. If you always want C-k to do the whole line, you can set <tt>kill-whole-line</tt> to <tt>t</tt>. No more fiddling with <tt>C-a</tt> or <tt>C-e</tt>. Ther...
Insufficient information -- what SQL server? Why have a history table? Triggers will do this sort of thing. MySQL's binlog might be more useful for you. You say you don't control the database. Do you control the code that accesses it? Add logging there and keep it out of the SQL server entirely.
Hey! These queries are not equivalent. ================================ Results will be same only if assuming that one email belongs only to the one time zone. Of course it does however SQL engine doesn't know that and tries to remove duplicities. So the first query should be faster. Always use UNION ALL, unless...
Hey! These queries are not equivalent. ================================ Results will be same only if assuming that one email belongs only to the one time zone. Of course it does however SQL engine doesn't know that and tries to remove duplicities. So the first query should be faster. Always use UNION ALL, unless...
As an aside, it's always a good idea to declare immutable variables using `const`: float function(){ const float x = SomeValue; cout << x; return x / SomeOtherValue; } Among other things this will prevent you from unintentionally passing your variables to functions that may mod...
Assembly loading is a rather elaborate process which depends on lots of different factors like configuration files, publisher policies, appdomain settings, CLR hosts, partial or full assembly names, etc. The simple version is that the GAC is first, then the private paths. %PATH% is never used. It is best to use...
Assembly loading is a rather elaborate process which depends on lots of different factors like configuration files, publisher policies, appdomain settings, CLR hosts, partial or full assembly names, etc. The simple version is that the GAC is first, then the private paths. %PATH% is never used. It is best to use...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Centering</title> <style type="text/css" media="screen"> body, html {height: 100%; padding: 0px; margin: 0px;} ...
The profiler is only available in the Team System editions of Visual Studio 2008. The last version that I used that included a profiler was Visual C++ 6.0. For Visual Studio 2005, you could try [Compuware DevPartner Performance Analysis Community Edition](http://www.compuware.com/media.asp?cid=701000000004ej0).
Here's one way that has been accomplished that seems extremely simple and easy to implement. http://xnaessentials.com/tutorials/highscores.aspx/tutorials/highscores.aspx
You're right -- looks like Eclipse has acknowledged it as a [bug][1]. [1]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=199499
The [java.lang.management][1] package does give you a whole lot more info than Runtime - for example it will give you heap memory (`ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()`) separate from non-heap memory (`ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage()`). You can also get process CPU us...
Try to set log4j.logger.org.hibernate.type=TRACE and see if that helps.