Author Archive

Macports updates their Erlang version, update your load-path’s

Posted by on Wednesday, 3 February, 2010

I’ve been working on my XMPP server pet project recently, and the need for a good Erlang XML parser has finally struck. I decided to go with Erlsom. It’s in MacPorts, so from there I installed it. Now, since I don’t update my port tree frequently I get delightful surprises from time to time. This time installing Erlsom triggered an update of Erlang, to the latest version!

Short story shorter, the update changes the path to the erlang-mode.el file so before you can M-x erlang-mode again you’ll have you fix your Emacs load-path to register the new location. (See my older post on how to initially set up Erlang and Emacs from MacPorts from scratch)

The new load commands should be:

(setq load-path (cons  "/opt/local/lib/erlang/lib/tools-2.6.5/emacs/" load-path))
(setq erlang-root-dir "/opt/local/lib/erlang")
(setq exec-path (cons "/opt/local/bin" exec-path))
(require 'erlang-start)

It just requires changing the tools-x.x.x to 2.6.5.

p.s. about erlang-mode

Syndication

Posted by on Monday, 14 December, 2009

Emacs related posts are now being syndicated on Planet Emacsen!

Installing dblatex from the latest MacPorts

Posted by on Friday, 4 December, 2009

I ran into this issue while installing dblatex (0.2.10) from the most recent MacPorts tree today:

Traceback (most recent call last):
  File "/opt/local/bin/dblatex", line 16, in <module>
    from dbtexmf.dblatex import dblatex
ImportError: No module named dbtexmf.dblatex

I got past it by exporting PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages, but clearly this was not optimal. I was about to file a bug report about the issue but before I did that I read their new ticket guidelines which requested the full build log be included in the ticket.

In the build log was the solution. I would have missed it had my shell scrollback not been set to unlimited. Nestled a good 182 lines back in my buffer was this little message:

--->  Installing python26 @2.6.4_0+darwin
--->  Activating python26 @2.6.4_0+darwin
 
To fully complete your installation and make python 2.6 the default, please run
 
sudo port install python_select
sudo python_select python26

I did as instructed, and sure enough, dblatex started working! I just wanted to post this on the blog in case anyone else ran into this and missed it like I did.

Macports, and Erlang: Setting up Emacs and your $MANPATH

Posted by on Wednesday, 2 December, 2009

You may find this helpful if you should find yourself using Erlang on OS X and you’ve installed it using Macports. After a default installation you’ll need to manually configure your .emacs file for erlang-mode and set your $MANPATH variable correctly, here’s how.

If you’ve installed Erlang with Macports then you may have noticed that when you edit .erl files you’re not entering into erlang-mode, nor is it available to enter into. Here’s how I got erlang-mode working on my system.

Macports will install Erlang into /opt/local/lib/erlang by default. The paths to put in your .emacs file provided in the erlang-mode documentation only need to be tweaked a slight bit to function properly. Here’s what I put in mine:

(setq load-path (cons  "/opt/local/lib/erlang/lib/tools-2.6.4/emacs/" load-path))
(setq erlang-root-dir "/opt/local/lib/erlang")
(setq exec-path (cons "/opt/local/bin" exec-path))
(require 'erlang-start)

Note that you may require setting “tools-2.6.4″ to something else if Macports has upgraded it’s distribution of Erlang.

Setting up your $MANPATH variable is fairly simple as well. Just put the string “/opt/local/lib/erlang/man” in a file called ‘erlang’ in /etc/manpaths.d/ and make sure it ends with an empty line. Test this by opening a new terminal and running: echo $MANPATH | grep erlang. If it doesn’t come back empty then you’ve done it right.

Emacs Hacking, reverse other buffer

Posted by on Sunday, 18 October, 2009

I started reading Writing GNU Emacs Extensions by Bob Glickstein. The first real meaty example you work through in it is making an ‘other-buffer’ like key command that works in reverse. So here I present to the internet, my version of previous-window.

(defun previous-window ()
  "As other-buffer, except in the other-direction"
  (interactive)
  (other-window -1))
 
(global-set-key "\C-c\o" 'previous-window)

Put in your .emacs file and activate with C-c o when you have multiple frames open at once.

Building VirtualBox OSE from SVN on OS X

Posted by on Monday, 28 September, 2009

Today abutcher and I found every way to fail to build VirtualBox OSE from source on OS X. We followed the build instructions on their web site but had some problems. I’ll post a more detailed writeup of what happened and what you need to do to build it later. Until then, here’s a link to download the most recent checkout from svn, built for OS X 10.6 (Snow Leopard). And here’s the SHA256:

dd55dbaabb23e19c16fb78d5b8f41d68bd19a6ad2ef810818b5d7d480da26393

A haiku for modulus

Posted by 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 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 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 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.