HOWTO: Add Syntax Highlighting Code on Blogger using Google Code Prettify

I am going to start a series of posts where I am bound to publish lots of code (and hopefully some comments). In order to make the posts more palatable I will add syntax highlighting to the posts.

What better way to start this series than with a Syntax Highlight using Google Code Prettify on Blogger.com
  1. Go to your blogger.com control panel
  2. Choose your blog and go to the  Layout / Edit HTML menu as shown in the screenshot below.
  3. In the Edit Template section, locate the following code:
    </b:skin>
  4. Add the following snippet after the last tag </b:skin> and before the </head> tag. This will ensure that the latest version of the Google Code Prettify  JavaScript and Stylesheets are loaded:

    <link href='http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css' rel='stylesheet' type='text/css'/>
    <script src='http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js' type='text/javascript'/>
  5. Locate the <body> tag and replace it with <body onload="prettyPrint()">
  6. Save your changes by pressing the 'Save Template' button then
  7. Start a new post, or edit an existing post, and in any section containing code, switch to the EDIT HTML view and surround your code with the following code:

    <code class="prettyprint">
    ... code goes there ...
    </code>

  8. If you have any issues saving your post, click on the Post Options link and make sure the Compose Settings are set to Show HTML literally as shown below:
  9. Save your post and preview it, you should have something along those lines :



    @synthesize window;
    @synthesize tabBarController;


    - (void)applicationDidFinishLaunching:(UIApplication *)application {

    // Add the tab bar controller's current view as a subview of the window
    [window addSubview:tabBarController.view];
    }



You can find more info on the Google Code Prettify website and until next time...

Happy Blogging!

iPhone 3g Woes in London


Let's talk 3G coverage in London. Here's one polite way to describe it:
"It's abysmal, really."

I am currently located a stone throw from the City in London, on the south side of the Thames and it is virtually impossible for me to use my iPhone for anything else but as an overly priced hand-warmer.

The situation is the following, since June 2009, all iPhone users in the area are boasting full 3G reception on their devices, yet no calls can be made, and SMS, Voicemail and emails never reach the devices. To add insult to injury, in these recurrent scenarios, the iPhone gets very hot and actually drains battery faster than the USB cable can charge it! Which means that I get a very hot block of plastic connected to my computer during the day, and a phone with no battery when I am back at home.

Lovely.

Some iPhone users have banded together and formed a defence committee and are trying to get O2 to fix this issue but so far O2 isn't acknowledging the issue and won't try to fix it. What it is doing though is proposing to buy-back the contracts of the most vocal users, how nice.

I paid for a service I am not getting, and I will not let the provider (O2) weasel its way out of it.

What really irks me is that in days of bad weather, when lots of people telecommute, or after tea time, when everyone's off at the pub, the service works wonders. Which seems to indicate that the infrastructure (or the radio bandwidth? Some radio engineer please correct me here!) is not adequate for the device concentration, and don't tell me the 3G tower logs can't show this to the provider (O2 UK).

The issue might actually be broader than initially thought, as seen from the last three paragraphs of this Arstechnica article about iPhone 3G meltdown in the US.

It looks like no-one wants to point-out the elephant in the room : O2 UK iPhone coverage sucks, and it might very well be unsolvable if it's a 3G protocol flaw.

iPhone screenshot courtesy of James S.