Thursday, August 18, 2005

The Missing

Just read in today's newspapers that neurologist VS Ramachandran was here in Bangalore yesterday. Apparently, he gave a talk sponsored by the Science and Spirituality research of India. I sure wish I'd heard of this sooner. I would've loved to hear his speech. Reminds me of the time when Peter Molyneux was in town and I missed him, as I only got to know of his visit, right after he'd left. Boy, all this is getting a bit too aggravating. Anyway, I still have "Phantoms in the Brain" on my to-read list. Hope to start on it sometime.

Monday, August 08, 2005

The Addict

Bang!!! Bang!!! Splash!!!Vroooom!!!!Splash!!!!Bang!!!! Bang!!!!
At last. After what seemed like an eternity of game-lessness, I finally satiated my negligent,tormented soul by fragging the living daylights out of hundreds of mercenaries in a tropical paradise in pursuit of a sexy female CIA operative. Before you begin to judge me as a psychotic or a maniac, let me just say that this is the theme of a game I've gotten addicted to over the weekend - "FarCry". Interestingly, I had earlier given up on even installing this game on my home computer as its requirements are a bit steep. But, as luck would have it (incidentally, me and Lady Luck don't actually see eye to eye) , I got a copy and thought....what have I got to lose??? Anyway, the game came through seamlessly on my paltry 32-bit PCI-E hungry system ( after a little bit of tweaking here and there) and, boy-oh-boy, it's painfully beautiful - water, surf, sand, foliage, birds, mutated primates, mercenaries, scientists, blood.....My eyes are wet, fingers sore, brain splintered, ears deaf, hair upright, thoughts splashed across every pixel on my monitor..........but I just can't stop myself from dragging my numb legs across the floor, faint halfway through, wake up, vomit incessantly, pull up the chair and finish what I've started-The redemption of mankind..........right now, the normal world looks like a far cry.

Friday, July 29, 2005

Wishcasting

