Sunday, September 20, 2009

0 comments

How to Block Websites

Worried about your kids surfing habit? Here are a few ways to block access to sites from your computer. These methods aren't very difficult to circumvent. But nevertheless, it provides a first line of defense for you to protect your kids.

Block Websites using Windows HOSTS file

Windows HOSTS file can be used to completely deny access to a website from a computer. Here's how it can be done -

1. Locate the HOSTS file.
In Windows XP and Vista it is in C:\WINDOWS\system32\drivers\etc\
In Windows 2000 C:\WINNT\SYSTEM32\system32\drivers\etc\
In Windows 98 and ME it is in C:\WINDOWS\

2. Open it in Notepad and find the line 127.0.0.1 localhost at the bottom. Add the following lines below it.
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 www.orkut.com
127.0.0.1 orkut.com

The above lines will block facebook and orkut. Include sites with and without "www". Try all possible combinations for accessing the website and enter them in the list; for eg, to deny access to yahoo websites, see the list below.

127.0.0.1 www.yahoo.com
127.0.0.1 yahoo.com
127.0.0.1 in.yahoo.com (use your regional yahoo domain here like, "in" is for India, "mx" is for Mexico etc)
127.0.0.1 mail.yahoo.com
127.0.0.1 login.yahoo.com

3. Save the file.
This will block the entered sites from being accessed by any browser from your computer.

4. To restore access, just delete the lines.


Block Websites in Firefox

Firefox has a nice addon, BlockSite, which can be used to block sites. The obvious disadvantage is, it only works with Firefox. So if Firefox is the only browser installed in your machine, this should be enough.

Conclusion: The advantage of using the HOSTS file is its simplicity and no additional software is needed. As I said before, these methods can be circumvented. If you are very serious about this, consider using commercial third-party software.
Sites can also be blocked with OpenDNS, your router settings, or with third-party software. These are more advanced which I'll try to cover later.

Saturday, September 19, 2009

0 comments

Blog Monitoring methods using Google Analytics


Google Analytics is a free service from Google that we can use to monitor our blog, traffic and all activities from our visitors and it's shows in statistic data (number and ghraphic). The informations is very useful to improve our blog, that why I integrated my blog with Google Analytics with no charge.
Google Analytics help me to knowing what keywords that send visitors to my blog, what article that most of my visitors reads and contents that bring most visitors.

Benefits using Google Analytics:
  1. Great Analysis. Google Analytics have all features more that you can imagine from an analytics tool. Google Analytics give you data to help you manage and improve your blog. And, all that data available on PDF or Exel or sent to you via email.
  2. Easy to use it. It's easy to use Google Analytics, even an internet beginner, it's provide maximum result that we can expect.
  3. We can use it to measure several sites size.Google Analytics run on the same server with Google. From the site/blog with high traffic to site/blog with low traffic, Google Analytics provide consistent services.
  4. Integrated With AdWords. If you have an AdWords account, you can use Google Analytics right from your Google Adwords interface.
  5. Integrated With Adsense. If you have an Adsense account you can track your Adsense activities from Google Analytics. Google Analytics provide you what traffic source, contents or keywords that give you adsense clicks.
  6. Track Your Promotions. Google Analytics track all your online promotion, from your email to keywords, whatever the searh engines or site/blog that drive visitors to your site/blog, it's from search engines (Goolge, Yahoo!, Bing, etc) or from another site/blog or from any country or with other ways.
  7. You can see how your visitors interactions. You can see how long you visitors stay on your article, what article have high visit and what article with less visitors.
  8. Save. Google taking care people trust very serious, and guarantee your privacy data. Google understand that your site/blog analytics data is very sensitive, so Google give a great protection.
  9. And nore benefits for us if we using Google Analytics.It's help us as we have our own professional blog analytics

Friday, September 18, 2009

0 comments

7 Reasons to Read the Glorious Quran

(1) Intimate:

It dares you to disprove it. How? It says that humans can not write a book like this even if they pooled all their resources together and got help also from the spirits. The Quran said this fourteen hundreds years ago and yet no one has been able to disprove it. Billions of books have been written - but not another one like the Quran.

(2) Incorruptible:

It is the only religious sacred writing which has been in circulation for such a long time and yet remains as pure as it was in the beginning. The Quran was kept intact. Nothing was added to it; nothing was changed in it; and nothing was taken away from it ever since it was completely revealed 1400 years ago.

