Thursday, November 22, 2012

We are Robots

I've always been fascinated by UFOs (Unidentified Flying Objects) and stories related to these alien objects. The first story that I heard was back in 1989 when I was in Jaipur. The landlady woke up one early morning to see a bright circular object above the Shahtut (King White Mulberry) tree. She almost fainted and came back running back inside. Jaipur at that time was famous for these alien and witch stories and I use to hear one every other day so this one did not look that convincing. Until one night when I was lying in the open staring this big bright strange looking star that looked so different from the rest. Suddenly it started moving and disappeared after a few second. I believe it was *something* unidentified (no it was not a satellite). As I grew up and had access to internet, my interest in these UFO/Alien talks started growing and questions like "Why are we here", "Who are we" started popping up in my mind. I am sure these questions bother every individual sometime in their lifetime, it came to me at 25. I believe it all started with computers and programming. As I read and understood more about computers and how they work, I started relating computers with real life scenarios and found a lot of similarities in the working of things. Through this post, I'll try to convey what I think about the whole world. Please be warned that it may all sound like the daftest things you've ever heard.




Creators/Engineers

I believe that we are built by a superior civilization that exists somewhere out in the vast unknown universe. These so called superior civilization built us in the same way we humans are working on robots. They found or created a place where their robots can survive. Imagine 100 years from now we humans have successfully built a robot that can reproduce itself, generates energy to run its components by consuming Nitrogen and can develop or improve itself on its own. When we say "Life", we compare it with our living conditions, oxygen, water, gravity etc and when we say human we think that it will always be made of flesh, blood etc. "Life" could have a different meaning depending on from where you view it. If these robots starts thinking, they'll term their activities as "Life" which is basically an experiment or game for their creators. They'll not have flesh or blood inside them but they'll term themselves as humans.
Okay so we then put a pair of these robots on Mars (depends on whether the robot is self-replicating or needs a partner) and watch the game called "Life". We can track their positions and see what the robots are up to, sitting at a control room on planet Earth. Occasionally we visit Mars in our special aircraft, something that those robots have never seen, amusing and scaring them with our technology. Imaging how much fun that would be. We would become "Gods". These robots will then pray to us, singing songs, doing all kind of things to amuse us. Certainly we could help them sitting on Earth. We might incept an idea in their brains (maybe a lottery number), change their behavior, or do something that can change their life or circumstances around them, depending on how the devotee amuses his God. We would certainly put constraints on what these robots can do so they can never "outshine their masters". Years later, they might start questioning their existence  "Who are we?", "Why are we here?", looking at all the complex design we have given them. They'll start their exploration, trying to find their creator, trying to solve the mystery until one day when they reach the peak of their intelligence and humans see them as a threat to their own society. Boom... goes the game and we start it again, this time with a robot version 2.0 and lot more stuff in the environment.



I don't believe in "Gods" like people do but I do believe in Creators because I believe everything is for a reason. We are here for a reason, we are made this way for a reason, earth rotates for a reason, every little thing in this universe exists for a reason. Our creators surely did not have a magic wand. It becomes clear when we see our body and things around us which are clearly understandable. For example out Food System:

(Input) -> (Process to get energy) -> (Output)

If the creator is so powerful, why can't (s)he just did a "swoosh" with the magic stick and made an "all flesh" thing that "just works", hiding all the details of its working. He is not suppose to answer or explain anything to anyone (not even to his wife I guess). If we remove our organs, our body is not going to function no matter how much time we spend in the church or temple or any other place made to initiate contact with the creator. That means he does not have a magic stick at all. Its all logical. He/They designed the whole system. The creators enjoy watching us as we uncover the mysteries each day, as we try to reach his level of intelligence.

The Big Loop

What is a soul? Nobody has any explanation. Can you describe it, touch it or feel it? Then why is it so important for existence. Because its the Prana. Think of the real world as a big computer running an operating system (OS) and we as different programs running inside that OS. In this context soul is nothing but processor cycles that gets work done. Every OS has this big loop that is responsible for scheduling different programs by assigning processor cycles to them. Programs or the code they are made up of *looks* alive as long as processor cycles are assigned to it and the program is attached to the big loop. The code has no significance once it gets detached from the loop that feeds cycles to it. Even though you have the source code that once ran and did things (human body), it just sits there and does nothing once it gets out of the loop. So I believe that this world is also governed by an OS to which all living things are tied to. We are *alive* as long as we are tied to this OS loop. When a body develops inside a womb, there must be a particular time when it gets attached to this loop but nobody knows when and how that happens. Maybe a signal or a chemical reactions triggers it, nobody knows. "How\Why do we die?" Because this loop somehow gets a signal from our bodies that the body is not usable anymore. This may sound like a silly example but think of an interface ILiving that all living being implement having a BOOL Usable() method:

class Human : ILiving
{
    BOOL Usable()
   {
        // check if body is usable and return appropriately
   }
}

