Thursday, September 20, 2007

[TECH] Generic Randomized Quicksort algorithm.

Adding to my own collection of generic data structures, today I added a generic Randomized Quicksort algorithm, I need a good sorting routine in the SAPE algorithm for sorting distances. I want to makesure that it can sort any kind array (array of char's,int's,float's,double's and also structures).


/*A generic Randomized Quicksort:
 *The key idea of being generic comes
 *from the fact that you take a memory 
 *block and size of each element and 
 *sort this memory chunk, so we always
 *deal with address's.
 *
 *
 *Sep 20,2007 vamsik@engr.uconn.edu
 **/
#include
#include
#include
#include
#include
#include "RandQsort.h"

/*INPUT: swap_routine,compare_routine
 * swap_routine: The algorithm gives the 
 * (void *)'s swap_routine of two things
 * which need to be swapped.
 *
 * compare_routine: The algorithm gives the
 * (void *)'s to the compare_routine its 
 */
static char QSORT_RAND_SEED=0;
static void (*swap_routine)(void *,void *) = NULL;
static unsigned char (*compare_routine_l)(void *,void *) = NULL;
static unsigned char (*compare_routine_g)(void *,void *) = NULL;
static time_t t_rqsort;
unsigned int GetPivot(void){
 if(!QSORT_RAND_SEED){
  assert(((time_t)-1)!=time(&t_rqsort));
  srand(t_rqsort);
  fprintf(stdout,"Setting RAND_SEED to %d \n",t_rqsort);
  QSORT_RAND_SEED=1;
 }
 return ((unsigned int)rand());
}
/*Avoid loosing the pivot during swaps*/
void UpdatePivot(void **pivot,void **i,void **j){
 if(*i==*pivot){
  *pivot = *j;
 }else if(*j == *pivot){
  *pivot = *i;
 }
}
/*Take a memory address location and size 
of the data items[Inplace partition]*/
static void PartitionWithPivot(void* start,void* end,
unsigned int dsize){
 void *pivot=NULL;
 void* i=start;
 void* j=end;
 unsigned int p_index = GetPivot();
 if(start==end){
  return;
 }
 p_index %= (((unsigned int)(end-start))/dsize);
 pivot=(void *)((unsigned long)start+
  (unsigned long)((p_index)*dsize));
 while(i=start)){
   j-=dsize;
  }
  /*Swap i,j*/
  if(istart){
  swap_routine(pivot,(void *)(i-dsize));
  PartitionWithPivot(start,(void *)(i-(2*dsize)),
  dsize);
 }
 if((i+dsize)<=end){
  PartitionWithPivot(i,end,dsize);
 }
}
/*Call PartitionWithPivot recursively*/
void RandQsort(void *start,void *end,unsigned int dsize,
void_void_fptr sroutine,bool_void_fptr croutine_l){
 swap_routine = sroutine;
 compare_routine_l = croutine_l;
 assert(swap_routine && compare_routine_l);
 PartitionWithPivot(start,end,dsize);
}
#ifdef UNIT_TEST_RQSORT
/*TEST1:Testing for chars*/
unsigned char CharCompare_L(void *a,void *b){
 return ((*((char *)a))<=(*((char *)b)))?1:0;
}
unsigned char CharCompare_G(void *a,void *b){
 return ((*((char *)a))>=(*((char *)b)))?1:0;
}
void CharSwap(void *a,void *b){
 char temp=*((char *)a);
 *((char *)a) = *((char *)b);
 *((char *)b) = temp;
}
void TestCharSort(){
 char *data = malloc(sizeof(char)*10);
 char test_buffer[64];
 unsigned int i,j,k;
 time_t test_time;
 for(i=0;i<10;i++){
  data[9-i] = '0'+i;
 }
 /*Randomize the input data*/
 time(&test_time);
 srand(test_time);
 for(i=0;i<100;i++){
  j=(rand())%10;
  k=(rand())%10;
  test_buffer[63]=data[j];
  data[j]=data[k];
  data[k]=test_buffer[63];
 }
 /*Print the buffer*/
 if(strncpy(test_buffer,data,10)!=test_buffer){
  fprintf(stderr,"SYSTEM_ISSUE:Copy into buffer failed\n");
 }else{
  test_buffer[10]='\0';
  fprintf(stdout,"%s\n",test_buffer);
 }
 RandQsort((void *)data,(void *)(data+9),1,
 CharSwap,CharCompare_L);
 for(i=0;i<10;i++){
  if(data[i]-('0'+i)){
   printf("Test Failed for Chars\n");
   printf("Expecting %d but found %d\n",i,
    ((unsigned int)data[i]-'0'));
   exit(1);
  }
 }
 test_buffer[0]='\0';
 if(strncpy(test_buffer,data,10)!=test_buffer){
  fprintf(stderr,"FAILED_TEST: UNABLE TO COPY BUFFER\n");
  fprintf(stderr,"MAY_BE_SOME_MEMORY_CORRUPTION_DURING_SORT\n");
  exit(1);
 }else{
  fprintf(stdout,"%s\n",data);
 }
 printf("Test Passed For Chars....\n");
}

unsigned char FloatCompare(void *a,void *b){
 int a_int = (int)((*(float *)a)*10000);
 int b_int = (int)((*(float *)b)*10000);
 return (a_int<=b_int)?1:0;
}
void FloatSwap(void *a,void *b){
 float temp;
 temp = *((float *)a);
 *((float *)a) = *((float *)b);
 *((float *)b) = temp;
}

#include
void TestFloatSort(){
 float *data = malloc(sizeof(float)*10);
 float temp;
 unsigned int i,j,k;
 time_t test_time;
 for(i=0;i<10;i++){
  data[9-i] = (float)sin(i);
 }
 /*Randomize the input data*/
 time(&test_time);
 srand(test_time);
 for(i=0;i<100;i++){
  j=(rand())%10;
  k=(rand())%10;
  temp=data[j];
  data[j]=data[k];
  data[k]=temp;
 }
 /*Print the buffer*/
 for(i=0;i<10;i++){
  printf("%f ",data[i]);
 }
 printf("\n");
 printf("The # of elements %d\n",(&data[9]-&data[0])/4);
 RandQsort((void *)&data[0],(void *)&(data[9]),4,
 FloatSwap,FloatCompare);
 for(i=1;i<10;i++){
  if(!FloatCompare((void *)&data[i-1],(void *)&data[i])){
   printf("Test FAILED comparing %f , %f\n",
   data[i-1],data[i]);
   exit(1);
  }
 }
 for(i=0;i<10;i++){
  printf("%f ",data[i]);
 }
 printf("\n");
 printf("Test Passed For Floats....\n");
}

/*Test for floats*/
int main(){
 TestCharSort();
 TestFloatSort();
 exit(0);
}
#endif


Saturday, September 08, 2007

[TECH] Perl template toolkit and Bugzilla

I have now done with the customization of Bugzilla for our internal needs, to keep track of things. The core of the idea of templates was simple

  • Seperate the presentation from the code
The good thing about using Perl + TTK is that the split (presentation code and actual code) is very wide compared to any other framework which I'm aware at least from my past experience. I have used the following frameworks previously. Its a very useful add on as a skill learn more about http://www.template-toolkit.org

Have few things to fix today, Add code to SAPE_1 with the new Center of Gravity algorithm.

Cheers!
Vamsi

Monday, September 03, 2007

[TECH] Bugzilla Internals

Got back to work today !


Was looking at the Bugzilla's perl code to extend it for some of my internal work, I found that it was a expert level perl code (Object oriented) they are using several things which I never used, It was a good learning experience.


I want extract few concepts from this code

  • How do all these websystem's avoid hard coding of HTML inside the code which generate's HTML dynamically (I know its kind of servlet and JSP/ASP situation), I found that these guys have some mechanism based on templates which avoids hard coding of the HTML inside the dynamic HTML generation code

I guess this is the key idea/concept behind all the code which generates HTML dynamically.

I was reading Sriram's "Advanced Perl Programming" I think its a great book the way he build's up the concepts, I was really impressed by a quote by him in the book
"It is indicative of inflexible procedural design if you find yourself using conditional statements to distinguish between object types"


I want to go out to get some lunch today :)
Cheers!
Vamsi

Sunday, September 02, 2007

[NON-TECH] The old and cold feeling comes back........

I visited India from Aug10-Aug30 all those 20 days were great most of the time I was in Hyderabad, life was great in India except that there was a lot of pollution especially in Hyderabad and also overcrowded places especially because of the booming IT industry.

Some of the things I noticed have changed in India from the time I left

  • The money spending power of people have increased a lot, I heard that the average salary for a undergrad is now around 5.0 lack/annum ($12.5k ), this was a huge increase compared to average of 2.4 lack/annum ($6k) which is more than double.
  • The cost of living has gone up from the last year, I remember that I used to eat in a hotel called Kakatiya in Ameerpet a full meal for Rs 26.00/- the same costs Rs 32.00/- now. A bottle of mineral water went up to 13.00/- from 10.00/-
  • There have been a lot of malls/multiplexes mushrooming every where in Hyderabad. I saw several existing houses being demolished and new multiplexes and malls are taking their place.
  • Looks to me that almost every thing is available in India now. I was shocked to see PSP in Music World, I guess people are now getting into games market and if its true India will be a great market for selling computer games.
  • In India cell phone has become a revolution I find that almost every one in the country has a mobile phone, thanks to Reliance which had a vision of making cell phones affordable to every one.

All these things are fine but my old feeling comes back again, I remember all those dilemma which I was having when I just landed in U.S went to riverside and came to UCONN, all those feeling are fresh in my mind. Well that COLD FEELING of missing India comes back again I don't know why but its back.....I feel sorry for myself I don't know what I'm up to in my life.....But I'm transforming my self to be better than what I used to be, and I believe that what ever is happening is just transformation for something better........as usual Connecticut is very lonely very quiet place, I used to go for jogging in India every day around 7-8 a.m in the morning.....

Well its life and lets face it without fear!
Cheer! Vamsi.

Thursday, August 02, 2007

[NON-TECH] From Dennis Ritchie's Bio....

Some times there are far too many things for people to decide on what to do? how to excel? what exactly is our strength ? . The problem here is that people tend to be *good* in several things, but being *good* is not enough if a person who is *good* compares to some of the smartest people in the same field. All this thoughts haunt every one I found the following from Dennis Ritchie's biography here
"My undergraduate experience convinced me that I was not smart enough to be a physicist, and that computers were quite neat. My graduate school experience convinced me that I was not smart enough to be an expert in the theory of algorithms and also that I liked procedural languages better than functional ones."
see that line "I was not smart enough to be an expert in the theory of algorithms....." I guess any person at his position would never say that (even though he is not smart), I really felt this guy is TRULY a GREAT GUY, he had to be really modest and humble to say such things......
Cheers!
Vamsi.

