Archives
May 19th, 2006 — Uncategorized
Literate programming in PHP?
April 11th, 2006 — PHP
Having come across mentions of it and seen pages of Knuth’s work, I became curious about literate programming. For those who have not come across it before, literate programming (LP) is an approach that mixes code in with extensive documentation to create something that is human readable and similar to a book.
So far I’ve encountered no instances of people using literate programming when writing PHP. Do you know of any?
Improved Wordpress related posts plugin
April 10th, 2006 — Algorithms, Site related, Web related
I’ve always liked the idea of having related entries shown - it’s a smart system of navigation and helps explore the knowledge available. Hence the first plugin I installed on this Wordpress-based blog was Related Posts by Alexander Malov & Mike Lu.
The aim behind the related posts plugin is to show similar entries already made on your blog, regardless of their category. Think of it as displaying search results before the reader has searched. That’s how useful it can be if it works.
However, the Wordpress plugin did not give very good results when used on this site. Upon investigating the code, I discovered it was only using the post’s URL to compare the current post with other entries. Since my weblog URLs are based on the page title, which on this site doesn’t always highlight keywords from the entry, this was unsurprisingly not proving effective.
The plugin provided the option for you to put hidden keywords in your post which would be used. However I didn’t want to go back and add keywords to my old posts. Not to mention I’d forget the standard keywords between writing posts
Tagging is a job for the computer, not a human…
So I’ve hacked up a modified version, which takes the post content, and calculates word frequency using weightings that can easily be modified (lines 57-62 of the code) for different parts of the post (eg URL, title, content). It then uses these details to match against the MySQL full-text index, (hopefully) returning more relevant results.
The script currently does not use any stemming algorithm or match against category IDs. Those are the most obvious features to add but the latter would require the MySQL query being reworked, and it was bedtime!
If you want to see the MySQL full-text ranking (as shown on this site next to each related posts link at present on this blog) to give you an idea of the certainty of each match being shown, uncomment line 161 in related-posts.php.
The code is not supported and was hacked because I was curious about recommendation algorithms. Improvements or suggestions are welcome. You are free to use and modify this code.
Question: Is there some way to manage file uploads like above from within Wordpress? I’ve uploaded it manually as the ‘upload’ box on the “Write Post” screen said a php file wasn’t a valid image!
Contact Me
March 26th, 2006 — Uncategorized
If you need to say anything, here’s the way to do it. I can’t promise to reply to all emails but I do try.
Back (subtitled: MT is gone for good)
March 25th, 2006 — Site related
Finally I have a blog I can write to again.
The reason for the delay was changing hosting company (the subject of a future post) and moving to one that didn’t support PostgreSQL. I was running an ancient version of MovableType and didn’t have the MySQL schema available, and when I contacted Six Apart they said they couldn’t help.
Reverse engineering a database schema wasn’t my idea of fun, and since the Movable Type version was very old I decided to move. Not being able to make up my mind I have installed Wordpress, despite my previous reservations (and current ones - do these guys know anything about code architecture - the number of includes to dig through from index.php to find any ‘working code’ - or commenting code?) which is working, and an extra PHP file to handle rewriting all the old URLs.
So apologies to any of you who have tried commenting or searching the weblog in the past 3 months - it’s back working now and I will change from this default Wordpress theme once I get my head round things!
About
March 11th, 2006 — Uncategorized
My name’s Peter (as you’ve no doubt already guessed) and I live in the UK.  I run a web development company, specialising in online ticketing solutions.  We also build most kinds of web applications such as content and information management systems.
This site is fairly temporary, a transitional state between MovableType and something I find which fits my needs. Â Unfortunately the move to Wordpress lost much of my Technorati ranking…
Wordpress appears to have some of the features of a content management system, and as what I’m looking for is a structured wiki with the ability to view content date-sensitively or as if browsing wikipedia, I need to see if Wordpress will work for me. Â Judging by my rate of posting since moving from MovableType the answer is a resounding ‘No’. Â I dislike the code (WP Â 2.1 may be better) and the whole information architecture doesn’t fit my way of working.
Happy What?
December 23rd, 2005 — Site related
Seeing the logo over on the Drupal site started this off.

