Yet another file uploader for jQuery!

Posted in Uncategorized by dpillay on December 17, 2010

Trying to get hold of a good client side file uploader plugin for jQuery turned out to be harder than I thought. Most of the existing plugins use flash (swfobject) to handle the uploads and thats not really the technology I was interested in using.

Hence I’ve written a new plugin that achieves the functionality using pure javascript called “jquery-yafu” viz. Yet another file uploader for jQuery :)

You can find the source @ Its dual licensed with MIT & GPLv2 licenses so should be commercial usage friendly.

I also have provided a Java server side component that can handle the file upload just in case people need it. Please check out the “yafu-sample” application for usage & details. It uses spring 3 mvc + commons file upload for the implementation.


Ubuntu 10.04 + A2DP = Awesome Headset Music!

Posted in Uncategorized by dpillay on September 27, 2010

Update: Been at it since morning again and looks like the whole process can be made much simpler & easier so say goodbye to PulseAudio as using ALSA is way better!

I recently bought a Plantronics BackBeat 903 and just wow! I got it working on my HTC Desire (w/ Froyo) in a breeze. Hardly anything to it, the android system takes care of most of the details. You just need to point and click :)

But getting the same working on Ubuntu 10.04 was quite a different ordeal. Don’t get me wrong here, Ubuntu Lucid Lynx is fantastic for what it did out of the box! I was able to pair and play music + talk on Skype via the ‘Telephony Duplex (HSP/HFP)’ profile. The problem here is that the sound in this profile just plain sucks. It breaks a lot and there’s a lot of background noise. Being the audiophile I am, this was just not acceptable!

Out came the documentation for Bluetooth, GStreamer & ALSA, trying to figure out what exactly needs to be tweaked. In the end, this is what worked for me:-

  • Make sure you have the following packages installed via apt-get: bluetooth, bluez, bluez-utils, bluez-audio, blueman, gstreamer*.
  • From a terminal run ‘gstreamer-properties’ and change the default output and input to¬†‘ALSA’.
  • Startup bluetooth (say from a control on the keyboard) and load ‘Blueman Manager’ from System -> Preferences -> Blueman Manager.
  • Here, do a search and find your device. You need to make sure to connect to the ‘Headset Service’ + ‘Audio Sink’ service for things to work correctly.
  • Once its connected and showing that both the above services are running, open up the Sound Preferences from System -> Preferences -> Sound.
  • In the Hardware tab, you should see a listing for your headset. By default, this is loaded on the ‘Telephone Duplex (HSP/HFP)’ profile. Use the drop down provided to select the ‘High Fidelity Playback (A2DP)’ profile.
  • Now restart your music player of choice (Quod Libet in my case) and enjoy hi-def sound! :)

The one thing I noticed here is that if you are connected on the A2DP profile, the Input tab of Sound Preferences does not list the headset mic. Apparently, its a kernel bug which we can’t do anything about just yet.

A2DP serves as an audio sink and has no specs for the mic, hence when you are using a smartphone, its the phone that manages to get A2DP for audio and the headset mic working correctly for calls. We’ll just have to wait till we can get this same feature set on Ubuntu.

For now, I’m more than content to switch the profile from A2DP to HSP/HFP for programs like Skype / GTalk etc.

Open source FTW!

tail4j – Simple tail for Java

Posted in technical by dpillay on May 10, 2010

I’ve been frustrated over the lack of a simple tail-like implementation in Windows and hence decided to write my own. Presenting tail4j, a simplistic file tail’er for Java.

It can be extended if anyone’s interested :)

On Immigration

Posted in economics, immigration, politics by dpillay on May 8, 2009

American President Barack Hussein Obama has been making a lot of news lately with respect to the US’s immigration policy. Right from envisaging a more protectionist policy for the US to the crackdown on the H1-B visas, he’s trying to woo the American citizen’s with his “No to Bangalore, Yes to Buffalo” slogan. The new tax rules for US companies that try to ship jobs offshore is another ploy to reel in these unruly businessmen who think only of profits for themselves and their shareholders. Shame on them, eh?

