Latest News >> 2008-08-06

Well, I’ll be at DefCon this year, and I always try to do something fun for the conferences I attend.

2008-08-01

Well looks like my rant about the state of open source feed readers hit some sites, so I should put in a few clarifications so people understand what I was looking for more specifically. I’ll do it by answering several of the questions people sent me.

2008-07-20

RubyFringe was my last Ruby conference and it was the best conference to go out on. Everything about RubyFringe was great. It was well organized, contained eclectic talks, and supported the weirdness that’s usually hidden at the other conferences.

2008-06-25

I’ve been completely fed up with news/feed/rss/atom readers these days. I use Linux as my primary operating system, and I only have a few feeds that I want to rip through quick so I can get to reading the content. Yet, trying to find a reader that doesn’t suck donkey balls has been a chore.

Well, I’ve got Idiopidae (my alternative to noweb) working for parsing up the sections of my book and importing code. Factor and the PEG parser setup by Chris Double do a decent job of this. This means that I can actually inject code from arbitrary source files into my LyX or TeX documents and have it typeset.

However, there’s a problem: it looks like shit as just plain text. One of the reasons I’m working on Idiopidae is that I can’t stand the way most code is injected into books. Either the code is pasted in by hand, the author makes a “build system”, or they use something like noweb.

Pasting in by hand sucks because, as the software evolves (which mine will for sure) someone has to update all those little code snippets. It’s error prone, disgusting, ugly, and I refuse to do it. Full stop.

Noweb and cweb suffer from the problem that since the code and the prose are in one file, that file looks nothing like the code or the prose. Instead it’s this mind boggling escape festival that “magically” produces the real source files for both the book and the software.

WTF. My book should look like my book and work like my book. My code should look like my code and work like my code. There’s no reason I can’t use some of that advanced compiler technology known as “import” and “export” to make a system that can merge the two for me based on statements in both.

That’s why I’m building Idiopidae.

With the problem of how to import/export sections of source code into the book solved (mostly) I wanted to get the formatting of the source sexy. I’ve always hated how source is laid out in most books: Usually in nasty fonts without any syntax highlighting, and never any color.

Lucky for me Factor has a great xmode library that can process about 100 programming languages and produce a token stream, and it already had a code2html library that produced HTML output. I just had to learn xmode and then write a similar converter to TeX’s nasty ass format.

Here’s the Factor code, Ruby sample, and TeX output. It’s a paste so don’t expect it to be around long. I’ll have more when it’s all working though.

You can see it’s not much code and what it produces is already quite nice. Here’s a sample PDF I’ve been playing with. The first block is just some sample TeX commands for the types of formatting I can do. After that is the above mentioned Ruby code injected into that document. The original source document is LyX but I had to do a bit of hand retouching since Idiopidae isn’t quite there yet.

What’s kind of nice is since there’s already a code2html in addition to my new code2tex I can inject formatted and named sections of code as either TeX or HTML. I’m hoping that’ll make writing about code on my blog easier too.

Next up is to figure out what’s the best font structure to use, how the hell TeX escapes stuff, and then how to go about doing fast builds of large books or chapters with Idiopidae.

Oh yeah, TeX is dogshit. It may produce great results, and maybe there’s LaTeX, but without LyX I wouldn’t touch it manually. Any language that has so many ways that different symbols must be escaped is just nasty. So far, ’_’,’{’,’#’,’}’, and ’|’ must all be escaped differently and in different ways depending on the context.

I love Knuth’s books, but I may just skip his book on parsing if this is how he does it.