Dissecting my wedding program

A couple of people to whom I gave my wedding card, were not able to fully understand the program that I wrote in it and have asked me to explain it. Now that I have kind of settled a bit after my wedding, I thought of dissecting the program and explain it.

Code

Letโ€™s have a look at the code one more time.

My marriage Invitation

You can also get the code from github.

Language

To start of the program was written in JavaScript. Whoever feels that JavaScript is not a *real* programming language, should first read these articles by Douglas Crockford.

Anonymous Function

The program starts with an anonymous function. This is not strictly needed by JavaScript syntax, but it is always considered a good practise to do and I generally do it in all JavaScript code that I write.

Object variables

Next, I create two instances of the Person object. This is similar to creating objects in any object oriented programming language.

Information about wedding

As you might have guessed, gettingMarried function is that one which prints the information about the marriage. I am passing a JSON object to the function as an argument with the required information.

Checking the responsibility

This is the main crux of the invitation. I am verifying the responsibility before the marriage and after the marriage.

If you look closely at the isResponsible function, you will note that it has a special condition, which will always return false for me, irrespective of my marital status. The hidden message is that, I will never change after marriage. Itโ€™s going to be month since I am married and I can say that I havenโ€™t changed yet. Hoping that it continues for the rest of my life ๐Ÿ˜‰

Posted in Random/Personal | Tagged , , | 3 Comments

How I designed my wedding invitation

Well, as most of you know, I am getting married in a couple of weeks. One of the important things which I needed to do for my marriage was to print the wedding invitation card.

I am not that good at writing stuff that needs to be put on the invitation card, so instead I did what I do best. I wrote code ๐Ÿ˜‰ Yes both figuratively and literally ๐Ÿ™‚ Need proof? check the photographs.

My marriage Invitation

Code

After deciding that I wanted to write code, I had to decide the language. Initially I thought of writing an HTML document with tags. But somehow I was not convinced that HTML is a real programming language (okay, I am not here for a language war ๐Ÿ˜‰ ).

After giving some more thought on it, I decided to do it in JavaScript. It was also fitting that I do it in JavaScript, since I had been mostly a web developer through out my career.

After a few minutes I had the basic version. After a couple of revisions, I finally came up with this version.

Update: I have also posted an explanation of this code, if in case JavaScript is not your cup of tea.

Screenshot

After completing the program (which I nicknamed as the “program that changed my life”), I had to decide how to print it on the card. Navneet Nair, who works with me, suggested me to put a screenshot of my IDE with the code inside.

Even I liked the idea and thatโ€™s how I decided to take a screenshot of my IDE and have it printed as the card.

Vim/Vi

This was a pretty easy decision to make. I was typing the code in vim (macVim to be exact) and after trying out a couple of color schemes, I finally settled on the desert color scheme

Envelope

The next step was to design the envelope. I did a basic version in Photoshop, by picking up some quotes from the programmer Ryan Gosling meme and placing them in comic sans font ๐Ÿ™‚ I then asked Navneet if he would like to change anything. He looked at it and said that he would like to change everything ๐Ÿ˜‰ He then did a quick design in Illustrator with the quotes and it came out very well.

NFC

I wanted to increase the geeky quotient of my wedding invitation a little more and thatโ€™s when I thought of embedding NFC chips in the card.

I first heard about NFC in Googleโ€™s IO last year and first saw it in action at DroidCon organized by HasGeek a couple of months before. I got hold of the person who had a stall at DroidCon and bought NFC stickers from him. They were a little costly but added a lot of geekness to the invitation ๐Ÿ˜‰

I then used the NFC Tag Writer Android app, to write a url on these NFC chips. If you tap an NFC enabled phone on my invitation, it will automatically open up a url which has information about my marriage, address and map to the marriage hall etc.

QR code

After doing the NFC stuff, I realized that most may not have a NFC enabled phone. That’s when I remembered about QR codes and generated one.

If I had time, I could have loved to customize the QR code a bit, but I didn’t have much time, so settled with the default one. You can find it at the back of the envelope.

Printing

After designing both the card and the envelope, I worked with a person from a print shop called PrintWorks who helped me get it printed. They were very helpful and delivered stuff on time and I highly recommend them.

Files

