I am Hack Sparrow
Captain of the Internets.

Archive for March, 2010

PHP setcookie() or PHP header(‘Location:’) Not Working – With Solution

The PHP setcookie() and header() should be called before ANY browser output. If there are any echo or print calls, or any accidental whitespaces, those functions just won't work. If it works on your localhost (strangely it does under some conditions!) but not on your server, check for the no-output-before-headers violations and fix them to get them working. HTTP headers should be se ...

How to Zip and Unzip in Linux: The Zip and Unzip Linux Commands

To create ".zip" files in Linux, you use the zip command. To unzip ".zip" files, you use the unzip command. Here are some common uses of the zip and unzip commands in Linux. To zip a single file: [bash] $ zip myfile.zip myfile.txt [/bash] ...

Top 10 Signs of an Idiotic JavaScript Developer

If you are interviewing someone for JavaScript developer, and discover the majority of these ten points in the process, you don't want to hire the candidate. Has ...

Get ASCII value of Character, Convert ASCII to Character in JavaScript

To get the ASCII value of a character, use the charCodeAt instance method of the String JavaScript object. Example: [js] var s = 'A'; console.log(s.charCodeAt(0)); [/js] To convert an ASCII value to its corresponding character use the fromCharCode static method of the String JavaScript object. Example: [js] console.log(String.fromCharCode(65)); [/js] ...

How to Delete Directories Even if They Are Not Empty in Linux

You probably know that is the bash shell command to delete directories in Linux. But the command will delete the directory only if it is empty. [bash] $ rmdir boringpics rmdir: boringpics/: Directory not empty [/bash] Would you need to traverse into a 10 level deep directory structure and delete the files in the subdirectories so that you can delete the top directory?. ...