The loop is responsible for calling this Usable method at defined intervals to check if the program (human body) is usable or not. If the method says NOT, the OS throws the program out of the loop and we "die". Sometimes the body, though usable, is unable to respond to this Usable call and body dies even though the problem is perfectly curable. If we connect this idea to our previous discussion about robots then this means that all our robots on Mars will be connected and controlled (not literally) from the control room on Earth. If a robot looses control with the control room, it becomes non-functional. Which makes sense because if it goes out of our control/sight/monitoring, it might become a threat to us so its better to make it dead as soon as it looses connection.

I don't believe in reincarnation at all. Soul cannot have any information. All the information is stored in our memory which gets destroyed with the body so it seems impossible how a person can remember things from his previous life. This is beyond logic. Also, we can't go to other worlds (Heaven or Hell) without a body. We can't feel good or be tortured without a body. If that were possible then what's the use of having such a complex body structure at all.

In Hindu religion, there's a word called Mukti which means final release (something like the  FinalReleaseCOMObject). Hindus believe that if for some reason like Moh the soul cannot go back to the loop then it dangles between the two worlds until a special Havan is performed and the soul is released. In a computer world, you can see the same scenario when a program hangs or exits unexpectedly. The program is gone from sight or freezes but remains in the process list (Task Manager for MS Windows users) until the user explicitly kills or releases it. The same *may* apply to us otherwise where would the Hindus got the idea about this release and performing *actions* to release the soul when its stuck. This kinda makes me believe in ghosts. I am not sure how useful the Havan is today. We might have lost the real knowledge to perform such things.


"History repeats itself". That's what we are going to do someday. We were made, the system was made and the game was started. We are going to do the same, creating a hierarchy of Creators ("Gods").

References:
16-DEC-2012: Master Computer Controls Universe - Times of India

Saturday, November 3, 2012

For the love of FOOD

Food has always been my favorite thing in this world. Be it home cooked or the neighborhood dhaba or that expensive restaurant. No wonder Cheeni Kum and Bawarchi are some of my all time favorite hindi movies. Fancy cooking is my hobby. Like they say for winners - "I don't cook different things, I cook them differently". Take for example an omelette, usual the Indian way of making a masala omelette would be to beat the eggs, put some spices and onions into the mixture and pour it over the hot oil in the pan. Then  maybe *attach* a few pieces of breads over it. I would change it to fry a little cumin seeds in the oil first, then saute the onions and other vegetables for a while, spread them evenly over the pan surface and finally pour beaten egg slowly over them. Let it cook for 10-15 mins on low heat (simmering - my favorite), sprinkle some basil and oregano then flip it over for another 5-7 mins for low heat cooking. If you want to fatten it like a cake, cover the pan with a lid. The heat will make it fluffy and thick.

I've been experimenting with omelette, Noodles, Dal-Chawal and other odd stuff for more than a decade now. Sometimes the experiment succeeds and sometimes it fails so miserably that I had to throw the whole thing or even worse that it sticks to the pan so hard that even the cleaning lady struggles with it. But you know, like they say "Experiments makes way for discoveries".

Cheeni Kum was a great movie. It portrayed Amitab as a perfectionist cook who wants everything to be done his way. I watched it more than 20 times and I still remember some of its dialogues  The "Hyderabadi Zaffrani Puloa" was made popular by this movie. This was the dish that went sweet by mistake and became a reason for Amitabh and Tabu to meet and fall in love. I was fascinated by the word Zaffrani (which is basically a surname) and how Amitabh would say that in the movie so I thought of trying out this dish at home. I called over a very close friend to cook the dish with me. I had never tasted the original Zaffrani Pulao so I don't know if it was even close to it but it certainly was better than a normal pulao. We had it for lunch.

These are some of my favorite scenes from the movie. In the first one, Amitabh describes the pulao recipe and in the second one he explains why chefs\cooks are the greatest artists in this world: "Issiye hum, duniya ke sabse bade kalakaar hain". Move to 2:09 in the second movie clip. For some reason I am unable to set the start time for Youtube movies here.

 

About a year back, I invented the Egg-Buns, similar to the Mac D's Egg McMuffins. It was Saturday morning and I wanted to make something different for my wife and kid. All I saw in the fridge was eggs and a few buns. To make the Egg-Buns, I made a big hole all through a bun, kept it on a hot pan and poured beaten egg batter into the hole. Then simmered it for 10-15 mins, solidifying the egg batter inside the bun. It came out really well and I made 4-5 Egg-Buns for breakfast that morning. Needless to say my wife was very happy, no not because the egg-buns were good but I saved her a day of breakfast making ;-)

 

There's one more quick and tasty snack that I want to mention here, the "Mexican Papad Wrap". Its a variant of masala papad. All you do is take a papad, roll it like a cone, hold the edges with a kitchen tong and deep fry it for a few seconds. Then chop onion, tomato (without the juicy part), green chilly and masala mixture and stuff the papad cone with it. Its goes great with Beer.


