Friday, September 29, 2006

About suspension threats and selections..

Been a while since my previous post, and for general information, the raiding party of CAM exams are here again.. :-( Start on the coming Tuesday.

As the title suggests, suspension threats are not related to the engineering suspension mechanisms, but basically administrative suspensions, where you're chucked out of the hostel/college etc.. :-) So me and 15 guys got one hostel-suspension threat for an "extended" birthday party which was held at 3 in the morning.. story goes something like this:

A guy had his birthday (obviously), and it started around 8 PM in quite a subdued manner i.e. an SMS message chain through the hostel about getting free ladoos etc to whoever give him birthday bumps at 12 midnight. That was sort of started in my room, with me having a substantial role in its creation and spreading.. :-) That guy could only watch helplessly as message after message poured into his cell regarding confirmations. Heh. Basically we all get a special Airtel Students' Pack with 100 SMSes free *everyday*, so the messages spread really fast. Now at 12 midnight, we all landed at his room, and he got his share of birthday bumps, which for some inexplicable reason ended up with giving him friendly kicks on the butt, while hanging in mid-air him with two guys holding his arms and legs. This wasn't really anything "hooliganistic", and something even the Birthday Boy enjoyed. But since it had rained really heavily that night, and we had given the bday bumps in the badminton court and ensured that he landed perfectly in the slime and puddles, we all later decided that he had to be given a bath. This means that the victim is locked inside the shower cubicles with his clothes on, and water is thrown from the other cubicles in calculated projectile motions. :-) This was where things began to spin out of control, since nearly 15 guys cramped inside a small 12 cubicle bathroom and naturally the din and noise wasn't small. The trouble came with the fact that the shower cubicle-room is right next to the Warden's room, and in the spur of the moment when the warden-room's light came on, in anxiety that bday boy also ran back to his room like the rest of us, the only difference being that he was dripping wet and wet the entire ground floor as he ran. This provided a natural trail to his room, and the warden is no fool. Soon he was being asked to "prove" that it was his birthday (haha), and demands of how his friends came to know of his bday (sheesh!) etc. That was indeed quite a lot of foolish questions on the part of the warden, but anyway, we were all called out and threatened with suspension from the hostel.

Story would have ended, but the fools we are, we resumed his bday party after coming back from classes at 1 PM the next day! Started with a very simple cake-cutting "Happy Birthday to you" chanting ceremony, turned into a cake-smearing fight, and soon another water-fight which started with one guy launching an entire bucket of water on me in front of my room . I retaliated with a bottle of chilled water, and soon World War III was on with the rest joining in. The guard obviously caught us all.. all unrecognizable in our cream-smeared faces and dripping bodies, and threatened to inform the warden. But he was sort of enjoying our party, so he told us to do the water fights only in the bathrooms, and not outside the rooms in the corridors, and we finally decided to end the really memorable "extended" birthday party before we all got kicked out of VIT. :-)

Whew... as for the second thing, I got selected to the IEEE Executive Board.. one of the 7 people who made it through the interview of about 100 odd. The sad part was that I had to quit ISTE to do so, because of clashing domains and difficulty in attention-management.

Now I must scramble back to my, now dry, room and prepare for the CAMs.. this time I'm really screwed. Started preparing just 3 days ago.

Tuesday, September 12, 2006

And... one more post!

I really must change the pattern of naming my posts I've started developing... one more, and yet another, and another.. sheesh!

Ahem, it appears that *trumpets sound*, my CAM exam results are out. Well, almost, since our History paper, which I think went quite well, has been neglected in the hustle of other papers, and no-one finally got their History marks. The others... ah.

