Posts

Showing posts from 2009

Issue while upgrading the GrEclipse plug-in

I upgraded my GrEclipse plug-in today to a newer version. The upgrade URL is given in this page . Since it was an upgrade, I click on Help -> Check for updates in Eclipse. Immediately I got the following error: Cannot complete the install because of a conflicting dependency.   Software being installed: Groovy-Eclipse Feature 2.0.0.xx-20091211-1000-e35 (org.codehaus.groovy.eclipse.feature.feature.group 2.0.0.xx-20091211-1000-e35)   Only one of the following can be installed at once:     JDT Core patch for Groovy-Eclipse plugin 2.0.0.xx-20091017-2200-e35 (org.codehaus.groovy.jdt.patch.feature.jar 2.0.0.xx-20091017-2200-e35)     JDT Core patch for Groovy-Eclipse plugin 2.0.0.xx-20091211-1000-e35 (org.codehaus.groovy.jdt.patch.feature.jar 2.0.0.xx-20091211-1000-e35) ... and a lot more ... To recover from the error, I just uninstalled the version of JDT that was conflicting. To do this, click on Help -> Install New Software and click on the " What is already installed?

Hurray! I have installed 2 GB RAM in my laptop

Last night I upgraded the RAM installed in my laptop from 1 GB to 2 GB. I found the following YouTube video to be very helpful and informative.

Two performance tweaks to boost your Vista performance

I have a HP dv6000 laptop with Vista Home Premium. Since day 1, my machine was terribly slow for no reason. I tried so many tweaks that didn't seem to work at all. I installed Process Explorer from sysinternals tools to monitor which process is taking much resources. There were two things that gave me a good performance boost: Disable Windows defender. Disable the windows indexing service. I have my own anti-virus software (Avira) which provides protection against much better protection than the Windows defender. But because both the defender and Avira were scanning each file and process, it effectively doubled amount of load to protect the system. So I disabled the defender. You can read how to turn off the defender here . I don't need the indexing service offered by Windows. The indexer hogs so much resource and I have not used the search feature much. You can easily disable indexing by right clicking on the drive in Windows Explorer and un-checking the indexing for th

Everything you want to know about memory

Recently I have been looking around to upgrade the memory in my laptop. I was trying to understand what are the specs and how to find out the right RAM model for my laptop. I found this article to be extremely useful. You can also read a follow up article that talks about the details of the RAMs used in GPUs. Also this article was helpful in understanding the FSB speeds and bus speeds in general.

Reloading inittab without reboot

Use " /sbin/init q " if you made any changes to the inittab file and would like init to reload that file.

A note on Java's Calendar set() method

Remember that the Calendar's internal fields include year, month, date, hour, minutes, seconds, milliseconds and time zone. Whenever you are calling a set() method with multiple fields, like set(year, month, date), it will not affect the rest of the fields. Remember that there is no set() method with multiple fields available to set the milliseconds. If you would like to set the milliseconds, you must use set(Calendar.MILLISECOND, value). Likewise, if you are planning to set all the fields, its a good idea to reset all the fields using clear() method. This will clear milliseconds as well. Most of the times, millisecond field may not be of interest to you. But if you are going to use the UTC milliseconds, by calling getTimeInMillis(), then make sure you set the right values for milliseconds as well.

Netcat for windows

I was troubleshooting an issue with one of the clients. And I desperately needed them to run the netcat tool and send me the output. But their OS is windows. So I was looking for the netcat tool for windows. Here it is: http://joncraton.org/files/nc111nt.zip

Eclipse - issue with setting break points

I recently ran into a weird issue. I had to debug a piece of code that I wrote. So I launched the application in Eclipse in debug mode, and set a few break points. Though I can see that the log messages related to all the break points appear in the log, it didn't stop in all the break points. In some break points it stopped and in some other it didn't stop. I checked the output directory, I checked the flags to the compiler, even I downgraded to Ganymede. Nothing seemed to work. When I asked the question in the stackoverflow.com, I got the answer in five minutes . Looks like JDK 1.6 update 14 has an issue with debugging. So upgrading to JDK 1.6 update 16 helped. But still I am seeing the issue occasionally.

CircuitCity online is open for business again

CircuitCity online is open for business again. They filed for bankruptcy in Nov 2008 and closed both online and stores.

