Adarsh welcomes you!

My window to the outside world.

Why I stopped using Eclipse and switched to IntelliJ IDEA after over a decade?

Eclipse vs IDEA

After having been a hardcore Eclipse fan for over 10 years, I made the switch to IntelliJ IDEA last year. I used to be completely satisfied with Eclipse. Infact, I never imagined I could ever get comfortable with another IDE for the rest of my life.

Come join me as I take you through my journey.

15 Dec 2014

Static Initializer and Blank Final Problem in Java

Greetings folks! Here I'm with yet another interesting situation in Java that I stumbled upon.

The situation is simple. I have two class level (static) blank final variables declared. As we all know, for the class to compile, we must initialize these variables in a static initializer block. Fair enough. Now, I will initialize the first variable the normal way. However...

21 Jun 2008

RARoScope - Java Library for Scanning RAR Files

Ever faced the challenge of having to be able to scan RAR archives using Java? Wished the API was as simple and easy to use as the ones provided for ZIP and JAR handling in Java? Don't want the hassles of including expensive native code into your Java application?

RARoScope is here to solve all these woes.

17 Mar 2008

Batch Rename File Extensions on Windows

"Necessity is the mother of invention" turned true to me this weekend as I wrote this script. Consider this. You go on a weekend outing with your friends and end up taking hundreds of snaps using your favourite digital camera.

You come home and download all the pictures to your laptop. Everything is fine about the pictures and all your friends are happy with the image quality. But, you being a perfectionism and systematism freak, somehow don't like to have those ".JPG" extensions to your files. You wish you could change the extensions of all those files to ".jpeg" in one shot.

03 Nov 2007

The Simplest Way to Open Command Prompt in Windows

enter image description here

If you use Windows, you must have realized that Command Prompt is one of the most frequently used programs. There are many times when we wish to open a Command Prompt to start in a certain directory. For example, how nice would it be if we could just right click on a deep directory and open a Command Prompt window to start from there!

19 Sep 2006

HTML Index Generator Batch Script for Windows

I recently saw that a colleague of mine had written a Java program to generate a simple HTML index of all the sub-directories of a given directory. I felt that the task could be accomplished with even more control if we just had a Windows batch script which does the same, eliminating the need for any JVM.

I've christened this script, indexer.bat so that it's easy to remember.

29 Jun 2008

Simple Implementation of Wildcard Text Matching using Java

The quick brown fox jumps over the lazy dog

What if you had to implement a text matching logic in Java that would result in an affirmation for search strings such as Th*ick*b*ox*over the*dog, *fox*dog and a negative for ones such as *fox*brown and *abcd*?

I faced a similar challenge few days back as part of another tool I was working on. I wanted a simple solution that not only worked but worked faster. Using a regular expression wasn’t feasible as the search pattern was dynamic and hence, precompiling the expression for faster performance was ruled out.

I thought for a while and arrived at this solution. Hope it helps some hapless programmer like me slogging the night out in some corner of the globe.

13 May 2008

Throwing null instead of an Exception in Java

As it's usual these days, I was spending the evening doing some extremely interesting programming in Java. It occurred to me all of a sudden, if we could compile a Java program if it threw nulls instead of exceptions!

11 Mar 2008

Fun with XMPP and Google Talk

Ethereal screenshot

Have you ever wondered when signing into Google Talk, what might be happening under the hood? How can it tell you that your friend is typing just as she has, in fact, started typing? How does it manage to show all that real time presence information?

Well, one day I got really curious and decided to open it up! In this two part article, I share my adventures as I unravel the way Google Talk does what it is best at — Communication.

29 Oct 2007

Very Long File Names in Windows

We had a strange problem one day when we were trying to deploy an Enterprise Application on WebSphere™ Application Server installed on a Windows XP machine. The application was never getting deployed although it was a perfectly valid one with no errors whatsoever. Just before the application would be deployed completely, a FileNotFoundException was being thrown for the EJB deployment descriptor.

java.io.FileNotFoundException: D:\IBM\..214 characters more ..\ibm-ejb-jar-bnd.xmi (The system cannot
find the path specified)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.(FileOutputStream.java(Compiled Code))
    at java.io.FileOutputStream.(FileOutputStream.java:151)
    at com.ibm.ws.management.application.task.ConfigRepoHelper.save2File(ConfigRepoHelper.java:440)
    at com.ibm.ws.management.application.task.ConfigRepoHelper.saveArchiveConfigDocs(ConfigRepoHelper.java:406)
    at com.ibm.ws.management.application.task.ConfigRepoHelper.saveEarConfigDocs(ConfigRepoHelper.java:343)
    at com.ibm.ws.management.application.task.ConfigureTask.performTask(ConfigureTask.java:161)
    at com.ibm.ws.management.application.SchedulerImpl.run(SchedulerImpl.java:215)
    at java.lang.Thread.run(Thread.java:568)
21 Feb 2005

CF - A fast Java Class Finder

What is it with class finders these days? Everyone seems to have their own version of the tool. From naive programmers creating crude forms to large organizations with fairly sophisticated ones. Through this article, I present my little implementation of the product.

But before you explore further, I have a few claims to make. I have tried my best to bridge the many mutual exclusivities exhibited by similar products in the realm.

22 Jun 2008

Args Engine - A reusable solution for Command Line Arguments Parsing in Java

Args Engine is a simple command line parsing engine for Java. The library has a single class and can be imported into any project of your choice easily. The only prerequisite, however, is that Java 1.5 or higher is required for the library to work.

This library works for applications which need to parse either (or both) short form (e.g. -h) or long form (e.g. --help) command line options. It also supports parsing valued options with the assumption that the value for an option follows the option itself (as in -out /usr/myhome/result.log).

12 May 2008

Fun with XMPP and Google Talk, Part 2

The second part of the technical article on XMPP, Fun with XMPP and Google Talk that was already published here. If you haven’t yet gone through the first part, I insist you do so before reading this one for the sake of continuity and ease of understanding.

20 Nov 2007

Recursive Java Decompiler

Often we encounter situations where the only solution to a certain Java problem is to decompile the contents of an entire JAR file, edit the resulting the source, rebuild and repackage before using.

I searched a lot for decompilers which could recursively decompile multiple class files while preserving the package hierarchy, but in vain. So, I thought of writing a Windows batch script myself, to do what I was looking for. This script is also known as JAR decompiler or recursive JAD.

30 May 2007