I need to start a new paragraph to describe them. Maths was devastated, English quite catastrophic, Chemistry measures 100 on the Richter scale.. total devastation, and Physics apparently good... atleast topped the class in physics. Need I give my marks? Let me start with what gives me some relief, Physics with 43/50, which makes me the topper in Physics. Don't get too many ideas, take a look at the other papers... Chemistry is 34/50, English 33/50 (a low scoring paper, I think I have the 5th highest or something in a class of 130), Maths is 42/50 (devastated, as I previously mentioned). The overall total puts me probably in the contention for the top 15, if I'm lucky in the top 10 out of 130. The top 10 guys get some good cash as a reward, which might allow me to go and splurge something on the excellent coffee I can get around here. But that's like a distant dream.. not sure. None of us know our exact standings, and History marks will be the deciding factor. I did the paper fine, but so were the rest. F**king!

So now that I have "wasted" a paragraph on CAM results, I have nothing much to say. Life is as such boring and hectic. Same old jobs to be done for getting the events up and running, except unlike the earlier times in school when I used to allot jobs to people and coordinate the event, here in college, as the first year, I'm given jobs to be done, and mostly the routine mundane stuff like making the brochures, banners, sticking them around the campus, getting more recruits, etc.... all stuff that event administrators love to give.. (I used to take sadistic pleasure in giving them to hapless juniors in my days.. hehehe). Talking of a full circle eh?!

The real interesting thing that I used to do, The Band, is currently not reachable, because all my "band-mates" have gone off since its TechWeek and therefore one week devoted to competitions without any classes or attendance. Infact, 90% of first years are off, and my hostel block is like a graveyard. I'm therefore going to get an experience of staying in a 6-bed room converted to a single bed for one whole week. Ah.. the whole room to my will! The hostel is really empty now, infact no-one screamed and threw dustbins from the 5th floor when the power went off, which proves that this hostel seriously needs more people.
Cya, more later..

Wednesday, August 23, 2006

Here I am, with a post again

So here I am, with yet another post.

"Just to inform you, I have a chemistry exam tomorrow and have got quite a substantial portion left, and the time as of now is 10:20 PM, and if I start working on it now, I'll probably finish at 3 AM, and the exam is at 8 AM. We have 5 exams in a row, from Monday to Friday, and tomorrow's the second last, and though I have been sleeping at 2:30 AM - 3 AM for the past three days, this neglect of studies to waste time due to sheer boredom is a first for me in VIT. Have done this before, but... "

and so my mind goes back to the beginning of the loop. *Beep* I'm damn bored. I never liked studying for exams.

Basically, I've been busy studying, trying to fit in ISTE and Phreak 2006 work when I can, and jamming with a *band-mate* in his room with an acoustic guitar. I recently hit on to a cool guitar riff (progression of chords that can form the backbone of the song and are repeated through the song) while messing around with the guitar, and soon I wrote an entire song based on the tune along with the lyrics. The song's called "Bogeyman/The Devil's all I got". Its a nice, slow and depressing song about an outlaw, though it might be time before we actually set about practising it seriously. Presently, its just a personal item. :-) We're planning to start practising "We Rule the Night" by Bon Jovi soon, infact within a few days once these bloody exams finish.

I think I really need to study how Municipal Water is treated, so will write more soon.

Friday, August 11, 2006

Finally another post..

Alright, its been quite a while since my last post, but I had warned you of these "disappearing acts" in my very first blog post. :-) Though this time, it wasn't really a disappearing act which occurs due to boredom, but I have been really busy getting adjusted to the new college life. For information, I have joined Vellore Institute of Technoloy (site) with Comp. Sci and Engg., which is quite a good institute in terms of infrastructure and facilities. The campus is really big and nice, though that means that there is an enormous amount of walking to do to just get from the classrooms to the labs. The library is one entire 4-floor building, and it has something called a Digital Library also along with paper books, you can figure out the meaning of that.

We're going to have our first round of exams in just a week now, from 21st August to 26th, to be more precise.

I've been busy studying, designing sites for the various student-chapters of prominent organizations (Check out ISTE. Open the board members' page), and trying to find members for my rock band. This is the real interesting part. I have found most of the required members for a basic band, and we'll begin jamming together after 1st semester when we all go back to our homes and get our instruments. There are some really great student bands here in VIT, really talented ones. You can hear them jamming really hard every evening-night from 5:30 PM to 11:30 PM in the music room.

