Saturday 14 November 2009

Wordpressing

I woke up quite late this morning - about 8pm. After breakfast I did a backup and then defragmented my hard drives / partitions. All the drives were 0.1% fragmented according to PerfectDisk, but the C:\ took quite a long time to defragment - about 45mins - 1hr, despite being much smaller than the other two drives/partitions. Most of the time was spent defragmenting the VMWare Server 2.0 Ubuntu Virtual Machine image.

I tried to do a bit more work on my photo website blog, but first of all I got a message that curl_init() wasn't a function (it worked the other day). After adding the curl.so extension to the php.ini file, I now had a problem with my decoded JSON string being null.

I tried using json_last_error(), but then just got a message that json_last_error() wasn't a function. I checked that the json.so extension was being loaded in the php.ini file, and it was listed there (and existed in the extensions directory).

Eventually I worked out that the problem with the decoded JSON being null was due to malformed JSON being fed to the json_decode() function. I still couldn't work out why I was getting the problem with json_last_error() not being a function though, so I asked about this on the Web Squeeze.

After this I watched L play on the Lego Batman game for a while, and also Moccle made a 'game face' of himself, which is quite skill. It lets you deform a 3D model of your face, and also change your hairstyle.

I tried to do some more work on my photo website blog, but came across another problem, so again I asked about this on the Web Squeeze.

In the evening I tried to improve the comments editor for commenting on the photo website blog.

  1. First I tried the MCEComments plugin, which is very good, except I couldn't find a way to be able to use HTML tags with it. It does have an 'enable HTML editing of the Source field' option, but ticked or unticked, this didn't seem to do anything. After writing this up, I did notice that the author of the plugin has an HTML button in the TinyMCE editor on their comment box, so I'll have to look into it a bit further tomorrow.
  2. Next I tried Comment Form Quicktags, but this used document.write() in its javascript, so wasn't XHTML compatible. Also its javascript file is actually PHP, which means it's not clear whether it would cacheable or not.
  3. Then I tried the jQuery Comment Preview, which as well as giving a preview also gives a few 'quick tags' buttons so users can use them to bold text, add links etc. I had a problem getting it working first, as it uses an md5 javascript implementation so as to get the user's gravatar for preview, but it didn't seem to be including the md5 javascript file in the actual page.

    After working out that this was what was causing the problem, I added the md5.js script to be loaded
    //Подключаем jQuery

    function jcp_jquery() {

    if ( comments_open() && ( is_single() || is_page() ) ) { wp_enqueue_script('md5', WP_PLUGIN_URL.'/jquery-comment-preview/md5.js'); wp_enqueue_script('jquery'); }

    }

    add_action('wp_head', 'jcp_jquery', 1);
    And now it would work. Only problem was, the link button just added an anchor tag with an empty href around your selected text - I was expecting that it would pop up a prompt box asking for the url and then add the anchor tag in with the href pointing the url entered in the prompt box.

    Also, it looked like you would have to do quite a bit of work to get the comment preview to actually be styled in the same way as a real comment. And it didn't get my name either - just said 'Undefined says' in the preview.

    This plugin also used PHP for the javascript file.


The weather today started off nice and sunny but by about 11am it was pouring down with rain and very windy, and it stayed that way most of the day (occasionally the rain would stop for a while).

Food
Breakfast: Orange marmalade toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese with crunchy salad sandwich made with fresh bread-maker-made bread; Crust of fresh bread-maker-made bread with honey; ¾ yum yum; cup o' tea.
Dinner: Toad in the hole; potatoes; carrots; leek; gravy; mustard. Pudding was a slice of home-made flap jack. Coffee.

No comments: