Archive for the ‘technology’ Category

Fun with Lego Mindstorm NXT

Saturday, April 19th, 2008

Picture taking robot

Picture taking mechanism

While I was getting confused on what to code on the quarterly hack day, our senior manager brought a Lego Mindstorm NXT programmable robotics kit for some fun. The moment I saw his mail, I ran to his cube to grab it. This was my one chance to enjoy some building and coding fun together in the name of hack.

So I spent the whole Saturday figuring what to make, and suddenly this idea struck me. In this age of social networking mania on the web, why not make an intelligent picture taker which can roam among people in a room and take some cool shots.

This is by far the best toy I ever handled. I always wanted to make toys with servo motors, and the kit has 3 of them. So 2 of them went to the wheel and the last one became a concoction to trip the shutter. Give the right amout of power and it will press just like a human finger. Woot.

Other than the motors, there are 4 sensors - ultrasonic (to “see” like bats), sound (mic), touch and light. Am having a ball of time to develop code in NXC on my Mac. A major part of the fun is in multithreaded event programming, using mutex and semaphores. Downloaded a very convenient compiler from Bricxcc and it is a breeze to compile and send the binary program to the robot over bluetooth. Here are the commands:

$ nbc prog.nxc -O=prog.rxe
$ nxtcom -v -S=/dev/tty.NXT-DevB-1 prog.rxe

To generate the tty for the bluetooth, I followed the instructions here:
http://juju.org/articles/2006/10/22/bluetooth-serial-port-to-nxt-in-osx

I am targetting to have these features for demo on Monday:
1. Front bumper hits something => move back a bit and take a picture.
2. Some obstacle comes in front and stays there for a few seconds => take a picture.
3. Explore the room intelligently.

More photos here.

jQuery - best javascript library till date

Monday, January 14th, 2008

I have been using javascript extensively at work for over 2 years, and YUI for the most part of it. Even a few days back I didn’t know about jQuery. I was building my professional photography website and was discussing designs with my good friend and photographer Francesco. When I was done, our sites resembled a lot and Francesco suddenly got the urge to renovate his professional portfolio. He had been using jQuery at work, and in just a day he put up a gallery with top-of-the-line look and feel with soothing effects. I could not believe something existed that was much better than YUI so we compared code fragments. The conciseness and power of jQuery language blew me over, especially the $() selector. I added some cool effects on my site in a very short time and realized I could not do that with such simplicity had I used YUI.

I did not stop at that. I renovated my main website last Sunday, with a few hours of labor, mostly spent in GIMP to make some cool icons to go hand in hand with the magic of jQuery. I am very happy with it now and planning to do more changes to the site soon.

Big thanks to Francesco for opening this wonderful javascript world to me.

rsync rocks !

Saturday, November 24th, 2007

A major part of my photography workflow is backing up the newer image files. It has been a little slow and cumbersome so far as I was using the unix “diff” program to find out which directories/files need to be copied to the usb hard drive. It was tremendously slow to show the changes on stdout before I could run the copy commands in batches.

I was finally fed up and ran some searches when the unix “rsync” program showed up. Voila. It runs a gazillion times faster than “diff -r” and also allows me to dry run. Plus, I don’t have to run the copy commands separately.

I just did this to backup my local photo directory: (hdd is a symlink to the usb hard drive)

rsync -avzn ./photography/ ./hdd/photography/

Followed by removing the “n” switch and running the command again. Gotta love working with *nix.

The friggin’ mac is here !

Wednesday, November 21st, 2007

Got my first ever mac - a shiny new mac book pro. And no, my wallet didn’t get lighter. Had a really long wait to get my POS windows laptop swapped to get this to actually use it for work. Did I say “work” ? Compared to the experience of using a mac, windows just seems a crappy environment to get any useful work done reliably. I had so many instances of the XP disappointing me at the times of need (slowing down, wireless acting up, freezing, blah blah) that I had to demote its use to only the Firefox browser 90% of the time. Even then I had to close it before putting to standby, else with 95.25% chance it would freeze up next day, wasting a good 30 min of my time.

At work, nothing could be better. I am now all up and energized to learn developing flash, and what is a better environment than OSX where everything works seamlessly. It is made for developers and artists and am loving every bit of it.

Now the mac is here, my dark days are gone. I am playing with it like a kid with a new toy, and not getting bored at all. The mac keeps stunning me with its interface and the fact that everything just plain works seems incredible. On the first day itself I took a bunch of pics using photo booth and made a fun movie using iMovie. What a hoot ! I am now thinking of taking actual movie clips along a storyline and try my hand at documentary making.

Here is the movie I made. Enjoy.

Got an iPhone

Friday, October 5th, 2007

I am not a latest-greatest gadget guy, and never been. I could have been happy with my simple Nokia handset but after missing a few emergency text messages from office due to T-Mobile’s inferior network necessiated a change of carrier. I never even get a bar of signal inside office, so my phone is always useless when I am at work. I wanted to switch to cingular, but just got lazy, till the iPhone happened. I thought maybe I would wait till the price goes a bit south, but after playing with it from a co-worker I had to bite the bullet. I would say this is by far the best electronic gadget I put my hands on.

Now I can have the following for just $20 more per month:

1. Unlimited use of the internet. Never miss an email even when on road. I can even blog while on a motorcycle trip, no need for a laptop. Typing is incredibly fast, even better that a blackberry/treo.
2. Phone will be functional in my office. Finally !!!
3. Text messaging plan included.
4. Lots of useful apps like stock watcher, weather, etc.
5. Love the maps, just wish it had a GPS too.

The purchase was also the best experience ever. At the crowded apple store I anticipated a long wait. The sales guy with a handheld device scanned the new package, swiped my credit card, checked my driving license and took my signature. Less than 10 seconds, no lengthy forms, no bullshit, and I got my iPhone. They sent me the receipt by email. Gotta love this company. Piyush also got his at the same time.

Gotta activate and start using it now.

Update after activation (Fri Oct 5, 2:06 AM): There is just no word to describe the utility of this gadget, it is just incredible. Thank you apple, my life just got a lot easier. Wish I bought some AAPL last year !!!

What ? No more XML in AJAX ?

Thursday, February 16th, 2006

Yeah, it seems like the emerging JSON format makes much more sense than having XML as the data-interchange format. In today’s data saturated world, web-programmers would be blissfully happy if the data doesn’t need some complex parsing. And JSON does just that. Consider a fragment of structured data that many “Ajax-ed” application of today could be receiving over the web:

firstname = Velma, lastname = Kelly

While the xml version could be (that needs parsing):

<name>
  <firstname>Velma</firstname>
  <lastname>Kelly</lastname>
</name>

JSON is:

{'firstname':'Velma', 'lastname':'Kelly'}

which doesn’t need parsing at all. The json data as a string can be converted to a javascript object and used like this:

var jsonObj = eval ( '(' + jsonObjAsString + ')' );
var fname = jsonObj.firstname; // or jsonObj['firstname']

Useful, right ? And consider how much less space and effort it takes to handle JSON. Clearly the preferred data interchange format for the dynamic web applications, many of which can’t even use XHR (XmlHttpRequest) because of crossdomain security issue of browsers. The solution is using dynamic script elements and using JSON just makes the whole effort a lot easier.

Here is Douglas Crockford’s interesting blog post.