Uncertain Binary Thoughts
01110100110101010101011101100010
01110100110101010101011101100010
Jan 1st
It has been some time since i have worked on a ‘significant’ side project, i have started to feel a slow down in the number of side projects i do not because of my full time work at Zynga but because i have become too lazy, to break this chain and to make sure i at least work on some project i have decided to work on a side project at least once in 2 weeks, i hope i will be able to keep this new year resolution.
Few weeks ago i tried my hands on Yii i really liked it, its simple, easy and efficient !! which made me wonder how much effort is there in writing a MVC framework in PHP, few hours work and the result was mvc-php (ya i suck at giving names to projects), i have used mod_rewrite and got basic controllers working, now working on getting Smarty integrated but still cant decide on what to use for models, was thinking about doctrine but it looks bulky, i still have no particular use case for mvc-php, i hope it gets some where
Nov 14th
A few weeks back i bought a new monitor Dell U2312HM, its a brilliant monitor with support for portrait/landscape switching.
so as it always happens after buying a new monitor i planned a movie night and ran into the screen lock problem, i have set 2 minute timeout for screen lock and some why changing screen settings didn’t work, i knew i had to find a solution and fast or the above xkcd might actually happen with me
so this is what i came up with, having worked with X bindings before for Game-on this was done in under 5 mins (after reading some docs) , another day saved all thanks to Linux, X11 and previous X11 binding experience
This code moves the mouse pointer back and forth every few seconds, which is defined in DURATION
Oct 2nd
In continuation of Weekend Project IV, i have updated the code to work with the a graphics LCD, i am using JHD 12864e it works on Ks0108 driver, earlier i was writing my own driver for this graphic LCD but i found that Arduino already has support for the LCD using the GLCD library and its pretty awesome.
here is the working
Sep 25th
Few days back i bought an Arduino UNO board, this is my first Arduino Project and it was damn easy!! I can see the power that Arduino has to offer for hobbyist, i have worked on 8051 and few avr (without Arduino) before, doing stuff with an arduino is pretty easy and straightforward.
In this weekend project i am using a JHD162a (16×2 LCD) connected with Arduino UNO to display the name of the current song being played, i am running mpd on my machine so have used python-mpd to retrieve song info and pyserial to transfer the data over UART to UNO, the UNO just spits out the data received over UART to the LCD.
This is a copy of my earlier project which i did in my third year in college, but that was using a 8051 and i wrote a library (code available here) to control the LCD, currently i am using the LiquidCrystal Arduino library for that.
here is the demonstration
UPDATE -> song name, artist and time also added, video here
PS – you might also want to see the extremely cheap CNC machine being made by one of my friend
Jul 4th


The experience at Citrix was great mostly because of the kind of work and guidance i was given, we arrived in Bangalore on 3rd Jan, it was weird that no accommodation was provided to us for the initial weeks, but since manipal is one night journey away from bangalore, we came here after our exams and searched for a flat, we finally decided on a flat in Cambridge Layout (near Indiarnagar) since it was pretty close to our work place which was near brigade road !! I was working with the NetScaler Tools team on a internal stress testing tool called BlackWidow, the best thing about my work at citrix was that i had to work with FreeBSD kernel, which meant i had to use *NIX development tools (cscope/vim/kgdb which is what i am pretty comfortable with) and not some bloated IDE (for me Vim + cscope > any IDE) which i had to learn for my last internship at microsoft, this helped me get started pretty quickly which surprised my mentor, although i was not assigned the feature i wanted to implement still my work was pretty interesting.
I found Citrix to be a really awesome company to work at, it has a lot of interesting products, the people are friendly and helpful and the work culture is great, ohh and not to forget the facilities they provide to employees, but one thing that I noticed during my internship is that the work can become monotonous, so you really need to pitch in and get some interesting work or one might end up doing similar work again and again, but then i think thats the case with most of the places.

The main motive behind me coming to bangalore was meeting interesting people, not that people in Manipal were less interesting, i wanted to meet with some ‘similar’ minded people. I had hardly talked to other people from my college who interned with me, but they turned out be interesting, also interns from other colleges like PeeShit (read PESIT) were interesting. I didnt actually went out to meet people, but then i guess i can do that now as i am going to stay in bangalore. A few days back i met folks at Artoo on their Demo Day, they are doing some really interesting work.

