Monday, August 30, 2010

Nice, just installed Rubinius-1.0.1

I first tried seriously using the "Ruby implemented in Ruby" Rubinius last spring and really liked it. If you have not done so already install it (rvm install rbx) and give it a try. Rubinius does not support 1.9.x syntax yet, but that is coming. Great work by the developers of Ruby 1.9.* but I still like the idea of Rubinius, long term. Good show for Engineyard supporting the Rubinius development.

Sunday, August 29, 2010

Using cljr for Clojure development

At work I now use the Clojure setup that everyone else uses, emacs+swank-clojure, with our custom repositories. For my own Clojure hacking (my own projects) I have just about settled on using cljr for convenience and agility. For me, the big win is being able to access Clojure libraries, Java libraries, and JAR files containing data sets I use often for NLP work from any directory. I don't need a heavy weight project, like for example, using Leiningen with all dependencies locally loaded. cljr uses Leiningen to manage the packages in the single ~/.cljr repository. When you startup cljr, everything in ~/.cljr is on your JVM classpath: this may seem a little heavy, but it is very convenient.

As an example, this morning I noticed an old Twitter direct message from the author of Nozzle library asking me if I had a chance to try it. Instead of setting up a separate Leiningen project directory, I just did a cljr install com.ashafa/nozzle 0.2.1, went to my catch-all directory where I keep short snippets of Clojure code, and entered Tunde's test program for Nozzle:
;; assumes: cljr install com.ashafa/nozzle 0.2.1

(use 'com.ashafa.nozzle)

(def username (System/getenv "TWITTER_ACCOUNT"))
(def passwd   (System/getenv "TWITTER_PASSWD"))

(defn my-callback 
   [message] 
   (println message))

(def noz (create-nozzle "filter" username passwd my-callback {:track "twitter"}))
and running it is as simple as:
cljr run nozzle-twitter-test.clj
or, using swank and Emacs:
cljr swank
and in Emacs do M-x slime-connect and in the repl: (load "nozzle-twitter-test")

My light weight Clojure wrapper for the PowerLoom knowledge representation and reasoning system

A ZIP file with everything you need to try it is on my open source web page.

PowerLoom has been in development for many years and is available in Common Lisp, C++, and Java editions. I wrapped the Java edition for this project.

This is just a first cut at a wrapper because assertions and queries must be encoded as strings.

Ruby happiness: first Ruby 1.9.2 released, now Rails 3.0

Assuming you have RVM installed, don't wait:
rvm install 1.9.2
rvm 1.9.2
gem install rails
and you will be up to date. I wrote a small utility app to browse MongoDB data we use for text mining for my customer this morning and I used Rails 2.3.8 and hopefully that will be the last time I start a new project < version 3.0. My excuse for not using version 3.0 was that I wrote and deployed the app in less than an hour, and I am just not up to speed on Rails 3 yet. That will change!

I am merging my other three blogs into this (my main) blog

I had what I thought was a good idea in the last year: split out special interests into:I am going to leave my other three blogs intact, as-is, but I am going to start doing two things: all of my non-book writing will go into this single blog and I am going to copy a few of my recent articles in the other three blogs to this one. Havng four distinct blogs has been a nuisance.

Friday, August 27, 2010

Moving MySQL to a large EBS volume

I had to move a very large customer MySQL database used for data mining to a large EBS raid. Since following the usual documentation did not work for me, here are my notes: after following the standard instructions for setting up RAID 0 (EBS is robust enough that I see little reason to use error correcting RAID, but do so if you wish), I followed some of the instructions here for mapping the usual installation location for MySQL data to the RAID EBS volume and using some fstab trickery (copied from the linked article):
sudo mkdir /vol/etc /vol/lib /vol/log
sudo mv /etc/mysql /vol/etc/
sudo mv /var/lib/mysql /vol/lib/
sudo mv /var/log/mysql /vol/log/

sudo mkdir /etc/mysql
sudo mkdir /var/lib/mysql
sudo mkdir /var/log/mysql

echo "/vol/etc/mysql /etc/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /etc/mysql

echo "/vol/lib/mysql /var/lib/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/lib/mysql

echo "/vol/log/mysql /var/log/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/log/mysql
I then did an apt-get remove on MySQL, followed by an apt-get install of MySQL and everything that I wanted is now set up on the large EBS RAID volume and I could start the very long database import process.

Tuesday, August 24, 2010

Good resources for learning HTML5

I recommend starting with slides.html5rocks.com for a good overview, get really excited by playing with some demos at hakim.se/experiments, and then using diveintohtml5.org as a tutorial/reference.

Friday, August 20, 2010

filling a tech knowledge hole: I bought "HTML5 Up and Running"

This has been a very busy year for me, and because of that I have been ignoring the tidal wave known as HTML5. The book looks very good so far.

Sunday, August 15, 2010

How programming languages affect thinking; Clojure at work; my Clojure wrapper for PowerLoom

The Sapir-Whorf hypothesis is that the human language that we think in and communicate with affects our thought processes: the way we think.

Because my current job mostly uses the Clojure programming language, I have been thinking in Clojure idioms lately - a big change from Java and a smaller but still significant change to using Ruby. (BTW, you may have noticed that I don't blog here anymore about Ruby; this is because I have a dedicated Ruby blog now.)

At work Clojure has been a good choice because it is concise, has well designed APIs (for example, most built in data structures support the seq uniform APIs: everything mostly works the same for lists, sequences, binary trees, maps, etc.), and can take advantage available Java libraries. As a personal project, I finished wrapping the PowerLoom knowledge representation and reasoning system in a thin Clojure library this morning. (See my Clojure blog for more information.)