Wednesday, April 20, 2011

A Note On Practice And Persistence

While you are studying programming, I’m studying how to play guitar. I practice it every day for at least 2 hours a day. I play scales, chords, and arpeggios for an hour at least and then learn music theory, ear training, songs and anything else I can. Some days I study guitar and music for 8 hours because I feel like it and it’s fun. To me repetitive practice is natural and just how to learn something. I know that to get good at anything you have to practice every day, even if I suck that day (which is often) or it’s difficult. Keep trying and eventually it’ll be easier and fun.
As you study this book, and continue with programming, remember that anything worth doing is difficult at first. Maybe you are the kind of person who is afraid of failure so you give up at the first sign of difficulty. Maybe you never learned self-discipline so you can’t do anything that’s “boring”. Maybe you were told that you are “gifted” so you never attempt anything that might make you seem stupid or not a prodigy. Maybe you are competitive and unfairly compare yourself to someone like me who’s been programming for 20+ years.
Whatever your reason for wanting to quit, keep at it. Force yourself. If you run into an Extra Credit you can’t do, or a lesson you just do not understand, then skip it and come back to it later. Just keep going because with programming there’s this very odd thing that happens.
At first, you will not understand anything. It’ll be weird, just like with learning any human language. You will struggle with words, and not know what symbols are what, and it’ll all be very confusing. Then one day BANG your brain will snap and you will suddenly “get it”. If you keep doing the exercises and keep trying to understand them, you will get it. You might not be a master coder, but you will at least understand how programming works.
If you give up, you won’t ever reach this point. You will hit the first confusing thing (which is everything at first) and then stop. If you keep trying, keep typing it in, trying to understand it and reading about it, you will eventually get it.
But, if you go through this whole book, and you still do not understand how to code, at least you gave it a shot. You can say you tried your best and a little more and it didn’t work out, but at least you tried. You can be proud of that.

By Zed A. Shaw from his book "Learning Python The Hard Way"

Wednesday, May 05, 2010

fork() bomb

Coding can never become more interesting than this !!!
-------------------------------------------------------

Understanding :(){ :|:& };: fork() bomb code

 :() - It is a function name. It accepts no arguments at all.

Generally, bash function is defined as follows:
foo(){
 arg1=$1
 echo ''
 #do_something on $arg argument
}

fork() bomb is defined as follows:
:(){
   :|:&
};:

:|: - Next it call itself using programming technique called recursion and pipes the output to another call of the function ':'. The worst part is function get called two times to bomb your system.

& - Puts the function call in the background so child cannot die at all and start eating system resources.

; - Terminate the function definition

: - Call (run) the function aka set the fork() bomb.

Here is more human readable code:

bomb() {
bomb | bomb &
}; bomb

Properly configured Linux / UNIX box should not go down when fork() bomb sets off.

REFERENCE : http://www.cyberciti.biz/faq/understanding-bash-fork-bomb/
WIKI : http://en.wikipedia.org/wiki/Fork_bomb

Monday, July 28, 2008

WHAT IFs

1. What if I can use any webpage as my personal notebook ? It simply means a notebook made of
webpages. Index them, browse them, edit them, print them, share them. Even an eraser to erase those filthy ads on your personal selected page.

2. Eliminate mouse usage on webpages. Think if your mouse suddenly stopped working when you are in the middle of net surfing ! What would you do ? All on the web is links, and zillions of links. How would you access them if your lovely mouse isn't there. Dude..... the key combinations ALT + DIGITS (Numbers 1, 2. ... N) have never been used. You press ALT, all the links on the webpage will be parsed and assigned a unique number. You hit the number(digits) and your link is clicked !

3. Entertainment business. It attracts a lot of money.

Sunday, December 09, 2007

JOB WELL DONE !

Dec 9 2007 is the date when I am not working on my project! It's been couple of days ! The University deadline was Dec 7 2007 and somehow I made it ... no no no... WE MADE IT TOGETHER. (Thanks buddy, like every time you came to rescue me and made me through) "If He will get you to it then He will get you through it". I am always on the verge of giving up and somehow you put me back.

It wasn't somehow though. I remember the time when I was there. I can feel it from that hunger, that aching back, those sleepless nights and the crashing drowsiness, the confusion, the stress, the race to beat the deadline, hours of constant stare on the computer screen, repetitive efforts to attain something with perfection and all amidst millions of distractions. It may not be the best thing in the world but somehow it was the best thing for me. I remember coming out of the graduate studies office after submitting my project report. That feeling, that momentary happiness, that smile on my face coming out from deep within the heart(!). Nobody was watching me. Nobody was there to greet me. I just stretched my hand to Thank You and you greeted me well. In the best possible way anyone ever could.

These words are written to flatter you with the desire of having this time again and again. But all I can say is YOU KNOW THE BEST. I tried and I failed but what I received in the end was and will ever be a precious gift. I will make an effort not to stop this journey here. I still have a long way to go and I want to tell you I will try to do my best. You know that I includes 'YOU' too ! THANK YOU... THANK YOU.

And yea, some things left are fine tuning the code, testing the working of Telnet, SSH and SMTP Protocols, and understanding Linux Network Stack.