Thursday, September 13, 2012

On Cross platform development

I have been looking at suitable platforms for cross-platform application development. While there are many such available, including Java, I was more interested in a write-once-compile-anywhere kind of platform. Since I have kept in touch with most of these stuff over the last 8years, I narrowed the list to two specific platforms
1. wxWidgets/C++
2. Lazarus/Object Pascal.

I could have used wxPython but I needed a compiled app rather than a scripted/virtual machine based app. The reason is that the application was likely to be closed source/proprietary till it made sense to open source it. This ruled out Java and Mono/.net since decompilation was fairly trivial.

In terms of elegance, of all the programming languages I have learnt I consider the worst to be BASIC and the second worst to be COBOL. But the language I really like for its elegance has been Pascal. I still remember writing a simple console-based banking/financial application in my second year of engineering in less than a day. The application even had those command line menu kind of interface (using Turbo Pascal) and the entire code (as far as I remember) was less than 2000 lines of code. For those guys who do not believe it could be possible, well you should visit Mike Wiering wrote a Mario clone for the PC which became quite famous. The entire compiled code with 256color VGA at 320x200 was less than 256kBytes.

During my final year, at one time I even contemplated using Delphi as my primary RAD platform. But then I shifted over to working with embedded systems. got into an MS and then PhD program during which time I started working on speech/signal processing. I wanted to program a cross-platform speech/voice source analysis application to go along with my electroglottograph (

I have been following Lazarus since the 0.9.1 version (2004), and the 1.0 version was released last month. It seems to have become quite stable and a number of applications have been developed using it. However I had not coded in Pascal since 2002 and so I decided programming simultaneously in both, till I found one faster to code than the other. Strangely it took me just a glance at couple of Pascal programs for me to recollect the syntax. One of the features of Freepascal which Lazarus uses is that I can use C libraries as units in my pascal code. Since I am more comfortable coding in C/C++ especially for signal processing related applications this is a very useful feature.

So at this stage I am stuck between deciding on the two. Hopefully I may not have to. Both can co-exist for different sets of applications. Anyway I think the following criteria will finally help me decide
1. Stability
2. Ease of use
3. Speed of development
4. Available libraries

Tuesday, August 28, 2012

My alternative to the Apple's bounceback patent.

I am posting it here before someone at Apple patents it. I call it the page stretch. The behaviour is similar to that obtained using a piece of latex with printed text. If you fix it to one end and pull at any particular place the resultant behaviour is what the page stretch effect would look like. 

Assume that the list/screen is made of latex, scrolling down when we are at the top of the page stretches the content from the top of the screen till the location of the finger. This can be uniform stretching along the x-axis or non uniform stretching with the maximum stretching taking place at the coordinates of the finger. Aternatively the stretching can be uniform with more stretching on the top of the screen. I am not very good at doing illustrations, but a crude mockup is shown below:

Original List

Uniform Stretched List

Non Uniform Stetched List
Similarily the page contents can stretch when the bottom of the page is reached. 

Sunday, July 8, 2012

Since the beginning of times, humanity with its ingenuity and its inventions and discoveries has never managed to improve the world we live in. We know more of the world and its history and yet we never learn.

Sunday, September 25, 2011

The Human Halting Problem

If we ever are proud of the discoveries and inventions of mankind then we have to also be humbled that there are many things we cannot and never will be able to understand with our pitiful mind inspite of all that it can achieve.

Thursday, August 11, 2011

Corruption of components in JScrollPane

I wasted over two hours trying to figure out the corruption of any component that I add to a JScrollPane whose size is a bit large (Depends on your screen resolution). The default scrollmode (BLIT_SCROLL_MODE) is the culprit here. Changing the scrollmode to a double buffering (BACKINGSTORE_SCROLL_MODE) one seems to fix the problem.

Wednesday, February 23, 2011

A personal review/opinion on "Learning Java"

I really have no idea what to title this post. During 2002-2003, I made an attempt to learn Java and so I bought a book titled Sams Teach Yourself Java 2 in 21 Days. I gave up after coming across the Jabberwocky example. While it was one of the worst books in my opinion to learn Java from, I personally had a grouse against Java. It was slow, buggy, primarily advertised for applet development and in my opinion too hyped up. And applets those days would bring my computer to a crawl. I preferred C/C++ any day over it. And then I moved on to learning some Python. While pursuing my Master's program in the area of Speech signal processing during 2004-2007, MATLAB became my primary "Programming Language" while occassionally dabbling in C++ and Python. Somehow I never experience the same joy while using MATLAB as I would in C/C++/Python. Fast forward to few months back; I never understood why Java was the primary language on Android. I wouldn't if I was not forced to start learning it to handle some project commitments. And this time I used the book Learning Java from O'Reilly publishers. Surprisingly, I actually enjoyed reading the book as well as coding in Java. The authors Patrick Niemeyer and Jonathan Knudsen have done a very good job of keeping mundane things out and focusing on covering what is important for a programmer/developer. For a change I actually like Java now (cause the hype has sufficiently died down) though not as much as I would Python.

Wednesday, January 12, 2011

On Falsifying History

I have come across an excellent example of how to cook up history so that people can be easily fooled. A classic example is the spreading of the purported "Lord Macaulay's address to the English parliament 2 February, 1835" which states

"I have traveled across the length and breadth of India and I have not seen one person who is a beggar, who is a thief. Such wealth I have seen in this country, such high moral values, people of such calibre, that I do not think we would ever conquer this country, unless we break the very backbone of this nation, which is her spiritual and cultural heritage, and, therefore, I propose that we replace her old and ancient education system, her culture, for if the Indians think that all that is foreign and English is good and greater than their own, they will lose their self-esteem, their native self-culture and they will become what we want them, a truly dominated nation."

From the style of writing ( or speaking) it is quite evident that whoever cooked up this article was not of the 19th century. It is crucial to be aware of one's history, to know who and what we are so as to not repeat the mistakes of our ancestors. But to cloud it and cover it up with lies is the most vilest thing a person can do. To not know our history is to be blind. And a person who obfuscates history through whatever means is as guilty as a man who has destroyed a person's sight. "Without vision people cast of restraint". How will one know to see the present without having a proper insight into the past; both the good and the bad?

India did have at some point or the other a rich cultural and social heritage. But centuries of cultural decadence and social inequality resulted in it being ripe for conquering by other nations. The heralded ancient discoveries which were found by proper scientific processes were over centuries wrapped in mystery, till at last they became statements without proofs. Rivals in various fields were disposed of easily so as to preserve one's own importance. India was a country divided and this still continues to this day. We find the pettiest of reasons to want to feel different from others to such an extent that we condemn and look down people who are not the same as we are. Unless such madness stops, I care not for any history which covers up the main problem with the country today.

One may accuse the English for their "Divide and Conquer" policy. India was already a country divided; the English just exploited the conditions to their advantage. As do now the politicians who have replaced them. We were able to get rid of the English through a persistent and non violent means. How then do we get rid of most of the elected/ruling class that continues to exploit fault lines for their own benefits. It is so easy to blame the English for the problems afflicting our country. But the only way for our nation to move ahead is to deal with the intrinsic factors rather than cooked up extrinsic ones.