Tuesday, July 03, 2007

[TECH] My Quick VIM tip of the day

To add something to every line in a file with vim
:s/^/something/gc

[TECH] FORTRAN awful stories

Well first time in my life had a chance to look at a messy FORTRAN code. I used some of the CRAY style POINTER(ptr,pointee) stuff and it looked to me its really weird.
There are several crazy things which got me irritated while writing the code

  • Can you beleive that when you write FORTRAN code you must make sure that every line is no more than 80 chars, some one told me that FORTRAN had this because of the punch cards whose size limit come from there.
  • Really strange that FORTRAN has no concept of global variables, and its a real pain especially when you have SUBROUTINES you will have to make a COMMON block and copy all the definitions into the SUBROUTINE, real big pain, thanks to INCLUDE which saves us.
  • I found they there seems to be a huge variations in the standards of FORTRAN, there are several things 'g77' did'nt support, I used 'ifort' intel fortran compiler.
  • Really had tough time figuring out the format specifiers equivalent to 'printf' for 'WRITE(6,*)'
  • Last but not least FORTRAN dont have a ';' at the end of statement and its really pain when you are a 'C' programmers.
  • Last++ IF conditions seems to require THEN , I figured out after writing several lines of code :(, really an Experience of writing programs in legacy languages and a real test for a real programmer.

I forgot I wanted to keep track of this piece of code, to close all the files in a program with calling close(fd) in each of fd's

fp = tmpfile();
fp->_chain = stderr;
fpclose(fp);
fp = NULL;

Take care guys!
Cheers!
Vamsi

Thursday, June 28, 2007

[TECH] Memory corruption and format specifiers "%s%c" is different from "%s%1s"

I have been fixing several issues last few weeks, and the following issue in someone's code is a clear test for understanding differences between strings and char's.

On the first look "%s%c" and "%s%1s" seem very similar, but unfortunately NO! and they can create some nasty runtime bugs corrupting your variables, suppose the code existing in someone's code like this.

void BuggyScanner(){
    char buf[MAX_SIZE];
    int a;
    char b;
    scanf("%d",&a);
    scanf("%3s%1s",buf,&b);
    printf("a=%d buf=%s b=%c\n",a,buf,b);
}
The format specifier is really a blunder as scanf "%1s" is going to write beyond one byte (the extra '\0' which gets padded for strings)at the address of 'b' , since 'buf','a','b' are on the stack writing one byte beyond the address of 'b' can do really nasty stuff.
  • Just as in this corrupted the variables.
  • Potentially corrupt the return address of the function, creating a great security bug.
Be Careful guys! Vamsi.

Tuesday, June 19, 2007

[BOOKS] List of books I want to buy when I'm in india

1. The Practice of Programming (Paperback) by Brian W. Kernighan (Author), Rob Pike (Author) 2. Programming Pearls (2nd Edition) (Paperback) by Jon Bentley (Author). 3. Algorithms on Strings, Trees and Sequences: Computer Science and Computational Biology (Hardcover)

I'll keep adding to this list...
Life has been through a lot of code in Matlab/Octave, Perl and C. Cheers! Vamsi.

Saturday, June 09, 2007

[Perl] Don't nest your regular expressions when you use /g switch

I have been busy all these days with quite a few things, well the motive of this blog is to document some of the issues I face in my day to day work.

while($line =~ /input .*? name="(.*?)" .*? value="(.*?)"/g){
  $param_name = $1;
  $param_value = $2;
  if($param_name =~ /blah/){
    # Do some stuff
  }else{
    #Do some stuff
  }
}

The above code can go miserably wrong and hard to debug especially when the outer while loop has hundreds of lines of code in it, as you can see when we use '/g' switch in the matching all the matches within a string, make sure that THERE ARE NO NESTED REGULAR EXPRESSIONS WHEN USING /g switch

Wednesday, April 04, 2007

I want to become expert in one area

Some times I think what I'm I worth of? what can sell myself?
In fact I did sell myself when I created perl2exe based on my systems knowledge.
few things I think I should concentrate on
1. Parallel Algorithms (they make me to say ahaa!)
2. Systems (Drepper called me Moron! :()
3. EDA (Feels good for me).

Wednesday, March 21, 2007

[NON-TECH] Puppy


Pic of puppy after a fashion show in hyderabad!
IMG_0495
Originally uploaded by vamsi.

Thursday, March 08, 2007

[Tech] Bitonic Sequences and Bitonic Merge

Given a Bitonic Sequence of length 2n (a motonically decreasing (inceasing) and montonically increasing (decreasing).
If we do a Bitonic merge we still of 2 bitonic sequences of length 'n' each.
void BitonicMerge(int *array,size_t size){
 int i;
 assert(!(size%2));
 for(i=0;i lessthan size/2;i++){
   if(a[i+(size/2)] < a[i]){
     swap(a[i+(size/2)],a[i]);
   }
}

What we have is now two Bitonic sequences. Doing a Bitonic sort on a parallel machines with 'p' processors and 'n' elements n >> p. Next post I'll post my code to do the Bitonic merge of the sequences.

Monday, March 05, 2007

[FUN] Top 21 things an Indian does after returning from U.S

(---  Good One!.... Just for fun---)


21. Tries to use credit cards in a road side hotel.


20. Drinks and carries mineral water and always speaks of being health conscious.


19. Sprays deo so that he doesn't need to take bath.


18. Sneezes and says 'Excuse me'.


17. Says "Hey" instead of "Hi".
says "Yogurt" instead of "Curds".
Says "Cab" instead of "Taxi".
Says "Candy" instead of "Chocolate".
Says "Cookie" instead of "Biscuit".
Says "Free Way" instead of "Highway".
Says "got to go" instead of "Have to go".
Says "Oh" instead of "Zero", (for 704, he will say Seven Oh Four Instead of Seven Zero Four)

 

 


16. Doesn't forget to crib about the air pollution. Keeps cribbing every time he steps out.

15. Says all the distances in Miles (Not in Kilo Meters), and counts in Millions. (Not in Lakhs)

14. Tries to figure all the prices in Dollars as far as possible (but deep inside multiplies by 43).


13. Tries to see the % of fat on the cover of a milk pocket.

12. When he needs to say Z (zed), he never says Z (Zed), instead repeats "Zee" several times, and if the other person is unable to get it, then says X, Y Zee(but never says Zed)

11. Writes the date in MM/DD/YYYY. On watching traditional DD/MM/YYYY, says "Oh! British Style!!!!"

10. Makes fun of Indian Standard Time and the Indian Road Conditions.

9. Even after 2 months, complaints about "Jet Lag".

8. Avoids eating spicy food.

7. Tries to drink "Diet Coke", instead of Normal Coke. Eats Pizza instead of Dosa.

6. Tries to complain about any thing in India as if he is experiencing it for the first time. Asks questions etc. about India as though its his first visit to India.

5. Pronounces "schedule" as "skejule", and "module" as "mojule".

4. Looks suspiciously towards any Hotel/Dhaba food.Few more important ones:

3. From the luggage bag, does not remove the stickers of the Airways by which he traveled back to India, even after 4 months of arrival.

2. Takes the cabin luggage bag to short visits in India and tries to roll the bag on Indian Roads.The Ultimate one


1. Tries to begin any conversation with "In US ...." or "When I was in US..."

Tuesday, February 27, 2007

[Tech] How to determine the bus bandwidth.

Hi recently I had a need to find out the bus bandwidth. 
The bus had 64 lines and assume that the speed of the bus is xMHz.
This implies the bandwidth = (no.of lines) * (speed of each line).
Bus Bandwidth = ((64/8)*x*10^6)/(2^20) MBytes/sec.

A simple use of this metric is suppose you have 
SMP(Shared memory processors) with a common bus
and the bandwidth of the bus is 1 GBytes/sec
and you have several processors which have an 
(memory) Instruction bandwidth of 250 MBytes/sec
you cannot connect more than 4 processors to 
saturate the bus.  

Thursday, February 22, 2007

[Tech] Pathetic non unix standard matlab editor

Well I'm really pissed of this damn editor (matlab editor) , some how I cannot execute my program .m file from the command line so I had to use this matlab's editor to run my program, after using vi for long this is really pathetic, its more worse than windows I just did ctrl+c and ctrl+v it pased some junk instead of the code which I intended to paste.

Monday, February 19, 2007

[SPICE2LAYOUT] 40% Complete

Got back to the SPICE2LAYOUT project updated some Makefiles and added all the skeletal code today. By the mid of the week I should get this up and running, It also needs to have the channel router in that.
Need to get back home and study some stuff for a upcoming Friday jury.

Sunday, February 18, 2007

Algorithm for Permuting in place

Problem: Given a set of numbers S = 1...n and a permutation PI(S), how can you rearrange elements in S in O(n) time with no extra space.

I don't like explaining things just code it., here's code below
#include
#include
#include
int a[10];
int b[10];

void ResetArray(){
    unsigned int i;
    for(i=0;i<10;i++){
        a[i] = i; 
    }
}
void swap_elements(unsigned int i,unsigned int j){
    int temp;
    temp = a[i];
    a[i] = a[j];
    a[j] = temp;
}
/*b is the swap list*/
void InplacePermute(int *perm){
    unsigned int i;
    for(i=0;i<10;i++){
        if(perm[i] < i){
            perm[i] = perm[perm[i]];
        }
        if(a[i] < i){
            perm[a[i]] = perm[i];
        }
        swap_elements(i,perm[i]);
    }
}

void PrintPermutation(void){
    unsigned int i;
    for(i=0;i<10;i++){
        printf("%d ",a[i]);
    }
}

int main(){
    int runs=10;
    unsigned int i;
    do{
        ResetArray();
        printf("Please enter the permutation of size 10, 10 unique digits from 0-9\n");
        for(i=0;i<10;i++){
         if(scanf("%d",&b[i])<=0){
            break;
         }
         assert(b[i] >=0 && b[i] <=10);
        }
        if(i<10){
            break;
        }
        InplacePermute(b);
        printf("The permutation is::");
        PrintPermutation();
    }while(1);
}

The following are testcases
7 3 2 1 4 8 9 0 5 6
8 9 1 2 5 6 7 3 4 0
1 2 3 4 5 6 7 8 0 9
1 3 4 8 9 0 7 6 5 2
Well this week has been a little productive, got the space for http://phaedrus.sourceforge.net a library of randomized algorithms
Have Fun.... Vamsi.

Thursday, February 15, 2007

Passing multidimensional arrays to functions

Got enlightened by this today. And realized the following.
int a[10][20];

int main(){
 print_array(a); /*results in a crash.*/

}

void print_array(int **a,int i,int j){
 printf("%d",a[i][j]); /*How stupid this can be?*/
}

Monday, February 12, 2007

I love PHP

Have been using PHP with apache to build some stuff really like programming in this I'am in love with PHP.

Tuesday, January 30, 2007

[Tech] One more reason why MACRO's are Not Preferred over inlines.

...macro.h....
/***Dangerouse Macro1***/
#define print_int_value_twice(c) do{\
 printf("first time %c second time %c\n",c,c);\
}while(0);

/***Stupid Preprocessor***/
#define my_error(c) do{\
 fprintf(stderr,"Error::");
 fprintf(stderr,c);
 fprintf(stderr,"\n");
 exit(1);
}while(0);

.....macro user ....
j=0;
print_int_value_twice(j++);
/*j incremented twice by the preprocessor*/


/*In this case the preprocessor is stupid 
 not treat the string spanned across several lines
 as a incomplete macro argument and fails compilation.*/
my_error(" My error spans three lines
            line1
            line2");


Avoid MACROS start using inlines , if you define macros the users should use them with caution

Monday, January 29, 2007

[Personal] I was not good and never have been.....

Yes! today I realize my potential, I was never good in fact never have been....I accept my failure. I'm a looser, I cannot win and never have won and in fact I'm obliged to life for letting me live and eat what ever I want and wear what ever I could....in the midst of bitter shame....I gave up...I don't want to live as a looser...I will soon end my life and this blog may be the last. I was never honest to myself I have things which I don't deserve. And I get emotional for small things...what else a looser can say except bending down head in shame.

Wednesday, January 24, 2007

[TECH-NON-TECH] SPICE2LAYOUT should I use BGL?

A Warm Welcome to a great new year 2007! This is my first blog after 24 days in the new year. Last time I had written my blog was on Dec 31, 2006, well this was the coldest new year eve I had. I just went to bed on Dec 31 night 2006. Its because I was with puppy taking care of puppy...we were really afraid on whats going to happen next....but it was great what happened next day was really a new begining in a new year things went excatly how I wanted (In fact I did'nt know what would be the best solution and just prayed "God! Please do something so that I will be comfortable after that")...a great going new year 2007 from there on, really had great time in Hyd from Jan-1 to Jan-6.....after that I took pathetic AeroSvit flight (Never Ever Take this shoddy airline) back to JFK, travelled all the way from NewYork to Hartford and took a cab to my place....its quite a tiresome journey to travel from India to U.S, next time I will travel by either BA ,Lufthansa or Emirates..... Now I need startoff my coding for the SPICE2LAYOUT project its been a while I took a break and its really a long one....Tomorrow Is a SRM from TopCoder....I was having a dilemma to use Boost Graph library or not...but I guess it will be fine if I write it on my own. Take care...keep Warm :) Cheers! Vamsi

Sunday, December 31, 2006

[PERSONAL] Lets solve the problem.....

"Lets solve the problem" , thats what I have been saying to myself for all these days. Well I have decided never to budge and just take the things the way they come..just bought my copies to the Art of Computer Programming. For me right now there are no shortcuts, no quickies I have to take the things the hardway or the toughway more specifically.
I guess I have become a little bit more matured now, because I have to do things more responsibly now. I have a big responsibility now, I don't worry about it but I welcome it into my life, I'am ready to solve it and all the consequences...I will never run-away from the problem. But I need to be a little bit more practical also, well for any problem now there is no way out except to solve it.
So...LETS SOLVE THE PROBLEM RATHER RUNNING AWAY FROM IT....
And when you are solving problem's you need to be very methodological...I know its all spelling mistakes my blog...I may not be a great genius but I'll try my part to solve the problem. And when I solve the problem there will be no shortcuts.
Frankly I have been not getting great results for my Dynamic Programming based Border Length Minimization Problem. What to do I don't know I cannot really fake up any results. It's bad really bad. I leave it
Today puppy came out, she has been not liking the place where she is living but she has to for sometime, she should feel free and I'am a very lucky guy interms of that. I will always care for puppy and will solve the problem and not run away from it.
Happy new year 2007.....LETS SOLVE IT....that's the quote of this year.
Take care guys and keep having fun.....mean while I will lay back and keep thinking....

Friday, December 08, 2006

[NON-TECH] Travelling to india....

I should be indeed thankful to sudha for a ride from Storrs to Stamford. When I reached Stamford it was a little difficult to find out where ravi is and finally found ravi, went to circuit city to buy some stuff, later toured manhattan,brooklyn went to a great Italian restaurant, I really liked the hot bread and that olive oil to eat the bread, I never tried any Italian food apart from the normal pizza. Its really windy today in New York with -7 Centigrade, really had a hard time pulling all my luggage into the airport.....well found a wireless connection at the food court here, IT WORKS...well I'am writing this from that connection only, I need to wait till 4:00 PM to take my flight. Its a long wait.

Good that I got some charge on my laptop so that I can do some work today, I have many things pending, mac,tim,ion and raj. I need to get all the work done in this break good if I could make a proper schedule to fix up all the things.

Lets see how things work......luv....Vamsi

Thursday, December 07, 2006

I have not started any packing

Its just 12 hours for my flight I have not packed any thing .....dont know how I will pack....I think in have insomnia I cannot sleep its killing me every day its 4:00 AM in the morning I have been trying to sleep for last 4 hours but failed miserably. God please gimme some sleep please....it would have been great if we could buy sleep :((

Sunday, November 26, 2006

[TECH] Algorithm to find euler circuit in a graph in O(|E|)

Important observation I found is that, if we delete a cycle (delete all the edges which form a cycle) from the graph which has a Euler circuit, the property of the graph still remains, i.e the necessary and sufficient condition for the graph to have a Euler cycle is that every vertex should have even degree. And also there has to be a cycle at every vertex.

INPUT: G =(E,V)
v = v
euler_cycle = NULL;
while(|E| > 0){
 /*Find a cycle in G, start
   the search at v, returns c0 around 
  which cycle is formed*/
 c0 = FIND_CYCLE(G,v);
 v = GET_NON_ZERO_DEGREE_VERTEX(c0); 
/*Above can be done in constant time,
 using some space while finding the cycle
 */
 MERGE(c0,euler_cyle);
/*constant time operation,
 put c0 after an edge e1 in
 euler cycle which ends at 
 vertex 'v', we can just remember 
 the position of v n euler_cycle
 every time we merge*/

}

[TECH] Building tags on the complete source code...

I see that sometimes

  $ctags -R *  
don't work. I just typed
$ctags -R *
in my cygwin it crashed
 ctags.exe.stackdum 
. Well now the question is how do I build the tags on the complete source recursively if
  -R 
don't work, we can use the the following to build the tags


$find . -name "*.c" -exec ctags -a \{\} \; -print; sort tags > tags1; mv tags1 tags;

The -a option appends to the existing tags file build

I initially thought that ctags keeps some seek information of the file in tags file,but just was amazed its a 3 column multientry text file, the first column is the tag which you are searching, second column is the file where is tag is and the most interesting part the 3 column is the search string for vim....hmmm see every one takes advantage of the plethora of things vim can do :)

Make_bp_profile ./RNAlib/ProfileDist.c  /^PUBLIC float *Make_bp_profile(int length)$/
Make_swString   ./RNAlib/stringdist.c   /^PUBLIC swString *Make_swString(char *string)$/

.........luv.......Vamsi

Saturday, November 25, 2006

[TECH] Never use a file stream for lookahead reading while using lex.....

Just got the parser working....I did a lot of modification to mac's code, especially the grammar rules which have the lookahead information while parsing. The code tries to read from the

yyin
file stream of lex, but that is really pathetic because lex code is now optimize and it position in the lex buffer may not correspond to the position in the filestream...well this is what is the bug in code, well it took a while to fix. But its a good one.

I added lookahead rules

(st,bt)\n[\+]{linenum++;}
(st,bt)\n[\*].*${linenum++;}
for lookahead extensions and comments in the spice syntax.

Tomorrow I'll get the layout printed ,,,,,,

Apart from this folks from india called and were telling me about the issues regarding priya pickles, well I think its really a slander against Ramoji Rao, any way I support this guy...yes may be after that great 3 day party at ramoji film city makes me baised, I guess you too will be baised once you receive that wonderful hospitality at hotel sitara in ramoji film city...when our team (verification group) went out there I saw mithun chakraborthy

..........luv..........Vamsi

Thursday, November 23, 2006

[TECH] SPICE layout generator.......

I have been a bit of slackish this week, but sure I want to start running soon.

Last night I read about the BPlane (Binned Plane datastructure used in micromagic, I need to implement that in magic soon).

Tonight, I thought about backing up my CVS repository regularly into my external hardrive, so that I can keep all my projects safe.

SPICE Layout generator

My new project, which generates cell layout from by reading from the SPICE files (transistor netlist) directly. I need to rewrite some of the code for the algorithm which tries to find the EULER trace in the transistors graph (and also its p-stack dual graph). Its exiting for me start it today....

I'am in love with my life for the first time.......writing code is what I loved apart from all other tensions in life I love it

Tomorrow morning I'll be running for the sale in circuit city and best buy

[TECH] SRM327

http://www.topcoder.com/stat?c=problem_statement&pm=6871&rd=10007

/*
 * topcoder_class1.java
 *
 * Created on November 22, 2006, 1:41 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package topcoder_srm1;

/**
 *
 * @author vamsi
 */
import java.lang.Math;

public class NiceOrUgly{


   
    private boolean checkNice(char[] s_arr,int len){

 int vcount=0;
 int ccount=0;
 int i;
 for(i=0;i

I challenged some guy in this SRM got 50 bonus points.

..........luv......vamsi

Monday, November 20, 2006

[TECH] DAG's and Dynamic Programming......

Directed Acyclic Graph (DAG), directly embeds into dynamic programming....as from Vazirani's notes, the useful property of the DAG is that its nodes can be linearized (topologically). So if we process these nodes in the topological order we have sub-problems solved and the solution can be used for the next level. In the simple example of shortest path, we need (u1,v) , (u2,v) are the edges adjacent on the node v. To solve the shortest path problem we need the shortest path to u1, u2 to get the shortest path to v. The wonderful property of the DAG's is that if we start with the topological SOURCE (may be hypothetical by adding 0 weight edges), we are sure that we solved u1,u2 before solving v (if we process the nodes in topological order)

Longest monotonic subsequence in a given sequence, suppose the given sequence is '5,2,8,6,3,6,9,7' (The longest monotonically increasing sequence) in this is 2,3,6,9. On the first look, it appears that it doesn't have sub-optimality inside it. In the sense take a subsequence '5,2,8' the longest monotonically increasing subsequence in this is is (5,8) or (2,8) but neither (5,8) and (2,8) is not in the overall longest monotonic subsequence, so the question is how dynamic programming works here??.....well people don't talk about the sub-optimality here......but still this can be solved by dynamic programming...
Let me restate the principle of optimality here...."If a optimization problem involves of sequences of decisions d1,d2,d3,d4...dn . The principle of suboptimality states that what ever decision you make initially the rest of the decisions should still optimize whats remaining after making decision d1...i.e would form a sequence of decisions to save a smaller optimization problem
Any way I wrote the following code segment , S[i] = length of the longest monotonic subseqence ending at index i, input is a array of integers A[i].

global_max_length=-INFINITY;
PATH[N];
for(i=0;i0;j--){
      if(A[j] < A[i]){
         if(S[j]+1 > S[i]){
             S[i] = S[j]+1;
             if(S[i] > global_max_length){
                 global_max_length = S[i];
                 PATH[N] = j;
             }
             PATH[i] = j;
         }
      }
   }
}

void printSeqence(){

 int j=N;
 do{
  print("%ld ",A[PATH[j]]);
  j = PATH[j];
 }while(j!=PATH[j])

}

global_max_length , returns the length of the longest monotonic increasing sequence, and also prints the sequence

Apart from this life has been very cold, man today was REALLY_ __FREEZING__ here, I have cold the damn cold, I cannot drink cool drinks, eat any cold stuff it sucks......Well , I'll be going to India soon meet swapna,chamu...just talked to chamu on the phone, hope to see her and swappy soon...............THE LIFE GOES ON ON ON...by the way the GYM is closed till 26th and its cold outside I cannot even jog its really HELL out here

With love ...............Vamsi...............

Tuesday, November 14, 2006

[TECH] Channel Router for cell synthesis......

Its quite an effort to get this thing working.....started on saturday night , worked on sunday, and monday night its done


perl had lot of kookups especially my $a,$b and my ($a,$b) are not the same, I pulled it from the manual. sometimes its really hard to fix this kind of errors, thanks for that wonderful debugger 'perl -d' , its really great to work with.

But I did'nt see if perl debugger has a backtrace kind of facility? just a gdb?


Life apart for my passion of the CGEN2MAGIC project, is quite slow need to study a lot about that Border Minimization Problem, also got the home work done on parallel algorithms and network flows.


I guess I'have started loving algorithms/problem solving...its really kewl


Take care....HAPPY CHILDRENS DAY.

Saturday, November 11, 2006

[TECH] Setting up VNC on LAN

Today I got my laptop dell-inspiron-640m, I have linux desktop running fedora connected to a wireless router which my friend uses, so totally we have 3 computers connected to the wireless router. Actually we have cloned the MAC address of my desktop onto the wireless router. Now I want to use my laptop and start working with vnc on my desktop. By default the port 5901 was firewalled, I had to setup the firewall to accept the tcp:5901. After which I had the probelems with the window manager, by default kde starts the twm& . So I edited the xstartup file to get the kde.


kwin & kdesktop & kicker &


You need all the three things to get the kde desktop up and running

Well thats all the infrastructure work, now I'am back to write the CHANNEL ROUTER for CGEN which I have not worked on for the last three days, due that motif-algorithm which I have been working on, last week I also had the polynomial algorithm for FINDING OUT ALL THE CUTS in the network flow graph.

Take care guys, I also had a long chat with swapna and that was really wonderful.

Monday, November 06, 2006

[TECH]Crippled mmap

I was trying to use a anonymous memory mapping to use in the first version of the Tile database memory manager which I was writing,

mmap(void *start_address,size_t length,int prot,int flags,int fd,off_t offset)

. I had prot = MAP_ANONYMOUS , (I thought its equivalent to MAP_ANON | MAP_PRIVATE , the man page says MAP_ANON , is depreciated). Well any way I got it fixed by MAP_ANONYMOUS | MAP_PRIVATE.


Last time I had problem with this syscall is when I need to mmap to actual address's , i.e the start_address argument is not NULL, once again WHEN YOU DO A MMAP FOR A STATIC ADDRESS YOU NEED TO HAVE OFFSET OF THE FILE ALIGNED TO THE PAGE BOUNDARY.

Friday, October 27, 2006

Fridays seems to coming very quickly.

I dont know why Fridays seems to be coming so quickly for me? I'am doing less work?.

Sunday, October 08, 2006

A melancholic 24th birthday....but I think I have started to think

Just added a year of life's experience, its really the coldest birthday I had ever had, it really feels lonely here. Nothing to smile about except the fall colors to cheer up missing all my loved ones back home, sometimes I feel I don't like it here(infact any where away from home)....
The other day I was returning back from the bus I broke within my heart, I knew I was a little more capable of getting into a better school, all my friends I have studied are now in better schools and me at UCONN making that hasty desicion to move from UCR....
I could certainly feel that I have a really hard luck, I don't know I think I have a nac for the SELF PITY for myself...first time in my life I feel I need to compromise, really I feel very low every day dont know why. May be I'am missing people very much, more than I could ever think of...mom told me to come back to india if I dont feel good here....you know at the same time I feel that by doing that I'am running away from the problem, ok now I'am in the problem a big complex problem the only way I can overcome this just by solving it....I say to myself I'AM TRANSFORMING TO MYSELF TO ATTAIN STRENGTH AND ENERGY TO SOLVE PROBLEMS....God please give me STRENGTH to face this problem. I know that I'am not a genius to come up with some idea to create a revolution but I'am trying sincerely...I don't do things to impress any one...
I don't feel any selfish any more the other day I was thinking about the change in me, I don't know I started feeling happiness in others happiness, sometimes I just did things that people are happy, although I don't expect anything from them.....
What ever it might be its really a rocky ride ahead of me....

Sunday, September 10, 2006

[TECH] Buffer insertion and signal integrity.

10-09-2006...if we add up all these its a perfect modulo of nine. Well today I started my research. Studied the classic "Buffer Insertion Algorithm" paper, its really great I the moment I read it I see the application of dynamic programming in it.
Well its a well studied problem after all this should have been done, but I'am loving it application of algorithms. The basic principles I need to stick to is honesty. I want to carry on like this feel good about it every day I sleep.....Well Its becoming a habit for me.
Delay modeling is a totally different research area, but the classic paper assumes a simple Elmore delay modeling...I guess I need to design a good algorithm which strikes a right balance on delay estimation and timing minimization.
Apart from that I wanted to see how much I can think backward. I tried to recall what I have done in my last few new years.
2006--> Partied in escape pub, hyderabad [I got a wildest dancer prize :)]
2005--> Freaked out on the roads boozing, my friend veeru with me he was annoyed a little that day :(
2004--> Well I was interning at Oracle this time, drank bacardi and made a mess, I guess I was frustrated that I was not having a grilfriend :))
2003--> Well I was with my parents in railclub. 2002--> I think I did nothing, but tasted beer for the first time...

Cheers! Vamsi

Saturday, September 02, 2006

Yes I cannot cheat myself......I never had...I'am proud that I was myself

Well I always had that guilty feeling in me every time I told everyone that I'am going to california and study. Every one thought that its some how great to belong to california, well pheadrus in me was I guess taking a break...started to enjoy the material pleasures and forgot about his journey which is the quest of quality. Yes indeed I wanted to cash on the name of UC .
Although I couldnt blame the professor for bringing me this far I need to blame myself. I know I want to do more fundamental things rather then jumping in something which I claimed to know, I told people that I had been working in a mixed signal simulation tool development. The word DEVELOPMENT here meant a different thing, I never really wrote anything core, what I was doing was just doing all system realted work to make the tool work. Well I guess I was somewhat doing well in what ever I had done. When I got admission at UCR with this background I started feeling guilty, I want to make up for it by looking into books on how fastspice was implemented, although I had a very high level of understanding on how fastspice worked I thought I could make it and decided to come to riverside. But when I talked to the professor I felt bad that he want to make use only programming skills which I had, he never expected me to design new algorithms, create new paradigms to revolutionize the research. Just at this moment I decided to leave this place RIVERSIDE. I CANNOT JUST DO SOMETHING JUST TO BELONG TO A UC AND BELONG TO CALIFORNIA AND TELL THAT PROUDLY FOR ALL THE PEOPLE OVER THAT WORLD...........I THOUGHT I'AM CHEATING MYSELF I CANNOT TAKE IT I DECIDED TO MOVE TO UCONN.
I know Dr.Raj was a great prof but people dont want me to go there when I said I got admit in a UC, well now I really dont give a damn shit on which university I belong I want to really learn the ART OF ALGORITHM DESIGN and apply in much more elegant manner with more CS pedagogy.....I FELT IF I COULD MASTER THE ART OF SOLVING PROBLEMS WITH A COMPUTER.....IT DOESNT KEEP MYSELF JUST TO CAD I CAN APPLY MY ALGORITHM DESIGN SKILLS TO ANY PROBLEM....I'AM EXCITED TO WORK UNDER DR.RAJ....
Well this is excatly what happens in pheadrus's book.......BUT I ADMIRE MY GUTS TO NOT TO CHEAT MYSELF EVEN TILL THE LAST MINUTE....ITS NEVER TO LATE TO GET IT BACK....,,,,,,NOW I NEED TO LIE SAYING SOMETHING TO THE OLD PROF AND MAKE SURE THE BRIDGES ARE NOT BURNT......

Tuesday, June 27, 2006

Problems for which "Principle of Optimality" does not hold??

For many optimization problems we take for granted that DP (Dynamic Programming works). But the first thing we need to check before we use the DP technique is the "Principle of Optimality".
o If the aim of a descision sequence(d1,d2,d3,d4........dn) is to minimize/maximize some objective function, then for any di , 1<=i<=n , the subsequence (di,di+1,....dn) should also minimize/maximize the objective function respectively.
o One problem for which the "Principle of Optimality" is when we have a KNAPSACK problem which both negative and postive profits, we might well ask ourself if a Item has negative profit then why we select that Item? well you might have forgotten the other factor which is the size of item...
I dont know of any other problems.

Tuesday, June 20, 2006

[NON-TECH] Marriage is buying conditional LOVE its for loosers, unconditional LOVE is what winners get.

Well, have seen several guys getting married these days in india. I don't know some how people in india always think thats the ultimate thing. I have heard many people definition of SETTLING in life is something like "I neeed to get a high paying job, have a house a car and a beautiful wife and have children".....
I just think its bullshit if you marry you get to loose the fire in you, I just don't beleive in SETTLING in life. I just believe that "ITS JUST A JOURNEY which goes on and on and on......." , I don't think there is a destination where you think you have reached the NIRVANA and just bullshit marry and have SEX.....
I live a life for myself, I just beleive I just want to be happy without causing others any trouble (ofcourse envy and jealous are some thing I cannot help).
Any way reiterating things my aim is just to create technology for real good, not for building research papers or making a huge sum of money. Feel technology as an art and contribute without any motive. Some time I see that people tend to use my high energy levels, thats what I tell myself "Don't take it damn seriously, when can people expolit something ? if something is in abundance (high energy here) people exploit it. If I crib about people who expolit I'll loose my abundance of energy, I want more people to exploit me so that indirectly they are helping me to create a lot of abundance of energy to create things...."
Well if I keep all things aside (all but technology), people's egoes, money, holidays etc... life just ROCKS for me I love it.

Friday, June 09, 2006

Yet another memory corruption on linuxipf, new FAT POINTERS on IA-64

Well its really gruesome last two days, was haunted by this problem in which my program on IA64 gets stuck just before the exit, I drilled down to _IO_flush_all @@ glibc which is not returning. After a elegant investigation found that a memcpy into a invalid address cooked up all this it basically created a cycle in FILE *ptr->_chain which is the reason why _IO_flush_all was not returning..
Well IA-64 had been a real good thing to work with, it has a real helpful kernel maintainers especially at ia64-linux@kernel.org, Well these guys gave me a lot of insight into several things RES backing store [60000fff80000000-60000fff80004000 rw-p 0000000000000000 00:00 0] this segment maps for every process on IA64 kernel.
Well other intresting thing is about the FAT POINTERS, the IA64 ABI mandates that the call to functions should be done via FAT POINTERS. do a google search if you want more details about this....
All in all a good productive week also fixed a couple of HSIM issues..
I really love it.

Wednesday, June 07, 2006

IA64 different virual memory layout

Hey just found that the IA64 is having a totally different mmap space and start of the text generally text start at 0x08048000 but here it starts at some 0x400000000000000. and also the mmap space is above &_etext in contrast to below &_end.

Thursday, June 01, 2006

How SIGINFO structure makes our life easy...

Well have been fixing code failing due to SIGFPE, The code was written to handle all signals like (SIGBUS,SIGFPE,SIGSEGV....). Well the culprit is SIGFPE which generally happen due to compiler optimization, the tricky thing is that I dont recevie SIGFPE when I run this through a debugger, it happens only when I run it normally.
Writing siginfo handlers will help you get the culprit virtual address which causes the problem. See the following handy code.
=======================================
struct sigaction action;
action.sa_sigaction = my_handler;
action.sa_flags = SA_RESTART | SA_SIGINFO | SA_RESETHAND;
if(sigaction(SIGBUS,&action,NULL)<0) {
printf("Cannot register handler\n");
}

HANDLER:
void my_handler(int sig,siginfo_t *siginfo,void *ucontext){
if(sig == SIGBUS){
printf("SIGBUS Caught\n");
switch(siginfo->si_code){
case BUS_ADRALN:
printf("SIGBUS due to address alignment at %x\n",siginfo->si_addr);
break;
case BUS_ADRERR:
printf("SIGBUS due to BUS_ADRERR%08lx\n",siginfo->si_addr);
break;
case BUS_OBJERR:
printf("SIGBUS due to hardware\n");
} q


Cheers! V.

Wednesday, May 31, 2006

Gives some solace.....

I have been thinking that I have reinvented the wheel, I had that guilty feeling when I did'nt use _etext , _edata , _end to figure out the begining and end of .data and .bss sections, which I rather got from the ELF sections. I had a feeling that I reinvented the wheel until I tested the code with _etext , _edata and _end they seem just SCREW....My method was and elite one I love it...I'am really happy. I love it. Now I realize how its a different feeling when you do things really right from your heart, other day after my workout (obviously with a lot of sweat, I generally jog for 33minutes cover 3 miles and burn 500 CAL) I was talking to arindam. I really liked what this guy said. He said "Workout spirit is something you need to get right from your heart just like a 100m sprinter......Theres just no showoff" WOW I liked what he said thats what I'am after in my life be it technology or art or just life.... KEWL V.

Sunday, May 28, 2006

ELF CORE file optimizations in Linux, problems with non standardization of core files.

Well, all these days life is revolving on BINARY RECONSTRUCTION from the corefiles(although this is only one of the ideas I have currently for BINARY RECONSTRUCTION).

o After my deep observation of the fact why core files have some program headers which have phdr.p_filesiz==0, found that David Miller, had added some changes to the core file which the linux kernel dumps, the optimizations are ofcourse to reduce the core file size, so I guess these guys are taking off the text part of the executable and the text part of the dyanmic shared libraries.

o My Question is WHY?? WHY?? do these people just dont try to stick to standards (if some standard dont exist they should create one, and once they enhance some stuff then update the standard rather than just flushing the changes into the code), in this opensource community this is really bad that the current standard of the core file depends on few induviduals.

I checked the PHDRS (readelf --segments) the following are the PHDRS of the core.exe
=================================
Elf file type is EXEC (Executable file)
Entry point 0x8048364
There are 11 program headers, starting at offset 52

Program Headers:
 Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
 NOTE           0x000194 0x00000000 0x00000000 0x00a48 0x00000     0
 **LOAD           0x001000 0x08048000 0x00000000 0x00000 0x01000 R E 0x1000

 LOAD           0x001000 0x08049000 0x00000000 0x01000 0x01000 RWE 0x1000
 LOAD           0x002000 0xf649b000 0x00000000 0x01000 0x01000 RWE 0x1000
 **LOAD           0x003000 0xf649c000 0x00000000 0x00000 0x132000 R E 0x1000
 LOAD           0x003000 0xf65ce000 0x00000000 0x03000 0x03000 RWE 0x1000
 LOAD           0x006000 0xf65d1000 0x00000000 0x03000 0x03000 RWE 0x1000
 LOAD           0x009000 0xf65e8000 0x00000000 0x01000 0x01000 RWE 0x1000
 **LOAD           0x00a000 0xf65e9000 0x00000000 0x00000 0x15000 R E 0x1000
 LOAD           0x00a000 0xf65fe000 0x00000000 0x01000 0x01000 RWE 0x1000
 LOAD           0x00b000 0xfeffe000 0x00000000 0x02000 0x02000 RWE 0x1000
===================================

o As I said earlier I see some of the PHDRS are having FileSiz as zero, the
first (1st **ed ) PHDR which is having virtual address 0x08048000
(this is obviously) the start of the text of the program, and its not
having any memory in the core file.

o The other PHDRS for which FileSiz is zero correspond to the
dynamic shared objects (.so) text , example in the above we see (2
**ed ) PHDR with VirtAddr as 0xf649c000 , so this means the text of
some shared .so has been mapped here.

o I had a question about the memory mapping with permissions r--s or
r--p (gconv used by glibc gets mapped like this some time) , so does
the core file contains this information of the memory mappings? IMO this content
is also mapped as PROGBITS I guess not sure.

o Is there a way I can findout the standard which the OS follows to
write the core file? No absolutely no, solaris dumps the entire core.

o Rather than depending on the OS core file, hows your opinion on
writing out all the mappings form /proc//maps as PT_LOAD into a
elf formatted file of type ET_EXEC, do you think this works? rather
than converting core file to exe?

Should I start working to write the standard.

=======================================================
#include
#include
#include
#include
#include

#ifndef __64_BIT__
#define __32_BIT__
#endif

#ifdef __32_BIT__
#define ELF_EHDR Elf32_Ehdr
#else
#define ELF_EHDR Elf64_Ehdr
#endif

ELF_EHDR place_holder;

/*Chages the elf_header in the file with ptr */
int ChangeElfHeader(int CoreFd, int WriteFd, unsigned long vaddr){

     unsigned long got_len=0;

     if((got_len = read(CoreFd,&place_holder,sizeof(ELF_EHDR)))
             != sizeof(ELF_EHDR)){
             perror("Unable to read the ELF Header::");
             exit(1);
     }
     /*Change the ET_CORE tto ET_EXEC*/
     if(place_holder.e_type == ET_CORE) {
             place_holder.e_type = ET_EXEC;
     } else {
             fprintf(stderr,"The file is not of ELF core file");
             exit(1);
     }

     /*Change the entry */

     place_holder.e_entry = vaddr;

     /*Write back the header*/
     got_len = 0;
     if (( got_len = write(WriteFd,&place_holder,sizeof(ELF_EHDR)))
             != sizeof(ELF_EHDR)) {
             perror("Unable to write the header::");
             exit(1);
     }
     return 1;
}

static void finishWriting(int coreFd, int writeFd) {

     unsigned char write_buffer[4*1024];
     int got_len = -1;

     while( (got_len = read(coreFd,write_buffer,4096)) != 0) {
             if(write(writeFd,write_buffer,got_len) != got_len ){
                     perror("Unable to to write the length which was read:");
                     exit(1);
             }
     }
     close(writeFd);
     close(coreFd);

}

int main(int argc,char* argv[]){

     int coreFd;
     int writeFd;
     unsigned long vaddr;

     if( argc < 3 ) {
             fprintf(stderr,"Usage core2elf core.file exe.file.name");
             exit(1);
     }
     if( (coreFd = open(argv[1],O_RDONLY)) < 0) {
             perror("Unable to open the core file:");
             exit(1);
     }
     if ((writeFd = open(argv[2],O_WRONLY| O_CREAT)) < 0) {
             perror("Unable to open the write file::");
             exit(1);
     }
     sscanf(argv[3],"%lx",&vaddr);
     ChangeElfHeader(coreFd,writeFd,vaddr);
     finishWriting(coreFd,writeFd);


}
====================================================

Sunday, May 07, 2006

My F1 student visa.....

Wow its been couple of weeks of unavoidable personal work I was busy with, although I got a full support I had to do all the formalities to get enough documentation that I'am not a potential immigrant. Well it costed me my valuable time and also money (Thats OK) but not time. The Visa officer was a nice lady she just saw my I-20 and my Transcripts and approved my visa... Well now I'am alleviated of this pain which is unavoidable for any student who is going to U.S. The only thing I have learned from all this excercise is JUST FINISH IT OFF, THERE IS NO WAY OUT. VAMSI.

Saturday, March 18, 2006

Life through ELF loaders.....

Hey its a long time I have been blogging...... yes its really a tough last two weeks. From last two weeks I have been trying to get a work around to the 'exec-shield' problem we were facing. I have got a lot of new ideas on implementing this. The following are some of the them pretty generic though
o My current problem boils down to create a executable from the running program itsself. To get this working I have been studying the kernels code in 'fs/binfmt_elf.c' especially code around 'load_elf_binary', The following are my finding might find it useful (for myself to look after some time).
-----1.)The kernels loader does not do any great , it basically gets all the metadata from the elf headers and just does the dirty work of just mapping and transferring the control. The summary of what excatly the kernel does is
a.) set the entry point from the (Elf32_Ehdr *).e_entry as the start jump to the program
b.) Load all the segments (PHDRS) the loader just deals with the program headers, it does not use any section headers. It loads all the segments with type (Elf32_Phdr *).type == PT_LOAD. If you do a 'readelf --segments a.out' you can see the segments


(gdb) shell readelf --segments a.out

Elf file type is EXEC (Executable file)
Entry point 0x80482a0
There are 7 program headers, starting at offset 52

Program Headers:
Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
INTERP         0x000114 0x08048114 0x08048114 0x00013 0x00013 R   0x1
    [Requesting program interpreter: /lib/ld-linux.so.2]
LOAD           0x000000 0x08048000 0x08048000 0x004cc 0x004cc R E 0x1000
LOAD           0x0004cc 0x080494cc 0x080494cc 0x00104 0x00198 RW  0x1000

DYNAMIC        0x0004dc 0x080494dc 0x080494dc 0x000c8 0x000c8 RW  0x4
NOTE           0x000128 0x08048128 0x08048128 0x00020 0x00020 R   0x4
STACK          0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
 00  
 01     .interp
02 .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
 03     .data .dynamic .ctors .dtors .jcr .got .bss
 04     .dynamic
 05     .note.ABI-tag
 06
(gdb) 


c.) One more important thing about how excatly it sets the 'brk' base I guess to set up the 'brk' base the kernel only (also see the copy of the email posted on linux-kernel mailing list
Hello All,

I have been working on an idea of creating an executable from a
running process image.

MOTIVATION:
Process migration among the nodes in distributed computing,
checkpointing process state.

BASIS:

The basis of my idea would be update the existing executable with
extra PHDRS (Program Headers) with type PT_LOAD and each of these
headers corresponding the vaddr mapping from /proc//maps.

I have done some basic study of kernels loders code in
'fs/binfmt_elf.c' especially code in 'load_elf_binary' function, the
following is my understanding.
-----------------------------

bss=0;
brk=0;
foreach (phdr in elf_header){

if(phdr->type == PT_LOAD){
if( phdr->filesize <>memsize){
/* Segment with .bss, so update brk and bss*/
}
else {
/* Just map it*/
}
}
/*Update brk bss*/
}
------------------------------------

from the above the kernel is updating brk, thus creating the start of
sbrk(0) only when it sees a PT_LOAD segment with filesize less than memsize. 
The kernel will set brk base i.e sbrk(0) to the value phdr.vaddr+phdr.memsize 
of the last PT_LOAD
segment its mapping? so do I need to reoder my PT_LOAD segments so
that the heap goes as the last PT_LOAD segment?

Is there any way we can tell the elf loader to force the vaddr for
sbrk(0) i.e brk base ?

Let me know your suggestion on this idea?

Really appreciate your valuable comments.

Sincerely,
Vamsi

[PS: I dont know if some one has already implemented this idea??]


-----2.) Also found out that the virtual address's for the sections in the segments are the excat virtual address if they are within the range of corresponding phdr. that is I found that if .bss section has a vaddr of 0x00001000 and .data has 0x00000010 and there is a corresponding mapping (rw-p) in /proc//maps as 0x00000004-0x00010000 which includes segment to section mapping in the order '.data ...... .bss' note that .data will not start at 0x00000004 it infact still starts at 0x00000010 same with .bss. This is very logical since if the kernel's loader changes the mapping of the .data section the all the code referencing the virtual address's has to be changes. So the segments in /proc//maps file are not the segments excatly corresponding to 'readelf --segments a.out' infact they are bigger carousels with wrap around the the excat segment address's for page alignment.
More ideas next time..........
Cheers
Vamsi

Wednesday, February 08, 2006

Presumption is a Programming Perversity..... [Discovery of new GUMPTION TRAP]

It was few weeks back in sunnyvale working on a night when I had ran out of my gumption and was almost burnt out , sitll wanted to write code to handle (In my sourcecov project) call to function pointers via 'call *%(ebp)' instruction on amd64, I ran into a problem and made a persumption on that sleepy night.......
I cannot imagine this presumption cost me 2 valuable weeks of time, which I wasted in meeting my bullshit girlfriend who has been bugging me all the way. Suddenly today after fight with her I went back (Filled with gumption) and got time to look at the code which I had left for 2 weeks with a presumption which I made that night when I saw that the debugger (gdb) itself crashed when I tried to something tricky on that sleepy night, I lost my gumption that night and presumed that its a very big problem, I was telling my self "Come on man there should be something really nasty in the code causing the debugger to crash............huh " this presumption made me very apprehensive to touch the code for two weeks :( , I have screwed the schedule with this just a crazy apprehension.
Rather than attacking the problem, I took a conventional root of comfort bought a TV to play on the XBOX with I bought it did'nt work researched on the voltage differences between india and U.S wasted my time and also wasted......Hey this reminds the the time when pheadrus took a break from answering the basic question of QUALITY, rather he went and married and forgot about QUALITY for sometime until he started thinking about it again and the mistake he made of the Presumption that QUALITY cannot be defined and took a comfort root of the question haunting him....later on he realized how big mistake it was left his wife and went on the journey of QUALITY again.
Yes even me also with this crazy prejudice lost my QUALITY track for a while.....But "Its never too late to get back..." (My Old Slang :)) ). Today I discovered a new "GUMPTION TRAP" ---> "PRESUMPTION and APPREHENSION" , probably we should have a course "GUMPTIONOLOGY101" in our school to know about all these traps rather than discovering them ourself. The problem was very silly when I got back into my QUALITY track its just that "I have been using old instructions and accessing/writing into a virtual address of the program in optimized mode when the instructions/code came from debug executable" (May be u should send me an email to explain the problem), but in a lucid manner its a very basic problem which I overlooked, its ok as long as I discover more gumption traps like this...........One thing is never presumption is bad and also evil....its a LOW QUALITY LIFE.
So today Its the 9th revision of the file just cvs commited and wanted to save my feeling to my harddisk before I forget about it......
Take care guys.....
Its always a journey no destination, you will get of QUALITY track when you say you have reached a destination
Reminds me of a quote from prisig "When you are filled with gumption there is no one stopping you from fixing the motorcycle"
Keep going guys make it a habit and enjoy it

Tuesday, November 29, 2005

Life of a hyderabadi....

"Akhir, Hyderabad ki zindagi kya he" .Whats all about hyderabadis ,and thier way of living.This mail explores certain ascpects of hyderabadi life style.I wish to seek some reviews basing on which I will post more.
A Hyderabadi on the road
It some time looks stranger than fiction when a Hyderabadi while driving on the road feels that he is the 'king of the road' and the traffic rules are meant (only )to be broken, so don't ever cross the path of a Hyderabadi when he is on the move. In case if you cross his path, he invariably tries to get into an argument as if 'raking up a fight is in the blood' of Hyderabadi.Even if he is wrong, as the proverb goes "barking dogs seldom bites "(Shara** style), he tries to get you by neck but the crowd around him stops him by holding his hands while he vainly tries to get his hand over you (a Hyderabadi seldom gets into fitscuffs )so don't worry you won't be beaten but you have to bear the choicest abuses in the Hyderabadi slang. The Potti Patana "Hyderabadi Ishtyle"
So far so good, the other aspect of a hyderabadi life style or rather estyle is "potti patana". It is the favorite pastime for some while for others it is a fulltime job. A Hyderabadi would try all the tricks in the book and outside the book to get hold of the woman of his dreams. With the girls of the generation next it is "potta patana hai". If people in rest of India were carried over by the movie "Hyderabad Blues" that it is taboo for guys and girls to be seen in public together,then they are going to have a culture shock if they come to Hyderabad.So don't believe those confused desh returned non-real Indian (NRIs).If you don't believe me have a dhekko on the Necklace Road -the scene would put to shame even the overly romantic French. Bindaas Batein
The bindaas attitude of Hyderabadis is personified in the numerous cafes of the city where in you get to see a whole lot of bindaas Hyderabadis sipping tea for hours together. One might wonder as to how these people have all the time in the world to indulge in such long sessions. There is so much of time available with folks over here that at times you have to literally ask them to go for want of peace.
Warning:
Beware of some nerds living around garden cafe ,Sec-Bad YMCA(Yocs and KC janta).They are extreamly intellectual and are always angry that swedish society has not awarded them nobel prizes for thier ideologies and symbolisms,trivias,Information oveload's.Make sure you drive around clock tower to avoid YMCA road , if your are a mere mortal .
"Abhi" never mean NOW...and Parson never mean day before yesterday.
eg "Parson ich apun world cup jeetenaa" Nakko is a famous word used forever! Lite lena mama! is ubiquitous
Irani cafe and Irani chai A typical scene in an Irani cafe The Steward shouts "Ye chotu ..Ek Chai La Rey" and gets it himself(!) to serve to his customers. We are talking of Irani Hotels where some people build their lives around it. They sit for hours and hours and chat with friends, families and even strangers. Irani hotels are an excellent franchise( but of course no royalty, no ownership and no rules). They can only run one way and that is successful way. Every one likes the "Chota Samosa" made out of Onions that are special to any Irani Hotel. Fine Biscuit, and the world famous Osmania biscuits were born from this concept called Irani Hotel.Some famous Iranis Cafes Blue sea, Garden,Niagra, Paradise,Madina,Sarvi.Always try to avoid cafes on lower tank bund road named as "Tea city " and "Tea Den ",For reasons follow above mentioned warning. Gold Flake Rs 3/(rate keeps fluctuating ,includes tip for the "Khadir")- and Irani Chai along with samosa and osmania biscuit make the day for many.
[Thanks to my friend sagar for sending this :))]

