« July 2005 | Main | September 2005 »

August 30, 2005

Database query caching

I'm busy spending time adding more features to my PHP Application Framework called the Tshukudu Application Framework which currently is quite a liteweight PEARish framework for PHP4 and PHP5. It's moving towards dropping PHP4 in the near future.

I've spent some time fiddling with the idea of caching database query results to disk instead of to a memcached servers when in a shared hosting environment to reduce load on a database server when looking up data which does not change very often. By caching database queries, it reduces the amount of work the database has to do to look up data considering the larger the dataset, the more data has to flow between MySQL and PHP.

Quite surprisingly I stumbled across an article titled Caching PHP Programes with PEAR on O'Reilly written by Sebastian Bergmann. Interesting read none the less.

So I created a class called DB_Cache which currently just extends PEAR Cache as well as keeping a DB connection open for sending queries to. The Cache_Memcached connects to Memcached servers to retrieve and store data while DB_Cache (should more likely be called Cache_DB_File in reality) caches database result sets to a file on the filesystem via Cache (which it extends).

A couple ideas behind the framework is to provide functionality for speeding up PHP sites by having different levels of caching within a PHP application such as caching content from remote servers, caching database resultsets, etc.

Utilisation of the code looks something like:

<?php
require_once 'Tshukudu/DB/Cache.php';
$db_cache = new DB_Cache;
$users = $db_cache->query("SELECT * FROM users LIMIT 0,10", 'getall'));

Ugly but needs a slight rewrite to rather extend DB_MySQL in mycase instead of Cache.

August 29, 2005

An Illustrated guide to IPSEC

An Illustrated Guide to IPSEC provides various diagrams and content explaining how IPSEC works.

FastCGI and Movable Type

Brad Choate from Six Apart has placed instructions up on his website for running Movable Type using lighthttp and FastCGI.

Which in a way is great news as the Movable Type application is going to be flipping fast running via FastCGI once the essentials are loaded. :)

Brad this is super duper news!

Currently my weblog is running via the normal apache handler.  Will look into getting FastCGI support going next week.

August 25, 2005

Upgraded to Movable Type 3.2

Upgraded the blog to Movable Type 3.2 I will be tweaking the layout quite a bit more at a later stage.

movable_type_new_icons.jpg

Problems with Movable Type 3.2:

  • Commenting with TypeKey registration required of users does not ask users to login on the individual blog entry pages hence people can no longer post comments.

I've also submitted to Freshmeat the Movable Type 3.2 release which should make it's way onto the Frontpage at some stage.

UPDATE: Site Javascript Fix

Under templates, you will need to create a template called "Site JavaScript" and enter mt-site.js as the output file and save. Click on templates again and click the checkbox to the left of the "Site JavaScript" template and select "Refresh Template(s)" from the dropdown box which currently says "More Actions..." and click on go. Click on the "Site JavaScript" link and click "Save and Rebuild". TypeKey commenting works again after doing this.

I think the above quirk should be added to the "Known Issues" list of Movable Type for users upgrading their version of Movable Type.

Movable Type 3.2

The guys over at Six Apart have released Movable Type version 3.2 earlier this evening. It contains their 32 favourite features (26 if you see their list ;)) including their relaxing of their licensing by allowing users unlimited blogs on an installation which Mena blogged about in her post entitled Anil onstage at the Blog Business Summit.

Anil's currently talking about the latest version of Movable Type (3.2). One thing he's highlighting is the easy way to manage all your weblogs throughout the system through one screen. Something that he said, but didn't go into too much detail is that with version 3.2, *all users* will be entitled to unlimited weblogs. This goes for free users, as well. A lot of the rationale behind this was that the multiple weblog management is so good in 3.2, that we didn't want to have the limit anymore.

We'll have more details about this real soon.

August 24, 2005

Perlbal 1.36 port for FreeBSD

I've updated the patch for Perlbal 1.36.

August 21, 2005

Check out textdrive's new FreeBSD boxen

Textdrive have a stack of new Dell servers which look spiffy as you can see in their Flickr servers set.

Textdrive shiny Dell 2850 servers

