A thought

I have been following the news of the BP oil spill for quite some time now. I have been reading how Obama wanted to “kick ass”, a most appropriate American term which suits the charisma of American leaders the most powerful of all men currently alive. On a side note, I wonder what will the Indian reaction if the Prime Minister or perhaps some other personality of power utter words like “pichwada phodna” while referring to odious personalities. Coming back to the main point, I have been noticing how the American outrage mounts over the callous attitude of the BP chief. The total number of persons killed in the BP debacle is 11 workers. The damage due to the leaked oil spill is terrible. Americans are terribly unhappy with the way BP is handling the show and the President has issued a number of stern warnings.

In the month of June, the verdict for the Bhopal Gas leak case was delivered. I have not the mind to put a link for it here. It is enraging, shows our lack of humanity, self-respect, degrading and so on. Clearly, this shows the “value” for an American and Indian life, both from Indians and Americans.


On compilation of FreeMat 4.0 from source on a GNU/Linux distribution

I mentioned in one of my earlier posts that Freemat is a cool substitute for MATLAB(TM Registered). Compiling FreeMat is slightly tricky.

  • First you have to ensure that QT is beyond 4.5. If not you have to compile it from source or install as a package. I prefer compiling from source. The documentation says that the default installation directory is /usr/local/Trolltech; yes “Trolltech”. After installing, export the library and bin as export LD_LIBRARY_PATH=/usr/local/Trolltech/qt-version/lib:$LD_LIBRARY_PATH and export PATH=/usr/local/Trolltech/qt-version/bin:$PATH. Note that the QT path is prefixed to the system path. Reason for this is that Freemat searches for QT version based on the first QT executable it finds. Also, add these lines in your .bashrc or .bash_profile or in the system-wide files. Otherwise, FreeMat will fail with some weird “undefined symbol” error.
  • One has to install LLVM 2.5 version only. LLVM’s dynamics change too much for the Freemat developers to cope. FreeMay packagers have nicely included a their dependencies on the source. So, you can find llvm here. Build and install it.
  • Then one has to install ARPACK and a bunch of other stuff. Just turn on the USE_BUNDLED_PCRE etc. in the cmake step and you are set to go.

OpenCV 2.1.0 and FFMPEG compilation solution

I had been recently struggling to compile OpenCV 2.1.0 with FFMPEG support on GNU/Linux. The problem was that the OpenCV CMake script fails to detect the important component of ffmpeg it needs; like avcodec, swscale, avformat. The more idiotic thing is that if one uses ccmake, the log is not visible. It is only after building that one sees that ffmpeg support is not there. One has to use cmake. Anyways, after doing  cmake ../OpenCV-2.1.0, noted that config log said “ffmpeg 0” and also put zeros against the above mentioned components of ffmpeg. Well, I knew that ffmpeg existed in all its components. I had also made a directory called ffmpeg in /usr/local/include and made symbolic links for the respective header files. Now it was a clear case of cmake being unable to find these, either because of poor CMakeLists.txt or the cmake itself. At this point, I did not want to dig into the innards of CMake; unlike autoconf it has an annoying tendency to hide information; for example where it searches for ffmpeg and such things. Such blackbox approach suits Ubuntu users no doubt. I tried parsing through the CMakeLists.txt and could not find anything that I could rectify. However, I did know that CMakeCache.txt contained the configured values.  After that it was a matter of putting manually the include, lib paths and the linker flags in this for each of the ffmpeg components. After running cmake again,  I could immediately see that ffmpeg components were recognised and ffmpeg was turned to 1. make happily started building cvcap_ffmpeg which meant that ffmpeg was actually being used.  However, the build process croaked at 99% when trying to link to the actual libavcodec/libavformat and libswscale. Clearly, the linker links I had passed as a guess had not worked. Now, I did cmake again and passed -L/usr/local/lib and -Wl, -rpath,/usr/local/lib. Voila! the compilation was complete. I build a test program to read and write videos. All worked ok. This was a rough sketch of the compilation solution. I will post the details of the CMakeCache.txt in case someone is interested.


A more elegant solution to the problem has been given by dev in the comment to the same self-mirrored blog post at blogger.

Ordinary user’s review of Acer 5738G