Comparison of SSD and drum-based HD (HDD)

I am in the process of assembling a PC for my friend. So I was gathering information on various components. I thought I must share what I learned about hard disks. The latest breed of hard disks in the PC segment are called Solid State Disks (SSD). Though the technology is not new, the price has become affordable in the recent few years. Due to their formidable high prices earlier, computers were usually shipped with the drum-based hard disks (I will refer to them as simply HDD). You can read about SSDs from wikipedia . These are the points I wanted to share: 1) The transfer speed of SSD is faster compared to HDD. A good 7200 RPM hard disk usually has a transfer rate around 70 MBytes/sec. Where as SSD has a transfer speed around 200 MBytes/sec. Remember I am giving an approximate figure and speeds vary for read and write. One of the recent additions to the hard disks is 10000 RPM hard disks. I found them to be faster than SSD. For e.g. Western Digital's Velociraptor has a peak tr

Ubuntu from USB drive

I wanted to try out running Ubuntu from my USB drive (2GB). While I was searching for the right software, I came across UNetbootin utility. This utility is a lot simpler to use than the method provided in the Ubuntu site , a method that makes use of Win32 disk imager. The best part is, UNetbootin provides you options to create bootables from other operating systems like FreeBSD, NetBSD and other notable flavors of Linux. UNetbootin is not an installable, its just one .exe file. You download the exe file and start it. It will prompt you for the version of OS you would like to burn in your USB. Once you select, it will automatically download the ISO image file and burn it for you. In case you happen to have the ISO image file available on your local hard drive, you can provide that path too.

Eclipse icons

Here is a complete list of icons that are used in Eclipse. It is very useful to understand all these icons as most of the time in the outline views only the icons are used to crisply denote what each member/method stands for.

Good JavaScript frameworks

This page provides you a list of top 5 JavaScript frameworks. Though I am not sure if they are the top 5, which is always arguable, I am very sure that those frameworks are good and useful.

VirtualBox 3.0 freezes bug has been fixed

If you had been following my blog, I posted an issue earlier with VirtualBox 3.0 that under network load it freezes. That bug has been fixed in release 3.0.2. Please refer to the release notes of 3.0.2 for an update. I verified the fix by reinstalling the 3.0.2 version.

Troubleshooting network issues in VirtualBox

VirtualBox comes with built-in facility to trace the network packets. To enable tracing, you must first shutdown your VM. Then find out the VM's name or uuid. Please refer to my earlier post to find how to find uuid. Once you have the uuid of the VM, give the following command: vboxmanage modifyvm a27473c0-d690-4c95-a48a-1c49d69a20e6 --nictrace1 on --nictracefile1 c:\temp\nictrace1.pcap Replace my uuid with yours. I am enabling tracing on the NIC1. You will have to change the parameters appropriately if you would like to trace some other NIC. To make sure that your VM's tracing is enabled on the specified interface, give the following command: vboxmanage showvminfo a27473c0-d690-4c95-a48a-1c49d69a20e6 VirtualBox Command Line Management Interface Version 2.2.4 (C) 2005-2009 Sun Microsystems, Inc. All rights reserved. Name: Ubuntu8.10 Guest OS: Ubuntu UUID: a27473c0-d690-4c95-a48a-1c49d69a20e6 Config file: C:\Documents and Settings\xxxx\.VirtualB

Line color in PlotKit

I am experimenting with PlotKit tool. So far I am liking the simplicity of the library and the good documentation. I was making use of the SweetCanvasRenderer to draw a line graph, as I was strictly following the quick start example. I wanted to draw two line graphs in the same canvas, each with different colors. But with the SweetCanvasRenderer it is not possible to change the line color, as it always overrides the strokeStyle property in the Context with white color. See the code below from SweetCanvas.js: context.strokeStyle = Color.whiteColor().toRGBString(); If you would like to make use of SweetCanvasRenderer, still would like to have different colors for each of the lines, you will have to do it with little changes to the SweetCanvas.js file. Or you can consider making use of the BasicCanvasRenderer.

VirtualBox 3.0 freezes under network activity

