Wednesday, December 19, 2007

Want to See My Friend Stalin ....

I'm getting addicted to Kolangal(Sun TV Serial). It is mainly because of Stalin.

Yes.... He is coming there, I could see his Big Fat, Black, Half-Clown face in it. He is coming as Tholar Balakrishnan. He talks in pure Tamil and talks a lot abt Classical Tamil, Social Worker.

Anybody who has seen Stalin will agree with me. Now, Stalin will be in some remote corner of U.S.A. hacking into his computer. Not aware of whom I'm comparing him with.

Monday, December 17, 2007

The Three Ants

Three ants met on the nose of a man who was asleep in the sun. And after they had saluted one another, each according to the custom of his tribe, they stood there conversing.

The first ant said, "These hills and plains are the most barren I have known. I have searched all day for a grain of some sort, and there is none to be found."

Said the second ant, "I too have found nothing, though I have visited every nook and glade. This is, I believe, what my people call the soft, moving land where nothing grows."

Then the third ant raised his head and said, "My friends, we are standing now on the nose of the Supreme Ant, the mighty and infinite Ant, whose body is so great that we cannot see it, whose shadow is so vast that we cannot trace it, whose voice is so loud that we cannot hear it; and He is omnipresent."

When the third ant spoke thus the other ants looked at each other and laughed.

At that moment the man moved and in his sleep raised his hand and scratched his nose, and the three ants were crushed.

The Two Learned Men

Last Week I got a Omnibus of Khalil Gibran, at a random read I got this.

The Two Learned Men
==================

Once there lived in the ancient city of Afkar two learned men who hated and belittled each other's learning. For one of them denied the existence of the gods and the other was a believer.

One day the two met in the marketplace, and amidst their followers they began to dispute and to argue about the existence or the non-existence of the gods. And after hours of contention they parted.

That evening the unbeliever went to the temple and prostrated himself before the altar and prayed the gods to forgive his wayward past.

And the same hour the other learned man, he who had upheld the gods, burned his sacred books. For he had become an unbeliever.

Thursday, December 13, 2007

Programming Books with Category

From the Bottom Up

This list is in the best reading order I could find. It’s not necessarily easiest to
hardest, but based on subject matter.

• Programming from the Ground Up by Jonathan Bartlett
• Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest
• The Art of Computer Programming by Donald Knuth (3 volume set - volume 1 is the most important)
• Programming Languages by Samuel N. Kamin
• Modern Operating Systems by Andrew Tanenbaum
• Linkers and Loaders by John Levine
• Computer Organization and Design: The Hardware/Software Interface by David Patterson and John Hennessy

From the Top Down

These books are arranged from the simplest to the hardest. However, they can be
read in any order you feel comfortable with.

• How to Design Programs by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shiram Krishnamurthi, available online at http://www.htdp.org/
• Simply Scheme: An Introduction to Computer Science by Brian Harvey and Matthew Wright
• How to Think Like a Computer Scientist: Learning with Python by Allen
Downey, Jeff Elkner, and Chris Meyers, available online at http://www.greenteapress.com/thinkpython/
• Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman with Julie Sussman, available online at http://mitpress.mit.edu/sicp/
• Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides
• What not How: The Rules Approach to Application Development by Chris Date
• The Algorithm Design Manual by Steve Skiena
• Programming Language Pragmatics by Michael Scott
• Essentials of Programming Languages by Daniel P. Friedman, Mitchell Wand, and Christopher T. Haynes

From the Middle Out

Each of these is the best book on its subject. If you need to know these languages,
these will tell you all you need to know.
• Programming Perl by Larry Wall, Tom Christiansen, and Jon Orwant
• Common LISP: The Language by Guy R. Steele
• ANSI Common LISP by Paul Graham
• The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie
• The C++ Primer by Stanley Lippman
• The C++ Programming Language by Bjarne Stroustrup
• Thinking in Java by Bruce Eckel, available online at http://www.mindview.net/Books/TIJ/
• The Scheme Programming Language by Kent Dybvig
• Linux Assembly Language Programming by Bob Neveln

Specialized Topics

