Saturday, May 30, 2009

Built in Breadcrumb in Zend Framework

Wenbert Del Rosario has posted a tutorial explaining how to use build in breadcrumb(Zend_navigation) facility in zend framework.

Friday, May 29, 2009

Managing Secure Protocol in Apache-Based Websites using PHP

In this post author explain of https protocol, how to effectively manage it, he is helping you to have good rank from google. Nice, see about use of rel="canonical" tag. He helps how to avoid your content being duplicated by googlebot as it will index your both http and https version of your website which will cause you to loss the page rank more details.

Strategy pattern in PHP

Very nice post explaning strategy pattern, i don't have much idea about it, But reading the post i liked it. Also see the way he has used interface in php.

Wednesday, May 27, 2009

Slides from international php conference(IPC) 2009

Will update the list as i get more.

IPC09 - Why Architecture in Web Development matters by Lars Jankowfsky

Evil WebDAV, XML and XPath at IPC SE 2009 by Tobias Schlitt

PHP Compiler Internals

Sebastian Bergmann explaining about php internal in the slides he goes in depth how the php code is compiled by zend engine and other step, if wanted to know how internally php code is worked on take a look at his slides

Monday, May 25, 2009

Friday, May 15, 2009

Build a Facebook application with Zend Framework

Thanks Madarco, Nice post i faced lot of problem while developing facebook application earlier in my previous company. This tutorial is really nice for new bies who wants to develop facebook application.

Thursday, May 14, 2009

Web Evolution


Picked this slide from Michael Sutton(VP, Security Research, Zscaler) presentation. Very nice explaining briefly about web evolution Web 1.0 to Web 3.0.

URL Rewrite Module in IIS

When i was giving TecHTalk in my previous company on .htaccess,SEO were i explaned about url rewriting(Short URL/Search Engine Friendly URL), one of miscosoft team member asked me is there a apache like mod_rewrite module for IIS. Today while reading blog in reader came across this and posting this for all IIS lovers here is a IIS URL rewrite module.

Wednesday, May 13, 2009

How To Debug Web Applications With Firefox

I used firefox plugin like web developer, live http header earlier now i love httpfox and colorzilla for debugging and used it lot of time, all this are my favorite can't leave without it. I found this interesting post which will explain you the short cut and example with more details how to debug the web application with firefox.

Tuesday, May 12, 2009

MySQL PROCEDURE ANALYSE

It examines the result from a query and returns an analysis of the results that suggests optimal data types for each column. To obtain this analysis, append PROCEDURE ANALYSE to the end of a SELECT statement.

For Example:
SELECT col1, col2 FROM table1 PROCEDURE ANALYSE();
SELECT * FROM table1 PROCEDURE ANALYSE();

Quite common task during schema review is to find the optimal data type for the column value - for example column is defined as INT but is it really needed or may be SMALLINT or even TINYINT will do instead. Read the post in mysqlperformanceblog explained in more detail.

PROCEDURE ANALYSE() can be a double edged tool. In the first it will help you to find the optimal data type for column. In the second case it had no idea you needed bigger values and gave you a recommendation based on bad data. Like most tools, PROCEDURE ANALYSE() needs to be used properly to get the desired results.

Syntax and more info here.

Search & replace in files using php

Very nice post from Sameer, in his blog code-diesel explaining how to search and replace in file using PEAR library File_SearchReplace.
Below are link explaining how to install PEAR.

Install PEAR on Windows

Install PEAR on LINUX

Read more about File_SearchReplace with example here

Friday, May 08, 2009

PHP 5.3 upgrading notes

Hi all upgrading to php 5.3 just go through the php 5.3 upgrading notes on wiki.php.net, lots of changes done, lots of new classes,method also function added and extension added and removed. List of upgrading notes is huge go through it. Below are few quick notes:

Reserved word: GOTO,NAMESPACE,CLOSURE are now reserved word in PHP, Make correction to your programs or else php will trow Fatal Error while parsing the script.

