Skip navigation

Category Archives: Programming

Python’s imp module is a bit of a bear, but thanks to the groundwork in this thread, I got it straitened out. Here’s some lightly tested sample code.

import imp
# the path variable is optional, but possibly necessary
tmp = imp.find_module("module", ["relative/path", "/absolute/path"])
# the names of the two constants do not seem to matter
  module = imp.load_module("name", tmp[0], "path", tmp[2])

This is how I created a tarball that, when extracted, gives a fully functioning install of python 2.6 w/ mysql – while leaving all of the original binaries in place.  The destination of the tarball must be decided at compile time. You may need to recreate the tarball if any of the software packages this is based on (the *-devel packages found below) are upgraded.

The creation process will modify the build server, though the resulting tarball will be completely clean (can be untarred into any similar server with identical software versions and file locations without modification).   You may want to wipe your environment after successfully testing deployment.
Read More »

If emacs isn’t your thing, or you prefer a modern IDE (read: GUI) for development, I recommend IntelliJ IDEA.  An open-source, community edition was just released, and it is definitely worth giving a spin – I’ve been a fan since I first tried it a couple of years ago.

Being at a university where the first language taught is Java, but transferring from an institution where C++ was dominant was a bit of a pain.  IntelliJ got me through my Java-based courses.  I tried and managed with Eclipse and NetBeans for the first semester – but we were given a significant initial framework.

Enough of my praise for IntelliJ.  Let’s get started!
Read More »

More than anything, this post succinctly describes how to get up and running with Clojure + Emacs. Virtually no thinking is required if you are working from a default install of Ubuntu, and not much more is required for any linux distro – you just need to know how to use your package manager.

Furthermore, if any of these steps would cause you trouble (deleting .emacs* comes to mind), you probably already know how to handle it.
Read More »

Not many people know that I run Gentoo (a source-based linux distribution) at home. Largely this is because most people don’t care. But for those who may care, I’ve decided to explain how Gentoo is better, at least for me.

Gentoo is known for taking a lot of time to set up – which is well deserved. Gentoo typically takes 1-3 days to complete a full install, and requires more work in maintenance than most other distros.

However, as I developer, I find that it is quite nice.
Read More »

Cross platform software can be difficult to debug.  Having a set of virtual machines on hand that can be used for testing can be quite handy.  Here are a few resources I’ve found for pre-made disk images.

VMWare Player images (seems to have much less variety):


Gentoo (didn’t find a VirtualBox image)

VirtualBox images (large variety):

VirtualBoxImages (mainly torrents, large index)

VirtualBox Images (direct download, hosted on sourceforge)

HelpDeskLive (older)

I think that should cover most open-source OSs.

As far as windows goes, one option is to roll your own and save it in its initial state.  If you have access to the MSDN, most OS releases are quite readily available.

Clojure is a new Lisp on the block.  It runs on the JVM, giving it full access to any Java library (and its complement), but it leans more towards the functional paradigm, so data structures are immutable (a big boon for concurrent programming, as locks become obsolete).

In addition to supporting the usual data types of Lisp, Clojure has added syntactic support for vectors, maps and sets.  Some sacrifices have been made for performance; in order to have immutable data structures, it returns a new data structure for each mutation.  However, because the parent data structure is immutable, much of the structure can be shared. Performance-wise, Rich Hickey has stated that “I’ve tried to keep [operations] all within 1 to 4 times [the equivalent] Java data structure, [but lookup times are frequently faster]”.

Read More »

Update: this post is now obsolete with the advent of official exherbo installation instructions.

As the Exherbo developers say, this distribution is not finished/supported/full featured and is very volatile. The project has been alive for less than a year, and there is a significant amount of work to be done before it will be ready for the mainstream.

That said, this is what I did to get it working…

This information should be used to get an idea of Exherbo’s status, not as a reference for installation. If you are unfamiliar with any of these steps, you probably shouldn’t try Exherbo.

Read More »

How many times have you needed to sort a file based on random or arbitrary criteria?  Well, probably not too frequently, and even if you have the need, you should be able to write one in less time than it takes to find a base.  But let’s ignore that.

One solution might be to do some fancy-schmancy mapping operation on the file, such that your data is preserved, but an alphabetical sort will give you your desired order, after which point you can remove whatever processing you did to it.

That sounds like it would be painful.  Or fun, if you have enough time or an interesting idea crosses your mind.

At any rate, a friend of mine recently was faced with an interesting dilemma, where he needed to sort a file based on some unusual criteria.  Here are the basics of his problem.  He forgot the last few characters in a password, but he was fairly sure they were letters and lower-case numbers.  So, he wanted to prioritize the the order in which he checked the 15 million combinations (62^4).

Read More »

I don’t even know if this program I am building deserves the title of grammar checker.  Regardless of what it deserves, it must be referred to as something.  I will refer to it as a probabilistic grammar checker.

My basic premises are these:

  1. It is impossible to precisely parse natural languages, due to grammatical ambiguities
  2. Simple algorithms can often provide results that are superior to more complex algorithms
  3. Simple algorithms are easier to analyze
  4. Effective analysis can bring significant insights on how to improve an algorithm

Based on these premises, I am building a brain-dead grammar checker.  As I test it, I will see its failings, and from those failings will be able to analyze its weaknesses.  With a knowledge of its weaknesses, I will be able to either enhance the algorithm in minor ways, or discover what issues exist in my underlying assumptions. Read More »