Monday, November 28, 2005

Blog addict

Well one thing is for sure that I am addicted to blogging. I have 3 blogs... well i do maintain only this regularly though. Since all of you know that I got a camera and have gone into a clicking spree... I thot it was now time for a new blog.

One thing that am always running short of is time so I was looking for the most easy way to accomodate photoblogging into my schedule. I tried photo blogging with picasssa and it didnt quite click on the time factor. Live journal was again something similar i tried using flickr. I used it earlier for photo sharing now i'll use it for one liner photo blogs. The flickr uploader works great and all I have to do is to right click the file and do "send to flickr" (on windows ofcourse... nothing there on linux :( ).
This is the RSS feed and this is the link to the photostream... do take a look at it.

Also I was meddling with my camera on linux. Kodak EasyShare software simply sucks on windows. I had really no hope as its a new model. I plugged in my camera and fired Kaboo (i guess that is the name... but not quite sure)... FC4 detected it gracefully, asked me which photos to transfer and transffered the required files... thats all I want from a camera software. Although I was a bit frustated... I like when things are cryptic... I wanted to mount /dev/sda1 and open the camera card... I hate it when my FC4 detects my flash drive and places an icon on my desktop :P. Anyway linux rulz.

Saturday, November 26, 2005


Winter is approaching.... well technically it is not yet winter here although the temperature dropped to a wicked -7 C. The scenic beauty is awesome, but the chill restrains me from spending my time outdoors and appreciating mother nature... good for me.

Well now that I have got a cam, and a figity person that I am, I could not resist tinkering with some of the pics I took. Above you are seeing a collage of photos created using picassa. All the photos are of my immediate neighbourhood.

Friday, November 25, 2005

Shoot 'em down ...

I am now the proud owner of Kodak c360. The retail price is $239 and i got it for $129.9... I also purchased a 512 mb mem card for just $19.

I love Black fridays... I went to Best Buy at around 2 am , only to find that people were standing there since 7 pm ...that is insane!! But it paid off anyway. The camera is a powerpacked pony, despite its small size, it has slr features plus manual focus option... i am loving it. It is a 5 Mp cam and is the latest C series Kodak camera. 3x optical +5x digital zoom... slick!!. I wanted to go for the camcorder but it was a bit outside my budget... panasonic 26x/1000x for just $249. Either these guys are trying sell their goods at a big loss or they are thugging us during normal days.

To top it all I got a pack of 25 CDR+75 DVD-R for just $2.9 .... incredible!! Posted by Picasa

Wednesday, November 23, 2005

Nothing is impossible....

Check out this story:
I found it while following a slashdot story... It is 10 pages long but its worth it. I would say its a great story of a man chasing his dreams... well a bit geeky too. It really feels great to be a scientist.

Sunday, November 20, 2005

look before u leap... design before u code

I spent past 5 midnights in college, doing my projects... I really screwed one up. There r certain things you learn the hard way. Designing is one such thing. The other is bias.

Bias...hmmm... anyone who talk for me for hour can easily infer that I hate Windows and am in love with Linux. Well that should be pretty normal , infact people do love something and hate others... but for a technologist the sense of objectivity is really important. Windows may be badly designed and Linux might be extraordinarily great but loving or hating them is insanity. It creates a mental block. How did bias ruin my nights??? well i procrastinated abt c# proj and ....

Designing, for me is like girl friend/sex/drama... is always there on books not in my life. But my software modelling and analysis class has really taught me alot. I started designing ... that is like a monkey writing sonnets of shakespere. I was really strugglling with a requirement and that was consuming my whole time ,well past the deadline. The application that i had put up was not even the bare minimum. In my frustation I mailed the prof that I had spaghettised my code... and i dont know what to do... I really needed a B to maintain my scholarship. He agreed to meet me and sort the matter out.

In a really short meeting he said a sentence which changed the dimension of my cosmos. He said The Hardest requirement is not the most important requirement ... I met him at 3 pm... found out that the feature that i wanted to implement could be implemented using a so called cross domain delegate, which ofcourse had a low ROI(return on interest)... so i dumped that part and finished the code by 8 pm.... the same code which was teasing me for the past whole damned week. I think if the lights were switched off, u could have seen a halo of enlightment around me :) ...
(btw he also told me that I can easily aim for A/A-) yayyyy...

PS: I really hate norton AV/IS.... I had removed VX2.look2me trojan/malware/adware.... but its still there on my n/w and norton does not stop it form entering my pc again. They ceratinly designs viruses better than the scanners...

