Monday, February 15, 2010

50 Extremely Useful PHP Tools

Some tools are useful

Friday, February 12, 2010

Quick Tip: Delete the Contents of a File without Removing and Recreating It

Do all this from the command line or terminal.

This will create a new file named t whose contents is the word "test":
$] echo "test" > t

more will display the contents of the file:
$] more t

Here's the new trick I learned. cat reads the contents of /dev/null (which contains nothing) and > writes this into t
$] cat /dev/null > t

Now t contains nothing:
$] more t

Get rid of it (don't do this to your logfile)
$] rm t

Another command :
$] > file.txt
$]echo > something.txt
$]echo "" > something.txt

for windows:
$]copy con > file.txt
$]copy nul > file.txt