Happy New Year!
2010 is going to be the year of awesomeness! I can feel it.
One little project I’m undertaking is to build a CCTV system for the house. A little background, last Christmas our place got broken into. Among other measures, a CCTV/camera system was something we wanted to install. The requirements are basically to be relatively cheap and preferably with motion detection so the cameras don’t need to be turned on constantly.
The biggest cost to the system is likely to be the cameras. For prototyping, I will use an old Ubuntu box and getting one camera to start with. ZoneMinder is the software that will be running on the Ubuntu box.
After doing some research, the D-Link DCS-920 will be the initial camera for prototyping with. It seems to be the best compromise between cost and features. It’s wireless and appears to have fairly decent image quality.
In my plans for world domination, I need messaging software. I wanted to try out ZeroMQ (trying out RabbitMQ is for another weekend). I’m skipping ActiveMQ since we use it at work and I mostly understand what it provides.
Downloaded the tarball and it compiled right out of the box. However when I tried to get it to run with a simple java program I’ve written, I kept getting this error (this is on Leopard).
dc@feynman:dist$ java -Djava.library.path=/opt/personal/pkg/zmq/lib -classpath lib/Zmq.jar -jar ZmqTest.jar Creating ZMQ Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/personal/pkg/zmq/lib/libjzmq.1.0.0.dylib: no suitable image found. Did find: /opt/personal/pkg/zmq/lib/libjzmq.1.0.0.dylib: mach-o, but wrong architecture /opt/personal/pkg/zmq/lib/libjzmq.1.0.0.dylib: mach-o, but wrong architecture at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1881) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1805) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1045) at org.zmq.Zmq.(Zmq.java:25) at zmqtest.Main.main(Main.java:15)
As far as I can guess, the JVM I’m using is 64bit so the libraries it loads also need to be compiled as 64bits. To fix this, I had to set the CXXFLAGS environment variable to build 64 bits. This set of steps worked for me.
export CXXFLAGS="-arch x86_64" ./configure --prefix=/opt/personal/pkg/zmq -with-java make clean make make install
Here’s my small java program
package zmqtest; import org.zmq.Zmq; public class Main { public static void main(String[] args) { System.out.println("Creating ZMQ"); Zmq zmq = new Zmq("localhost"); System.out.println("Done creating ZMQ"); } }
Since I've been hacking Clojure with Slime on Emacs, I've found myself wanting the Caps Lock key to work as the Control key. This makes some of the key combinations with Emacs easier to hit. Leopard makes this easy (almost too easy!).
First open "System Preferences", and select the "Keyboard And Mouse" preference pane.
Then click on the "Modifier Keys" button.
Finally pick Control for the Caps Lock key. Note that I made Caps Locks and the Control keys work as Control. Initially I swapped the functionality of the keys and found that years of using Control in the old location made me hit it too often. Since I rarely used Caps Lock, I decided to just make both of them Control.
QED!
[Update: I redid these instructions when I moved to clojure 1.1 . Take a look if you're interested]
For the last couple of days, I've been enjoying the combination of Clojure + Emacs + SLIME . Getting it working on my Mac was relatively straightforward (although I hit one minor bump).
To get started, git and Java 6 need to be installed on your Mac. I used the Java 6 SDK supplied by Apple (Java 5 might also work but I'm not using that). git was installed through MacPorts .
1. Get clojure-mode
> mkdir ~/src
> cd ~/src
> git clone git://github.com/jochu/clojure-mode.git
2. Add these lines to your .emacs
(add-to-list 'load-path "~/src/clojure-mode")
(require 'clojure-mode)
Restart emacs (or evaluate the 2 lines above)
3. M-x clojure-install (inside emacs)
4. When done, you'll see something like this.
5. If you do as the instruction suggest, you'll get an error about missing a file or directory.
6. Add the following lines to your .emacs
(setq swank-clojure-classpath '())
(add-to-list 'swank-clojure-classpath "~/src/clojure-contrib/clojure-contrib.jar")
(add-to-list 'swank-clojure-classpath "~/src/clojure/clojure-1.0.0-SNAPSHOT.jar")
(clojure-slime-config)
Restart emacs (or evaluate these lines). Note: you can use the swank-clojure-classpath variable to add jar files or directories to your classpath to work with in SLIME.
7. M-x slime
P.S Some weirdness with the formatting. I was having trouble with the blog editor.
There were some annoyances which I fixed by putting some config into my ~/.vimperatorrc
" disable the annoying audible beeping
set visualbell
" make a disable vimperator for gmail and google reader, activate by doing :disable and :enable. tip was from here
js function disable() { liberator.execute(':set guioptions=Tnbrm showtabline=1'); modes.passAllKeys = true; }
command disable javascript disable()
command enable set guioptions= showtabline=0
Went through the exercise of removing unwanted stuff on a PC notebook today. Replaced crappy proprietary software with better open source alternatives. I can't help but wonder if the low cost of notebooks is forcing PC manufacturers to pursue other revenue streams to cover cost.
I was tempted to go the Ubuntu route then decided against it since the notebook was not for me.
Trying out the new TypePad. The differences are there but I'm not noticing anything major. This was the first weekend for the last couple of months where no running was done. Between recovering from the marathon(a month ago), the cougar mountain trail run, Ragnar and the twisted ankle, I was taking it really easy this weekend. It was a nice change of pace not to wake up early on Saturday or Sunday. That gave me sometime to play with technologies and write down some ideas.
Been meaning to try out Aptana Studio and Jaxer. Finally got a chance to do that this weekend. Like the concept for Jaxer bur was really impressed with Aptana Studio. It has a whole bunch of auto complete stuff I didn't expect. I've not been in the IDE world for too long (still preferring a good old text editor) but for new technology an IDE really helps with the learning curve. Might be hacking some rails code with Michael and looking to give Studio a try.
Didn't get too deeply into it but also mucked about with Hadoop, Cappuccino and picked up where I left off with Clojure from a couple of weeks back. Finally settling on Aquamacs + Swank to work with Clojure. Could not get textmate working with the REPL. Also downloaded the MPS language workbench but didn't install it. Also reminded me about the whole language workbench I want to look at and the little pyparsing project I have with Riley.
The two things I didn't get too was the Leksah Haskell IDE and the algorithms class form MIT OCW. Also still looking to build a website with Django, Drupal and SInatra.
Played with a couple of new apps from MacHeist and MacUpdate promo package. Checked out the Project Natal stuff from Microsoft, looks cool but I'll need to try it to be convinced.
Too much stuff. Not enough time.
At the new job, we use MySQL. I’ve mostly worked with Oracle before this and while not expecting everything to be the same, the transition has been smooth.
The one gotcha that threw me for a loop is MySQL’s default transaction isolation level for. With Oracle, once data is committed, it’s available to be read by all other connections. With MySQL, your view of data is determined by the first query made after the connection is open.
One rationale (I was given) is MySQL has fast connection setups and connections are setup and torn down between queries. I’m not sure I believe that though….
The solution was to change the isolation level for my session via the following incantation:
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
(Taken from the mysql reference manual page)