Saturday, October 22, 2011

Insanely helpful error message


Ofcourse, I don't see any harmony in the exception thrown !! ;)

(PS. Nokia, eagerly waiting to know when the WP7 devices are heading to India?)
(Update: So looks like, mostly probably Nokia WP7 is landing in India by the end of the year, ref: http://windowsteamblog.com/windows_phone/b/windowsphone/archive/2011/10/26/nokia-s-first-two-windows-phones-are-here-and-they-re-awesome.aspx. And in most probablity, I am gonna switch to one of the Lumia devices :) )

Friday, September 02, 2011

qusoware: Quantum Software on their way

Until now if you wanted to try out any of the algorithms based on quantum computing framework, you would basically need to reconfigure the hardware,  presumably with an expert experimentalist. This however is probably poised to change with the introduction of quantum memory:http://www.technologyreview.in/computing/38495/. This essentially brings the quantum computing devices to the realm of general purpose computing architecture, the thing that is most common in todays processors.
On a lighter note we will might soon have qusoware (my pun for software that runs on a quantum computer), probably something like QComBasic 1.0 from someone like Microsoft ;)

Saturday, August 27, 2011

Upgrade to MeTA Studio : full jython integration, first steps of jchempaint integration

A new upgrade to MeTA Studio is now available for download. The current version is 2.0.27082011 and the update is available from usual place: http://code.google.com/p/metastudio/

Changes in this version:
- Updated smackx libraries, GTalk integration works again!
- Fully supported Jython integration into the IDE

  - Initial implementation of JChempaint integration, more improvements on the way
  - Other improvements: surface normals, improved GTalk widget, bug fixes and improvements in federation framework, issues with .mar handling fixed, new APIs for managing workflows (no UI integration yet).
 - I also welcome javadba, who recently joined the project and plans to contribute unit tests for the parallel framework in the MeTA Studio and in the process improve it.

With this release, MeTA Studio SVN has 500+ commits (http://code.google.com/p/metastudio/updates/list). Though the development on MeTA Studio started quite some time back (2003-04 for version 2.0.x), it was only made opensource in 2009. Just interesting to look back ;)

Enjoy!

(PS: as you might notice from SVN logs, I unsuccessfully tried porting the project to JDK 7, which was recently released. I am almost sure that the problem is with a bug in the current JDK release. Will be investigating and may eventually migrate to the new JDK release once it becomes stable enough.)

Tuesday, August 16, 2011

Hello Kinect : Speech recognition

If you have ever used speech recognition built into recent version of Windows, you would know of all the troubles it has. It is good, but not good enough to make you want it use on everyday basis. It is good when it works, and painful other times. Handwriting recognition or merely typing is much less annoying to get your real work done. Most of the trouble comes when you are in a room where other people are also talking. The engine gets confused.
With Kinect, however, things are better as the speech recognizer also uses additional inputs from the camera multi-array microphone to estimate the source of sound to recognize. Which pretty much makes speech recognition quite interesting.
So what all do we need to identify speech using the Kinect SDK?
First of all you need to add Microsoft.Speech.dll to your project, and them make the following two imports:

using Microsoft.Speech.AudioFormat;
using Microsoft.Speech.Recognition;

All of the speech recognition stuff is then essentially handled by the classes: KinectAudioSource and SpeechRecognitionEngine. The later is part of Microsoft speech API and provides a generalized framework for speech recognition.
private KinectAudioSource kinectSource;
private SpeechRecognitionEngine sre;

RecognizerInfo ri = SpeechRecognitionEngine.InstalledRecognizers().Where(
r => r.Id == RecognizerId).FirstOrDefault();
if (ri == null) return;
sre = new SpeechRecognitionEngine(ri.Id);
var helloChoice = new Choices();
helloChoice.Add("hello");
helloChoice.Add("kinect");
var gb = new GrammarBuilder();
gb.Append(helloChoice);
var g = new Grammar(gb);
sre.LoadGrammar(g);
sre.SpeechRecognized += sre_SpeechRecognized;
sre.SpeechHypothesized += sre_SpeechHypothesized;
sre.SpeechRecognitionRejected += new EventHandler(sre_SpeechRecognitionRejected);
var t = new Thread(StartKinectAudioStream);
t.Start();

For the speech recognizer to work correctly, you need to provide words that need to identified. These are handled by constructing a 'grammer' for the same. In the above code we construct a simple grammar to recognizer only two words 'hello' and 'kinect'. Next we register event handlers, which are 'callbacks' when the SpeechRecognitionEngine recognizes (or does not) something that is spoken.
After this we open the Kinect's audio stream and start listening to it in a different thread.

The body of StartKinectAudioStream() function is as follows:

kinectSource = new KinectAudioSource();
kinectSource.SystemMode = SystemMode.OptibeamArrayOnly;
kinectSource.FeatureMode = true;
kinectSource.AutomaticGainControl = false;
kinectSource.MicArrayMode = MicArrayMode.MicArrayAdaptiveBeam;
var kinectStream = kinectSource.Start();
sre.SetInputToAudioStream(kinectStream, new SpeechAudioFormatInfo(
                                               EncodingFormat.Pcm, 16000, 16, 1,
                                               32000, 2, null));
sre.RecognizeAsync(RecognizeMode.Multiple);

The code above basically tries to construct a beam for each person recognized by Kinect (skeletal tracker).

Finally, the signature of event handlers for speech recognizer are as follows:

void sre_SpeechRecognitionRejected(object sender, SpeechRecognitionRejectedEventArgs e)
void sre_SpeechHypothesized(object sender, SpeechHypothesizedEventArgs e)
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
   Console.Write("\rSpeech Recognized: \t{0}", e.Result.Text);
   lastRecognizedWord = e.Result.Text;
}

