Sunday, September 30, 2007

Best Online Book Ever

Dive Into Python: www.diveintopython.org


Best Chapter: Performance Tuning

However, this chapter is not really about how to improve performance. It does tell few things related to a simple program, but if someone is really worried about performance, this chapter is a misnomer.

I liked this chapter, because it pervasivly depicts the idea of avoiding performance tuning while development. While it is a known advise, "first working code, then performance"; this chapter can teach the software development in a very interactive way, the same lesson.

On a footnote, this is very well written online book. The layout of book ideally matches an online experience. I read this book back to back in 10 days. I wish there were more chapters I could read (a feeling I used to get, when I used to finish reading comics book as a kid and wished the comic was longer).

Anyway, if you want to explore a different language and python is your choice, Please, do start with this book.

Monday, September 10, 2007

Operator Parsing: Nice Hack

#include 
#include
int main(int argc, char *argv[]){
int i;

printf("((((");
for(i=1;i!=argc;i++){
if( strcmp(argv[i], "^")==0) printf(")^(");
else if(strcmp(argv[i], "*")==0) printf("))*((");
else if(strcmp(argv[i], "/")==0) printf("))/((");
else if(strcmp(argv[i], "+")==0) printf(")))+(((");
else if(strcmp(argv[i], "-")==0) printf(")))-(((");
else printf("%s", argv[i]);
}
printf("))))\n");
return 0;
}