Monday, December 29, 2008

LSJ: The Blue Screen of Megadeath


Shudder. For those of you who have used Microsoft Windows XP, be afraid, be very afraid. Because the British Navy has just upgraded its nuclear (powered and deterrent) submarines to the state-of-the-art control technology -- Microsoft Windows XP. A stripped down version of it, if that be any consolation, which it is not.

Check out the Linux Journal article: Blue Screen of Megadeath

"We can't speak for anyone else, but the thought that somewhere floating out there are two hundred nuclear warheads under the control of Windows XP scares the living daylights out of us. If anyone needs us, we'll be building a bunker in the back yard before one of the boom-boom boats throws a blue screen of death and blows us all to kingdom come."

Boo!
~Shashank

Mounting ext2/ext3 partition in Windows

Having no Linux disc at hand in order to live-boot and see my "Back2Basics" root filesystem files in X Windows (I removed X Windows as well, remember?), I found this interesting tool for accessing the Linux ext2/ext3 partitions from inside Windows. It works with almost all versions of Windows, but doesn't do reiserfs, and others.

Check this post out: Post
Download the tool from here: Download

Cheers
Shashank

Saturday, December 27, 2008

Real-time color scheme generator

Here's a very interesting and ingenious tool I found on the Internet: A real-time color scheme generator that does a Yahoo Image search for the term you search and returns the most prominent colors in the images returned.

Here's what they say:
"We take 5 related images from Yahoo Image Search and then show the most prominent 6 colors from each image. Each column of colors is taken from a single image."

Check it out: link

Cheers
Shashank
PS: Why the hell is Google displaying Visual Ads now? It is just going the same way as the other old internet-advertising agencies went - ugly, intrusive and heavy picture ads, and some of them even Flash-based! So much for light, elegant and unobtrusive text ads.

Friday, December 26, 2008

Day two: Back2Basics Linux


Having vowed not to spend my 10-day winter vacation doing anything serious, I decided to play a bit with Linux, apart from reading the novel "She" by H. Rider Haggard (of Allan Quartermain fame) and revisiting the Beatles' album collection I got hold of just before setting off from college.

Anyhow, one of the first things I did when I got home was to strip off /everything/ from my ancient Ubuntu installation in the PC at my home, and essentially removed ALL the packages other than the important core and base and essential ones. This brought me down to the beautiful command line at the next reboot, and then I to do a little tweaking with the /etc/init.d/rc to display some messages and request for user login, instead of asking for root login (it was configured to spawn /sbin/sulogin, instead of login) and such. All this led to a cool "Back2Basics" Linux, which still takes around 800 MB because I haven't removed a LOT of unneccesary libraries incase I break something (I've done that once before). So I'll proceed to do the stripping work soon (hehe). I got hold of this O'Reilly book on Building Embedded Linux Systems sometime back and it lists this minimum required directory structure for the root (/) filesystem, and another book on Embedded Linux (whose publisher I cannot recall) which listed the bare essential binaries and the corresponding libraries required. So I'm planning to base the stripping-down on the guidelines in these books, and of course using the ldd command to find the dependencies of the desirable binaries incase I want something extra. I replaced the GNU utils with Busybox yesterday. My target is to just have the Kernel Image, Busybox, Perl, and Java. Lets see what comes of it. ;-)

Also, I'm working on a new categorized layout for this blog, something I'd developed two years back but never implemented. Its going to automatically pick the most popular categories and show posts filed under those in square boxes, and the more popular categories will be higher up in the boxed, 3-column layout.

Cheers
Shashank

Monday, December 22, 2008

Network scanner script

One of the more useless handiwork of a wasted 2 hour lab session:

A shell script for scanning the network with Class C IP Addresses from 192.168.0.1 to 192.168.255.255 and listing the active IP addresses. It writes it to a file called IP_list as well as echoes it.

ip_scan.sh:
-------------------------------------------------------------------
#!/bin/bash

# A Useless network scanner
# by Shashank Shekhar
# - Scans the Class C network from 192.168.0.1 to 192.168.255.255
# - Note: Ping doesn't always return the true state of a network node
##

for ((i = 1; i < 256; i++))
do
for ((j = 0; j < 256; j++))
do
ping -c 1 -w 1 192.168.$j.$i > opFile
cnt=$(grep -c -i " 0% packet loss" opFile)
if test $cnt -eq 1
then
echo "192.168.$j.$i is there" >> IP_list
echo "192.168.$j.$i is there"
fi
done
done
Cheers
~Shashank
PS: I was so bored.

Edit: Evil text-garbling spirits, Stay Away!

Sunday, December 21, 2008

Life in other places. What is Life?



The question of whether there is life in other places in the Universe requires a fundamental question to be answered: What is the definition of life?

This is not a spiritual discussion on Life and its meaning, but for those who thought it was, do read on. Fresh viewpoints are always stimulating for spirituality.

People tend to have very varied and often biased views with regards to their definition of Life. Most would think of a grotesque humanoid form with a head, two arms, two legs as an instant reaction to the question, while others might take more colorful forms: octopuses, crabs, giant ants etc. These have been covered extensively by countless science-fiction material, books, movies etc. These view points are flawed at several places:

a) These replies do not even answer the question: "What is the definition of life". These just provide the answer to the specific question: "What would living beings look like in some alien planet". A sea of difference.

b) They all assume that the physical and environmental conditions required for life are similar to that of the Earth. The fact that life could exist at 12,000 degree centigrade is just absurd, in these viewpoints. But living cells have been found on Earth in the most extreme conditions [1].

c) They all assume that "Life" is Carbon-based, and in-fact, material. What I mean is, they assume that the dependence of Living beings on Water, Oxygen and Nitrogen is universal. This "life" that people talked about involved Amino acids and nitrogenous compounds forming the basic genetic material and cell structures that coordinated to form the diverse life-forms that we know of. But this entire set of known life-forms are mostly based on Nitrogenous compounds with dependence on Hydrogen, Oxygen and Carbon. Assuming that life could evolve only from these is a precarious one.

I do not claim to have the correct answer. The purpose of this article is just to try to broaden the scope of thought and opinion of what is living and what is not.

What is Life? The property that makes entities living. Thus if a set of rules determine that the entity in question is "living", then it has "Life". Hence the question narrows down to determining the set of rules that declare an entity living or non-living.

This is where things get fuzzy. I'm afraid there will never be a conclusive, definitive and "correct" answer, but just our viewpoints. Just like our viewpoints of what is "right" or "wrong" determines laws and so-called morality.

I think an expanded and relatively broad-minded checklist for a single "living entity" would be:

a) Should be responsive to external environments and stimuli
b) Should be able to self-sustain for as long as possible in the environment
c) Should be able to change itself and adapt in order to continue existence

Is reproduction a necessity to certifying something "living"? Probably not. Because a single male or female of the human species, or any sexually reproducing species, cannot reproduce without involving two entities. Thus a single man would not be able to reproduce alone, and would hence be declared non-living by following that logic.

Note: Do not read the following lines if you have had enough mind-expansion for the day.

This expanded view brings us to a series of interesting ideas. Could life forms exist in electromagnetic waves? Why make the assumption that life needs to have material composition? Electromagnetic waves are doomed (in a way) to keep propagating ahead in space until their energy is absorbed by any entity they collide with. But what prevents us from calling a man who keeps running non-stop until he vaporizes by running into a blast furnace as living? You'd say he's living even though he's constantly running non-stop because he can change himself, he's interacting with the environment and external stimuli, and because he is... well a man!

