Thursday, March 20, 2014

My Creations

My story of being a programmer has the elements of a movie to it :)
My initial struggle to understand syntax; doing very badly in my computer science tests; my dear teacher motivating me; my uncle sharing a computer for me to work on; me programming games on it (because the computer didn't have any games); me falling in love with programming; creating and learning much more than my peers and eventually being one of the top programmers in class (in 9th grade, during a predicting game at my prefects picnic, writing on a sheet of paper that 10 years later I'd be in the company of software engineers); my parents not understanding my interest in programming (2002 was a panic year when software people were losing jobs) and pushing me to do Mech engineering; me continuing to do programming even during my engineering (winning a state level hobby project in the process and surprising my Mech seniors when they found me reading computer science books in the library); landing my first job as software developer even before I stepped out of college; going ahead to do my post-graduation in software technology and exactly in the 10th year following my prefects picnic, joining a new company and having my aim fulfilled.

Some of my hobby projects

Most of my initial programs were created on a 286 computer which didn't have Windows installed. Only MS-DOS. Max speed of the computer: 20MHz. Hard disk capacity: 30MB. Yikes! :-) It was only after my engineering that I got an internet connection at home, so the below programs are a result of hard-work and self-study of API's and documentation.

 Kids of 3rd and 4th grade seem to LOVE this game. I guess it's because of the simplicity and the funny sounds I programmed into it. This was the first game I programmed (in GW-BASIC) when I was in 9th grade, and my little brother was crazy after it. He even beat my highscore!

A game with ten levels of increasing difficulty and challenges. Created in 10th grade. Was introduced to the term "cheat codes" at this point of time, and introduced this into the game.

I used to create mazes on paper, and decided to program one too. Was a daunting task setting up the arrays on large sheets of paper I stuck together and then replicating the same on the computer. The maze was programmed with portals and wells (which you might fall into and die). It was also divided into 4 sections which made it very difficult to solve, because you had to remember the previous screens to find your way. My best friend tried for three hours, and said he couldn't solve it (to date, I'm the only one who has solved it).

This was one game I really wanted to program. Had played it many years back on a cousin's computer, and wanted to play it at home too, so just created it myself. Wasn't familiar with Q-BASIC graphics at that time, so used ASCII characters. It's a game with a digger machine digging through mud, collecting diamonds, monsters trying to destroy the machine and the machine being able to shoot at the monsters or drop sacks of money on them to kill them. Then collecting the destroyed sacks to get more ammo.
Had created an initial version and then improved upon it.

Calculator program
Okay, this one was too simple, but it was programmed to be user friendly by allowing the user to navigate from one key to another using the arrow keys and by providing a square root option (which I'm surprised that many calculators strangely still don't provide).

Mock antivirus program
Well you'd recollect I was using my uncle's computer, and I wanted to pull a prank on him. I created an antivirus interface which was pretty similar to the real MSAV antivirus interface of those days. The program pretends to scan the computer and pops up an alert that it found a boot sector virus which can't be removed. Uncle actually believed it! :)

Vein: An MS-DOS OS interface, like Windows
Navigating through the commandline is difficult for people. My family found it tough to use the PC because it didn't have Windows and the MS-DOS interface was too geeky for them. So I created an interface (while in 11th grade) for interacting with MS-DOS. Pretty much like how the Windows graphical interface was created by Microsoft.
Also, the PC was infected with a virus which randomly wrote ASCII characters on the screen. Vein's user interface was designed to refresh the screen at the press of a spacebar, temporarily solving the virus problem.

Digger forever
Had wanted to make my Digger game closer to the actual game I had played at my cousin's house, so while doing my engineering, when the ISTE student chapter organized a state level hobby project competition, I borrowed my room-mate's computer for two weeks and created Digger with BASIC graphics (presented it along with my other games). And guess what? I won the competition with a Rs.2000 cash prize! Roommate got a generous treat and seniors were all-praise :) The Mechanical engineering student who won a competition by programming games!
[update] Just found the original of the printout my very-happy-seniors had put up on the college and hostel notice board after I won the prize.

Message decoder program
Converting text from English to a coded language and vice versa being slow, I wrote a program for it. Also kept it flexible for it to be able to accept a new code sequence too.

Mechanical force visualization software
A Civil engineering lecturer at my college asked me if I could create for him, a program which would show a 2D representation of the normal and tangential forces on a beam. He also wanted a simple graph to show the force distribution. By this time, I had derived the 3D projection equations on my own (I didn't know this would be available on the internet, so I had actually drawn projections on paper and derived the equation by using whatever I learnt in trigonometry), so I completely took him by surprise by using the graphics of C (using the Turbo C compiler) and created the beam in 3D, as an application with full-fledged menus and an interactive graph. You can actually rotate the beam in 3D using arrow keys, feed in various values using textfields (these were tough to program) and also load/save the values. When I look at the program today, I find it hard to believe that I actually programmed it when I was at that age!

Had wanted to make a Dangerous Dave kind of game, and I began with Ben. But this program was left incomplete, as I couldn't use threading in BASIC. So when I added a monster in the second screen, it became too slow. Was able to get over the tough part of programming multi-key input to make Ben jump around.

Those were my student days. As a professional, I've learnt a lot more.
I've also engaged in creating a few scripts here and there to ease my work:

Greasemonkey for auto-clicking a web-page

A certain page required clicking a link every time I visited the page. So I thought I'd automate the process with this code snippet. 

var element = document.getElementsByTagName("a"); // get element by tag namevar theEvent = document.createEvent("MouseEvent");
theEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 30, 79, false, false, false, false, 0, null);
//var element = document.getElementById('link');

Recursing directories

Wanted to  be able to move recursively through directories to accomplish what I wanted to, so wrote a small python script for it:

After writing it, I discovered that the functionality was already available in Python via the walk command ... *sigh* ... anyway at least there's the joy of creating a program on my own and being able to tweak it as I wish!

Resting my eyes

What's the point of knowing VC++ if you aren't using it to your advantage? I borrowed some open source code for a program which sits in the system tray in Windows, and modified it to start at logon and pop up a message at a specified interval of time, alerting a person to rest their eyes for 5 min. Strained-eyed friends and I found this program to be a boon. Of course when I found Eye Leo, I switched to it immediately.

Popup Destroyer

A certain security setting created by a certain someone, made an "Authentication required" popup appear whenever I opened a new page on my browser. The user just had to press Esc to make the popup go away and it was very annoying. So I wrote a sentinel program in VC++ to run in the background, scanning all window titles for the "Authentication required" string. When it found one, it'd immediately issue the Esc keypress command to the window automatically and the window would get closed. I used to enjoy watching those windows disappear while I continued with my work happily :)

Volunteering website
Our volunteering team in Tata Power SED needed a website and we decided to create it. I created an interactive prototype in 3 days. Made good use of free and open source code available on the internet. More about it in this blog post.

No comments: