Thursday, May 10, 2007

Bluetooth Remote Control

I have been looking for a Bluetooth Remote Control application that can be used to control the media player from the mobile. I watch a lot of movies on my laptop and it is really a pain to pause and control volume using the keyboard. Earlier I found very few applications, specifically none in open source.

I found one good Remote Control in .NET by Jerome Laban although it is designed for the windows smartphone and did not work on my Pocket PC 2003. I also tried this one available in J2ME, but this is designed for Nokia and did not run on my phone's J2ME.

Recently I have seen quite some activity on these kind of projects. blurc and lbrc are open source projects for remote control of Linux. Bemused is another such project for controlling Media player from Symbian, also ported to J2ME. However, I am more interested in applications like Mobile Control Suite, which can control other applications like PowerPoint. It is really cool to show a slideshow using a remote control.

Finally the good news, I have also created an installer for the Remote Control in .NET which is a complete suite as well. Can't upload it using blogger, but I will contribute this back to Laban. Unfortunately Laban's code is not open source and I would really like an SDK that can be used to develop more plugins for other applications. Anyone interested in starting this open source ?

Saturday, January 06, 2007

Profiling tools for Java

When your web application developed some months ago, does not perform well or cannot support the number of users hammering at it, profiling is the way to go. Performance tuning is a difficult job and trying to solve it by looking at source code is like trying to throw sticks at a huge beast. So you choose the place to attack very carefully and thats what the profiling tools are designed for.

Till sometime back, the commercial ones like JProbe, OptimizeIt and JProfiler were the only tools of choice, and the open source tools were limited to taking snapshots of Java heap and then looking at the numbers. But now you can save a lot by utilizing open source tools, and some of them even offer features not available in commercial tools. Recently I happened to review the various tools available for profiling a Java web application, and I started out with this big list. I have always liked the complete lists of open sources available at manageability, but the absence of any comparisons makes it difficult to use.

First I shortened the list by cutting down the tools which did not have the following essential features -
  • Easy to install and configure
  • No modification to existing code
  • Profile server side applications
  • Decent documentation
  • Visual representation of statistics
  • Active development
  • Dynamic statistics, and not snapshots
You might be able to work with some of the following missing, but I really wanted a tool which wouldn't make our developers throw their hands in frustration :) So this limited the choice to a handful which were reviewed.

ToolFeaturesLimitations
Glassbox
  • No configuration required
  • Shows possible problem in the code, not statistics
  • Understands web frameworks like Struts
  • Does not show possible memory leaks
Jmemprof
  • Shows detailed memory statistics by class and method
  • Runs very slowly with Sun JDK
  • No visualizations
  • GUI only shows statistics not clickable call graphs
  • No CPU statistics
GCSpy
  • Shows various generations of objects
  • Requires conceptual understanding of GC
  • Does not show statistics or visualization at source code level
Eclipse Profiler
  • No configuration required
  • Shows graphs of memory
  • CPU statistics available to a good detail
  • Memory profiling limited to showing heap memory usage
InfraRED
  • Shows bottlenecks in the code
  • Analyzes the application as layers and allows drill down to expensive pieces like views and queries
  • No visualizations
  • Does not profile memory
EJP
  • Simple to use
  • Ability to drill down within functions with timing
  • No support for memory profiling
  • No visualizations
  • Limited number of users
  • Does not seem to be under active development
Netbeans Profiler
  • Very nice visualizations
  • Profiling of memory as well as CPU
  • Step by step documentation with screenshots
  • Works with NetBeans IDE only
Eclipse TPT Platform
  • Profiling of memory as well as CPU
  • Supports many servers
  • Good documentation
  • Better visualizations are needed
jvmstat
  • Shows sizes of various generations of objects
  • Monitors garbage collection activity
  • Requires understanding of garbage collector
  • Runs on J2SE 5.0 only
  • Not for detailed profiling at classes/method level


The recommended tools for profiling are Eclipse TPT (Testing and Performance Tuning) Platform and Netbeans Profiler. Both these tools come close to commercial tools by providing features like memory and CPU profiling both, professional interfaces for drilling down to the problems, visualizations and helpful tutorials. jvmstat is the recommended tool for performance tuning of the JVM.

Glassbox and InfraRED are great tools during application development since they pinpoint possible issues without any code on part of the developer and can point performance problems before the code reaches the QA.

Tuesday, July 25, 2006

Agile development

For a long time, I have been wanting to write a blog on development methodologies, but haven't done so because I usually write the blog when I am satisfied with my survey of all the recent developments in that area. But methodologies are endless research so here is a brief overview of Agile which will be updated soon.

A brief overview first. Strictly speaking, Agile methods are not a methodology but a philosophy for modern application development. So there are specific methodologies like XP, Scrum, Crystal, Lean Development (from the Google article) which belong to the Agile class. It is absolutely true that most of our development happens that way and we should use Agile philosophy. As for RUP, it is a broad set of practices like use cases, iterations, documentation. Hence really speaking, RUP is a framework that can be fitted with many methodologies. For example, RUP can be used with XP (incidentally called dX - XP turned round on its head :)