But similar is the case of an electromagnetic wave. Its a bundle of energy, like every man or for that matter, "matter". If some quirks of nature in some part of the Universe would cause these bundles of energy to self-sustain on loss of energy, and suit themselves to the surroundings, all while running along at the speed of light constantly, would they be called Living? I believe they would, and should.

Cheers
~Shashank
PS: Image: X-ray of the left hand of a ten year old boy with polydactyly.

Friday, December 12, 2008

The Curse of the Gravel Machine

Trudging through college life, we come across several obnoxious myths, stories and legends belonging to our college. One such legend I came across is that my college is a cursed one. The curse is that the moment it stops constructing something new, building a new annexe block, pulling down a perfectly nice place and building another... the moment it stops constructing... It will cease to exist! Just like that. God's WILL.

Obviously its obnoxious and untrue, or so we'd hope as long as we're here. But the construction bug has bitten my college since before the guards were toddlers (or so they say), and you're bound to collect different proportions of sand, cement and pebbles in your slippers depending on which path you take across the hostel campus.

Oh and I'm on a break from blogging, which is an odd statement to make since I blog in intervals of decades anyway. I'm also on a break from nosy-technical-fun-&-games since there are a couple of exciting new projects I and my friends have embarked upon which is taking up all my time.

Cheers
Shashank

Sunday, November 23, 2008

Some sad news

Been busy with exams, and work on the latest project which we're submitting for this year's Google Product Prodigy. But this post is not about that.

This post is about the tragic passing of my friend, Ishan Goel, who passed away a few days back. He was just 20. He was a colleague in the Sun Ambassador programme, i.e. he was my colleague at the Sun Open Source club we were founding here at college, and worked very hard with me in making the Software Freedom Day (September 2008) a success, and also a member of our last year's Google Product Prodigy team (which I covered in great detail in a series of blog posts previously), which we worked for close to 6 months together. A brilliant and immensely creative fellow, and a "Linux Helpline". This is not an obituary, or any formal note of sort. It's just hard to absorb this. My hand still tries to dail his number whenever a problem with my Linux system occurs.

~Shashank

Saturday, October 18, 2008

Hello World! iPodLinux - Java style!


October's been a good month for me, and better for my iPod. iPodLinux.org is back online and they've released a couple of pretty neat tools, and updated builds. Loader 2 (the new bootloader) is great - no more messing around with complicated wheel/key combinations to select the boot OS. Loader 2 gives you a GRUB-like list of installed OS images on the iPod disk, and can read kernel images from ext2 and ext3 partitions, as well as FAT32 (W95). So this effectively removes the need to re-create the firmware each time a kernel update takes place. All you need to do is use ipodpatcher (which originally was used for installing Rockbox) and install Loader 2, which will now get merged with the Apple Firmware.

The Podzilla interface has been improved too, and lots of annoying little problems have been ironed out mostly. The text-input is (or atleast, feels) WAY better now, and I can actually input something meaningful in a meaningful amount of time. Here is the text file I "typed" (with awkward scrolling and tapping) on my iPodLinux's PodWrite with a "Scroll with Prediction" text-input mode:

first.txt : "This isn't bad at all. The prediction algo is pretty good as far as this text input session is concerned. Took me 10 minutes to input this on the iPod, but I'll improve I guess."

Then I finally got my first Java program running on the iPod! After encountering wierd errors and battling nasty iPod text-input mechanisms for months, things have finally come to a closure. The latest build of podzilla, makes things easier, and thus enabled me to run Java programs using the K Virtual Machine (kvm) by Sun Microsystems. I got hold of the kvm binary from some place, but I don't think its available on the Sun website anymore, which is pretty odd. But this is how I got my "Hello world" in Java working on the iPod:

1. Install iPodLinux by using the latest Podzilla and loader.
2. Download kvm from here. Put the kvm binary into your iPod's /bin folder and make sure it has execute permission.
3. Write your java code, but keep it simple. KVM just supports basic I/O, data types, Vector, Stack and a couple of other simple things. No graphics, gui etc. For e.g.:

Test.java:
public class Test {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}


4. Then compile the code to the JDK 1.4 format:

#javac -source 1.4 -target 1.4 Test.java

5. Finally, create a script file in gedit or vim called, say, Test.sh:

Test.sh:
kvm Test


6. Save the script file in the same folder as the Test.class file, and give both Test.sh and Test.class execute permissions:

#chmod +x Test.sh
#chmod +x Test.class


7. Put all these files in some folder in the iPod's Linux partition. I put it in "/home/shashank/java" (on the iPod partition, not your own system! Also avoid spaces in your folder path.). Then boot into iPodLinux and open the folder where you placed the files using the File Browser, and scroll to "Test.sh", and keep the "Select" button of the iPod pressed until the context menu shows up. Then select "Execute" and select "Read output". Voila! You should get the two words: "Hello World!" on your screen!

No cross-compilation, no recompiling of gcc to work with ARM7 processors (most iPods run on ARM7 processors, thus C code compiled on your PC will not work on the iPod). Life is easier with this if you want to do simple programming. Maybe if someone wrote an extended Virtual Machine, with more libraries, then it would make this a pretty solid platform.

BTW, the above steps have been written assuming you have a Linux/UNIX machine. If you have Windows, a VMWare or xVM VirtualBox image of some Linux distro on your Windows machine would make life tonnes easier compared to trying to use Windows' limited functionality with everything in life in general.

Cheers
Shashank

Thursday, October 16, 2008

Possible loophole with dd command in multi-user Linux servers


Possible loophole with dd command in multi-user Linux servers

I didn't think this would be a big deal, but I noticed that several remote logging Linux servers permit users to have an unlimited disk quota, which can easily be exploited using a command like:

~$dd if=/dev/zero of=null.bin

It doesn't require the user to 'sudo'. I checked it out in one of the remote access servers that need to be logged in to using Telnet, and I executed this command and was surprised to see it being permitted and having a free and unchecked run. Effectively, /dev/zero is a virtual disk that can generate a series of 'zero' bytes, and the 'dd' command will copy from the input file (i.e. /dev/zero) to the output file (null.bin here) and will not terminate until it reaches the End of File of /dev/zero. And because I didn't give it any count or bytes limit (which can be done using the bs=xxx and count=xx parameter), and since it never reaches the end when reading from /dev/zero, it will effectively create a massively huge file within seconds, and fill up an entire normal-sized hard-disk in about a minute and a half! I tried it out and in less than 7 seconds, I had created a 962 MB null.bin in my home folder. And then I tried on a virtual machine (Ubuntu 8.04 Hardy Heron running in VMWare on Windows) I had created, with a fixed disk-space of 3 GB, and in about 10-15 seconds my 'dd' command died with a "No space left on disk" error message.

I'm not sure if its really a loophole or not, but it certainly made my home directory expand to 1.2 GB unchecked within seconds in a remote telnet login to a Redhat Server. If it is a loophole, I think it could be solved by assigning a strict disk-quota to each user, encompassing the total areas where he can write to.

~Shashank

Friday, October 10, 2008

How to boot from USB in xVM VirtualBox


