fmod() in PHP is the worst !”#¤%&/()= function ever!

Tuesday, November 10th, 2009

I hate floating point artithmetic and I really hate fmod() in PHP. It's useless. fmod — Returns the floating point remainder (modulo) of the division of the arguments If you calculate 36 modulo 7.2?  What do you get? Zero, yes. 7.2*5=36. No remainder! What if you use fmod in PHP? $ ...

Today’s thoughts about programming languages

Wednesday, September 16th, 2009

Maybe some of you have heard me ranting about this already? I'm not productive enough in C++ and I feel too limited by Java A large chunk of Java frameworks seem to serve no other purpose than to workaround limitations in Java I believe (and hope!) that Java will cease to be the ...

Online PHP MySQL CRUD Scaffold generator

Monday, July 6th, 2009

I needed some simple PHP MySQL CRUD and found www.phpscaffold.com. Perfect!

Permute an array in PHP

Thursday, June 4th, 2009

I wrote this function recently when I could not find it in the PHP function list. Please provide any optimizations you discover! function permute($array) { $results = array(); if (count($array) == 1) { $results[] = $array; } else { for ...

Namespace separator in PHP

Monday, October 27th, 2008

Danne has the stuff, but I can tell that backslash is the buzz!

WordPress crack attempt this morning!

Wednesday, April 16th, 2008

When I got to work and viewed this blog I noticed that Sidebar Widgets was disabled. I thought "That's weird!" When I tried to login to the administration interface I was told that my WordPress database needed upgrading. I thought "That's weird!" Some further investigation revealed that someone managed to upload a ...

Andi Gutmans: “Java is losing the battle for the modern Web”

Friday, March 28th, 2008

Andi Gutmans (of PHP fame) has written a very interesting blog post about Java's future on the web. The article is called Java is losing the battle for the modern Web. Can the JVM save the vendors? He gives some good arguments for using a LAMP stack for web ...

MySQL support for UTF-8 in PHP

Monday, December 10th, 2007

Originally published in Swedish in my Folkmun.se Blog, a handy tip to make sure that you are reading and writing UTF-8 when connecting to a MySQL database: mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER SET utf8")