<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Uncertain Binary Thoughts &#187; Stuff</title>
	<atom:link href="http://ankurs.com/category/stuff/feed/" rel="self" type="application/rss+xml" />
	<link>http://ankurs.com</link>
	<description>01110100110101010101011101100010</description>
	<lastBuildDate>Sun, 01 Jan 2012 18:20:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Simple MVC implementation for PHP</title>
		<link>http://ankurs.com/2012/01/simple-mvc-implementation-for-php/</link>
		<comments>http://ankurs.com/2012/01/simple-mvc-implementation-for-php/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 18:20:56 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[year]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=867</guid>
		<description><![CDATA[It has been some time since i have worked on a &#8216;significant&#8217; 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&#8230;]]></description>
			<content:encoded><![CDATA[<p>It has been some time since i have worked on a &#8216;significant&#8217; 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.<br />
Few weeks ago i tried my hands on <a href="http://www.yiiframework.com/" target="_blank">Yii</a> 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 <a href="https://github.com/ankurs/mvc-php" target="_blank">mvc-php</a> (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 <a href="http://www.doctrine-project.org/projects/orm" target="_blank">doctrine</a> but it looks bulky, i still have no particular use case for mvc-php, i hope it gets some where <img src='http://ankurs.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2012/01/simple-mvc-implementation-for-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Command Line Fu</title>
		<link>http://ankurs.com/2011/11/command-line-fu/</link>
		<comments>http://ankurs.com/2011/11/command-line-fu/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 18:46:12 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[timeout]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xkcd]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=847</guid>
		<description><![CDATA[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&#8230;]]></description>
			<content:encoded><![CDATA[<div id="attachment_848" class="wp-caption aligncenter" style="width: 750px"><a href="http://ankurs.com/wp-content/uploads/2011/11/command_line_fu.png"><img class="size-full wp-image-848" title="command_line_fu" src="http://ankurs.com/wp-content/uploads/2011/11/command_line_fu.png" alt="" width="740" height="232" /></a><p class="wp-caption-text">http://xkcd.com/196/</p></div>
<p>A few weeks back i bought a new monitor Dell U2312HM, its a brilliant monitor with support for portrait/landscape switching.<br />
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&#8217;t work, i knew i had to find a solution and fast or the above xkcd might actually happen with me</p>
<p>so this is what i came up with, having worked with X bindings before for <a href="http://ankurs.com/2010/09/game-on-weekend-project-iii/" target="_blank">Game-on</a> this was done in under 5 mins (after reading some docs) , another day saved all thanks to Linux, X11 and previous X11 binding experience <img src='http://ankurs.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>This code moves the mouse pointer back and forth every few seconds, which is defined in DURATION<br />
<script src="https://gist.github.com/1362439.js"> </script></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2011/11/command-line-fu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Weekend Project IV Part 2</title>
		<link>http://ankurs.com/2011/10/weekend-project-iv-part-2/</link>
		<comments>http://ankurs.com/2011/10/weekend-project-iv-part-2/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 12:20:33 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=842</guid>
		<description><![CDATA[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&#8230;]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p><a href="http://www.youtube.com/watch?v=sy_zdzZAXQo" target="_blank">here</a> is the working<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/sy_zdzZAXQo" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2011/10/weekend-project-iv-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weekend Project IV</title>
		<link>http://ankurs.com/2011/09/weekend-project-iv/</link>
		<comments>http://ankurs.com/2011/09/weekend-project-iv/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 21:12:15 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[lcd]]></category>
		<category><![CDATA[name]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[song]]></category>
		<category><![CDATA[weekend]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=830</guid>
		<description><![CDATA[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&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/ankurkingofnet/6179145988/" title="Arduino UNO by Ankur Shrivastava, on Flickr"><img src="http://farm7.static.flickr.com/6163/6179145988_51e62f102e.jpg" width="500" height="299" alt="Arduino UNO"></a></p>
<p>Few days back i bought an <a href="http://arduino.cc/en/Main/ArduinoBoardUno" target="_blank">Arduino UNO</a> 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.</p>
<p>In this weekend project i am using a JHD162a (16&#215;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.<br />
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 <a href="https://github.com/ankurs/uC-Dump/blob/master/lcd.asm" target="_blank">here</a>) to control the LCD, currently i am using the LiquidCrystal Arduino library for that.<br />
<a href="http://www.youtube.com/watch?v=n5dBDtErR34" target="_blank"><br />
here</a> is the demonstration<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/n5dBDtErR34" frameborder="0" allowfullscreen></iframe></p>
<p>UPDATE -> song name, artist and time also added, video <a href="http://youtu.be/7rC9crdnKwA" target="_blank">here</a><br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/7rC9crdnKwA" frameborder="0" allowfullscreen></iframe></p>
<p>PS &#8211; you might also want to see the extremely cheap <a href="http://muditsdiy.blogspot.com/2011/09/sneak-peek-cnc-part-iii.html" target="_blank">CNC machine</a> being made by one of my friend  </p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2011/09/weekend-project-iv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>6 months in Citrix / Bangalore</title>
		<link>http://ankurs.com/2011/07/6-months-in-citrix-bangalore/</link>
		<comments>http://ankurs.com/2011/07/6-months-in-citrix-bangalore/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 20:48:59 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[college]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[bangalore]]></category>
		<category><![CDATA[citrix]]></category>
		<category><![CDATA[internship]]></category>
		<category><![CDATA[manipal]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=786</guid>
		<description><![CDATA[Lot of time has passed since i last updated my blog, i have finished the 7th Semester of my engineering and just one step from my degree, i have moved from Manipal to Bangalore for my last (8th) semester and I was interning at Citrix Systems, working with NetScaler Tools team. The last few days&#8230;]]></description>
			<content:encoded><![CDATA[<p><center><a href="http://www.flickr.com/photos/ankurkingofnet/5544476378/" title="IMAG0019 by Ankur Shrivastava, on Flickr"><img src="http://farm6.static.flickr.com/5014/5544476378_c8974416fa.jpg" width="500" height="299" alt="IMAG0019" /></a></center><br />
Lot of time has passed since i last updated my blog, i have finished the 7th Semester of my engineering and just one step from my degree, i have moved from <a href="http://en.wikipedia.org/wiki/Manipal">Manipal</a> to <a href="http://en.wikipedia.org/wiki/Bangalore">Bangalore</a> for my last (8th) semester and I was interning at <a href="http://en.wikipedia.org/wiki/Citrix">Citrix Systems</a>, working with <a href="http://www.citrix.com/netscaler">NetScaler</a> Tools team. The last few days as a college student have turned out to be awesome, living in Bangalore with friends is fun (except for Bangalore&#8217;s night life which sucks big time). During the last 6 months i have learned at lot about life, universe and everything :p .</p>
<p><center><a href="http://www.flickr.com/photos/ankurkingofnet/5805348188/" title="Work work by Ankur Shrivastava, on Flickr"><img src="http://farm4.static.flickr.com/3464/5805348188_5e910b7748.jpg" width="500" height="299" alt="Work work"></a></center></p>
<p>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 <a href="http://ankurs.com/2010/06/4-weeks-at-microsoft/">internship at microsoft</a>, 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.</p>
<p>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.</p>
<p><center><a href="http://www.flickr.com/photos/ankurkingofnet/5901713551/" title="Last Day at Citrix by Ankur Shrivastava, on Flickr"><img src="http://farm6.static.flickr.com/5316/5901713551_f91e553a16.jpg" width="500" height="299" alt="Last Day at Citrix"></a></center></p>
<p>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 &#8216;similar&#8217; 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 <a href="http://artoo.in/">Artoo</a> on their Demo Day, they are doing some really interesting work.</p>
<p><center><a href="http://www.flickr.com/photos/ankurkingofnet/5734439490/" title="IMAG0110 by Ankur Shrivastava, on Flickr"><img src="http://farm4.static.flickr.com/3410/5734439490_886510a557.jpg" width="500" height="299" alt="IMAG0110"></a></center></p>
<p>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 !!</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2011/07/6-months-in-citrix-bangalore/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>multiple mouse / keyboard in linux</title>
		<link>http://ankurs.com/2010/10/multiple-mouse-keyboard-in-linux/</link>
		<comments>http://ankurs.com/2010/10/multiple-mouse-keyboard-in-linux/#comments</comments>
		<pubDate>Sun, 03 Oct 2010 20:33:26 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[mpx]]></category>
		<category><![CDATA[multiple]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=709</guid>
		<description><![CDATA[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&#8230;]]></description>
			<content:encoded><![CDATA[<div id="attachment_740" class="wp-caption aligncenter" style="width: 310px"><a href="http://ankurs.com/wp-content/uploads/2010/10/mpx.jpg"><img src="http://ankurs.com/wp-content/uploads/2010/10/mpx-300x225.jpg" alt="4 mouse cursors on a single screen" title="4 mouse cursors on a single screen" width="300" height="225" class="size-medium wp-image-740" /></a><p class="wp-caption-text">4 mouse cursors on a single screen</p></div>
<p>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 <a href="http://en.wikipedia.org/wiki/Multi-Pointer_X">MPX</a>, now i dont know how many of you remember <a href="http://en.wikipedia.org/wiki/Multi-Pointer_X">MPX</a> which enabled interaction of multiple mouse/keyboards in linux. <a href="http://en.wikipedia.org/wiki/X_Window_System">Xserver</a> 1.7 which is used in most of the disto&#8217;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 &#8220;xorg-x11-apps&#8221; just do a
<pre>[ankur@x144 ankur]# yum install xorg-x11-apps -y</pre>
<p> and you are done, for other distro&#8217;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 &#8220;xinput list&#8221;</p>
<pre>[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)]</pre>
<p>this returns a list of all the input devices, i am running this on my laptop so you can see &#8220;AlpsPS/2 ALPS GlidePoint&#8221; and &#8220;AT Translated Set 2 keyboard&#8221; which are my laptop&#8217;s mouse and keyboard, to enable multiple keyboard/mouse i will create a group and move my laptops mouse and keyboard to the group, </p>
<pre>[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)]
</pre>
<p>above i created a group by the name &#8220;main&#8221;, 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&#8217;s mouse (id-> 15) and keyboard (id-> 13) to this newly created group</p>
<pre>[ankur@x144 ankur]# xinput reattach 15 10
[ankur@x144 ankur]# xinput reattach 13 11</pre>
<p>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.<br />
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.</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2010/10/multiple-mouse-keyboard-in-linux/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Game On / Weekend Project III</title>
		<link>http://ankurs.com/2010/09/game-on-weekend-project-iii/</link>
		<comments>http://ankurs.com/2010/09/game-on-weekend-project-iii/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 17:30:36 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[college]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[manipal]]></category>
		<category><![CDATA[mobi]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[on]]></category>
		<category><![CDATA[pc]]></category>
		<category><![CDATA[techtatva]]></category>
		<category><![CDATA[vision]]></category>
		<category><![CDATA[x11]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=682</guid>
		<description><![CDATA[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&#8217;s Samsung Wave refused to work, but luckily i bought&#8230;]]></description>
			<content:encoded><![CDATA[<p>Few weeks ago I posted about playing <a href="http://ankurs.com/2010/08/weekend-project-ii/">pong using tilt sensors on the phone</a>, Now me and <a href="http://blog.abhimanyukumar.in/">Abhimanyu</a> 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&#8217;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.<br />
For Game On we make use of the phone&#8217;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.<br />
The Code for Game On can be found on <a href="http://github.com/ankurs/Game-On">github</a></p>
<p>Here is a video of the android phone (Samsung I5800 Galaxy 3) being used to control a car racing game.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/hWV37mYr6AQ?fs=1&amp;hl=en_US&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/hWV37mYr6AQ?fs=1&amp;hl=en_US&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>And now the working</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/D-YqEneKQk8?fs=1&amp;hl=en_US&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/D-YqEneKQk8?fs=1&amp;hl=en_US&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>After this we decided to work on something which i wanted to finish a long time ago (remember <a href="http://ankurs.com/2010/03/weekend-project/">Weekend Project I</a>) so we finished Weekend Project III which is well <a href="http://ankurs.com/2010/03/weekend-project/">Weekend Project I</a> + <a href="http://ankurs.com/2010/08/weekend-project-ii/">Weekend Project II</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/FdNOlLLFLkQ?fs=1&amp;hl=en_US&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/FdNOlLLFLkQ?fs=1&amp;hl=en_US&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>And the working of Weekend Project III</p>
<div id="attachment_684" class="wp-caption aligncenter" style="width: 510px"><a href="http://ankurs.com/wp-content/uploads/2010/09/Photo0017.jpg"><img class="size-medium wp-image-684" title="Weekend Project III Data Flow" src="http://ankurs.com/wp-content/uploads/2010/09/Photo0017-300x225.jpg" alt="Weekend Project III Data Flow" width="500" height="425" /></a><p class="wp-caption-text">Weekend Project III Data Flow</p></div>
<p>The Data Flow is Phone &#8212;-WiFi&#8212;-&gt; PC &#8212;-USB&#8212;-&gt; USB to <a href="http://en.wikipedia.org/wiki/RS232">RS232</a> Converter &#8212;-<a href="http://en.wikipedia.org/wiki/UART">UART</a>&#8212;-&gt; MicroControler &#8212;-<a href="http://en.wikipedia.org/wiki/Relay">Relays</a>&#8212;-&gt; Toy Car Remote &#8212;-RF&#8212;-&gt; Toy Car, which is almost same as that of <a href="http://ankurs.com/2010/03/weekend-project/">Weekend Project I</a>, except for processing of Sensor Data on Phone.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/m2UX83y48YY?fs=1&amp;hl=en_US&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/m2UX83y48YY?fs=1&amp;hl=en_US&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>PS &#8211; if you were not able to look at the video&#8217;s above they can be found <a href="http://www.youtube.com/watch?v=hWV37mYr6AQ">here</a>, <a href="http://www.youtube.com/watch?v=D-YqEneKQk8">here</a>, <a href="http://www.youtube.com/watch?v=FdNOlLLFLkQ">here</a> and <a href="http://www.youtube.com/watch?v=m2UX83y48YY">here</a>, also Game On won 2nd prize in Mobi Vision &#8211; a mobile application development competition</p>
<div id="attachment_699" class="wp-caption aligncenter" style="width: 310px"><a href="http://ankurs.com/wp-content/uploads/2010/09/2010-09-25-17.58.47.jpg"><img class="aligncenter size-medium wp-image-699" title="MobiVision in TextTatva and i dont exactly look like that cartoon depicting me !!" src="http://ankurs.com/wp-content/uploads/2010/09/2010-09-25-17.58.47-300x225.jpg" alt="MobiVision in TextTatva (by Ed Board Manipal)" width="300" height="225" /></a><p class="wp-caption-text">MobiVision in TextTatva and i dont exactly look like that cartoon depicting me !!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2010/09/game-on-weekend-project-iii/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Weekend Project II</title>
		<link>http://ankurs.com/2010/08/weekend-project-ii/</link>
		<comments>http://ankurs.com/2010/08/weekend-project-ii/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 16:22:33 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[bada]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[pong]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[samsung]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[tilt]]></category>
		<category><![CDATA[weekend]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=656</guid>
		<description><![CDATA[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&#8230;]]></description>
			<content:encoded><![CDATA[<p>In march i posted about a <a href="http://ankurs.com/2010/03/weekend-project/">weekend project</a> 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 <a href="http://qt.nokia.com/">Qt</a> (C++) and the application on the Phone is written using the <a href="http://www.bada.com/">Bada SDK</a>.<br />
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 <strong>requires better calibration</strong> 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 <a href="http://abhikumar777.blogspot.com/">Abhimanyu</a> which we implemented.</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/dHinEjh8iIw?fs=1&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/dHinEjh8iIw?fs=1&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/Aw15OuquzcQ?fs=1&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Aw15OuquzcQ?fs=1&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>if you cannot see the above video <a href="http://www.youtube.com/watch?v=dHinEjh8iIw">here</a> and <a href="http://www.youtube.com/watch?v=Aw15OuquzcQ">here</a> are short demo of how it works.</p>
<p>PS &#8211; code and proper working for the previous and this weekend project will be posted soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2010/08/weekend-project-ii/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Weekend Project</title>
		<link>http://ankurs.com/2010/03/weekend-project/</link>
		<comments>http://ankurs.com/2010/03/weekend-project/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 19:52:34 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[college]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[car]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[rf]]></category>
		<category><![CDATA[toy]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=607</guid>
		<description><![CDATA[In Dec 2009 at foss.in at the maemo stall i saw a guy control a small toy car through accelerometer on his N900, i thought of replicating that but it just remained in my mind, so last Saturday i finally decided to implement it and went straight to a toy store and bought a toy&#8230;]]></description>
			<content:encoded><![CDATA[<p>In Dec 2009 at foss.in at the maemo stall i saw a guy control a small toy car through accelerometer on his N900, i thought of replicating that but it just remained in my mind, so last Saturday i finally decided to implement it and went straight to a toy store and bought a toy RF car, one hour of hacking and i was able to control the small car through by phone (Nokia E61i) here is the video of it working.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/tdfnt-a7vkM&amp;hl=en_US&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/tdfnt-a7vkM&amp;hl=en_US&amp;fs=1&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/XK8eOvkX14U&amp;hl=en_US&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/XK8eOvkX14U&amp;hl=en_US&amp;fs=1&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>the concept is simple, i send commands through my phone over wifi to my laptop which controls the car remote, controlling a toy car remote is very easy with a Parallel port and few transistors but laptops don&#8217;t have parallel ports, so i used a micro-controller in between to sort that out, so now micro controller controls the car remote by acting on signals received over UART from laptop.<br />
the working is Phone &#8212;(WiFi)&#8212;&gt;Laptop &#8212;(USB/UART)&#8212;&gt; Micro controller &#8212;(Relays)&#8212;&gt; Car Remote &#8212;(RF)&#8212;&gt; Toy Car<br />
will post details with code sometime later</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2010/03/weekend-project/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>strange thing in python</title>
		<link>http://ankurs.com/2010/02/strange-thing-in-python/</link>
		<comments>http://ankurs.com/2010/02/strange-thing-in-python/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 12:52:17 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=599</guid>
		<description><![CDATA[i recently noticed this anyone has a proper explanation for this for literals i get this &#62;&#62;&#62; def a(): ...     b = [] ...     c = {} ... &#62;&#62;&#62; import dis &#62;&#62;&#62; dis.dis(a) 2 0 BUILD_LIST               0 3 STORE_FAST               0 (b) 3 6 BUILD_MAP                0 9 STORE_FAST               1 (c) 12 LOAD_CONST               0 (None) 15 RETURN_VALUE but for&#8230;]]></description>
			<content:encoded><![CDATA[<p>i recently noticed this anyone has a proper explanation for this</p>
<p>for literals i get this<br />
<code><br />
&gt;&gt;&gt; def a():<br />
...     b = []<br />
...     c = {}<br />
...<br />
&gt;&gt;&gt; import dis<br />
&gt;&gt;&gt; dis.dis(a)<br />
2 0 BUILD_LIST               0<br />
3 STORE_FAST               0 (b)</code><br />
<code><br />
3 6 BUILD_MAP                0<br />
9 STORE_FAST               1 (c)<br />
12 LOAD_CONST               0 (None)<br />
15 RETURN_VALUE</code></p>
<p>but for constructors i get this<br />
<code><br />
&gt;&gt;&gt; def a():<br />
...     b = list()<br />
...     c = dict()<br />
...<br />
&gt;&gt;&gt; dis.dis(a)<br />
2  0 LOAD_GLOBAL              0 (list)<br />
3 CALL_FUNCTION            0<br />
6 STORE_FAST               0 (b)</code><br />
<code><br />
3  9 LOAD_GLOBAL              1 (dict)<br />
12 CALL_FUNCTION            0<br />
15 STORE_FAST               1 (c)<br />
18 LOAD_CONST               0 (None)<br />
21 RETURN_VALUE<br />
</code><br />
i mean why the difference, i was thinking {} and dict() do the same thing, shouldn&#8217;t they?</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2010/02/strange-thing-in-python/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Begining Python workshop</title>
		<link>http://ankurs.com/2010/01/begining-python-workshop/</link>
		<comments>http://ankurs.com/2010/01/begining-python-workshop/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 21:09:33 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=593</guid>
		<description><![CDATA[LUG Manipal is organising a workshop on python, Workshop is aimed at people interested in beginning programming with python.No programming experience required. Details are -&#62; Time: 5:30 pm Place: NLH 103 Date: 29th JAN to 3rd FEB PS :- Slides for the workshop are available Begining Python Slides]]></description>
			<content:encoded><![CDATA[<div id="attachment_594" class="wp-caption aligncenter" style="width: 222px"><a href="http://ankurs.com/wp-content/uploads/2010/01/python.jpg"><img class="size-medium wp-image-594" title="LUG Manipal python workshop" src="http://ankurs.com/wp-content/uploads/2010/01/python-212x300.jpg" alt="LUG Manipal python workshop" width="212" height="300" /></a><p class="wp-caption-text">LUG Manipal python workshop poster</p></div>
<p>LUG Manipal is organising a workshop on python, Workshop is aimed at people interested in beginning programming with python.No programming experience required.</p>
<p>Details are -&gt;<br />
Time: 5:30 pm<br />
Place: NLH 103<br />
Date: 29th JAN to 3rd FEB</p>
<p>PS :- Slides for the workshop are available <a href="http://ankurs.com/wp-content/uploads/2010/01/python.pdf">Begining Python Slides</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2010/01/begining-python-workshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobi Vision 2.0 Slides</title>
		<link>http://ankurs.com/2009/10/mobi-vision-2-0-slides/</link>
		<comments>http://ankurs.com/2009/10/mobi-vision-2-0-slides/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 12:30:55 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=561</guid>
		<description><![CDATA[First and Second Phase for MobiVision 2.0 is long over, and we can call it a workshop well done, the slides are here Mobi Vision 2.0 View more documents from Ankur Shrivastava.]]></description>
			<content:encoded><![CDATA[<p>First and Second Phase for MobiVision 2.0 is long over, and we can call it a workshop well done, the slides are here</p>
<div style="width:425px;text-align:left" id="__ss_2267468"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/ankur.os/mobi-vision-20" title="Mobi Vision 2.0">Mobi Vision 2.0</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=homeankurdesktopdump1mobivisionmobivision-091018161227-phpapp01&#038;stripped_title=mobi-vision-20" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=homeankurdesktopdump1mobivisionmobivision-091018161227-phpapp01&#038;stripped_title=mobi-vision-20" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/ankur.os">Ankur Shrivastava</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2009/10/mobi-vision-2-0-slides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A simple python socket chat example</title>
		<link>http://ankurs.com/2009/07/a-simple-python-socket-chat-example/</link>
		<comments>http://ankurs.com/2009/07/a-simple-python-socket-chat-example/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 19:08:34 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[Chat]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[socket]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=557</guid>
		<description><![CDATA[i was trying to explain sockets to one of my friend and this is what i used, the code should be self explanatory, this is a very simple application of sockets&#8230; download here]]></description>
			<content:encoded><![CDATA[<p>i was trying to explain sockets to one of my friend and this is what i used, the code should be self explanatory, this is a very simple application of sockets&#8230;</p>
<p><script src="http://gist.github.com/145536.js"></script></p>
<p>download <a href="http://gist.github.com/raw/145536/753a6d62042163710647574ea723c42807f44aef/python-socket-chat.py">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2009/07/a-simple-python-socket-chat-example/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Creating your own service like tinyurl</title>
		<link>http://ankurs.com/2009/05/creating-your-own-service-like-tinyurl/</link>
		<comments>http://ankurs.com/2009/05/creating-your-own-service-like-tinyurl/#comments</comments>
		<pubDate>Sun, 24 May 2009 09:45:56 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[tinyurl]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=505</guid>
		<description><![CDATA[Few weeks ago i came across this article on Techcrunch which says tinyurl is worth $46Million (of course before twitter started using bit.ly as default) which made me think how hard is it to make a simple service like tinyurl and i figured out its not hard. so i used apache&#8217;s mod_rewrite to rewrite the&#8230;]]></description>
			<content:encoded><![CDATA[<p>Few weeks ago i came across <a href="http://www.techcrunch.com/2009/03/30/if-bitly-is-worth-8-million-tinyurl-is-worth-at-least-46-million/">this</a> article on Techcrunch which says tinyurl is worth $46Million (of course before twitter started using bit.ly as default) which made me think how hard is it to make a simple service like tinyurl and i figured out its not hard. so i used apache&#8217;s mod_rewrite to rewrite the url and forward the code to a php script ( url.php ) which will then search for the url in database and take the use to the original url and for shorting, url it is inserted into a table with a auto increment primary key and the key is converted to base36 which contains [a-z] and [0-9], making the short code&#8230;</p>
<p>First create a database say &#8216;shorturl&#8217;<code><br />
CREATE TABLE IF NOT EXISTS `shorturl` (<br />
`id` int(11) NOT NULL AUTO_INCREMENT,<br />
`url` varchar(300) NOT NULL,<br />
PRIMARY KEY (`id`)<br />
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />
</code><br />
then create file .htaccess where you want your url to be and write<code><br />
RewriteEngine On<br />
RewriteCond %{REQUEST_URI} \/([0-9a-z]*)$ [NC]<br />
RewriteRule ^(.*) url.php?url=%1 [L]<br />
</code></p>
<p>and to create the url we will use a simple file say create.php<br />
<code><br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;Url Shortner&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;?php<br />
ob_start();<br />
$host=""; //host<br />
$dbuser=""; // database username<br />
$dbpass=""; // database password<br />
$db=""; //database name<br />
$con = mysql_connect($host,$dbuser,$dbpass);<br />
mysql_select_db("url",$con);<br />
if (!isset($_POST['shorten']))<br />
{<br />
echo "&lt;center&gt;&lt;h3&gt;Enter the url to shorten&lt;/h3&gt;&lt;form method='POST'&gt;&lt;input type='text' name='url' /&gt;<br />
&lt;input type='submit' name='shorten' value='Shorten' /&gt;&lt;/form&gt;&lt;/center&gt;";<br />
}<br />
else<br />
{<br />
if (isset($_POST['url']))<br />
{<br />
$url=" ".mysql_real_escape_string($_POST['url']);<br />
if (strpos($url,"http://") or strpos($url,"https://") or strpos($url,"ftp://"))<br />
{<br />
$url=mysql_real_escape_string($_POST['url']);<br />
}<br />
else<br />
{<br />
$url="http://".mysql_real_escape_string($_POST['url']);<br />
}<br />
$q="select * from url where url='{$url}'";<br />
$res = mysql_query($q,$con);<br />
$row=mysql_fetch_row($res);<br />
if (!$row)<br />
{<br />
$query="insert into url set url='{$url}'";<br />
$res = mysql_query($query,$con);<br />
}<br />
$query1="select id from url where url='{$url}' limit 1";<br />
$res=mysql_query($query1,$con);<br />
$row=mysql_fetch_row($res);<br />
echo "shortened url is http://yoursite.com/".base_convert($row[0],10,36);<br />
}<br />
}<br />
ob_end_flush();<br />
?&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code><br />
then our url.php file<br />
<code><br />
&lt;?php<br />
ob_start();<br />
$host=""; //host<br />
$dbuser=""; // database username<br />
$dbpass=""; // database password<br />
$db=""; //database name<br />
$con = mysql_connect($host,$dbuser,$dbpass);<br />
mysql_select_db($db,$con);<br />
if (isset($_GET['url']))<br />
{<br />
$query="select * from url where id ='".base_convert(mysql_real_escape_string($_GET['url']),36,10)."'";<br />
$res = mysql_query($query,$con);<br />
$row=mysql_fetch_row($res);<br />
header("Location: ".$row[1]);<br />
}<br />
ob_end_flush();<br />
?&gt;</code></p>
<p>Download <a href="http://ankurs.com/wp-content/uploads/2009/05/urltar.gz">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2009/05/creating-your-own-service-like-tinyurl/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>JavaFX and Pong</title>
		<link>http://ankurs.com/2009/03/javafx-and-pong/</link>
		<comments>http://ankurs.com/2009/03/javafx-and-pong/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 17:38:03 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[javafx]]></category>
		<category><![CDATA[manipal]]></category>
		<category><![CDATA[mit]]></category>
		<category><![CDATA[pong]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=476</guid>
		<description><![CDATA[There was a workshop conducted by engineers form SUN in our college regarding JavaFX, which went quite well. I was planning to start with JavaFX but as there was no Official release of any Linux SDK, it kept me back but this semester i had to install Windows because of my University which wants me&#8230;]]></description>
			<content:encoded><![CDATA[<p>There was a workshop conducted by engineers form SUN in our college regarding <a href="http://javafx.com/">JavaFX</a>, which went quite well. I was planning to start with JavaFX but as there was no Official release of any Linux SDK, it kept me back but this semester i had to install Windows because of my University which wants me to use Visual Studio for my mini project this semester, so as i had Windows (unwillingly) on my system i planned to go and attend this JavaFX workshop.<br />
From what i have learned in these two days, JavaFX looks promising for developing Rich Internet Applications, the language is somewhat a mixture of JavaScript and Java. With Type Inference , Audio/Video support  etc making it very easy to use and create applications with.<br />
In the workshop after every thing was over we were asked to make a simple application in JavaFX, so here is my code for a Simple pong game in JavaFX<br />
the resolution is set to 1440&#215;900 you can change it to your resolution in the code<br />
<span id="more-476"></span><br />
<script type="text/javascript" src="http://snipt.net/embed/af5b15371751e9d9ebbe6b42f96d1f34"></script><br />
if you cannot see the code see <a href="http://snipt.net/ankur/a-simple-pong-game-in-javafx">here</a><br />
<br />
PS &#8211; as i dont normally boot into windows i dont think that i will do anything in it soon, i am waiting for Linux JDK to be released&#8230;&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2009/03/javafx-and-pong/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

