Saturday, August 8, 2009

कलियुगातील गोष्ट

प्रामाणिक (ला)कोड तोड्या

कलियुगातील गोष्ट आहे.

एका गावात दोन (ला)कोड तोडे म्हणजेच साहेबी भाषेत Software Engineers राहत होते. पोटाची खळगी भरण्यासाठी दोघेही कोडिंग करायचे. त्यांतील एक कोड तोड्या प्रामाणिक होता तर दुसरा लबाड होता. सकाळी उठायचे, न्याहरी करून ऑफिस मधे जायचे, Source Tree वर चढून कोड तोडायचे (cut copy paste), दुपारच्याला सब वे मधून बांधून आणलेले फुट लॉंग खायचे, अंमळ विश्रांती घ्यायची, आणि मग उशिरापर्यंत राब राब राबून अंधार पडला की घरी परतायचे असा त्यांचा दिनक्रम असे.

एके दिवशी काय झाले, प्रामाणिक कोड तोड्याचे कामात मन लागत नव्हते. म्हणून आपल्या खुराड्या(cube) मधे बसून कोड तोडण्या ऐवजी तो ऑफिसच्या आवारातल्या पोहण्याच्या तलावापाशी जाऊन बसला. तलावाकाठी बसून लॅपटॉप घेऊन कोड तोडू लागला. बघता बघता त्याला जराशी डुलकी लागली आणि त्याचा लॅपटॉप तलावात पडला. प्रामाणिक कोड तोड्याला खडबडून जाग आली आणि लॅपटॉप पाण्यात पडलेला पाहून तो रडू लागला. त्याला रडताना पाहून एक जलदेवता पाण्यातून बाहेर आली आणि तिने कोड तोड्याला विचारले,

"
कोड तोड्या, तू का बरे रडत आहेस ?"

कोड तोड्याने रडत रडत तिला सांगितले

"
माझा लॅपटॉप कोड तोडता तोडता पाण्यात पडला. माझ्याकडे दुसरा लॅपटॉप नाही. माझी उद्या डेडलाईन आहे. ती पूर्ण झाली नाही तर माझे कसे होणार ? घरी म्हातारे आई वडील आहेत. त्यांचे कसे होणार ?"

जलदेवता म्हणाली, "रडू नकोस. मी तुझा लॅपटॉप पाण्यातून बाहेर काढून देते."

इतके म्हणून जलदेवतेने पाण्यात बुडी मारली आणि ती एक लॅपटॉप घेऊन बाहेर आली. कोड तोड्याने कन्फिगरेशन पाहिले. हा लॅपटॉप 4 GB RAM चा होता. प्रामाणिक कोड तोड्या म्हणाला,

"
हा लॅपटॉप माझा नव्हे. माझा लॅपटॉप तर 1 GB RAM चा होता."

जलदेवतेने पाण्यात पुन्हा बुडी मारली आणि ती अजून एक लॅपटॉप घेऊन बाहेर आली. कोड तोड्याने कन्फिगरेशन पाहिले. हा लॅपटॉप 2 GB RAM चा होता. प्रामाणिक कोड तोड्या म्हणाला,

"
हा लॅपटॉप माझा नव्हे. माझा लॅपटॉप तर 1 GB RAM चा होता."

जलदेवतेने पाण्यात तिस-यांदा बुडी मारली आणि ती एक लॅपटॉप घेऊन बाहेर आली. कोड तोड्याने कन्फिगरेशन पाहिले. हा लॅपटॉप 1 GB RAM चा होता. प्रामाणिक कोड तोड्या म्हणाला,

"
हाच माझा लॅपटॉप !!"

जलदेवता कोड तोड्याच्या प्रामाणिकपणावर खूश झाली आणि तिने ते तीनही लॅपटॉप प्रामाणिक कोड तोड्याला बक्षीस देऊन टाकले.

दुस-या दिवशी प्रामाणिक कोड तोड्याच्या मित्राने त्याच्याकडे नवीन लॅपटॉप पाहिला. त्याने विचारले, "मित्रा, या इकॉनॉमी मधे तुझ्याकडे नवीन लॅपटॉप कुठून आला ?" प्रामाणिक कोड तोड्याने त्याला जलदेवतेबद्दल सांगितले. ते ऐकून लबाड कोड तोड्याच्या मनात लोभ निर्माण झाला.

दुस-या दिवशी लबाड कोड तोड्या पोहण्याच्या तलावापाशी जाऊन बसला. तलावाकाठी बसून लॅपटॉप घेऊन कोड तोडू लागला. थोड्या वेळाने त्याने आपला लॅपटॉप मुद्दाम तलावात टाकला आणि मोठ्याने रडू लागला. त्याला रडताना पाहून जलदेवता पाण्यातून बाहेर आली आणि तिने कोड तोड्याला विचारले,

"
कोड तोड्या, तू का बरे रडत आहेस ?"

कोड तोड्याने रडत रडत तिला सांगितले,

"
माझा लॅपटॉप कोड तोडता तोडता पाण्यात पडला. माझ्याकडे दुसरा लॅपटॉप नाही. माझी उद्या डेडलाईन आहे. ती पूर्ण झाली नाही तर माझे कसे होणार ? घरी म्हातारे आई वडील आणि बायका पोरे - नाही नाही - बायको आणि पोरे आहेत. त्यांचे कसे होणार ?"