Script2Executable project....

Today....I'have been thinking about this very exiting project..."SCRIPT2EXECUTABLE". I have googled on the net and found that some specific projects were existing for perl, phyton, etc.... But in this unix would we have several interpreters like expect (which I'have been using lately), lisp, csh (shell interpreters)....
So now my ideal is to create a program which takes the interpreter name and the file (script) and create a compiled executable file, which can run standalone. There are several advantages of this program one thing is that this hepls the developers to hide the code of the scripts, what are the other advantages??....
To create this generic solution, I started thinking about this idea
STEP1:
o I'll create a dummy executable file compiled, with a placeholder for the script as follows
#include
static char buffer_space_for_script[MAX_SCRIPT_FILE_SIZE]="#Cheating perl hahaha...";
/*Driver program to launch the script, similar to piping except the program reads from static buffer and writes into the pipe.*/
int main(){
int fd[2], pid;
/*create a pipe all finer details avoided*/
pipe(fd);
dup2(1,fd[1]);
pid = fork()
........
if(pid==0){
dup2(0,fd[0]);
exec(perl/other interpreter);
.....
}
else{
write(1,buffer_space_for_script,MAX_SCRIPT_SIZE); /*write into stdout will be read by interpreter in the child*/
}

Now I wanted to compile this program and use 'hexdump -c a.out" find the seek location(byte in the physical file of the buffer_space_for_script and write the contents of the script file into the file a.out)....
I almost coded it but suddently realized that the major objective of this has been breached since hexdump -c will read out the ascii, thus a intelligent user can read the script using hexdump, even though we have created a compiled executable from the script.....
:(

Monday, November 07, 2005

Algorithm to build DFA's to test divisibility

I found this following algorithm very useful in designing DFA's (especially making DFA's to test the multipules, divisibility etc.....). This logic can help slove may DFA problems lets start with an example and generalize this after that..
Problem: Create a DFA to test the divisibility of a binary string by 3. (Assume the string can be scanned from left to right....ex 11 , 110 )
During the scan of the binary string the current state (Value of the binary string scanned till now) can be in one of the following states
1. 3K 2. 3K+1 3. 3K+2
So if the current state of the DFA is 3K+1 and we scan a '0' the value becomes 2*(3K+1) == 3k+2. If we scan a '1' it becomes 2*(3K+1)+1 == 3K. Similarly if we scan '0' in state '3k+2' it becomes 2*(3k+2) == 6k+4 == 3k+1. So now we have 3 states and move according to the following table.
CURRENT STATE SCAN_LITERAL NEXT_STATE
3k (final state) 1 3k+1
3k (final state) 0 3k
3k+1 1 3k
3k+1 0 3k+2
3k+2 1 3k+2
3k+2 0 3k+1
We can now extened this for the divisibility test for any 'k' that requires a D.F.A of kstates (can we minimize?). With this we can solve problems like the following.
Problem: Design a DFA for the set of string in {0,1,2}* that are ternary(base 3) representations, leading zeros permitted, of numbers that are not multiples of four.
Thought that this would be a useful piece of information.......Cheers Vamsi.

Sunday, September 18, 2005

Small observation in our life

A small truth to make our Life 100% successful.......... If A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Is equal to 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Then H+A+R+D+W+O+R+K = 8+1+18+4+23+15+18+11 = 98% K+N+O+W+L+E+D+G+E = 11+14+15+23+12+5+4+7+5 = 96% L+O+V+E=12+15+22+5=54% L+U+C+K = 12+21+3+11 = 47% (None of them makes 100%) ............................... Then what makes 100% Is it Money? ..... No!!!!! Leadership? ...... NO!!!! Every problem has a solution, only if we perhaps change our "ATTITUDE". It is OUR ATTITUDE towards Life and Work that makes OUR Life 100% Successful.. A+T+T+I+T+U+D+E = 1+20+20+9+20+21+4+5 = 100

Sunday, September 11, 2005

klists an ideal way for building asynchronous applications.......

Hi doood's, Long time blogging.....its high time now "I'am back to hack". Was following a lot of lkml threads these days to garner some intriguing suff. Just found 'KLISTS', these datastructures are highly consistent across the asynchronous processing within the kernel (basically from interrupts from the devices as well as software interrupts).
Ok let me put this in much lucid terms... 1. I have some data to be shared across process's (not threads). 2. This shared data is accessed asynchronously. We get this type of context typically in telecom applications ( I recall from my experience from moto****). They have a unix based system, with several process's running each communicating with each other.
Ok talked a lot about the problem so whats a unix way of solving it. BTW way the data should be consistent and pocess the ACID (Atomic .....dont remember :-p) behaviour i.e a typical transcational behavior, basically the solution should'nt be error prone to race conditions occuring due to asynchronous behaviour within the process's. So how do you architect this kind of applications?
Ok let me give you some really shoddy professional solution which MOTOSHIT has sold to _NEXTEL_ (being soooo dump bought it from moto***a). 1. Moto***a had a real dumb soultion, to make sure that the data is consistent across the process's they seem to use a DATABASE :)).... 2. I have seen code which tries to access a shared variable as a row in the database table. 3. They just dumbly put every shared suff in the database...to make sure that the data is having ACID properties during the modification of the data by these asynchronous process's. 4. And more ludicrously they buy a database from a shoddy database vendor informix....and just heard that they are lobbying for support form IBM for this outdated product. really amazed by the quality (the romantic quality form zen and art of motorcycle maintenance :-p) of the approach to this problem. After knowing about klists I just felt that kernel which also has asychronous stuff inside does it in a much smarter way using KLIST. (KLIST is worth a reading please use the link above).

Monday, August 22, 2005

Solving serious problems....

I was just reading about an article about 10 best innovators in computer science. Infoworld magazine names 6 people from solaris 10 development team as best innovators. You should emphatically read the blogs of each of these sun engineers....So coming towards problems its a really hard problem to find serious and effective problems especially in computer science. Most of the research work is essentially a cliche. Frankly speaking I always do something to get a research publication, may be I feel gingerly that I dont have enough research publications compared to my friends.
Surely this kind of attitude will not help serious problems. But I have that innate feeling that I'am not doing any challenging and substantial stuff at work, so during the last few months I adopted an attitude shift in my thought "rather than complaining about the dark try to light a candle", I took all the pain to refactor every thing except the inane attitude of the superiors around, but they seem to have an attitude similar to some examples in my last post.
I quickly realised that they were just using me to their own glorification. Surely my managers are not my ideals but try to force that thought on people that they are great role models, I just keep mum. I really feel that they could really drive innovation and conceive innovative things, rather than drinking that materialistic vine.
Maan I just feel that I should do something different.

Friday, August 19, 2005

The power of intention.

Just finished studying the book "The power of intention", really felt very inspired after reading this. Some of the authors statements had striking effect on me, statements like "Don't die with the music still left in you!!". Seemed to me a very good way to do my self talk. Other highlights in the book which was equally striking was the authors description about the ego. The author gives the following example of how people are really blinded by this ego.
1. A tiny and thin beam of sunlight suddenly thought that is was the sun...
2. A mild ripple in the middle of the ocean suddenly beleives that its the ocean...
Yes its really true on how ego can really doom a person. If you are reading this just dont be egoistic ever in your life, just relax and think about it again.

Thursday, July 28, 2005

Why this vacuous discernment between senior and junior?

I still remember Dr.PJN telling during my college days...."To test a person's real character, give him immense power". Its long time I'have been blogging just wanted to write about some topcoder dynamic programming problems in this post (I had drafted it may be I'll post in my next post).
All my mood is off when I see this guy walking ostentatiously all around, with a sneer unfurling those perverse insinuations, to motrify me. I guess his vanity has reached a zenith. All this is because of the discrimination the management shows between experienced and people with little experience. They just seems to despise our ideas with a prejudice that only experienced people only can make successful things and get things working, the management seems tout excessively that they will give weight to everyones views.
Its just because they think they are really privileged , they demand obligation....I really feel these are not the ideal people, no one is a junk. I'am not writing this out of jealously that they are getting paid more and are accessible to more stuff, these are words right out of a morbid mind twarthed by such inane seniors guys working along....I just learned one thing out of it although its a hard way to learn, I will never show that attitude when I become experienced. In fact I will never become a manager, its really a job with massive sagacity not to create any internal humilation among the people working under the manager.....I strongly feel that there should'nt be any discrimination among people interms of experience.