*** Update on 07/11/2009 *** The issue below has been marked as fixed. Refer to the release notes of 3.0.2 for a note on what has been fixed. I think now you can happily move back to VirtualBox 3.0 :-) After installing the VirtualBox 3.0, I ran my Ubuntu under that. When I ran update manager, my VM kept freezing. I realized that not only with update manager, even with Firefox trying to download a huge file, the VirtualBox freezes. Looks like this a known issue and there is a bug artifact for this one. As of now, there is no fix available and there is no ETA as well when the fix will be available. So I have happily reverted back to VirtualBox 2.2.4 version. I don't see that issue anymore.

Doing "View source" for JavaScript generated page

By JavaScript generated page I mean a page that is mostly constructed using JavaScript's document.write(...) statements. This is mostly the case when you make use of UI frameworks like YUI. Recently one of my friends approached me to help him with trouble shooting a page which was developed using YUI. We spent some time trying to figure out how to view the source of the page that we were viewing. When we did a right click and "View source" in Firefox, all we saw was a bunch of JavaScript sources being included. Nothing more. So here is how you can easily view the source. Install "Execute JS" plug in. Then load the page you would like to view source. Then you click on "Tools -> Open Execute JS". Then check the "Content Window" and choose the title of the window that you would like to view the source for. Now in the "JS-Code to execute", just type the following: document.documentElement.innerHTML Then click on "Execute"

VT-x is not available error in VirtualBox 3.0

Image
After installing the VirtualBox 3.0, when I started my Ubuntu VM, I got the error shown in the image on the right side. The reason for this error is explained in this discussion thread . To recover from this error, follow these steps below: Click on the OK button and come to the VirtualBox manager. Click on the VM that threw this error and click on the System. Click on the Processor tab and reduce the number of CPUs to 1. Click on OK and save your changes. Now start your VM by selecting it and clicking on Start button or just by double clicking on the VM. Though the VirtualBox can support multiprocessor guest operating systems, to enable it you must have VT-x support from the underlying processor.

GMail is out of beta now

Hurray ... GMail is out of beta now. Read the official announcement in the Google blog .

VirtualBox 3.0 relased

VirtualBox 3.0 has been relased. You can download that from the product web site . I have upgraded and yet to try out my Ubuntu image in that.

bashreduce - a MapReduce system using command line tools

I came across this interesting reading in Linux Magazine about bashreduce . Sounds interesting. You will also find it useful to read about Richard Crowley's extensions to bashreduce .

KSplice - Thats what I had been looking for

The time has come to apply any critical kernel patches without rebooting the system. The tool that does this magic is called ksplice and shipped as a part of Ubuntu system (Jaunty). It would be a valuable part of any system that cannot afford to take a downtime. To learn more about ksplice, please read this Linux Magazine article .

Why Python has both lists and tuples?

There is a FAQ entry that explains why Python has both list and tuple data types and what is the key difference between these two types.

Adding META tag to your blogger page layout

When I wanted to submit my blog for Google AdSense, I had to first confirm the ownership to my blog. It can be proved in two ways: either by adding a META tag in the HEAD section or by adding a HTML file in the site. Since I have my blog in the blogger.com, the easiest way for me to confirm my ownership is to add a META tag in my blog layout. It is very easy to add this tag. Follow these steps. Login to your blogger account Click on Layout and then Edit HTML Search for the following phrase: all-head-content . This is the line that tells the blogger engine as to what needs to be included in the HEAD tag. Just before this line, not just before all-head-content, but before the line , include your meta tag. Most likely you will be including a META tag that looks like: < meta name = 'verify-v1' content= "Some base64 encoded string" / > Save your changes and view your blog and confirm that your new META tag appears on the header. Remember that though you specify nam

The mysterious ORA-03111 error

Recently one of the applications that I developed started throwing exceptions, that had the following message: SQL state [72000]; error code [1013]; ORA-03111: break received on communication channel When I googled around, I couldn't come across anything useful. Sadly enough most of the sites just showed the documentation for that error, without any explanation from anyone experiencing that issues. So here you go, with the best possible explanation that I could come up with. My application sets two things on the connection that is throwing this exception: It sets the fetchSize to be 2500 rows It sets the query timeout to be 10 seconds The database server and the application are separated over a long latency network (actually there is a NetEm box that emulates the long latency between these two boxes) which has a latency characteristic of 50+/-5 milliseconds. This is the whole setup. It is important to understand how the timeout is handled by the Oracle client (in my case JDBC clien