I've looked around the internet a lot and mostly didn't find any working solution apart from trying to make an image/virtualDisk from a raw physical disk (USB). I was basically experimenting with writing simple bootloaders in assembly language, and wanted to rapidly test and make changes to the code without rebooting my system again and again to try booting. The obvious solution is to use a Virtualization tool like VMWare or xVM VirtualBox by Sun (the latter is free), but the trouble is that neither of them support booting from pen-drives and I have long forgotten the existence of floppy drives, and have thus no way of directly writing to a disk and virtual booting straight-away, without creating an new image of the disk each time I make changes to it. So I decided to write to my USB pen-drive directly and try booting from it. It works when I boot the entire computer with it, but VMWare and VirtualBox do not have the option of booting from a USB device.

So messing around xVM VirtualBox 2.0.2 36488 for Windows yesterday, I was pretty surprised to find my USB Pen-Drive listed under the field of Floppies! That is,

a) Create a new Virtual "Machine"
b) Click on the "Floppy" link in the main screen (right panel)
c) Enable "Mount Floppy Drive", and from the drop-down list in "Host Floppy Device", select your USB drive's Drive Letter (haven't tried it in Linux, I guess you'll have to select the correct device like /dev/sdxx)

That's it. Try starting the Virtual Machine now.

Its quite wierd, and I'm still wondering why my USB drive gets listed under floppy, but it works for me! Neither VMWare Workstation, nor xVM VirtualBox permit booting directly from the USB otherwise.

Cheers
Shashank

Sunday, October 05, 2008

Of the Elusive Breakfast Syndrome


I really have a problem, or rather had one. It is an uninteresting topic for anyone but me, but I haven't managed to have breakfast on any weekend this ENTIRE semester i.e. in the past 4 months. I have never managed to wake up before the closing hours (9 am) of the hostel mess (often I directly wake up for evening snacks on weekends, let alone breakfast and lunch). I have even attempted, several times, to stay awake the entire night, till the golden moment when the clock struck 6:45 am, and each time some odd conspiracy of Nature conspired against me. Once I watched a movie till 6:35 am, and then pondered over how to pass the intermediate 10 minutes, and then continued pondering as I next regained conciousness at 10:30 am. Then once I managed to sleep off on the floor of my room, beside my door, while trying to open it to leave for the mess, again at 6:35 am.

Today, however, I grabbed Fate by the wrist and bent it to my will! I left my room at 6:30 am, as I was sure I wouldn't manage to survive any longer after watching Lord of the Rings III (for the 5th time), and also figured that I probably wouldn't sleep off in the corridor beside the mess, though I'm not sure I'd put that past my capabilities. Anyhow, here I was - unshaven, unkempt, with a haggardly-desperate look, sitting outside the stairs of the mess waiting for it to open. Then I tried walking around the area a bit, and I discovered I didn't like the cold air too much, and again returned to my patient look-out post. And then, the Gates of Destiny opened! And I had wonderful breakfast, and Tea! One of the greatest battles of will and destiny in my life had been fought, and I had emerged the victor - a fed victor at that. :-)

Shashank
PS: I haven't gone loopy. Food breaks the best of men, I'm just a mere, humble mortal.

Saturday, October 04, 2008

DMOZ Local Directories and BatchDMake


Today morning I finally settled in to perform a long-pending weekend house-cleaning job, except that the cleaning work was electronic, i.e. my computer. It is a common scenario to find your files so badly scattered around the hard-disk, inspite of some organization scheme that we all implement. Years ago, I saw a nice scheme Roshan, a friend of mine, implemented. He created directories and sub-directories based on topics and categories, like "Science", "Computers", etc, and Science would contain "Physics", "Chemistry" ... while Computers would contain "Programming", "Internet" and so on. It was a complete hierarchial structure, and I've been using it on my systems too ever since I saw it there.

But, its hard to maintain my directory, as creating such a structure is a rather tough task. You could either create an entire directory structure before-hand, with empty folders waiting to be filled, or you could create new folders as and when you require, in the correct category of course. The latter option obviously seems more efficient, as you don't have an empty mammoth directory structure, but a dynamic and to-your-taste structure. But after several years of trying out both, I have found that the first approach is much better. When you are, say, saving a file from the Internet, you often don't have the patience to ponder over the hierarchial relationship between "Geese Hunting" and "Duck Hunting", and whether you should create a new directory for each, or just club them into one single directory called "Bird Hunting". This inherent impatience of people when using files, as understandable and natural it is, is THE reason why files are scattered and chaotic. Thus I have concluded that people need an existing order to follow, that is as extensive and accomodating as it can be, but also flexible in order to allow people to delete and modify and create new topics and directories.

With this long discourse on the philosophy of file management in mind, I sat about thinking! :-D

This is what I came up with: Why not use an existing MASSIVE topic-wise directory structure, which has been developed and nurtured for about a decade by tens of thousands of people across the world? That directory structure is the DMOZ Open Directory Project (http://www.dmoz.org) by the Mozilla Foundation (of Firefox fame). It forms the backbone of Google Directory and several other places on the internet, and is a collaborative and open effort at building efficient web directories. My interest, however, is not in the links to websites that is provides, but the topic-based organizational structure. And as luck has it, they offer a downloadable plain-text file containing the ENTIRE folder structure. Perfect. Its available at:
http://rdf.dmoz.org/rdf/categories.txt (57.4 MB)

Then I wrote a simple tool in Java called "BatchDMake", which will read a given text-file line-by-line and create the folders listed in it. Each folder path is listed in a separate line. For example, this is from the DMOZ dump:

Arts
Arts/Movies
Arts/Music
Computers
Computers/Artificial Intelligence
Computers/Games


The syntax for operating it is:

java BatchDMake [filename] [root folder]

The filename parameter is obvious, the root folder is the folder name relative to the current working directory in which it should create the folders listed in the text file. For e.g. using the downloaded DMOZ categories file:

java BatchDMake categories.txt dmozRoot

The source code for BatchDMake is available here, and the executable .class file is here.

I just created the ENTIRE folder structure of DMOZ on my hard-disk, it has about 770,000 directories & sub directories. A lot of them are useless ones, so I'll go about pruning the tree to come up with the most useful structure for normal users. Will post that one soon. In the meanwhile, you could try the DMOZ structure and use BatchDMake to create it on your system!

Cheers!
Shashank
PS: I even found the place I'm currently in!
root\Regional\Asia\India\Tamil_Nadu\Districts\Vellore
This is like exploring an uncharted world in your hard-disk! :-P

Thursday, October 02, 2008

Software Freedom Week 08 - Phew!


Note: This is a blog post I'd written in a state of half-sleep at 3:38 AM, 27th September, 2008. I slept off before managing to send it and forgot all about it, so here it is. :-)

Sitting at 3:38 AM, while browsing the Internet for some interesting articles, I found I had received a new mail. Looking into my Inbox, I discovered that the mail had been entered into my "Friend Networks" label, and it turned out to be an insistent invite (he had sent it thrice) from a friend in a social networking site, and the invite reads: "You have been invited by ____ to join the community: I LOVE FRUITS". Need I ask, "Huh?"

This was meant to be a blog on the "Software Freedom Week", which more or less got concluded today. Technically, it finishes tomorrow, but the only event we're having tomorrow is the passive collection of Abstracts for the Product Engineering contest and a party! So no crazy real-world events that require fighting with the "bureaucrazy" and stuff. The last one week has been a very hectic period, which reminded me of the days of our "IEEE Resonance", the two-day National Level Technical Fest, held in March earlier this year. That event was gigantic and I, as one of the 3 main organizers, probably lost several years of my lifespan due to the stress and workload that went into organizing that event.

This Software Freedom Week was organized together in a VERY short span of time. Really. It sets a sort of personal record, as the only Large Scale event I've organized within a span of 9 days. The other large events have me and the core team starting work atleast 3 months in advance. The entire idea that we Sun Campus Ambassadors have to organize a Software Freedom Day in our colleges by 27th September became clear only once we had done our Induction & Training programme at Noida from 5th - 8th September.

Our SFW went off pretty well! We managed to conduct several successful installfests, and installed and distributed openSolaris DVDs to atleast 30 folks! The other guys installed some distributions of Linux, like Ubuntu, Fedora and openSUSE. Then our Linux & Unix demos were quite successful with a lot of interested people turning up who managed to get an intro to the basics of the file structure and philosophy of the Unix operating system, as well as some common tools and commands. Our Programming challenge paper was very well appreciated by all the students as being "damn interesting to solve". The biggest success was the "Mobile Application development using NetBeans" workshop which I conducted yesterday evening (26th). The turnout was HUGE and the guys were amazed at the ease of developing MIDlet apps using the Visual Editor. There was a pretty strong request for conducting an advanced session for them soon as they wanted to learn more about this. :-) And just to recall that I myself had been trained at this for the first time 3 weeks ago in Noida!