===== Review of Acer 5738G =====
I bought this laptop after doing a “literature survey” of the different models available in the market. I had considered Dell Studio as an alternative; however it was extremely expensive for nearly the same specifications. HP & Lenovo were way too expensive. My primary requirements were a good CPU( Core2Duo 2.0+), 4GB RAM, a low-end graphics card and a good HDD. 5738G fitted in admirably. My requirements were not on the portability side. There were enough laptops with 2GB RAM or so from Sony and costing nearly twice this model. Also, I tried to cleverly time my purchase during some festival season, where the offers would be there. The usual freebies thrown in would be a USB mouse, a pair of cheap speakers or something similar. I went to an Acer store itself and was convinced by the salesman to shell out 42,000/- for this. He would throw in a cable lock(which he himself admitted was one of those “cheap Chinese junk”) and a USB hub. I had a look at the mouse; it was a micro-mouse barely bigger than the inside of my palm and was of some obscure Chinese make; I should have known better. I thought that as i was going to an Acer store, the offer there may be more true to the word. On my protests, I got an equally cheap cable lock which is lying unused. Anyway, after I swiped my card the salesman quickly brought in a new box, showed me that the seals were intact, broke them and powered up the laptop. When I reached home, I saw that the instructions that the laptops were *not* supposed to be powered up on battery alone for the first time. This showed the complete lack of professionalism again.

I had searched for a DOS-prompt or preferably GNU/Linux loaded laptop. Sadly, these things are unheard of in Bangalore. Nobody had such models, the most they might do was to wipe out the default OS and install some earlier version of Fedora but this was not advisable. So I paid the Windows tax and took the Vista Home Premium version with the promise of free upgrade to Windows 7 as and when it came. Little did I know that this was another conspiracy to hoodwink and cheat from consumers. This is because when Windows 7 was released, I tried to upgrade but the media for my region was supposed to be shipped for which I would have to shell out yet another good amount of money. So much for free market.

I installed Fedora 12 on it. The default stupid HDD configuration is one huge drive. I had to use the re-partition tool to create two nearly equal partitions and installed Fedora on the other. The laptop came with a lot of junk software, games, promos and a big virus called Microsoft Office 2007. This last piece of junk was a 3 month trial version and reminded this everytime I started it. I uninstalled it faster than it could squeak “Bill Gates”. The general feel is ok; the keypad feels cheap but is fairly rugged. I have banged on it a number of times in frustration and it seems to have taken it well. On the other hand, I have a Dell Latitude E6400 which is feeling its “Shift” key despite careful usage. Thats one plus for Acer though I am not sure if the “ruggedness” is deliberate or accidental. The screen is ok, a bit too reflective, you have to turn on the screenlight quite a bit to do something useful. Naturally, this reduces battery life.

Coming to the most important part, the battery life is something I am fairly ok with. This laptop comes with the usual company specific power management tools. There are 3 modes:
Powersaver: Saves power and extends battery life. I get about 2 hr 30-40 minutes for very normal usage. Maybe I have a browser, a text editor and some python scripts running while I learn the language.

Balanced: This turns up the power more. I have noticed a 50% reduction in compilation time for the ITK software library between this and the Balanced mode. Obviously this eats up battery, never timed it though.

High Performance: As per the blurb this mode reduces battery life and bring out the high performance. When you turn this on, be sure to bring out your pan to boil tea or eggs. Unfortunately, you would have barely begun to boil the stuff when the laptop freezes and shuts down. Initially, when this happened I thought that the laptop had conked out. Then I figured that the heating was too high. So, the “high performance” mode is really a low performance mode. In any case, there is not much of difference between “Balanced” and this mode at least in terms of compilation time for ITK code. This is a serious disappointment with Acer and I consider this as lying like the “friendly” greengrocer who has been shafting you for years and generations together.

One thing which worries me is that the battery is now getting charged to 91% of its rated capacity at full charge. I am not sure if this is the norm. This is strange because i do not do a full discharge everytime and start re-charging when the battery indicator goes less than 20%.

========== Conclusion =========
This was my first laptop purchase. I am not elated and not too disappointed. I would have expected a clearer specification of the deal from the Acer exclusive authorised dealer; I would definitely have expected better power management. I would also expect to have a no Windows version. The laptop bag is piss poor and the laptop is heavy. Not for regular travellers.

On the plus side… erm.. the laptop still works. I think that the 5738G is now phased out and Acer is offering newer and better configurations at lesser or equal prices barely 8 months after I purchased 5738G. However that is the flipside of the electronic market. The idea behind the review is to make the other aware of my general experience with Acer and of course the model. Based on my 5738G experience, I would probably pay some more money and try out HP.
If you can stick tolerate Windows Acer offers features at prices that are really tempting. Also, once you accept that the quality of Sony and Acer models are going to differ considering the price difference; you would probably not feel too bad. Dell is way too heavy and my friends have reported the heating problem.