Oh pleeeaaaase. What’s got into everyone this year? The festival at this time is known as Christmas, therefore wishing Happy Christmas is correct. Countries such as Oman who don’t celebrate Christmas don’t have time off at this year, so Happy Holidays rubs their nose into the dirt even more.
Now assuming the fuss is because it’s a (supposedly) religious festival, if we’re going to call this Happy Holidays are members of other religions going to relabel their main festival to also be called Happy Holidays? Because you know I could get offended by seeing Happy Chanakuh or any islamic greeting, so they’d better change! Should I end up living in Saudi Arabia I hope they take note - they’d better not offend the minorities!
Perhaps more so, the U.S. festival of Thanksgiving should be changed so that one country’s holiday doesn’t offend everyone else. Being wished Happy Thanksgiving on mailing lists is so annoying; it’s not something I’ve ever celebrated or ever intend to celebrate. So rename it “Happy Thursday” and stop offending the rest of the world.
And how about the U.S. celebration of Independence Day? We don’t jubilantly mark winning the second world war every year or Nelson beating France, so cut your egos and stop celebrating beating the British. Grow up OK?
Thank you, and have a Happy Christmas!
Online co-ordination strategies
September 26th, 2005 — Web related
I don’t usually repost from other blogs, but this was too funny to pass over. “David Weinberger”:http://www.hyperorg.com/blogger/ was talking about “Recovery 2.0″:http://www.buzzmachine.com/index.php/2005/09/05/recovery-20-a-call-to-convene/ and the ways to co-ordinate to help those involved in Hurricane Katrina. “Here’s what he had to say”:http://www.hyperorg.com/blogger/mtarchive/004502.html:
How you think that coordination should happen says a lot about your view of the Web.
A Semantic Web approach would create an ontology of victims, relatives, disasters, relief efforts, locations, threats, supplies, routes, relief agencies, medical records, doctor appointment books, local bus schedules, and stock market data.
A Web 2.0 approach would create APIs among recovery services offered on the Web and wait for hackers to build something useful. Whatever the hackers create would include plotting something on Google Maps, a requirement for all Web 2.0 apps.
A microformats approach would spend a weekend coming up with a quick-and-dirty set of useful metadata, preferably modeled on Amazon.
The regulatory approach would ask the pharmaceutical, transportation and recording industries to come up with a set of guidelines for the distribution of relief supplies with the primary objective of making sure that they do not fall into the hands of terrorists.
Web 2.0 all the way ![]()
Google’s Terms of Service
September 16th, 2005 — Web development
This is bizarre! I was just creating a “Google Sitemap”:https://www.google.co.uk/webmasters/sitemaps/ for a “Florida vacation home rentals”:http://www.daystarvillas.com/ site I manage, and had to sign up for Google Sitemaps. Being a good boy, I read Google’s “Terms of Service”:http://www.google.com/terms_of_service.html
Now I’m not sure how many other people have read this, because its terms appear ludicrous. First up is the title: *Google Terms of Service for Your Personal Use*. I’m creating this sitemap for a client, and will be using this as my company’s account to manage his sitemap - invalid already?
Let’s just look at the next bit:
bq. Welcome! By using Google’s search engine or other Google services (”Google Services”), you agree [...] The Google Services are made available for your personal, non-commercial use only. You may not use the Google Services to sell a product or service, or to increase traffic to your Web site for commercial reasons, such as advertising sales.
Note that Google services include the search engine. Now I don’t know about you, but I certainly use the search engine to increase traffic to my web site for commercial reasons. Every commercial website does it and it’s stupendously important, that’s why the market’s flooded with unethical SEO companies.
So what’s Google saying? Commercial sites cannot post Google Sitemaps because this would be aiming to increase traffic by exposing more of your site to Googlebot?
I could make a guess and say what Google are talking about is people displaying their search results on their own website to attract traffic, but I don’t know what they are prohibiting. It appears most of the options Google is already used for.
Whatever the reason, it would be helpful if Google would clarify their terms to make what’s allowed clearer.
GTD: integrating emails?
September 11th, 2005 — GTD
I’ve just started reading Dave Allen’s Getting Things Done. It looks a great way to stay organised, however from the book I cannot see how to integrate email in with other tasks (eg if my todo list says “Reply to X” it would be good to link directly to that email).
Now, many people practicing GTD use Microsoft Outlook, a program I’ve never used (and because I have version 2000 and it’s Microsoft, don’t want to use). Thinking around the problem, I came up with the idea of shortcuts to individual emails - so I can drag an email onto my task list and it creates a link like @C:\path\to\emailclient.exe “”@ which when clicked opens that particular message.
I don’t know if this is the best approach of if there’s other tools available.
Like “punkey”:http://www.punkey.com/pivot/entry.php?id=1644, I have the idea that software cures all and I will test many different programs, twiddle and tweak the software until it suits me - which of course is a way to procrastinate instead of getting on with things I really need to do (Guess what: I didn’t realise that until I read his post)!
In the same way, I’ve been reading a few pages of the book and then surfing the net for ideas. As punkey so neatly puts it:
bq. Instead of _just doing things_ and getting it to work for myself, I surfed the net for tips and tricks. Of course that is not a bad thing, but it stopped me from really really implementing the system in my life and work. I kept seeing tips and thinking:”yeah I can do that, good idea!” and instead of implementing that idea, I made a note of it, dropped it and never looked back at it. Bad bad bad…
So first move, I’m cutting out reading as much as I can about GTD, surfing sites to find software that works, and concentrating on reading the book and doing the difficult bit (stopping procrastinating). To help me in this (findin a successful method to manage my tasks), what method have you found works best for GTD? Being a student and freelance web developer, personal and work life are mixed, and I’ll need to keep track of tasks while out at University. I’m thinking a paper solution while out, transferred to the computer when I get back, but I don’t know about email and other digital resources.
Update: There’s a post on “using Thunderbird for GTD”:http://entropicprincipal.blogspot.com/2005/09/using-thunderbird-to-get-things-done.html. Maybe I have to have two todo lists - one for email and one for everything else. That’s a pain for projects (where a client’s requests need dealing with along with project tasks I have identified)