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.