Textpad PHP manual lookup tool
Posted by Howard Yeend in PHP, Productivity on February 1st, 2010
A little tip for those of us using textpad to develop in PHP. How often do you find yourself having to go back to PHP.net to check up on a function – is it ($needle, $haystack) or ($haystack, $needle)? I can never remember! With this tool I just need to highlight the function in textpad, press Ctrl-1 and up pops php.net in a new tab, opened on that function’s manual entry. Neat huh?
Here’s how:
The K-Means Clustering Machine Learning Algorithm
Posted by Howard Yeend in machine learning on January 24th, 2010
The k-means clustering algorithm is one of the simplest unsupervised machine learning algorithms, which can be used to automatically recognise groups of similar points in data without any human intervention or training.
The first step is to represent the data you want to group as points in an n-dimensional space, where n is the number of attributes the data have. For simplicity let’s assume we just want to group the ages of visitors to a website – a one-dimensional space. Let’s assume the set of ages is as follows:
{15,15,16,19,19,20,20,21,22,28,35,40,41,42,43,44,60,61,65}
Now there are a number of ways we could separate these points out; one obvious way that springs to mind is simply to iterate over the set and find the largest gap between adjacent ages. For some sets this can work quite nicely, but in our case it would give us quite unbalanced groups; 15-44 and 60-65, the latter containing just 3 points, and the former being far too broadly distributed.
Using k-means clustering we can obtain more tightly defined groups; consider the set {1,2,3,5,6,9} – using the simplistic greatest distance technique we gain two sets {1,2,3,5,6} and {9}, while the k-means algorithm produces a grouping of {1,2,3} and {5,6,9} – more cohesive clusters with less dispersion of points inside the groups – k-means tries to minimise the sum of squares within a cluster:

Notice how in the first set of clusters the outermost points of the first cluster are quite far away from the middle of the cluster, while in the second set, the points in both clusters are closer the center of their groups; making these clusters more well-defined, less sparsely populated.
Now let’s have a look at the algorithm and work through the example age data to see if we can get a tighter grouping than 15-44 and 60-65 using clustering:
Top 2009 Facebook Status Trends
Posted by Howard Yeend in web on December 22nd, 2009
As google release their annual zeitgeist, and many other sites prepare interesting stats on web usage, facebook have today done the same and released an fascinating insight into the top facebook status update topics of 2009:
Facebook Chat Smilies
Posted by Howard Yeend in web on December 3rd, 2009
After the runaway success of my facebook chat history video (45k views, 100 ratings on youtube) I thought I’d follow up with a video explaining all the chat emotes you can use in facebook. There are some cool emoticons there.
Read the rest of this entry »
Wordpress Security Flaw – Admin Password Reset
Posted by Howard Yeend in Wordpress, hacking on August 11th, 2009
It is possible to reset the admin password in all versions of wordpress up to and including the most recent version 2.8.3.
This information comes from a milw0rm exploit.
Read the rest of this entry »
GIFexplode – community powered web development
Posted by Howard Yeend in PHP, web on August 2nd, 2009
Let me share with you a very cool story about strangers coming together and building something.
I was browsing reddit yesterday, and I saw a thread entitled “Someone needs to make a Firefox add-on that lets you step through animated gifs frame by frame“. I thought “hey that’s a nice well defined simple idea” – just the kind of thing I love, so I registered a nice-sounding domain name and started looking at how to use PHP to split an animated gif into its component frames – I figured it couldn’t be too hard. Read the rest of this entry »
PHP Developer CV
Posted by Howard Yeend in (misc), PHP on August 1st, 2009
Howard Yeend (howard.yeend@gmail.com) – Experienced PHP Engineer
Availability
Not currently seeking work. Sorry!
Facebook Chat History
Posted by Howard Yeend in Productivity, hacking, web on July 24th, 2009
A little video I made with some instructions on how to get facebook chat history, even if your friends are offline.
It’s always really annoying when you remember that a friend sent you a cool link but they’re not online any more. With this facebook tweak you can bring up the chat history.
Facebook only stores chat history for a few days though, so there might be no history to retrieve.
This is an extension of my facebook hacks page.
PS: Sorry the text is so small on the vid, put it fullscreen and you can read it better :0)
PHP error handling
Posted by Howard Yeend in PHP on July 5th, 2009
Does this type of error handling code look familiar?
function doFunction($var) { if(is_numeric($var)) { /* do some stuff*/ } else { return -1; } }
BLEH. How ugly is that? There’s no indication whether -1 is actually an error or a valid return value, or what it means. And other functions might use false to indicate errors so there’s inconsistency. So I’ve written a very simple function to help you give meaningful PHP error messages.
Read the rest of this entry »
PHP 5.3.0 Released!
Posted by Howard Yeend in PHP on July 1st, 2009
If you’re still stuck in the old PHP 4 days, please please please take today’s release of PHP 5.3.0 as your cue to start learning about the wonderful world of object oriented PHP 5.
5.3.0 isn’t a hugely interesting release, but getting your PHP4 code compatible with 5 will ease the process when PHP 6 comes along. PHP6 is really where it’s at:
What’s out:
No more register_globals (finally)
No more magic_quotes (you kinda liked magic quotes? Admittedly it was handy, but when you think about it, having code that may or may not be sanitised depending on a php.ini setting is a Bad Idea™)
No more HTTP_GET_VARS and cousins. Just change to $_GET etc and you’re fine.
What’s in:
A bunch of minor fixes aaand:
Namespaces – so we can section off bits of code properly. Woohoo! more info here.
Short post today I know, but I’ve got some real coding to do :) If you’re not doing anything better, go download PHP and have a play with it.
