Tuesday, June 07, 2011

Why buying a BMW is irresponsible and selfish?

I love the beauty and power of the BMW. But, I have never been able to justify owning one myself and here's why:
  1. It is a gas guzzler that is harmful to the climate and to all the societies that are exploited for energy.
  2. It is expensive. Buying one diverts valuable funds from the hundreds and thousands of charitable causes around the globe.
  3. Its powerful engine is wasted driving within the paltry speed limits of most roads and highways. A fuel efficient, inexpensive Honda or Toyota is good enough.
Oh, well. Selfishness is core to human nature. I'll just continue cursing every time I see a BMW owner.

Thursday, April 07, 2011

Sunday, January 09, 2011

Yahoo's amazing audio player

Yahoo has an amazing audio player that can be embedded into your website to support the playback of audio files linked on your site. This is an amazingly simple way to embed MP3 songs on your site without having to deal with any of your own javascript mess.

Click on the link or play button below to see the player in action:
SPB - Keladi Kanmani - Mannil Indha (Courtesy: TamilWire.com)

Thank you, Yahoo!

Ciao

Sunday, January 02, 2011

Eclipse Maven site issues

Following up on my previous posts about Maven, Eclipse on Tomcat, I ran into a a very interesting problem that I wanted to share with you so that you don't waste time like I did.


Running 'mvn site' from Eclipse does not generate reports


Problem

As I was getting ready to release my Maven project in Eclipse, I wanted to generate a project site with FAQs, javadoc and junit reports. So, I decided to use the standard 'mvn site' command.

I edited my pom following the instructions at http://maven.apache.org/plugins/maven-site-plugin/ and http://maven.apache.org/plugins/maven-javadoc-plugin/examples/selective-javadocs-report.html.

With my pom edited, I ran the mvn site command from Eclipse. The site was generated but it had no reports and no javadoc. I had no idea why this was and searched all over the Maven forums and Google but, had no luck.

I then decided to fall back to the reliable command-line and presto, the site generated with all the reports and javadoc. I came to the sudden realization that Maven may not have been configured properly in Eclipse.

Root Cause

I found that my Eclipse Maven installation was using the default embedded version of Maven which was at 3.0. And, the changes I had made in my pom were intended for Maven 2.2. Due to incompatibility issues, my Eclipse Maven was ignoring the reporting tags in my pom.

Solution

The solution was straighforward. I just had to go to Workbench -> Preferences -> Maven -> Installations and add the path to Maven 2.2 installed on my filesystem.



I hope the above information is helpful to you and saves you some time.

Ciao!

Friday, December 31, 2010

Maven, Eclipse and Tomcat

Following up on my previous post, I went through another frustrating experience trying to develop a webapp that was built using Maven and deployed into Tomcat through Eclipse.

The challenges I ran into were as follows:

  1. Tomcat 6.0 supports only Java 1.5 and Servlet 2.5. But, the Java and Dynmaic Web Module facets in Eclipse pick Java 1.6 and Servlet 3.0 by default.
  2. The Dynamic Web Module facet in Eclipse looks in a folder called WebContent for the web content whereas Maven maintains the web content in src/main/webapp.
  3. The Dynamic Web Module facet once applied to a project cannot be modified i.e, you cannot change from 3.0 to 2.5 after you discover that your Tomcat will not support Servlet 3.0.
  4. Eclipse does not provide a way to remove the Dynamic Web Module facet from your project.
Before I go into the steps for integrating a Maven webapp with Eclipse and Tomcat, let me first address the challenges of modifying or removing incorrect web facets.



How do I modify the Dynamic Web Module facet for my project ?

In Eclipse, if you try to remove the Dynamic Web Module facet, you will get an error saying "Dynamic Web Module 2.5 cannot be uninstalled". The only way to modify the facet is to first remove it and then reapply it. To learn how to remove it, read the next section.


How do I remove the Dynamic Web Module facet from my project ?

Step 1. Right-click on your project in Eclipse Package Explorer and select Close Project.
Step 2. Open a command-line terminal and go to your project folder.
Step 3. Open the .project file in a text editor and remove the following lines:
Step 4. Open the .classpath file and remove the following lines:
Step 5. Go into the .settings folder and delete the following files:
Step 6. Go back into Eclipse, right-click on your project and select Open Project Your project should now have all facets removed and should appear like a regular project.