When it comes to choosing a methodology, it is easy to fall into the trap of mix-and-match. For example, many organizations claim to follow a variation of XP, but all they are doing is - following the part of XP which says developers may not question the requirements, but conveniently forgetting that XP strictly specifies that only developers may give the estimates for the work. For the same reason, if we are to really follow Agile, we need to watch for conflicts. Agile clearly says that it is heavily dependent on people rather than just process-oriented. So it does not think of people as resources but as individuals, each of which has its own strengths and weaknesses and it is no longer possible to think of developers as pluggable units. It also changes the process itself if people want that.

I have also studied a bit on outsourcing using Agile methods. There are some big differences. First of all, usual Agile does not rely much on documentation but on close proximity between technical and business people. In outsourcing scenarios, this needs to be handled by more documentation. Practitioners believe that the amount of documentation should be "just enough", although this is determined only by experimentation across several projects. Secondly constant visits from both sides are necessary. Third is that business requirements should be written down at the client side and then test scenarios be written at the outsourcing side. Most important is that continous integration systems be in place, so that nightly builds can be taken any time the customer wants to see the current situation. I also believe that Agile methods have certain weaknesses, like lack of an integrated architecture, which can be well addressed by the software architecture artifact from RUP.

My views are influenced by Martin Fowler (universally heralded for design patterns), Alastair Cockburn (of Crystal fame), XP proponets, RUP website and others. Some interesting links for further reading -

1. Misuse of Iterations
2. Various articles on methodologies by Martin Fowler
3. Internationally Agile
4. The new XP

Saturday, July 22, 2006

Mp3 tagging through music fingerprints

I have a collection of few thousand mp3 files with unmeaningful names and tags. Sometimes I do try to rename the tags and filenames using iTunes, Windows Media Player or other editors but its just too huge a task to be completed, more so because the collection is increasing all the time. There is a huge number of tools for fixing, ranging from tools which can edit the tags, to tools which can write the tags using filenames. While learning Python, I wrote a small code to beautify the names, extending which is a Someday task in my GTD list :)

It is too difficult to edit tags using iTunes, even with the functionality of editing multiple files simultaneously. I found this great open source tool Mp3 book helper, which uses the good trick of exporting/importing tags and filenames to CSV files. It is much easier to edit the CSV files using Microsoft Excel, specially because of Macros and functions and then import the corrected file.

However, often the filename and the tags are completely incorrect making it impossible to correct it without listening. I have always wondered if there could be a way to digitize the music patterns and look the tags into a database of music patterns. Today I was searching if there has been some work on it, and found to my suprise that there are many such systems already implemented.

MusicBrainz is such a community which has such a database of music fingerprints and tags. It provides a freely downloadable tool called Picard that can search and correct the tags of your files by sending music fingerprints to MusicBrainz server, although highly manual and not automated. It uses music fingerprinting technology supplied by MusicDNS, which has a database and client side APIs for collecting music fingerprints of various audio files and searching the database. The use of this API is completely free for non commercial purposes. A real act of benevolence I would say, attempting to bring some sort of an order into the huge amount of audio information !

Looks like it can be classified as a Web 2.0 application...the elements are there all right. The database is unique and is constantly improved by users contributing music fingerprints and tags. Programming model is there too, only thing missing is a nifty user interface. It would be nice to write a service which constantly monitors your collection and automatically tags your files by running the MusicDNS api.

Tuesday, July 18, 2006

Web 2.0

Every client wants to enable Web 2.0 for their applications, and like Paul Graham, I initially disliked the term so much that upon its mention I used to immediately launch into a lengthy marketing talk about user experience, AJAX, collaboration and the semantic web. No wonder the term has been called marketing slogan and even amoral. Looks like there are still some folks out there in software who believe in honesty ! :)

Finally I decided that enough was enough and at least I need to try to appreciate it from a business perspective if not technical.

The term was popularized by O'Reilly Media and MediaLive International for a conference they hosted, the first Web 2.0 Conference in October 2004. Later on, an article on oreilly.net clarified the meaning in detail. This article tries to differentiate between Web 2.0 applications like Wikipedia, Blogs, Google Adsense, Flickr and their Web 1.0 counterparts like Britannica Online, Websites, DoubleClick and Ofoto, and uses the differences to come up with Web 2.0 principles -
  1. Web as a platform - Software is provided as a scalable service. Examples are Google Search, Adsense, BitTorrent
  2. Harnessing collective intelligence - Users are trusted to contribute to the collective material. Examples are Wikipedia, Amazon reviews, Flickr tagging, Blogs
  3. Data as central - Application relies on a unique, hard to recreate repository of information that becomes more valuable as more users use it. Examples are Amazon, Imdb
  4. Lightweight programming models - Programming models allow use of various platforms and integrate easily to form innovative applications. AJAX, REST web services, RSS are key components in this. Mashup is a good example of these put to work.
  5. Software above the level of a single device - Devices can utilize the web to perform useful services. iTunes and TiVo are good examples.
  6. Rich user experience - Gmail, Flickr