Availability calculation

I wanted to understand how the availability is calculated for systems. I came across an excellent article and found it very useful. You can read it from here .

Yet another top 10 list for Firefox

But this one is useful. The title of the blog entry is "Top 10 Firefox plugins for web developers & designers".

Effective use of Timeouts

It is very important to pay special attention to the timeouts and set them with proper values for any blocking operation. Any good library API must provide a way to set the timeout for any blocking operation. Recently we identified one of the issues in production network because one of the programs that we deployed in production had set right timeout value. I just thought I must reiterate the fact that its critical to set the timeout values to optimum level so that we can fail fast and catch issues.

Introduction to Vimscript

A useful page to give a decent introduction to Vimscript , a scripting language used to extend vim.

Difference between function, macro and special form in Lisp

A very good description of the differences between function, macro and special forms in Lisp. Read all the way through the end of the email thread.

A list of WYSIWYG editors for content mangement

There are times when you would like to have a text area in your web site that resembles like a word processor's page, with a lot of controls to format your text. If you have worked with any content management system (CMS) or a wiki, you have most likely come across one. I was looking for a WYSIWYG editor and came across a few of them. Thought I sould share the list with everyone so that you don't have to waste your precious time. The list below is not in any particular order. FCKEditor . Looked like the editor that had the most features. This site provides a demo and a very good documentation as well. TinyMCE . Wherever people talk about WYSIWYG editor, they invariably mention both FCKEditor and TinyMCE. Provides a demo and by looking at the source of demo you can find how easy it is to integrate this editor. Xinha .They have an excellent demo page that allows you to customize the editor on the fly and see. Kupu . Kupu is from Open Source Content Management team. I could not

Django tutorial

I manged to complete the three parts Django tutorial today. I haven't worked with many web frameworks before. I have a very good experience in CGI and some flaky experience in JSP and PHP. I liked Django for the reason that they coupled the model and the database and provide the ability to almost worry nothing about writing database queries. I don't know how much more time it would have taken if I had written the poll application myself in either JSP or CGI. Especially setting up the database and the tables. Now that I have first hand experience in developing application in Django, I am yet to see the performance under reasonable and heavy loads. I am also yet to discover how Django is deployed in production. As per my understanding, the design of the Python interpreter itself is not suitable for multi-threaded applications. The best way to scale Python is not to create a multi-threaded application, but to have more instances of Python running with some load balancing server i

Mounting folder shares in xVM

In xVM, you can access folder shares from the host system in your guest Linux system. The prerequisite is to install all the guest additions. The following is the process that I followed to install guest additions and mount the shares in my Ubuntu desktop (Linux ubuntu-desktop 2.6.24-24-generic). Installing guest additions is very easy. Once you start your guest OS, you click on the "Devices -> Install Guest Additions" in the xVM. Then it will mount a CD ROM for you. Once the CD ROM is mounted, just let it auto run or you can run the appropriate shell script from the mounted CDROM. Usually it is mounted under /media/cdrom. So doing an ls under that directory should tell you which shell script you need to run. To create a share, go to "Devices -> Shared Folders". Click on the add share icon (the one that has "+" in it). Select the folder you would like to share with the guest and then give it a name. It is preferable to give a short name for the share

A useful regular expression tutorial

This is one of the most useful regular expression tutorials I have seen in the recent times. The tutorial is not only clear and concise, it just hits what is actually needed to be fully productive. BTW, the tutorial was written by a high school student!

xVM's vboxmanage.exe command

You can view and edit the configuration of your guest OSs using the vboxmanage command. To view the list of guest OSs you have, give the following command: C:\Program Files\Sun\xVM VirtualBox>VBoxManage.exe list vms VirtualBox Command Line Management Interface Version 2.2.2 (C) 2005-2009 Sun Microsystems, Inc. All rights reserved. "MySolaris" {dc6dc85f-5583-4a1b-bf3e-969941a2cd91} "Ubuntu" {eb973bbf-d86e-4579-85eb-6ea2cd12bf95} "Debian" {3e784597-89d8-4f17-90cb-63e866c651a3} "openSUSE" {6862884e-60e1-4c65-8aab-b57ec38a3922} "Debian-Lenny" {4b561432-abac-4a27-a501-b42af956b96b} To view the specific guest, you can use the UUID of the guest. For e.g. C:\Program Files\Sun\xVM VirtualBox>VBoxManage.exe showvminfo eb973bbf-d86e-4579-85eb-6ea2cd12bf95 VirtualBox Command Line Management Interface Version 2.2.2 (C) 2005-2009 Sun Microsystems, Inc. All rights reserved. Name: Ubuntu Guest OS: Ubuntu UUID: eb973bb

