Google analytics code

Wednesday, February 13, 2008

PHP: Code snippet

I found this on a page written in japanese. Great for streaming files through php and not reveling their source.
http://phpspot.org/blog/archives/2008/02/phpdlphp.html

header('Content-Type: application/octet-stream');
header('Content-Disposition: filename=dl.zip');
header('Content-Length: '.filesize('dl.zip'));
echo file_get_contents("dl.zip");
?>

This will also post the size of the file so you know how long it will take for it to download.

Friday, February 8, 2008

Apple / OSX : Updating the hosts file

I'm in the process of migrating from a PC at work to a new iMac. There are a few servers with names that don't resolve properly. These were stored in the hosts file on windows.
C:\windows\system32\drivers\etc\hosts

On OSX it's stored in
/etc/hosts

The file is read only so you'll want to open it with sudo before bringing it into vim, or however you plan to do it with a GUI editor.