The Immortals of Meluha by Amish Tripathi

I just completed reading this wonderful book.

The Immortals of  Meluha is a fiction by Amish Tripathi. This book is first of the Trilogy on Lord Shiva, a fierce warrior, a passionate lover, an accomplished dancer and a wise philosopher. This is an interesting adaptation of great Indian mythology from human perspective i.e. The simple man whose karma recast him as our Mahadev, the God of Gods.

Though it’s a fiction, you might believe in it, the way author explains the concept behind Somras, origin of ‘OM’, invention of ‘Trishul’, ‘Har Har Mahadev’ and so on. Also it will impart you some knowledge on Indus valley civilisation, Sapt Sindhu, Suryavanshis, Chandravanshis, ancient caste system and so on.

A web presence for this trilogy can be found here.

Check out a wonderful video teaser here:

It’s a believable realistic approach, An intelligent approach to serve mythology which is digestible. A wonderful read. And yeah I must say, Don’t read it for mythology, read it for entertainment and you will love mythology.

Now I am eagerly awaiting for second installment of this trilogy to meet Nagas and to learn their secrets ;)


How Facebook Targeting me

On my Gmail, Facebook is luring me to meet a Gujju girl ;). I must say AdSense is working.

P.S. Funny :)


A Funny Requirement

Many a times I browse various project requirements on freelancing websites and bid on them for my freelancing work related with PHP, MySQL, jQuery, JavaScript, CSS and XHTML.

In one of the freelancing site I came across this requirement which is totally funny, here is print screen excerpt for the same:

This guy is looking for best gay to develop his website and also he will pay in different kind ;). God bless the bidder.


Keeping footer always at the Bottom of the Page

In a recent website work I had to keep footer always at the bottom regardless of the content. If there is no content or very less content then footer use to come up instead of sticking at bottom of the page. Here is the CSS solution I found for the same:

Lets say the page structure is something like this:

<html>
<head><title>TITLE</title></head><body>
<div id="page">
 <div id="header">HEADER</div>
 <div id="content">CONTENT</div>
 <div id="footer">FOOTER</div>
</div>
</body>
</html>

Then we just need to use the following CSS code for footer which we need to keep in head section or some CSS file which will linked in head section:

<!--
#page
{
 position:relative;
 height:100%;
}
#content
{
 padding-bottom:40px;   /* Height of the footer */
}
#footer
{
 position:absolute;
 bottom:0;
 width:100%;
 height:40px;   /* Height of the footer */
}
-->

and we are done. Just test in any browser :)

This can be quite easily done without using any CSS if we are using <table> tag with height attribute instead of <div> tag. for e.g.

<html>
<head><title>TITLE</title></head>
<body>
 <table width="100%" height="100%">
 <tr><td valign="top">HEADER</td></tr>
 <tr><td valign="middle">CONTENT</td></tr>
 <tr><td valign="bottom">FOOTER</td></tr>
</table>
</body>
</html>

Here table height is set to 100% to use whole page and valign is used for vertical alignment of .  height attribute can be avoided using style element.

This will work fantastic but might fail in W3C validation as height attribute is no more supported so better use the solution with <div> tag with CSS.

Note: I tested this in Chrome browser only.

Have Fun ;-)


Symbol Interpretation

coincidentally it depicts the real situation in India

Rupee Symbol Interpretation

hats off to the person who imagined this …


Email Validation using PHP

In one of my recent project I was required to validate email address in PHP. There are many ways to do this but I like following two approaches very much for which I created two different functions:

I created a function isEmail which will validate the email address and return true or false as per validation result.

First Approach: Using Filter functions (http://in.php.net/manual/en/function.filter-var.php)

This is quite simple and straightforward way using filter_var method and FILTER_VALIDATE_EMAIL constant which works on PHP 5.2+

Here is the function definition:
<?php
function isEmail_FirstApproach($strEmail)
{
if(filter_var($strEmail, FILTER_VALIDATE_EMAIL))
{
return true;
}
return false;
}
?>

Second Approach: Using Regular Expression (http://in3.php.net/manual/en/function.preg-match.php)
Regular expression is extremely powerful and quite confusing tool. So use it cautiously :)
Note: This function validates emails very well but quite not fully functional will all kind of emails. For e.g. Gmail gives option to add ‘+’ sign in emails which will fail with this functions and so on. Anyways you can easily enhance it :)

