Changing Apache's www root directory

Sometimes it's necessary to change your current www root folder to something else. Maybe you have all your work files on a different partition than where you installed WAMP to or you have several websites you're working on and need to make one of them your primary site for a while (the one that shows up when entering localhost).

Anything that has to do with Apache configuration can be done within a file called httpd.conf.

1. WAMP provides quick access to certain important files, one of them being httpd.conf.
2. Left-click WAMP icon and select Config files › httpd.conf.
3. The file will probably open up in Notepad.
4. Press Ctrl+F and enter documentroot.
5. Make sure case sensitive search is disabled and hit enter.
6. You should find a line that looks like DocumentRoot "C:/Program Files/wamp/www/".
7. Copy that line then put a # in front of it: #DocumentRoot "C:/Program Files/wamp/www/".
8. Paste the copied line just below and adjust it to where your custom root folder is located (e.g. DocumentRoot "C:/my_cool_site/").
9. Resume the search (usually by pressing F3) and you'll find a line like: .
10. Again copy the line, put a # in front, paste copied line below and adjust it (e.g. ).
11. Save and close the file.

Whenever you make a change to httpd.conf you have to restart Apache for it to take effect. The # we've added in front of the old lines turns them into a comment which Apache ignores. We just added them so that we can easily switch back to an old configuration by uncommenting the lines.

1. Left-click the WAMP icon and select Apache › Restart Service.
2. Wait for the icon status to change to white again.

The root directory should now have changed to then one you've entered in httpd.conf. You can test this by entering localhost in your web browser. The index page in that folder (or the lack thereof) should show up now.

How to get the Next Auto Increment ID in Mysql

Two way are there in mysql

1st way :
SELECT Auto_increment FROM information_schema.tables WHERE table_name='%s';"


2nd way using this sql :

$rs = mysql_query("SHOW TABLE STATUS LIKE 'table_name' ");
$row = mysql_fetch_array($rs);
echo $row['Auto_increment'];

PHP Form Validation By Regular Expression ()

(1) PHP check valid url

function valid_url($str)
{
return ( ! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $str)) ? FALSE : TRUE;
}

(2) PHP numeric characters validator

function numeric($str)
{
return ( ! ereg("^[0-9\.]+$", $str)) ? FALSE : TRUE;
}

(3) PHP alpha-numeric characters validator

function alpha_numeric($str)
{
return ( ! preg_match("/^([-a-z0-9])+$/i", $str)) ? FALSE : TRUE;
}

(4) PHP alpha characters validator

function alpha($str)
{
return ( ! preg_match("/^([-a-z])+$/i", $str)) ? FALSE : TRUE;
}

(5) PHP validate ip