(3) Unsurpassable:

The Quran is God's final revelation to humankind. God revealed the Torah to Moses, the Psalms to David, the Gospel to Jesus, and finally the Quran to Muhammad. Peace be upon all of them. No other book will come from God to surpass his final revelation.

(4) Indisputable:

The Quran withstands the test of time and scrutiny. No one can dispute the truth of this book. It speaks about past history and turns out right. It speaks about the future in prophecies and it turns out right. It mentions details of physical phenomena which were not known to people at the time; yet later scientific discoveries confirm that the Quran was right all along. Every other book needs to be revised to accord with modern knowledge. The Quran alone is never contradicted by a modern discovery.

(5) Your Roadmap for Life and Afterlife:

The Quran is the best guidebook on how to structure your life. No other book presents such a comprehensive system involving all aspects of human life and endeavor. The Quran also points out the way to secure everlasting happiness in the afterlife. It is your roadmap showing how to get to paradise.

(6) God's Gift of Guidance:

God has not left you alone. You were made for a reason. God tells you why he made you, what he demands from you, and what he has in store for you. If you operate a machine contrary to it's manufacture specification you will ruin that machine. What about you? Do you have an owner's manual for you? The Quran is from your function for success lest you fail to function. It is a healing mercy from God. It satisfies the soul, and cleans the heart. It removes doubts and brings peace.

(7) Your Calling Card to Communicate with God:

Humans are social creatures. We love to communicate with other intelligent life. The Quran tells us how to communicate with the source of all intelligence and the source of all life- the One God. The Quran tells us who God is, by what name we should address God, and the way in which to communicate with God. Are these not seven sufficient reasons for reading the Quran?

Saturday, September 12, 2009

0 comments

Maruti Suzuki Ritz Specifications | Maruthi Ritz Prices in India

Maruti_ritz_car

Specifications of Maruti Ritz Car

  • 1.2 litre petrol engine capacity
  • 1.3 litre diesel engine capacity
  • Long spark plug life
  • Efficient fuel system
  • Low emission engines
  • 4 cylinder K series engine
  • Performance is 85 PS of peak power

Maruthi Ritz Price in India

Currently Maruti Rits comes in various models. And following are the prices as per the research. Like I said, the price will be in between 3 to 5 Lakh.

  • Maruti Ritz ZXi - 479,999
  • Maruti Ritz VXi - Rs 419,999
  • Maruti Ritz VD - Rs 498,999
  • Maruti Ritz LXi - Rs 389,999
  • Maruti Ritz LDi - Rs 464,999

Note that the price and specifications may depend on the Ritz model you opt for. Overall the price was as expected and already many of the Indian people have started booking it online and via Maruti car stores.

0 comments

Get Vodafone Caller Tunes for Free

I thought this might interest the people around here, Vodafone Caller tunes (also known as Caller Tones) are quite popular actually. You can subscribe to caller tunes on a monthly basis by calling the customer support or activating the subscription via sms. But right now, here are some free vodafone caller tunes that can be used across India. All you need is to make a call or send an sms given below.

vodafone_caller_tones

Free Vodafone Callertunes online

There are two working methods I've found online that will subscribe you to Vodafone caller tunes, try out both of them and I am sure any one of them will work for you. I searched a few places and some of the people in South India have been happy to get this trick work from their current location.

Method 1 : Dial 54206090 from your vodafone cell phone and you will get a free Caller tune instantly. This trick is working for Kerala Vodafone users. Period!

Method 2 : Activate the caller tune by sending an SMS to the toll free number 55655. Send FREE to 55655 and you will have a vodafone caller tune set for your mobile number.

0 comments

Smallest Nokia Cell Phone In the World

Nokia have been well known for developing some awesome cell phones, in my place Nokia Cell phones are the preferred mobile brand, other well known cell phones used are from Sony Ericson, Motorola and so on.. Anyway have you seen the Smallest Nokia cell phone picture? Do you know the smallest Nokia mobile phone model? If you've any guesses then forget it 

Check out the smallest Nokia Cell Phone in the world:

nokia_smallest_cellphone

Isn't it really very small? This phone is Nokia 0.3710 which is smaller than the coin and it's incredible mini size makes it tough to type any text from the phone, perhaps you have to use a toothpick (just like a PDA  ) or the cell phone might break 