All my design files including the JavaScript source file are available at github. Feel free to use them for your own wedding (if you are not married yet ๐Ÿ˜‰ )

Credits

There are couple of people who helped me to get this card designed and printed. A huge thanks to all of them.

  • Navneet Nair, who works with me at Yahoo.
  • Swamy from PrintWorks
  • Kiran from hasgeek

Ohh, btw donโ€™t forget to be present for my wedding ๐Ÿ˜‰

Update:ย  The following are some of the words which people said after seeing my invitation ๐Ÿ™‚

  • Amazing..
  • The geeket card ever..
  • Collector’s piece..
  • I am gonna frame it ..

Posted in Random/Personal | Tagged , , , , | 58 Comments

Using ez430 to control PPTs in Mac

After seeing me using my ez430, programmable watch to control ppt’s in my Mac, a couple of people asked me explain how I do it. As usual, instead of sending separate emails, I thought of documenting it here, so that it would be useful for others.

The following are the steps you need to follow.

  • Plugin the ez430 USB dongle to the USB port of your Mac
  • Pair the USB dongle and your ez430 watch
  • Install python and Serial library
  • Download or clone the ez430 tools repo from github
  • Open up your ppt presentation
  • Open terminal, navigate to the directory where you have ez430 tools package files and then type the command python ppt-mac.py
  • And you are done ๐Ÿ™‚

Let me know if you face any issues.

Posted in Gadgets, Python | Tagged , , | 6 Comments

Generating dynamic files for download from PHP

If you have used my WordPress readme generator you would have noticed that I have a “Save As” button, which when pressed allows you to download the file which was just generated by the PHP code. (In most browsers this opens the save file as dialog box)

Recently one of the readers of my blog asked me how to do this in PHP and I was about to send him the code snippet. But then I thought of writing a blog article so that it will be useful for others as well.

So here we go.

The code is mostly self explanatory. The important part in the above code snippet is the “content Disposition” header.

Also since we are sending headers to the browser, we should not have started the output before this code executes. Otherwise we might get a “header already sent” error.

Posted in Web Programming | Tagged , , | 3 Comments

Looking back at 2011

2011 had been a great year and it just ended. I thought of publishing my year end review for 2011 as I did for the previous years.

Personal Highlight

Finally..

Well do I have to explain anything more? ๐Ÿ˜‰

For those who are still staring at the picture, yes I am โ€œformallyโ€ engaged now ๐Ÿ™‚ My marriage is going to be on Feb 6th 2012 (Just another 21 days to go)

Other highlights in 2011

Apart from the big personal update the following are some of the other highlights of 2011.

I started of the year by changing the permalink of my blog, had a most memorable day on top of a hill, released my first Arduino library, met my idol Doug for the first time in person, went to a couple of HackU events, released my gist-it WordPress Plugin, bought an interesting toy, created my pet bot Asimi, gave a couple of talks and finally experienced snowfall for the first time in my life.

Travel highlights

On the travel front I had a pretty good year. Following are some of my travel highlights

Blog Stats

The following are my blog stats generated by my Year End stats WordPress Plugin.

no-of-posts-2011ย no-of-comments-2011

avg-length-of-posts-2011ย total-no-chars

At the starting of 2011, I wanted to increase the average size of the blog post that I write and I have succeeded in that.

But, when compared with the previous years, I have written fewer posts. Getting committed, travelling places and what else you can expect ๐Ÿ˜‰

With me getting married in 2012 I am not sure how much free time I will get, but I will definitely try my best to increase the count in 2012.

Whatโ€™s in the card for 2012?

I am planning to spend more time on Android and Arduino stuff and also planning to enhance my pet bot Asimi. So expect some news about some cool projects. ๐Ÿ˜‰

Well, from the personal front, I am going to get married in 2012. Not sure what to expect out of it, but I am eagerly waiting for it. Itโ€™s kind of really exciting to realize that you have finally found someone with whom you are going to spend the rest of your life. ๐Ÿ™‚

So how was 2011 for you?

Posted in Random/Personal | Tagged , , , , , | 4 Comments

My first experience with snowfall

One of the advantage as well as disadvantage of living in the southern part of India is that, you never get to witness snow fall. We get to witness snowfall only in movies or in malls where it is just cotton and not real snow.

