Connected to internet but unable to browse in IE,Firefox

Sometimes you may be connected to internet but your browser won’t work

To solve this issue there are two ways

a)You have to un-install any ad-ware software

b)You have to run these commands in “CMD” (Command prompt)

Resetting WinSock and TCP/IP to defaults:

TCP/IP stack repair options for use with Windows XP with SP2.*
*
For these commands, *Start, Run, CMD, OK* to open a command prompt.

Reset WINSOCK entries to installation defaults: *netsh winsock reset catalog
*

Reset TCP/IP stack to installation defaults. *netsh int ip reset reset.log*



Php code to extract filename from urls.

This code will be useful to extract the names of the files from url

For E.g http://unicode.org/charts/PDF/U0B80.pdf

//Url to extract
$url='http://unicode.org/charts/PDF/U0B80.pdf';

//Code
$file1=preg_match("#(.*)\/(.*)(.pdf||.doc)#",$url,$file2);
$filename1=$file2[2];

//Outputs U0B80.pdf
echo $filename1;

This would output U0B80.pdf



Replacing urls with a href link in Php


Replacing urls with a href link

This code is used to replace any urls with links

E.g

“http://google.com is a good site ” will be “
http://google.com

is a good site

$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "\\0", $text);


Paste Disabled in Windows

A workaround for Paste Disabled in Windows

Step 1. Copy as usual
Step 2. run>clipbrd.exe
Step 3. Save as .CLP file to a folder
Step 4. Empty the Clipboard



Today is a special day


Here are some calculations about today=92s date which says an importance of
it.

09-09-09 i.e. 09-Sep-09

Sum of 09+09+09 =3D 27 =3D 2+7 =3D 9
This is 252 nd day of the year i.e. 2+5+2 =3D 9
This is September month and total characters of September are 9 .
Today is Wednesday and total characters of Wednesday are 9.

This kind of an occasion will not occur in next 1001 year. So enjoy this
day. Just like every day



Uploading a entire folder by FTP using Php


Php code to upload an entire folder via FTP


function ftp_uploaddirectory($conn_id, $local_dir, $remote_dir)
{

  ftp_mkdir($conn_id, $remote_dir);
  $handle = opendir($local_dir);
  while (($file = readdir($handle)) !== false)
  {
    if (($file != '.') && ($file != '..'))
    {
      if (is_dir($local_dir.$file))
      {
        ftp_uploaddirectory($conn_id, $local_dir.$file.'/',
$remote_dir.$file.'/');
      }
      else
        $f[] = $file;
    }
  }
  closedir($handle);
  if (count($f))
  {
    sort($f);
    @ftp_chdir($conn_id, $remote_dir);
    foreach ($f as $files)
    {
      $from = @fopen("$local_dir$files", 'r');
      @ftp_fput($conn_id, $files, $from, FTP_BINARY);
    }
  }
}

//FTP Login Detauls
$ftp_server = "127.0.0.1";
$ftp_user = "XXXXXXX";
$ftp_pass = "XXXXXXX";

// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to
$ftp_server");
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
    echo "Connected as $ftp_user@$ftp_server\n";
} else {
    echo "Couldn't connect as $ftp_user\n";
}
echo "Current directory: " . ftp_pwd($conn_id) . "\n";

//Directory details local dir files are to be uploaded to Remote dir
$local_dir='a1/';
$remote_dir='a2';

//Function for uploading directory
ftp_uploaddirectory($conn_id, $local_dir, $remote_dir);