Category Archives: Technology

From b2Evolution to WordPress

In January 2005, I wrote my first blog entry. b2Evolution was my tool of choice to manage my blog — it was free, simple to install, and more than adequate for my needs. I’d never heard of WordPress back then, though it shares a common origin with b2Evolution – they were both forks of b2/cafelog, one of the original blogging systems.

Fast forward ten years, and WordPress rules the world. I’ve used it on countless projects for clients and friends, and it’s an extremely flexible and powerful CMS. I’m also now far more familiar and comfortable using it than I ever was with b2Evolution.

Which is why, finally, I’ve migrated this blog  to the latest version of Wordpress, version 4.1. (If you’re wondering, the photo in the banner is Pan’s Rock in Ballycastle, Co Antrim, taken last April. Here are some more Antrim photos from the same trip.)

For those interested, the nitty gritty steps required are below; everyone else can stop reading now.

Database Migration

The biggest challenge was transferring the existing blog contents from b2Evolution’s database to WordPress’s database. Since many bloggers have travelled this path in the past, I expected this to be straightforward. However, most of them appeared to (a) be running a much newer version of b2evolution than me, and (b) have made the move long ago, to a much older version of WordPress.

No matter. First step was to find a script close to what I needed, in this case a script called import-b2evolution-wp2.php.txt at themikecam.com, referenced by Christian Cawley’s helpful b2evolution migration guide. Unfortunately, themikecam.com is no longer online, but luckily, archive.org still has a copy of the most recent import-b2evolution-wp2.php.txt available for download, along with all the older copies.

Although it should go without saying, now is a good time to backup your b2evolution database! Just in case…

While the script didn’t work right away, it was certainly a good start. I made a few tweaks to it and managed to get it working properly on my installation. You can download my copy here – make sure to remove the trailing .txt suffix after downloading.

I installed WordPress as usual, specifically WordPress 2.7 from the WordPress archives since I wanted a fairly old version. I configured it to use b2evolution’s database —  Wordpress uses different table names, so they don’t conflict with each other. Plus, the migration script expects this, so you don’t really have a choice.