My internship is over but I will be staying in Bangalore for my first full time job, i have a few on campus and off campus offers but more on that some time later, Thanks to my flat mates Mikhail Jacob, Sohil Himanish and Tushar Dadlani for making my stay in Bangalore awesome and Thanks to my mentor, manager, all fellow interns and everyone else at citrix for making my work awesome, you people rock !!
Mar 13th
I remember my first encounter with epoll some time back trying to get a simple server working, implementing a proxy and then a few days back i saw one of my friend trying to get started with epoll, which made me think it will be good to have a simple wrapper around epoll which will allow me to get started with the application and not worry about epoll specifics and at the same time providing enough control, so i wrote a small wrapper with callbacks, which has been quite helpful for my epoll usage, here is the interface poll.h
code and a sample can be found on github
PS – just checkout libevent which is an awesome battle tested event notification library, and a quick getting started
Mar 11th
I was working on a code where i had to lookup a structure based on the file descriptor (socket) again and again in a code, i was using a linked list initially but as the nodes grew i knew i should use a hash table, so i wrote a simple hash table implementation which did the work.
its a just works implementation there are a lot of thing which can be added like a perfect hash function but as long as hash table is not the bottle neck this should work, code can be found on github
file hashtable.h contains the definition
More >
Oct 4th
few days ago i came upon an article about human computer interactions which mentioned different ways we interact with computes and how we will interact with computers in future, the article instantly reminded me of MPX, now i dont know how many of you remember MPX which enabled interaction of multiple mouse/keyboards in linux. Xserver 1.7 which is used in most of the disto’s was released with MPX, so i decided to find out how to make it work on my existing Fedora 13 box, and using it is pretty simple you just need to use xinput and configure X for multiple input, for that you first need to install xinput, on fedora it is provided by the package “xorg-x11-apps” just do a
[ankur@x144 ankur]# yum install xorg-x11-apps -y
and you are done, for other distro’s i guess there sould be a similar package, after the install we need to find what all is plugged in to the computer, for that we do “xinput list”
[ankur@x144 ankur]# xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ PS/2 Mouse id=14 [slave pointer (2)] ⎜ ↳ AlpsPS/2 ALPS GlidePoint id=15 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Video Bus id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ Sleep Button id=8 [slave keyboard (3)] ↳ Laptop Integrated Webcam id=9 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)] ↳ Dell WMI hotkeys id=16 [slave keyboard (3)]
this returns a list of all the input devices, i am running this on my laptop so you can see “AlpsPS/2 ALPS GlidePoint” and “AT Translated Set 2 keyboard” which are my laptop’s mouse and keyboard, to enable multiple keyboard/mouse i will create a group and move my laptops mouse and keyboard to the group,
[ankur@x144 ankur]# xinput create-master main
[ankur@x144 ankur]# xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ PS/2 Mouse id=14 [slave pointer (2)]
⎜ ↳ AlpsPS/2 ALPS GlidePoint id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Video Bus id=6 [slave keyboard (3)]
↳ Power Button id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Laptop Integrated Webcam id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
↳ Dell WMI hotkeys id=16 [slave keyboard (3)]
⎡ main pointer id=10 [master pointer (11)]
⎜ ↳ laptop XTEST pointer id=12 [slave pointer (10)]
⎣ main keyboard id=11 [master keyboard (10)]
↳ laptop XTEST keyboard id=17 [slave keyboard (11)]
above i created a group by the name “main”, you can see a second mouse cursor on screen as soon as you do this, to make both these mouse/keyboard active i will move my laptop’s mouse (id-> 15) and keyboard (id-> 13) to this newly created group
[ankur@x144 ankur]# xinput reattach 15 10 [ankur@x144 ankur]# xinput reattach 13 11
now if i connect an external mouse and keyboard to my laptop i can see both working simultaneously, if you want multiple (more then 2) mouse and keyboards to work, you can create a separate group for them and move them to that group in a similar manner.
after doing this I was not able to find any benefit of using multiple mouse/keyboard on a laptop but it will make sense when you have multi monitor setup and multiple users trying to use the same machine simultaneously.
Sep 25th
Few weeks ago I posted about playing pong using tilt sensors on the phone, Now me and Abhimanyu have taken that to the next level and have made it a generic game controller for any game running on the computer. We faced some problems when Abhimanyu’s Samsung Wave refused to work, but luckily i bought a Samsung Galaxy 3 (Android 2.1) about a week before that, so we shifted out focus on Android.
For Game On we make use of the phone’s sensors and touch screen to generate different gestures and motion events, we use these events to generate control data and sent the control data over a socket to the computer over a wireless network. On the PC the received data (different for each motion event or gesture) is processed by the computer and a specific task is performed, in this case generating a Key Event.
The Code for Game On can be found on github
Here is a video of the android phone (Samsung I5800 Galaxy 3) being used to control a car racing game.
And now the working
After this we decided to work on something which i wanted to finish a long time ago (remember Weekend Project I) so we finished Weekend Project III which is well Weekend Project I + Weekend Project II
And the working of Weekend Project III
The Data Flow is Phone —-WiFi—-> PC —-USB—-> USB to RS232 Converter —-UART—-> MicroControler —-Relays—-> Toy Car Remote —-RF—-> Toy Car, which is almost same as that of Weekend Project I, except for processing of Sensor Data on Phone.
PS – if you were not able to look at the video’s above they can be found here, here, here and here, also Game On won 2nd prize in Mobi Vision – a mobile application development competition
Aug 29th
In march i posted about a weekend project which involved controlling a small toy car using my cell phone, this is a similar one again implemented in few hours, here we are trying to play the awesome game of pong using the tilt sensor on Samsung Wave. The pong application running on Laptop is written in Qt (C++) and the application on the Phone is written using the Bada SDK.
The working is simple, the pong application running on Laptop requires phones to make a TCP connection to it. Phones just create a TCP connection to the application on PC and sends tilt sensor data to it, movement of paddles is done by the PC application based on the value it receives from the phones. It still requires better calibration and we will work on it after the exams are over (Education prevents you from doing cool things!!), there are a lot of ideas buzzing in our empty heads (according to our teachers!!) , the original idea was by Abhimanyu which we implemented.
if you cannot see the above video here and here are short demo of how it works.
PS – code and proper working for the previous and this weekend project will be posted soon!