Dec 28, 2007

Syntax highliting in blogspot posts

So far Blogspot doesn't support syntax highlighting and "verbatim" mechanism, which could help to post C++ (or other languages) source code blocks.
I will try to summarize in the following post workarounds I found on the subject. This post should help to:
  1. make posts with blocks of source code (C++ for example) in it,
  2. enable syntax highlighting of source code blocks,
  3. add a word wrapping for source code blocks.
Let us start!

You will need google-code-prettify, which does the main job of enabling source code blocks in you posts.
Please edit your HTML template by adding the following lines to the end of your "head" HTML block:

<!-- google-code-prettify -->
<link href='' rel='stylesheet' type='text/css'/>
<script src='' type='text/javascript'/>

Also you need to change your "body" tag to the following:

<body onLoad='prettyPrint()'>

To post source code blocks your will need to process HTML escaping of this block, this can be done with the help of the following tool (Quick Escape). What is quick escape? It's a tool that lets you quickly paste in HTML and for that to be converted to escaped characters which can be pasted back in to your HTML source code so that it renders on screen.
Now you can put the results between

<pre class="prettyprint">
<!-- Put your source code here -->

Now you need to enable a word wrapping mechanism for "pre" HTML tags. Put the following css code to your HTML template somewhere at the beginning, where you have your page defaults:

pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
white-space : normal;

(Here you see a C++ code inserted into the blog post using the method above)
* @brief A partial specialization of SCaller template with #MiscCommon::NullType.
* @brief Used to implement calls of commands \\b without a Return object.
template<class _Parent, class _LogFun>
struct SCaller<_Parent, _LogFun, MiscCommon::NullType>
void call( _LogFun _log_callback, MiscCommon::NullType */*_ret_val*/)
_Parent *pThis = reinterpret_cast<_parent>(this);
pThis->command( _log_callback );

Eclipse CDT spell check

It seems that very soon we, users of Eclips CDT, will finally get spell check enabled for C++ source. See Eclipse bug 190512.


For one of my projects I've been using Buildbot for quite some time already. So far it satisfies all my needs in distributed builds of my continues integration process. Here you can check the web interface of the builds out.
Well, Buildbot very simple in installation and configuration, supports SVN and, what is very important, it supports distributed builds. Check out my configuration file (master.cfg) and my custom css.
A summery of the Features Buildbot 0.7.6 provides:
  • run builds on a variety of slave platforms
  • arbitrary build process: handles projects using C, Python, whatever
  • minimal host requirements: python and Twisted
  • slaves can be behind a firewall if they can still do checkout
  • status delivery through web page, email, IRC, other protocols
  • track builds in progress, provide estimated completion time
  • flexible configuration by subclassing generic build process classes
  • debug tools to force a new build, submit fake Changes, query slave status
  • released under the GPL

Dec 19, 2007

Qt 4.4 Sneak Preview

The Qt 4.4 sneak preview has been released!
We are pleased to announce that the technical preview of Qt and
Qtopia Core 4.4.0 are now available. Qt and Qtopia Core 4.4.0 technical
preview presents a number of new features for testing and feedback,

* Integration with WebKit
* Multimedia framework based on the KDE Phonon project
* Enhanced XML support
* Concurrency framework
* Interprocess communication framework
* New help system

For more information on the new features scheduled to be released with
Qt 4.4, please visit the Qt 4.4 Sneak Preview page;

Linus Torvalds: C++ is a horrible language

Linus expressed his self and his thoughts about C++ language in this topic (the full thread).
Very entertaining to read.
I also found a couple of polite comments from Andrei Alexandrescu on the subject.