The dot refers to the current directory. The forward slash “/” is the directory path separator. So, when you type in ./filename at the shell, you prefix the filename with the path to the current directory. Why do we need to do this when running any executable file? When you run a command in the shell, it either runs it as a built-in command, or as an executable. If it isn’t a built-in command, the shell tries looking for the executable in all the directories specified by the PATH environment variable – you can see what this contains by typing in echo $PATH in the terminal. So if your file is in the current directory, the shell won’t find it[…]

Shortcuts Learn to use the shortcuts. Seriously! Did you know that if you need to scroll suddenly while typing, you don’t need to reach out for your mouse? Just use the Ctrl–↑ or the Ctrl–↓ key combinations to scroll up or down. To learn more about Eclipse shortcuts, head over to TechNonStop’s tutorial on Eclipse Shortcuts. Templates Templates are a must-learn – there are so many out there. For example, sysout, syserr, and systrace. Look up Window->Preferences->Java->Editor->Templates for all the pre-defined templates available, and don’t forget to add your own! Often, those working on a single project would like to share templates they create so that the whole team enjoys the shortcuts. Tweaks to eclipse.ini I’ve had a noticeable improvement[…]

The popular open source news site LXer recently published a detailed article on the advantages of Linux, with the aim of dispelling unfair cynicism. Whether you are a home user or a business owner, Linux is a great choice for an operating system. I entered the Linux world pretty recently, after spending a long time with various Microsoft Windows versions. Now, there’s no looking back! I’ve identified the top 5 reasons to consider turning to Linux: 1) Cost of operating your computer. Microsoft Windows offers various paid license plans to run your computer, or install copies on several machines in a network. When you turn to Linux, software that runs your computers is completely free! This is a great advantage[…]

I often get a chance to work from home, and this has given me opportunities to look for ways to share sessions with my colleagues. Windows XP used to have the excellent NetMeeting tool, but I recently switched to Ubuntu and haven’t yet found an equivalent. Yes, I’ve heard of VNC and used it a lot too, but I wasn’t happy with its remote desktop sharing performance. Ekiga is interoperable with NetMeeting calls, but doesn’t support screen sharing. Even Skype’s screen sharing does not seem to support remote screen controlling. However, Linux’s power is at the command line, and this is true even in the case of remote sharing. So here comes screen to the rescue – this magical command allows you[…]

I got my DB2 database installation running on a Ubuntu 11.10 machine recently, and have documented the steps I carried out below. Downloading DB2 The express edition is free, and can be downloaded from Download DB2 Express-C. You’ll need to register for an IBM id if you don’t already have one. Extracting and installing Use the command tar -zvxf db2exc_975_LNX_x86.tar.gz to extract the gzipped file. Run the installer using sudo ./db2setup, and choose “Install a Product” on the left menu. The installation process is quite straightforward after this point. Troubleshooting libaio.so.1 ‘not found’ when running db2setup I faced the following problem when I ran the setup script: $ sudo ./db2setup ERROR: The required library file libaio.so.1 is not found on[…]

Here’s a cheat sheet of Eclipse shortcuts I’ve put together to help me work really fast with the IDE. The shortcuts have been categorized into two sections – one that most people know about, and another section that contains the lesser known ones. You should be able quickly scan through the first section, and learn any of the ones that you don’t currently know. The second section might take longer, and you may want to bookmark this page for future reference. Easy Shortcuts Search in files Use Ctrl–H to search in all files across the workspace or project. Open Resource Ctrl–Shift–R opens a resource quickly – without the time it spends for indexing. This makes it especially fast when you’ve just opened a workspace, in[…]

The singleton design pattern in Java is one that I found over the years to be both tricky and interesting. There are many ways to break this pattern – and developers keep writing about different techniques to break it. One powerful way to break this pattern is to use reflection to access the private constructor and instantiate the class as many times as you want. The underlying idea is that you can call private members of any class using theAccessibleObject.setAccessible(true) reflection method. There are available techniques to prevent such reflection attacks. One of them is using the old way of writing your Singleton class, that is, not using lazy initialization, and, in addition to that, throwing an exception in the constructor[…]

UPDATE (18th Nov, 2011): I carried out a clean installation from a USB drive, and no longer have the purple/blank screen problem while loading the 3.0.0-12-generic kernel. I can conclude that a problematic web upgrade process prevented the newer kernel from loading. Possible fixes are being discussed on various forums, but none of them have worked for me. I’ve been running Ubuntu 11.04 (Natty Narwhal) for several months and have been satisfied with the experience. In October 2011, the newest stable Ubuntu 11.10 version (Oneiric Ocelot) was announced. The upgrade to the new distro can be carried out by running the command: sudo do-release-upgrade You could also enable automatic updates, like I did, and have Natty Narwhal prompt you to[…]

To enable Oracle’s Java plugin in your Linux browsers, just copy these lines into a script, and run it! JAVA_HOME=/usr/lib/jvm/jdk1.7.0 MOZILLA_HOME=~/.mozilla mkdir $MOZILLA_HOME/plugins ln -s $JAVA_HOME/jre/lib/i386/libnpjp2.so $MOZILLA_HOME/plugins Note: You may need to change the value of JAVA_HOME so that it correctly points to your installation of the JDK. 64-bit users will need to change the final line to: ln -s $JAVA_HOME/jre/lib/amd64/libnpjp2.so $MOZILLA_HOME/plugins If you’re a newbie, here’s how to run the script: Using your favorite editor, paste the contents of the script into a new file. Find out where Oracle Java is installed. This location has the directories “bin”, “lib”, and “jre”, among others. Replace the value of JAVA_HOME with the path to this folder, and save the file. This[…]

While working on the Oracle Application Framework, my Application module’s class file was behaving in a strange manner. When it was deployed on Apache and run, it was throwing the following Error: oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.ClassFormatError, msg=oracle/apps/fnd/framework/test/updateAMImpl (Invalid pc in line number table) at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1619) at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:2366) at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:427) at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:214) at oracle.apps.fnd.framework.webui.OAHttpSessionCookieImpl.useApplicationModule(OAHttpSessionCookieImpl.java:473) at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:398) I Googled on this error a lot, but most of the suggested solutions spoke about compiling the class with a different JDK or a different Java version and deploying it again. I tried to do that, but the error persisted. Decompiling using javap I thought of decompiling the deployed class using the javap utility – if it would fail to decompile, that would[…]