Matt's Blog

Archive for the ‘News’ Category

Code Highlighting in WordPress

Monday, September 10th, 2007

Have you ever wanted to post some code onto your WordPress blog, but then quickly get frustrated when it gets formatted properly? I have, a lot. I also wanted syntax highlighting. To try to solve these problems, I was using WP-Syntax. Sure, it did syntax highlighting, but if you wanted the code to be presented well, you had to do some CSS magic, and I still got frustrated when my code got formatted.

Well, WordPress.com solved this problem. They made it easy to do, presented the code well and your code doesn’t get formatted. Oh, sure, but what about self-hosted WordPress blogs?

Well, it wasn’t long before somebody made a plugin for self-hosted WordPress blogs that did exactly the same thing. Viper007Bond threw together a plugin that did what WordPress.com blogs could do. Then, Matt Mullenweg saw Viper’s post and said that they should work together, and sent over the code he was using on WordPress.com. That’s how the WordPress plugin SyntaxHighlighter was born.

To use it, you just wrap your code in [sourcecode language=’lang’] and [/sourcecode] tags. Where lang is, would be one of the following currently supported languages:

  • cpp
  • csharp
  • css
  • delphi
  • java
  • jscript
  • php
  • python
  • ruby
  • sql
  • vb
  • xml

You can also use source or code instead of sourcecode, and lang instead of language. You can even not type in language or lang. So, the shortest would be [code=’lang’][…][/code].

The visitor is then presented with a clean little box with the code in it. The code is highlighted, there’s line numbers, the visitor can view the code in plain text (no highlighting), copy the code to the clipboard and print the code. Here’s a live example (click here if you’re reading this as a Feed):

<?php
if ($x == "1") {
echo "1";
}
else {
echo "2";
}
?>

It uses Alex Gorbatchev’s SyntaxHighlighter to highlight and present the code front-end using JavaScript. Which also means, that it will degrade nicely if it’s being read in a Feed, or if the visitor doesn’t have JavaScript on/doesn’t have a browser that supports JavaScript.

It’s a great plugin that does what it supposed to do, and does it well. Check it out, if you like to post code on your WordPress blog, without any hassles.

WordPress 2.2.3 Released

Friday, September 7th, 2007

WordPressWordPress 2.2.3 has been released! It is a security and bug fix release. It can be downloaded here.

This will likely be the last release in the 2.2 series. WordPress 2.3 will be released on September 24, 2007.

I’ve upgraded, have you? 😀

New iPods… Sweet!

Thursday, September 6th, 2007

The new iPods look pretty Sweet. If you haven’t about them yet (seriously, put the rock up for sale!), I’ll fill you in:

iPod shuffle: Nothing much new… some new colours I think.

iPod nano: It’s now a square, and can play video. Coverflow (album cover flippy thingy from iPhone), and some UI changes. All metal.

iPod classic: New name (before it was unofficially the iPod Video, officially the iPod 5.5 generation). Looks a bit different, available in grey and black. All metal. Base model is 80GB, model up is 160GB. Around the same price. Coverflow and some UI changes.

iPod touch: Brand new. Think the iPhone without the phone part. Wifi, Safari, Youtube, multi-touch screen and all that good stuff. Download songs through iTunes via Wifi directly to the device.

The model name after “iPod” is not capitalized, either…

By far, the iPod touch looks the coolest! I’d definitely buy one, if I had the money (:P). Prices aren’t that bad, too. Check out all the iPods here.

What do you think about the new iPods?

Google Reader Changes

Tuesday, September 4th, 2007

It looks like the Google Reader team has made some minor-ish changes to Google Reader!

You can now hide your subscriptions by clicking a little arrow between your subscriptions and the feed entries. Once they’re hidden, the feed entry space expands to fill the gap. There is then a little “My Subscriptions” link that expands into a dropdown of all your feeds, when clicked.

My Subscriptions Link

My Subscriptions Dropdown

The loading “screen” is different now too. Instead of a Erlenmeyer flask and “Loading…” in the center of the window, it’s a little yellow “Loading…” with a little circle animation in the top center of the window.

New Loading Screen

Even though the new changes are fairly minor, I like them.

Update [September 5, 2007 @ 9:30 PM]: There’s a search box in the top-center of the page now, with a dropdown box to narrow your search to certain feeds and/or folders. Sweet.

Update [September 5, 2007 @ 10:37 PM]: The Google Reader blog confirms this. You can also use the Back/Forward buttons in your browser, and the unread count stops at 1000, now, instead of 100. Awesome.

New IE6 and 7 VPC Packages

Monday, August 20th, 2007

The IE Team has now updated the IE6 and 7 (w/ XP SP2) VPC Images. They have all the updates and are set to expire December 7, 2007.

If you don’t know about these, they’re Virtual PC “images” of Windows XP SP2 with either Internet Explorer 6 or Internet Explorer 7 installed. They’re great for cross-browser/Windows version testing purposes. You can see my previous post on them here.

Download IE6 or IE7 VPC Image (appox. 500-700 MB)
Download Virtual PC 2007 (appox. 30 MB)