Thursday, December 25, 2008

Happy (Internet free) Christmas!

Merry Christmas wishes to one and all!

In other news, the partial Internet free days make me ponder on reliant we have become on these series of 'tubes' that send and receive data from various servers. This brings in light of the hassles that you may face when you become fully attached to online applications.

My e-mail provider provides LDAP and is online-only. You have a plethora of online-apps that provide basic word-processing, do your taxes, view pictures and store presentations etc. If you have the cable cut, you loose access to everything.

Telephone and credit card companies are urging their users to move online, to receive bills and statement alerts via e-mail rather than the traditional mail in the pretext of accessibility and saving the environment. I'm not against saving the environment, but most of us are moving towards a system where there is only one way to get informed about the various activities in life and if this one way gets disrupted, I wonder what would happen as it would take days or months to get back to the regular, good old reliable snail mail.

PS: Save your stamp collection. Some day, it would fetch million$!

Sunday, November 30, 2008

SMS SPAM filtering?

Been there, done that. That's what you would hear if you are talking about SPAM filters for your e-mail. The other new area that I am constantly getting irritated about is the mobile SMS SPAM that make their way into my cell phone.

One way or the others, we inadvertently give away our mobile phone nos to the various dealers who pass on the same to bulk SMS generators. They in turn make it a point to enlighten you of the various offers that you should be thankful to spend your money on! Thank God I am not charged for incoming messages!

I know most providers like banks or the telecos provide a Do Not Call registry usually hidden away in the small-print. They abide by your request, but it is the other sources where you are forced to give away our number from where the main problem arises.

One thing that I noticed that most mobile phone lack is an active SPAM filter for your mobile phones that can scan your incoming SMSes and over a course of time, learn from you, on what you regard as SPAM and what are valid message. This algorithm of scanning the frequency of words that makeup an SMS and classifying them based on your inputs as one of 'possible SPAM', neutral or 'likely a valid SMS' is called the Bayesian SPAM filtering.

Looking at the Java MIDP API, I could not find any way by which I can intercept or takeover the built-in SMS application. However, from the forums, the friendly folks at Nokia informed that it might be possible using the C++ SDK.

So, my next possible app would be to try on the feat before which there might be a few simple applications to hone my skills on the S60 API. Check out the source forge project mymobiletools shortly for simple apps that might enhance your experience with your mobile.

Saturday, November 22, 2008

Design Patterns: The art of making TV serials or masala movies

After being tortured to sit through one too many series of never ending serials, here are a few rules or patterns that I had observed:

Design patterns on serials or movies
  • The-Not-Good-as-it-seems Pattern: If it is too good to be true, it is a dream and in real-world, it will happen exactly the opposite
  • The-One-is-not-enough Pattern: One of the primary character will have two wives and will struggle between the two (or more?).
  • Medical-Miracle Pattern: Someone will get amnesia and later will be always be cured.
  • Double-Trouble Pattern: If twins are born, they will get separated to meet again 20 years later. Of-course, there will be scope for impersonation.
  • The-Cryptic-Prophet Pattern: Swamijis, gypsies, sadhus will usually be able to give cryptic clues on what is about to happen next
  • The-Cycle-of-Life Pattern: If a primary actor's family is portrayed as being very rich, chances are they will become poor. Conversely, the family opposing the hero / heroin will have the lifestyle opposite to them.
The art of extending airtime
  • The-Matrix-Bullet-Time Pattern: When the situation becomes tense, you get into slow-motion mode with background accompaniment *after* every statement / action made by the actors.
  • Manic-Mondays Pattern: Friday (for serials that are aired on weekdays) sessions will usually be a cliffhanger, ending just before a pretty tense moment which will usually fizzle out on Mondays.
  • Bored-With-the-Existing-Faces Pattern: When things become too dull, introduce a new set of characters and follow a side storyline
  • The-Forget-Me-Not Pattern: On long running soaps, introduce a recap session that compresses all major moments that had happened earlier which the actor will ruminate