These books are the best books that cover their topic. They are thorough and
authoritative. To get a broad base of knowledge, you should read several outside of
the areas you normally program in.
• Practical Programming - Programming Pearls and More Programming Pearls by Jon Louis Bentley
• Databases - Understanding Relational Databases by Fabian Pascal
• Project Management - The Mythical Man-Month by Fred P. Brooks
• UNIX Programming - The Art of UNIX Programming by Eric S. Raymond, available online at http://www.catb.org/~esr/writings/taoup/
• UNIX Programming - Advanced Programming in the UNIX Environment by W.Richard Stevens
• Network Programming - UNIX Network Programming (2 volumes) by W.Richard Stevens
• Generic Programming - Modern C++ Design by Andrei Alexandrescu
• Compilers - The Art of Compiler Design: Theory and Practice by Thomas Pittman and James Peters
• Compilers - Advanced Compiler Design and Implementation by Steven Muchnick
• Development Process - Refactoring: Improving the Design of Existing Code by Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts
• Typesetting - Computers and Typesetting (5 volumes) by Donald Knuth
• Cryptography - Applied Cryptography by Bruce Schneier
• Linux - Professional Linux Programming by Neil Matthew, Richard Stones, and 14 other people
• Linux Kernel - Linux Device Drivers by Alessandro Rubini and Jonathan Corbet
• Open Source Programming - The Cathedral and the Bazaar: Musings on Linux and Open Source by an Accidental Revolutionary by Eric S. Raymond
• Computer Architecture - Computer Architecture: A Quantitative Approach by David Patterson and John Hennessy

Further Resources on Assembly Language

In assembly language, your best resources are on the web.
• http://www.linuxassembly.org/ - a great resource for Linux assembly language programmers
• http://www.sandpile.org/ - a repository of reference material on x86, x86-64, and compatible processors
• http://www.x86.org/ - Dr. Dobb’s Journal Microprocessor Resources
• http://www.drpaulcarter.com/pcasm/ - Dr. Paul Carter’s PC Assembly Language
• http://webster.cs.ucr.edu/ - The Art of Assembly Home Page
• http://www.intel.com/design/pentium/manuals/ - Intel’s manuals for their processors
• http://www.janw.easynet.be/ - Jan Wagemaker’s Linux assembly language examples
• http://www.azillionmonkeys.com/qed/asm.html - Paul Hsieh’s x86 Assembly Page

The Argument

An interesting argument.... between XXX and YYY ....

Guess, who is XXX and YYY ..... ?