What are the steps to integrate a Maven web archetype into Eclipse Tomcat ?

Step 1. I assume you already have a Maven web app in your Eclipse workspace. If not, here are some quick steps.

(i) In a command-line terminal, enter the following command:
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp

You can find out more about this command at Maven - Guide to Webapps

(ii) In Eclipse, select File -> Import ... -> Existing Maven Projects. You will be prompted to select the directory the project located on your filesystem. This should complete the Maven webapp creation in Eclipse.

Step 2. Select your project in Eclipse Package Explorer and select Properties.

Step 3. Select Project Facets in the Properties window and click on the "Convert to faceted form ..." link

Step 4. Select Java 1.5 from the list of facets.

Step 5. Select Dynamic Web Module 2.5 from the list of facets.

Step 6. Click on "Further configuration available..." link below the list of facets.

Step 7. In the Modify Faceted Project window that opens, change the value in the "Content directory" field to reflect maven's target folder.

Step 8. Click OK and OK.

Your project is now both a Maven project as well as an Eclipse Dynamic Web Module project.

If you want to deploy to the Tomcat instance that you setup in Eclipse, just right-click your project in Package Explorer and select Run -> Run on Server. You will be prompted to select your Tomcat instance and the application will be deployed.

If you need instructions on how to setup a Tomcat instance in Eclipse, refer my earlier post at Tomcat from within Eclipse.

If you want to deploy to an external Tomcat instance running outside of Eclipse, you can follow the instructions at How to create a Maven web app and deploy to Tomcat - fast

If you have any other questions, just drop a comment and I will get back to you.

Ciao!

Tomcat from within Eclipse

I just went through a very frustrating time trying to get a Tomcat instance configurable and usable from within Eclipse. As you will realize after going through this article, the Eclipse integration for Tomcat is a very confusing integration. The problem is that Eclipse has no single wizard or form to configure a Tomcat instance.

After an hour, I got my Eclipse and Tomcat integrated the way I wanted them to be. I am sharing some of the initial steps that I had to go through so that you can get a head-start with your Eclipse Tomcat integration.

Step 1. Download the binary distribution of tomcat from Tomcat 6.0.29

Step 2. Just unpack your download and you should be ready to go with Tomcat from the command-line.

Step 3. Launch Eclipse. ( I assume you are already using Eclipse. )

Step 4. Add the Tomcat server runtime environment to your Eclipse workbench.

(i) Click on Window -> Preferences


(ii) Select Server -> Runtime Environments from the preferences pane.

(iii) Click Add and select Apache Tomcat v6.0 from the list.


(iv) Click Next.

(v) Set the Tomcat installation path to the location in Step 2 above.


(vi) Click Finish.


Step 5. Create server instance.

(i) Click on Window -> Show View -> Other


(ii) Select Servers from the list of Views.


(iii) Click OK.

(iv) In the Server view, right-click and select New -> Server.


(v) Select Tomcat v6.0 Server from the list. Provide a name and select the runtime environment created in Step 4 above.


(vi) Click Finish

Step 6. Test your Tomcat instance.

(i) In the Server view, right-click the server that you just created in Step 5 above. Select Start.

(ii) Open the following URL in your browser: http://localhost:8080/.

(iii) You will get a "HTTP Status 404" error message and the title of the page will indicate the version of Tomcat. This should confirm that Tomcat has launched correctly.

Step 7. Configure the deploy path and ports for Tomcat.

(i) In the Server view, right-click the server that you just created in Step 5 above. Select Open.


(ii) In the server configuration view, you can modify the configuration as you wish.


HELP !!! 404 error when accessing http://localhost:8080/


The tomcat instance that we created in the steps above comes with a ROOT webapp that has no content. You may want to deploy a proper ROOT app with the default Tomcat welcome page that we are all familiar with. I like the welcome page because it gives me quick access to the release notes and Apache's online pages for Tomcat.

To get the welcome page, you must do the following :