Tuesday, November 15, 2005

Life... File Not Found

From my earlier posts you could have imagined that my life is really going the way I always wanted... Highly techie type, but today I felt my brain getting fried. Not that I was doing something hightly demanding, just the fact that I had been working out too much lately drained me out.

Well for the past couple of days I was working with FreeBSD kernel... a job that I love to do... so finished it before the deadline and started adding elegant features and test modules which were way beyond the requirement. Now that the project is over, I have another project at hand... this one is a C# project and is quite a biggie... I was given 5 weeks time to finish it...the deadline is this wednesday and I started it yesterday. I will have to satisfy all the requirements according to spec sheet before the deadline. Man ...only if I liked Windows like *niX... The fact that anyone can write a program easily in .NET makes the whole work of writing C#.NET code unexciting. Well yeah then you only use C# and java to implement business logic.

I have written few great tools on languages like Java and C# and there is no way I could do the same thing with C like language. But for reasons unknown to me, they dont excite me a bit. I tend to get bored writing code in those language. Implementation is so trivial that if u know the logic, there's no way you cannot write an application unless you are extraordinarily stupid.
If u use these languages then u only need to figure out what to do instead of how to do. The problem being that once you know what to do, doing it becomes simple and boring. These facts make them superb language for commercial application development.... which makes me wonder if I will ever be happy settling for a regular job where engineers are like machines ... who are just thinking mechanically and doing nothing more than a blue collared worker. The only difference being that they get to sit in an air conditioned chamber and get paid more. The work is almost similar with CS engg using components to make up a bigger system.

I kindda like putting my feet in uncharted waters, hacking the kernel, learn some fancy languages like C#,Jave, php ...write one or two great applications using them and then forget about them. The more obscure the thing is the more I like it.... I loved to crack windows applications and snoop the network but that too got boring after a while. I guess am on my way to be a scientist...but i dont think that i'll be doing Phd...My Dream: Being the CTO of a multinational Software company or better start a company and be its CTO/President.

