Monthly Archives May 2007

PHP: File Downloads HTTP Headers

In PHP you can provide file downloads by using a PHP page to “pass through” the file. Of course you could just link to the actual file, however this technique means your file can kept outside of your website root. Another advantage is you can integrate this system into a PHP based user/password system easily.
Now [...]

Away with Applications: The Death of Desktop

There is a great talk that went up on Google Videos earlier this month called Away with Applications: The Death of Deskop. In it the speaker, Aza Raskin points out that no work is carried out actually using the computers desktop. He also points out the failing of desktop applications, that you frequently need to [...]

PHP: Get First Index in Associative Array

The other day I was programming in PHP and needed to get the first index in an associative array. There doesn’t appear to be a built in function to deal with this so I wrote my own.
PLAIN TEXT
PHP:

function getArrayFirstIndex($arr)

{

foreach ($arr as $key => $value)

return $key;

}

Here's a bit of code you can test it on:
PLAIN [...]

JS: Execute JavaScript on Page Load

Recently I’ve been making an effort to improve my JavaScript skills, I’m not a JavaScript-Jedi yet but I have been picking up a few, tips, tricks and techniques.
One thing that I find extremely useful is using an init function to call other functions when the page has loaded. I have been using the nifty function [...]

Vim: Search and Replace, Insert new line

Vim has some really useful commands, especially search and replace ones. Unfortunately I'm always forgetting the finer details of how to use them so here's an example:
PLAIN TEXT
CODE:

:%s/$/\rthis is a new line

To break down whats happening above:

: switches Vim into command mode
% means we're going to apply this command to every line in our [...]