FramedBlog

No longer actively developed. see the AJAXBlog page instead

ok, here goes the instructions of how to have bookmark capability with a framed wordpress page:

  1. move your wordpress installation into a folder (from here on out called wordpress/) and update the settings of wordpress to use the new location (If you can’t get into the wp-admin pages after the move, edit the wp_options table in mysql and change any instances of the old url to the new one. In my install that was only the very first option in that table.).
  2. create in the directory above wordpress/ a file called index.html which will be your frameset.
  3. Once you’ve finished adding the desired frame layout, add the following inside the <head></head> section:
    <script src="wordpress-admin/wordpress-includes/js/prototype.js" type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    var wpdir = 'wordpress/'
    var baseurl = 'http://www.thehoneymonster.net/';
    Event.observe(window, 'load', function() {
        currentdoc = window.location.href;
        idx = currentdoc.indexOf('#');
        var loaddoc = wpdir;
        if ((idx > -1) && (idx != currentdoc.length)) {
            loaddoc += currentdoc.substring(idx+1);
            setTimeout(checkAddressBar, 1000);
        }
        mainframe.location.href = loaddoc;
    });
    function checkAddressBar() {
        idx = window.location.href.indexOf('#');
        loaddoc = false;
        if ((idx > -1) && (idx != window.location.href.length)) {
            loaddoc = window.location.href.substring(idx+1);
        }
        var mainframe = document.getElementById('mainframe');
        if ((loaddoc == '/') && ((mainframe.src == baseurl+wpdir) || mainframe..src == baseurl+wpdir+'/')) {
            setTimeout(checkAddressBar, 1000);
            return;
        }
        if (loaddoc && baseurl+wpdir+loaddoc != mainframe.src) {
            mainframe.src = baseurl+wpdir+loaddoc;
        }
        setTimeout(checkAddressBar, 1000);
    }
    function setlocation(location) {
        location = new String(location);
        if (!location.match(baseurl)) {
            if (location.match(/^((((ht)|f)tp[s]?)://)|(mailto:)/)) {
                window.location.href = location;
                return;
            }
        }
        currentdoc = window.location.href;
        idx = currentdoc.indexOf("#");
        if (idx > -1) {
            myself = currentdoc.substring(0,(idx));
        } else {
            myself = currentdoc;
        }
        location = location.substring(myself.length + wpdir.length);
        if (!location) location = '/';
        window.location.href = myself + '#' + location;
    }
    //]]>
    </script>
  4. download and install this plugin (framedblog.zip) (a simple affair which will import the prototype.js library included with wordpress and send click event notifications to the “parent” frame, ie your frameset.
  5. navigate to your frame page and bask in the glory of bookmarkability!!

FramedBlog

As a precursor to the return of a music player for my blog, like that of CuBeZeRo’s site (www.nweightman.co.uk), I have inserted a frameset so that I can have the player permanently at the top of the window while the user is navigating the site. This allows me to use the streaming mp3 technology of Adobe Flash (my choice of player) rather than embedding the mp3 into the flash file making it a huge-ass download. Using streaming also means I can have more than one mp3 file and either rotate them as they play, or change the single file once in a blue moon when I feel like a change, without having to recode the flash file.

Now onto the clever bits: I’ve coded a plugin for wordpress that simply adds some javascript to the top of each page served, and placed counter code in the frameset page. These codes combine to allow the user to deep-link their bookmarks to any page on the site while still retaining the frameset. I’ve utilised anchors ) for this, and the javascript inserts the correct page’s url as the anchor whenever the user clicks a link. When the frameset is loaded from a bookmark that has an anchor the javascript sets the content frame’s url to the correct location. And finally, on each loaded page of the blog there is javascript that sets the browser’s title to the correct string, rather than having a single static title for the entire site.

OC Development Infrastructure

In the linked post, I discuss the infrastructure that I’ve put in place to aid the development of the Occasionwise facebook application. The infrastructure can also be turned to _any_ web development needs. It keeps multiple developers happy with version control while also maintaining a live website for them to check their changes as they’re made.

Please check out both Occasionwise and our Facebook Application at the following urls:

ezCache

This page is no-longer relevant.

After spending a while looking into caching methods on WordPress, Deadpan110 and I have started work on a way to reduce database server load.

Most caching methods for WordPress involve creating static (WP-Cache) or semi-static (Staticize Reloaded) pages and these are very good at reducing web and database load but are very quirky on sites with a lot of dynamic content.

Although the database cache does not reduce web server load, it does reduce the amount of queries sent to the database server.

At the time of this posting, my home page performs 38 queries to the database server.

With database caching enabled, 21 queries were retrieved from the cache and only 17 queries were made to the database server.

Even with the cache timeout set to the minimum of 1 hour, the load on a database server can be dramatically reduced on busy sites.

The WordPress database class (WPDB) is a modified version of an earlier release of ezSQL and can be easily replaced by creating your own database class in .-content/db.php which is the same method the WordPress site uses for its HyperDB.

HyperDB is a replacement for the standard WPDB class which adds the ability to use multiple databases.

The cache I have created just drops into the wp-content directory and extends the current version of ezSQL for use with WordPress.

Features

  • Uses the cache feature within ezSQL
  • No caching of WordPress options, admin pages or previews
  • No caching of any SQL that makes use of RAND
  • Cache timeout can be set to a minimum of 1 hour (default)
  • In case of emergency, the cache can be switched off or even made to revert back to the WordPress default wpdb class from within wp-config.php

The script and documentation will be available soon – watch this spaceā€¦

In the mean time, you can see the cache statistics at the bottom of these pages.

The project pages for this were available in the ezCache section on Deadpan110’s site.

Science Museum

So, week before last my parents and myself went up to visit my sister in London. She is getting married sometime next year (I’m unsure as to whether the date has been set yet or not), and wanted to take my mum wedding-dress shopping. Seeing as dress shopping is an inherently feminine past-time, my dad and I decided beforehand to take the tube into London and visit the Science Museum while my sister and mum were doing their thing.

Turned out, that it was a bit of a mistake going on the day that we chose. My sister, being a teacher, decided that it would be best to not skip her teaching duties just for the sake of wedding stuff. This meant that she organised to do her dress shopping in the Half-Term period when school is out for a week. This meant, however, that when my father and I got to the Science Museum there was a massive queue with all the young families. We felt quite out of place, two adults without any children in tow.The museum didn’t disappoint though and, while the “Science of spying” exhibit was a pay-for section (so we decided against visiting that part), we managed to view the telecommunications and history of computing exhibits along with a lot of other bits in between.

The most fascinating part to me was the section on computing where the museum was in the process of building one of Charles Babbage’s inventions, the Difference Engine #2.

Another of Babbage’s inventions, built by his son after his death, the Analytical Engine, was a fully mechanical programmable computer with everything that a modern computer needs to operate, including: input, output, memory and central processor. This machine is considered to be the forerunner to all computer science of today’s modern age, and Charles Babbage is heralded as the grand-father of Computing.

Flash music player

You should have noticed a flash-based music player in the top left of your browser window when viewing this site. I’ve been rather clever with this, in that it will remember where the music had got up to when pausing and resuming playback. Also of note, is that if you click the pause button a cookie will be saved that tells the player NOT to start playback on the next page reload. This means that once you’ve heard the piece of music and have got fed up with it, you can disable it for ALL future visits simply by clicking the pause button. I hope to also enable memory between page loads so that it will start off playback from where you had got to previously, thereby negating the effect of loading a new page causing the playback to begin from the start of the track again.

EDIT: The player now remembers how far through the track it had reached before a page refresh, so that it is almost seamless when loading a new location.