XXX (1:34:20 PM): Do not deceive yourselves. If any one of you thinks he is wise by the standards of this age, he should become a "fool" so that he may become wise. 19For the wisdom of this world is foolishness in God's sight.
YYY (1:34:57 PM): All I'm talking is science
YYY (1:35:04 PM): nothing more than that
XXX (1:35:18 PM): yes you're talking about unprovable science
YYY (1:35:49 PM): I don't believe in any Dogma
XXX (1:36:51 PM): I don't believe in any science that is unprovable and is only a theory
XXX (1:37:24 PM): And dont call theory as a science. its theory and NOT science
YYY (1:37:31 PM): yes, every scientist/science had this problem
YYY (1:37:58 PM): people just want to stick to thier confortable thinking
XXX (1:38:08 PM): Yes thats what I say to you too
YYY (1:38:10 PM): they just don't think out of the box
XXX (1:38:23 PM): You wouldn't like to consider what I am saying bgut stcking on to your own
XXX (1:38:52 PM): And I say again, if you have verifiable proof to what you say I will consider. But talk theory as science
XXX (1:39:00 PM): I mean Dont talk
YYY (1:40:07 PM): once upon a time, man going to moon is also called impossible and not proven
YYY (1:40:15 PM): but time changed
XXX (1:40:19 PM): Yea talk it after you prove
XXX (1:40:28 PM): dont talk before you prove
YYY (1:40:32 PM): It is not for you
YYY (1:40:51 PM): you should have common sense to buy it or not
XXX (1:41:19 PM): You told about science and what you're saying is only theory
XXX (1:41:42 PM): I just need common sense to differentiate what u're talking is science or theory
YYY (1:41:54 PM): yes, first it will be theory and then it will become science
XXX (1:41:54 PM): And call theory as theory and science as science. dont mix both
XXX (1:42:06 PM): Hmm...
YYY (1:42:13 PM): se the history
XXX (1:42:21 PM): Good hope...
YYY (1:42:26 PM): for you too
XXX (1:42:39 PM): what shud I see in history?
YYY (1:42:45 PM): atleast science can be proven
YYY (1:42:52 PM): but not god
XXX (1:42:58 PM): yea thats what I say prove it
YYY (1:43:01 PM): god can't be proved
XXX (1:43:12 PM): Dont force your thing on others before u prove
YYY (1:43:36 PM): there is no god
XXX (1:43:46 PM): There is no evolution
YYY (1:44:49 PM): XXX, did you have biology in your studies ?
YYY (1:45:00 PM): in 10th standard
YYY (1:45:09 PM): which group in +2 are you ?
XXX (1:45:17 PM): why u're asking
YYY (1:45:31 PM): for "XXX (1:43:46 PM): There is no evolution"
XXX (1:45:42 PM): Yes there is no evolution
XXX (1:46:07 PM): Thats because it appears in some science text books, it is not science
YYY (1:46:13 PM): go back to your schooling
XXX (1:46:23 PM): I was never given proof
YYY (1:46:35 PM): did you write the exam ?
XXX (1:46:41 PM): yes...
YYY (1:47:00 PM): did you give the answer abt evolution ?
XXX (1:47:11 PM): No, it wasn't asked :)
YYY (1:47:11 PM): or you answered it differently ?
YYY (1:47:26 PM): ok, atleast you studied
XXX (1:47:32 PM): No either
XXX (1:47:41 PM): I asked you for proof you have any?
YYY (1:48:14 PM): Answer: go for schooling
YYY (1:48:18 PM): one more time
XXX (1:48:20 PM): It requires me great faith to believe something came out of nothing than to believe something came out of something
YYY (1:48:51 PM): it is not something came out of nothing
XXX (1:49:11 PM): mmm
XXX (1:49:20 PM): How did the universe came into existence then?
YYY (1:49:33 PM): then god is also nothing ????
YYY (1:49:53 PM): God came from Nothing ?
XXX (1:50:41 PM): God created time, space, matter. All that I see now. God hasn't given me the intelligence to comprehend beyond this. When I meet him I will find it out
YYY (1:51:08 PM): my question is simply
YYY (1:51:15 PM): who created GOD
YYY (1:51:31 PM): do you have answer ?
XXX (1:51:35 PM): My question is who created universe?
XXX (1:51:39 PM): do you have answer?
YYY (1:52:24 PM): Universe came out of Big Bang
YYY (1:52:47 PM): do you have any such theory ?
YYY (1:52:50 PM): for GOD
XXX (1:53:06 PM): who created big bang?
XXX (1:53:15 PM): Or who initiated
XXX (1:53:24 PM): and how did matter come into existence
YYY (1:53:32 PM): XXX, I answered yours
YYY (1:53:37 PM): you answer mine
XXX (1:53:39 PM): Not yet
YYY (1:53:43 PM): who create GOD
XXX (1:53:46 PM): Who initiated big bang
XXX (1:53:56 PM): How did matter come into existence
YYY (1:53:57 PM): atleast give some theory ?
XXX (1:54:14 PM): You didn't answer mine.
YYY (1:54:15 PM): you don't have any ?
XXX (1:54:22 PM): you answer me then I will
XXX (1:54:52 PM): You give me a thory for big band and the existence of matter then I will
YYY (1:55:03 PM): XXX
YYY (1:55:15 PM): the basis of any religion is GOD
XXX (1:55:22 PM): forget that
XXX (1:55:31 PM): I am talking abt big bang and matter
XXX (1:55:34 PM): tell me first
YYY (1:55:36 PM): but you don't know who create your GOD
XXX (1:55:51 PM): And you dont know how matter came into existence
YYY (1:55:52 PM): does it not given in your Book ?
XXX (1:56:09 PM): tell me first
XXX (1:56:44 PM): Is there any proof in the entire universe where matter came out of nothing?
XXX (1:56:55 PM): You at least need a photon dude!
XXX (1:57:12 PM): And how did the first photon originate?
YYY (1:57:12 PM): at least Science have some answers, but religion dont have any ???
XXX (1:57:20 PM): What answer??
XXX (1:57:30 PM): You asked me abt God and I asked you about matter
XXX (1:57:43 PM): It is more correct to say that both have no answer
YYY (1:58:27 PM): atleast science is digging deeper
YYY (1:58:32 PM): but religion is not
YYY (1:58:39 PM): it is blind
XXX (1:58:41 PM): yes dig deep and tell me how matter came into existence
XXX (1:58:58 PM): Atleast science is blind too in terms of origin of matter
XXX (1:59:04 PM): That is primary to any science
YYY (1:59:07 PM): atleast you can see matter
YYY (1:59:17 PM): but can you see god ???
YYY (1:59:23 PM): ok
YYY (1:59:27 PM): I don't see any god
XXX (1:59:29 PM): I am not asking abt matter, I am asking abt its origin
XXX (1:59:39 PM): I can see God's creation for sure
YYY (2:00:00 PM): but who is god ?
YYY (2:00:07 PM): do you say
YYY (2:00:14 PM): MATTER = GOD ?
XXX (2:00:16 PM): Isn't it best to conclude that both of us follow religion
XXX (2:00:21 PM): NO
XXX (2:00:31 PM): Matter is God's creation
YYY (2:00:35 PM): GOD create WORLD
YYY (2:00:49 PM): WORLD is made up of MATTER
YYY (2:00:58 PM): so GOD = MATTER
XXX (2:01:04 PM): Hey I admit mine is religion will you admit yours? If not give me proof of origin of matter
YYY (2:01:43 PM): matter and energy always existed
YYY (2:01:47 PM): like your GOD
XXX (2:01:50 PM): hmm
XXX (2:01:55 PM): Isn't it religion
XXX (2:02:07 PM): aren't both of us following religion?
YYY (2:02:10 PM): if it is religion
XXX (2:02:14 PM): Why do u call ur religion science?
YYY (2:02:18 PM): you will chatting like this
YYY (2:02:33 PM): there might have been no invention
YYY (2:02:36 PM): nothing
XXX (2:02:38 PM): hmm
YYY (2:02:45 PM): we will in complete darkness
XXX (2:02:47 PM): Isaac Newton wrote abt God more than science
YYY (2:03:11 PM): and Einstien also
YYY (2:03:16 PM): carl sagan also
YYY (2:03:26 PM): everybody
YYY (2:03:29 PM): I also
YYY (2:03:31 PM): I say
YYY (2:03:36 PM): MATTER = GOD
YYY (2:03:51 PM): Matter create the world
XXX (2:03:53 PM): This is ur assumption dude
XXX (2:03:58 PM): Who created matter
XXX (2:04:28 PM): I dont know who created God and you dont know the origin of matter
YYY (2:04:35 PM): does your God is male or female ?
XXX (2:04:36 PM): We both are following religion
XXX (2:04:54 PM): That doesn't matter and it is outside of our context
YYY (2:05:03 PM): what is he made out of
YYY (2:05:10 PM): flesh ?
XXX (2:05:21 PM): Man answer mine I already told you I dont know
XXX (2:05:38 PM): Now only you'd have to admit you dont know too
YYY (2:05:52 PM): are you making any progress to research into
XXX (2:06:02 PM): Are you?
YYY (2:06:16 PM): we we are researching into matter
XXX (2:06:23 PM): hmm any findings?
YYY (2:06:25 PM): are you researching into god ?
YYY (2:06:27 PM): yes
YYY (2:06:29 PM): a lot
XXX (2:06:33 PM): tell me whats latest
YYY (2:06:50 PM): read abt String Theory
YYY (2:06:56 PM): what abt god ?
XXX (2:07:02 PM): hmm
XXX (2:07:13 PM): what does it tell about the origin of matter?
YYY (2:08:33 PM): matter composed of bosons, Glue balls
YYY (2:08:34 PM): etc
YYY (2:08:42 PM): what is God made up of ?
XXX (2:08:52 PM): how did boson originate
YYY (2:08:54 PM): water
YYY (2:08:56 PM): fire ?
YYY (2:09:00 PM): earth
YYY (2:09:10 PM): which chemical compoent
XXX (2:10:12 PM): how diod boson originate
XXX (2:10:21 PM): and which chemical component it contains?
YYY (2:10:32 PM): now, tell me something abt your god
YYY (2:10:52 PM): do he eat to live
YYY (2:10:53 PM): ?
XXX (2:10:58 PM): I said I don't know. Only you seem to be telling you know everything. Thats why I am asking you
XXX (2:11:14 PM): how did boson originate?
YYY (2:11:19 PM): research it
XXX (2:11:19 PM): What it is composed of?
YYY (2:11:35 PM): XXX, as I told you
YYY (2:11:47 PM): scientist are studing it
YYY (2:12:00 PM): we still have long way to go
XXX (2:12:26 PM): hmm... we've already researched for 100 years and still we dont know how matter and God originated
XXX (2:12:35 PM): I mean life, not god
XXX (2:12:53 PM): And any chances of finding that are 50/50
XXX (2:13:15 PM): Say for now that whatever you have is theory and don't claim it as science
YYY (2:13:59 PM): atleast we are going into that path of finding the origin of matter
XXX (2:14:20 PM): But where are you getting at?
YYY (2:14:21 PM): can you tell me, is there is any research going on for GOD
XXX (2:14:22 PM): No where
XXX (2:15:07 PM): Scientists would never even accept the notion of God existing and how do you expect them to research God?
YYY (2:15:19 PM): atleast did you make any attempt ??
XXX (2:15:20 PM): But if you want you can individually research him
YYY (2:15:36 PM): oh .. my god
YYY (2:15:49 PM): you don't know anything abt god
XXX (2:16:06 PM): I can tell you God exists and I spoke to him today morning but you wont believe it unless you know it personally
XXX (2:16:16 PM): And yes you dont know anything about the origin of matter
YYY (2:16:17 PM): thru phone ?
YYY (2:16:27 PM): do you have his number ?
YYY (2:16:36 PM): do you cann heaven ?
YYY (2:16:54 PM): do you call heaven ?
XXX (2:16:55 PM): Do you really think you're speaking logic?
YYY (2:17:03 PM): LOGIC
YYY (2:17:06 PM): my god
YYY (2:17:16 PM): XXX is speaking abt LOGIC
XXX (2:17:29 PM): Yes YYY too is talking abt it.. My God
YYY (2:17:30 PM): LOGIC says GOD=NOTHING
YYY (2:17:37 PM): do you take it ?
XXX (2:17:47 PM): Logic says something should create something
YYY (2:17:54 PM): It take SCIENCE=NOTHING
XXX (2:17:55 PM): do u take it?
YYY (2:18:00 PM): what abt you ?
YYY (2:18:07 PM): I take it
YYY (2:18:12 PM): science=nothing
YYY (2:18:17 PM): do you take
YYY (2:18:22 PM): god=nothing ?
YYY (2:18:27 PM): by LOGIC
XXX (2:18:37 PM): what do u mean by science is nothing?
YYY (2:19:29 PM): XXX, do you believe in miracles ?
XXX (2:19:45 PM): do you?
YYY (2:19:59 PM): answer me, first
YYY (2:20:04 PM): do you or not
XXX (2:20:07 PM): yes
YYY (2:20:10 PM): ok
YYY (2:20:18 PM): then don't talk abt LOGIC
XXX (2:21:23 PM): ok I never said I believe in logic. But since you believe I asked whether the questions you asked are logical?
YYY (2:24:41 PM): XXX, you are a contradiction
YYY (2:24:48 PM): either you hold
YYY (2:24:53 PM): Miracle
YYY (2:24:57 PM): or hold
YYY (2:25:06 PM): Logic
XXX (2:25:13 PM): ok do u believe in logic?
XXX (2:25:24 PM): Anyway we are deviating from topic
YYY (2:25:27 PM): ha ha ha ...
XXX (2:25:47 PM): You asked me some questions and I asked you whether they were logical
YYY (2:25:54 PM): Science created logic
XXX (2:26:06 PM): And of course u're definition of logic is different from mine
YYY (2:26:17 PM): No way
YYY (2:26:25 PM): Logic is same for all
XXX (2:26:35 PM): No it depends on your belief
YYY (2:26:38 PM): there is no Your Logic and My Logic
YYY (2:27:00 PM): do interchange Logic and Belief
XXX (2:27:01 PM): I believe God is all powerful and all knowing. He can do miracles. And that is logical
XXX (2:27:18 PM): If you belive in God it becomes logical if not it isnt
YYY (2:27:28 PM): Miracle is not Logical
XXX (2:27:44 PM): God does miracle because he has power and this is logical
YYY (2:28:33 PM): how many watt power ?
YYY (2:28:54 PM): you said:XXX (2:17:47 PM): Logic says something should create something
YYY (2:29:17 PM): now you say God can create something without something
YYY (2:29:30 PM): I mean Miracle
XXX (2:29:34 PM): But I said I dont believe in ur opinion of logic
YYY (2:29:47 PM): there is no "opinion of logic"
YYY (2:29:52 PM): there is only Logic
XXX (2:30:01 PM): The power is not measured by watts... It is similar to ur brain power
XXX (2:30:08 PM): hmm
YYY (2:30:10 PM): either you tautologies or contradict
XXX (2:30:17 PM): If God is all powerful he can do miracles
YYY (2:32:00 PM): Brain is a matter XXX
YYY (2:32:12 PM): it has chemical reaction
YYY (2:32:31 PM): what is that "Powerful" means
XXX (2:32:53 PM): Powerful to do anything
XXX (2:33:08 PM): Now if you ask me about Go, I have already told you I dont know.
XXX (2:33:27 PM): I believe he is all powerful all knowing and with that I can logically conclude he can do miracles
XXX (2:33:38 PM): But only you're not trying to admit you dont know
XXX (2:33:45 PM): Mine is a religion I admit
XXX (2:33:52 PM): And yours?
YYY (2:34:08 PM): You mean he is a Super computer who create the world
YYY (2:34:17 PM): and controls all events ?
XXX (2:34:17 PM): I said I dont know
YYY (2:34:28 PM): may be he is ?
XXX (2:34:34 PM): Since you seem to know everything can we talk about yours?