0 comments

How to recover lost EXCEL password

The only way to protect the confidential excel documents from unauthorized access by others is to password protect them. Microsoft office excel 2003 and the latest 2007 version have the facility of password protection. There are two types of password protection :

  • read only : which allows others to only read the excel spreadsheet and they can't edit them
  • password protected : users with correct password can only access

How to set password for excel Spreadsheets

Either you are using Microsoft office 2003 or 2007 , the method remains the same.

To enable read-only protection:

1. Open the file.
2. On the Tools menu, click Options, and then click Security.
3. In the Password to modify box, type a password, and then click OK.
4. In the Reenter password to modify box, type the password again, and then click OK.

To password protect a file:

1. Open the file.
2. On the Tools menu, click Options, and then click Security.
3. In the Password to open box, type a password, and then click OK.
4. In the Reenter password to open box, type the password again, and then click OK.

You might have noticed so many users especially employees of a company will be using this feature to password protect confidential excel documents. Just imaging What will happen if they forget the password . No one can access the file without knowing the previous password. Even a careless mistake can make the employee to loose his job.

Excel password Recovery Tool

Although you can set password to the excel documents , you can't recover the password in case you forgot or lost the password. Never wonder now you can easily recover the lost password of excel documents with excel password recovery tools. With EXCEL password recovery tool you can easily recover your lost or forgotten password without much difficulty. You can even unlock password-encrypted Microsoft Excel documents quickly as possible.


In order to recover your lost or forgotten password just follow the simple steps :

First download and install the free office password recovery tool in your PC. Once you have finished installing the software , you can begin the recovery process. During the recovery process you can easily decrypt the spreadsheet or make it to display the original document password.

In this Excel password recovery tool , two options are available :

  • 100% Instant Document Decryption
  • Recover the Password to Open
0 comments

How to View Locked Album photo and scrapbook of any Orkut Profile

You can easily view all locked photos and scraps on orkut by just adding Adds-On in your browser, to unlock Album and scraps of any orkut profile just do following steps. This is a sure way to get it.

Step 1. You must download firefox browser, because it has the capability to keep Adds-on script. This is a free browser. You can download it from MOZILLA. This browser is more powerful than internet explorer browser. If you are already using firefox, it's OK.

Step 2. Download Greasemonkey . This is an adds-on for firefox browser. Install it for firefox. Close all firefox browser after installing. Open firefox browser, you will see a monkey figure at the bottom of browser. Insure it is glowing. If this is glowing, it's O.K. This is to insure that user-defied java script code will run on it.

Step 3. Now use java script code for various purpose, all script will work fine. Click here to install View Locked Scrapbook Script. After enabling it, open orkut.com in firefox browser. Now you can view locked scrapbook of any profile.

Step 4. To view any locked album click here and install script. This required script to view photo of locked album of orkut may change frequently. so use latest script from http://userscripts.org.

Both the script is available at http://userscripts.org . you can do various other works from different scripts like you can scrap all your friends by single click (HTML included). You can make same new topic in all of your community by a single click or you can send friend invitation to all members of a community etc. Just check here

Above methods is also misused to hack orkut, and it is misused for spamming everywhere. Orkut team should work hard to fight from this scripts.

0 comments

Tips to prevent your Orkut Account

Here are some of the tips for Orkut users to prevent from getting their own Orkut profile hacked!

Orkutting in Public Computer

Make sure you do not check the button "Remember Me" when you log in to your Orkut account from a publicly accessible Internet (Cyber Cafe).Someone might peep when you are typing the password,in such case strong password with numbers and capitalization are recommended.

Anti Keylogger

If you are visiting a local browsing center then try to check the programs installed in the computer.If you find keylogger (which stores password) then remove it immediately (Complain about this to the person who manages the browsing center).You can also install a Anti Keylogger to protect and safely log in to your Orkut account.Another solution for this is to make use of On Screen keyboard which is installed on every Windows Operation System.

Never use Javascript code

If a friend scraps you to copy the javascript code and paste it in your browser address bar then re check the Javascript to understand the code.If you are familiar with the code then  make a search or better ignore such javascript scraps,no matter what they do! They are a time waster..

Re-Check Links via Scraps

