Error Reporting

Posted by Montu on March 25, 2009

PHP has come a long way. I used to program with Global vars then $HTTP_POST_VARS and then $_POST and even did a foreach to convert all Posted/Get-ed vars to their respective variable names. But I never faced any issue till the time I started using error_reporting(E_ALL).
My life changed. Initially I started pulling my hairs and then I realised that I will be bald very soon and then started concentrating on writing better code. Avoiding on the fly variables. Yesterday at work, I again realised the value of  error_reporting(E_ALL).I created a small piece of code and tested it in a temp php file. It looked superb. I ported the code to production environment and it started breaking. I thought for a while. May be I have introduced some parse errors. I ran a php -l test and didnt see any syntax error. I read the whole code line by line. Even did a diff. Still the temporary php code was running fine and the code in production environment was not working fine. :-/

I decided to look at the code bit later. After a break of 15 minutes I decided to write a unit test and capture everything. And then I found a notice message telling me I was accessing an index that didn’t exist. I looked at my data set. It was a long range of number, 6184 to be precise and an index value 280 was not set. I looked at my temp file and found my code was not going thru error reporting and production environment was set up to halt at all notices and warnings. Damn it!

Drop down menus with jQuery

Posted by Montu on March 18, 2009

After attempting sliding menus with jQuery I developed drop down menus using lists.

Here is the code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html>
  <head>
  <title>Drop Down Menus With jQuery</title>
  <script type="text/javascript" src="js/jquery.js“></script>
  <script type=”text/javascript”>
  function mainmenu(){
  $(”#nav ul” ).css({display: “none”}); // Opera Fix
  $(”#nav>li” ).hover(
function(){
$(this).find(’ul:first’).css({visibility: “visible”,display: “none”}).show(400);
},
function(){
$(this).find(’ul:first’).css({visibility: “hidden”});
});
}
$(document).ready(function(){
mainmenu();
});
</script>
<style type=”text/css”>
#nav, #nav ul{
margin:0;
padding:0;
list-style-type:none;
list-style-position:outside;
position:relative;
}
#nav>li{
float:left;
position:relative;
}
#nav>li>a{
font-size:12px;
font-family: arial;
color:#000000;
padding:5px;
text-decoration:none;
border: 1px solid #ddd;
background:#eee;
}
#nav ul {
position:absolute;
dispay:none;
}
#nav a{
display:block;
}
#nav>li>ul>li>a{
font-size:12px;
font-family: arial;
color:#000000;
padding:3px;
text-decoration:none;
border: 1px solid #aaa;
background:#bbb;
}
</style>
</head>
<body>
<ul id=”nav”>
<li><a href=”">HTML</a></li>
<li><a href=”#” >CSS</a>
<ul>
<li><a href=”#”>CSS 1</a></li>
<li><a href=”#”>CSS 2</a></li>
<li><a href=”#”>CSS 3</a></li>
</ul>
</li>
<li><a href=”#” >Javascript</a>
<ul>
<li><a href=”#”>Mootools</a></li>
<li><a href=”#”>Prototype</a></li>
<li><a href=”#”>jQuery</a></li>
<li><a href=”#”>Yahoo! UI</a></li>
<li><a href=”#”>Dojo</a></li>
<li><a href=”#”>Mochi Kit</a></li>
</ul>
</li>
</ul>
</body>
</html>

The big Indian poll drama

Posted by Montu on March 06, 2009

I just read this news item, “TDP promises free colour TV to every poor family“.

Now I must do some maths. I pay around 70K INR annually as income tax that too after saving more than 100K INR. There are 1000 more like me in my present organisation who pay at least 70K INR as taxes.

Now 70K x 1K = 70,000 K INR i.e. 7,00,00,000 INR or in Hindi 7 Crore Rupees just from one company.

Now multiply this with 100 and 700 Crore Rupees is the minimum amount that is being paid as Income Tax by people working in Noida. Visit Noida to experience

  • Traffic problems
  • Always Interrupted Power Supply
  • Crumbling infrastructure
  • Insecure neighborhoods, girls be aware.
  • Corruption, can be experienced in any city in India

These are just few things. One can write a complete book on this issue but I have just two observations.

  1. If TDP is going to spend money in purchasing colour TV sets for poors they will obviously not have enough money for anything else.
  2. If my money isn’t spent on right purpose I am justfied in evading Income Tax.

Long live India. :)

Being a Software Professional

Posted by Montu on March 03, 2009

Recently SBI slashed rate of interest for car loans. Just 10%. Enough for anyone to own a car. I too get tempted and gathered all my documents, ITRs, bank account statements, residence IDs, Form16/17/18/19…, and 2 passport size photographs(why do they call a postage stamp size photographs passport size photographs) and landed in SBI. They looked at my salary slips and were like OMG :O, your loan will be disbursed this weekend. I was surprised too :O, this a sarkari setup and how the hell they can process a loan within 3-4 days. But then I said to myself, mainnu kee, :D and was happy and rejoicing. I called up the dealer and enquired if the black color was in stock or not? My friends started to plan a party and I was dreaming…

…and then one day…

Your loan has been rejected because:

  • Credit score is not sufficient
  • You don’t own a property

What the f###???

I banged at Assistant Manager’s door and here are her explainations:

  •  You are a software professional

That’s it. All other things were linked to me being a software professional. My job is not stable, blame it on recession. Attrition ratio is higher in IT industry. I even don’t own a property coz I am not stable at one place, I was in Chandigarh, then Chennai, then N0Id34 and GAWD knows where I will be after one month. Dil ke armaan ansuo me beh gaye. Ham wafa kar ke bhi tanha reh gaye. The only good thing she found in my file was a good salary and that was not sufficient for me to repay a loan.

Unfortunately, there are no clear guidelines from RBI in this regard. I did a lot of Googling and didn’t find proper answer. By end of the day, I heard this, “Rehne do aap, aap se kuch nahi ho sakta:-(

Slow, slower, slowest gmail

Posted by Montu on March 01, 2009

slow gmail
I wished there was another superlative degree or an adjective which I can use to tell that newer version of Gmail is very slow and it never loads up on 64Kbps or even on 256Kbps.

Or

I guess Google has decided to slow down all Google apps including Gmail for Firefox so that they can promote Chrome and ….

Or

Firefox is damn slow, it never loads Gmail at first go but it loads FB/Orkut/Yahoo! Mail and hell lot of other websites

I am just trying to find out other reasons which forced me to revert to older versin of Gmail as Daddu did.


Fine Print: In very short I own my views & if you don't like something on my blog, I am sorry, I can't help you. In fact I am not even sorry. Ch33r5.