Saturday, 22 November 2008

Intermission: Posting code on Blogger

The series I'm posting on circular buffers in C++ is a bit of a personal experiment in article writing; attempting to form an article on-line in pieces that can eventually be assembled into a cohesive whole.

Thanks for the feedback you're giving me, in comments and by email. The encouragement is great.

The experience has been an interesting one so far. In fact, it's also been a quite frustrating one. The Blogger editor is supremely unhelpful when you try to enter preformatted text (like C++ code).
  • Code with angle brackets (e.g. < and >) is hard to get into Blogger without accidental butchering during editing or display, since you fall into all sorts of complex HTML problems.
  • The Blogger editor continually reformats my pre-formatted code, stripping spaces, inserting spaces, realigning things. Every time you open the editor to fix one mistake, it breaks everything you fixed last time. Very frustrating.
  • The editor window is far too small for anything except the smallest pieces of writing.
  • I've attempted using external blog editing software, Quama to sidestep these issues. It's a beta version, and so somewhat buggy. It also has it's own ideas of how to butcher and reformat my code.
  • The Blogger layout themes don't really help to make code readable at all.
If anyone has any cunning solutions to this problem, I would really love to hear them! Otherwise, I'll soldier on fiddling with code by hand and losing what's left of my hair. Please do point out layout issues to me, and I'll do my best to fix them.

5 comments:

Rik Hemsley said...

I'm using this:

http://code.google.com/p/syntaxhighlighter/

You can integrate it into your blogger HTML like this:

http://paste.rikkus.info/9

I uploaded the necessary resources to googlepages, as you can see from my example.

HTH!

Rik Hemsley said...

There's another decent-ish option: If you're using Firefox, you can use the 'It's all text' extension and use your favourite editor to author your posts - and use its inbuilt transform-to-highlighted-html function on the code parts... I've done this with gvim and it's not the worst idea ever.

Rik Hemsley said...

In case you're not sick of advice: The 'Simple II' layout (part of the standard list of blogger templates) is pretty good when you're showing code - it's nice and wide.

BanyanTree said...

Another nice out-of-browser option:

http://pygments.org/

lijialefw said...

Why was there no follow on bankruptcy then? The bailout of AIG FP went to (wow power leveling) hedge funds that bound credit swaps on Lehman failing or others betting on rating (wow power leveling) declines. AIG has drained over 100 billion from the government. Which had to go to (wow power leveling) those who bet on failures and downgrades. Many of whom (power leveling)were hedge funds. I-banks that had offsetting swaps needed the money from the AIG bailout or they would have been caught. Its an (wow powerleveling) insiders game and it takes just a little bit too much time for most people to think (wow gold) through where the AIG 100 billion bailout money went to, hedge funds and players, many of whom hire from the top ranks of DOJ, Fed, Treasury, CAOBO