Some people will blindly click on the website links sent by anonymous orkut user to the scrapbook.Re check the links once again and make sure you do not enter your password to any fake login page or give out any of the Orkut details if you are visiting a website or any link via orkut scrapbook.

Strong Google Gmail password

If you are having a password which is easy to remember then change is as soon as possible.Because hackers can make use of programs such as "Brute Force" to easily detect your password (If the password is short and is a dictionary word).Make use of Password generators and take a note of your password.Also make sure you have a good security question & answer which none of your friend can easily guess.

Check the address bar

Everytime you visit someone's profile via links or any orkut community then check the address bar to ensure that you are on Orkut.com website.If you detect any different url then do not panic, immediately change your orkut password!

Stay away from Orkut Strangers

If someone requests for friendship then checkout his/her profile, check scraps, orkut communities and mutual friends joined by the person.So that you get a clear idea if the person is genuine or a orkut hacker who want to abuse your profile.

Maintain Orkut Privacy Profile

Keep your profile private if you are too much concerned about your privacy.Generally this will help you a great deal if you are orkutting to connect with Well-Known friends as it eliminates anonymous scraping and friendship with strangers!

Remember to Logout

Make sure you do NOT forgot to Log out from the Orkut website if you are accessing Internet from a public area.Once again double check Orkut,Gmail and Google services.

0 comments

10 things you should know about Nokia


Nokia is the world's largest manufacturer of mobile telephones. Its total market share is around 38% . It is a Finland based company with its branches in more than 100 countries. Nokia produces GSM, CDMA, and W-CDMA (UMTS) mobile devices. It also offers Internet services for its mobile users, which include music, maps, media, messaging and games.

Nokia