Thursday, June 30, 2005

Verminous ego stench .........

I don't know why we(including me......) inanely always do things anticipating something, yes every one anticipates for good things to happen for their course of action. But in some cases this anticipation is different , sometimes you try to flaunt in doing things as if some one watching and you actions are mended in such a way to impress people around you. Every time you write a mail , talk to people or do some thing you want to impress people around you. But I feel that you should do things naturally but not to impress any one....the root cause of all this is ego of people . I too was a victim of it but I think I have realised some thing about it and these day I listen to people and value what they say............its ok if you are a wise man and can take great decisions but you should'nt make others feel low or jeer at people at sloppiness, but every one can slowly get things accomplished and I feel that touting may not always converge to a right solution.............and sooner or the later every one will realise this.
BTW the book I'am studying this week is "If tomorrow comes" , really a good one by sheldon makes us feel how a sapped, anguish and vindictive mind with a sedative torso feels. It was a story of a dejected lover tracy withney who tries to endure with a slender hope to seek vengeance.
TGIT (Thank God Its Thursday)
V@msi

Sunday, June 26, 2005

Fervent gaming hermit....

Hmm.....finally I have moved into this reclusive world of FPS games, had spent around 90% of this weekend time quaking.....just fragged sarge 20 - 7 in a nightmare, in a map with no railguns only rocket launchers, plasma guns and shot guns (machine guns ofcourse :)) . I like this rocket launcher (although I was succumb to the rockets launched without a lot of span between walls and myself)...I almost fragged very accurately with this rocket launcher. My dodging skills are improving with every game, I felt the best way to dodge is to hold all the three keys 'w' ,'a' and 'd' which will make you move forward and press 'space' during aim and leave the keys 'a' and 'w' while shooting, this seems to be a very useful tactic of dodging, surely you can frag a human with this dodging, there are some really good players here like 'KeYmaker' and 'Devil' they fragged me couple of times. Its really great fun when you have a bunch of bacchanalian quake freaks at work places, good that I also I have 'Geforce Go' on a LCD which makes gaming more exotic.