My favorite food show is the Food Safari. I just love how they describe foods from different parts of the world. They start by showing the popular and commonly used spices and stuff for that place then go on showing how these are used in day-to-day cooking. Now whenever I cook rice, I put a slice of lemon (slice not juice), a slice of ginger and a few cloves and coriander leaves to cook with it. It gives a totally different taste to steamed rice. Nigella Kitchen is also a good show but because of the host, it becomes a little difficult for me to *just* focus on the beauty of the food being prepared.

Haaa! I've written so much about food that I've started feeling hungry again.

Thursday, October 4, 2012

Journeys on the Iron wheels

I am on my way to Meerut from Chandigarh in the Chandigarh-Chennai LINK Express.  My ticket says Sleeper - S8/48 (Seat number 48 in S8 coach). As long as I can remember, this is the first time I am going to travel in the sleeper class. It wasn't a planned trip so I could only manage a reserved seat in the sleeper class coach, which my brother (and his friends) says can have its own unforgettable experience. Well, first look at the coach from outside confirmed that but I have to take this train today as it only runs on Mondays. I reached my seat, which was a side-upper and saw one middle-aged lady sitting on the lower birth. Side seats can be unfolded in the night to make beds (or berths as they are referred to in railways) and then folded in the morning to seat two people. I asked the lady to unfold the seats (as it was already 8 in the morning) so that I can have my reserved seat.
"Son... I want to take a nap, you need to move to the upper birth"
"Upper birth? well, I wanted to sit not sleep at this time of the day" I said. 
"In that case, you can sit in the corner, pointing to the 30% of the area she had cleared for me. 
"Okay that's fine". 



Me and my brother came outside for some air. We still had 10 mins to fix something with the ticket teller (popularly known as TT). We saw the TT coming out from the AC coach with a bundle of papers. Without wasting any time, my brother pounced on him to check if a seat is available in the AC coach. 
"Actually it was a last minute decision and we could not get a ticket in the AC coach. Its Monday and he needs to work on some urgent things" my brother said pointing towards my laptop bag and making a helpless looking face. 
I don't have this skill at all. I would have straightway asked him if there is a seat in the AC coach and probably have got a straight reply that the coach is full. 
The TT gave me a look and said "Okay let me check - In the mean time you take seat no 42 in the AC coach". 
It was a real life example of how to make things work and communication play an important role.

I grabbed seat #42 in the AC coach. At Ambala, the TT came to the coach for ticket checking. I gave him a quick look "Sit Sit, I'll come to you". Then at Jagadari station he came to my seat and said "Sir, can you come to seat #21". I picked up my bags and started walking towards #21 in the same coach.

"You can sit here and work. Do you need a socket to plug your laptop in?" he asked.
"No that's fine, its fully charged"
It was the side seats reserved for railway personnel, he sat in front of me and drew the curtains.
"200 rupees Sir"
I had 200 change in my upper pocket that I had kept for the tempo but forgot to give to my brother. I gave him two 100 rupee notes inside that curtained space.
"You can sit here or move to the upper birth if you want. Your brother said that you had to do some urgent work?" he said with a smile.
"Yes, Yes I had to. Thank you very much" - relieved, I was now a passenger of the AC coach.
To make the urgency look real, I took out my laptop and started fiddling with it, thinking what to do without access to the Internet. Between the noise of "Chai piyo Chai Chai", "Tasty Chole lo Tasty Chole" and "Namkeen Biscuit Chips Kurkure" in their typical tone, I decided to write something on food. Though I had Aloo-Paranthas in the early morning breakfast, I've started feeling hungry already.




My brother was particularly concerned about the eunuch beggars. They would stroll around the sleeper and general class coaches during the 40 minute stop at Saharanpur station for rake-sharing (joined to Dehradun-Chennai Express). These beggars are popular for passing some embarrassing comments at people ( like "oye shahrukkhan") until they shell out something. And if you don't look like a general or sleeper class passenger, you will have to give them more to avoid any kind of argument with them.

And while I am writing this sitting in the AC coach, I saw a young man hasty/roughly sweeping the floor with a cloth and then looking at people to get some money. 
"come on, isn't that something that the railway guys would do?" I asked him. Without saying anything, he moved to the next compartment.

The *scheduled* arrival time for this train is 12:20 PM (4.5 hours journey) but even the TT was sure that it won't reach Meerut before 12:45. The train was in full speed, zooming past the green fields of Uttar Pradesh. Some Tamil speaking TT has replaced the one I met. He was busy fiddling with his mobile phone and striking some kind of deal for a dual sim. The train started loosing speed at 12:30. I asked the TT which station is it. "Ahhmmmm" he took out his station chart "Meerut City will come in another 10-15 mins". People have started collecting their luggage and moving towards the door. There was no stop in between, the window glass was too foggy to see which station it was so I asked a gentlemen standing next my seat "Meerut aa gya kya?" he nodded.