August 19, 2005

South African FreeBSD Users Group

It's been quite some time since the old FreeBSD Users Group mailing list on Khetan's box has existed. I've created a new list which aims to provide a place for us to start-up a user group for FreeBSD users to discuss issues relevant to FreeBSD in South Africa.

FreeBSD ports for Perlbal and Danga::Socket

I've finally gotten around to uploading patches for Perlbal and Danga::Socket:

The satisfaction one gets from Hacking

Ben mentions on his blog and the Six Apart website about the joy of hacking and some of the things they've achieved for a release of Typepad by just holding a hackathon.

Joe Kraus, FeedBurner, and others have done a good job of demonstrating the effectiveness of periodic hackathons on inspiring creativity. As a fast-growing company with multiple products and international offices, though, one of the biggest barriers we've faced has not been lack of creativity in and of itself--what we've been missing, in part, is channeling that creativity into features that get released in our products.

Over on Six Apart News I posted about the Scratchathon that we held, which work formed the basis for our most recent TypePad release.

This is an amazing release, because it combines work from all of the engineers working on TypePad, and includes features that we & our customers have wanted for a long time. In fact, Mena writes about her favorite new feature on Mena's Corner:

Believe me, not having the ability to choose specific photo albums has bugged me since day one of TypePad.

We'll continue to post more information about the new features over the next couple of days, including the feature I worked on during the Scratchathon.

Taking time out from one's normal schedule to fix small annoyances can be useful, as you get to scratch at code you normally are not prodding as part of your day to day coding activities as well as making adding new features to your codebase.

Allowing employees to take ownership for a project of their own choosing for a product is a great way of getting employees to think differently about the product and be creative and think outside of the box.

More reading:

August 17, 2005

+5 Insightful

There has been quite a bit of discussion regarding the start of development on PHP 6.0. Various people have been complaining that we should not be discussing the future of PHP on our blogs, et. al.

Rasmus Lerdorf posted the following comment to Marco's blog, which sums it up nicely.

It is interesting how much attention our PHP 6 discussions have been getting and even some criticisms that we shouldn’t be talking about it, or at least we shouldn’t be talking about it publically since PHP 5 is still pretty new to people. Work on PHP 5 started in November 2002. No significant structural changes are going to go into PHP 5 at this point. Minor enhancements and plenty of bug fixes to solidify it will continue for a long time, but given this it is natural that we start looking ahead to PHP 6. People should be worried if we weren’t looking ahead at this point. And given that we are an open source project, these discussions must happen in the open even if it gives people ammunition to use against us. Wouldn’t you love to see the internal developer discussions about what sucks in a number of proprietary products out there? Would it make you stop using the product if you saw its developers discussing weaknesses and proposing solutions or enhancements?

Occasionally we form smaller closed groups of developers to tackle a tricky problem and crank out some code quickly. The Unicode effort was an example of that, but the result of the work was made public as soon as it was feasible and didn’t interfere with more pressing work on PHP 5. And it is far from done. We are a long way from PHP 6 still and we need the ideas to keep flowing and people need to keep discussing them.

August 16, 2005

PHP 5.1.0RC1

Zeev has rolled PHP 5.0.1 release candidate 1 a little earlier today:

What to do when new kernel does not work

Ocassionally things go bad(tm). This has bit me for the second time in approx 3 years now, but generally one needs to load the old FreeBSD kernel to start debugging and going through a box with a fine toothcomb.

The following snipbit gives you an idea what steps to take when rebooting the server so that you can load the previous working copy of the FreeBSD kernel:

When the boot menu appears hit the spacebar to stop the countdown.
Press "6" for "to escape to loader prompt"
unload
load /boot/kernel.old/kernel
boot

Now the old working FreeBSD kerenl is booting up. It would be recommended to copy the last working version to /boot/kernel.last for example so that you can "load /boot/kernel.last/kernel", especially if you are going to be building your kernel multiple times on a server.

August 15, 2005

Movable Type 3.2 beta 3

Was testing a beta version of Movable Type last week and I am quite impressed on the changes to the UI.