function valid_ip($ip)
{
return ( ! preg_match( "/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $ip)) ? FALSE : TRUE;
}

(6) PHP validate email

function valid_email($str)
{
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}

(7) PHP Windows Filename Validation
function is_valid_filename($name) {
$parts=preg_split("/(\/|".preg_quote("\\").")/",$name);
if (preg_match("/[a-z]:/i",$parts[0])) {
unset($parts[0]);
}
foreach ($parts as $part) {
if (
preg_match("/[".preg_quote("^|?*<\":>","/")."\a\b\c\e\x\v\s]/",$part)||
preg_match("/^(PRN|CON|AUX|CLOCK$|NUL|COMd|LPTd)$/im",str_replace(".","\n",$part))
) {
return false;
}
}
return true;
}


Reference from : http://www.roscripts.com/snippets/show/61

important scrips for php (Part -1)

(1) Human readable Sizes

function ByteSize ( $file_size )
{
$file_size = $file_size-1;
if ($file_size >= 1099511627776) $show_filesize = number_format(($file_size / 1099511627776),2) . " TB";
elseif ($file_size >= 1073741824) $show_filesize = number_format(($file_size / 1073741824),2) . " GB";
elseif ($file_size >= 1048576) $show_filesize = number_format(($file_size / 1048576),2) . " MB";
elseif ($file_size >= 1024) $show_filesize = number_format(($file_size / 1024),2) . " KB";
elseif ($file_size > 0) $show_filesize = $file_size . " b";
elseif ($file_size == 0 || $file_size == -1) $show_filesize = "0 b";
return $show_filesize;
}

(2) Remove non alpha numeric characters

function rem_non_alpha_numeric ( $string, $replace )
{
return preg_replace ( '/[^a-zA-Z0-9]/u', $replace, $string );
}

(3) PHP escape for SQL

/**
* Correctly quotes a string so that all strings are escaped. We prefix and append
* to the string single-quotes.
* An example is escape ( "Don't bother",magic_quotes_runtime () );
*
* @param str the string to quote
* @param [magic_quotes] if $s is GET/POST var, set to get_magic_quotes_gpc().
*
* @return quoted string to be sent back to database
*/
function escape ( $str, $magic_quotes = false )
{
switch ( gettype ( $str ) )
{
case 'string' :
$replaceQuote = "\\'"; /// string to use to replace quotes
if ( ! $magic_quotes ) {

if ( $replaceQuote [ 0 ] == '\\' ){
// only since php 4.0.5
$str = seo_str_replace ( array ( '\\', "\0" ), array ( '\\\\', "\\\0" ), $str );
//$s = str_replace("\0","\\\0", str_replace('\\','\\\\',$s));
}
return "'" . str_replace ( "'", $replaceQuote, $str ) . "'";
}

// undo magic quotes for "
$str = str_replace ( '\\"','"', $str );

if ( $replaceQuote == "\\'" ) {// ' already quoted, no need to change anything
return "'$str'";
}
else {// change \' to '' for sybase/mssql
$str = str_replace ( '\\\\','\\', $str );
return "'" . str_replace ( "\\'", $treplaceQuote, $str ) . "'";
}
break;
case 'boolean' : $str = ($str === FALSE) ? 0 : 1;
return $str;
break;
case 'integer' : $str = ($str === NULL) ? 'NULL' : $str;
return $str;
break;
default : $str = ($str === NULL) ? 'NULL' : $str;
return $str;
break;
}
}

(4) PHP is keyword in string

function is_keyword_in_string_bol ($keyword, $string)
{
if ( strpos ( $string, $keyword ) === false )
{
return FALSE;
}
else {
return TRUE;
}
}

(5) PHP check url if valid

function is_valid_url ( $url )
{
$url = @parse_url($url);

if ( ! $url) {
return false;
}

$url = array_map('trim', $url);
$url['port'] = (!isset($url['port'])) ? 80 : (int)$url['port'];
$path = (isset($url['path'])) ? $url['path'] : '';

if ($path == '')
{
$path = '/';
}

$path .= ( isset ( $url['query'] ) ) ? "?$url[query]" : '';

if ( isset ( $url['host'] ) AND $url['host'] != gethostbyname ( $url['host'] ) )
{
if ( PHP_VERSION >= 5 )
{
$headers = get_headers("$url[scheme]://$url[host]:$url[port]$path");
}
else
{
$fp = fsockopen($url['host'], $url['port'], $errno, $errstr, 30);

if ( ! $fp )
{
return false;
}
fputs($fp, "HEAD $path HTTP/1.1\r\nHost: $url[host]\r\n\r\n");
$headers = fread ( $fp, 128 );
fclose ( $fp );
}
$headers = ( is_array ( $headers ) ) ? implode ( "\n", $headers ) : $headers;
return ( bool ) preg_match ( '#^HTTP/.*\s+[(200|301|302)]+\s#i', $headers );
}
return false;
}

(6) How to extract google search results using PHP




if(!isset($_POST['q']))
{
echo '

';
}
else
{
// this would be the URL if you want the results on page 2, 3 ... where $_POST['p'] is multiple of 10
// $off_site = 'http://www.google.com/search?q='.urlencode($_POST['q']).'&start='.$_POST['p'];
$off_site = 'http://www.google.com/search?q='.urlencode($_POST['q']).'&ie=UTF-8&oe=UTF-8';
$fp = fopen ($off_site, 'r') or die('Unable to open file '.$off_site.' for reading');
while (!feof ($fp))
{
$buf = trim(fgets($fp, 4096));
$pos = strpos($buf,'

');
if($pos !== false)
{
$parts = explode('

',$buf);
$parts2 = explode('http://',$parts[1]);
$parts3 = explode('>',$parts2[1]);
echo ''.$parts3[0].'
';
}
}
}


?>

(7) PHP word wrap

/** * Example usage: *
* // Your text * $text = "This is a sentence which contains some words.";
* * // Or from a database result * $text = $row['text'];
* * // Then put it into the function * $text = word_wrap($text);
* * // Output the result * echo $text; */ function word_wrap($text)
{ // Define the characters to display per row
$chars = "10"; $text = wordwrap($text, $chars, "
", 1);
return $text;
}?>

8) Page load time calculator

// Insert this block of code at the very top of your page:
$time = microtime();$time = explode(" ", $time);
$time = $time[1] + $time[0];$start = $time;
// Place this part at the very end of your page$time = microtime();
$time = explode(" ", $time);$time = $time[1] + $time[0];
$finish = $time;$totaltime = ($finish - $start);
printf ("This page took %f seconds to load.", $totaltime);
?>


(9) PHP limit words

function word_limiter($str, $n = 100, $end_char = '…')
{
if (strlen($str) < $n)
{
return $str;
}

$words = explode(' ', preg_replace("/\s+/", ' ', preg_replace("/(\r\n|\r|\n)/", " ", $str)));

if (count($words) <= $n)
{
return $str;
}

$str = '';
for ($i = 0; $i < $n; $i++)
{
$str .= $words[$i].' ';
}

return trim($str).$end_char;
}

(10) PHP limit characters

function character_limiter($str, $n = 500, $end_char = '…')
{
if (strlen($str) < $n)
{
return $str;
}

$str = preg_replace("/\s+/", ' ', preg_replace("/(\r\n|\r|\n)/", " ", $str));

if (strlen($str) <= $n)
{
return $str;
}

$out = "";
foreach (explode(' ', trim($str)) as $val)
{
$out .= $val.' ';
if (strlen($out) >= $n)
{
return trim($out).$end_char;
}
}
}

(11) Show page queries

function mysql_query_2($query){
$_SESSION['queries']++;
return mysql_query($query);

// now use mysql_query_2() function in place of mysql_query()
// Each query will execute exactly the same but count up in
// session variable 'queries'

echo "$_SESSION['queries']";

// just output it somewhere like above...

(12) Checks if a path is absolute or relative

function is_absolute($path)
{
return ($path[0] == '/' || (substr(PHP_OS, 0, 3) == 'WIN' && preg_match('#^[a-z]:/#i', $path))) ? true : false;
}

Remove Leading Zeros Using PHP

It is actually two way to remove unnecessary Zeros

(1) ltrim()

Example : echo ltrim(”001″,”0″);
Result : 1

(2) intval()

Example : echo intval(”001″);
Result : 1

Conversion of MySQL Timestamp and DateTime to Unix based TimeStamp

About MySQL TimeStamp

* The Prior version of MySQL v4.1 the timestamp was formatted as like YYYYMMDDHHMMSS”
* since after MySQL v4.1 timestamp and datetime data types are formatted “YYYY-MM-DD HH:MM:SS”.

About Unix Based TimeStamp

* It is differ from MySQL. Unix’s timestamp is a integer value of seconds since January 1, 1970.


How To - Convert

(1) Using MySQL

* you can use Unix_Timestamp() function.
* Example:
SELECT Unix_Timestamp(Created) FROM CreatedItem;

(2) Using PHP
* you can use strtotime() function.
* Example:
$unixTimeStamp = strtotime($createdTimestamp);

stdClass in php

stdClass is php's generic empty class or say default PHP object which has no predefined members, kind of like Object in Java
you cannot define a class named stdClass in your PHP code. Useful for anonymous objects, dynamic properties,

StdClass object creation. Something like this would be great:

$foo = {”bar”: “baz”, “bam”: “boom”};

so you end up doing something like this:

$foo = new StdClass;
$foo->bar = “baz”;
$foo->bam = “boom”;

but you don’t have to. Using PHP’s casting operator you can create the object in one line:
$foo = (object) array(”bar” => “baz”, “bam” => “boom”);

usage is casting an array to an object which takes each value in the array and adds it as a member variable with the name based on the key
in the array.

Here’s an example below that converts an array to an object below. This method is called Type Casting

'Divyesh',
'lastname' => 'Karelia'
);

$p = (object) $person;
echo $p->firstname; // Will print 'Divyesh'
?>


Here’s an example below that converts a multi-dimensional array to an object. This is accomplished through recursion.

02.function arrayToObject($array) {
03. if(!is_array($array)) {
04. return $array;
05. }
06.
07. $object = new stdClass();
08. if (is_array($array) && count($array) > 0) {
09. foreach ($array as $name=>$value) {
10. $name = strtolower(trim($name));
11. if (!empty($name)) {
12. $object->$name = arrayToObject($value);
13. }
14. }
15. return $object;
16. }
17. else {
18. return FALSE;
19. }
20.}
21.?>


array('name' => 'Divyesh'),
'last' => array('name' => 'Karelia')
'
);

$p = arrayToObject($person);
?>

first->name; // Will print 'Divyesh'
?>

Drupal .module extension treate as php file (syntax color) in Eclipse

Recently I started to work in Drupal. I came across strange little problem with Drupal’s module development, syntax coloring and general PHP support when it comes to files with extension different than .php or .phtml. Lucky for me,

Eclipse comes with a nice solution for these kind of situations.

All you need to do in order for Eclipse to treat .module extensions as .php is to go to

Window Menu > Preferences > General > Content Types > (Select) Text > PHP Content TYpe from the Content types area, then below under

File Associations click on Add button and write down any extension you wish. In Drupal CMS case, write down “.module”.

Now you should be able to work with .module files as with all other .php files.

Top 10 Drupal Modules

Every CMS system should have a rich variety of extensions and add-ons, and so does Drupal have. In Paul Koura (webpodge.com) has made a top 10 list of those modules that he finds most valuable for Drupal.

His list is as shown below, in priority order:

  1. Content Construction Kit

  2. Views

  3. Tagadelic

  4. Path and Pathauto

  5. Organic Groups

  6. Buddylist

  7. Privatemsg

  8. Guestbook

  9. Logintoboggan

  10. Service Links

You can read Paul Koura's blog post including comments about each module here:
http://webpodge.com/2007/02/22/top-10-drupal-modules/

Easy to under standing File Upload in PHP

see simple tutorial how to upload file in php

http://www.sebastiansulinski.co.uk/web_design_tutorials/php/php_file_upload.php

change the PHP Max Upload file size

Last 2 yeara ago, I made a php-upload code for www.blemo.com, this site is specialy for mp3 sound and image gallary, regardings to this functionality user can upload multiple mp3 sound file at a time. that time I did not know about file uplode limit and it's setting
I tried much but some of file uploded and some of not for multipul file upload.

search some solution for that.

Most of the web servers are configured such a way that a user can only upload the maximum file size of 2MB.anything more will yield an error 500 due to a timeout. So there might be the problem for the people who wants to upload the .media file of size around 15MB. But, you can increse the maximum upload file size limit describe below.

There are two ways (that I know of) to change the php upload limit.

(1) changes in php.ini

The first is done by editing the php.ini file. This is normally the case if you have your own dedicated or virtual server. There may be multiple php.ini files throughout your system. The main one is typically found in /etc/php.ini which would govern all PHP. scripts.Furthermore you can include php.ini file in each folder that you wish to apply different settings to. In any case the, below are the fields you want to change.

upload_max_filesize = 10M ;
post_max_size = 20M ;


(2) by .htaccess

An alternative is to using the php.ini file is to use .htaccess. By just placing a.htaccess file in your root folder. the following directive would be placed in .htaccess file

RewriteEngine On
php_value post_max_size 20M
php_value upload_max_filesize 10M
php_value max_execution_time 6000000


Remember that : Choose your values carefully, know your audience and monitor the number of users. Always test/plan for worst case scenarios; 500 users uploading 10mb at the same time = 5,000mb bandwidth. This could easily annoy your web host provider.

If you are on windows with IIS server .htaccess file will not work for you,You should update these settings in php.ini file.

Advantages of PHP Programming

PHP programming which had a humble beginning has now turned to be a major player in software development. It was successful in launching fast and simple scripting language that could work seamlessly with many other components.

The execution speed of a web applications is very important as it cannot afford to slow down the rest of the machine, either. PHP integrates well with other software, especially under UNIX. It can be very fast, because it is a thin wrapper around many operating system calls.

PHP offers various security levels which can be set in the .ini file to defend the system from attacks of users, both as programmers and as surfers.

Another important advantage of PHP is its simplicity. Even HTML coders can integrate PHP programming straight into their pages.

Further Advantages of PHP Programming include:

* Ease of writing interfaces to other libraries.
* Several HTTP server interfaces.
* Large amount of database interfaces like MySQL, MS SQL, Oracle, Informix, and PostgreSQL etc.
* PHP programming is similar to C / JavaScript and Java.
* PHP is extendible.
* PHP will run on (almost) any platform.
* The PHP Extension and Add-on Repository.
* PHP is Open Source.

Reference from : http://www.eninteractive.com/Offshore-Outsourcing/Web-Application-Development/Programming/PHP-Advantages

Different types of WebHosting

Hosting can be FREE, SHARED or DEDICATED.

Free Hosting

Some service providers offer free web hosting.

Free web hosting is best suited for small sites with low traffic, like family sites or sites about hobbies. It is not recommended for high traffic or for real business. Technical support is often limited, and technical options are few.

Very often you cannot use your own domain name at a free site. You have to use a name provided by your host like http://www.freesite/users/~yoursite.htm. This is hard to type, hard to remember, and not very professional.

Good: Bad:
Low cost. It's free. No domain names.
Good for family, hobby or personal sites. Few, limited, or no software options.
Free email is often an option. Limited security options.

Limited or no database support.

Limited technical support.

Shared (Virtual) Hosting

Shared hosting is very common, and very cost effective.

With shared hosting, your web site is hosted on a powerful server along with maybe 100 other web sites. On a shared host it is common that each web site have their own domain name.

Shared solutions often offer multiple software solutions like email, database, and many different editing options. Technical support tends to be good.

Cost: $15 per month.
Best for: Small businesses who receive moderate levels of traffic.

Good: Bad:
Low cost. Cost is shared with others. Reduced security due to many sites on one server.
Good for small business and average traffic. Restrictions on traffic volume.
Multiple software options. Restricted database support.
Own domain name. Restricted software support.
Good support


VPS hosting

VPS (Virtual private server also referred to as Virtual Dedicated Server or VDS) hosting is a great stepping stone between shared and dedicated hosting. A single physical server is partitioned into multiple virtual private servers, and each VPS gets a dedicated amount of CPU and memory resources. Therefore, even if a VPS on the same server crashes, your VPS won't suffer. Also, a VPS gives you more control over server, software, and security configuration than shared hosting.


Cost: $60- $100 per month.
Best for: Small and medium businesses who need special server configuration and secure eCommerce capabilities.

Dedicated Hosting

With dedicated hosting your web site is hosted on a dedicated server.

Dedicated hosting is the most expensive form of hosting. The solution is best suited for large web sites with high traffic, and web sites that use special software.

You should expect dedicated hosting to be very powerful and secure, with almost unlimited software solutions.

Cost: starting at $150 per month
Best for: Companies who outgrow VPS hosting, or new companies who have the need and budget.


Good: Bad:
Good for large business. Expensive.
Good for high traffic. Requires higher skills.
Multiple domain names.
Powerful email solutions.
Powerful database support.
Strong (unlimited) software support.


Collocated Hosting

Collocation means "co-location". It is a solution that lets you place (locate) your own web server on the premises (locations) of a service provider.

This is pretty much the same as running your own server in your own office, only that it is located at a place better designed for it.

Most likely a provider will have dedicated resources like high-security against fire and vandalism, regulated backup power, dedicated Internet connections and more.

Good: Bad:
High bandwidth. Expensive.
High up-time. Requires higher skills.
High security. Harder to configure and debug.
Unlimited software options.


Your Checklist

Before you choose your web host, make sure that:

  • The hosting type suits your current needs
  • The hosting type is cost effective
  • Upgrading to a better server is a possible solution
  • If needed, upgrading to a dedicated server is possible

Before you sign up a contract with any hosting provider, surf some other web sites on their servers, and try to get a good feeling about their network speed. Also compare the other sites against yours, to see if it looks like you have the same needs. Contacting some of the other customers is also a valuable option.


APACHE SERVER STATUS & ERROR CODES

Sometimes when trying to access a web page, an error code will appear. Have you ever wondered what that code meant? Here is a list of the most popular error codes and their description. The first thing you should do anytime you get an error code is to make sure that you have entered the correct web page addressed. Everyone has incorrectly spelled a company name or added too many periods.

401 - Authorization Required

This error code means that you must have special access to view this page. The developers may want only certain people to access this page. There are several ways to limit access to a web page, including password protection. You may get the “401 - Authorization Required” error message when you try to view a web page with limited access. (A web site may have a customized version of this error message, displaying “Access Denied” or “Unavailable.”)

403 - Forbidden

This standard error message is generated by web servers when you try to access a file that has not been correctly configured by whomever maintains it. (The file needs to be set with “read permissions” for all users.) What this code most likely means is that you can’t view the page because whomever maintains the site set it up incorrectly.


404 - Page not found

A 404 - Not Found error means that there was no web page with the name you specified at the web site. This could happen for a variety of reasons:
Make sure that the web address (URL) that you typed in exactly matches the address you were given. Check that the capitalization matches, that all words are spelled properly, and that all the punctuation, like dots (.) and slashes (/), are correct. Be sure you are using the forward slash (/) and not the backward slash (\). (Remember, there are no spaces allowed in Web addresses, and a proper Web address will look like http://www.htmlcenter.com).
The page may have been renamed, moved, or deleted. Another possibility is that the person maintaining the web page may no longer have an account at that location.

500 - Page not available

If the server has been incorrectly set up or is experiencing technical problems, it will return this error. Again the first thing to do is make sure that you have typed in the address correctly.

501 - Not Implemented

This error is a direct result of problems in the web page’s HTML (HyperText Markup Language). It usually occurs with web pages that contain forms in which you type information and send it to a third party.









































Successful Client Requests
200 OK
201 Created
202 Accepted
203 Non-Authorative Information
204 No Content
205 Reset Content
206 Partial Content
Client Request Redirected
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
303 See Other
304 Not Modified
305 Use Proxy
Client Request Errors
400 Bad Request
401 Authorization Required
402 Payment Required (not used yet)
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable (encoding)
407 Proxy Authentication Required
408 Request Timed Out
409 Conflicting Request
410 Gone
411 Content Length Required
412 Precondition Failed
413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type
Server Errors
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported

Web 2.0 : What Is It?












 

The bursting of the dot-com bubble in the fall of 2001 marked a turning point for the web. Many people concluded that the web was overhyped, There is no clear definition of web 2.0.


The concept of "Web 2.0" began with a conference brainstorming session between O'Reilly and MediaLive International (Web 2.0 conference ) held in San Francisco Oct 2004 but one thing is clear Web 2.0 marks a fundamental change in how we use the Internet.


Web 1.0

Early Web development (retrospectively called as Web 1.0)

Simply we can say these :

·  Static pages instead of dynamic user-generated content.

·  The use of framesets.

·  Proprietary HTML extensions such as the <blink> and <marquee> tags introduced during the first browser war.

·  Online guestbooks.

·  GIF buttons, typically 88x31 pixels in size promoting web browsers and other products.

·  HTML forms sent via email. A user would fill in a form, and upon clicking submit their email client would attempt to send an email containing the form's details


Web 2.0

Network connectivity is the most fundamental principle for Web 2.0 to succeed. Any collaboration amongst users is not possible without being connected to each other.

There are a plethora of web sites emphasizing the social aspects of Web 2.0 which was not prominent in Web 1.0.


AJAX, CSS, RSS/Atom, Folksonomies, Blogs, Mashups and REST are some of the main technologies that enable the principles of Web 2.0. In the subsequent blog entries,

(IMAGE)


There is no clear-cut demarcation between Web 2.0 and Web 1.0 technologies, hardware and applications. The distinction is, to a large extent, subjective. Here are a few characteristics often noted as descriptive of Web 2.0:



  • blogging

  • Ajax and other new technologies

  • Google Base and other free Web services

  • RSS-generated syndication

  • social bookmarking

  • mash-ups

  • wikis and other collaborative applications

  • dynamic as opposed to static site content

  • interactive encyclopedias and dictionaries

  • ease of data creation, modification or deletion by individual users

  • advanced gaming.


 


 “collection of technologies - be it VoIP, Digital Media, XML, RSS, Google Maps… whatever … that leverage the power of always on, high speed connections and treat broadband as a platform, and not just a pipe to connect.”

That is easy (few minutes learning curve), quick (intuitive) and effective (presentable). Flickr, Wikipedia, MySpace, Writely, Del.icio.us and YouTube are some of the most common (and successful) websites showing Web 2.0 concepts. Most of these websites have gained popularity in past 1.5 years but it's hard to imagine life before them.

Web 2.0 era is the rise of blogging. Personal home pages have been around since the early days of the web, and the personal diary and daily opinion column around much longer than that,

& internet era software is that it is delivered as a service, not as a product.

Netscape was the standard bearer for Web 1.0, Google is most certainly the standard bearer for Web 2.0,














































































Web 1.0

 

Web 2.0

DoubleClick

-->

Google AdSense

Ofoto

-->

Flickr

Akamai

-->

BitTorrent

mp3.com

-->

Napster

Britannica Online

-->

Wikipedia

personal websites

-->

blogging

evite

-->

upcoming.org and EVDB

domain name speculation

-->

search engine optimization

page views

-->

cost per click

screen scraping

-->

web services

publishing

-->

participation

content management systems

-->

wikis

directories (taxonomy)

-->

tagging ("folksonomy")

stickiness

-->

syndication


we believe to be the core competencies of Web 2.0 companies:



  • Services, not packaged software, with cost-effective scalability

  • Control over unique, hard-to-recreate data sources that get richer as more people use them

  • Trusting users as co-developers

  • Harnessing collective intelligence

  • Leveraging the long tail through customer self-service

  • Software above the level of a single device

  • Lightweight user interfaces, development models, AND business models


That is easy (few minutes learning curve), quick (intuitive) and effective (presentable). Flickr, Wikipedia, MySpace, Writely, Del.icio.us and YouTube are some of the most common (and successful) websites showing Web 2.0 concepts. Most of these websites have gained popularity in past 1.5 years but it's hard to imagine life before them.


The idea of sharing information is being valued as much as the idea of proprietary information. Open source, which has been around for decades, is becoming a significant factor. And the web link is becoming a form of currency.


 


Web 2.0 vs Web 1.0   From Joe Drumgoole





  • Web 1.0 was about reading, Web 2.0 is about writing

  • Web 1.0 was about companies, Web 2.0 is about communities

  • Web 1.0 was about client-server, Web 2.0 is about peer to peer

  • Web 1.0 was about HTML, Web 2.0 is about XML

  • Web 1.0 was about home pages, Web 2.0 is about blogs

  • Web 1.0 was about portals, Web 2.0 is about RSS

  • Web 1.0 was about taxonomy, Web 2.0 is about tags

  • Web 1.0 was about wires, Web 2.0 is about wireless

  • Web 1.0 was about owning, Web 2.0 is about sharing

  • Web 1.0 was about IPOs, Web 2.0 is about trade sales

  • Web 1.0 was about Netscape, Web 2.0 is about Google

  • Web 1.0 was about web forms, Web 2.0 is about web applications

  • Web 1.0 was about screen scraping, Web 2.0 is about APIs

  • Web 1.0 was about dialup, Web 2.0 is about broadband

  • Web 1.0 was about hardware costs, Web 2.0 is about bandwidth costs


40 Tips for Optimizing PHP performance

Reinhold Weber has written 40 Tips for Optimizing PHP performance. Many of them were new to me - e.g. $row['id'] is 7 times faster than $row[id]. I don’t know how he has measured these numbers, but the tips are good overall!

Here are the first 10 tips:

  1. If a method can be static, declare it static. Speed improvement is by a factor of 4.
  2. echo is faster than print.
  3. Use echo’s multiple parameters instead of string concatenation.
  4. Set the maxvalue for your for-loops before and not in the loop.
  5. Unset your variables to free memory, especially large arrays.
  6. Avoid magic like __get, __set, __autoload
  7. require_once() is expensive
  8. Use full paths in includes and requires, less time spent on resolving the OS paths.
  9. If you need to find out the time when the script started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()
  10. See if you can use strncasecmp, strpbrk and stripos instead of regex

Read the full list of 40 tips here.

Read comments on the post as well, they too contain useful information.