I decided to write about my love for food but ended up writing about my train experience. Though this one was better than my last train travel experience in the AC Chair Car (from Meerut Cantt to Ambala Cantt in New Delhi-Jalandhar InterCity Express) when the AC unit malfunctioned, making passengers dripping in sweat for nearly an hour until some SardarJi decided to pull the chain. They stopped the train at Muzzaffarnagar station, not allowing the train to move until the AC unit is fixed or their fare is returned. Luckily, it tool 5 minutes for the railway technicians to fix the fault.

Sunday, September 16, 2012

MS-DOS Explorer

Year 2003 was the last year of my masters in computers. I was very excited because after so many theory papers, finally we were suppose to develop something as our final year projects. MICI, our study center, had posted a list of commonly developed projects such as XYZ Management System, writing some kinda shell scripts for UNIX or making a simple user interface in Oracle forms. It was a long list with all sorts of conventional projects. Visual Basic 6.0 with Oracle back-end was so popular among students. Nobody cared whether an enterprise database like Oracle is actually required for the kind of application they are building. Even I was part of this herd behavior in the final year of my bachelor degree, I made 'Store Management System' in Visual Basic 6.0 and Oracle 8 Personal Edition, though I made it a little more complex to make it stand out from other projects. 2-tier 3-layered using an in-process and an out-process component. It became quite popular and students kept submitting it for years (with little modifications of course) as their final year project, until the combination became obsolete and Visual Basic 6.0 was no longer a preferred development language. .NET era had started. There were some of my friends who had developed or purchased Java projects. Java projects were hard to configure and run and even more harder to make changes to them basically because an IDE (Integrated Development Environment) such as Visual Studio was missing. There were a few I was familiar with such as Borland Java Builder and Tek-Tool's Kawa but these were no match for Visual Studio's speed and features.

I wanted to do something different this time, something nobody had thought of before. One day while I was in the computer lab, managing my files using the DIR, COPY and MOVE dos commands, I felt the need of having a Windows Explorer like application for MS-DOS. 'browser' I named it and my project was decided. It was a purely different idea than the rest of the class. Nobody had ever thought of making a user-interface for MS-DOS. Turbo-C IDE was an example of user-interface in MS-DOS and who can forget popular programs such as 'Nash Format' which could even format a *bad* floppy and make it usable. A user-interface in C, sounded scary. "Are you going to use windows api?", "Which database are you going to use?", "Will there be mouse support" were some of the questions my fellow students would ask. I did not have satisfactory answers to their questions, all I knew was that it is possible and I will do it. Why I was so confident about completing it was because of a book that I bought purely by chance. When I was in Lucknow couple of years back, I asked my father if he could get me a book on Internet on his way home from office (I told him the author and book name). I got it in the evening but it wasn't as good as I expected so I thought I'll return it back and get another one. I went to the Bhoothnath market in the evening itself and started searching for something I could buy in replacement for the Internet book. Strange enough, I could not find even a single book worth buying. It was getting late and the shop had to close so my father asked me to hurry and select something. Just then a book with the word "MSDOS" caught my eye. It was Ray Duncan's Advanced MSDOS Programming. I turned a few pages and it seemed all Greek to me but because I was familiar with MSDOS I decided to buy it anyway. And that's how I got introduced to the magical world of interrupts, TSRs (Terminate and Stay Resident programs) and assembly language programming.


I started MSDOS Explorer by designing the application and soon the whole structure became gigantic with more than thirty different classes. There were classes for each and every user-interface element, from menu, status bar to dialog boxes. I wrote my own classes to handle graphics - yes the 80x25 blocks by directly writing to the video memory buffer (working around the magical video memory address 0xB0008000L). The best thing about this project apart from the UI stuff was that it did multi-processing. Even though the support was fragile (because of all the MSDOS Interrupt Handling) it worked flawlessly if the provided function did simple tasks such as updating the clock or running a ticker. Multi-processing in this context was to schedule multiple functions to run simultaneously along with our main program loop. The support was added by chaining the Clock Tick Interrupt (0x1C) to call our function whenever an interrupt is generated. The function in turn would call other methods such as to update the clock on screen or advance the trigger from it's function list. The downside was that these scheduled functions needs to be very simple and if any one of these failed, it would take the whole application down and there was no way to recover from it. MSDOS Explorer had two scheduled functions, one to update the clock at bottom right corner of screen and the other to run the ticker on top right (which would scroll my name).