Here a short video:

More to come soon :)

Monday, August 15, 2011

Google + Motorola = Googarola !

Here we go, Googarola (http://googleblog.blogspot.com/2011/08/supercharging-android-google-to-acquire.html)! Google has announced that it would be acquiring Motorola mobility, the unit of Motorola that build the Droids. Essentially, Google has stopped being software only company, by buying a major Android handset manufacturer. This is a quite smart move. From the official blogpost, it is quite apparent the motive of this buy: Patents. Lately, Android handset manufacturer have been hit by patents from all sides, some of which may be ligit, but overall they simply seem to seve as a way to scare companies away from using Android alltogether. With Motorola acquisition, Google gets its hand on a large pool of mobile patents, and at the same time also weakens its complaint againt Apple+Mircosoft et. al. to the US DoJ for the rescent issue of Nortel patents buyout.
Personally, I feel this is a good move in view of customers. Hopefully, the mobile space has room for atleast about 5 different ecosystems which are sustainable as against only 2 players in case of PCs. Google can now have more control over the hardware and at the same time will have less worry of any patent litigation. Also, I think this move is good for other Android handset manufactures, as now Google can essentially be more helpful to them when it comes to patent litigations. What actually worries me is if the culture of an 80 year old company will jell well with an yet young Google.
In view of this acquisition, one more thing seems to be clear: the reason why Nokia didn't go with Android. I guess, with Motorola acquisition in mind, Google obviously couldn't think of giving Nokia enough room for customization of Andoid.

Things in mobile space are getting very interesting. May be another major cosolidation is underway... like the 'unlikely' acquition of Nokia by Microsoft? Although I am highly skeptical of such an event.

Saturday, August 06, 2011

Hello Kinect!

So, finally I gave up all the resistance to avoid buying this cool new stuff and ordered a piece for myself from http://www.flipkart.com/. The unit arrived last week, but had to spent the weekend rearranging my living room so that I could get enough space to use my Kinect. Plugging it to my PC and using the drivers provided with Microsoft Kinect SDK was straightforward. I did initially face a problem with the driver not installing properly, but quickly figured it out that this was because the Kinect was not plugged into a root USB port.
My intention of getting Kinect was not to play games, but to play with programming it. Although I would happily take an XBox, if you gift me one ;-)
This post and subsequent posts on Kindle on this blog will tell my experience of programming on Kindle. As a first step, I ensured that the samples provided with the SDK work well. Next, I installed Visual Studio Express 2010 (available for free here: http://www.microsoft.com/express).
I chose C# (C-Sharp, may be they should call it C-Dumb :P) as my programming language for Kinect. Jokes apart, I have very little experience using C#, mostly using Java or C++ (left using Fortran on day-to-day basis 2 years ago!). Any how, I found C# to be quite neatly designed language and easy to learn particularly if you come from Java or C++ background. If you come from C++, you are sure to enjoy some freshness that Java brought to object oriented programming.
So considering you have some idea to program in C#, writing a 'Hello Kinect' is relatively easy. First ensure that you have added Microsoft.Research.Kinect.dll as an external dependency to the Visual Studio project you create.
image
Next is to import the Kinect APIs:
using Microsoft.Research.Kinect.Nui;
All the initialization of Kinect NUI (Natural User Interface) is handled using the Runtime class.
Runtime nui = new Runtime();
nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | 
               RuntimeOptions.UseSkeletalTracking |
               RuntimeOptions.UseColor);