जलदेवता म्हणाली,

"
रडू नकोस. मी तुझा लॅपटॉप पाण्यातून बाहेर काढून देते."

इतके म्हणून जलदेवतेने पाण्यात बुडी मारली. या खेपेस थोडे Optimization करून ती तीन लॅपटॉप घेऊन बाहेर आली आणि कोड तोड्याला विचारले,

"
यातला कोणता लॅपटॉप तुझा होता ?"

लबाड कोड तोड्याने कन्फिगरेशन्स पाहिली. तो म्हणाला,

"
माझा लॅपटॉप 4 GB RAM चा होता."

जलदेवतेला लबाड कोड तोड्याचा खोटेपणा आवडला नाही आणि ती लबाड कोड तोड्याला कोणताच लॅपटॉप न देता अदृश्य झाली.

कलियुगाचा महिमा :

प्रामाणिक कोड तोड्या तीन लॅपटॉप घेऊन आयुष्यभर कोडिंगच करत राहिला.

लबाड कोड तोड्याचा लॅपटॉप पाण्यात पडल्याने त्याला कोड लिहिता येईना. मग कंपनीने त्याला मॅनेजर बनवून नवीन ब्लॅकबेरी घेऊन दिला




Wednesday, April 22, 2009

Words Lyrics Its Awesome


$mile an ever lasting smile
a smile can bring you near to me
don't ever let me find you gone
'cause that would bring a tear to me
this world has lost its glory
let's start a brand new story
now my love
you think that I don't even mean
a single word I say

it's only words
and words are all I have
to take your heart away

talk in ever lasting words
and dedicate them all to me
and I will give you all my life
i'm here if you should call to me
you think that I don't even mean
a single word I say

it's only words
and words are all I have
to take your heart away

it's only words
and words are all I have
to take your heart away

da da da da da da da
da da da da da da da da da da
da da da da da da da
da da da da da da da da da da

this world has lost its glory
let's start a brand new story
now my love
you think that I don't even mean
a single word I say

it's only words
and words are all I have
to take your heart away

it's only words
and words are all I have
to take your heart away

it's only words
and words are all I have
to take
your #eart away

Thursday, November 20, 2008

Regular Expression

What is a Regular Expression?

A regular expression is a set of characters that specify a pattern. Regular expressions are used when you want to search for specify lines of text containing a particular pattern. Most of the UNIX utilities operate on ASCII files a line at a time. Regular expressions search for patterns on a single line, and not for patterns that start on one line and end on another.

It is simple to search for a specific word or string of characters. Almost every editor on every computer system can do this. Regular expressions are more powerful and flexible. You can search for words of a certain size. You can search for a word with four or more vowels that end with an "s." Numbers, punctuation characters, you name it, a regular expression can find it. What happens once the program you are using find it is another matter. Some just search for the pattern. Others print out the line containing the pattern. Editors can replace the string with a new pattern.

Parts Of Regular Expression

There are three important parts to a regular expression.

1) Anchors are used to specify the position of the pattern in relation to a line of text.

2) Character Sets match one or more characters in a single position.

3) Modifiers specify how many times the previous character set is repeated.

A simple example that demonstrates all three parts is the regular expression "^#*."

The up arrow is an anchor that indicates the beginning of the line. The character "#" is a simple character set that matches the single character "#." The asterisk is a modifier.

The Anchor Characters: ^ and $

Pattern

Matches

^A

"A" at the beginning of a line

A$

"A" at the end of a line

A^

"A^" anywhere on a line

$A

"$A" anywhere on a line

^^

"^" at the beginning of a line

$$

"$" at the end of a line

The use of "^" and "$" as indicators of the beginning or end of a line is a convention

Matching a character with a character set :

The simplest character set is a character. The regular expression "may" contains three character sets: "m," "a" and "y." It will match any line with the string "may" inside it. This would also match the word "mayur." To prevent this, put spaces before and after the pattern: " may ."

Match any character with . (DOT)

The character "." is one of those special meta-characters. By itself it will match any character, except the end-of-line character. The pattern that will match a line with a single characters is ^.$

Specifying a Range of Characters with [...]

If you want to match specific characters, you can use the square brackets to identify the exact characters you are searching for. The pattern that will match any line of text that contains exactly one number is

^[0123456789]$

. You can also use the hyphen between two characters to specify a range:

^[0-9]$

You can also have explicit characters with character ranges. This pattern will match a single character that is a letter, number, or underscore:

[A-Za-z0-9_]

Rules in Short.

Regular Expression

Class

Type

Meaning

_




.

all

Character Set

A single character (except newline)

^

all

Anchor

Beginning of line

$

all

Anchor

End of line

[...]

all

Character Set

Range of characters

*

all

Modifier

zero or more duplicates

\<

Basic

Anchor

Beginning of word

\>

Basic

Anchor

End of word

\(..\)

Basic

Backreference

Remembers pattern

\1..\9

Basic

Reference

Recalls pattern

_+

Extended

Modifier

One or more duplicates

?

Extended

Modifier

Zero or one duplicate

\{M,N\}

Extended

Modifier

M to N Duplicates

(...|...)

Extended

Anchor

Shows alteration