Author Archive

A haiku for modulus

Posted by tbielawa on Friday, 4 September, 2009

I needed to know
Is this Even or odd, hmm?
I used modulus

This is the simplest way to quickly find out if an integer is even or odd. I’m posting this because I don’t recall my programming lab TAs or professors ever mentioning this simple way to figure that out.

May it save you many lines of code and time!

Update: Suppose I should show an exampe

if ( (your-number % 2) == 0) { echo “that’s an even number” }

Basic Screen Tutorial

Posted by tbielawa on Thursday, 3 September, 2009

I wrote a basic GNU Screen tutorial a while back for my work place. I’m posting it here for the unknown masses to enjoy too.

And now I present, Using GNU Screen. (DocBook Source & Makefile)

Linux 101 Tutorial for LCSEE

Posted by tbielawa on Sunday, 30 August, 2009

Andrew and I put together a small Linux 101 tutorial for new CS kids in our department. We collaborated on it using google docs for the outline and then google presentation to make the actual presentation.

Fixing my missing locales

Posted by tbielawa on Thursday, 13 August, 2009

Background: I run this server through Slicehost, and I enjoy their service immensely. When you set up your first server, or rebuild an existing server you get a very minimal GNU/Linux system installed. For obvious reasons, I like this a lot too.

The problem: Both the first time I built this server, and most recently when I rebuilt it to Jaunty Jackalope, the system locales weren’t configured. I understand why this is done, that it happens doesn’t bother me. That I had a hard time finding out how to properly set my locale frustrated me a little bit.

How do you know if your locales aren’t correctly defined? On my Jaunty Jackalope system I see messages like this:

locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default
locale: No such file or directory

I tried running dpkg-reconfigure locales, but that had no effect. Searching the Internet for the messages above provided a couple of possible solutions, but none of them looked like anything I was interested in. I’m a firm believer that if the Internet tells me to run a command with more than a couple of options, that it may work, but there is probably an easier, less cryptic solution. For example:

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

No way I’m running that. I instead searched for “slicehost locale” and found this article: Ubuntu Hardy setup. I enjoy this much more:

locale-gen en_US.UTF-8
 
update-locale LANG=en_US.UTF-8

Turns out that update-locale is a Debian/Ubuntu specific command. It update your systems default locale setting file. I had checked for one before running it and found that none existed yet on my system. After running those two commands above I found one had been created with “LANG=en_US.UTF-8″ in it. It’s possible that running update-locale could have been all I needed to do to begin with.

I hope this helps some one else whose had this problem before or for the first time.

Enabling automatic slash completion in nXML-Mode

Posted by tbielawa on Thursday, 13 August, 2009

I do a lot of DocBook XML editing, either at my job or at home. Because of that I’ve built up a pretty customized .emacs file. Every so often I meet another person whose also found themselves having to edit a bunch of XML. The most fantastic thing about nXML mode I think is the automatic slash completion feature. It works like this: If I have an open element, say I’ve started an <xref>, you can configure nXML mode such that upon typing the closing </ characters it will complete that sequence for you. I can just never remember how to set that option in emacs. So today I’m taking the time to finally document that procedure.

  1. Enter nxml-mode
  2. M-x customize-apropos
  3. nxml-slash
  4. Press Toggle on
  5. Optionally: select “Save for future sessions”

For even more fun, use the C-c C-f macro which will auto complete your current block, regardless of your position inside of it. For additional references, I invite you to check out the docs NM Tech has posted on nXML-Mode.

New Blog

Posted by tbielawa on Thursday, 13 August, 2009

We’ll probably change the name. For now it’s plain and descriptive: Yet another geeky blog. Let the acronyms fly!