Categories
WordPress

Decoding a WordPress Post Title

By default, get_the_title and the_title will return the title of the current post. It’s stored in the database in plain text, however, when returned using the aforementioned functions if appears to be encoded. This means that characters such as ampersands and apostrophes will be converted to equivalents that are more HTML friendly.

Unfortunately, passing, say, this title to Twitter, via the URL, causes problems. First you have to URL encode and the mixture of the HTML encoding and the URL encoding produces a mess that Twitter simply doesn’t cope with very well.

However, the standard HTML decoding in PHP didn’t seem to work 100% with, for example, apostrophes not being decoded. After much head scratching and some frustration I found that this was due to the parameters that I was using.

The following line will correctly decode the post title to plain text…

html_entity_decode(get_the_title($post->ID),ENT_QUOTES,'UTF-8');

To then encode is to be passed via URL, then simply use this…

urlencode(html_entity_decode(get_the_title($post->ID),ENT_QUOTES,'UTF-8'));

It seems obvious now 😉

Categories
Life

Which Android?

HTC HeroNo, not the name of a new publication related to robots 😉 Of course I’m referring to Google’s rather excellent mobile operating system.

My current phone contract expires soon and I’m seriously interested in getting an Android handset. But which to have. I was excited by the Samsung Galaxy but reviews have generally not been as glowing as I’d hope for – issues such as a hidden i marketplace icon and abysmal PC connection software have rather tainted it. On top of this, although it’s on O2 (my current provided), it’s only available from O2 themselves and not Carphone Warehouse (which is where my contract is with). Oh, and it’s expensive.

The viable alternative is the HTC Hero, with excellent reviews, but a poorer quality camera (yes, the camera is one of the selling points for me) and, gulp, only available in pink or brown from the Carphone Warehouse.

However, the Hero has just won the T3 award for best mobile phone and best gadget of 2009. I’m not sure I can argue with that.

Having said that, I’ve just noticed that 3 are bundling Spotify Premium with the HTC Hero…. Hmm. Between now and my contract renewal, it may get quite exciting!

If anybody has any thoughts, have tried either phones, then please let me know.

  1. although I believe it is there![]
Categories
Life

The truth behind Micro Men

I cut my teeth on 8 bit home micros back in the 80’s and was more than chuffed to be able to catch BBC’s Micro Men programme last night.

Here is the official BBC description

Affectionately comic drama about the British home computer boom of the early 1980s.

Legendary inventor Clive Sinclair battles it out with ex-employee Chris Curry, founder of Acorn Computers, for dominance in the fledgling market.

The rivalry comes to a head when the BBC announce their Computer Literacy Project, with the stated aim of putting a micro in every school in Britain. When Acorn wins the contract, Sinclair is furious, and determines to outsell the BBC Micro with his ZX Spectrum computer.

Home computing arrives in Britain in a big way, but is the country big enough for both men?

Clive Sinclair was played, brilliantly, by Alexander Armstrong and Chris Curry by Martin Freeman. However, I was particularly excited to see Steve Furber included (played by Sam Phillips).

Micro Men - Steve Furber on the very right
Micro Men - Steve Furber on the very right

In a magical twist that would make many geeks salivate, I’ve met Mr (or rather, Professor) Furber as I’m good friends with his daughter. So, after last nights show I thought I’d ask her what he thought of it and how accurate it really was.

They got his character wrong – in real life he’s not a chain smoker or someone who eats Chinese food with wire clippers. Although he did describe it all as  “a jolly romp”!

He also wasn’t personally responsible for wire wrapping all those joints, and if he was he’d like to point out that he wouldn’t use a soldering iron!

Not that he told his daughter a great deal about the show (she’s not sure if he had any involvement in it) – he only told her it was happening on Tuesday in a ‘you might want to watch this…’ way! But he says the major facts are true although, sadly, Hermann cut the wire about 3 hours before the BBC people arrived rather than 3 seconds, so there was some dramatization.

Who’d have thought it?

Categories
Life

Samsung NC10 – beware of cheaper versions!

The Samsung NC10 Netbook has received many positive reviews since it’s release and many believe it to the best Netbook on the market.

A colleague of mine has recently purchased one at, what he thought, was a bargain price from Comet i. It turned out that the low price was due to it having a far inferior battery. Indeed, the reason why it often garners such good feedback is its 7.5 hour battery life. This one struggles to a couple.

Some users are pointing out that some retailers are referring to this as the “award winning” NC10. In fact, it’s the bigger battery life version that has been winning the awards. Naughty.

So, be careful out there..

  1. I’d provide the link but the site was strangely “under maintenance” when I tried[]
Categories
Life

Improving Windows boot times

Lenovo has been “tweaking” its laptops and PCs in preparation for Windows 7, heavily improving startup and shutdown times.

Some of the methods, however, can be easily transferred to any Windows system – in this post I’ll be concentrating on XP, but I’m sure many of these will work on other versions.

So, here are some of the things that Lenovo did and what you can do that’s similar…

Fixed the drivers of on-board hardware components that were cumulatively causing massive delays.

Ok, so there’s not much we, as individuals, can do to fix drivers. However, it is important to stay on top of Windows drivers to ensure that you benefit changes of this type.

Personally, I have a spreadsheet of download links for my drivers and regularly check them. The other option is to use software that will look for updates for you. DriverMax is a popular example, although others are available.

Tweaked the BIOS phase of startup to temporarily hide some devices from Windows 7, so that the OS only loads the drivers after the boot is finished.

What they’re doing here is hiding hardware devices from Windows until its loaded. This may be a webcam, CD drive, etc. Now, there are some things you can do here for yourself…

  1. Create a secondary hardware profile. This gives you an additional boot option where, say, lesser used hardware devices won’t be loaded. This is done by turning off different services (and having different startup options too). I used to have one for gaming, whereas non-gaming services would be disabled, saving memory and boot time.
  2. Switch hardware off that you don’t use very often. No, ok, this won’t stop the drivers from loading but there may be some exchange (or handshaking) of information that may be reduced. My scanner and lazer printer, for instance, are used only occasionally, so are left unplugged when not in use. Of course, this also saves on electricity!
  3. Uninstall old drivers. When you change hardware, you often leave the old drivers behind. Plug everything in, start up your PC and then find and uninstall any old drivers.

Tweaked Windows 7 to delay the loading of non-essential services and applications until after startup.

Ah, now this is definitely something we can do ourselves.

The first thing I’d recommend you do is to go through the various startup programs and disable those you don’t feel you need (RealPlayer, Quicktime and Java update checkers are popular ones to disable). You can use msconfig, but I find the option within the Tools section of CCleaner a better option.

A quick tip… you’ll find some startup options that don’t appear within the “Startup” folder in your Start Menu. If one of these is only relevant to particular users, who have their own profiles, then note the URL that this startup is running. Disable it and then create the relevant shortcut within the appropriate profile startup folder.

You can also delay when various startup options execute. So, lets say you REALLY want Quicktime, et al, to do their online checks, do they have to do them as soon as the computer starts? Programs such as Startup Delayer will allow you to delay startup tasks.

That’s applications. Now services. You have to be careful with these, but its still worth going through all your services and looking for those that are best set to manual or disabled entirely. There are many websites dedicated to which ones should be changed.

And that’s it. If you have any suggestions on how to improve startup and shutdown, feel free to contact me (or add a comment to this post).