Tuesday, September 28, 2010

Story of Elephant

A king had 17 elephants. Then the king died. He had three sons. According to his will, the first son was entitled to one-half of the number of elephants, the second to one-third, and the third to one-ninth. The size of the share couldn't be changed. As 17 is an odd number, and difficult to share among the three, they were unable to find a solution to the challenge. Fortunately for them, a wise man was passing through their country. He was an old friend of their father's as well. The young men described their predicament and asked for his help. The wise man asked them not to worry and set about solving the problem immediately.

He added his elephant to the 17 elephants; they were now 18. He separated 9 elephants or one-half of 18, and gave them to the first son. The second son was given six elephants or one-third of 18. Lastly, the third son was given two elephants, two being one ninth of 18. The total number of elephants given away was 17 (9+6+2). The eighteenth elephant left was that of the wise man who took his elephant back and left, with everybody happy and satisfied. The last elephant is like maya: it came to solve a problem, and having solved it, it removes itself from the scene, leaving no trace of its previous presence.

flicked this story from :

I see this wise man as Entrepreneur and last elephant as his Efforts to make things better and no emotions attached.

Monday, August 09, 2010

30 Books Everyone Should Read Before They’re Thirty

30 Books Everyone Should Read Before They’re Thirty

I read 6 out of these... 24 to go and 2 years remaining..need lot to catch.

1. Siddhartha by Hermann Hesse
2. 1984 by George Orwell
3. To Kill a Mockingbird by Harper Lee
4. A Clockwork Orange by Anthony Burgess
5. For Whom the Bell Tolls by Ernest Hemingway
6. War and Peace by Leo Tolstoy
7. The Rights of Man by Tom Paine
8. The Social Contract by Jean-Jacques Rousseau
9. One Hundred Years of Solitude by Gabriel García Márquez
10. The Origin of Species by Charles Darwin
11. The Wisdom of the Desert by Thomas MertonThe Wisdom of the Desert by Thomas Merto
12. The Tipping Point by Malcolm Gladwel
13. The Wind in the Willows by Kenneth Graham
14. The Art of War by Sun Tzu
15. The Lord of the Rings by J.R.R. Tolkien
16. David Copperfield by Charles Dickens
17. Four Quartets by T.S. Eliot
18. Catch-22 by Joseph Heller
19.The Great Gatsby by F. Scott Fitzgerald
20 The Catcher in the Rye by J.D. Salinger
21. Crime and Punishment by Fyodor Dostoyevsky
22. The Prince by Niccolo Machiavelli
23. Walden by Henry David Thoreau
24. The Republic by Plato
25. Lolita by Vladimir Nabokov
26. Getting Things Done by David Allen
27, How To Win Friends and Influence People by Dale Carnegie
28 Lord of the Flies by William Golding
29, The Grapes of Wrath by John Steinbeck
30. The Master and Margarita by Mikhail Bulgak

30 Books Everyone Should Read Before They’re Thirty

30 Books Everyone Should Read Before They’re Thirty

Saturday, May 01, 2010

Pollard ko itna late kyun bheja?

Today Gangadhar kids were playing against relatively stronger uncle's team. Uncles are all in mid twenties so do not exactly fit to be called uncles but kids are actual kids between 5-14 age group so no option. Even I am an uncle for these kids.

So this uncles team blasted 50 runs of 5 overs. with New rules and DLF maximums, allowed in the ground. they were completely overshadowed. so big score to chase and uncles team being stronger on bowling side too, cut through their batting line up
to take all wickets for some 10 runs. then somehow I shifted my self from fielding team to batting team as I fielded for them for 2-3 balls. as I know how these kids are sensitive to winning the games, I have no option to start aggressive,
so I started wiith 2 sixes of 2 balls, suddenly baccha camp was all excited and started shouting Pollard,
so I got in more enthu and hit one more boundry next ball... and the comment came on..
"Arre lekin hamne pollard ko itna late kyun bheja?", (originally in marathi, अरे पण, पोल्लार्डला एवढे लेट का पाठविले? ) With perfect timing and context and with such a innocence that kid spoke,
I just cant stop blushing :) as this is the sentence was on everyones mouth a week back when MI lost to Chennai in IPL,
and at End everyone has this question..."Why do they sent pollard so late?" as pollard blasted 22 in 5 balls still mumbai lost, so Gangadhar kids..:)

Monday, April 05, 2010

Salesforce: Timezone, CreatedOn - trivial fix

I was showing list of records with createdDateTime. Created date was being shown in GMT at one place for same record
and it was shown in IST format at other place. I thought both places I am doing same thing but result was different.
It was all Salesforce's magic Apex languange rendering.

following code was showing date in GMT despite global setting being IST.
< apex:pageBlockTable value="{!recentList}" var="item" >
< apex:column >
< apex:facet name="header" >Created On< / apex:facet >
< apex:outputText value="{!item.CreatedDate}" />
< / apex:column >

< / apex:pageBlockTable>

Slight change in the code fixed this issue. removed facet and outputText.

< apex:pageBlockTable value="{!recentList}" var="item" >
< apex:column value="{!sms.CreatedDate}" headerValue="CreatedOn" / >

< / apex:pageBlockTable>

Saturday, March 06, 2010

Authentication for CodeIgniter done right

