Technology

Tools of the trade : Java application management

We recently launched a new product at work and had to optimize a Java web application hosted in a JBoss application server for performance. The following tools came in rather handy to troubleshoot and analyze the application.

  • Java core dump memory analyzer from SAP. This tool is better than the standard run of the mill heap analyzers since it can handle larger core dumps. The tool is available here.
  • Messadmin : Session information tool by Cedrik Lime. This tool helps you to analyze the sessions on the application server in real time. We were able to install it on the application server without making any changes in our application, other than adding a couple of listners.. In essence, we copied the jar/war files to the application server and edited our application web.xml file to add the following listners
<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>/WEB-INF/applicationContext*.xml,classpath:applicationContext*.xml</param-value>
</context-param>
<filter>
	<!-- MessAdmin Servlet Filter -->
	<filter-name>MessAdminFilter</filter-name>
	<filter-class>clime.messadmin.filter.MessAdminFilter</filter-class>
</filter>
	<filter-mapping>
	<filter-name>MessAdminFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
	<!-- MessAdmin listener -->
	<listener-class>clime.messadmin.core.MessAdminListener</listener-class>
</listener>

HOW TO : Repair corrupted MYSQL Table

I recently came across a corrupted table in MySQL and was getting the following error, when I was trying to access a table.

“mysql ERROR 145 (HY000): Table ‘xxxxxxx’ is marked as crashed and should be repaired”

I repaired the table by

  • Log into the mysql client using “mysql”
  • Change to the required database by using “use DATABASE_NAME”
  • Repair the table by using “repair table TABLE_NAME”

Love the simplicity of MySQL :).

A case of reverse engineering

As I noted in my last post, I recently ran the Shamrock shuffle 8K. The official pictures for most of the races in US are taken by Marathonfoto. You can go to their website after the race, put in your Bib no and get a preview of the photos that can then be ordered from them. In previous years, I was happy with just taking the thumbnail of the picture and sharing it with my friends. Looks like the Marathonfoto folks decided to “beef” up their security this year and put a annoying “Proof” across the picture. When you log into the site, it shows a list of all the pictures they took of you.. the list looks like this

Clicking on any of the thumbnails brings up a popup looks like

Here’s what I did to get rid of the “Proof” text

  • Checked the page source of the popup and figured that it was a flash application. Clever way of obfuscating the link to the source image..
  • Knowing that the flash application would use generic HTTP connections in the background, I fired up “WireShark“, a traffic capture and analyzer tool, and clicked on the thumbnail again to fire up the popup.
  • An analysis of the traffic showed that the flash app was calling out a particular URL to get the image. Here’s a screenshot of the analysis by Wireshark.

  • Fire up a browser window and directly access the image with the URL from the traffic capture to get it without the “Proof” text :).. The original image looks like this.

Simple script to compare files in two directories..

Here’s a small script to compare the files in two different directories on a Linux machine. The script uses MD5 checksum to compare the files.

#\!/bin/bash
prefix1=“/usr/directory1″ # First directory without trailing /
prefix2=“/usr/directory2″ # Second directory without trailing /
find \-L “$prefix1″ \-type f \| while read filename; do
name=“${filename#$prefix1*}”
sum1=“$(md5sum \-b ”$prefix1$name“)”
sum2=“$(md5sum \-b ”$prefix2$name“)”
if \[ “${sum1% \*}” = “${sum2% \*}” \]; then
echo “ok: $prefix1$name”
else
echo “not ok: $prefix1$name”
fi
done

Internet in the air..

I wrote ~2 years ago, about accessing the Internet, while I was flying at 35,000 feet in the air. Since then, the company that provided this service, Connexion, has declared bankruptcy and everyone pretty much wrote off the market for in-air Internet access. Looks like enough people want it 🙂 and several companies are reentering this market. This article at news.com claims that most of the US air-carriers will have some kind of broadband service available in the next 2 years. Say goodbye to the last “Internet free” place on earth 🙂

Save XP!!

While, I am writing about couples smooching over each other!! :), my buddy Ray is writing something meaningful. As he states, Microsoft is planning on ending sales of Windows XP on June 30 2008. While Vista, has a lot of cool features, none of them are compelling for businesses to make the expensive migration. Not only does the new operating system require extensive planning for the migration and training for the tech support teams, but businesses also have to consider the expense of training end users because the interface has changed so much.

And not to mention the 100 different (I am exaggerating!! 🙂 ) flavors of Vista that Microsoft has come up with to make the decision even tougher.

Sign the petition here . [UPDATE : Link has been corrected.. Thx Ray for pointing this out.]