Organizing large events at a very short notice leads to nightmarish organizational problems, and can easily spin out of control to lead to horrible mis-management and utter chaos. We came close to it during the hiccup that happened on the first day with the venue conflict with another department's research class, and it took us a great effort to continue with full speed throughout the week inspite of the regular, minor-but-painful hiccups that occured. We always managed to solve them somehow, but the fact that they appeared shows that a lot more work could have gone into the planning process. Yet, I do not regret anything, and even though I am so totally physically and mentally exhausted, I can still say that the SFW was one of the most challenging and awesome things I and my friends have attempted. And I enjoyed it and the great response it generated. But now we're planning a FAR larger thing in December. A sort of a Open Source Mega Fest at the top levels.

More soon, I'm too sleepy!

Cheers
Shashank
PS: No technical work has been possible over the past one week
PPS: Metallica released their new album called "Death Magnetic". Most of the songs are just average in my scale. I like "Cyanide" and the intro of "That was just your life". And Kirk Hammet is finally playing guitar solos again. His solos were cut out of the last album: "St. Anger", which was a welcome return to Thrash Metal. In my opinion, all the songs on the St. Anger album sounded like an army of tin-soldiers sprinting over a tin bridge, and a song playing in the distant background. Heh!

Tuesday, September 23, 2008

SFW & WTF ...

Note: The following post is organized into five sections: Boring, Bad, Interesting, Personal, TechNotes. Pick the kind of news that you dig into most!

Boring Stuff:

Although the official date of my appointment as the Campus Ambassador in VIT for Sun Microsystems is August 1st, I officially was handed the reins from September 1st, and real work started off on September 8th, the day I returned from the Sun Induction & Training programme, Noida. The task at hand, the first order of business, was the "Software Freedom Day" that each CA had to organize in their respective colleges and universities and spread awareness about Open Source and impart knowledge etc.

Organizing large scale events at short notice is a rather dangerous thing to do, especially when you have an elephantine "bureaucrazy" ready to thwart every move of yours.

Bad Stuff:

We had a pretty bad false start in our Software Freedom Week where the administration decided to, without fore-warning, re-allocate the venue of our "Inauguration & Intro to Open Source" event to some Embedded Systems class, and we had thus move event to another timing. This was indeed frustrating and embarassing, but we explained the deal to the assembled audience and informed them of the revised schedule.

Interesting Stuff:

We had a great installfest today, and the revised Open Source introductory session. The folks turned up and were real innocent about Linux & Open Source, and we had a nice time explaining to them the difference between Open Source and Freeware, and so on. I probably did get a little emotional about Open Source at one point when a guy asked me, "Why do we need Linux when we have Windows which fulfils all our requirements". Imagine that. Any person reading this who doesn't see this question as absurd, is pretty seriously naive!

We also showed people "Big Buck Bunny", a short animated movie made using Blender, and was a great hit among people. The movie is absolutely hillarious!

Personal Blabberings:

Anyhow, this was Day 2 of the "Software Freedom Week" here at VIT University, and battling new catastrophic problems everyday and nearly ruining events and then miraculously managing to pull off a great show is something that is now something really really very familiar and all-in-a-day's-job occurance for me and my friends. Can't say I really enjoy this kind nerve-wrecking event management anymore -- am quite a veteran now, after 2 years at it; but I have better and newer plans for getting Open Source a greater reach among students out here, instead of just organizing Plain-Jane events like today's. This is the Participation Age, not the age for delivering sessions and telling people how and what to do. More about this unconventional idea in my next blog post!

Tech Notes:

On the other hand, my messing-arounds with my iPod hacks (here) has been getting more productive. I recently got some nice programs of mine running on Rockbox, and have decided I like iPodLinux once again! :-) Nothing wrong with Rockbox as such, but I feel that with iPodLinux having the comfortable "Linux structure", it makes more sense porting the nicer features of Rockbox to Podzilla and maybe in the process bring some things back to Rockbox as well. The other major interesting iPod-related thing is the in-depth reading-up I've been doing about the "Apple Accessory Protocol" (AAP), the set of commands iPods use to communicate and allow the world to control the iPod remotely through the Data Connection Port. This makes the critical part of my iPodMouse project pretty easy! :-)

Cheers!
Shashank

Friday, August 29, 2008

Upgrade to a dial-up!


Well, here it is finally. Internet in my hostel room. And man, is it fast? I rejoiced when my download speed finally managed to reach 10 KBps at 2 in the morning, and average far worse during regular "earthly" hours. Yet, adaptation is the key to survival. After having paid a substantial amount for this wireless datacard (Reliance NetConnect), I am finally on the internet which is a highly liberating experience, regardless of the speed of connection. Hard to describe in words! :-)

I've been messing around a lot with Rockbox, another OS-type thing for an iPod, and was thrilled to see real video files being played on my ancient iPod Mini 2G (4 GB)'s tiny, monochrome screen. Who said that video was the domain of expensive iPod videos only?! Take an iPod nano or something with a color screen, install Rockbox and BANG! you have excellent videos being played, and with capabilities of extending the codec base. I've been trying to get hold of the various components required for compiling for ARM6-processors, which is rather hard to do without a proper source of unrestricted fast internet. Rockbox allows you to write your own "viewers", which are programs that can process specific types of files, like associating .mpeg files with the mpeg-Viewer, .txt files with the text_editor viewer etc. You can also write plugins to provide new applications. Once my development environment for ARM6 (and Rockbox specifically) gets set I can work on some of the interesting stuff I think can be put in. I would rather like some simple HTML viewers, and a Java virtual machine on it. KVM (released by Sun microsystems) does something of that sort, but hasn't been running all that well for me. Infact it has run at all.