Next we open the Video and Depth streams of Kinect:
nui.VideoStream.Open(ImageStreamType.Video, 2,
                     ImageResolution.Resolution640x480,
                     ImageType.Color);
nui.DepthStream.Open(ImageStreamType.Depth, 2,
                     ImageResolution.Resolution320x240, 
                     ImageType.DepthAndPlayerIndex);

Note that the current Kinect hardware only support VGA resolution (max) for video stream.
When a data frame is available for processing on Kinect, the driver sends a notification to the application. In C# this is handled by registering an appropriate even handler as follows:
nui.DepthFrameReady += 
new EventHandler<ImageFrameReadyEventArgs>(nui_DepthFrameReady);
nui.SkeletonFrameReady += 
new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady);


The signatures of the event handlers look as below:
void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
void nui_SkeletonFrameReady(object sender, 
                            SkeletonFrameReadyEventArgs e)


Now, I have managed to see how to get the Skeletal data easily:
SkeletonFrame skeletonFrame = e.SkeletonFrame;
foreach (SkeletonData data in skeletonFrame.Skeletons)
{                
       foreach (Joint joint in data.Joints)
       {

              // transform and plot joint.Position
       }
}
In the end uninitialize:
nui.Uninitialize();

So here is a video of my ‘dot avatar’) in action Smile
My ‘dot avatar’, the other ‘dot avatar’ is my dad in background. Kinect SDK for Windows 7 at the moment allows tracking of only two people.

Next up, I need to figure out how exactly to use depth data as well as handle audio. Hopefully a post for next weekend Smile

Have fun!

Sunday, July 10, 2011

A need for sincere debate on the energy issue in India

When was the last time there was a debate regarding future of energy resources in India?
Many would want to say ... um .. well when was it? When Indian Parliament was trying to get a nuclear deal signed with the USA? Or just last month when there was a fuel hike?
I have a strong feeling that none of these debates were sincere. None of them had anything visionary coming out of it. I always felt that there were more emotional and monetary reasons behind any decision involved towards the future of energy resources in India.
Everyone at the decision making level today seems to make statements such as, "Nuclear and thermal energy is the future for power needs of India". Seriously? Did we ever think if this is sustainable? How did we come to that 'conclusion'? 
To understand this let us go to the root of the issue. Bharat, traditionally has been an economy that always emphasized upon sustainable villages. The villages were always as resourceful as the cities. When the Colonial rule came to Bharat, they got with them the Industrial culture in the West and India was born. Industrialization was good, it brought the so-called 'progress'. There was one differentiating factor though which was not so good. It promoted an economy of unbalance. Of all the unbalances, the unbalance of a region or territory is what made things even sorrow. This is what resulted in the formation of 'cities' of modern time. Instead of decentralization, we had concentrated hubs that had all the amenities. And all these were completely absent in other places. This is what prompted large scale migrations from villages to 'cities', which keep on getting bigger and bigger. But how long will this expansion last is anyone's guess.