The whole class hierarchy was *inspired* by the MFC (Microsoft Foundation Classes) model. A CObject was at the top and then CWnd, CView, CListView, CMenu and classes for different controls, dialogs and utility functions. It took me six months to get the first version out. I wanted to see all my C++ knowledge in action, all the OOP stuff and data structures. For the file list, I used a doubly linked-list of structures and used insertion sort to sort the list. Sorting was required on every column (file name, size, modified etc) and its this sort feature that made me publish my first article in Developer IQ magazine. It was called Using trees with custom data types


One of the feature of MSDOS Explorer that I personally liked very much was the Snake screensaver. If you've worked on Novell Netware systems you probably know what I am talking about. The Novell Netware snake was a little different from the one I implemented in the way that it would always move on an empty black screen and it kept growing as the server load increased. Its tail would grow longer and longer. Mine (see screenshot below) would take a memory screenshot of the current screen, black out the whole screen and would reveal the area underneath it as it moved. After the snake was popular, I added Garbage and Bars screensavers to the application. Unfortunately, I do not have the new executable which had these new screensavers, the "About MSDOS Explorer" screen and in particular the "About Developer" screen. I do have the source code which I wish to re-compile someday and update this post with some more screen shots. I say "someday" because the source code is in pieces and not directly compilable.



When I thought of writing about MSDOS Explorer my only concern was how to run it and take screenshots of different features. One option was to boot MSDOS on my old laptop, run MSDOS Explorer on it and take pictures using a camera. The other option was to run MSDOS as a virtual machine using tools like VMWare Player and take snapshot of the window. This seemed better as I can avoid switching between systems and also because I wanted to restart on this project and do a little programming in TurboC++ 3.0. I have fond memories of that MSDOS based IDE which also supported mouse operations (only a few people used it though) apart from great looking windows, menus and dialog boxes. I won't be wrong in saying that the inspiration for developing a user interface in MSDOS came from this IDE. So ya, I choose the second option to run MSDOS as a virtual machine.

Luckily, MSDOS 6.22 was available in subscriber downloads section inside my MSDN account. I downloaded the executable but it was of no use (though later I learned that files can be packed into an ISO archive using programs such as MagicISO) as VMWare needed an ISO file that it can read as CD to install the operating system. After a couple of minutes of Googling, I found MSDOS 6.22 ISO on AllBootDisks site. Downloaded it and created a new virtual machine from within VMWare Player specifying the path to the ISO file.




Here's a really interesting video while I was searching for different stuff related to this article. The video dates back to 1980s and is a promotional video for MSDOS 5.0.



So that was it. I enjoyed writing this one, it took me back to the old golden memories of FAR and NEAR pointers when even hundred MBs of memory was luxury. It feels so good to think about that period of life. In my next one, I'll talk about the Store Management System project. Till then - keep experimenting.


Monday, August 27, 2012

Jack of all trades, Master of [some]


My family got a shock when I first expressed my desire to buy a personal computer. They had been through this about five years back in 1994 when I asked for a video game console on my birthday but this was much bigger. A good branded PC use to cost anywhere between Rs. 50000 to Rs. 70000 at that time in the year 1999. I could have gone for an assembled one but being brand conscious I shortlisted the HP Pavilion 4450. I believe that brand consciousness is not about putting your finger on the costliest thing in the market, it about paying for quality and the effort put in by the company in their RnD activities and for maintaining the quality. I stick to good brands even though some people strongly disagree with me on this.

HP Pavilion 4450 Mario 8 bit
This great PC had a Celeron running at 366 MHz with 48 MB of RAM (yes its MB). Hard Disk was 4.3 GB and it came with Windows 98. Though now even my cellphone runs faster than this machine, it was a good configuration back in 1999. The Pentium II version was even more costlier.

Like any other Indian parents, mine too were a little skeptical about buying an expensive PC for me. And my job was to explain them what benefits it can bring for me and my brother. My brother wasn't fond of computers at all so there was no point asking him for help. He was happy with whatever exposure he got in school. After weeks of discussion, finally my dad asked me one day "You want a PC or a scooter?". I loved LML Select II scooter not just for the looks but the overall build quality. I wasn't a bike guy. My father was a die hard fan of Bajaj scooters (he still is) so we had a green Bajaj Super which I disliked. Even a Lambrette looked better than a Bajaj Super. So that was a tough question to answer, a choice between LML Select II and HP Pavilion PC. It made me gave thought to what I do and what I need or want. I had no girlfriends and the possibility of having one was bleak and roaming around the city alone didn't sound like a good idea to me. The other thing was that I use to travel to UPTEC everyday by bus just to spend a couple of hours in front of a computer. By having a computer at home, I could save this time and the bus travel which I hated. I hated it because these bus guys would never completely stop the bus to let passengers out and one has to literally jump out of the moving bus. As a do-it-the-right-way person, I never liked it and it was out of my control. Even if I waited or asked him to stop the bus completely, he would skip this one and stop at the next stop which had more people waiting to board. Finally I decided to get a PC. My father wasn't that happy with my decision as I couldn't explain what I'll do with it. All he had in mind about PC is that people can play games on it and Rs. 65000 for a video game did not sound like a good idea to him.