But during my recent series of vacation, I witnessed snowfall for the first time ever in my entire life. It was one of those memorable moments in my life.

I was returning to India from US and my connecting flight was in Frankfurt, Germany and it is where I witnessed snowfall ๐Ÿ™‚ My flight got delayed a bit, but who cared ๐Ÿ˜‰

I didnโ€™t know till then that snow while falling is soft. I always confused it with ice and assumed that it would be hard. When I got down from the flight, snow was floating in the air like a feather and it slowly kissed my skin. After it touched me, it slowly melted into water droplets. It was one of those memorable moments of my life, which you will remember for a long time.

Following are some of the photos that I took using my mobile, while enjoying the snowfall. I seriously wished that I had a decent camera with me at that time.

Snowfall in Frankfurt Airport Snowfall in Frankfurt Airport Snowfall in Frankfurt Airport Snowfall in Frankfurt Airport

I also took these photos when my flight was over Iceland. You can see the frozen Atlantic ocean along the shore.

Flight over Iceland Flight over Iceland Flight over Iceland

One more highlight of the trip is that, on four consecutive days, I boarded 4 flights, visited 6 airports and landed in 3 different countries in 3 different continents.

Letโ€™s see if I get a chance to break my own record ๐Ÿ˜‰

Posted in Travel/Trek | Tagged , , , | 2 Comments

My plan for December

Regular readers of my blog would now that I generally will be busy in December travelling. But this year, itโ€™s crazy ๐Ÿ˜‰

Here is an outline of my plan for December. You yourself can figure out whether it is crazy or not ๐Ÿ™‚

I am leaving to Goa on 1st of December for team outing with my teammates and will be back to Bangalore on 3rd night. Then the next day (4th Dec) I am leaving to US on a Business trip. After spending two weeks there, I will be back to Bangalore on 21st Morning. That evening I have a party at office. And after that, my office is closed for forced year-end vacation in which I will be travelling again (even though I havenโ€™t finalized the place yet).

Ohh, by the way, did I mention that I have two weekends in US and I am planning to go Las Vegas in one weekend and to New York in the other.

And did I mention that I am missing two other outings from office because I donโ€™t have enough days in December ๐Ÿ˜‰

Is it crazy enough ๐Ÿ™‚

So if you sent me an email and if I havenโ€™t responded back, then you know why ๐Ÿ™‚

Meet you all in 2012 guys.

Posted in Random/Personal, Travel/Trek | Tagged , | 4 Comments

Building Robots using Arduino and Android at DroidCon

I just came back from yet another amazing event by HasGeek. This time it is DroidCon.

DroidCon

DroidCon is a developer conference and is part of worldโ€™s largest series of Android conferences. It happened at Bangalore on 18th and 19th of November.

Continue reading »

Posted in Android/Java, Arduino, Events/Conferences | Tagged , , , , , | 19 Comments

Programmable watch – My new Geek toy

I have added a new addition to my existing list of geek toys. This time it the programmable watch ez430 by Texas instruments.EZ430-Chronos

Yes you heard it right; it is a watch which you can (re)program ๐Ÿ˜‰

Features

The following are some of its features

  • MSP430 with integrated <1GHz wireless transceiver
  • On-board 3-axis accelerometer
  • Pressure sensor
  • Temperature sensor
  • Battery voltage sensor
  • 96-Segment LCD display driven directly by CC430
  • Includes an eZ430 USB emulator that connects the Chronos to a PC for real-time, in-system programming and debugging
  • Can be paired wirelessly with other RF based devices
  • And of course you can see time as well ๐Ÿ˜‰

Video

Here is a video introducing the watch by Texas Instruments

I am currently working on a couple of ideas like integrating this watch with Arduino etc. So stay tuned. Meanwhile if you see me waving hands in the air, look carefully, I might be controlling the nearby devices using gestures ๐Ÿ˜‰

Posted in Arduino | Tagged , , | 9 Comments

Yahoo HackU at IIT-Delhi

This past weekend, Yahoo conducted HackU (Hackday for university) at IIT – Delhi and I was part of the Technical crew that conducted the event.

In the event, I talked about Yahoo Query Language (YQL) and thought of sharing the slides here so that it could be useful for others as well.

Continue reading »

Posted in Events/Conferences | Tagged , , | 4 Comments