Entries for the ‘Code’ Category

Using ldap_rename Properly to Move Objects

Just today I needed to move several thousand Active Directory users from one OU to another and so I needed a quick way to script this. Looking over at the PHP pages, the ldap_rename function is very poorly documented and so I thought that I’d take a moment to give better detail of the function.

Moodle 2 Public Feedback Templates Permission

Due to the way in which roles and permissions are handled in Moodle version 2.0 upwards, tutors by default can no longer create global public templates which has become increasingly frustrating as we’ve gone along with our upgrade. The easiest way to get around this is obviously to add all of your colleagues to a […]

PHP Lightweight Mobile Device Device Detection

>After experimenting with various methods of mobile device detection, I’ve eventually come up with what I think is a quick and easy solution which can be done in just three lines of code. $mobile = 0; $devices = array(‘iPhone’, ‘Android’, ‘Windows Phone’, ‘iPod’, ‘webOS’, ‘Symbian’, ‘BlackBerry’); foreach($devices as $device) if (strstr($ua, $device) == true) $mobile = […]

Moodle 2.3 – Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

>This morning, a colleague of mine contacted me regarding an error that she received when she browsed to one of her courses. The error came up as ‘Coding error detected, it must be fixed by a programmer: PHP catchable fatal error’. Googling around, there were many people getting the same error with different debug details […]

CSS Tips & Tricks, Shorten Your Code

>Firstly, I would like to say that I absolutely hate untidy CSS and code of any kind. The tips that I would like to share with you here will hopefully help you to avoid several calamaty errors that will make your site load more slowly and much more difficult to fix when something goes wrong. […]

Performance Checking ob_start(“ob_gzhandler”) in PHP

>Since there seems to be a small debate on the Internet as to the usefulness of ob_start(“ob_gzhandler”) in PHP, I thought that I would conduct a little experiment of my own to see if in the real world it actually does make any difference. There is a valid argument that running this will actually introduce […]

PHP 5.4.1 LDAPS Fix

>After taking a bit of a break from blogging, I decided that it was time that I should do something again. Anyway, last month I took a stab at upgrading PHP to version 5.4, which contained some nice little features and performance improvements. Almost everything went fine, apart from one little thing which made me roll […]

Correct Silly HTML Mistakes

>For those of you that have read my blog, you will know that I’m a little OCD about website performance – and so should you be. If your website becomes the source of frustration for an end user, more often than not you will lose your viewer and since the choice on the web is […]

PHP: mysql_fetch_assoc Vs. mysql_fetch_array

>Recently I’ve been doing a lot of work to optimise my work so that pages load more quickly and server load is reduced. When I was looking through to my database calls, typically I’ve always used the mysql_fetch_assoc function because it always returned less data than the mysql_fetch array which actually returns two arrays – one which […]

PHP 5.4 On The Way

>Earlier this month PHP 5.4 RC1 was released to the general public. No big deal you might be thinking, but actually I noticed a small change in the latest release that could potentially be of massive help. The note specifies ‘Added class member access on instantiation (e.g. (new Foo)->bar())’ which could be very handy if […]

  • Categories

  • Social

  • Tag Sphere

  • Recommended

  • Archives

Get Adobe Flash player