I got my first PC on 21st June 1999. It was a day of rejoicing which quickly turned sour after a major electricity breakdown in my colony. It was such a major breakdown that there was no electricity for almost four days. I remember watching movies with friends during this period to avoid the frustration of not being able to operate my new PC.

The first thing that I wanted to do was to format the Hard Drive and partition it the way I want. Being an HP PC, it was loaded with all sort of programs that I'll hardly use ever. I spent the next few days looking at each and every setting and file that computer had, installing whatever Free or Demo applications I can find on Digit CD, watching movies and listening to MP3 songs. I did not want to clutter the formatted PC with demo applications so I decided to try them all before cleaning it. The MP3 movement had started and it was everywhere. MP3 Rippers, MP3 To EXE converters, MP3 Tag Editors were popular apps and I tried them all. Trying out different applications gave me a lot of information about user interfaces and filled my mind with ideas.

My first completed application in Visual Basic was a calculator. Nothing special in it, just that it displayed colourful digits and the calculation steps can be saved in a text file. It also had a big logo on the right saying "INDIAN" in a fancy way, I did it using Ulead's PhotoImpact. Ulead was later bought by Corel (remember Corel Draw) and all its products are now on Corel's site. Paint Shop Pro was also a very popular image editing software. It sat between the bare-bone Microsoft Paint and the advance Adobe PhotoShop. All these were available as shareware on Digit CD. I don't have the calculator executable available with me, nor do I have the screenshot which I really miss. As I wrote in my earlier post, I use to update this calculator frequently and gave it to my friends for testing. This application taught me the basic of Visual Basic and Packaging.

Then I made a data Encryptor (see images below). The one thing I was very fond of was making splash and about screens because it always had my name and other details. The application only allowed text to be encrypted which can either be entered directly into the RichTextBox or can be loaded from a file. To encrypt the text, user needs to specify a key up to 40 characters. The same key would decrypt the text.

Encryptor 2001Encryptor 2001 - Encrypting Text

Encryptor 2001 Help FileEncryptor 2001 Help File Contents

If you encrypt the text "This is a test" with the key "123456", it would give you "Abhimanyu Sirohi - abhimanyusirohi@yahoo.com - 2001Ngas im X o]pn*+1+4.“/'++.270/(". Ya, that long string was the file signature. I packaged this application complete with a ReadMe and a Help file. The help file contents seems funny now. It was generated using the HTML Help Generator that came with Visual Studio and generated .HLP and .CNT files. .HLP files are not supported anymore and if you have Windows 7/Vista you'll need to download the WinHlp32 program to view these HLP files. A few weeks later I also packaged it as an ActiveX control that can be embedded in user applications.

As I dived deep into the Visual Basic world, I craved for advanced controls which were not available in the Visual Basic toolbox. VBAccelerator.com was an excellent site for all the advanced controls complete with their source code. The best part was that it was totally FREE. It provided all the nicely written and beautiful looking ListViews, Grids and ExplorerBars. The site has been updated and it now supports both VB and .NET.

The next I wanted to do was to create my own website. Hacking and cracking was quite popular those days and sites providing serials, keys and key generators (with free p@rn  of-course) were all over the Internet. It was very easy to find serials and key generators for any software you like. I always wondered how these smart hackers\crackers override the limitations in a software. How is it possible to make changes to an executable. I started reading about it and found SoftICE. SoftICE was a kernel level debugging tool but because of its capabilities it was used by crackers to break application limitations. Digit CD was full of shareware applications with either a 30-day trial period or a nag screen that pops up every now and then while you are using it. I browsed it and found my first target, WinZip. Let me tell you that it was totally for educational purpose only and not to use or distribute the cracked version. The idea behind cracking WinZip was to bring up the WinZip registration dialog, enter and key and put a break-point in SoftICE for the GetDlgItemText API. The API gets called when we press OK to get the text entered in the registration key textbox. Then we step into the code looking for a place in assembly language where WinZip processes the entered code and decides whether its valid or invalid. That's where we need to trick it into believing that the entered code is valid. WinZip was cracked in a day by following the instructions on a hacker site.

Playing Half-Life was a regular affair between all these cracking and development activities. Everything was excellent about this game. The story, scientists, head crabs, Gordon Freeman and his crowbar. I found it on the Digit CD and became a hardcore fan. Sarvjeet was also a big fan of this game which became very popular. I still play it on my Xbox 360. The other one I use to play at that time was Virtua Cop. A First-Person-Shooter, it was fast but only had 3 stages. 


