Monday, May 26, 2008

Alright!

git in the Ubuntu 8.04 repositories now supports interactive rebase! My job just got much, much easier. Thank you repo maintainers!

Tuesday, May 20, 2008

Dweller is back

Holy cow! Dweller is back online again! I remember some time ago this not being the case, so pick it up while you still can.

Dweller is a roguelike game for mobile phones. If you're after a surprisingly addictive game to tide you over on the train on the way to work, this just might be the thing for you. Sure beats wasting time on card games. I've played it myself quite a while ago, and it's surprisingly easy to control, and the levels show lots of variation. Highly recommended.

Saturday, May 17, 2008

There's something about LaTeX...

... that makes writing documents fun! It might have something to do with the fact that even with the default settings, the output looks awesome. For a guy whose document-writing experience has been limited to OpenOffice.org and Microsoft Word, the whole thing feels very liberating.

That's another thing: when I make a document in LaTeX, I'm free to use whatever editor I like. MS Word's interface is a mess (2007 perhaps less of a mess), while the load time for OO.o is excessive to the point where I hesitate to open anything that would load it. No more of that crap. From here on, it's Emacs and AUCTeX for me.

The biggest hurdle is rustling the tools together. I use Ubuntu Linux and Emacs already. First thing was to install texlive from the package manager, which installs the tools you need. To integrate with Emacs, just install auctex along with it.

Keys are simple enough: C-c C-c to process/view your document, C-c C-p C-b to generate inline buffer previews for headings and formulas. I'm sure there's more, but I easily use these two key chords more than any other when working with LaTeX docs in Emacs.

LaTeX itself isn't difficult. Here's a simple document:

\documentclass{article}

% lol preamble (doesn't appear directly, just informational)
\title{The many ways to skin a cat}
\author{Some dude}

\begin{document}

% here's where the fun begins

\maketitle

Normally, cats aren't the sort of thing you'd even consider
eating. But if you're running low on supplies and money has
been exhausted, you may be left with no other option that to
consider making the inedible, well, edible.

I can break these damn lines up however I want.
This is on the same paragraph as the line above.
Only empty lines separate paragraphs.

I can type like a moron, because like in HTML
the whitespace in a paragraph is collapsed into
single spaces.

\end{document}

Making a final PDF is simple too. If you process your document as above, you already have "blah.dvi" derived from the "blah.tex" you were editing/viewing. I already have dvi2pdf available from a command prompt (which I also run in an Emacs buffer using M-x ansi-term), so just run that DVI through that program and a shiny new PDF is created with your doc. Pretty swanky.

And to think there was a day when I thought this kind of stuff was impenetrable.

Wednesday, May 14, 2008

Common Lisp + Emacs + SLIME under Windows

Due to reasons relating to my studies, I have to deal with Windows more often now. Crap. But I can still play around with Common Lisp.

Or so I thought at first. I already have Emacs installed, getting the CLISP Common Lisp implementation and SLIME should be easy, right?

How wrong I was.

Nothing seemed to go right. I mean, the downloads went A-OK, and I installed things alright. Tacking it all together ran me into brick walls. Repeatedly. There were always obscure errors about not being able to invoke the Lisp implementation properly. Google, universal as it is, still came up with lots of cruft.

Eventually, I found out from a post online (by Robert Zubek) that spaces in paths caused problems in SLIME. It never really comes up in *nix environments, because nobody's dumb enough to put spaces in any directory names, but SLIME groks paths using 'split-string. This of course means that directory names with spaces will be pulled apart where they aren't meant to.

Solution? Install everything in friggin' C:\. No spaces, no nothing. After the usual setting of paths for SLIME in .emacs, everything works just dandy.

Hacking on Windows: who'dve thunk it?

Saturday, May 3, 2008

git: Collapse the last commits

This is mostly for my own benefit, so I don't forget it later on. I'm learning how to use git.

What happened was that I committed some changes. Pretty normal. Then I realised I forgot to take something out. I committed that, with an "Oops, I should have included this in the last commit too"-style message.

I'm using Ubuntu 7.10, which has an old version of git without interactive rebase (I'll switch soon, I swear!), so I couldn't use that. After a rather dopey hour of searching how to use rebase to collapse the latest two commits, I opted for a different tack.

Turns out all I had to do was the following:

git reset --soft HEAD^
git commit --amend

The first line sets the current HEAD to the second-last commit, while keeping the changes I wanted in the index cache (i.e. the removal of the stuff I wanted to take out). The second makes the correction. Result? The latest intermediate commit is collapsed into the second-latest, so I don't have a messy history.

Of course, this is rewriting history, so I wouldn't want to do this for a public branch, but I'm the only one working on this small project anyway, so it's fine.