Now let’s consider this, the extra tax can never equal the cost of hiring an American worker for a substantially higher cost. Hence, all in all, the US companies would continue hiring offshore talent but this time simultaneously filling up the Fed coffer’s. Does it help the still out of work American worker? Definitely not! His job is still offshore and now the US companies have even less money to create more jobs. Well, who does this actually help? The Fed of course. But why would they want more blood money? Ah, I forgot the trillion dollar debt that they have created.

Great isn’t? First, the idiotic Fed creates an economic environment that leaves the American people with 3 trillion dollar debt, after which they punish the few that could help with even more tax. And then they go accusing Madoff for his Ponzi scheme!

With regards to the H1-B visas, again the only thing that Obama will accomplish is to crackdown on the competitiveness of US companies, nothing more. As long as business’s strive to be profitable, globalization will exist. Either that or Joe the plumber / programmer should accept working at $25k a year. Its absurd to tell businesses that they need to hire American’s at $80k a year and oh, by the way, you can’t shift that job abroad! One must learn the meaning of being competitive.

When I see the policies being enforced in the US and UK, I cannot but think of the analogy that all immigrants are guests who are not welcome any more. Would you go to a house that you knew were not welcome to? I wouldn’t. The people who support such protectionism must pay the price for their ineptitude.

There are those who are calling on India to make its own protectionist agenda but that would be equally dumb. Two negatives in this case will not create a positive. Instead, the Indian government should strive for more limited government and free enterprise. The majority of Indian industry has still not awoken to the miracles of IT. I hope the day is not far when an Indian techie is happy to be “on-site in Bihar”. This surge of economic growth is only possible through free trade, anything else is just slow poison.

Maven + Cargo + Tomcat = Auto-deployment

Posted in technical by dpillay on April 12, 2009

I’ve been using Maven as the build / dependency management tool for a project I’ve been working on. After tweaking the initial maven setup and finally getting all my dependencies in place, I had a nifty build system for my project.

As I kept working on the project, the frustration of having to build the webapp and deploy it to Tomcat manually was getting on my nerves. It was easy enough to build a small script that took my latest war snapshot and deployed it to Tomcat. This eased some of my pain but then I started wondering whether Maven had any plugin to do exactly this. And voila, I found two! Namely – the Tomcat Maven plugin and the Cargo plugin.

I first test drove the Tomcat Maven plugin not knowing that it actually deploys its own instance of Tomcat. This was not what I needed. My local Tomcat instance was tweaked to exactly how I wanted it and I didn’t want a new instance hence I just gave up. I’m sure I could have made changes to the embedded instance of the plugin but I just wasn’t in the mood.

That’s when I turned to Cargo. After going through their site a bit, I realized that it was exactly what I was searching for. But boy, was I in for a tough time. With all due credit to Cargo, their documentation is really bad. One shouldn’t document with the intent of just ‘covering’ a particular feature. The incomplete xml’s on the site were really annoying. I think they could learn a thing or two from the Spring community whose documentation is one of the most brilliant I have worked with. I know they are just starting out with the plugin but if they don’t document, people will just turn away.

My use case was simple. One of the modules in my project needed to be deployed to a ‘local’ instance of Tomcat and consequently I needed to launch Tomcat. Though Cargo seemed to be able to handle this, getting it to work properly took me through 10 odd articles and numerous pages of half baked documentation on the Cargo site.

Eventually though, I got it working which is exactly what I want to share here.

Lets start with the project structure:-

  • <project_ root>
    • pom.xml 1
    • <module1-core>
      • pom.xml 2
    • <module2-webapp>
      • pom.xml 3
    • <module3-deployer>
      • pom.xml 4

1 – This is the parent / root pom. It basically contains the fact that the project consists of 3 modules (basic maven terminology, nothing to do with Cargo yet)
2 – This pom contains the description and dependencies for the core service module. Again normal maven structure
3 – This pom contains the description and dependencies for the webapp module. This module depends on the core module.
4 – This pom is where our Cargo related details go which is the focus of this article.