Nokia is also the fifth most valuable global brand in the Interbrand/BusinessWeek Best Global Brands list of 2008. It is ranked 85 in terms of revenue in fortune 500 companies. Even I am also using Nokia cell phones from last 6 years. Today I have compiled 10 things that you should know about Nokia. So here comes the list.







  • The name of Nokia originates from Nokia town of Finland which is named after river Nokianvirta which flows through the town.
  • Nokia has been listed as the 20th most admirable company in the world by Fortune's list of 2006 (1st in network communications, 4th non-US company).
  • If we reverse the name of Nokia it becomes "aikon" which is used in many SDK software packages, including Nokia's own Symbian S60 SDK.
  • Nokia phones do not start its call timers until the call is actually initiated( Except for Series 60 based handsets like the Nokia 6600 ) which is unlike most of the today's handsets.
  • Digit 4 never appears in any Nokia handset model number in Asia as 4 is considered to be unlucky in many parts of Southeast/East Asia.
  • Nokia's mobile phone User's Guides mostly uses the Agfa Rotis Sans font which is Nokia's corporate font and was originally designed by Eric Spiekermann.
  • The sms tunes available to users of Nokia phones are actually Morse code. "Special" tone in Morse code for "SMS", "Ascending" tone is Morse code for "Connecting People"(Nokia's slogan) and the "Standard" tone is Morse code for "M" (Message).
  • Nokia is currently the world's largest digital camera manufacturer because the sales of its camera-equipped mobile phones have exceeded those of any conventional camera manufacturer.
  • The world's first commercial GSM call was made in 1991 in Helsinki over a Nokia-supplied network, by Prime Minister of Finland Harri Holkeri, using a Nokia phone.
  • The ringtone "Nokia tune" is actually based on a 19th century guitar work named "Gran Vals" by Spanish musician Francisco Tárrega. The Nokia Tune was originally named "Grande Valse" on Nokia phones but later was changed to "Nokia Tune" around 1998 when it became so well known that people referred to it as the "Nokia Tune."
0 comments

Plane crashes cost insurers over $1 bn in 2009

Paris, Sep 8 (DPA) Aviation insurance companies are experiencing one of their worst years on record due to a number of costly plane crashes, according to information released at a meeting of global reinsurance companies in Monte Carlo.
According to estimates, three plane crashes this year will force insurers to pay more than $1.3 billion (930 million euros) in compensation.

The June 1 crash of an Air France Airbus in the Atlantic Ocean, in which 228 people died, is now estimated to cost about $747 million.

Added to this is are the costs of the February crash of a Colgan Air plane in the US ($354 million) and that of a Yemenia Airlines aircraft near the Comoros islands in late June ($239 million).

As a result, 2009 "will probably go down in history as one of the worst years ever for aviation insurance," the insurers said.

0 comments

NASA unveils first images from revamped Hubble

Washington, Sep 10 (DPA) NASA scientists Wednesday unveiled the first images taken by a revamped Hubble telescope, providing even crisper pictures of distant stars and galaxies.
The colourful images provide a taste of the Hubble's new capability after a servicing mission in May that installed new instruments and repaired broken ones that had hampered the world's most famous telescope.

Hubble has been orbiting Earth since 1990 sending back some of the most spectacular images of galaxies - helping scientists to place the age of the universe at 13.7 billion years, learn that black holes are at the centre of most galaxies, monitor planetary formation and discover that the universe is expanding at an ever-faster pace.

But despite its storied past, the Hubble looked set for the junk heap until the space shuttle Atlantis' repair mission that saw the installation of new instruments and the repair of existing ones to extend its life until at least 2014, and possibly beyond.

NASA had originally decided against the maintenance mission because of the risk involved and the pressures to complete International Space Station (ISS) construction by 2010, when the shuttle is to be retired. But US politicians and world astronomers fought successfully to keep alive the instrument that has expanded knowledge of space.

Among the most important work done on the telescope was the addition of a new camera. The Wide Field Planetary Camera 3 will allow astronomers to see deeper into space and to capture images across all three regions of the light spectrum - ultraviolet, visible and near infrared.

Another new instrument, known as the Cosmic Origins Spectrograph will break up light into its components and allow astronomers to study the large-scale structure and origins of the universe, including how galaxies, stars and planets formed and how elements developed.

0 comments

US man to run 5,000 km barefoot

New York, Sep 10 (RIA Novosti) US businessman Tellman Knudson hopes to raise $100 million for a charity by running across the the country barefoot, a media report said Wednesday.
The 32-year-old entrepreneur will start his 5,000-km barefoot run in New York. He intends to give the money collected during the run to nonprofit organisations and programmes across the country involved in rebuilding the lives of homeless.

Knudson's route is expected to pass through Cleveland (Ohio), Chicago (Illinois), Oklahoma City (Oklahoma), Saint Louis (Missouri), Houston (Texas), and to end in Santa Monica (California). To cover the distance, he plans to run 30-40 km per day, the Brattleboro Reformer newspaper reported.

Friday, September 11, 2009

0 comments

How to Install Google ads under posts

Installing ads under posts -

One to be remembered that this technique is not for only installing the ads, but also for installing banners, messages, subscription information, and others that are placed under posts. You also should know that the ads would not appear in the homepage, but under posts when the posts are displayed full by clicking the "Read More" link.

The technique used is usually as below:

 

<div class='post-body entry-content'>
      <data:post.body/>
      <div style='clear: both;'/> <!-- clear for photos floats -->
    </div>

 

Or some are like this:

 

<div class='post-body entry-content'>
<p><data:post.body/></p>
      <div style='clear: both;'/> <!-- clear for photos floats -->
    </div>

 

Both are right because the additional code <p>…</p> is HTML code for paragraph or for making different lines. To install the ads, messages, or anything else, you have to add the additional code like this:

 

<div class='post-body entry-content'>
      <data:post.body/>

<b:if cond='data:blog.pageType == "item"'>

     <p> Your ads code, banners, alert or anything paste in here! </p>

     </b:if>

<div style='clear: both;'/> <!-- clear for photos floats -->
    </div>

 

It's very easy, right? So you do not need to worry about Blogger Read More system, because you can adapt.

Need to remember, some ads codes such as Adsense, Adbrite, and others cannot be installed directly there, but you need to parse it. For this trick, you can read my old post about Placing Google Adsense Under The Posting.

Still confused how to install ads under posts? Below is the trick to make you easy to practice:

 

  1. Please log in to Blogger with your ID
  2. Click Layout
  3. Click Edit HTML tab. Then backup your template first
  4. Check the small box next to "Expand Template Widget"


  5. Find this code:

     

    <div class='post-body entry-content'>
          <data:post.body/>
          <div style='clear: both;'/> <!-- clear for photos floats -->
        </div>
  6. Please add the code in red and green printed:

    <div class='post-body entry-content'>
          <data:post.body/>

    <b:if cond='data:blog.pageType == "item"'>

         <p> Your ads code, banners, alert or anything paste in here! </p>

         </b:if>

    <div style='clear: both;'/> <!-- clear for photos floats -->
        </div>

  7. Click SAVE TEMPLATE button
  8. Done


0 comments

What will happen to your online life after you die?

Its off topic but the concept is so great I could not resist blogging it. A traditional business model implemented over the web in these Web2.0 times which is sure to succeed.

Before you die or any unfortunate incident occurs in your life, you make sure that all your assets, property goes into right hands. To take care of it, you make a will and assign a beneficiary to pass your assets to the correct person. Now try mapping it with the web. You have an online life. Don't you? You exist on Gmail, Hotmail, FaceBook, Twitter and numerous other services. You have some personal pictures stored on flickr, some lovely mails on your Yahoo or Gmail account which you would not want to go into any other hands. Ever wondered what will happen to your all these accounts in case you die or something happens to you?

Here comes Legacy Locker. Legacy Locker is a service that will store your credentials to mail services, social networks and other important services on the web and will pass them to a caretaker chosen by you in event of your death. It is kind of protecting your online life after death.

The service is not available yet and will be opening in April 2009. Of course there will be money charged for the service .The pricing is kept at $300 which can be paid as one time fee of $300 or yearly payments of $30.

The list of sites/networks that Legacy Locker has already covered is impressive. The list already includes Gmail, Flickr, Facebook, Paypal, Yahoo! Mail, Ebay, iTunes, ING, Snapfish, YouTube, AOL, Amazon, Kodak Gallery, Wordpress, GoDaddy, Hotmail, Netflix, Blogger, LinkedIn, Photobucket, 12seconds, Box.net, Friendster, TypePad, Party Poker, Mint, Twitter and many other sites.

The service seems to be useful. Let's see how many users consider it for managing their online identities after death.

0 comments

How to Download files in php

The following code snippet will guide you to implement the php code that will prompt user to download files in his browser window.


<?php
//download.php
//content type
header('Content-type: text/plain');
//open/save dialog box
header('Content-Disposition: attachment; filename="sample.txt"');
//read from server and write to buffer
readfile('test.txt');
?>




<!--List of Content Types
=====================

pdf   --  application/pdf
sig   --  application/pgp-signature
spl   --  application/futuresplash
class  --  application/octet-stream
ps   --  application/postscript
torrent  --  application/x-bittorrent
dvi   --  application/x-dvi
gz   --  application/x-gzip
pac   --  application/x-ns-proxy-autoconfig
swf   --  application/x-shockwave-flash
tar.gz  --  application/x-tgz
tgz   --  application/x-tgz
tar   --  application/x-tar
zip   --  application/zip
mp3   --  audio/mpeg
m3u   --  audio/x-mpegurl
wma   --  audio/x-ms-wma
wax   --  audio/x-ms-wax
ogg   --  audio/x-wav
wav   --  audio/x-wav
gif   --  image/gif
jpg   --  image/jpeg
jpeg   --  image/jpeg
png   --  image/png
xbm   --  image/x-xbitmap
xpm   --  image/x-xpixmap
xwd   --  image/x-xwindowdump
css   --  text/css
html   --  text/html
htm   --  text/html
js   --  text/javascript
asc   --  text/plain
c  -- text/plain
conf  -- text/plain
text  -- text/plain
txt   -- text/plain
dtd   --  text/xml
xml   --  text/xml
mpeg  -- video/mpeg
mpg  -- video/mpeg
mov   --  video/quicktime
qt  -- video/quicktime
avi   --  video/x-msvideo
asf   --  video/x-ms-asf
asx   --  video/x-ms-asf
wmv   --  video/x-ms-wmv
wmp  -- video/x-ms-wmp
wvx  -- video/x-ms-wvx
wm  -- video/x-ms-wm  
mp4    -- video/mp4
mpv2,mp2ve   -- video/x-mpeg2  
rv  -- video/vnd.rn-realvideo
fli,flc       -- video/fli      
3gpp,3gp -- video/3gpp
bz2   --  application/x-bzip
tbz   --  application/x-bzip-compressed-tar
tar.bz2 -- application/x-bzip-compressed-tar -->
0 comments

How to rename multiple files in a directory with php

The following example will tell you how to rename more than one file using php
<?
php
$dir = "C:\\vaseem\\rename_files";
$fileType = "mp3";
$charsToTrim = 4;
if($handle = opendir($dir))
{
$count = 1;
while (false !== ($file = readdir($handle))) // read files in directory one by one
{
if(is_file($dir."\\".$file))
{
$extension = substr(strrchr($file,"."),1);// get the extension
if(strcasecmp($fileType,$extension) == 0)// proceed only if it matches with the extension we have provided
{
$newName = substr($file,$charsToTrim); // generate new name for file
$success = rename($dir."\\".$file, $dir."\\".$newName); // rename the file
if($success)
{
echo $file." renamed to ".$newName;
echo "<br/>";
$count++;
}
else
{
echo "Cannot rename ".$file. " to ".$newName."<br/>";
echo "<br/>";
}
}
}
}
echo $count." files renamed
";
}
closedir($handle);
?>


You will have to set these 3 parameters:
$dir – Location of directory in which files are placed.
$fileType – Extension of files that you want to rename(mp3 or txt or doc any other)
$charsToRemove – How many characters do you wish to remove from the filename.

Set these and you are ready to rename. Remember that this script will only trim characters from start of the file name.
This means if you have set $charsToRemove = 5, a file with name "abcd_Plateau" will be renamed to "Plateau".


0 comments

How to fix php warning – "Cannot modify header information – headers already sent"

You must have seen this error message quite a lot of times.

Cannot modify header information – headers already sent

The following code sample will throw the same error:

//this will result in header error
<html>
<head><head>
<body>
<?php
header("Location:http://www.google.com");
?>
</body>
</html>
<?php ob_end_flush(); ?>


Outputting any html to browser before calling functions like session_start, header or any such function which sends http headers to the browser result in this error. This is because php does not wait for whole page to be generated, rather it renders the page in a linear fashion.Therefore sending any html/data before the http headers have been sent results in an error.

But do not worry.There is a workaround for this error.

  1. Turn the output buffering on.
  2. Let the whole script execute and collect generated data in its buffer.
  3. Output all data to the browser.

Php has output control functions which can be used for this purpose.

At the very start of your script put this line:

<?php  ob_start(); ?>

This will turn output buffering on. After this write whatever code you want. When you are done append another line in the end.

// this will not give the header error
<?php ob_end_flush(); ?>


The code now becomes:

<?php  ob_start(); ?>
<html>
<head>
<head>
<body>
<?php
header("Location:http://www.google.com");
?>
</body>
</html>
<?php ob_end_flush(); ?>


ob_start turns output buffering on as a result of which no data or headers are sent to the browser. Instead, all data is collected in
internal buffer. Calling the function ob_end_flush dumps all the buffer data to the browser.




Tuesday, September 1, 2009

0 comments

The best and worst way of saying the things

Check out the THE MOST ROMANTIC FIRST LINE, BUT THE LEAST ROMANTIC SECOND LINE

My darling, my lover, my beautiful wife,
Marrying you screwed up my life.

I see your face when I am dreaming.
That's why I always wake up screaming.

Kind, intelligent, loving and hot;
This describes everything you are not.

I thought that I could love no other --
that is until I met your sister.

Roses are red, violets are blue, sugar is sweet, and so are you.
But the roses are wilting, the violets are dead, the sugar bowl's empty and so is your head.

I want to feel your sweet embrace;
But don't take that paper bag off your face.

I love your smile, your face, and your eyes --
Damn, I'm good at telling lies!

My love, you take my breath away.
What have you stepped in to smell this way?

My feelings for you no words can tell,
Except for maybe "Go to hell"

What inspired this amorous rhyme?
Two parts tequila, one part lime

 

About Me

My photo
Hey guys this is Vaseem Ansari, 25 years old, Software & Web Developer, Blogger & works on Open Sources Technologies I love my family and my loved once very much. It takes a while for me to build trust in someone new. I am honest, thoughtful, and my friends tell me that I am wise. I would also say that I am stubborn. but I do learn from my mistakes. I'm Glad I'm Me No one looks The way I do. I have noticed That it's true. No one walks the way I walk. No one talks the way I talk. I am me. There's no one else I'd rather be! Have fun reading this blog and don't forget to subscribe to the feed to keep updated on the latest articles. Visit my Blog at http://www.VaseemAnsari.com/blog/

Followers