Press "Enter" to skip to content

Posts published in December 2009

mySQL select multiple ids

SELECT * FROM tablename WHERE `active`=’1′ AND `id` IN (‘107’ , ‘125’ ) ORDER BY `id` DESC LIMIT 12

Force Download in PHP

This script works in all browsers, including Internet Explorer! 🙂 [code lang=”php”] if (strstr($_SERVER[‘HTTP_USER_AGENT’],”MSIE”)) { header(“Pragma: public”); header(“Expires: 0”); header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”); header(“Cache-Control: private”,false); header(“Content-Type: application-download”); header(“Content-Disposition: attachment; filename=\””.basename($filename).”\”;”); header(“Content-Transfer-Encoding: binary”); header(“Content-Length: “[email protected]($ab_file)); set_time_limit(0); } else { header(“Content-type: application-download”); header(“Content-Length: “.filesize($ab_file)); header(“Content-Disposition attachment; filename=”.$filename); } readfile($ab_file); [/code]

Remove an onRelease Handler

After creating a onRelease handler in Actionscript 2 as follows: myMovieClip.onRelease = function() { doWhatever(); } ..you then want to remove the handler for whatever reason, you can remove it like this: delete myMovieClip.onRelease;

Xmas tree!

Hello everybody! I have put up my “work xmas tree” on my external harddrive at work. It is a little USB powered Xmas Tree that changes colour every few seconds! You like? 🙂

shortText function toggler in php

I often have to show a shortened version of a news item and then a link to show the entire news article or whatever. Here’s a way to get that short text! [code lang=”php”] function shortText($text, $length) { if( strlen($text) > $length ) return substr(preg_replace(“/(]*>)/”, “”, $text), 0, $length).”…”; return…

ak script

www.andrewodendaal.com/ak/ ran a webscan today returning results of online sites and has retrieved a list of a few thousand items every half hour. The test will run until a softcap is reached at 52K.

PHP – file() lines

[code lang=”php”] $lines = file(‘all-words.txt’); foreach ($lines as $line_num => $line) { echo “Line number “.$line_num; } [/code]

Windows Live Writer – Beta2

Start writing content to your blogs from your Windows Desktop now. No need to login to your wordpress backend to post items anymore, there is now a decent desktop application that allows you to do exactly that! I have looked at it before but not until recently when Beta2 came…

Traffic Rush on iPhone

Traffic Rush Traffic safety is at your fingertips as RUSH HOUR is approaching. Strategically stop and accelerate rushing vehicles that are crossing the intersection! Sounds easy? Well, wait until you’ve tried! I downloaded a game to my iPhone called Traffic Rush by the people at Donut Games, how terribly addictive!…