Then I also got this idea of controlling my iPod through my PC, maybe write a simple mouse controller program in Rockbox, which can take inputs from the data-cable connecting it to the PC, and therefore permit me to move my real physical mouse of the PC to control the cursor on the iPod screen. This could later be expanded upon to eliminate the PC by writing mouse-drivers in Rockbox and then using a USB mouse and connecting it directly to the iPod via the iPod data-cable. That would make life tonnes easier for using advanced applications in iPodLinux/Rockbox.

Anyhow, more later. I am too busy sitting idle, waiting for "Google.com" to open. (*rolls* eyes).

Shashank

Saturday, August 16, 2008

I had hair...


Don't mistake me. I still have hair, albeit, 8 inches shorter. Farewell my dear long locks. At my prime, I had hair till my shoulder-blades. Now they barely are an inch long. Two and a half years without paying a visit to a barber; feels like I've lost an arm or something. But anyway, why am I boring you with my story of locks lost behind?

I've been studying. No really, I finally have been studying new stuff. Not academic stuff related to what's taught at University (who cares?!) but new interesting stuff. More specifically, I've been enjoying myself by playing around with Mandelbrot sets, Julia sets etc. With the result that I've started manufacturing a sequence of rather spectacular wallpapers by applying various color filters and mapping different parts of the above mentioned sets.

The other things include a compulsary mini-project as a part of our 5th semester curriculum, and we're working on simulation of artificial personality in software bots. You can poke, hit, pat, feed bones etc to an artificial dog and view its responses according to the selected personality, and it will vary over time depending on the past interactions. I'll post on some demos once we have a decent build ready. This time, as it is compulsary and there is a strict deadline, I will finally actually complete something rather than touching it and leaving it to bide time once the interesting parts are done.

Oh, and I finally got iPodLinux installed on my ancient iPod Mini 2G, and it is really great and Awful. Great because it is Linux running on an iPod, and all the cool demos and stuff that can be done with it. Awful because the input method is limited to a dumb touch-wheel, so to input text, I have to circle through a list of alphabets each time. Use it, and you'll know how painful that extra-sensitive touch-wheel is. Another reason it is awful is because it is difficult to program for it as I have to use ARM6-gcc for it. And there is no Java on it. And arm6-gcc is hard to install correctly on my openSUSE machine back at the hostel because I have no internet which effectively makes installing any package with millions and zillions of cross-linking dependencies a nightmare.

Finally, I'm planning to take an internet connection at my hostel room, which will make life "normal" for me again. I have been selected as the Campus Ambassador for Sun Microsystems, which means that I represent Sun in our University, and had to go through a rigorous process of interviews etc. Anyhow, I am supposed to promote Open Source and Sun stuff in our campus, which should be fun I guess. And I get a stipend for it too! :-)

Shashank
PS: The image at the start of the post is from a specific region of a Julia set.

Sunday, June 08, 2008

Back to the 'Drawing Canvas'


I've been checking out the new canvas tag that's scheduled to be a part of HTML 5, the next specification of the web markup language. And I'm pretty impressed. The Mozilla guys have been doing some neat work with the Canvas and have a nice documentation ready for Canvas 2D: here. If you're reading this in Opera, Safari or Firefox, you've already got Canvas supported and running in your browser! Internet Explorer, of course, doesn't have it. But the folks at Google have written a neat thing called Ex Canvas, which allows you to just include an extra javascript file and have your code running in Internet Explorer too! I think the Canvas tag has some potential of being really accepted and supported by all the browsers, which means that its good for developers like us who crave for atleast ONE technology supported properly across all the browsers, apart from the standard (or rather, now not-so-standard) 'b'; tags etc. :-) So I think developers can actually put their money on the Canvas tag and not worry too much about support and implementation across browsers. Face it: three out of the four 'major' browsers have Canvas already running. And there is a Google hack that lets you run it in the fourth (now) so-called 'major' browser.

The other (really) interesting thing I've been checking out is the next-step: Canvas 3D! The guys at Mozilla have been working out the basics of a simple 3D library and have so far adopted a wait-and-watch strategy i.e. have implemented a basic library (which is scheduled to be shipped with the Firefox 3 release) that exposes the API of the OpenGL ES specification and makes use of hardware acceleration where possible and are watching what kind of uses the developers put it to, in order to determine the next features to add. Now this is really interesting news, as OpenGL ES is something I've been looking into for the past few days, and find it a tad better for me than the standard OpenGL implementation, as it is lighter and more streamlined. OpenGL ES by the way is OpenGL for Embedded Systems, which means that all the extra bloated code and old deprecated methods and fat around the OpenGL standard has been stripped off, leaving a light API for systems with limited resources. The guys at Opera have been working on a different approach however. They too have implemented a Canvas-3D implementation, but they don't make use of OpenGL bindings, instead provide a higher-level of abstraction allowing platform neutrality, i.e. permit non-OpenGL programmers to be able to use it too. While this is a nice idea, trouble will arise if the two major browsers decide to implement their own versions of Canvas 3D. And where does Microsoft fit in? I think they'll be willing to Open Source all their Windows code before they will ever think about implementing OpenGL (arch rival to their proprietary Direct3D) in their browser. So they might either make D3D bindings, or adopt a 'high-level/neutral' approach similar to Opera. Which essentially means that Canvas3D, as such, is still volatile and is a high-risk platform to develop for. But it is the most promising of the upcoming technologies as it incorporates hardware acceleration which will make life tonnes easier.

For instance, I wrote a simple z-buffering system in Javascript for a non-canvas based experiment, and it simply is TOO slow as the DIV hacks, as I mentioned in a previous post, are just not feasible for even a thousand triangles. Z-buffering, however, can be made to run really well in the Canvas2D platform. The Useless Pickles 3D demo crawled to a halt (0.4 fps) when I fed it with objects with slightly over 200 triangles, which is peanuts. And that 3D library/demo is the best attempt I've found so far on the internet. Agreed that when I looked under its hood, it didn't make use of anything other than simple backface culling for optimization, but even if approaches like BSP Tree with front-to-back rendering or Octrees for optimizing Frustum Culling etc are applied, there is only so much that you can do. The potential for the sort of things that can be done with Canvas & Canvas3D is far greater and I think its better to push with new technology than be really clever with the old one and remain at the stage of just proof-of-concepts.

PS: The picture at the start of the article is the Apple Mac OS X Webkit's icon. The entire concept of Canvas started with them.