PS: my pc is adware one knows how to remove them. I tried spy doctor & norton but no avail :(.... i hate when my webpage changes automatically to some cell phone vendor site and flash animation cover my screen when i am online(which accounts for 15/24 of my day)

Sunday, November 13, 2005

Virtual Memory Hacks...

Today I finished my mods on FreeBSD's VM subsystem. I changed the page replacement algorithm from LRU to FIFO. I also changed the prefetching scheme to make it fetch a single page ahead of it instead of traditionally fetching out a few pages from the front and the back of it.

Now this obviously was an effort to improve our understanding of the existing kernel. We hoped that FIFO with new preloading will really be pathetic in all the cases. But this wasnt the case. The original scheme was consistent in most of the cases but failed by almost 20% when i accessed an insanely large linked list. I ofcourse could not use stack as there is a serious size limitation associated with it... also I was not sure whether the stack frame associated with a process resident in the memory is paged out.... i think it wont be... but thats the logical implication... i needed empirical data to assert somethings for the experiment...

Any way FIFO was way better than LRU for that particular case. The graphs for all the different cases proved a lot of theories which I had read and broke many myths and assumption I had about the system. The best one is this...

struct node{
struct node *next;
int info[4096]; //page size in FreeBSD4.1

struct node *first,*curr,*temp;
first=(struct node *)malloc(sizeof(struct node));
add temp to first...extend the linked list .//too lazy to type
}while(there is still space in the heap);

Now guess the amount of page faults....just 400. And as soon as you write to it the pf shoots up to 45000. My best bet is that the system implements some kind of copy on write. The memory is allocated on heap only when something is written onto it or read from it...not before.

There were plenty of obscure facts that never failed to baffle me. All the budding kernel hackers should definitely take a look at BSD kernel. Simple yet powerful...

Monday, November 07, 2005

My experiments with truth...

For the past two days I have been trying desperately to get my own VM page replacement scheme to work on FreeBSD, but all in vain. I am implementing FIFO and the version I am using supports LRU (infact any OS does). So of course i was expecting a clear increase in the number of pagefaults or perhaps a system crash due to excessive thrashing. My two test programs gave me the fault count of 15636 and 6 for LRU and FIFO. The results were quite opposite to what i had expected. I was using a combination of both LRU and FIFO. FIFO for active list and LRU for the inactive, cached and free list. I thought that I would have hit onto something really great. I was so overjoyed that i called my project mate Jorge at midnight!! later inspection of the code revealed that i had made a programatical mistake and the damned thing was just spittin out garbage.aaah...
After fixing the code the two algorithms for some divine reason were giving me almost the same results. One other grp too was getting that result.... i decided to give it a break.

As usual I started watching tech videos/podcasts/vodcasts. One of them involved ARP poisoning using the man in the middle attack. I have been browsing for stuff for ages now, so didn't give it a second thought. But since I was on Linux that time, i gave it a try. I used a simple utility called ettercap (am not going to give you the links, if u r smart u r gonna get them anyway... otherwise think that i did u a favour... most funny stuffs u can do with it are illegal). I added a filter that just sniffed the incomming packets for images and replaced them with my photograph. I did not care to switch that thing off. Actually it was really funny to see my photo plastered all over my roomy's browser. Then the bitter truth came to me. Instead of scanning my subnet, i had left the sniffer lose onto the whole network.
I just hope nobody else is online at midnight and the cops understand the humor :P

Friday, November 04, 2005

System call in FreeBSD

Kernel programming is considered a dark art, but writing a system call is in FreeBSD is incredibly simpler than Linux. So here's my quick and dirty, 5 minutes to fame, system call implementation on FreeBSD 4.1. This system call just print Pico Rocks on the terminal :)

Edit /usr/src/sys/kern/syscall.master: I wont explain why i am doing certain things... cuz the code does a wonderful job in doing that. So just go to the end of the file. You will see a lot of system call defined. The first column gives you the system call number. The last sys call on my machine had a syscall number of 363. So add the following line at the end

364 STD POSIX { int sys_pico(void); }

STD means that your system call will always be included in the kernel, which was necessary in my case as I had to enter asynchonously from the top half of the kernel. The function within the curly brackets give you the syscall signature. Also if you system call is named pico(), the signature here has to be sys_pico(). POSIX means that its is POSIX option, well i din really care abt that I just wanted it on my PC and not ported to others... u cud have used BSD or any other options available.

Next run
#make init_sysent.c
in /usr/src/sys/kern directory. This automatically updates init_sysent.c, syscalls.c and syscalls.h.

Now add the following file in /usr/src/sys/kern directory under the name of sys_pico.c:

#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/mount.h>

*The whole BSD kernel is littered with K&R type formatting.
* so i used it too just for uniformity sake...
sys_pico(p, v, retval)
struct proc *p;
void *v;
register_t *retval;

printf("Pico Rocks\n");
return (0);

Now go to /usr/src/sys/conf/files and add the line
kern/sys_pico.c   standard
anywhere u like... since the whole file was arranged in alphabetical order so I inserted it in its correct ordered position. Now recompile the kernel and reboot the machine.

Now the following code snippet calls our sysetm call:

#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>

int main()

compile the above program using gcc -I /usr/src/sys/sys.
o/p: Pico Rulz ....hoooray
Now of course you might be thinking that why cant i call pico() normally like other system calls. well for that u have to modify a file(or whatever way ur libc's includes them) and recompile libc. I tried to do it but my libc crashed and I had to reinstall the whole damn thing. The result of reinstallation was so gross that i ended up re-installing my BSD.

Update: Sorry i almost forgot.... dont forget to remake the config file too in the i386/conf directory
 #config GENERIC


One thing that made life really kewl in Bangalore was the abundance of like minded engineers and scientists. By that I mean I knew a lot of people who were or wanted to be Linux geeks. The BLUG, although was politics infested like any other large group but those who were not involved always enjoyed the rich flow of intellectual material at the BoFs (birds of a feather meetups) and the annual LBA meet. Especially this annual event never fails to excite me. I totally went nut for linux and broke my association with Windows in 2003 when i attended the talk by Herald welte (author of netfilters), Miguel and Nat (Mono), Brian (Apache ofcourse) and Rasmus(php's dad) (of course i do code a teeny weeny bit on windows when the situation demands).
This year they have come yet again with a big bang. They have even roped in Alan Cox (those of u who dont know who he is...go kill urself) to give a couple of talks. Now the number of talks are around 185 and include everything from BSD to desktop to embedded development. Check out this tallk list. It is as great as Linux Kongress meet. I am missing Bangalore :(

Ya and BTW i did well on the SMA mid term. Got 94.4/100 ... it was the 3rd highest i think. It counts for 1/3 of the gpa and was really a refreshing change after getting scores which were 3rd lowest. Somehow I only show my mettle in exams?? even in algorithm... and i know why... i simply dont work hard for assignments.... but come on no one is perfect. (Agent Smith said: You r still only human :P)