A case for decentralization
We can’t keep expanding cities. It will surely crumble at some point. We already keep seeing signs of this. All that the city administration tries to do is find workaround.
A good example of how not to expand a city is the one that I live in: Pune. This city is full of malls. So many of them and so close. And each of them suck power like crazy. There seems to be no full stop in growing number of malls. I can count like four big malls in my small suburb of Viman Nagar. And one of the malls even proclaim to be biggest in India! So you can easily imagine its energy needs. Add to this the fact that the city houses two of the most powerful supercomputers in the country, which also figure in the top 500 list. You can easily get where this is all headed.
When Mahatma Gandhi said we need self-sufficient villages and not big cities, he had point and a vision to see ahead. We just seem to have forgotten that, our vision blinded by the glitz of big malls. At the same time people migrate to cities because villages are under-developed, have rigid social structure and very limited opportunity for ‘growth’. The form of decentralization that Gandhiji advocated once seems to have been completely lost. No one cares about it. Heck none of the political class even speak of it, most are simply concerned with providing subsidies or ‘rojgar’ schemes, which most of times are pointless and foster corruption.

Bad Science and Why no investment in future, the renewable energy?
A few years ago a group of people from a wind energy company had come to our home to meet my dad. They wanted my dad to be a part of independent scientific advisory panel. The reason: There was immense political pressure on this unit to shutdown, apparently because this unit had been blamed for not enough rains in this region. Logic was because of the windmills the wind was diverted, and somehow the rain clouds didn’t come there! Now now! The committee did submit a report to state government , saying there was no such evidence. To top it all, it rained heavily that year in this particular region. Guess, even rain god don’t like bad science Winking smile
In India, I don’t see concerted efforts to push for generation of renewable energy: particularly solar and wind which is available in abundance or even the biogas, but poorly utilized. There are ‘here – and – there’ efforts. We do have a ministry of new and renewable energy : http://www.mnre.gov.in/, but I hear more of Petroleum ministry that this more important ministry. I strongly feel that ministry of renewable energy should put in concrete efforts for large scale adoption of renewable energy, which need not be subsidised. A policy like compulsory solar power for all new buildings and existing housing complexes may be a good starting point. 

I strongly feel that Nuclear or thermal energy is just not suitable for our sustainable future. What do you think?

PS. 1) All views expressed here are solely mine. They have nothing to do with my current employer or any organization that I represent.
2) I had though of writing this up from long time. But recent statement on solar power and 'its everyone's choice' by German Chancellor, Angela Merkel, during her recent India visit further prompted me to write this up.

Wednesday, June 01, 2011

From Symbian to Android

About few months ago I switched from using Symbian to Android. The transition is still in progress, but I can say this much: probably I would never go back to Symbian. And well, Symbian is more or less dead with the Nokia announcement that they would rather be shifting to Windows Phone OS.

As much as this is about moving from one mobile OS to another, it is also about moving from one handset to another. The Symbian phone is a Nokia E51 while the Android phone is a Samsung Galaxy 5.

These are just notes on what I find good and not so good with the switch.

Daily Usage:
My basic requirement from a Phone call is just that it makes and receives phone calls. For this both Android and Symbian seem just OK.

Another requirement from my phone is calender management. In this case Android just wins, mostly because of its seamless integration with Google calender.

Finally battery life: My Symbian phone used to last much longer on a charge than my Android phone. Generally, I feel Symbian is still better in power management. But this may also vary depending on the phone model.

Always Connected:

With Symbian phone I never felt like being always connected. Simply because there were no great apps that needed online update, like no good chat clients.

System stability:

As far as I can say, Android on my phone has not really be stable. With Symbian, my phone worked with a reboot for months ... this has reduced to a few days! This in no way is an advancement. I should really checkout iOS and Windows Phone OS stability to see how other modern OSes fair.

Usability:

I generally find Android to be much more easy to use and navigate than Symbian. Making phone calls, browsing Internet, accessing e-mail, playing music, watching YouTube is all much more enjoying and smoother experience with the Android interface than it has ever been with any version of Symbian.