Dion Hinchcliffe examines the current state of Web 2.0 with a brave attempt at architecture of the web using people, machines and technologies. In a seperate article, he also lists the applications best qualified to be called Web 2.0.

After all that reading, I think I have at least a handle on the new web. I can't get rid of the feeling that technically, nothing has changed. AJAX means that now we can use Javascript safely and can get away with supporting a few browsers :) RSS has also been around for long. Web services have been there for a long time as well as as P2P. One thing that has really changed is the convergence of devices.

However, it is definitely true that these technologies are being combined in ingenious ways to create new applications that allow users to access relevant information and collaborate more effectively. And if you would like to call it the emergence of Web 2.0 and it makes business sense, I am fine with that !

Thursday, April 13, 2006

Javascript glorified

Ever since Google brought back Javascript into fashion with Gmail, Google Suggest, Google Earth and My Google, everyone is swearing by AJAX. Even Microsoft has followed suit with Windows Live and MSN Virtual Earth. Someone at google saw beyond all the bad publicity of Javascript, although gurus like Douglas Crockford have known its power for long.

Inspite of its design flaws, Javascript is a very innovative programming language with the syntax of C and Java and the power of Scheme and Python.

1. Javascript treats functions as first class objects, they may be passed to a function, be a member of an object, put inside a hashtable. They can even have arbitrary number of arguments and can also contain other functions.

2. Javscript objects are dynamic. Its possible to add members and functions at runtime because the objects are essentially a collection of name value pairs.

3. Javascript can be used for inheritance and private members. Inheritance is implemented through the inherits function and private members through closures. Closure means that an inner function has access to variables and parameters of the outer function.

4. Functional programming in javascript is possible through currying, the technique of passing one function to another as argument. It also supports recursion.

Javscript had been long renegated to the level of a toy language only suitable for showing annoying popups. With the modern browsers increasingly supporting the ECMAScript standard, and the support for XmlHttp object, it has emerged as a great way to build cross browser interactive applications.

There are a large number of AJAX frameworks in almost every language used for web applications. These frameworks provide server side controls and Javascript libraries for easing the task of building AJAX based applications. There are also some great Javascript toolkits like Dojo, MochiKit, Prototype/Scriptaculous and the Yahoo! UI Library. Google Web Toolkit is another toolkit which takes the novel approach of generating Javascript code from Java source written using the libraries provided.

Open source AJAX Frameworks in .NET
  • MagicAJAX.NET - Handles AJAX calls like postbacks and needs very little code.
  • ATLAS - The official framework developed by Microsoft. Contains javascript libraries for UI components, AJAX calls and cross browser support.
  • AJAX.Net

Here is a nice comparison of many frameworks.

Open source AJAX Frameworks in Java

Of course there are many more.

AJAX Frameworks in PHP

Ruby on Rails also has an AJAX extension.

As pointed out by Kinshuk, Javascript needs to be treated with respect as far as debugging is concerned because of its dynamic nature and loose typing. There are some tools available for this like JSLint (you can think of it as checkstyle for Javscript), apart from Microsoft Script Debugger for IE and Venkman for Mozilla. Frameworks for logging and unit testing are already there. Maybe its time for an exclusive IDE for javascript.

Saturday, February 18, 2006

Stress free productivity

As David Allen describes in Getting Things Done, like most people I feel frustrated and bogged down by the great number of things that are on my mind. While working on an important project, the mind keeps reminding that your investment decisions are overdue, there is an important social event to attend, you need to make that important decision and so on.

The book makes for interesting reading, but I have summarize the tricks in a short algorithm that would be easier to remember.

  • Make a list of the projects you currently have. Everything that requires two or more actionable items should be considered a project. Highlight the very next physical action required to move the project forward.
  • Normally, you would have 50 to 100 projects. Divide the projects into several categories and group these into areas of responsibilities like Finance, Health etc. This way you can also track the time spent on various areas.
  • Make folders for each of the projects that contains reference material and other documents regarding the project.
  • Mark all your incoming stuff, ideas, things to do into following folders.

a) Trash - No action required and not needed in future

b) Reference - No action required but may be needed as reference

c) Someday - No action required recently but in distant future

d) Followup - Action to be taken by someone else

e) Calendar - Scheduled at a particular time

f) Projects - Is a next action on some project

  • Your calendar should be sacred and should contain only those items that must absolutely be done on that date or you do not need to do it at all. Moving tasks in the calendar to another day should not be done as far as possible.
  • Start your day by looking at your calendar and tackle the items. When you find free time between the items on your calendar, look at your projects list and select a next action depending on the time you have available.
  • Do a weekly review of your projects and next actions. Spend some time on the maintenance of your system.
You can buy this Outlook plugin which helps implementing the methods.