Let me now begin to detail the module3-deploy’s pom.xml. First off, since we need to deploy the snapshot of module2-webapp, we need to add that as a dependency for moduel3-deploy. Dependencies form a core part of the maven system and are achieved using the <dependencies> tag detailed as below:-


Next come’s the <build> tag which contains the meat of the Cargo configuration:-

<!-- Configuration for the Maven build -->
	<!-- The plugins tag as mandated by maven -->
		<!-- Start's the plugin tag for Cargo! -->
			<!-- Cargo Group Id -->
			<!-- Cargo's Artifact Id -->
			<!-- This the most important part of the setup -->
					When Cargo starts the container, the following tag instructs it to
					wait for you to kill the session with Crtl-C
					The following tag details the container you want to
					deploy to.
						Specifying "tomcat6x" is very important! This one tripped me up
						for quite a while. The issue is that instead of being an
						identifier for you, "tomcat6x" is an identifier for Cargo that
						you want to deploy your webapp in Tomcat 6.x. I had initially
						thought otherwise and hence just dropped the 'x', making it
						"tomcat6", but that never worked.
						Type == Installed means that you want to deploy to a container
						that's installed on your computer
					<!-- The home folder for your local Tomcat -->
						This is another one that confused me for long. Its not enough to
						specify 'installed' in the container tag. You have to now specify
						another configuration with type == existing and re-issue the home
					Cargo has the notion of a 'deployer' in which you specify
					<!-- You have to again specify that the type for the deployer -->
						<!-- This deployable specifies the webapp you want to deploy -->
				Executions specify the targets that you want to run during build
					Maven has the concept of a 'phase' which can be thought of a
					collection of goals. Hence here we are specifying that during the
					'install' phase first deploy the webapp to the container specific
					folder and then start the container. Both 'deployer-deploy' and
					'start' are cargo specific goals.
					Specifying that during the 'pre-clean' phase, Cargo should first
					stop the container.

And that’s it! You can now issue a ‘mvn install’ from the project root which will deploy your latest webapp snaphot and start the container!

Cargo is still in the initial phases of its development but I’m sure more good things will come out. For one thing, the <wait> is an irritation. I haven’t been able to tell Cargo to fork the tomcat process and then return to the command prompt. Instead if you specify <wait>true</wait>, it loads tomcat as part of the maven process and expects a ‘Ctrl-C’ to get back to the prompt or if you specify wait as false, it just shuts down the maven process which in turn brings down the container.

Cargo’s Maven documentation keeps throwing an error when I try to access any of the tag’s documentation. Fortunately I found the same documentation over here.

You can get download the entire XML here.

Tagged with: , , , ,

A warning about Google

Posted in meta by dpillay on April 10, 2009

As many of you may know I have used the ‘dpillay’ google id for almost 3 odd years that is until one fine day Google decided to ‘disable’ my account. I have yet not been able to reactivate it and customer support has been abysmal. Research on the net shows me that there are scores of other users who have been afflicted by this seemingly ‘random’ problem. I am sure I did not violate their ToC in any way so it must be a bug.

The problem here is that Google apps are so intertwined that I lost in one shot – gmail (3 years of important emails and contacts), my blog at blogspot (, my orkut profile and worst of all 10GB of photos in Picasa which was space I actually paid for! FB and mass emailing seems to be the only way to let people know that I will not be posting on that blog anymore.

This isn’t even about depending too much on a ‘free lunch’ cause I was all the while happily thinking that buying space from Google would NOT let such things happen. But apparently, that does not count. This is the reason I switched to for email and have found the service simply fantastic.

Please take a backup of everything you have with Google as soon as possible.

Tagged with: ,

Switching homes

Posted in meta by dpillay on April 10, 2009

New blogging home, another crack at a ‘Hello, World!’ post.

I used to blog over at blogger, but after Google decided to ‘deactivate’ my account I needed to find a new home. I hope my relationship with turns out better.


Get every new post delivered to your Inbox.