Edit 6 June 2010: Perhaps even easier is to install a WordPress plugin for code markup. In this blog, I use the Syntax Highlighter Evolved plugin, which supports a number of programming languages such as the C-family, Java, PHP, Bash/shell, etc.

It is sometimes difficult to add code snippets your blog, for example using Blogger/Blogspot or WordPress. Code involving xml or html tags might get parsed if you simply try to use the <pre> tag. A simple solution is to copy and paste your code snippet into this website, which transforms it to “readable” code. You may then enclose the resulting code in <pre> tags as usual.

For example, when I needed to write <pre> in the previous paragraph, I went to the above website, entered <pre>, and got &lt;pre&gt; back in return, which I simply copy and pasted back into the blog editor.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)