(i) Click on the "Open launch configuration" link in the server configuration view (see Step 7 above). In the Edit Configuration window that appears, switch to the Arguments tab and view the location by examining the setting for catalina.base and wtp.deploy in the "VM arguments" field.


(ii) Start and stop your tomcat instance. Note: It is important that you do this step before proceeding to the next step because the wtp.deploy directory does not get created until you have started tomcat at least once.

(iii) From the command-line, you can copy the ROOT application from the tomcat installation (see Step 1 above) to the eclipse tomcat server instance (see Step 5 above).

$ cp -R ~/Apps/apache-tomcat-6.0.26/webapps/ROOT ~/workspace/personal_workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/

(iv) You should now be able to access the root app from http://localhost:8080/

HELP !!! How do I configure tomcat-users.xml ?


In the Package Explorer view of Eclipse, you will find a new project called "Servers". Expand the project and you will see the tomcat-users.xml file.



I hope you have saved yourself some time with the help of the above article. Happy coding!

Ciao

Tuesday, December 21, 2010

Don't be evil!

I am not a fan of large multi-billion dollar tech corporations but I am a fan of Google. Here's why:

1. Google tries to balance openness with business goals. While companies like Oracle, Facebook and @9913 control every bit (pun intended) of their ecosystem, Google is still a big proponent of open standards and open source technologies, and Android is probably the best example of this.

2. Google is driven by geeks and not marketing or business minded employees. There is no better example of a geeky employee than Andy Rubin who co-founded Android. Take a look at this tweet from Andy. Which VP of a tech company tweets a unix command ? Isn't that awesome ?

3. Google invests heavily in research both internally and externally and, research is very important for the betterment of humanity. While most tech companies focus on making pretty products for the middle class in the developed world, Google continues to focus on advancements in engineering. Google's self-driving car, research group, labs, scholar and green all drive towards the goal of moving the human race forward.

4. Google has the guts and the conviction to stop doing business in China, a country that doesn't give a hoot about human rights. While other tech companies like Microsoft, Facebook and @9913 continue to court China with the intention of expanding their business empires to its 1 billion population, Google has decided to stick to principles and pull out of China.

Don't be evil
Ciao

Friday, December 10, 2010

What happened to 'J2EE Application Servers on Desktops' ?

Here is an article I wrote a long time ago (11/2004 to be precise) about J2EE Application Servers on Desktops. It is 2010 and obviously my prediction hasn't come true. While I analyze what might have gone wrong with my prediction, here is the article for your perusal.

Nov, 2004
Summary
This article looks at several reasons that make it feasible and often desirable to use server-based software on desktops.

J2EE Application Servers on Desktops - Vijay Mariadassou

Last week, I was overjoyed to read about IBM's plans for Web-based desktop software. The software is part of IBM's Lotus Workplace strategy and is designed to be distributed and accessed through a Web server. The news reaffirmed my long-held belief that desktop applications will, in the not so distant future, be replaced by application server-based software. Server-based software has traditionally been confined to deployments on large enterprise servers. But, as I discuss below, there are several reasons that make it feasible and often desirable to use server-based software on desktops also.

Application Servers are feasible on Desktops

The primary reason for the absence of server-based software on desktops is the resource-intensive nature of server software, also known as middleware. Traditionally, middleware were designed and built to handle large numbers of transactions typical of large organizations with huge IT infrastructures. But, as Information Technology has permeated organizations of all sizes, middleware has evolved to fit into smaller infrastructure. Middleware based on J2EE and .Net are notable in this respect.

The latest breed of J2EE-based application servers like JBoss and Geronimo have highly modularized architectures based on the Java Management Extension (JMX) API that allow them to be deployed with variable sets of modules. Consequently, these servers may be deployed in resource-friendly configurations with minimal number of modules. For example, modules such as messaging (JMS) and transactions (JTS) may be removed without any adverse effects on the normal functioning of the application server. Such configurations make it possible for these servers to overcome any resource constraints.

Also, most modern application servers make use of some sort of resource caching to further optimize resource usage and performance.