Owning an iPod mini myself, I, like countless other ipodders out there, have a wish-list. These are the things I'd love to see in an iPod:
1. A color iPodMini
2. A video iPod (that atleast plays mpeg1)
3. Integrated FM Transmitter and Receiver
4. Blue-tooth for song transfers
5. A much larger display (something like Sony's new NW series mp3 players, which use "Organic Electroluminescence" display)
6. Different screen-color themes
7. Better battery life
8. Customizable exterior frames
9. Support for reading large e-books.
9. Song visualizations.
11. And,for heaven's sake, please give us a BLACK iPod.

Thursday, July 28, 2005

Uncanny Valley

It certainly made sense to me from the first time I came across it. I mean, "Uncanny Valley" atleast explained why I did'nt like the movies "Final Fantasy","The Polar Express" and partly "Bicentennial Man" and "Shrek 2"; though they were graphically astounding. Incidentally, Pixar too believes that such a theory exists. Speaking of anthropomorphism, I just can't resist myself from raving 'bout this Calvin and Hobbes' strip(one of my all-time favourites)-

Friday, July 22, 2005

Body Doubles

Caught "Freaky Friday" yesterday.Funny "feel good" movie that. Made me wonder ; If I had the oppurtunity to switch bodies with anyone,who will it be?

George Bush - On the eve of 9/11
William Murdoch - On April 14, 1912
Roger Federer - The dawn of a Wimbledon Finals match
Gabe Newell - When Half-life went gold
Paul Hewson (Bono) - When he wrote "One"
Albert Einstein - When he formulated the General TOR
The curator of the MET - When the "Tapestries of Unicorn" were removed from their walls
Neil Armstrong - When he landed on the moon
James Joyce - When he wrote "Finnegans Wake"
David Lynch - When he directed "Mulholland Drive"
The first guy who lays his hands on the "Optimus Keyboard"

Thursday, July 14, 2005

Terminal Locker

Well, I finally had some free time on my hands and thought it would be fruitful to invest it on some useful coding. I ended up writing this nifty little and outrageously simple "terminal lock" kinda utility for Linux. It doggedly does one thing and one thing alone. LOCK YOUR TERMINAL. Without further ado, here's the code:

#include "pwd.h"

#include "signal.h"
#include "sys/types.h"
#include "fcntl.h"
#include "unistd.h"
#include "ncurses.h"
#include "shadow.h"
#include "errno.h"
#include "stdio.h"

#define MAX_PWD_LEN 512

int main(int argc,char* argv[])
{
int pwdCorrect=0;
uid_t thisUserId;
char *encPwd,plainPwd[MAX_PWD_LEN],*thisUserName;
struct passwd* pEntry;
struct spwd* sEntry;
sigset_t allSIG;

sigfillset(&allSIG);
sigprocmask(SIG_BLOCK,&allSIG,NULL);

initscr();
cbreak();
noecho();
clearok(curscr,TRUE);

thisUserId=getuid();
pEntry=getpwuid(thisUserId);
if(!pEntry) goto bad_exit;
thisUserName=pEntry->pw_name;
sEntry=getspnam(thisUserName);
if(!sEntry) goto bad_exit;

while(!pwdCorrect)
{
getnstr(plainPwd,MAX_PWD_LEN);
encPwd=crypt(plainPwd,sEntry->sp_pwdp);
if(!encPwd) goto bad_exit;
if(!strcmp(encPwd,sEntry->sp_pwdp))
pwdCorrect=1;
move(0,0);
wrefresh(curscr);
}
good_exit:
endwin();
return 0;
bad_exit:
endwin();
perror("");
return errno;
}

The following steps require you to be root.
Compile it with -lncurses and -lcrypt.
Set the s bit on the executable with "chmod a+s a.out". This is because any other user must also be able to run this application.
Copy it under a suitable directory(which appears in $PATH) as tlock(or any other name that appeals to your whims and fancies ) and you're done.
Just run the program and watch that dumb terminal lock up.

Wednesday, July 06, 2005

Immortality

I often find myself asking the question "What's life without death?". Imagine yourself to be immortal, never having to face the end of the road, that ultimatum of Life ; when everything you've held dear in your fragile existence is whisked away from you in an untimely manner. "Light at the end of the tunnel!!!! Or is it darkness?". The "I" in you is lost. The egotistical being that man is, is mocked by nature, by God, by the supreme force that created Adam and Eve. "I" becomes "It", just like when you were born. There is nothing to be seen or heard, felt or spoken,your senses lost, consciousness forgotten, limbs motionless. Life comes full circle. Man or atleast the manifestation of his soul is reduced to pulp. Some believe that this soul of man is not lost even after death. It is somehow preserved, protected, safeguarded all throughout its journey from this Earth to the House Of God, where it awaits His decision. Other doctrines preach that the destiny of the soul is not determined by Him, but Us. We are the ones who choose the Gardens Of Heaven or the Labyrinths Of Hell. God has no part in this; He is just an observer- the lone audience of the Game Of Life. There are no rules, no boundaries. Just a beginning and an end. YOU ride the rollercoaster; you decide the track, but not how it ends. Every turn you take might be the last. It's like falling into a rabbit hole. You never know when the ground rushes up to meet you. But, what happens after we finish the game? Do we get to play again? Did we win? Did we lose? A tie perhaps? What would you ask God if you were given just one question? Man is just an object of a derived class ; a class publicly derived from God, who has one default constructor; one that applies to all of mankind. It is in our constructors that we inscribe how we sustain our object through the sands of time. There are feelings within us, thoughts & actions that are marked private, others public, and some others protected. Object interaction is seamless;integration effortless. We are the perfect object, the pinnacle of God's technology, His achievement. Yet, we somehow find ways to perform nasty operations, make illegal function calls, use NULL pointers and basically keep throwing exceptions for Him to handle. But the sad part of all this is, we do not get to write a destructor; a method to somehow clean up our acts, refurbish that tormented soul within us, to gain salvation,peace,nirvana. Maybe that's what we're trying to do through cryopreservation. Trying to live on borrowed time. But, maybe He had foreseen all this. Maybe, he just does'nt give us our object pointers. He only gives us his pointer, but typecasted to our object. So, when we're destroyed, our destructor never even gets called. His definition of us is succinct. Man will be created and is meant to be destroyed. Why be immortal? What would you achieve? You live to see your loved ones die, their final breath, their anguish and suffering at having to leave you, while you hopelessly hold their hands, making futile attempts to bring them back; back to the mouth of the tunnel. Or would you also go around insulting all the people of the world in alphabetical order, just so you have a mission, an objective, a goal to achieve in life?
No, immortality is more than a blessing, it's a curse.

Thursday, June 16, 2005

Build me one, Mr.Calatrava

One of the very few modern day architects that I know of and really admire their work is a spanish who goes by the name of Santiago Caltrava. His buildings are a work of art and illusion;true masterpieces. I am reminded of Howard Roark(The Fountainhead) every time I see one of Calatrava's buildings. His train station at Zurich and L’Hemisfèric at Valencia just take my breath away. Maybe Mr.Calatrava can leave his indelible mark on Bangalore sometime in the future.
Links:
Official Site
L’Hemisfèric -Valencia

A close encounter with "dc"

Warning:
"dc" DOES NOT stand for:
David Coulthard (F1 fans can stop reading)
Direct Current (electrical engineers, look no further)
District Council (sorry officer!!!)
da capo (dictionary please????)
Before Christ (You're blind dude!!! Get your eyes checked)

Computer engineers, step forward.
dc is a desktop calculator utility on Linux that uses the reverse-polish notation for its calculations. Honestly, I had not come across it until like a coupla days back, and I would've brushed it aside, were it not for the fact that what I saw critiqued my thinking abilities. Well, I bet it would ruffle up your thinking feathers too if you came across the following line:
echo "16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D68736142snlbxq" | dc.
The above line actually prints the string "Bash".Well,
not to be undeterred by this seemingly haphazard arrangement of characters, I started out on the noble mission of deciphering it. So, let's start from the left and work our way through it. Since we've piped the entire command to dc, it's as if dc read this from the stdin. First the basics of dc(assuming you know the reverse-polish notation):
1. Whatever number dc encounters, it pushes it onto its stack. The radix of the input is set by the command "i". When dc encounters this command, it pops the variable on top of the stack and sets it as the input radix.
2. Whenever it encounters an operator(+,-,*,/,%....) it pops the top 2 elements,performs the operation and pushes the result.
3. A macro is nothing but a collection of commands/numbers/operators within square braces"[]".
4. The command "q" quits from the current macro. If we are at the topmost level, it simply quits dc.
5. dc also has around 256 internal registers. The command "sx" pops the variable on top of the stack and stores it in the register x. Macros can also be stored onto registers or pushed onto the stack.
6. The command "lx" pushes the variable in register x onto the top of the stack. x is unchanged.
7. Command "x" pops the macro at the top of the stack and executes it. Hence, the command "lbx" executes the macro in register b. How? Well, it pushes the contents of b onto the stack and the "x" command pops it off executes it. Cool,nah?
8. "P" pops the variable from the top of stack and prints its ASCII equivalent.
9. The command "=z" pops the top 2 elements from the stack, compares them and if found equal, executes the macro in register "z".
Fine, now comes the interesting part of tearing apart this ubiquitous line:
echo "16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D68736142snlbxq" | dc.
First the input radix is set to hexa by the command 16i. We then store the command q in register a by "[q]sa". The next macro is a HUGE one. We'll tackle it later. Whatever was in that macro, we store it onto register b. After that, we push the number "A0D68736142" onto the stack, and then store it into register n through the following sequence : "A0D68736142sn". Finally, we execute the contents of register b(lbx) and then quit from the program.
Now, the magic is in the macro that we skipped earlier, which is actually recursive. Lemme print that here just for convenience:
[ln0=aln100%Pln100/snlbx]
First, the register contents of n are pushed onto the stack. If you remember, this is that huge hex number. It is then compared with 0 and if found equal, executes the macro in register a, which contains "q". Hence, this is the terminating condition of the recursion. After this, we again push the contents of reg n(since it was popped during the = operation) and the value 0x100 onto the stack. Now,the stack looks like this:
0x100 <- top
0xA0D68736142
We then find the remainder of "0xA0D68736142/0x100" and print its ASCII value. Finally, we find out the value of 0xA0D68736142/0x100 and store this into the register n. At last, we make the recursive call (tail-recursion) to the same macro through "lbx". But now, the register n contains 0xA0D68736142/0x100 instead of 0xA0D68736142. Thus, we repeat the same procedure until n contains 0, at which point we execute contents of reg a,which quits this macro.
So, how do we get "Bash"? Simple:
1. REG N=0xA0D68736142
0xA0D68736142%0x100=0x42=66=ASCII('B')

2. REG N=0xA0D68736142/0x100=0xA0D687361
0xA0D687361%0x100=0x61=97=ASCII('a')

3. REG N=0xA0D687361/0x100=0xA0D6873
0xA0D6873%0x100=0x73=115=ASCII('s')

4. REG N=0xA0D6873/0x100=0xA0D68
0xA0D68%0x100=0x68=104=ASCII('h')

5. REG N=0xA0D68/0x100=0xA0D
0xA0D%0x100=0xD=13=ASCII(Carriage Return)

6. REG N=0xA0D/0x100=0x10
0x10%0x100=0x10=16=ASCII(DLE) ( I don't know what this is. A flaw in the logic perhaps???)

7. REG N=0x10/0x100=0x0
QUIT.

Life or something like it

what I'm listening to: Do you feel loved-U2
the ringing in my head: Last thing-Diana Anaid
what I'm reading: The Agony and the Ecstacy-Irving Stone
what I'm not: The Da Vinci Code(don't intend to either)
what I'm writing: Computer code
what I'm not: A love letter
last movie I watched: Star Wars Episode III
last place I ate: Sweet Chariot
what I had: ummm, cheese garlic bread, vanilla cheese cake,
mint tea(if you can call it that!!!!)
what I'm thinking: Goa,Apple's move into x86,Ann Coulter,
Intelligent Design,lip syncing in computer games,
101 philosophical problems,the new Dockers ad,
Nokia N90,ipod,Star Wars....
what I wanted to write at the end of the post: this.

Wednesday, June 15, 2005

this is me then

I was recently watching this new sitcom "Stark Raving Mad" on Star World, when I realised one of the characters in it was the protagonist in an old TV show called "Doogie Howser". I used to watch that series every day after school (on either star plus or star world. Don't remember which one). That show really inspired my adolescent thoughts, I must admit. It's 'bout this child genius of 14 or 16 who is an M.D. and works in a hospital after school, treating maladies of all sorts and proportions. The end of each episode always signified the end of a hard day's work for young Doogie, where he sits in front of a computer logging his thoughts onto a "blue screen" ( the edit program in DOS????). Anyway, I always thought at that time that the first thing I was gonna do when I get a computer was to log all my thoughts like he did, which I obviously never even came close to. So, that's one of the lame excuses for starting this blog thingy. Ok, so about me: books; objectivism; nocturnal; bangalore; drizzle; enigma; ipod; google;john carmack; michelangelo; pieta; ps3; aquafina; black currant; subway; tea; isla nublar; david gray; depeche mode; dire straits; 21 grams; amores perros; linux; fight club; tracy chapman; bell labs; friends; bbc; middle earth; galadriel; paradoxes; computer gaming; pizza; leelee sobeiski(GOD, I hope I got that right); nicole kidman; keira knightley.... (yaaaaawn.... the list is endless). Mesa getting sleeeepy. Lemme log off by quoting this pleonasm I came across recently:
"...and so it was deja vu all over again".