Edit: I have been trying out the Google Ex-Canvas that enables code written for the Canvas tag to run in Internet Explorer too, and all I can say is: It is SLOW! Just to warm up the testing, I made it draw 60,000 (i.e. canvas size = 300 x 200) single black pixels at each position in order to fill the canvas block entirely with black (yes I know it can be done with a single fillRect command, but I'm testing things here remember?), and Firefox 3 (rc2) did it within 400 milliseconds, while Internet Explorer 6 took almost 7-8 seconds, not to mention hung while doing it. Can't expect much out an emulation, can you?

Wednesday, June 04, 2008

World Domination... and beyond!


This one is for all the Doom gamers, old or new. The Official Union Aerospace Corporation (UAC) website made by iD software's web designing team:

http://www.doomrpg.com/n.x/UAC/Home

Enjoy!
Shashank

Weekly round-up


Here's a round-up of the things that I've been working with a great deal over the past one week:
  • Google Sketchup
  • BSP Trees & 3D Rendering
  • Javascript
  • SDL & Projective Geometry
I might have something pretty interesting coming up within a few days, so if anybody who's into this stuff reads this, come back in a few days for an interesting Proof-of-Concept demonstration on this blog. It might be really dumb, but it does look pretty good to me.

Also, I was looking up into hacks of Nintendo Wiimote (thanks to my friend Roshan Shariff who got me interested into this - he's doing some pretty interesting Wiimote hacks too), and I think I'll get a Wiimote sometime soon when I save up enough for it. Till then, I'm looking into the sensors and libraries for interfacing it, and being a gamer myself AND a programmer, I can think of really nice things to use it for. :-)

Also, me and Roshan got into discussing how iD software's new game "Rage" implements the Megatexturing feature for rendering and texturing such HUGE landscapes etc, and found it to be an application of "Clipmaps", that are (as far as I understand, I'm still figuring it out), a way to use the Mipmaps concept (see below) and clip a cubical region from the Mipmap pyramid to get a series of landscape textures of decreasing quality (i.e greater zoom out).

So in effect, the "MEGA" Texture, often reaching into dimensions of 128000 x 128000 (which is really big), is used to construct the clipmap stack:
[Texture 1]
[Texture 2]
[Texture 3]
.
.
[Texture 'n']

In this, 'Texture 1' will be a say, 512 x 512 texture of the segment of texture (from the original 128000x128000 texture) that is right in front of the viewer. This one has no zoom effect, and is of therefore the best (original) quality. Then next texture, Texture 2 will also be 512 x 512 in size, but will be a "compressed/zoomed out" version of 1024 x 1024 segment of what is front of the viewer from the original texture, so this would be a 2x zoom out. Then Texture 3 would be another zoom out and so on.. and by Texture 6 (I think), the entire 128000x128000 texture will be compressed and represented by a 512 x 512 texture. Now, the renderer will just interpolate between the textures at the various levels the stack to render portions of the texture and show the required Level of Detail only. This also enables parts of textures to be streamed from an external disk when required, instead of loading the ENTIRE texture into the memory (which is dumb, not to mention almost impossible if your texture is 128k x 128k). I posted this here in order to make sure I understand properly myself, so there might be loopholes.

Useful resources:
Shashank
PS:
The picture at the start of the article is a screenshot of iD software's RAGE game, demonstrated at QuakeCon 2007 by John Carmack.

Saturday, May 31, 2008

Of Al-Google and the Silicon Valley rantings


I have two thoughts, and am too lazy to write two separate posts so I clubbed them into one.

Al-Google:
Google is funny, really. I was just taking a trip down ego-boosting lane, and did a Google search for myself, and found that searching for "Shashank Shekhar" (which sadly appears to be quite a common name nowadays) returned a reference to Me first on #15, and my current blog at #17 and my old blog at #20. Then, I did a search for just "Shashank", and Hey Presto! I jumped to #7! I thought adding descriptive keywords narrowed searches!
(PS: Yeah yeah, before you SEO geeks start giving me the reasons, the reason is that the #7 position is occupied by my old blog which is called just "Shashank's Blog", with no mention of Shekhar, so..)

My second topic is entitled: "Silicon Valley of India: A Miracle"

Well, I was reading a nice article about the coming together of the original Silicon valley, a paper actually, (here) and I agree with his explantion that the Silicon Valley came together because of a rare co-occurrence of a lot of events that catalysed such an event. The Venture Capitalists were there, the Infrastructure was there, the Research places and great Universities were there, all mostly in the same San Francisco Bay Area
in Northern California. The setting was just right for something amazing to suddenly come up. The university people came up with great ideas, the area had sufficiently high academic cultured people living around to encourage such innovation and if someone felt that some money could be made out of those ideas, the venture capitalists were there to be sold to the ideas. The spirit of risk-taking was enhanced by some early successes and the smell of money being generated. And people had garages which could be used as offices, and small rooms could be rented for the same purpose too. And employees had places to stay nearby and basic infrastructure like roads and transport pre-existing due to the existence of older residential areas in the neighbourhood. Yes, this is an over-simplification, but these points will come into play in my next paragraph.

Now how Bangalore came to become the Silicon Valley of India is indeed a puzzling thought. Lets see, Bangalore did have residential areas pre-existing, but I think that really was IT (no pun intended). No great Venture Capitalists prowling around, miserably tiny roads and basic small-town transport facilities, and most of all, no Stanford-like great Universities in the neighbourhood to fuel ideas. Therefore how the great start-ups of Bangalore came up, attracted investors, got clients, performed their day-to-day activities with the miserably lacking infrastructure is something that is nothing short of a Miracle. Even today, companies have their own internal power generators as depending on Bangalore City's own rickety power supply would effectively lose them deals worth millions of dollars everyday, they need to find ways to work around the terrible chaos existing in the cramped roads of a city that just grew too fast. Oh and when it rains (which it does for 3 hours every evening), the city halts to a standstill as it is impossible to drive with the pot-holes, broken roads and impossible to work with the power-cuts. I'm still wondering how this Miracle came about. The only possible explanation I see is that
a) The people who started the first start-ups were incredibly clever at attracting investors,
b) The Indians are willing to slave for really long hours with considerably lesser pay (which is true). Hence India is the hot-destination for a cheap-workforce, hence a great deal of investment in off-shore development.

PS: The building in the picture is the Infosys Headquarters.
PPS: If you're interested in reading some interesting stuff related to Silicon Valley, check out some interesting SV blogs I follow as often as I can spare time:

Friday, May 30, 2008

3D in Javascript? Kidding me?


Yeah.. well. That's definitely true for now, I mean that's definitely NOT easy to do with the current libraries and existing frameworks. With the "Canvas" project still chugging to completion and wide-spread implementation, we seriously don't have any proper 2D & 3D drawing libraries. Sure there are some really good libraries developed by some smart people, like the Ajax3D and the Triangles Method at UselessPickles but neither of those are true 3D engines capable of seriously importing and simulating objects with even, say, thousands of triangles at real-time, which is what even basic 3D games would require.

The most bugging thing is the lack of any sort of hardware acceleration available for drawing in the browser. Wait a minute! The Most Bugging Thing is the lack of ANY standard means of drawing at all in the browser! Well, as I see it, the graphic potential for rendering 3D objects using Javascript today lies somewhere close to the graphics prevalent in the year 1995, and is in a sense, actually worse. This is because not only is the triangles rendering capability sorely limited, the overheads involved in basic Input/Output is far higher, as it passes through several layers of application layer before it reaches the Javascript layer.

Well, I did write a basic 3D proof-of-concept type script that can simulate a rotating sphere with 300 odd triangles at pretty good speeds in my system. I'm still optimizing it. I find the task of writing this 3D engine in Javascript a lot more fun as compared to writing it in C++, because its like the old days when you had to squeeze out every little bit of speed from your code and run it in really restricted capability environments.

Tuesday, May 27, 2008

Crazy World Saving Idea #312


Hand everyone in the world a music instrument, and make it compulsory for them to play some instrument or the other. Playing music helps relax, and would make the world a more peaceful place.

Of course, my first action would be to purchase the finest set of sound-absorbing earphones I can get hold of, to drown out the cacophony of the world. :-)

Shashank

Sunday, May 25, 2008

TerraGen 2 : First looks