"Silence is an argument carried out by other means."
- Che Guevara (favorite Quote of Karadi)

Wednesday, December 05, 2007

Good Prayer for Daily Use

Good Quote

"Anything is possible. You can be told that you have a 90-percent chance or a 50-percent chance or a 1-percent chance, but you have to believe, and you have to fight."

Lance Armstrong

(Very good for my present situation)


Monday, November 26, 2007

Problems

Common Sense is not Common

There were once four learned and accomplished men. One day they said to themselves, "Of what use is all our learning if we do not seek the employment of a great king?" Accordingly, they set out for the capital.

Now among these four, three were particularly brilliant. The fourth was far inferior to the others in intellect, but he was the one with the most sense.

On the road, they came upon the skeleton of a lion. "Let us bring this lion back to life," proposed the first. "Yes, this will bring us great fame," agreed the second and third. The fourth one said, "If you bring this lion back to life, he will attack and devour you."

"Don't interrupt!" cried the first, who already used his superior knowledge to put flesh on the bones. The second quickly introduced blood, and the third was about to breathe life into the lion.

"We should think of safety," said the fourth.

"Quiet!" said the third from the depths of his labor.

"Well, then, I shall go sit in this tree," said the fourth. "Just in case."

The lion came back to life and killed the wise men. The only one who survived was the man with common sense.

