Shantanu Oak
Apr. 13th, 2009
12:54 pm - PEAR Power
Basic commands:
pear search services
(search for packages those have services keyword in it)
pear list
(installed packages)
pear upgrade-all
(upgrade installed packages)
pear install --alldeps Service_Weather
_____
Useful Packages
Mail
(send mail with attachments)
upload/ download file after tar or zip
(file management made easy)
pager
(Paging result rows)
DB
(Database connection)
HTML_safe
(Find unclosed tags)
HTML_QuickForm
(Build forms dynamically)
HTML_Menu
(Build menus dynamically)
Numbers_words
(numbers to word like One hundred fifty)
Date
(all about comparing dates, finding diff)
PhpDocumentor
(code documentation on the fly)
Log
(Logging messages from code)
Config
(have a single file for all configurations)
Auth
(Login / password management)
Nov. 6th, 2005
05:35 pm - Top 21 PHP progamming mistakes
Too many variables, too much time
Some people have this utter obsession with temporary variables. I just can't seem to understand it whenever I see something like:
Why the temporary variable? It is simply not necessary:
Unfortunately, it seems that many users have difficulty breaking out of this bad habit. Temporary variables slow down the execution time of your program. It's faster to omit them altogether and bundle the function calls together. Users who use temporary variables often add on 25% to the execution time of their scripts.
http://www.zend.com/zend/art/mistake.ph
Oct. 30th, 2005
05:49 pm - Resource id #3
When I echo ed the following statement
$sendto1 = mysql_query("select email from yubmail where mail_alias = '$to'");
I got the message
Resource id #3
I thought it's an array so I tried mysql_fetch_array but did not get the expected results.
I checked using is_array function and found that it's not an arrary.
I tried a lot of other ways to find out what the actual value is.
At last (Should have done it first), I googled
"Resource id" php output
And the Forth result gave me the exact answer to my question.
It's a mysql issue and I have to add mysql_result function
$sendto2 = mysql_result($sendto1, 0);
I don't know how does adding one more layer helps, but it's working now.
I think open source and free software had no meaning if the powerful search engine like google was not there!
Oct. 26th, 2005
04:29 pm - Regular Expression
Validates Mastercard credit card
^5[1-5][0-9]{14}$
# First character is 5
# Second character is 1-5
# Last 14 characters 0-9
Sample Matches:
5125632154125412||| 5225632154125412||| 5525632154125412
Sample Non-Matches:
5625632154125412||| 4825632154125412||| 1599999999999999
http://www.regexlib.com/REDetails.a
Oct. 24th, 2005
03:43 pm - Programmatically deciding which database to connect in PHP
After writing and debugging the code on my local machine, I would change the values of $user_name, $pwd and $database_name and upload the files to my client’s server. While I was developing the application (it was my first PHP project and I still maintain the program and the database for my client) there was no problem, as I would remember to change the values. But when, after the launch of the website, I routinely started altering the program (according to my clients interminably changing needs) I woud often forget to change the values, and consequently, render the website disfunctional. Then I changed the connect_database() function....
http://www.developertutorials.com/tutor
Sep. 28th, 2005
03:17 pm - PHP and Java Script
In this article, you will learn how to combine PHP and JavaScript to create two SELECT menus, one containing categories, and the other containing only those options applicable to the category selected.
http://www.devshed.com/c/a/PHP/PHP-a