Now a days, a lot of reality shows have made it into our TV channels. Here are a few patters that I have observed here:
  • The-Blunt-in-Your-Face Pattern: The judges make it an effort to be rude while pointing out the participants faults, with closeups of both the judges as well as the participants at the recieving end with again, background accompaniments.
  • The-Let's-Cry-Together Pattern: When a participant or pair is bumped out of the contest, you should watch the emotional drama. The relatives and friends of the bumped out participants hurling verbal assaults towards judges and the judges themselves get into an emotional state deciding to quit and all others wooing them to come back. This is something that you should not miss . OK, OK, I was kidding about the last statement!
  • You-Have-Yet-Another-Chance Pattern: When the participants are dropping off the chart like flies after you switch on the repellent, the organizer will decide to pardon the non-performers and continue to the next session.

CD-less Car Audio Systems

The new Honday City comes with an audio player that takes your portable player, collections of memory or USB sticks. Though a good option that gives flexibility allowing you to carry your music and listen to all of them, the minus point is, they now lack a CD player.

I see this as a disadvantage. Guess where I will play a newly purchased CD? In my car, on my way back home! The same goes for CDs purchased during a long trip. I might not have my laptop handy to rip and transfer songs on the go.

The music download scenario currently in India is not good either. Amazon and iTunes do not offer song downloads here. So, purchasing online music which is likely to happen during your home or office are not it atleast in India.

With these audio system, I will have to hold on until I reach home, rip the songs, copy them to my USB stick and only then, I will be able to listen to them in my car. Though most cars offer to add a CD as an option, for the cost, I feel this should be standard.

Wednesday, November 19, 2008

The Age of the Hybrid?

Honda recently offered a slash in their new Civic Hybrid model. Though not all are sure if it was a publicity move or an inventory clearing sale, I believe with good mileage figures and a growing concern on how green everyone should be, hybrid cars will see an increase in prominence in the Indian roads.

The Indian market is price sensitive. Be it an industrialist who is buying a Rolls Royce or a car enthusiast pining for a BMW, the inevitable question remains: "What is the mileage?". This has led to a slew of Diesel cars in the market . Though economic to us, it still fails against the 'green' parameter.