Next, I uploaded the migration script to my WordPress wp-admin folder, then invoked it directly (e.g. http://yourblogaddress/wp-admin/import-b2evolution-wp2.php) and filled in the relevant values in the form presented.

It took me a couple of goes to get it right, so after the first failure, I installed the WordPress Reset plug-in; this makes it very easy to reset the WordPress database ready for another try, without having to do a full WordPress re-install, and without altering the b2evolution entries.

I highly recommend checking your database with phpAdmin afterwards to make sure the posts appear correct!

Even with the script, I still had to manually update the categories – my version of the script didn’t migrate them across properly. Since I only had 100 entries or so, it was easy enough to sort them on b2Evolution using phpAdmin. I could then select multiple posts by hand in WordPress and assign them to each category using the bulk update option.

(If I’d had many more posts, I might have spent some more effort getting the category migration working correctly.)

Finally, once I was confident everything was working okay, I updated WordPress from 2.7 to 4.1, which is MUCH nicer.

And all done!

Legacy URL support

Well, not quite done it turned out. There are plenty of links out there to my old b2evolution posts, and it would be nice if they could magically redirect to the new WordPress equivalent, to keep both the search engines and users happy.

This turns out to require a little .htaccess magic, and some PHP scripting. I added the following to WordPress’s .htaccess (I’ve reproduced the entire file for reference):

# BEGIN WordPress

RewriteEngine On
RewriteBase /blog/

# Check for references to the old b2evolution blog and send them
# to our redirect script where they'll be properly handled.
#
RewriteRule b2redirect.php - [L]
RewriteCond %{QUERY_STRING} ^(m=|.*cat=|.*blog=5|.*author=|pb=1|title=)
RewriteRule .* /blog/b2redirect.php [L,R=301]

# Normal WordPress rules
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

# END WordPress

(Watch out for word wrap on the QUERY_STRING line – the bracketed items are part of the same line.)

Essentially, this says that any query strings passed in to the blog of the form m=xxx (date reference), cat=xxx (category reference), blog=5 (my old Blog’s internal ID), author=xxx (show author posts), title=xxx (title reference) or pb=xx (b2evolution specific) should be directed to my custom script b2redirect.php without further ado and everything else should be handled by WordPress as usual.

(We use a 301 Redirect to indicate to browsers and search engines that this is a permanent redirection, and the new URL should be used in future.)

I learnt a couple of useful things about mod_rewrite figuring this out. I hadn’t fully appreciated that RewriteRules can only match against physical disk filenames from the URL; if you need to match parameter names or values, you must use RewriteCond in conjunction with the QUERY_STRING parameter.

And of course, I got caught out by having the parameters in my redirected URL immediately trigger another redirect when the page was refetched, until eventually it gave up. This is why the very first rule says that references to b2redirect.php should be passed through without any rewriting at all.

So what is b2redirect.php? It’s a small script I wrote that interprets the old b2Evolution parameters and figures out a WordPress equivalent. Here it is:

<?php
// Redirect b2evolution blog URLs to WordPress
$baseurl = "http://www.snoopdos.com/blog";

$catmap = array();

$catmap[14] = "observation";
$catmap[15] = "technology";
$catmap[16] = "random-thoughts";
$catmap[17] = "networking";
$catmap[18] = "windows";
$catmap[19] = "rant";
$catmap[20] = "useful-links";

$title  = $_GET["title"];
$m      = $_GET["m"];
$cat    = $_GET["cat"];
$author = $_GET["author"];

// Set default URL
$url = "$baseurl/";

if (!empty($title) && !strpos($title, ":"))
{
$url = "$baseurl/$title";
}
else if (!empty($cat) && !empty($catmap[$cat]))
{
$url = "$baseurl/category/$catmap[$cat]";
}
else if (!empty($m) && (strlen($m) == 4 || strlen($m) == 6))
{
$year  = substr($m, 0, 4);
$month = substr($m, 4, 2);
if ($year >= 2005 && $year <= 2013)
{
$url = "$baseurl/$year/";
if (strlen($month) > 0)
$url .= "$month/";
}
}
else if (!empty($author))
{
$url = "$baseurl/author/eddy/";
}
// Now issue the permanent redirect to the new location
header("HTTP/1.1 301 Moved Permanently");
header("Location: $url");

?>

Once again, the categories needed some special handling. Otherwise, it was straightforward – month references get changed to WordPress archive format (year/month); titles are mapped to the equivalent WordPress direct URL; category numbers go to the new WordPress equivalent name; author references show the WordPress author page; and everything else goes to the home page of the blog – better than a 404 Page Not Found.

So that’s that job done. Now let’s see what the next 10 years brings…

Telepresence in the air

Marc Andreessen’s blog today mentioned this cool demo:

This uses video goggles with a head-tracking sensor to remotely control the orientation of a camera mounted on a pilot-less plane, letting you virtually explore the heavens.

Apart from the general wow-factor of flying around the sky without ever leaving the ground, it reminded me of another piece of impressive technology I came across recently: quad-copters.

Here, a high-speed DSP is used to combine realtime feedback from gyros and sensors on position, wind direction, etc. to control four rotating blades independently allowing for stationary hovering in a wide range of conditions with no pilot input required. Great for remote video surveillance etc.

Combining these two pieces of technology seems like a perfect opportunity. Has anyone done it yet?

And a missing piece of the puzzle: even using stereo cameras to feed the video goggles, the image will still be flat since there is no way to remotely focus it (other than relying on auto-focus). Has anyone developed a set of video goggles that can track the eye’s ability to focus on specific objects? Combine that with a pair of remote cameras that can track the eye’s focus in that way and you could have REAL telepresence (once the latency isn’t too high, of course).

Isn’t it great that we live in an age where such amazing technology is affordable enough to let people devise interesting hacks in their spare time…?

Turn any surface into a touchscreen

Thanks to Kieran for pointing me towards this impressive Wii Remote hack, covered by Engadget here.

Johnny Chung Lee has done a marvellously simple hack which uses the standard Wii remote controller, plus some ballpoint pens modified to emit infra red, to convert any surface into an interactive touch-screen. With multiple pens, you can support multi-touch effects (as seen on the iPhone and iPod Touch), and previously mentioned on this blog back in March 2006.

Here’s an example of his technique in use:

(Make sure you watch the video long enough to see the technique in action; it’s very impressive, especially when combined with a video projector.)

Johnny’s software to make all this work is free, and available here.

Tilt-Shift Photography

When I had a film camera 15 years ago, I took almost no photographs with it: about one roll of film per year, on average. Then I got a digital camera, and since then I’ve taken a ridiculous number of photos – currently around 36,000 and climbing.

So, while I wouldn’t call myself a big photography buff, I do have a passing interest in photography techniques and methods.

No doubt that’s why my friend Steve sent me a link to this website, which describes Tilt-Shift photography, a style that makes normal scenes look like they are in miniature:

We’re used to looking at photos where everything is in focus (to infinity) so when the depth of field is restricted, the brain is tricked into it’s a model scene. The effect is quite surreal!

Check out the website mentioned above for more information.

Some cool CES things

There were lots of impressive products at CES 2007, most of which have been covered in detail elsewhere.

Here are some that impressed me but haven’t received much coverage:

LG’s 3D Television

Buried deep within LG’s massive stand was a 42″ high-definition LCD screen displaying genuine 3D video. This has apparently been around for a few months, but it was the first I’d heard of it.

The effect is stunning – proper 3D with no special glasses required. As with traditional 3D displays (such as IMAX and motion simulator rides), it takes your eyes a second or two to adjust – then everything jumps into focus.

Of course, there are some limitations. The optimal viewing range is 3M-7M from the display, with a maximum viewing angle of around 30 degrees. All the video on display was computer generated; I’d have liked to see some live video as well.

The screen works by integrating 25 separate LCD panels, each of which produces a display with a very narrow viewing angle. The 25 views are positioned around the objects being viewed, so that standing in any position, your eyes will see only two views at a time (one for each eye). The panel is thicker than a normal flat panel, but not overly so – about 6-8″ deep.

Capturing live video to work with this system will require some advanced cameras, since it would need to record 25 images simultaneously, each at a slightly different perspective.

Regardless, this is deeply impressive technology – some day, no doubt, all TVs will look like this.

Smyth Research’s Surround Sound Headphones

If 3D television wasn’t enough, we stumbled upon 3D sound in the form of Smyth Research’s new virtual surround sound headphones. These aim to allow headphone users to experience a surround sound movie or album in all its glory, without alienating their neighbours.

While most DVD players and A/V receivers offer some form of downmixing to let you listen to surround sound movies on headphones, this new system is in a completely different class. A sensor mounted on the headphones identifies the position and orientation of the headphones in space, and the sound is adjusted accordingly.

When you turn your head to the left or right, audio coming from each speaker appears to stay at the same location within the room, rather than moving with your head as normally happens with headphones. The effect is amazing – the first time I heard it, I immediately took the headphones off to confirm that the soundtrack hadn’t simply been routed back to the main speakers again.

The system we saw used an infra-red transmitter positioned above the TV to send out a reference signal which a reciever on the headphones picked up, analysed, and then transmitted back to the sound processor via the audio cable. This approach allows several headphones to be used at once in a single room.

With the infra-red solution, listeners must not turn their head more than 60 degrees away from the TV, or the effect is lost. This can be overcome using an alternate RF positioning system.

Smyth Research don’t sell hardware products themselves; instead, they are licensing the technology to manufacturers for inclusion in their audio equipment. The demo we heard was using Yahama equipment; expect products to be on the market by the end of 2007.

As an aside, Smyth Research are based in Bangor, Northen Ireland – it was nice to see some Irish representation at the show. They were previously involved in the development of the DTS Surround Sound system, so their audio pedigree is well established.

The Laser Mouse That Works On glass

A4Tech had a stand in the international section over at the Hilton, where they were showing their laser mouse that works on glass.

Most optical mice fail dismally when moving over a shiny or glass surface; not the A4Tech mouse. I spent some time playing with their demo setup, and can confirm that it worked just as well on glass as on other surfaces. A simple trick, no doubt, but extremely useful.

Apparently the mouse is already on sale in Korea – hopefully it will make it to Europe soon.

CNET’s Next Big Thing

Alongside the main CES convention, there were numerous seminars and panel sessions to discuss issues of interest to the consumer electronics industry. Most of these cost money to attend, but some were open to all CES participants.

The first session we attended (on Monday afternoon) was CNET’s Next Big Thing, a discussion about three hot areas of debate in the industry at the moment:

  • Whether there is a genuine market for displaying video on mobile phones and other small-screen devices
  • Whether streamed online content will lead to the death of the DVD
  • How Digital Rights Management for movies & music can evolve into something less customer hostile.

Several industry panelists (including a CNET reader flown in from the UK to represent the consumer) discussed these items at length; the audience then voted electronically on how they thought things would develop in the future.

CNET's Next Big Thing was a popular session

Mobile video

On mobile video, the verdict was: yes, there is a new and growing market for media playback on mobile devices, but access needs to become far less restrictive (both in price, and range of media available) before it will take off. Mobile video will supplement existing markets rather than replacing them.

Dynamic content like news clips, music videos, and short length TV programs are more suited to these devices than feature length movies. One panelist predicted that the production style of programs will change to match the constraints of the mobile devices – more talking heads, fewer panoramic landscapes, etc.

All reasonable points. However, the most important point was only briefly mentioned: mobile video need not be streamed. People use it to fill time when they would otherwise be bored (standing in a queue, waiting for something to complete), and it suffices to have pre-loaded content available on their mobile device; it’s not a big deal if it’s several days old.

With modern video codecs and ever-increasing flash capacities, it’s quite feasible to store multiple movies or (more likely) TV programs on your portable device. I think this trend is just beginning to gather stream.

The death of DVD?

The panel were (eventually) united in their view that DVD wouldn’t be going away anytime soon – certainly not by 2010, as had been suggested. The tangible nature of a DVD, which makes it collectable, suitable for gifts, easy to use and distribute, etc. all combine to make it unlikely to disappear.

However, the panel did did agree that online streaming media will gain significant following as well. (No surprises there.)

I’m broadly in agreement with this view. It takes a long time for a given technology to die out; after all, there are still plenty of VHS tapes around, even though it is now difficult to buy a VHS recorder.

I also doubt we’ll see broad acceptance of streamed video until most households have a fast broadband connection (where ‘fast’ means 10 MBps or higher, with no contention).

Digital Rights Management

Digital Rights Management (DRM) was the most contenious discussion, with representation from the legal profession, movie industries, and consumers, as well as several industry observers. Everyone agreed that some sort of rights management was essential, but making it transparent enough so that consumers were not unduly restricted when they tried to use media they believed they owned was judged difficult.

Apple’s ITunes was given as an example of how to make DRM straightforward, so that customers are not always even aware that any special restrictions apply.

The biggest hinderance to existing DRM technology is that it goes against the grain of what consumers are used to. If you buy a CD, you can take it to a friend’s house to share with them or loan to them. You can play the same CD in your living room, your bedroom, your car, on your laptop, and anywhere else that has a CD player.

This is almost never true for media protected with DRM, especially where that media has been downloaded rather than delivered in some sort of physical packaging. While providers are entitled to protect their content, they need to find a less onerous way to do so than has currently been attempted.

I have no doubt that this problem will be solved; until then though, consumers will continue to be highly suspicious of anything resembling DRM.

How big is that hard disk?

Seagate had a cute visual exhibit at CES 2007 – a typical laptop hard disk, represented as an equivalent number of CDs (assuming you only store MP3s, of course.)

Lost: 1 Laptop. Also lost: 52,716 MP3s.

Seagate’s point, of course, is that you might want to think about backing up that hard disk … and naturally, they had a product designed to do exactly that.

CES 2007

I’ve just returned from the Consumer Electronics Show, which ran from January 8-11 in Las Vegas. This was my first time attending the largest trade show in America (2700 exhibitors, 150,000 attendees) and it was quite an experience. Over the next few days, I’ll post entries about some of the more interesting products and companies I saw.

I was travelling with some colleagues, and we had four days to cover the exhibition – just as well, since it covers ten large convention halls, and conference space in several nearby hotels.

The scale of CES is hard to grasp – by lunchtime on the first day, we had cleared half of one hall and felt we were doing well – until we realised we had only cleared half of one corner of one hall!

It was time for a more aggressive approach. By planning ahead, and stepping up the pace substantially, we managed to cover about 90% of the exhibits during the first three days! This left Thursday morning for some final follow-up visits to stands, and we were all done by lunchtime, leaving the afternoon for some R&R.

The conference was well organised, with courtesy coaches between the different venues, free Internet access available in the halls (supplied by DivX), and even free international phone calls courtesy of Vonage, who had installed VoIP kiosks in the lobbies. Complimentary magazines from just about every consumer and electronics publisher you’ve ever heard of were also available outside the conference entrance, along with the six show guides and product directories.

While most of the halls were in the gargantuan Las Vegas Convention Center, one hall was in the Sands Expo Centre, about a mile away. (The Adult Entertainment Expo was taking place in an adjacent hall during the week, which led to an interesting mix of attendees in the areas outside the hall.)

General Trends

Two products were in evidence just about everywhere this year – large high-definition LCD televisions, and digital photo frames. Even manufacturers who didn’t sell photo frames were using them to display information sheets for their actual products.

There was a wide and varied selection of Windows Media Centre PC cases from assorted vendors – perhaps the most impressive (if not the most practical) were the Diamond Media Centre range from Moneual, which featured a jewel-encrusted fascia panel and control knobs at prices ranging from $30,000 to $1,000,000, they are for elite purchasers only.

Moneual's diamond-encrusted Media Centre PC

While most of the larger vendors had extravagant stands with large floor areas, there were plenty of smaller stands there as well. The entry level cost for a stand is in the region of $6000-$8000 depending on location (about 2 metres x 3 metres) which is within reach for even small startups.

There were surprisingly few freebies on offer. Other than the ubiquitous carrier bags, and a few trinkets like LCD pocket torches, watch batteries, and T-shirts, pickings were slim.

Apple steal some thunder

One of the biggest announcements didn’t even happen at the show. Apple were running MacWorld in San Francisco during the same week, and launched their new and long-awaited iPhone, though it won’t be available until June. While the industry was impressed with the product, there was plenty of scepticism about Apple’s ability to break into the highly competitive cellphone market, especially with a product that costs $600! Time will tell…

Virus Creation in The Lab

The US magazine Consumer Reports (similar to Which? magazine in the UK) has been in the technology news recently. As part of a comprehensive test of antivirus software packages, they commissioned a consulting company to create 5,500 new viruses to see how well market leading programs would cope.

The antivirus industry, led by McAfee, was immediately up in arms when they heard about it. Imagine the risk to society of these viruses escaping into the wild! What blatant disregard for consumer safety! And other similar scaremongering…

It only takes a little scratching below the surface to show that their concerns are, at best, misguided. The viruses created for Consumer Reports were simple modifications of existing viruses, altered so that their signature was no longer identifiable. The viruses were kept in a secure environment, and all copies were removed after testing – only a single CD remains, which is kept in a locked and secure cabinet on site.

Surprise, surprise – McAffee’s package didn’t do particularly well in the test; it relies heavily on a signature database to identify new threats. When viruses were still something of a novelty, this approach worked well – it often took weeks before a new virus gained notoriety, giving McAffee plenty of time to respond.

By now however, it is so easy for would-be virus writers to develop new viruses, and variants on existing viruses, that a pure signature-based approach is no longer sufficient. A more pro-active approach is needed, that can identify virus-like behaviour and quarantine or block the affected program. Of course, there will be legitimate tools which end up looking like a virus – commercial tools can be recognised and permitted explicitly, while a mechanism can be included to allow users to grant access to other programs on an as-needed basis.

Maybe the industry should use two distinct terms – “Virus removal”, for packages that can remove existing viruses which are already known to the program, and “Antivirus” for packages that can detect new virus strains and prevent infection in the first place. (Somehow, though, I can’t imagine vendors thinking this is a good idea.)

Whenever Which? reviews product categories that I know well, I find myself disagreeing with their conclusions; this doesn’t give me much confidence in their reviews of other products that I’m not familiar with. People I trust have made similar comments about Consumer Reports. In this case, however, they’re on the side of right. More power to them…

(In case you’re wondering, the top rated antivirus packages were from BitDefender and ZoneLabs. The full report is only available to subscribers.)

HAL 2000 smart home technology

Steve pointed me towards an interesting demo video showing off the capabilities of the HAL 2000 home automation system. It lets you control your home using speech commands from any room – quite impressive.

The author has an extensive discussion of the technology involved (speakers, distribution amps, microphones, etc.) along with some comments on the limitations of the system.

Startrek’s onboard computer suddenly doesn’t seem quite so far away…