Here is the function definition:

<?php
function isEmail_SecondApproach($strEmail)
{
$strPattern = “/^([a-z])([a-z0-9._])+([a-z0-9])\@([a-z0-9])*([a-z])+(-[a-z])*([a-z0-9])*(\.([a-z0-9])*([a-z])+(-[a-z])*([a-z0-9])*)+$/i”;

if(preg_match($strPattern, $strEmail))
{
return true;
}
return false;
}
?>

Now simply call these functions to use it’s functionality as follows:
<?php
$email = “abc@example.com”;

if(isEmail_FirstApproach($email))
echo “Valid Email”;
else
echo “Invalid Email”;

if(isEmail_SecondApproach($email))
echo “Valid Email”;
else
echo “Invalid Email”;
?>

Note: Validation results can be different for different email addresses as filter validation is quite liberal than my Regex function.

Let me know if you find any issue with this or know any more efficient way to perform the same.


Power of Investment: Wipro

After reading a related email I was just going through the stock of Wipro and got unbelievable impressive figure for long term investment.

Wipro was founded in 1941 with 17000 equity shares and incorporated in 1945. As the base price or face value per share price used to be Rs 100 at that time so considering the premium of Rs 80 the share price must be Rs 180 approximately. Also there used to be norm for minimum subscription of 100 units at a time so you need minimum 18000 Rupees for this subscription. Please note that Rs 18000 is a huge sum in 1980.

Now luckily lets say your father had that much money in 1980 and invested in Wipro stocks and forgets it for 30 years. til 2010 Just see what could have happened to that investment in all those years:
Considering all the bonuses and stock splits in last 30 years for Wipro:

Face Value BONUS Year Ratio Initial 100 shares
100 BONUS 1981 “1 : 1” 200
100 BONUS 1985 “1 : 1” 400
10 SPLIT 1986 “10 : 1” 4000
10 BONUS 1987 “1 : 1” 8000
10 BONUS 1989 “1 : 1” 16000
10 BONUS 1992 “1 : 1” 32000
10 BONUS 1995 “1 : 1” 64000
10 BONUS 1997 “2 : 1” 192000
2 SPLIT 1999 “5 : 1” 960000
2 BONUS 2004 “2 : 1” 2880000
2 BONUS 2005 “1 : 1” 5760000
2 BONUS 2010 “2 : 3” 9600000

So initial 100 shares of 1980 could have been 9600000 shares in 2010.

Current stock price of Wipro is Rs 433 (on 6 Aug 2010). So the total price of 9600000 shares: 4156800000 i.e. INR 415 crore. wow just amazing :)

Also as Wipro recently declared dividend of Rs 300 on the face value of Rs 2 i.e. Rs 6 per share, so only dividend earning for 9600000 shares for year 2010 could be: Rs 57600000 i.e. 5 crore 76 lakhs. Probably you or your children don’t need to work anymore and can thank everyday for your ancestor’s thought in 1980. :)

By the way if this blog information is correct then there is one lucky person who earned such benefits.

Now if someone had bought 100 shares in 1990 then it could have been compounded to 60000 shares. Its value on 6th Aug 2010 with the per share price of Rs 433 could be Rs 25980000 i.e. 2 crore 59 lakhs and dividend earning for year 2010 could be 360000. Still a good deal in 1990 for lucky ones.

If an investor had invested for 100 shares in year 2000. (Note: It was very costly in year 2000 with the price range of 2700-2800 on 1 Jan 2000) It could have been compounded to 1000 shares in 2010 and its value on 6th Aug 2010 with the per share price of Rs 433 could be Rs 433000 and dividend earning for year 2010 could be Rs 6000. Not a worthy investment in 2000 as its just doubling your money in 10 years which even any saving schemes could have done in less than 10 years.

Now think of your future after 20 years and let me know one such stock :)

Happy Investing !!


Follow

Get every new post delivered to your Inbox.