Tuesday, June 21, 2005

Don't be afraid of making mistakes.......

Yep....I was depressed last week. But I'am starting a new life now, honestly I'am concentraring on my guitar in all my solitude they(guitar skills) seem to be improving, I feel good finally I learned to play "happy birthday......" for that special occassion next month. All this inspiration came from watching "Million dollar baby" again.......Mr.Scrape's words to danger seem to show me some light...."Any one can loose one fight....." , "Sometimes to deliver a good punch is to step back...." . And also thanks to call from karun, karun called me from canada and reminded me about st.laurel street in montreal, and about the good times we had, I really felt excited to receive his call (he will be in india soon). Sometimes this kind of suprise calls make you feel happy, and you feel something new....one more thing is I started playing cricket, people are really happy about my batting....seem's like I have'nt ever thought about my cricketing skills after a long break from club cricket during highschool...during those days I used to spend many hours to get my timing right, but was not quite getting it....but today after a long break and zero practice I'am batting like I'am in a great touch......some times when you try to work too hard on anything you don't seem to get it right (probably I'am too afraid of making mistakes during those old cricket days to get selected into the team), but when you have removed that thing of being afraid of making mistakes (because right now I dont care wether I'am in the corporate team or not) you seem to do things naturally and you get it right.......may be its a pathological example on how one should remove fear of screwing up something......... \/ /-\ /\/\ _\"" |

