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