This is all for now, will blog more later, and try to pick up the threads of the blog again. I just don't get the time to blog anymore.. never did anyway, but now its even less.

Tuesday, July 04, 2006

Interesting observations..

I was just poking around my webstat interface, and I found this script that tells me the search engines people have used to reach my blog directly, and the keywords they used. I was quite surprised to note that nearly 30% of the traffic I get is because people land up on my blog while searching for variants of the keyword: "BITSAT 2006 cutoff". Its surprising because my blog contains absolutely no information about BITSAT cut offs or anything. Then I remembered my post about my experience of giving the BITSAT-06 in Noida (Remember the post: Marooned with a computer in Noida?). Quite funny, the search engines of today still have a long way to go before achieving decent relevance-rating. Oh and the Webstat interface also confirmed one thing: Google is the No. 1 search engine, since people have used only Google to reach to my site.
Now, I'll be a little smart. Since it is driving traffic to this blog, I'll actually put up the real cut-offs for BITS and some info. ;-)

The First-Iteration cut-off mark for 2006 is 317. The people above 280 are in the first-iteration waiting list. So this year the cut-offs appear to have gone higher. I have heard that last year's first-iteration cut-off mark was 290 or something. The next three iterations went at 260, 250 and 245.

The last seat at BITS Pilani last year went at 252 (MSc. Bio) and in BITS Goa at 245 (MSc. Bio), and Computer Science at Pilani went at 351. Engineering finished in Pilani at 301 (Civil) and in Goa at 289 (Chem).

Wednesday, June 28, 2006

Of internet communities and hair..


Browsing around the 'net, I found some really wierd community websites/boards. Though now it makes perfect logical sense, but I really found this particular board pretty interesting: Link


I find amazing comradeship among long hairs. Walk into a bus, you'll immediately be noticed by another ponytail, not that I'm making one yet. Though of course, I find the "super groomed", "super silky" hair that kids try to emulate really gross. Hair should be allowed to grow as it wants to, what's the kick in spending 45 mins a day trying to get your hair silky smooth and steady?

PS: That guy in the picture is, unfortunately, not me. :-)
PPS: I know this sort of breaks the tradition of semi-technical posts that I have set with the last few ones.. Its unlikely I will post anything this idiotic in the near future.. :-)
PPPS: I really had nothing to post about, and was feeling generally bored. :-)

Sunday, June 25, 2006

Effective optimizations for graphic programmers


Warning: The post contains a bit of technical stuff, along with some source code. Read on if you're interested.

I don't claim to be an expert, or even an intermediate in the vast field of graphic programming, but here are a few cool optimizations/replacements that I have been using for common math functions. This list is by no means complete, and by no means are most of the optimizations my inventions. If anyone wishes to suggest any more, please feel free to do so.

Graphic programming, 2D as well as 3D, involves extensive use of math, especially Vectors and Matrices. And it therefore extensively uses several math functions, like trigonometric ratios, squares and square-roots etc. Vectors also extensively involve "inverse-square-root" i.e. 1/sqrt(x) i.e. one divided by square root. This invSqrt is used in everything from finding magnitudes to finding angles between vectors, projections etc. The main point of this paragraph is that graphics heavily utilize math.

Now before we can make the next Doom3 engine, we need to first get the engine up-to-the-mark. Its no good having a fantastic engine intended for games, only to find it running like a slide-show on even high-end systems. The reason John Carmack is famous is because he has written all the game engines of id software, famous for the Doom, Wolf3D, Quake-series, Doom3 engines/games, and reading his code reveals some amazing tricks and optimizations. All the code upto Quake-3 (inclusive) has been made Open-Source under GPL, so you can try downloading and taking a peek if you're interested. I recommend that. So it turns out that most math functions can be hacked a lot to gain a great deal of optimization and speed.