Finally, the processing capacity of desktops has been steadily increasing. Thanks to Moore's Law, yesterday's servers are today's desktops. Modern desktops are now capable of handling the many CPU-intensive operations normally associated with application servers. And, the imminent arrival of 64-bit processors in the desktop market will go a long way in guaranteeing this capability.

Thus, it is my belief that application servers are feasible on desktops and concerns about their consumption of resources are unnecessary.

Application Servers are desirable on Desktops

Application server-based software is desirable for several reasons, which let us discuss below.But, before we go into the discussion, I wish to make a disclaimer. There will always be certain applications like games, music editing and animation software that are very sensitive to response times and will remain the domain of Desktop software. For such applications, Desktop software is preferable to middleware-based software because they are optimized for the operating system and the hardware hosting the software. For most other applications that are not as sensitive to response time, middleware-based software is desirable.

An important advantage of using middleware-based software on the desktop will be the reduced impact of viruses in the event of an attack. The devastation caused by the current wave of virus attacks and Internet worms is attributed primarily to the monoculture (read Windows) that exists on the desktop. The choices that both commercial as well as free J2EE application server vendors provide will bring diversity to the desktop and rid it of this monoculture.

In addition, middleware-based software are inherently more robust and secure than traditional Desktop software. Middleware vendors have invested millions of dollars in ensuring their middleware are scalable, reliable and secure for highly sensitive industries like the financial industry. And, software that operate within the secure environment of a middleware are likely to be less vulnerable to security attacks than those that operate out of this secure environment.

Another advantage of middleware based-software is the cost advantage it offers to the vendor and, consequently, to the user. Since there is no difference between a middleware platform deployed on a desktop and that deployed on a large Enterprise Server, vendors can move their existing Enterprise applications to the desktop at no extra cost. Vendors can also leverage the huge talent pool of J2EEdevelopers available in the Enterprise Application industry to build applications for the desktop. These developers do not have to be trained on the myriad Operating System APIs.

Finally, as users spend more time online, they will find it Web-based interfaces more natural to use than traditional desktop interfaces. A case in point is the growing popularity of services like Ofoto and Yahoo! Photos that are replacing the traditional photo albums on the desktop.

Over The Horizon

I see IBM’s recently announced plans as foreshadowing where we can expect to see the first breed of middleware-based desktop software emerging – the workplace. Workplace software is expected to benefit the most from the security and cost advantages of middleware-based software.


Ciao

Sunday, December 05, 2010

Boycott Amazon and PayPal

You probably have heard about WikiLeaks and the cowardice of Amazon and PayPal. If not, go to this link for details on the appalling cowardice of these corporations.

I am appalled at Amazon's lack of character. They succumbed to pressure from the political class and decided to drop WikiLeaks. I have been using Amazon for a long time now for buying everything from books to diapers and toys. But, after this latest incident, I have decided that it is not worth doing business with a company that cannot stand for freedom of speech.

I am going to boycott Amazon starting today. I have just removed all Amazon Associates widgets from my blog. I will be shopping for diapers at Costco or Walmart. I will be shopping for toys at Target or Toys R Us. I will be shopping for books at Borders and Barnes & Noble. I will be shopping for a Nook or Sony e-Reader. I will be switching to Google App Engine.

Also, starting today I have decided to stop using PayPal. I have just initiated the transfer of all my money out of my PayPal account and will be removing my bank account from PayPal once the transfer is complete.

Shame on you Amazon ! Shame on you PayPal !

P.S.: I am very proud of Google for standing up for freedom and pulling out of China. Go Google ! Go Android !

Friday, December 03, 2010

Write and read locks in Java

Here's a crude but very transparent way of doing the locking. Note the below code assumes that the implementer will ensure by design that there are NO concurrent writers but concurrent readers i.e., only a single thread will write but multiple threads could read.

int _readers = 0;
boolean _writeWaiting = false;

writeMethod() {

_writeWaiting = true;
boolean canWrite = false;

while (!canWrite) {

synchronized (lock) {

canWrite = _readers > 0 ? false : true;
if (canWrite) {
_writeWaiting = false;
writeToFile;
}
}
}
}