Got good piece of information from stack overflow, by Jens Roland


Just republishing it...
Disclaimer: none of the golden words below are written by me.

Authentication for CodeIgniter done right

Here's my MINIMAL required list of features from an authentication library. It also happens to be a subset of my own library's feature list ;)

1. Tiny footprint with optional test implementation
2. Full documentation
3. No autoloading required. Just-in-time loading of libraries for performance
4. Language file support; no hard-coded strings
5. reCAPTCHA supported but optional
6. Recommended TRUE random salt generation (e.g. using random.org or random.irb.hr)
7. Optional add-ons to support 3rd party login (OpenID, Facebook Connect, Google Account, etc.)
8. Login using either username or email
9. Separation of user and profile data
10. Emails for activation and lost passwords
11. Automatic cookie login feature
12. Configurable phpass for hashing (properly salted of course!)
13. Hashing of passwords
14. Hashing of autologin codes
15. Hashing of lost password codes
16. Hooks into CI's validation system
17. NO security questions!
18. Enforced strong password policy server-side, with optional client-side (Javascript) validator
19. Enforced maximum number of failed login attempts with BEST PRACTICES countermeasures against both dictionary and DoS attacks!
20. All database access done through prepared (bound) statements!

Note: those last few points are not super-high-security overkill that you don't need for your web application. If an authentication library doesn't meet these security standards 100%, DO NOT USE IT!

Recent high-profile examples of irresponsible coders who left them out of their software: #17 is how Sarah Palin's AOL email was hacked during the Presidential campaign; a nasty combination of #18 and #19 were the culprit recently when the Twitter accounts of Britney Spears, Barack Obama, Fox News and others were hacked; and #20 alone is how Chinese hackers managed to steal 9 million items of personal information from more than 70.000 Korean web sites in one automated hack in 2008.

These attacks are not brain surgery. If you leave your back doors wide open, you shouldn't delude yourself into a false sense of security by bolting the front. Moreover, if you're serious enough about coding to choose a best-practices framework like CodeIgniter, you owe it to yourself to at least get the most basic security measures done right.

Friday, March 05, 2010

Find the hidden Atlas :)

Can you see him?

Now ?

Atlas shrugged... tired so flew and hidden behind tree...

MySQL timezone setting for IST

Normally on US based servers, default US timezone is used, when creating DateTime in mysql. If your application is served to only India based customers then better to set mysql timezone to show Indian time.

check time_zone* tables in mysql db. if they are empty fill them using following command

shell> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

Zone Info database on system.
Such systems are Linux, FreeBSD, Solaris, and Mac OS X. One likely location for these files is the /usr/share/zoneinfo directory.

mysql>SET GLOBAL time_zone = "Asia/Calcutta";

This blog is writter based on info from mysql website .

Friday, February 26, 2010

The Sachin Tendulkar

The Great Sachin Tendulkar.

Full name Sachin Ramesh Tendulkar
Born April 24, 1973, Bombay (now Mumbai), Maharashtra
Current age 36 years 309 days
Major teams India, Asia XI, Mumbai, Mumbai Indians, Yorkshire
Nickname Tendlya, Little Master
Batting style Right-hand bat
Bowling style Right-arm offbreak, Legbreak googly
Height 5 ft 5 in
Education Sharadashram Vidyamandir School

Wednesday, February 24, 2010

Java.lang.OutOfMemoryError: Java heap space

It means that the JVM has run out of all the memory that has been allocated to it. You can change the amount of memory allocated for use by your JVM using the -Xms and -Xmx command line parameters.

For example, the following says run MyApp in a JVM and allocate a minimum of 5 Megabytes and a maximum of 15 Megabytes off of the heap in order to do so.

java -Xms5m -Xmx15m MyApp

republished from

Friday, January 15, 2010

installing lxml on Mac.

STATIC_DEPS=true sudo easy_install lxml

works while
sudo STATIC_DEPS=true easy_install lxml doesnt work

Tuesday, January 12, 2010

CodeIgniter - removing Index.php from path and enable $_GET

Enable Mod_rewrite in apache

in htaccess file

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

check in your apache config:

AllowOverride All
It works
http://example.com/foo/fun should work
http://example.com/index.php/foo/fun works

Get request issue solution got from Al James. republishing it here. thanks Al James.

I have recently added $_GET support to my CI project.

I wanted to do this in such a way as to avoid hacking the CI code. Its actually quite simple.

Firstly, set the config item for uri_protocol to use PATH_INFO:

$config['uri_protocol'] = "PATH_INFO";
This ensures that query string parts dont get treated like the rest of the CI uri structure (resulting in lots of 404 not founds).

Secondly, you need to extend the default Input library in order to stop it clearing the $_GET variable. Place the following file (called MY_Input.php) in your application/libraries/ folder:

class MY_Input extends CI_Input {

function _sanitize_globals()
$this->allow_get_array = TRUE;

This basically overrides the Input.php class to allow $_GET variables, but does not open up CI to query string URI routing (as it would if we simply set $config[‘enable_query_strings’] = TRUE).

Of course you will need to make sure that your config file specifies you subclass_prefix to be ‘MY_’, i.e.:

$config['subclass_prefix'] = 'MY_';
If its not, you can change the filename and classname of the above code accordingly!

That works for me anyway

Tuesday, January 05, 2010