A) Inverse Square Root
First I look at the famous "Inverse-Square-Root" function that was first seen in Quake-3 and is based on the Newton-Raphson method for approximating functions. The function in this case is 1/sqrt(x). To read in detail about how this works, you can see this and this (more technical). The code:

float InvSqrt(float x)
{
float xhalf = 0.5f*x;
int i = *(int*)&x; // get bits for floating value
i = 0x5f375a86- (i>>1); // gives initial guess y0
x = *(float*)&i; // convert bits back to float
x = x*(1.5f-xhalf*x*x); // Newton step, repeating increases accuracy
return x;
}
Test Result: I had tested this before using it in my code. For calculating the inverse square roots of 500000 numbers, the standard compiler method of 1/sqrt(x) took on an average 132 milliseconds, while the above code took on an average 18 milliseconds.

B) Square Root:
Then digging around Quake's source, I found an optimization for the simple square root function, which is essentially the same thing as above with a little modification. The Code:

float fSqrt(float number) {
long i;
float x, y;
const float f = 1.5F;
x = number * 0.5F;
y = number;
i = * ( long * ) &y;
i = 0x5f3759df - ( i >> 1 );
y = * ( float * ) &i;
y = y * ( f - ( x * y * y ) );
y = y * ( f - ( x * y * y ) );
return number * y;
}
Test Result: To calculate the square root of 500000 numbers, the standard compiler function took on an average 110 milliseconds, while the above code took on an average 26 milliseconds.

C) Square, Cube etc.
This I found on my own. This method is best used if you know the exponent (the power to raise to) beforehand. There are two ways of raising a number to a specific power. One is to use the simple compiler pow(x, n) function which raises x to the power n. I've often observed people using this method if 'n' is large.. above 5 or 6, even if they know beforehand (while coding) the power to raise to. So they use the pow() function. The other way is to simply multiply that number as many times as required by itself. So if I want to raise x to 6, I'll do: [x = x*x*x*x*x*x]. Now it might seem odd, since this method looks so ugly (imagine doing that for 15th power), but believe it or not, the speed difference is amazing. Use the second method always, even if you're raising to the 15th power.
Test Result: I performed two separate tests. In each case, as usual, I took 500000 test numbers. I tried simple "squaring" using the pow() compiler function, and it took on an average 45 milliseconds. I tried the other ugly method of x*x, and it took 2 millseconds. I then tried raising 500000 numbers to the 9th power, and the pow() compiler method took on an average 67 milliseconds, while the [x*x*x*x*x*x*x*x*x] method took just 3 milliseconds. This proves this uglier way to be much more efficient.

D) Trigonometric Ratios
This is quite a common trick, and I therefore won't be putting up a result sheet for this one. The idea lies in making a 'lookup table' beforehand for all those trigo functions you are using. This is because the compiler trigo functions are VERY expensive (take time) and its bad to use them while rendering. So suppose we use cosine in our program, what we do is, make a table (array) of all the angles that the program might use and a table (array) of the cosines of those angles. So the speed boost is immediate, as picking a random element in the array (random access) is a very fast operation. Now generally we have an idea of the range of angles that we might use, and the smallest required intervals between each angle, for example, we might just need whole number angles, not fractional angles, thus we need to make, say, just 90 cosines. Or if the smallest step between angles is 0.5 degrees, we need to calculate the cosine of 0.0, 0.5, 1.0, 1.5 and so on.. while the program is starting up. After that we need to just look up the table and get the cosine very quickly. Incase the angle required is not *exactly* present in the table, like we need 13.7 degrees and we have 13.5 deg in the table, it makes sense to pick the cosine of 13.5 and be happy with it, since in Graphic programming, for real-time work it is smart work to make small compromises here and there to gain an great deal of speed.

PS: I think I need to change the blog theme. I tend to write long entries and this theme squeezes the text into a narrow column making it look dauntingly long.