Tuesday, June 07, 2005

Transmeta lessons.......

Really feel sorry about this high technology microprocessor designer. But I really appreciate their nerve to compute against titans like INTEL and AMD. I feel that monopoly is bad and it reduces innovation and checks conceiving new products. Transmeta's low-power combat against is definitely a dud, I feel that transmeta should have invested more in research to overcome the 'underpower citics' rather then demonstrating a mere obeisance, may be transmeta management failed to notice the infliction points the company has being going through, intel on the other hand have been leveraing on grove's pedagogy(Only the Paranoids survive) of identifying these infliction points and thus bashed transmeta. Intel was the first one today to get a dual-core chip out, amd followed later, but I don't why transmeta never thought about dual-cores. This indicates Intel's astute ability to pick up infliction points, but transmeta I feel should conceive something really creative to get back and start running.

I feel it as a small practical reminder about how one should always keep track of the infliction points, at any instance there are millions and millions of people competing with you and a slight negligence might create a infliction point with negative slope............ Think big to conceive a marvel.

Monday, May 23, 2005

Podcasting with itunes...

Ohh...that sounds 'leet right. Yes indeed it is. Thankgod no need of any external podcatchers, since every thing would be integrated in itunes itself. You just need to sync up your ipod by just connecting and you get all your favourite radio shows.
BTW the following are radiostations I'have been listening all my downtime
http://feeds.feedburner.com/ITConversations-EverythingMP3
http://www.hackermedia.net/wp-rss2.php
http://www.binrev.com/radio/podcast/
http://daily-horoscope.libsyn.com/rss/