Courtesy: Link

Sunday, November 11, 2007

This Week Quotes

To be alive, to be able to see, to walk,...it's all a miracle.
-- Arthur Rubinstein (1887-1982) Polish Pianist

"The more you praise and celebrate your life, the more there is in life to celebrate."
-- Oprah Winfrey

People call me an optimist, but I'm really an appreciator....When I was six years old and had scarlet fever, the first of the miracle
drugs, sulfanilamide, saved my life. I'm grateful for computers and
photocopiers...I appreciate where we've come from.

-- Julian Simon (1933-1998) American Academic

"At the center of your being you have the answer; you know who you are and you know what you want."
-- Lao Tzu

A prudent man will think more important what fate has conceded to him, than what it has denied.

-- Baltasar Gracian (1601-1658) Spanish Philosopher

"Nothing is worth more than this day. You cannot relive yesterday. Tomorrow is still beyond your reach."
-- Johann Wolfgang Von Goethe

"A real decision is measured by the fact that you've taken a new action. If there's no action, you haven't truly decided."
-- Tony Robbins

Wednesday, November 07, 2007

Spiral Matrix Program

My Spiral Matrix Program

#include < stdio.h>

#define UP 0
#define LEFT 1
#define DOWN 2
#define RIGHT 3

int getele(int *arr, int x, int y, int size) {

int pos=(x*size)+y;
return arr[pos];
}