TerraGen 2 is really cool. They've released the "Technology Preview Edition", which is not a beta, but just a preview of the cool technologies that will form the next version of TerraGen, which was years in coming. But better late than never, this edition is really good, and incorporates Procedural generation of content into its grand scheme of things, and also has the Node Network that can be used to view the overall graph of the scene. Another interesting feature is the ability to do animations, so you can view the entire scene change over a period of time, instead of the static images its predecessor generated.

So much for the pros. The one thing I found troublesome is that it is really SLOW. But its a Preview Edition right, so can't say much.

Anyhow, here are my first drawings with Terragen 2 : Technology Preview Edition, and I think I'm getting better with each drawing! :-) The interface is completely new so I've gotta completely relearn how things are done.



Something chilly! :-)




Nevada? Chambal? Looks like some place that really needs those clouds to rain!




The Edge of the World! :-)

Enjoy.

Shashank
PS: TerraGen2 is available for free download from here.

Implementation of the 'Threshold Whole Square Method'

So here's the 'C' implementation of the 'Threshold Whole Square Method' I talked about (here). This one is only for 'long' data-type, but I've written a generic one that can deal with float types too, but I'll post that one later.

Code:

long lsqr(long n) {
if (n > 1)
{
long twoBase = 1, i;
for (i = 1; twoBase <= n; i++)
{
twoBase <<= 1;
}
twoBase >>= 1;
long k = (long)(n - twoBase);
long sqrN = (long)(twoBase << i - 2);
return (k == 0 ? sqrN : sqrN + lsqr(k) + ((k * twoBase) << 1));
}
else
return n;
}


Basically, the variable twoBase is the nearest threshold which is a power of 2, so that it can be used as 'n' in the formula mentioned in that other post. This is done as the whole square of this number can be calculated very cheaply by a simple left shift operation. After that, the difference between the given number and this threshold is calculated to determine 'k', i.e. the offset. Then a simple application of the formula gives the result. The advantage of this method is that the we need to effectively calculate the whole-square of just a very small number (the offset 'k'), instead of the conventional calculation of the entire number 'n'. This make this method marginally faster than the compiler's method, but this one can only be used for 'long' data types and should be used carefully.

Quick calculation of whole squares using "Threshold Method"


Not a big deal, millions might have already guessed it or might be using it. Just found it useful to mentally calculate the square of the next number quickly, if you know the square of a basic 'check-point' number like 10, 15, 20, 25, 30 etc.

The standard formula I use for such a technique is:

sqr(n+k) = sqr(n) + sqr(k) + 2*k*n
For e.g.: sqr(29) = sqr(25+4) = 625 + 16 + 2*4*25 = 625 + 216 = 841


Thus the above sqr(n+k) method of finding squares is very useful for quick calculation of squares using the left shifts in even multiples to find the value of the nearest power of 2 and then adding 'k' to determine the desired whole square quickly for computer algorithms as well as human calculations.

For humans, it is easy to calculate with the nearest multiple of 10 or 5 as 'n' and 'k' as the extra required to achieve the number (like in the previous example). For computers, it will be quick to take the nearest power of 2 as 'n', as they can quickly calculate the square of that n by left shifting. I did write an 'C' implementation of such a "Threshold Whole Square" algorithm, which can be found here.

Shashank

PS: The ball in the picture is called a "Spherical Cube". Its made of 6 squares. Yes, they are squares, even though they don't look like one. :-)

Saturday, May 24, 2008

Squack3D


Alright, hence starts my first Technical project for the vacations. For those interested, my internship is now officially "Work-from-home" status, so I need not go to office everyday, but just pop in now and then for reviews. :-)

This project I'm embarking on is basically just a learning-experience type thing, don't really think it has much value as such. Anyhow, the project is called "Squack3D" (for lack of a better name), and is a very very stripped-down elementary 3D engine, that tries to offer the simplest 3D functionality for games that could be incredibly large to incredibly small. But the point is that the graphic needs of those games will have to be really basic, with no fancy effects etc. The second objective is to have the engine run at super-lightning speed, so that its really good at whatever limited functionality it gives. The third objective is to incorporate Procedural development techniques right into the basic fabric of the 3D engine which will reduce a lot of effort on the part of the game developers to develop stochastic algorithms etc for basic things.

Let me summarize the objectives:
  1. A highly stripped-down engine focusing on very basic graphics and primitives giving games and applications with low-fi graphic expectations a very small and suitable 3D engine
  2. Super-fast rendering and processing
  3. Inherent support for Procedural generation of content
  4. Ready-made templates for basic applications and games
  5. Free! In all the senses.
Shashank
PS: The scene in the picture is NOT from my engine however! :-) Its from a software called Terragen.
PPS: Your browser isn't rendering my blog incorrectly, I have indeed stripped all styling and graphics from my blog for simplicity and elegance with this new design. :-)

Monday, May 19, 2008

This is how I look when I'm forcibly woken up...


Dee Snider, from "Twisted Sister".

An awesome heavy-metal band of the 80s, never-mind their make-up. ;-)

(That's a guy in the picture, BTW. That's Dee Snider).

Saturday, May 17, 2008

The Lore of the Inverse Square Root function


This one is for all the 3D geeks!

I had posted some useful optimizations for Graphic programmers earlier, and one of the optimizations I had suggested was one I saw in the Quake 3 source code, which performs the inverse square root, i.e 1 / sqrt(x). In 3D Graphics, the question of who came up with the 'magic' constant
0x5f3759df continues to be a question that 3D geeks still seek to answer! Most attribute it to the legendary programmer John Carmack, the man behind the Quake, Doom and all id Software Game Engines. However there are several other people attributed to it, and John himself refused to take claim for the creation of the constant in the mail:

-----Original Message-----
From: John Carmack
Sent: 26 April 2004 19:51
Subject: Re: Origin of fast approximated inverse square root

At 06:38 PM 4/26/2004 +0100, you wrote:

>Hi John,
>
>There's a discussion on Beyond3D.com's forums about who the author of
>the following is:
>
>float InvSqrt (float x){
> float xhalf = 0.5f*x;
> int i = *(int*)&x;
> i = 0x5f3759df - (i>>1);
> x = *(float*)&i;
> x = x*(1.5f - xhalf*x*x);
> return x;
>}
>
>Is that something we can attribute to you? Analysis shows it to be
>extremely clever in its method and supposedly from the Q3 source.
>Most people say it's your work, a few say it's Michael Abrash's. Do
>you know who's responsible, possibly with a history of sorts?

Not me, and I don't think it is Michael. Terje Matheson perhaps?

John Carmack

Why this is so important could be understood by the fact that Chris Lomont, a professor at Purdue took up the task of deriving that constant by mathematical means for the initial approximation of the Newton Raphson method (that the magic code uses), and his 'mathematically and theoretically' brilliant approximation constant turned out to perform WORSE than the constant found in the Quake III source code. So the question that arises is how John Carmack, or the author who originally wrote the code managed to figure out the magic approximation. That could be pretty useful I think for designing other fast mathematical functions.

So this article on Beyond3D.com does a great job of tracing down the original author, or atleast a major contributor, after a great deal of digging around. Check it out:
Origin of Quake III's Fast Inverse Sqrt()

Thursday, May 15, 2008

The Creativity-Killer : Office life


