SUSE Enterprise 10 video settings on VMware

Not sure why SUSE Enterprise 10 failed to automatically detect video/monitor configuration after I migrated virtual machines from Microsoft Virtual PC to VMware Workstation ACE Edition 6.0.0. I had to run x86config and provide the parameters below. Section "Monitor" HorizSync 31-38 Identifier "Monitor[0]" ModelName "800X600@60HZ" Option "DPMS" VendorName "--> VESA" VertRefresh 50-60 UseModes "Modes[0]" EndSection Section "Modes"  ... Read more

Search and Replace

Sometimes you just need to search all files in a folder and replace everything that matches to a regular expression. Here is a program that does this trick. Of course you need to update the regular expression and other constants with values that meet your requirements. ATTENTION: This program can (depending on the values you assign to the constants) screw up any/all of your files, so make yourself a favor before running it: backup the files under the target folder. [code ... Read more

Making All Text Fields Uppercase

A jQuery-based JS snippet that makes all text fields of the current document automatically uppercase as the user types. [javascript] $('input[type=text]').keydown(function(e) { if(e.keyCode >= 65 && e.keyCode <= 90) { /* Bypasses ctrl-letter events */ if(event.ctrlKey) { return false; }  ... Read more

Any Language Anywhere

I was reading my SCJP Study Guide (PDF format, on my iPhone) while waiting for my turn at a barber shop. As I was going through one of the sections I fell into a tricky question -- all of a sudden found myself craving for a Java compiler. Just Googled "online java compiler" and found a wonderful resource called Ideone, it allows you to write, compile, debug and run your code online. Besides Java it also supports a multitude of languages (vide ... Read more

Falling Through

A real-life example of a switch statement with fall-through cases. [code language='java'] public class FallingThrough { public static void main(String[] args) { char c = 'a'; switch(c) { case 'a': // Falls-through case 'e': // Falls-through case 'i': // Falls-through  ... Read more

How Evolution Harms a Programming Language

Java is a lovely programming language, but after its biggest evolutionary step (from 1.4 to 1.5) some awkward things started occurring, since the new compiler should be backwards compatible. Java programmers must recall about some backwards compatibility aspects in order to understand why the Java compiler acts in a somewhat strange way at times. Method overloading, for example, became pretty tricky. Guess what's the result for the program below... [code language='java'] public class MethodOverloading { void doSomething(Integer i) {  ... Read more

Avoiding StaleConnectionException on WebSphere Application Server

StaleConnectionException is one of the most popular issues that occur when one implements an application that employs JDBC to connect to a database through WAS' connection pool. Depending on the container's connection pool settings, it keeps stale (no longer usable due to database failure) connections. Therefore when your application gets a new connection and tries to use it, it will fail. As recommended by IBM, I have implemented several approaches to detect stale connections, and retry. Although OK, the retry approach is ... Read more


Lazy Singleton in Java: [code language='java'] public class Singleton { private static class SingletonHolder { private static Singleton INSTANCE = new Singleton(); } public static Singleton getInstance() { return SingletonHolder.INSTANCE; } }[/code] Read more

Transaction Management Using Spring

In order to effectively design and implement software that handles transactions using Spring, knowledge on the concepts below is vital: Isolation: the degree of isolation this transaction has from the work of other transactions. For example, can this transaction see uncommitted writes from other transactions? Propagation: normally all code executed within a transaction scope will run in that transaction. However, there are several options specifying behavior if a transactional method is executed when a transaction context already exists: for example, simply continue running ... Read more
Page 4 of 41234