int setele(int *arr, int x, int y, int data, int size) {

int pos=(x*size)+y;
arr[pos]=data;
}

void setspiral_worker(int *arr, int x, int y, int data, int size, int dir) {

if(data==1)
setele(arr, x, y, data, size);
else {
setele(arr, x, y, data, size);
dir=check_change_dir(arr, x, y, size, dir);
if (dir == UP) {
x--;
} else if (dir == LEFT) {
y--;
} else if (dir == DOWN) {
x++;
} else if (dir == RIGHT) {
y++;
}
setspiral_worker(arr, x, y, data-1, size, dir);
}
}

void setspiral_driver(int *arr, int size) {

setspiral_worker(arr, size-1, size-1, size*size, size, UP);
}

int check_change_dir(int *arr, int x, int y, int size, int dir) {

if (dir == UP) {
x--;
} else if (dir == LEFT) {
y--;
} else if (dir == DOWN) {
x++;
} else if (dir == RIGHT) {
y++;
}

if (x>=0 && x<=size-1 && y>=0 && y<=size-1
&& getele(arr, x, y, size) == 0)
return dir;
else
return (dir+1)%4;
}

int main() {
int oper=UP;
int size;
int i,j;

int *matrix;

printf("Enter the size:");
scanf("%d", &size);

matrix=malloc(size*size);

for(i=0; i < size ;i++)
for(j=0; j < size;j++)
setele(matrix, i, j, 0, size);
setspiral_driver(matrix, size);
for(i=0; i < size;i++) {
for(j=0; j < size;j++)
printf("%4d\t",getele(matrix, i, j, size));
printf("\n");
}
return 0;
}