readMethod() {

while (_writeWaiting) {
sleep;
}

synchronized (lock) {
_readers++;
}

readFile;

synchronized (lock) {
_readers--;
}
}

The following code uses Java 1.5 APIs and is a lot more efficient than the above pseudocode. But, it is very opaque. If your JVM implementation has a bug ( and JVMs do have bugs ), the below code could be very tricky to validate and debug.

static ReentrantReadWriteLock _rwl = new ReentrantReadWriteLock();

writeMethod() {

rwl.writeLock().lock();
writeToFile();
rwl.writeLock().unlock();

}

readMethod() {

rwl.readLock().lock();
readFromFile();
rwl.readLock().unlock();

}

Update to post: Edit made on Jan 1, 2011 to clarify the beginning paragraph of this article.

Tuesday, November 16, 2010

Why I dropped off Facebook ?

Recently, I decided to drop off Facebook and deleted all my relationships on the site. Here are some of the reasons why I decided to get out of Facebook :

1. Facebook doesn't care for my privacy. They keep changing privacy settings and make it my (the user's) problem to go fix the settings. I have better things to do in life than deal with this crap. Take a look at how Facebook has been encroaching on your privacy http://www.eff.org/deeplinks/2010/04/facebook-timeline

2. Facebook is neither public nor private. It's somewhere in between and that makes me really nervous. Facebook's walled garden makes it private to the rest of the world but within the garden everything is public. http://techcrunch.com/2010/09/20/facebook-not-now-follow/

3. Facebook is like a big black hole. They don't let you export your contacts or posts; they make it almost impossible to move away from Facebook; they suck you into their hole.

4. Facebook doesn't give a hoot about your relationships. You treat your friends, colleagues, family and acquaintances all the same. But, in reality they are not the same. There are special people and not so special people. ( http://www.youtube.com/watch?v=nrlSkU0TFLs )

5. Facebook is boring. I am sorry to all my friends on Facebook but this huffingtonpost post sums it up http://www.huffingtonpost.com/andy-ostroy/i-hate-facebook_b_178867.html

6. Facebook is a monopolistic social information empire and, monopolies and empires are never good for society.

In conclusion, I am going to stay away from Facebook and stick to Twitter(public) and Email(private).

Ciao.

Update 1: What a coincidence that I wrote this blog on "National Unfriend Day".

Update 2: Debt collectors utilize Facebook to embarrass those who owe. Read more...

Update 3: Dec 1, 2010: Facebook's 'Like This' button is tracking you Whether you click it or not. Another reason to hate facebook.

Update 4: Jan 18, 2011: Another example of why Facebook can be dangerous to your privacy online. Man Mines Facebook For Security Questions, Nabs Nude Photos From Email

Update 5: Jan 18, 2011: Facebook has done it again; they don't give a sh** about your privacy. Third-party apps now have access to your address and phone number.

Wednesday, November 10, 2010

The Pain and Benefits of Critical Thinking and Drive

As is standard procedure in Corporate America, I had my annual performance review done by my manager. During the year, I had performed well on all fronts except on my relationships with some of my peers. I had done an excellent job of delivering business critical projects and managed a large, very successful team of engineers. But, my relations with some of my peers did not pan out well during the year.

My poor relations with my peers has been the only sore point during the year. I attribute this to my low tolerance for mediocre work and poorly designed engineering solutions. One of the key reasons for my success has been my ability to do quick critical analysis of business and engineering problems, work aggressively on solutions and drive them to a closure. But, this critical analysis and aggressiveness has cost me my relationships.

This coming year, I intend to take better care of my relationships. Critical thinking and drive is very important in the world's largest technology startup. But, these same qualities hurt people's feelings. No one likes to hear that their designs or implementations have flaws. No one likes to hear that they are not moving fast enough.

A colleague of mine (yes, I do have good relationships with some of my peers just not with everyone) has advised me to read The Power of Now: A Guide to Spiritual Enlightenment by Eckhart Tolle.

I hope to read the book during the holidays and will post a review here.

Ciao

Update 1: Dec 5, 2010: Boycott Amazon for dropping WikiLeaks and not standing up for freedom. Removed Amazon book information from my website and closed my Amazon Associates account.