Sunday, May 15, 2005

Its podcasting revolution.....

Hey guys.....wondering whats new in scintillating world of gizmo's? make a guess no its not "Ipod U2" or "Ipod Shuffle" It's not a gadget but something related to them yes its Podcasting!!. Podcasting is real fun, so what excatly is this podcasting? . hmmm..... I guess most of you have already been using RSS feeds (adding them to firefox livefeed toolbar) :-? , podcasting is akin to RSS syndication, actually normal RSS feeds get you only the text content from where ever you have subscribed the feed, now just imagine a feed which will play audio when ever you select it, rather than reading the feed you are now listening to the feed, sounds great!! right? this is excatly what is podcasting. In a little geeky terms podcasting is similar to tunnelling (protocol tunnelling) where you add (embedd) 'protocol2' in the carrier 'protocol1' as a payload, so the multimedia content is being added as the payload in RSS (Really simple syndication protocol) 2.0 protocol for syndicating audio content from the publisher. So lets come to the bottomline "how can I get podcasting work". 1. Get a podcatcher I use doppler. 2. Configure podcatcher to integrate with mediaplayer or itunes, I use itunes and every live audio feed you add to the doppler makes it a playlist. 3. Sync up the playlist to your Ipod or any other MP3 player. 4. Enjoy podcasting (Podcasting is fun!) You can also setup podcasting and make your blog audioblog. So get started with the pocasting revolution.....keep checking for my upcoming podcast. Cheers! Vamsi