Tuesday, October 30, 2007

Some Chanakya Quotes

Chanakya (Indian politician, strategist and writer, 350 BC 75 BC)

"A person should not be too honest.
Straight trees are cut first
and Honest people are victimised first."

"Even if a snake is not poisonous,
it should pretend to be venomous."

"The biggest guru-mantra is:
Never share your secrets with anybody. !
It will destroy you."

"There is some self-interest behind every friendship.
There is no Friendship without self-interests.
This is a bitter truth."

"Before you start some work, always ask yourself three questions - Why am I doing it, What the results might be and Will I be successful.
Only when you think deeply and find satisfactory answers to these questions, go ahead."

"As soon as the fear approaches near,
attack and destroy it."

"Once you start working on something,
don't be afraid of failure and don't abandon it.
People who work sincerely are the happiest."

"The fragrance of flowers spreads only in the direction of the wind.
But the goodness of a person spreads in all direction."

"A man is great by deeds, not by birth."

"Treat your kid like a darling for the first five years. For the next five years, scold them.
By the time they turn sixteen, treat them like a friend. Your grown up children are your best friends."

"Books are as useful to a stupid person as a mirror is useful to a blind person."

"Education is the best friend.
An educated person is respected everywhere.
Education beats the beauty and the youth."

Wednesday, October 24, 2007

Quiz Again

CODC Quiz is one of the Annual Event, which I always love to attend. Many Chocos to win, T-Shirts. Today, I won 2 Chocos and 1 T-Shirt.

I'm not much strong in Networking Area, my favorite areas are OS, esp. Unix/Linux.

Choco Question-1:

It is abt "Nicolas Writh" - A Turing Award winner who wrote Pascal PL, and many books on DS and Algos.

Choco Question-2:

It is a simple question, the answer is "Friend Class", you can guess the question.

One Summa Question:

Who wrote TeX - Donald E.Knuth (Thala...)

And The Great T-Shirt Question is....

What is the name "Unix" Stands for:

It is named as a pun on Multics, which some Bell guys like Ken Thompson, Dennis Ritchie, Brian Kernighan were working. Multics is an Multi-users operating system, funded by GE. But Multics was huge flop, so they came with an new operating system which developed on PDP-11 and using C Language, it is been ported to other hardwares.

Guna answered 2 Choco Questions.

I still remember My Senior Dhinesh, asked this same question in the Ragging Session while I was doing my MCA in MKU.

Totally, it is an awesome experience.

Friday, October 19, 2007

C/C++/Unix/Linux Help

This is for some my friends who want to learn C, C++ and Unix/Linux Programming including C/C++ pointers, templates, STL, IPCs like Semaphore, Pipes/FIFO, MQs and Pthreads.

Just leave your questions on comments session, I will try to answer them to the best of my knowledge.

Start Music ...

Pthread Synchronization w/o Mutex

Today, when I was just going through some Pthreads concepts. Pthreads are very useful for writing multi-threaded application, it has more advantages over multi-tasking.

Here is my program of Pthread Synchronization without using Mutex

#include < pthread.h>
#include < stdlib.h>
#include < unistd.h>

int mx=0;

void *thread_function1(void *arg) {
int i;

for ( i=0; i<10; i++) {
while(mx==2);
mx=1;
printf("Thread says hi-%d!\n",i);
mx=2;
}
pthread_exit(0);
}


void *thread_function2(void *arg) {
int i;

for ( i=0; i<10; i++) {
while(mx==1);
mx=2;
printf("Thread says hello-%d!\n",i);
mx=1;
}
pthread_exit(0);
}

int main() {

pthread_t mythread1, mythread2;
pthread_attr_t my_attr;
char *str;

if(pthread_create( &mythread1, NULL, thread_function1, NULL) ) {
printf("error creating thread1.");
abort();
}
if(pthread_create( &mythread2, NULL, thread_function2, NULL) ) {
printf("error creating thread2.");
abort();
}

mx=1;

if ( pthread_join (mythread1, NULL) ) {
perror("error joining thread.");
abort();
}
if ( pthread_join (mythread2, NULL) ) {
perror("error joining thread.");
abort();
}
printf("Pthread Joing Success\n");

exit(0);

}


The main disadvantage of this code, is polling, the while() statement in the 2 threads. When you use Mutex/semaphore, this polling which consume CPU time, can be avoided. I don't know the implementation of Pthread Mutex. But we can try to analyze through time command in the next session.

Next Meet Pannalam....

Tuesday, October 16, 2007