The other competitor to hybrids are the all-electric vehicles which may be termed greener (assuming that the cost of production, battery is far less harmful than the actual emissions), they lack in range, ability to quickly recharge (which seems to be a 5 minute affair for it's counterparts) and the lack of accessible recharge locations (do you think at the current electricity cuts).

The hybrid vehicles usually offer dual modes which combines the benefit of being green (to an extent), offer great mileage along with the ability to refuel using popular modes quickly. Maruti and Hyundai have already started offering a less greener dual option: CNG and petrol to the consumer which guarantees fewer paise / km.

So, hybrids, though being more expensive caters to all the other needs. The government can, to encourage this, offer to reduce the import duty for such cars as, in general, they help the environment much better than the other vehicles on the read.

So Toyota... are you listening?

Sunday, November 09, 2008

Dynamic Math Question Paper

If you have kids who are into schooling, now would be the time when you are revising their knowledge for the upcoming mid-term and half-yearly exams.

A good way to check up on your kid's (and your) math skills is to setup up a question paper. Unfortunately, kids have good memory power that you can't reuse the same maths question paper. Otherwise, you would see them breeze through the QP as they tend to 'remember' most of the answers.

The alternative is to have multiple QPs. But that is a pain and I had been thinking of coming up with a simple script or software (TeX) to generate the QP dynamically.

The final solution was much simpler. Use Excel or Open-office Calc (in my case) to dynamically generate the question paper. The key is, for each of the question, have a bunch of random numbers (to your specifications) generated so that you can construct the parts required for your sum and generate multiple versions of the question paper by recalculating the workbook.

Friday, November 07, 2008

A bookshelf in your palm

With the advent of e-books, software readers, hand-held devices and the Project Gutenberg, you literally have access to more than a book shelf.

A good e-book reader for your mobile when you are standard at some place with nothing to do is Mobipocket reader. It comes along with a good PC based e-book creator that can take simple HTML or .txt files and convert into a format usable from a mobile device.

With the text files combined with Emacs and a few regexps, I was able to convert most of the files to readable html files in a few minutes and feed them back to the e-book format converter for hours of readable entertainment.

So, my current bookshelf contains:

  • Arabian Nights
  • Robinson Crusoe by Defoe Daniel
  • The Devil's Dictionary by Ambrose Bierce
  • Dracula by Bram Stoker
With these books with me, who would mind waiting on a long queue?

Sunday, October 19, 2008

The portable game framework

Ever since I had seen GCompris, a children activity application, I always wanted to add modules that caters to the need of getting my son to learn while he plays games. GCompris supports a python interface for rapid board development. But one quip that I had was, GCompris is a Linux only application (though they have a commercial win32 port). Now, if I can find a framework that works both on the Linux as well as the windows platform, it would make great sense. Gcompris as of now only will restrict schools to the Linux OS (which is good, but most schools would probably be using Windows and getting them to change would prove difficult) would be good.

An alternative framework would be Java with it's great 2D API (no fancy 3D here to confuse the kids). Others would by SDL with C/C++ or pygame (which I read has performance issues on the windows front. Read childsplay). A new contender that I noticed was the Mono framework which sports a 2D API identical to the DotNet framework.

My immediate course of action would be to write a few python modules based on GCompris and see if I would be migrate it to another framewor later as GCompris currently has the framework where as mine is still vapoware. Plus, it also has good i18n capabilities with a library of digitized voice samples where a build-from-scratch approach would require a lot of work.

Sunday, October 12, 2008

WiFi atlast

After numerous hours of tweaking, I resolved the problem with my WG311v3 NetGear PCI card. The problem? The router was too far away!

Now that I am online using my Linux box, here are a few screen-shots of my desktop!



The next time your supported WiFi card acts up, you know what to do...

For those inquisitive lot, I am currently using the XP drivers with ndiswrapper.

Saturday, October 11, 2008

Look around you...

Most people think that they need to be at the right place and at the right time to get a great picture. I say, all it takes is patience and the ability to see differently. While exploring the place nearby, here is what I managed to click, all within a radius of 10 meters from the front door...




For more, visit my picasa page.

Friday, October 03, 2008

Whois[she|he]

One of my favorite ploy to those who newly joined my previous company was to give them a command line application and ask them to find out how it worked. This magic command line tool happens to guess your gender if you give your name.

char lastc = argv[1][strlen(argv[1])-1];

printf("%s is a %s\n", argv[1], (lastc == 'a' || lastc == 'i') ? "She" : "He");

Basically, it checks to see if your name ends with an 'a' or an 'i' and if it does, assumes that the person is a lady. Chances are, 95% of most Indian names fall into this category and this simple app seems to do magic.

Most were able to (after a few tries) guess the grand algorithm, but a few poor souls could not, which eventually leads to step number 2.

Step #2 is, as they were unable to decipher the algorithm, I said that I will provide with two separate command line apps called whoisshe and whoishe. I also mentioned that as I had not done the validation part properly, to please provide only men's name to whoishe and a ladies name to whoisshe. If they provide the wrong name, the results could be wrong as well. The code for whoisshe is as follows:

printf("%s is a she\n", argv[1]);

And appropriately modified for whoishe.

The aim is to see how long our new joinee continues to test these tools... Wicked!

Hardy Heron - Linux getting better!

A few months back, I had requested Canonical to dispatch me (they still do it for free!) a CD of Ubuntu Linux 8.04 LTS (hardy heron). I was still running an older version of the same distro for quite some time and this was an opportunity to change. I had installed the newer OS and these are a few observations:
  • Display is much better, with my ancient VIA chip-set getting recognized with 3D acceleration too. Now, I can play most of the 3D games (tuxkart, supertux, billards GL) and a few non 3D games (chromium) in full glory.
  • Wireless is still a problem. My netgear wireless adapter was able to recognize my ADSL router among the other routers in range in my neighborhood, but fails to connect frequently. But once connected, they blaze through at 200kbps. I have not been able to see this kind of speed on a windows machine though...
  • Audio CDs are mounted properly. This happened to be a problem with 7.04 when only data CDs were recognized.
  • Video / audio codecs are easier to download from the main application installer.
I happened to find more applications available on the Linux platform, especially for kids compared to windows. TuxPaint, TuxMath, celestica, GCompris are some must haves. And my son's current favorite is Pingus (a lemmings clone where you deal with penguins instead).

Of couse, you have the standard suite of tools for regular work (open office), CD burning, browsing (FireFox), e-mail (Evolution) and all this happened to work well on my 4 year old Athlon with 384 megs of RAM!

Keep watching... I'll post in a few screen-shots.

Friday, July 04, 2008

It's bright and sunny at Chennai, but the fuel queue is long

All at Tamil Nadu would have faced the spurts of acute fuel shortage and chances are, you too, like me had spent some time on the queue waiting to fill your tank. The last few days had been 'exciting' looking out for every fuel station on the way to see a line of already queued vehicles waiting for the fuel tanker to arrive. The recent fuel hike just added to the woes.

We are accustomed to travel long distances, and imagine if for a week or two, the fuel tanker fails to arrive? A tank full of fuel may sustain you for a few days, but after that, you are left with your own foot (or other animals) for travel.

Public transport (fuel driven) will not function and as traveling by foot would be difficult to span the distance that we once used to travel in mere minutes. Bicycles will be in great demand and possibly, we would start considering bullock-carts and horse riding.

But, somehow, solar energy does not seem to be exploited by us, being in a very sunny place. Perhaps this free / cheap energy source that has been neglected for so long would see a spurt of new advancements to make fast fuel-less (Petrol / Diesel) travel a thing of the past.

Friday, June 27, 2008

20 Years Before - 1988

When I had attended a course for GW BASIC. I already had a computer at home, and it was called the ZX Spectrum with, wait for it, 48k memory. Before formally learning the BASIC, I had restricted myself to a few prints and beeps and meticulously typing out program listings off computer books which eventually resulted in a star walled winding road with a car in the middle. The beeps always allowed you to specify the frequency and duration to compose a simple tune of your own.

The I/O was innovative with the ability to use standard audio cassette tapes to record your programs and load it back. Hmmm. The good old sequential storage medium. And mostly, I was using it for playing games. There was one called DLAN, a space simulator which I had spent countless hours trying to save the Earth and solar system from menacing alien fighters which featured a 3D environment along with a full solar system map, portholes and docking to a planet to refuel and carry out simple maintenance activities.

Later, I upgraded to a 128k machine with only one game that utilized the full memory which required to tap two keys as soon as possible to increase the power for some athletic activities like a 100 meter sprint or a tug-of-war against the computer counter part.

Bah, now a days, each game occupies more that a GB of disk and memory and provides the same level of experience.

The 128k also gave me an opportunity to learn about machine code language where I had to painstakingly type out hex byte-codes which resulted in a simple editor to allow you to directly program your computer using machine code. That was the time when I learned about machine instructions like move or registers.

We have come a long way until then...

FLACkey MP3s

Happened to buy a set that promised over 100 songs in a single CD. Should have looked at the small print or made some mental calculations on what bit-rate the songs might have been compiled. But, those were the moments where you have the 'urge' to buy (like shopping for food when you are hungry!). After buying, I realized all songs to be compiled at the rate of 128kb which usually sounds bad using the laptop speakers!

The collection that I maintain through legal CDs purchased over the last ten years were meticulously encoded at 192kbps and when VBR (variable bit rate) came into play, the ranges that I supplied were 32 to 320 kbps which sounded quite good. But with diskspace available for a few rupees / MB, no, infact much less than a rupee, I have moved to using FLAC.

Most encoding techniques are lossy, which means that you loose some information from the original music which cannot be recovered at any cost. FLAC is a loseless compression technique where, if you were to decode a FLAC file, the contents will be equal to the orignal.

Though most media players do play FLAC files, I found minor issues on some of them. But, FLAC being an open source project guarantees that you get the source which you can port to a machine of your choice or convert to a format that could be readable by the platform with ease.

The other popular format is WMA lossless which comes preinstalled with your windows media player. But, then, you do not get the source and possibly will find it difficult to playback on a non-windows box.

So, until then, I am slowly converting my collection to FLAC.

Saturday, May 17, 2008

ScummVM
Been always for the lookout for good games to play on my cellphone on those days where you do not have anything else to do, but had always ended up with sub-par free games or those that require you to cough up dough out of your wallet.

The other day, when I was checking out my long used collection of games, I stumbled upon a few LucasArts DOS based games. Looking up the internet, I found ScummVM, a virtual machine capable of playing LucasArts games which has been ported to almost all different types of OSes like Linux, Windows, Symbian OS etc. So, I had been able to download and install ScummVM and a couple of free games.

You eventually get a mouse pointer which you can control using the directional keys to perform various in-game actions. Though a little cumbersome, if you have time to wile away, ScummVM is work a try.

Free games to try are:
  • Beneath the Steel Sky
  • The flight of the Amazon Queen

Wednesday, May 14, 2008

iPods? Nahhhhh

Ever since the pod hit the market, it had created a big industry of other wannabe players. Agreed that Apple's iPod is not the first of its kind, but the quality and simplicity the product made the world sit up and notice.

As with most of us, I had also been tempted to get a pod of my own, but somehow been unable to justify the need for a music device, at least while at India.

Unless you are jogging during the mornings or commute using a public transport, I do not see a big reason to use an iPod. If you have your own 4 wheel transport (My opinion is, it is unsafe to listen to music on a two wheeler), chances are, they have a port to read in from your music device. But, do you need an expensive music player for that? With the advent of mass storage devices, high capacity flash pen drives, all you need is a medium for storage, not a music player. I just saw at a computer shop at Spencers, creative mass storage harddisks with the capacity of 120+GB (great for lossless FLAC format music files anyone? Hmm... This looks like a good idea for my next article...) available for picking.

While in office, you have your trusty high performance desktop or your laptop to host your music. I'm sure you are not going to listen to music as you walk to your cafeteria. So a desktop or a laptop would do.

The one advantage that I see is, you always carry your cellphone. So, if your music player and your camera and your phone and your PDA and your computer are bundled into one, I would probably take a look as it does not increase the number of devices and dangling pairs of earphones that I have to carry.

Perhaps the deal by AirTel and Vodafone with Apple would allow the availablility of the iPhone into India. I would wait a year or two for the prices to come down to own one.

Sunday, May 04, 2008

Inside a Text Editor

Ever since my college days, after dabbling with vi and a few other editors, I always had an yearning to create my own. Now, I am still stuck with XEmacs and jEdit and had a chance to compile / study the sources and documentation of EMACS and a free editor component called Scintilla.

Until now, I was under the the belief that text editors used a doubly linked list to represent the text in memory. The advantages of this approach being insertions and deletions are much more easier which is just a matter of just un-linking a node off the list. But the shortcomming is that they tend to fragment memory with each node or line take a bit of memory.

The other alternative approach is to have a dynamic array which is a contiguous space of memory and can sometimes be directly written off to a file. The disadvantages are that insertion and deletion are costly and you need to reallocate quite frequently.

While goint throug the source and documentation of text editors, I chanced upon the Buffer Gap algorithm that provides the benefits of a contiguous space and yet minimizes the impact of insertions or deletions.

The algorithm is simple where the text is represented as an array of characters. There is a gap in the array that can be moved or repositioned. Every time a few new characters are inserted, the gap is moved to the location where the characters are to be inserted and it is just a matter of using the gap as a buffer to insert the new set of characters. The end result is, the gap size has reduced. Deletion is a similar affair where the gap is simply extended to include the area that needs to be deleted.

Wikipedia has a short description of the same algorithm.

Sunday, April 06, 2008

The Quest

The quest for a free UML tool has been going on for the past few years until I chanced upon StarUML. Capable, with support for UML 2.0 constructs except Timing Diagrams, this is a good tool compared to others like ArgoUML.

StarUML is developed using Delphi and is COM compliant so that plugins exist to extend the existing framework to support or provide configurability.

The base installation supports document generation and well as rudimentary reverse engineering support. I tried reverse engineering a few C# code and only a few classes were imported. This being an open source project, there is no stopping you from acquiring the source and fixing any open issues and submitting a patch.

The UI is snappy and unlike other tools that are over 250 MB in size, this is 1/10 in comparison. A great tool for quick modeling.

Thursday, April 03, 2008

Visual Studio - tread safely

Wizards - A slowdown to productivity?

Had a chance to write a few small apps in C# using the IDE. One thing that felt a bit daunted was the amount of code that is being generated automatically specifically with the GUI initialization code and the resx files.

Intellisence? Not for the 'declare later' group

The second is how intellisence interferes with your code. If you use a variable without declaring it (say in a for loop), intellisence inserts the nearest matching class or type name or variable in code, which I have to backtrack to remove and the go back and declare the variable and then specify that in my loop.

The mystic resx files

Whenever you start including images or other resources, they get compiled as a resx file which is xml file with the binary data embedded into it (using base64 encoding?). Though I have included the core resource files in the project, the resx files becomes difficult to manage, especially when multiple members are working on a project where it gets difficult to trace the changes made by someone else.

So, you've got your own quips about the IDE? Share them as comments in my blog...

Sunday, January 20, 2008

Linux - still going strong

Over three years of running my home PC on Ubuntu Linux, and looks like it's going good. Here are my rants and raves.

+ Application availability and easy install if your desired app is hosted in the apt system. From openoffice to k3b to edutainment (gcompris, tuxmath, tuxpaint, frozen-bubble)

The availability of kid friendly educational games is much better with Linux that Windows. Agreed, that there are commercial software packages available, but the ones you find at Landmark or Music World are sub-par and look as if they are created out of flash, with a few randomized questions and shoddy art-work. Compare this to Gcompris, it is much more polished with a whole gamut of games and activities that teach kids about maths, time-telling, typing and computers and an external interface (python or GTK based) to add your own lessons or games.

All other standard apps are provided and are quite capable, be it a browser, word-processor (though not as good as Microsoft's), music player, burner, and in some instances much better than their windows counterparts.

- Interoperability with other devices

The other day, I happened to get a wifi card from netgear. Having the cables sprawling around our rooms was not it. Problem was, I needed to consult four or five how -to's, download a few packages, edit a couple of scripts to get the card working occasionally.

My connexant based internal win-modem is not event recognized, which means I will never be able to connect over a dial-up modem, in-case my broadband link goes down. The drivers are available for a fee from a 3rd part vendor. The original is available as source, but were for an outdated linux distribution distributed a decade back.

The printer and scanner requires you to again go through the forums to install the right drivers. Your display is limited to vesa compatibility with no hardware acceleration.

Though some devices liky my pen-drive, digital camera etc connects properly.

- Gaming

One thing Linux lacks is with gaming. Though drivers are available for the latest graphics cards, most of the leading game developers are reluctant to release games on the Linux platform. Games targeting DX10, or DirectX are directly not not portable and requires an intermediate layer to translate the DX calls to the Linux equivalent.

+ Updates and support

Any OS or applications requires constant updates, security fixes. Over the course of three years, my Ubuntu install is still being constantly updated and none of my applications crashed or created incompatibilities which is a good thing.

Support-wise, you have the good Ubuntu forum and the whole wide web to post your questions or search for probles other users might have faced. The Ubuntu forms had been quite informative and up-to-date.

Similarly, my Linux box has remained virtually virus free.

+ Cost

One of the biggest advantages of an OSS based OS is it's free. With a legal copy of Windows XP or Vista costing over Rs.7000+ it is fine if you get it along with your desktop. But if it is a bare-bones box, you need an operating system. So, be prepared to shell out 7000+ or go for a free OSS based operating system.

With some of these parameters listed out and how it had impacted me and my family over the course of three years, you can assume that if you are not looking out for heavy duty gaming and possess a few Linux supported hardware, Linux is a good choice, particularly with a Rs.0 price tag!