Monday, May 09, 2005

Love you momma!!


mom, originally uploaded by vamsi.

Hmmm......have been thinking about too many things these days, finally I got some time to write about momma.

I just shut my mind up for few minutes and start thinking about momma feeling a little nostalgic. Momma made me realise that "success is going from failure to failure with out loss of enthusiasm", without her motivation, I would'nt have accomplished any thing till now. In fact every day is a mothers day for me.......I love you momma!!!

Wishing all of you a happy mothers day

Friday, April 29, 2005

Solace for the weekend.....

Feel's like I had found an oasis in scorching heat.....just heard from JMMA (Journal for Mathematical Modelling and Algorithms) www.kluweronline.com/issn/1570-1166 . That they have accepted a work which I had done at the school related to polygon enclosure algorithms titled "Optimal algorithms for some polygon enclosure problems for VLSI Physical Design". No Idea in which month they will publish it but just finished off a final LaTeX version of it. I remember I submitted this around Nov-2003 and they had screened it now really loooong time right? (Ref No:100335). I almost forgot about this submission was having no hopes on this but suddently it comes back at right time helping my confidence. Really speaking after school I did'nt do much research. But I always use to tell my friends that I'am still working on that "external memory algorithms project" but could really never finish it off. May I got really complacent these days....but "Its never tooo late to get it back!!!"

Tuesday, April 26, 2005

Corporate victimization of enthusiasm.......

I guess you should have been hearing things like "Employee centered company" , "Employee * company". This is just to exploit the energy of the young kids in the company get the work done at a very cheap price. Ultimately bussiness is just making money yes thats true. But the way the current corporate culture is evolving these days in india especially of the outsource buzz word is really pathetic. The managers who take the initiative of settting up shops in india for corporates tend to be extremely selfish...selfish and selfish, this is not silicon valley attitude of "Win...Win" in the managers. Yes I'am currently a victim of this and I really had a feel of this selfishness, I dont know any where else but atleast in indian corporates (MNC's) this is what every one crib about...I felt really demotivated about these vices in the corporate culture of india. I feel that there is no use of doing things proactively taking up responsibilty and showing an effective commitment towards in getting things done ultimately. I have learnt a lesson that you should just do what ever is enough and nothing more. Live your life do what you think is good and what you think is right. Dont become an work addict at the corporate there are better places where you can prove your self and prove not just to the corporate to the complete world, write opensource software make opensource software run efficiently fix bugs in them do research and what not you can do any thing what ever you like.... So the bottom line is "Never count on anyone except your self!"

Tuesday, April 19, 2005

IPOD Mini on the go......


28-03-05_0844, originally uploaded by vamsi.

Recently bought an IPOD mini for just
$199 . I felt this to be really great no hassles of batteries, no hassles of space (4GB). I really feel like throwing my samsung YEPP-90S (64 MB) mp3 player.


The great thing about IPOD's is their integration with audible ( click here). I could really play all my audiobooks in audible format without converting them into mp3's. Yes now I turned out into an audible freak listening tons of audio books in my down time.....guys wondering why I have photo of mine rather than an IPOD mini here??......keep guessing

Monday, March 14, 2005

Turned into a RSS Freak

I found this to be really intresting it saves my time by not visiting the websities for news and other tech stuff and most wonderful part of it is the integration with Firefox, yes I'am talking about teh Live Bookmarks a great feature in firefox which integrates a RSS Feed reader in firefox....Suddenly I realized that I wanted RSS feed for every thing I even wrote to timesofindia to provide a rss feed on their site..yes I have become an RSS freak now my firefox toolbar is filled with 18 RSS Feeds right from BBC News, Devx Tech updates, CNET News.com, Wired ..........to ESR's blog.
:-p Vamsi

Tuesday, February 22, 2005

There is no AI only RI (Real Intelligence)


On Intelligence
Originally uploaded by vamsi.
I have been studying "On Intelligence" these days I could'nt stop myself reading. I really liked the way Jeff tried to put this new Memory prediction framework. Wondering if this guy has any thing to do with stefen hawking? NOWAY.


Jeff Hawkins, the man who created the PalmPilot, Treo smart phone, and other handheld devices, has reshaped our relationship to computers. Now he stands ready to revolutionize both neuroscience and computing in one stroke, with a new understanding of intelligence itself.
Hawkins develops a powerful theory of how the human brain works, explaining why computers are not intelligent and how, based on this new theory, we can finally build intelligent machines.

The brain is not a computer, but a memory system that stores experiences in a way that reflects the true structure of the world, remembering sequences of events and their nested relationships and making predictions based on those memories. It is this memory-prediction system that forms the basis of intelligence, perception, creativity, and even consciousness.

Monday, February 21, 2005

The Aviator........


Hughes
Originally uploaded by vamsi.
"I am by nature a perfectionist, and I seem to have trouble allowing anything to go through in a half-perfect condition. So if I made any mistake it was in working too hard and in doing too much of it with my own hands."
-- Howard Hughes describing his way of working and the mistakes made in building the "Spruce Goose."

Monday, January 31, 2005

How to avoid BROKEN PIPE errors in code (SIGPIPE)

Recently I had to struggle a lot to fix a issue generating BROKEN PIPE on a AMD64 platform, this code works on EMT64 and other 32-bit platforms but fails on AMD64. The bottom line is be really careful when you do use a fflush.
void *stream = (FILE *)......;
............
............
//To make sure the data is written to disk (HA)
if(!fflush((FILE *)stream)){
   printf("Flush failed due to %d error refer error.h\n",errno);
}
//This is really very dangerous code if you dont have a signal handler
//written for SIGPIPE (either you write a sig handler for SIGPIPE) or
//use the following code//

/*Safe Code*/
if(!fsync(fileno((FILE *)stream)))){
  printf("Sync failed due to %d error refer error.h\n",errno);
}
I found the standards guide on context of libc functions really useful
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_05.html
Hope you will not go through the same pain....
Vamsi

Monday, January 17, 2005

Symbol referencing errors for static variable in C++

Are you stuck with static symbol referencing errors in ur code??
What could be wrong in the following definition of a c++ class to find out how many instances of MyClass are created??
class MyClass{
 private:
   static int __instance_count;
 public:
    MyClass(){
         __instance_count++;
    }
    int getInstances(){
      return __instance_count;
    }
};
main(){
....
}
When complied with g++ says that __instance_count is not defined...this can be resolved by defining __instance_count outside the class definition,as follows.
int MyClass::__instance_count;
Why do we need this seperate definiton of static variables?

Saturday, January 01, 2005

04 to 05 with a 4-5 puzzle....


01-01-05_1857
Originally uploaded by vamsi.
I have seen people circulating this 04 to 05 puzzle to check how difficult 2005 will be compared to 2004. It's crazy but timepass. Get the square
here cut it into 5 pieces and solve it.....finally keep track of how much time you took to solve this and this will be proportional to the hard times you will have to face in 2005....how about people who solved this already :)) not problems at all in 2005??