Did I program?

Not much. Basically, didn't get much time to play around with Android programming as yet. But I did easily manage to port some of the core parts of MeTA Studio project. This initial port is available at: http://cid-76d41f4618b0b6af.office.live.com/self.aspx/metastudio/MeTADroid.tar.gz
May be somewhere down the lane there will be UI Android port for MeTA Studio.

That said, programming on Android is definitely much more enjoying than Symbian C++. I am not sure about the new Qt support for Symbian. But then I always find it enjoying to program in Java than with C++ (i dislike hunting for segfaults in someone elses code ;)).

Sunday, May 29, 2011

Push pedal..

An Indian express article (http://www.indianexpress.com/news/pushed-to-pedal-post-fuel-price-hike-a-spurt-in-cycle-sales/796946/) is indicating that there is increase in Push Bike sales in Pune with the recent increase in fuel prices. To me it is just a blip in the timeline. Not sustainable. Unless of course there is substantial up gradation of cycle tracks in Pune.

At least for now I would not actually recommend long distance commuting on a Push Bike in Pune … from my own experience.

Just drawing…

charcol_try

Saturday, May 28, 2011

Normal generation for surfaces in MeTA Studio..

watwat2
For some reason, the earlier builds of MeTA Studio did not have normal generation for surface rendering. This resulted in poor but fast surface rendering. I have just modified this to always generate normals for surfaces starting from r468 revision in the SVN. So now you need not tinker to get a smooth surface.

Tuesday, May 17, 2011

Remembering Dr. V. Sundararajan, sir



When I called him up yesterday morning on his cell, to invite him for some function, that soothing voice on the other end was no longer there. He had left all of us the very same morning. I am at loss of words.

To me Dr. Sundararajan was an 'un-official' mentor during my Ph.D. program. Although I had quite less academic overlap with him, he always used to help out in umpteen ways, particularly when it came to using the C-DAC facilities for our research work.
He almost always used to attend my Ph.D. progress presentations and had ready useful comments at the end of the session. After I had completed my thesis, he had asked me to give a presentation at C-DAC, which unfortunately never happened as I almost immediately went to ANU for post-doc.

Even when Dr. Sundararajan went into higher administrative roles at C-DAC he was always accessible to everyone who had an interest in doing interesting work with HPC and evolutionary algorithms. He also taught courses at my alma mater, and would indeed be a great loss as a teacher.

R.I.P. may god give his family strength and courage for the life ahead.

Sunday, April 17, 2011

MeTA Studio binary release

Another, major bug fix release of MeTA Studio (2.0.17042011) is available for download. The list of issues addressed, and not yet fixed can be seen here.

New additions and fixes in this release:

- apps folder: simple examples of writing new applications on MeTA Studio platform
- MO plot (a new widget is supplied for the same)
- Support for NetCDF and HDF libraries
- problems with i/o redirection for scripts running with in MeTA Studio GUI environment

Still in works:

- Rotation of individual molecules in the editor (partially working)
- Interpolated normals for on-screen iso-surfaces

Monday, April 04, 2011

Configure WiFi usb adapter as a WiFi hotspot (Windows 7)

Had allocated this long weekend for fixing Issue 46 in MeTA Studio, but ended with lot other bugs that had to be fixed. Eventually, I am only half way through fixing the real issue. With all this I got painfully bored :( So decided to do some changes in my setup.

I have a mobile data plan currently on my mobile for which pay about 100 INR per-month for 2GB, which are hardly used up. In fact, I find that I really do not require that. Also, after seeing the new 3G data plan rates (http://airtel.in/Airtel-3G/tariffs.html), I though it was high time I just dump the subscription. So now my phone is quite simply put, un-plugged, with only voice and sms, and pay as you use data.

Now when I am at home, on most of the weekdays, my parents watch TV. And my main desktop as well as the TV is same unit. So, if I need to work (with internet connection), I simply used to setup an ad-hoc connection using a WiFi usb adapter connected to my desktop. The sad part was that my Android 2.1 phone never saw this ad-hoc network. I could simply purchase a Wifi router, but just can't convince myself to get a new device.

After a bit of googling, I came across this very useful article: http://www.blogsdna.com/5506/how-to-setup-virtual-wifi-in-windows-7-without-any-extra-software.htm

Essentially, the whole thing boils down to two commands:

netsh wlan set hostednetwork mode=allow ssid=mywifi key=mypassword
netsh wlan start hostednetwork


and also enabling Internet connection sharing in Windows 7.

Next up, I wanted this to startup automatically when my main desktop booted. I did this by writing the above commands in a batch file and using NSSM - the Non-Sucking Service Manager (http://iain.cx/src/nssm/) to create a Windows auto start service.

Cool afternoon, now back to fixing Issue #46 ;)

Thursday, March 31, 2011

Ban! Pretty much an un-Gandhian way




It seems here in India, there is a fad, to BAN.

Recently, many state governments banned a book on Gandhi, proclaiming that it has insulting statements on the father of our nation. The Law ministry is even considering changing the law to make such statements a crime! The bureaucrats and politicians who even think of doing this of course don't seem to have an iota of idea what Gandhiji represented.

When I started writing this post, I thought how can anyone even think of such absurd idea a 'ban'. Let's be quite clear: we are a democratic and intellectual society where the word 'ban' and an associated 'authoritarian' behavior of the people in power has absolutely no place. You can never enforce respect towards a person or a nation or a place, it has to come from within. That is but human mind.

I was quite relived to see that I was not alone to have similar feelings, descendants of Gandhi seem to have much more sense towards what to say, than our learned bureaucrats and government.

My only thoughts at the end of this post: I wish, if the respected law ministry were as sensitive to more real issues like that of Dr. Binayak Sen (http://www.binayaksen.net/) than going down the un-Gandhian way of protecting Gandhiji himself, Bharat would be a far better place to live in!

Note: Any view expressed here are solely my personal views, and have nothing to do with my employer or organizations I am associated with.

Tuesday, March 29, 2011

HCL Launches ME Tablets

Now, I am not a tablet fan as such, though I do own and heavily use a tablet PC.

But as a mass consumer product, I think, this has a large potential if the price points are right, especially in a market like India, where PC penetration is not that great.

So, I was quite excited almost an year ago when Notion Ink announced their plans to come up with a tablet. And actually delivered couple of months back (http://notionink.wordpress.com/). However, I still don't have a first hand look and feel of it (missed the first pre-order and then the second preorder invite :( ..)

While Notion Ink is quite innovative in what it has designed and continue to do so with their quite open development process, there are other Indian companies that might just get the critical mass in selling tablets, without innovating a lot. Or to say it in other words, provide what a user needs, not necessarily always the "wow" factor.

This is where the news of HCL ME Tablets comes in. And it is not just news, but you can buy the real product online (http://www.hclstore.in/ME_tablet). Of course, this one is not as good in "specs" department as the Notion Ink. But do users really care about specs of a tablet? Steve Jobs wants all of us to believe this, rt? Quite frankly, I think that is true. I don't really care about specs of these devices, if I get a smooth experience and get my job done.

HCL has a history of disrupting the Indian market with low price with pretty high quality products. In fact, my first laptop (or netbook) was from HCL. It was simply the best piece of portable hardware that I could afford back then. And this time around HCL has again come up with a similar strategy. The only difference this time is that in coming months there will be many other players in this space, particularly big Indian mobile manufactures like Micromax.

With all this, I am a bit concerned that NotionInk would actually become a small player, unless they do something radical. Just hope that Rohan is thinking along these lines, or at least reading this post of mine ;-)

Thursday, March 24, 2011

speech, html5 and chrome

Now this is cool (http://chrome.blogspot.com/2011/03/talking-to-your-computer-with-html5.html). Putting speech in browser has just reduced dependence on the PC OSes a bit more. What would be more cool is if it could support more than just English.

So now, the ChromeOS is looking more and more complete. Now when is handwriting recognition coming into picture ;)