Functions affecting backwards compatibility:
* var_dump() output with objects.
* session_start() now returns false if session startup fails for some reason.
* opendir(), scandir() and dir() now use the default context if no context passed.
* The new mysqlnd library necessitates using MySQL's newer 41 byte password format. Continued use of the old 16 byte passwords will cause mysql_connect() to produce the following error message: “mysqlnd cannot connect to MySQL 4.1+ using old authentication.” No need to worry if you are using MySQL version >= 4.1, Prior to MySQL 4.1, password hashes computed by the PASSWORD() function are 16 bytes long.

Bye Bye windows 98 or NT4: The minimum Windows versions are now windows 2000/XP.

Libraries added: mysqlnd (optional replacement for libmysql)

Extension Changes Causing Incompatibilities:
"Session" - Sessions would no longer succeed to store session-files in ”/tmp” path if open_basedir restriction is enabled, and ”/tmp” is not explicitly added to allowed paths list (special treatment of ”/tmp” was added in 5.2.2, but was not documented)

Deprecated:
* define_syslog_variables() now issues E_DEPRECATED
* all ereg functions now issues E_DEPRECATED (note that not all of them are prefixed with ereg)

New functions:

Array

* array_replace()
* array_replace_recursive()

Date

* date_add()
* date_sub()
* date_diff()
* date_parse_from_format()
* date_create_from_format()
* date_get_last_errors()
* timezone_version_get()

Filesystem

* parse_ini_string()

MySQLi

* mysqli_fetch_all()
* mysqli_get_connection_stats()
* mysqli_poll()
* mysqli_reap_async_query()

Tuesday, May 05, 2009

Submitting Sitemaps using robots.txt

What are Sitemaps?

Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site.

You can tell Google and other search engines about your Sitemap by using robot.txt

Read file in php

Really nice post with example explaining how we can read large size file using php.

Retrieving original url from short url using PHP and CURL

Good post explaining how to get back original url from short url.

expanding short url to original url using PHP and CURL

Monday, May 04, 2009

Luhn algorithm for validating credit cards

The Luhn algorithm also known as the “modulus 10″ or “mod 10″ algorithm, is a checksum formula which can be used to validate credit card numbers. Developed in the 1950’s by IBM scientist Hans Peter Luhn and described in U.S. Patent 2,950,048. A PHP implementation is shown below.


function LuhnCheck($strDigits)
{
$sum = 0;
$alt = false;
for($i = strlen($strDigits) - 1; $i >= 0; $i--)
{
if($alt)
{
$temp = $strDigits[$i];
$temp *= 2;
$strDigits[$i] = ($temp > 9) ? $temp = $temp - 9 : $temp;
}
$sum += $strDigits[$i];
$alt = !$alt;
}
return $sum % 10 == 0;
}

?>

Web scraping tutorial

Web scraping (or Web harvesting, Web data extraction) is a computer software technique of extracting information from websites.

I got a freelance work to extract all the hotel information in UK of some city from yellow pages, I wrote a simple php script which uses curl to get the data and parse it using regular expression and extract the require data and populate db, sorry was not aware probably ignored policies.

Now there is a PHP library that facilitates the process of creating web scrapers called Simplehtmldom. More information can be found here.

Checking coding standards with PHP_Codesniffer

PHP_CodeSniffer is a PHP5 script that tokenises and "sniffs" PHP and JavaScript code to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.

I was really behind this in my previous company, i want to make sure everyone follows the coding standard, with this tool i am sure that problem is solved.

You can also define your own coding standard, it can be integrated with Subversion.

More detailed information with installation and example can be found here.

Load testing

http_load is a simple load testing tool.

http_load is a useful HTTP benchmarking utility that lets you run multiple http fetches in parallel to test the throughput of your web server. It gives you a rough idea of how many bytes a server can serve in a predetermined time.

Detailed information with example and download link can be found here.

Note: I didn't test it.