ha ... ha... ha... Stalin

Stalin, What is the use of getting a book, if you are not going to read it ?

See, When ever you read that book, I have asked my Sister to beat you up and give you some important jobs in the Kitchen. Don't waste your precious time by reading other's blobs, go... go... go to Kitchen.

Some Dialogues from 300
=======================
.....
Persian Messenger: What makes this woman think she can speak among men?
Gorgo: Because only Spartan women give birth to real men.
....
Persian messenger: This is blasphemy! This is madness!
Leonidas: [He looks at Gorgo, who nods to him] Madness? THIS IS SPARTA!!! [kicks the screaming messenger down the well]
....
Persian Emissary: No, not slaves. Your women will be slaves. Your sons, your daughters, your elders will be slaves, but not you. By noon this day, you will all be dead men! A thousand nations of the Persian Empire descend upon you. Our arrows will blot out the sun!
Stelios: [grins] Then we will fight in the shade.
....
[The Spartans hold up their shields as a flurry of Persian arrows blot out the sun.]
Leonidas: Persian cowards.
[Suddenly, Astinos begins laughing.]
Stelios: What the hell are you laughing at?
Astinos: You had to say it!
Stelios: What?
Astinos: "Fight in the shade!"
....
Xerxes: Yours is a fascinating tribe. Even now, you are defiant, in the face of annihilation, and the prescence of a god. Imagine what horrible fate awaits my enemies when I would gladly kill half of my own men for victory.
Leonidas: And I would die for any one of mine.
.....
Stelios: It is an honor to die by your side.
Leonidas: It is an honor to have lived at yours.
....
Xerxes: There will be no glory in your sacrifice. I will erase even the memory of Sparta from the histories. Every piece of Greek parchment shall be burned. Every Greek historian and every scribe shall have their eyes put out and their tongues cut from their mouths. Why, uttering the very name of Sparta or Leonidas will be punishable by death. The world will never know you existed at all!
Leonidas: The world will know that free men stood against a tyrant, that few stood against many. And that before this battle is over, even a god-king can bleed.
....

Courtesy: 300 Wikiquote


Today's Quote

=============
"The starting point of achievement is desire. Keep this constantly in mind. Weak desires produce weak results, just as a small amount of fire produces a small amount of heat."

- Napoleon Hill

Monday, October 08, 2007

Language Agnostic Books

I have consolidated some of the Language Agnostic Books from the Computer Zen Link.

List of Language Agnostic Books:
================================
1. Code Complete
2. Pragmatic Programmer
3. Programming Pearls
4. Refactoring
5. Design of the UNIX Operating System
6. Design Patterns
7. The Practice of Programming
8. The Structure and Interpretation of Computer Programs
9. The Mythical Man Month
10. Object Oriented Analyis and Design

The Tao of Programming

In the beginning was the Tao. The Tao gave birth to Space and Time. Therefore Space and Time are Yin and Yang of programming.

Programmers that do not comprehend the Tao are always running out of time and space for their programs. Programmers that comprehend the Tao always have enough time and space to accomplish their goals.

________________________________________________________________________________

The Tao gave birth to machine language. Machine language gave birth to the assembler.

The assembler gave birth to the compiler. Now there are ten thousand languages.

Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.

But do not program in COBOL if you can avoid it.

________________________________________________________________________________

Once the Grand Master Turing dreamed that he was a machine. When he awoke he exclaimed:

"I don't know whether I am Turing dreaming that I am a machine, or a machine dreaming that I am Turing!"

________________________________________________________________________________

A master was explaining the nature of Tao of to one of his novices. "The Tao is embodied in all software - regardless of how insignificant," said the master.

"Is the Tao in a hand-held calculator?" asked the novice.

"It is," came the reply.

"Is the Tao in a video game?" continued the novice.

"It is even in a video game," said the master.

"And is the Tao in the DOS for a personal computer?"

The master coughed and shifted his position slightly. "The lesson is over for today," he said.
________________________________________________________________________________
Link: Tao of Programming

Memory for Programmers

The links to

Memory for Programmers Part-I

Memory for Programmers Part-II

________________________________________________________________________________

The Joel Test

The Joel Test

1. Do you use source control?
2. Can you make a build in one step?
3. Do you make daily builds?
4. Do you have a bug database?
5. Do you fix bugs before writing new code?
6. Do you have an up-to-date schedule?
7. Do you have a spec?
8. Do programmers have quiet working conditions?
9. Do you use the best tools money can buy?
10. Do you have testers?
11. Do new candidates write code during their interview?
12. Do you do hallway usability testing?