Hard work goes both in making a software and cracking it. Back then there were no IT laws in India and I did not have much idea about the legal aspects of cracking and distributing software so I decided to make my first website loaded with my small applications along with hacking and cracking stuff. The first one I hosted on Fortunecity which provided 100MB of space for personal websites. The downside was the big ad banner that got attached to every page in your site. Then I switched to Geosities (now closed), a Yahoo service. It provided 15MB of web space and a small ad banner. I use to update my site frequently and in three years I uploaded three different websites. I stopped updating when I got a BANNED notice from Yahoo for the hacks and cracks stuff that I had published.




All of these websites had a common profile section which I filled with anything and everything related to me. As the Java fever caught me, I got myself a big fat Java 2.0 book. I started working on Java because it was part of my 'A' Level course. I wrote a small desktop application in Java but it wasn't fun because there was no good IDE available. Being a Visual Basic developer, I had the privilege of using Microsoft's Visual Form Editor and I could not find a similar product targeting the Java platform. It was boring and frustrating to write down the initialization statements for each and every control on Form (which Visual Studio .NET hides inside the InitializeComponent method). Despite of all these things, I really liked writing Java Applets for fun. Below are some of the applets I wrote - KissMe, Digital Clock and Radar. Try clicking on my picture below (No it won't send me the email address of person who clicked and kissed me). The Radar applet makes a lot of annoying sound, you might have to lower down your system's volume.

   

(You'll need to allow Java to run in order to see the above applets)

In the next part, I plan to write about my experiences during my college days, about the people I met and the projects I developed. I'll also write about the project I am particularly proud of: The MS-DOS Explorer.

As always, all third-party images used here are for illustration purpose only.

Monday, August 20, 2012

The Wonder Years in Lucknow

It has been 14 years since I was first introduced to computers and the introduction was purely by chance. A few days back, as I was browsing through the old stuff I have gathered over the years, I thought why not write about those wonder years that I spent in Lucknow - 1998-2000. Though I spent four years in Lucknow only the last two were worth remembering.

It was a hot afternoon of June 1998 when I saw Gautam leaving Sanjay's house on his Hero Puch bike. He stopped outside my house and we started a conversation on what he is doing and what I am doing these days. That's when he mentioned about a computer diploma course from UPTEC. The diploma was the 'O' Level Diploma by Department of Electronics, Govt. of India. I had no idea what he was talking about. Computers? What do you do with them? Oh Yes, I have seen computers at school and I've done a bit of programming in LOGO and I've also seen the railway clerk booking a ticket but how can you make career in computers. I went to government schools (Kendriya Vidyalaya) for the last four years of my school education. Computers was a subject there but I never got a chance to even touch one. It was all about reading the basics (Input and Output devices, CPU, Storage devices) and taking the exam but computers always fascinated me.

We all were out of the school but nobody had anything in mind about the future. Engineering, Merchant Navy, Bank Job, Railways, Army there were so many different things. I had nothing else to do besides preparing for Army and Bank papers so I asked Gautam to get me a prospectus for this course. The next day he came with a prospectus and I gave him Rs. 50. The prospectus was for one year diploma course at UPTEC that would prepare us to get a 'O' Level Diploma. The prospectus mentioned that UPTEC will provide their own diploma for the course undertaken but the course does not guarantee an 'O' Level Diploma. We were supposed to pass four different national level exams to get the real diploma. The main thing I had in mind was that I'll get a chance to study computers so I filled in the details and submitted the form. An entrance test was held a couple of weeks later and I passed it. The longest and the most enjoyable journey of my life had started as I stepped into this virtual world.

The course covered mainly the fundamentals of computers, batch programming and the 'C' language. The first day I entered the computer lab was the first day I grabbed the mouse in my hand. We were asked to boot the computer. I heard a few beeps and then saw some numbers running the screen. Wow! Computer! felt on top of the world. Everything settled a few minutes later and all I can see was a black screen with a "C:\" and something blinking and blinking and blinking. "What do we do now?" I asked Ashish who was my batch-mate  He knew nothing so I kept waiting and looking at other people's screen. It was my first day so I avoided any kind of experiment with it. I thought of typing something in but then changed my mind. "Type win" heard someone saying "and press enter then". I typed in the three magic letters and pressed enter. Windows 3.1 splash appeared on the screen. The next few minutes passed looking and admiring the beauty of things on screen. Changing colours and dimensions and then finally settling for a "Program Manager" window with a few pictures inside it. It was truly an amazing experience for me and I hope for the entire class too. Though some of them were not so amazed probably because they already had a PC at home or computers wasn't something they liked. "Now what?" I asked my teacher. "Grab that mouse and open Paint progam" he replied. I grabbed that funny looking thing and moved it. "Yo, did you see that? when I move that funny thing something even more funny happens... see that small pointer, it moves" excitement grew to a new level. The teacher showed us how to 'click' and 'double-click' using that funny thing in hand and finally I was able to open Microsoft Paint. "OMG this is such a useful piece of machine" I thought to myself. That day I spent the remaining time in the lab to draw the blue-red PEPSI logo with of course my name at the bottom.


The first big thing for me was "MS-DOS Batch Programming". It gave me the first feel of how you can program a computer and make him follow your commands in an ordered way. Do this, then this, if this is that then do that and so on. Thursday and Friday were the only days we were allowed to use the machines, that too for only two hours per day. Two hours were too less for me to develop something so to cut down on the application design time (like I knew what application design meant?), I would write batch program at home in my notebook and dry run them for hours. This was to make sure that the program will run in the first go and to avoid any debugging delays in the two hours session. I made a lot of batch programs. I thought the only programming one could do is the batch programming till I met 'C' and soon realized the power of this new language and started writing all sort of programs from 200 years calendar (found at the back of some notebooks) to personal diaries with its own record management system (obviously I had no experience with databases). Schaum's Programming with C was my first 'C' programming book -- actually my first programming book. I never studied for the 'C' exam but working on these small projects paid off and I got an "A" in the 'C' programming paper of 'O' Level. Programming and computers were now an addition and I enrolled for the advanced level diploma ('A' Level) after clearing 'O' Level.

I always wondered how people make nice looking Window interfaces with buttons and lists and the colourful backgrounds. The Digit Magazine use to have a dedicated folder in their CD for small applications developed by Indian programmers. It had many interesting application all with nice looking user interfaces. I asked my teacher Mr. Rahul Navneet Singh about it. "Try Clipper or FoxPro, you can create user interface in them" he said. I and Sarvjeet went straight to the computer market that day which was in Hazratganj lane, near Mayfair Cinema (now closed). I got a CD with both Clipper and FoxPro 2.6 (or maybe Visual FoxPro 5). FoxPro turned out be an entertainer and I made a few database projects in it including my 'O' Level project. I remember the login screen I made for a test project, it was inspired by Boris's Hack program in the movie Golden Eye. and I also remember how I saved myself from embarrassment by quickly turning off the computer monitor when this login screen jammed while I was testing it and a neighborhood lady came in at that very moment (Murphy's law I guess -- If there is a worse time for something to go wrong, it will happen then).


Browsing Internet was considered a luxury. The shop close to UPTEC would charge Rs. 120 for an hour of browsing. Rs. 120 was big part of my monthly pocket money and so does for my friends. There was this guy who worked in a cyber cafe. He use to sell internet username and passwords for Rs. 50. The passwords belonged to some government offices having a part of their budget set aside for internet but never used it. It was expensive even after getting the passwords because it consumed local calls (Rs. 1.5 or Rs 2 per 3 minutes).

Computers and classes were not the only thing we did during these two years at UPTEC. As a foodie, I and Sarvjeet use to roam around the city looking for good (and cheap) street food. Entering a restaurant was a luxury only to be enjoyed on someone else's expense so we waited for birthdays (of course not ours). The dhaba just in front of UPTEC served great samosa-chole for Rs. 5 per plate. It was perfect for a quick lunch break from our 'A' level classes. When we had a little more time (and money), we use to have biryani which was Rs. 25 per plate that time, so we shared it. It was an amazing biryani with white, green and saffron rice. It was so tasty that we often had to go for "Biryani Part II". "Biryani Part II" was when we had a plate of biryani, went back to the class but could not resist coming back and having the second plate. Then there was Rovers, near GPO in Hazratganj. Rovers was famous for fast foods such as burgers and rolls, mainly the Chicken Kathi Roll and Paneer rolls.

Samosa-Chole


A few months later, someone told me about Visual Basic and how easy it is to design an application using its visual designer. I called up Sarvjeet and we again went to the computer market. I bought a CD with Visual Basic 6.0. It was damn expensive, Rs 150 for a single CD. Visual Basic was a star, I was up and running in no time. It was exactly the kind of stuff I was looking for - Fast, Easy and Powerful so I dived deep into it, often finding myself awake till 3 AM. Calculator, NoteKeeper, Encryptor, I made them all. The real fun was distributing these small applications among friends and getting their WOWs (which actually never happened). A 1.44 MB Floppy Disk was the popular media those day. I remember packing my first VB calculator on it for Sarvjeet and Koshika, they both had PCs at home. Both came back saying that it did not work on their system, some error message was displayed and then took two days to tell me the exact message. A few days of research taught me the basics of Dependencies and this time I used Visual Basic Package and Deployment Wizard to pack the application. It was a weekly affair to ask close friends to test my programs.


In my next post (which I hope I'll publish in the next few days), I plan to write about all the small applications I developed during these wonder years. Encryptor, KissMe Java Applet, MS-DOS Explorer, my software cracking experience and some of my hacker friendly web sites which were banned.


(All the images used in the blog belong to their respective owners and are used here for illustration purpose only)

We are Robots

I've always been fascinated by UFOs ( Unidentified Flying Objects ) and stories related to these alien objects. The first story that I ...