Creating a image in Php pixel by pixel

Creating a image in Php from a image file pixel by pixel using this even you can compare from the the other images..
<?
header(”Content-type: image/png”);
$i1 = @imagecreatefromjpeg(”tom1.jpg”);
$diffi = imagecreatetruecolor(640, 480);
for ($x = 0; $x < 400; $x++)
{
for ($y = 0; $y < 400; $y++)
{
//getting colors at particular pixel point
$rgb1 = imagecolorat($i1, $x, $y);
//Splitting the colors into [...]



Php code to replace brackets in a particular text

 You may be faced with a situation to remove text inside the bracket,wonder how it can be done.. it can be easily done by preg_replace function

Here is the preg_replace function code to replace text inside brackets(along with brackets)by freespace
$text1=preg_replace(”/(\([A-Za-z0-9.',()]+)\)/si”,””,$text);
Explanation of the code:
a)First ‘/’ and ‘/’ are delimiters
b)’(’  - this stats the replacing text should start [...]



Setting up a Php user agent for the script

The below post would explain how to set up a user agent for the script..
User agent is useful such that when you are indexing a site you are posed as a normal user instead of bot something like that..it can be used in proxies to a great extent..

To add useragent who can do this
a).htaccess method
.htaccess [...]



Undefined offset error in Php

Undefined Offset  error in Php occurs sometimes when these conditions satisfy
a)When there are empty variables in the script
b)and when the Error Reporting is set too much in Php.ini

If you do n’t want the error to display then you can simply set
ERROR_REPORTING(0);
at the top of the script which would turn of all Error Reporting.. or otherwise [...]



Setting a log file for Php errors

Setting a log file for Php errors..
Here is the tutorial about how to set up a log file for logging Php errors encountered during
the execution of the script

Steps to follow:
1)Go to /apache/bin
2)Open php.ini
3)Go to the line 309 or Find “log_errors” in “php.ini”
4)Simply replace “Off” with “On”
Now it would  be like log_errors=”On”
So the errors would logged [...]



How to make Tata Indicom Plug to Surf a little faster

To make your Tata indicom Plug to Surf Faster..
You can use Public DNS Servers instead of  DNS servers obtained automatically..
To change your DNS Servers to Public for Tata indicom
1.Go to  Network connections
2.Right Click on SXC-1080 (Tata indicom connection)
3.Click on Properties->Networking(Tab)
4.The Click on TCP/IP Protocol  and then Click on Properties
5.Click on use the following DNS Servers [...]