Don't get me wrong. Its not because I'm really unhappy at the fact that my vacations are getting ruined as I have to "WORK" in the office 10 hrs a day everyday (read) but truly a realisation that I came about due to this effort.

The "office life" destroys your creativity, forcing you to do continually work piecemeal on mostly dumb projects that you know will never revolutionize anyone's life, but basically does the routine that people need. Yes, this kind of routine work has to be done by someone, but if you're like me, you will not be the one to get stuck in this zombie culture of waking up in the morning, slaving for 10 hours, and then returning towards late evening, too tired to do anything but slouch on a chair drinking tea and writing about how dumb you feel. One simply doesn't have the time or energy to think about ANYTHING else after returning from office. All one seeks to do is to relax and sleep soon. Gotta sleep early.. office in the morning remember? In short, even if you are good, the routine office life will bring you down to its levels of mundaneness and dumbness and make you feel generally really stupid and out of touch.

This is the typical routine every office worker follows, and my statements are meant for those select few who desire to break away from the system and be different. If you are fine with serving people's routine needs, that is perfectly genuine too. Do not mistake me. I am talking about those people who can be intensely creative, know that they can do better things for people, have confidence in themselves that they can create things that will make better and revolutionize the life of others as well as theirs. The first casualty when you get stuck in the drill of conventional life is your sense of Independent thinking.

A matter of bread and butter, some would say. True. You've gotta do what you've gotta do. However, when there is an opportunity, grab it. Risks are meant to be taken, some big and some small. When you have the chance to some radically better stuff, do it. I have been in IEEE Students' Chapter for the past two years, and was the Secretary at last count. But I felt that it was time to move on and do other things, even though I appeared to have a very good chance at the top job. However, it was a risk nevertheless, leaving IEEE to get back the time to do bigger things, develop new ideas that could potentially be the next big things. I feel I can do it. So risk I must. Risk the general "social standing", risk the chance of not having any work to channel one's energies. This is an example of a small risk, almost negligible. But the basic point does not change. If you want to be different, don't get stuck in any kind of routine. One must follow for a while, and move on to other things to remain fresh and dynamic.

Tuesday, May 13, 2008

The coming ages of immersive gaming?


Just found this interesting looking article about the possibilities offered by immersive large-display systems. Check this out:

Wall-sized, multi-touch 'Missile Command' -- every gamer's fantasy

To quote a few catchy phrases:

"A gentleman named Steve Mason has created a large-scale version of the game that can be played by hand using multiple contact points. The result? Extreme awesomeness." Lol! ;-)

There's a flash video on that page that demonstrates players playing the game live.

I've posted this here, as this has gotten me thinking again about the trends that games will follow in the coming few years. Yes, this particular wall-display system noted above is not really "immersive", but in all essence, I would get completely immersed in such a game! Wouldn't you? ;-) Don't get me wrong, I'm not calling the above game display system "immersive"!

Having been involved in a lot of personal game-development projects, I find it extremely fascinating to note that we are indeed moving closer and closer to the age of true Virtual Reality, where the technology blurs the barriers between what we really believe to be "real", and what we don't. I for one would be the first to question what we indeed are, returning to the age old question of "why are we here?", and "HOW are we here and conscious about it?". Anyhow, the concept of Virtual Reality really raises a lot of interesting questions- technical, business-related, ethical, psychological and philosophical.

More on this soon. Promise.

9 hr 45 minutes a day. 6 days a week. 33 days.

That's the duration of my summer internship. There goes my vacation, can see it fleeing away while I sit in the office.

Have a confidentiality agreement with them, don't want to talk about them anyway. My poor vacation...

Monday, May 12, 2008

Yet another 'Airport Blues' saga


This time around, hanging around Bangalore's Great Airport, I discovered some harsh truths of life. Life is like the Cafe Coffee Day Espresso that you get at the Bangalore Airport. You do not ever get what you wanted, its hideously expensive, it has no sugar, is black and really awful. Stirring it up makes no difference really, ultimately you end up with the same old stuff and its better to drink it up in one quick gulp than one prolonged struggle and bitter taste. And it always tasted better in the good ol' days.

I can say without doubt that THAT was simply the worst coffee I ever had in my life, and saying that would be a gross understatement. I was waiting to pick up my mom, and due to a series of (un)fortunate events ended up reaching the Airport really quickly, and an hour and half early. Bangalore Airport is seriously not the best place to hang out, and they take great pains to maintain and further that reputation. No chairs or waiting lounges at the Arrivals gate. Just one Cafe Coffee Day outlet with smirking faces serving you bad coffee. So I managed to find a seat in the Departures section, and then was sprayed all over with insecticide. The stupid bugger chose to make his grand entry right at the moment I sat down, and sprayed those fumigated kerosene-like smelling fumes all over me, and the people all around me too. Luckily its meant only for mosquitoes and small insects, not animals.

Oh, and I am alive, kicking and have finally returned back to this blog.
Auf Weidersehen!

PS: I speak German now.

PPS: I simply cannot understand how people manage to drink Black Coffee! My theory is that people find themselves awakened by sipping Black Coffee because each sip is so horrible and bitter that it shocks them awake. That's how I stayed awake for 1.5 hours at the airport, and just managed to finish half of my coffee (which was originally half a cup anyway). Gruesome really.

Friday, January 04, 2008

Basic “Google Suggest”-like script

Recently while working on the Google Project, I was messing around with AJAX and figuring out how JSON works etc, so I decided to implement the much talked-about “Google Suggest” thing myself just to test my JSON and AJAX techniques. Turns out it indeed is really simple in concept and implementation, except that the amount of “bells ‘n whistles” you can add is endless.

“Google Suggest” in 5 easy steps:
1. Capture the onkeydown events of the text-box where the person is typing
2. Send the text typed to a server-side script (in ASP, PHP, Perl or any language you prefer). This you could do by passing the server script URL with the typed text to inline frames or XMLHttpRequest suiting your taste and requirements.
3. The server side script will search the database table for entries whose text starts with the text presently in the front-end textbox.
4. This list can be converted to a JSON object, or an XML feed or plain inline-frame javascript etc and will be received back by the client
5. The client will display the received list in a floating DIV or container below the textbox and permit the user to select an entry from that list by either arrow keys or mouse clicks.

So in my script, I wrote this Google Suggest-like tool that would read names from a database and display them as we type.

This code is really elementary with loads of features missing, and lots of optimizations possible. I wrote this script in like 2 hours in the dead of night so wasn’t thinking about lots of goodies and optimizations.

Download the ZIP file: Auto-suggest names

Minimum Requirements: ASP 6.0+ support, Microsoft Access 2000, IE 5.5+, FF 1.5+.

I’ll list out some things that can be added to this code of mine:

1. Add mouse handlers to the drop-down menu to enable mouse clicks on suggestions
2. Improve the elementary keyboard support it gives to include responses to several other keys
3. Optimize the feedback process to the server by inserting a “delay” before sending the typed value to the server-side script. That is, instead of sending the text “immediately” on “every” key-press, wait after a keypress for a second or two and see if the person stops typing. If the person hasn’t entered anything for, say, two seconds then send the text over to the server for searching. This will reduce the load on the server as its obviously wiser to wait for the user to atleast tell the client what he/she has to say before jumping off to suggestions. This is done by Google too.

I’ll add some more suggestions as I think of some more.