The new default theme looks neat and clean which should not require too much hacking on to make get my current theme working with Movable Type 3.2 once it has been released.

Even Six Apart are powering their documentation using the latest beta release of Movable Type 3.2 beta4. :)

When Telkom changes their pricing model

What happens when Telkom changes their pricing model to "squeeze more blood out of a stone?". A local ISP has announced that they are doing connectivity at similar rates with more bang for your buck.

What is interesting to also note is that Datapro have purchased @lantic's client base of 32000 users for R 45 million. It's approx R 1400/client who is apparently paying R 100/month each which is a big chunk of cash to pay for a subscriber base.

Apparenlty the ISP market is in "land grab" mode so we should be seeing more client bases getting sold from reading the Datapro press release.

The state of PHP

PHP is moving on towards gearing itself for PHP 6.0.

Andrei started warning people to not commit to HEAD as he was about to start committing his Unicode support for PHP. He mentions in his blog post:

The project that we have been working on for the past 4 months is finally seeing the light of day: yesterday I merged the Unicode support into the public PHP tree. I was going to say that my part of the hard work is done, but I guess I still have to edu-ma-cate developers about Unicode and other finer things in life. :)

Our Benevolent Dictator for Life, Rasmus Lerdorf, decided to email the internals list discussing a "PHP 6.0 Wishlist" which started a thread of over 150 email messages since Friday evening!

Various things on Rasmus' initial list which interests me from a enterprise adoption view includes getting rid of

  • register_globals
  • magic_quotes
  • safe_mode

The adding of an opcode cache should have been added a long time ago, more to Zend's dislike for that to be included on the list, as when Andi and Zeev implemented the Zend Engine, they left out the opcode cache and built their business around an opcode cache (Zend Accelerator).

Other PHP'ers comments on the 'state of PHP':

August 9, 2005

Reflecting on the tools one uses

Benjamin Trott, from Six Apart, wrote about Open Data which started getting me to think about how certain companies write software to lock you into using their software only!

For me, it's always been easier to trust a tool that allows me to get my data out if I watch to switch tools.

And so, since day one, Movable Type and TypePad have had the ability to Export your posts--not because we wanted people to leave, but because we wanted people to stay.

Many tools do not allow you to easily transfer your data out of them. For example Clickatell's Messenger-PRO stores the SMS messages which you have sent using the programme in a database which one cannot easily extract contacts when you can export elements of the sent SMS data. How difficult would it be to have added CSV export of your contacts to the software? Not much more I'm sure, seeing that you're half way there with the exporting of certain elements of your outbox. Having to manually export your contacts for example requires one to manually write down the contacts details to another file rather than being able to click on a 'export contacts' button and Bob's your uncle.

In Movable Type's case one can easily run queries against the various tables and import the data and reformat the content of entries on one's weblog till the cows come home, as you have the raw data and can do what you please with it.

p5-Perlbal for FreeBSD

There's a slight delay with my p5-Perlbal port for FreeBSD, as I need to figure out the correct way of figuring out if p5-libwww is installed (that's where the HTTP::Date package comes from after a bit of digging) and ensuring that Danga::Socket is installed.

I suppose one of the nicer sides of digging around with the FreeBSD ports tree is that one tends to learn something new each time you play around with creating ports for various applications and libraries that you use, even if you just update ports.

August 8, 2005

Perlbal on FreeBSD

Finally have gotten around to placing perlbal 1.3 into production which is currently reverse proxying the doc.php.net website.

p5-Danga-Socket for FreeBSD

I've hacked together a port for Danga's Danga::Socket perl module which can be downloaded. My perlbal port will be available shortly, as I'm using perlbal infront of doc.php.net ;)

I'm going to clean-up the port prior to submission to the FreeBSD Ports guys.

August 4, 2005

Python Developer Job

At work, we are looking for back-end python developers. Pop me your CV and I'll forward it to the relevant people at work.

Ideally they are looking for python developers who have a solid understanding of Internet protocols, Python programming, OO Design and Unix development. Knowledge of Twisted or another event-based communications framework would be a distinct advantage.

You would be working from our offices in Cape Town, South Africa.