Installing matplotlib - the hard way

I recently installed matplotlib from the source. It was quite an experience that I thought I would share my experience so that others don't have to waste time searching how to do that. So here it is! What is matplotlib? Matplotlib is a libarary to plot figures from your Python program. It has much more features than just plotting. You can read more about that from the library's home page . If you are planning to install matplotlib on Linux everything from the source by building everything yourself, this guide is for you. Please read on. You will have to install the dependencies first before you can install matplotlib. Matplotlib depends on numpy, zlib, libpng and FreeType libraries. You can get the full dependency list (including the optional dependent libraries) from here . Let us see how to install each one of these components. Phase 1: Installing numpy Numpy requires the same Fortran compiler that was used to build blas. There are two flavors of Fortran compilers possible:

Paper on garbage-first (G1) garbage collector

This is the paper on garbage-first (G1) garbage collector. It is an interesting read.

A better way of printing heap usage in Java

If you rely on getting the heap usage by methods provided in Runtime, then consider making use of the MemoryPoolMXBeans. The code to print the memory usage is extremely simple: List mpool = ManagementFactory.getMemoryPoolMXBeans(); for(MemoryPoolMXBean b:mpool) { System.out.println(b.getName() + ": " + b.getUsage()); } You will see something like this when you run this: Code Cache: init = 163840(160K) used = 468672(457K) committed = 491520(480K) max = 33554432(32768K) Eden Space: init = 917504(896K) used = 202792(198K) committed = 917504(896K) max = 4194304(4096K) Survivor Space: init = 65536(64K) used = 0(0K) committed = 65536(64K) max = 458752(448K) Tenured Gen: init = 4194304(4096K) used = 0(0K) committed = 4194304(4096K) max = 61997056(60544K) Perm Gen: init = 12582912(12288K) used = 108360(105K) committed = 12582912(12288K) max = 67108864(65536K) Perm Gen [shared-ro]: init = 8388608(8192K) used = 6162160(6017K) committed = 8388608(8192K) max = 8388

A good reference on processor cache

I found this good reference on processor cache while I was looking for some material to refresh my cache knowledge. Hope this is useful for you too.

How to measure time to execute a query when using DBCP+JdbcTemplate

Keep the following things in your mind if you are planning to measure the time taken to execute a query when you make use of Apache DBCP + Spring JdbcTemplate. You will never be able to find out the time taken to execute a query in the database by measuring the the time it takes to complete any variant of JdbcTemplate.query...() or JdbcTemplate.execute...() . Making use of any of these functions involve the following steps: Time taken to borrow a connection from the pool Time taken to create a statement from the connection and bind the parameters if needed Time taken to send the query to the database Time taken to execute the query in the database ( this is the time you are specifically interested in ) Time taken to receive the result from the database (depending on the fetch size you have set, this will vary). For UPDATEs, only the update count is sent back from the database. Time taken in the row mapping (if you are making use of RowMapper) or time taken to consume all the rows from

Is my DBCP configuration bad or my database slow?

Let us say you are making use of DBCP in your application. You are running a load test on your application and you find that the response time is terrible. You suspect that it is the database that is messing up all the performance. Well, as an application developer that would be my first response! But how do I prove that it is the database that is causing the issues, and not my application. The first thing you should be checking is the number of load testing client threads versus the number of connections in your DBCP. If you have more number of client threads than the number of connections in your DBCP, there is a likelihood of your application being the root cause for the bad response. The easiest way to confirm this one is by using the maxWait parameter of DBCP. You just set the maxWait to a value that you expect the average waiting time to be. For e.g. in my case I never expect the wait time to be more than 30 milliseconds. Once you set this watch for errors in your application lo

Saving a file being viewed in less