Thursday, October 07, 2010

Social Enterprise for technical documentation

Documentation is an onerous task that very few engineers (read geeks) will willingly do. It requires discipline, patience and time to prepare readable and usable documents. Traditional use of documentation tools like a WIKI or CMS place constraints on the documenter to follow style and structure guidelines that may make sense to management but absolutely no sense to geeks.

A lot of technical documentation is often created and lost on whiteboards and cubicle shout-outs. Such documentation rarely gets captured on a traditional document site due to the constraints outlined above.

I propose using Twitter and Moblog in the enterprise as a facilitator for documentation. Most geeks today have smartphones and are comfortable writing short text messages and taking pictures or videos on their cellphones. Here's how I envision using Twitter and Moblog for documentation:
1. Whenever there is a whiteboarding session, the engineers take pictures and upload to the internal Moblog/Twitter site. And, when there is a shout-out they tweet their brains out and dump them onto an enterprise twitter site. Even better, they start the shout-out on Twitter.
2. People within the organization can start following the tweeters and mobloggers that they trust and rely upon.
3. We could even throw in some Facebook "Like" or Digg "Digg It" features for followers to rate the posts.
4. Based on the number of followers and ratings each engineer has, a professional documentation team could port the posts of the most followed engineers into a traditional documentation system.

The process outlined above can be extended to communicating project status and team huddles instead of emails in overflowing inboxes.

Here are some links to explore if you think this post makes sense..
Moblog:camera phone mobile blogging community
Yours truly on Twitter
List of Enterprise Microblogging Tools

Sunday, July 18, 2010

Why Droid X?

Here are some reasons why I like the Droid X :

  1. It runs Android

    • The best distro of embedded Linux and micro Java.

    • Open source - thousands of eyeballs can rip the code apart, find bugs, find security holes and criticize Google's implementation.

    • Open platform - I can run whatever the hell I want to run as long as it can be interpreted on the Dalvik VM.

    • Open marketplace - I can download from wherever I want and even setup my own marketplace.

    • Open development - I can develop in any language I want and use any IDE I want without selling my soul to some restrictive developer agreement.



  2. It is from Google, Motorola and Verizon bringing in the best from all these three companies.

    • High quality software from some of the best developers on the planet.

    • Superior hardware from an experienced and reliable hardware manufacturer.

    • Awesome service from the best carrier in the US.


  3. Super size screen that makes for a great reading and browsing experience.

  4. Excellent voice-enabled navigation software

  5. Great battery life


I am sure I am forgetting a lot of other nice features. But, the above are good enough reasons to like the Droid X.

My 80/20 efforts and, Google Code and Google Labs!

For a long time now, I have been trying to convince my management to implement an 80/20 work schedule where everyone would be forced to do something other than their day job for 20% of their time. Unfortunately, they don't seem to have the courage to implement it.

I have however gone ahead and implemented it with the teams that I manage. Unfortunately, enforcing the 80/20 and operating within an organization that believes in 120/-20 rule ( i.e. work overtime and regress your brain) is a difficult task. I am hoping that something spectacular will come out of the 20% time I have given my team and I will be able to use that to convince my management about the 80/20 rule.

In the meanwhile, all I can do is envy Google and ogle at its Google Code and Google Labs portfolios.

Monday, July 05, 2010

Saint Warrent Buffett and Saint Bill Gates

As many of you may already Warren Buffett and Bill Gates are the world's biggest philanthropists having already pledged a huge percentage of their personal wealths to charity. Buffett has pledged (download pdf version of his pledge here) more than 99% of his personal wealth. Now, they are trying to convince the other billionaires of the world to do their share of charity.
Buffet, Gates and Gates in the $600 Billion Challenge
Buffett and Gates are, in my opinion, the greatest saints of the mordern era and the greatest humanitarians of all time. To understand why their humanitarianism is so great, we need to just look at the scale of their charitable work and our own contributions to charity. Even though our personal income levels keep rising every year, the percentage of our charity does not go up proportionately. The percentage probably stays the same, if not drops lower. As you get richer, older and more comfortable, it gets harder to deprive yourself and give more.
Long live Buffett and Gates.