This review is of course kind of incomplete without the after sales services. Thankfully, I have not yet had problems which would require such trips and hopefully I would not need it either!

One major grouse is that despite paying for the full Vista, I do not have an installation media. Sure, I do have a backup and restore option which will “restore” my last stable state in case the C drive gets corrupted. However, I will not be able to install a fresh version. This is rather annoying, after all I have paid a good amount. All laptop manufacturers are following this tradition now sadly.

Latex equation editor for Powerpoint

I found a nice tool for writing equations in Microsoft Powerpoint called TEX4PPT. Here is the link.

Free MATLAB Substitute

During my PhD days, I had looked around a lot for Matlab substitutes. While MATLAB is an excellent piece of software, it is prohibitively expensive. Two substitutes I can recall immediately are Octave and Scilab. While GNU has generally cut it well on the software it offers, somehow Octave has not made it. I definitely appreciate the time the community has put in; my comment is based on the conversations I have had with friends. Perhaps the non availability of an easy to install MS Windoze version may have something to do with it. My main requirement is image processing and vision. There are tonnes of software written in MATLAB, which is perhaps the main software of choice in many universities. So, a MATLAB substitute must be able to process this vast collection of tools with no or minimum effort. Sadly, this may not be possible. One problem with such packages is that these get tied down to specific releases of MATLAB.
Recently, I came across FreeMat which seems to be a good substitute. I have barely begun to use it but some people I know report a fairly good compatibility with MATLAB. At least the general commands seem to match well. The flip side is that compiling from source in GNU/Linux is a bit of bear.


This is a superb software! This Python library/software packages OpenCV, ITK, VTK, Scipy, Numpy and plotting utilities all under one umbrella seamlessly. This is what I was looking for a looooong time. I have not really begun to explore it as I had problems with the Windows installer. I am eagerly looking forward to using this.

On roads in Indian cities

I am one of the innumerable victims of the perennial traffic jams occurring daily in all Indian cities. Part of the problem is lack of rules governing the traffic flow. The major part of the problem is of course the complete lack of discipline in India. Does not matter if you own or drive a bike or a bus, the road IS yours; park anywhere, make a U turn, stop, pick up and drop passengers etc. It is a part of fundamental your right to disobey traffic rules. Indians need the stick to maintain discipline. Be as it may, I have hit upon a wonderful idea to which will at least help maintain lane system, if nothing else. The idea is that each lane in a road should be about 3-5 inches higher than the next. This will prevent the nimble people from weaving in traffic or they can do so at great discomfort to themselves and their passengers. It is a simple idea yet I think it will be wildly successful. To be fair, this idea is novel only in purpose. Most roads in India are somewhat laid with level differences. In extreme cases of level change, I have seen this happening; I am sure this was unintentional.

US-Israel relations: what drives it?

What drives the US-Israel relations? Why does the USA bend over backward to accommodate Israel’s every wish and condone every massacre it does. When I first read about the USS Liberty incident a few years back, I could not believe it. How could a nation which prides itself on its capacity for blindfolded revengeful rage, condone this? I theorise that Israel has some proof of America’s involvement in the initial days of Nazism and is holding this over America’s head everytime. The Ha’aretz seems to be one of the more balanced newspapers in Israel. Truly, the Middle East is a mess and Israel’s ultra aggressive posturing is never really going to help. The fundamental problem is that any time anyone says that this is wrong, Jews in Israel and elsewhere start howling about the Holocaust, victimisation and so on. Frankly, which group or community has not been victimised or faced the brunt of some other community ever? Be it Hindus, Muslims, Christians, Budhhists  and so on, all have been shafted at some point in time by the other. The timing of the Holocaust was such that mass-media propagated this soon to the rest of the world which was shocked by the brutality they could actually see and which happened just 5-10 years back then. The guilt was driven in to the higher level than the usual apathetic way human beings take it. Ultimately, if Israel wants peace, it must accept that it lives on land which was stolen from Palestinians by guile and force. Since Israel is now stabilised, it must now promote peace by showing some give and take. Here is an interesting article.

BSpline code for curve evolution

I implemented planar curve evolution using B-Splines for my PhD. Here is the package. This uses OpenCV for the basic data structures and linear algebra operations. Here is the code. Bricks & bouquets welcome!