Sometimes I have a long sequence of command line pipes that end in less command. For e.g. cvs log main.c | egrep "^revision " | less So what is the best way to save the contents that are being viewed in less? You cannot view those contents by typing the letter "v". If you do so you will get an error message saying "Cannot edit standard input (press RETURN)". The solution is simple. First type "g" to go to the beginning of the file. Then type "|". Then you will be prompted for the "mark:" and enter "$" (which denotes the end of file). Then you can enter a command for which the entire contents of less will be piped. For e.g. I will give the following: cat > /tmp/savefile.txt Thats it! You have saved the contents to the file /tmp/savefile.txt. Now you have a problem. Since you have moved to the beginning of the contents, you might want to go back to the same place where you were before saving the contents. Just typ

So you think you understand misfireThreshold?

One of the most critical and least documented features of Quartz is the concept of misfiring and how misfiring is handled. If a trigger was supposed to carry out a job a certain time, and for some reason it was not carried out at that time, it is a misfired trigger. But not any trigger could be treated as a misfired trigger. For e.g. if a trigger is long due for 2 hours from its actual firing time, does it make sense to treat that as a misfired trigger? To make that decision Quartz scheduler relies upon a configurable parameter called misfireThreshold . It is specified in milliseconds. Whenever a trigger is due for misfireThreshold or lesser amount of time, it will be treated as a misfired trigger and triggered depending on the misfire policy specified in the job detail. For e.g. on a certain situation you might want a misfired trigger to be fired immediately, on a certain other situation you might decide its okay to reschdule the same trigger to the next firing time. For SimpleTrigger

More comments on JDBC batch update return codes

This is a quick follow up to my earlier post on JDBC batch update return codes. There are two constants that you can conveniently make use of to check the error codes available in java.sql.Statement: SUCCESS_NO_INFO - The UPDATE or INSERT corresponding to this input values has succeeded but the number of rows that it affected is unknown. EXECUTE_FAILED - The UPDATE or INSERT corresponding to this input values has failed.

Eclipse CVS error

Today while I was trying to synchronize my code with CVS repository and I got the following error: Problems reported while synchronizing CVS Workspace. 0 of 1 resources were synchronized. An error occurred synchronizing /abcd: I/O exception occurred: java.io.IOException: channel is broken I/O exception occurred: java.io.IOException: channel is broken java.io.IOException: channel is broken I was scratching my head for sometime and searched Internet for an answer, but none seemed to be appropriate for my case. Then when I tried to do the check out from command line using plink, I got a message from my CVS server stating that my password had expired and I needed to change my password. So I changed my password and everything started working fine. If you get the error message above, one possible and easy to check root causes is your password expiry.

Understanding return codes of JDBC batchUpdate

Recently I had to make use of the JdbcTemplate.batchUpdate() facility in Spring. I was connecting to the Oracle database using Oracle JDBC driver. As per the documentation, the batchUpdate() function is supposted to return an integer array. Each element in the array contains the number of rows affected the respective INSERT/UPDATE/DELETE query in the batch. But during my testing I found that, I was always getting all the elements to be -2. Initially I was thinking it was a bug in the driver code. Then when I was referring to the JDBC Programmers Guide , I figured the following: For a prepared statement batch, it is not possible to know the number of rows affected in the database by each individual statement in the batch. Therefore, all array elements have a value of -2 . According to the JDBC 2.0 specification, a value of -2 indicates that the operation was successful but the number of rows affected is unknown. There are more examples and explonation of error codes in the same page .

Useful list of Java resources

I came across this article titled "Essential Java Resources" in developerWorks and found out to be useful.

Gotchas with DBCP

I had to make use of DB connection pool in one of the applications that I was implementing. Since I am new to Java, everyone in the team was suggesting why don't you make use of Commons DBCP. Being a fan of reuse, I decided to make use of DBCP and started reading about the parameters that are exposed so that I can customize DBCP to fit my needs. While reading through the available configuration parameters , I was thinking, "I don't need to check the connection to be bad on every borrow or return. It is sufficient if I check for being bad only when the connection is sitting idle in the pool." So I set the testWhileIdle to be true and set the validationQuery to be "SELECT 1 FROM DUAL". I was thinking that the configuration that I had was the optimal for the situation in hand. But one thing I overlooked was, the default value for the testOnBorrow is true. So the moment you set the validationQuery to be any non-null value, every connection you borrow from the po