A Single Programmer's Blog

Scala Hackaton and SQL Workshop Wrap Up

in
Auteur: 
François Beausoleil

A great time was had by all!

Seriously, the Scala workshop was very cool. The actor model was new to almost all attendants and needed some explaining. Looking back, I should have explained a bit more about how the this works. From what I saw, nobody stumbled upon the Scala syntax that much. The people that were there were all experienced programmers, thus may not have needed much hand-holding regarding syntax.

Quick Puppet Tip

in
Auteur: 
François Beausoleil

While testing my Puppet recipes, I usually boot a new instance then apply configuration manually. I have a base configuration, which is extended with other things. I just noticed I could apply a manifest using STDIN:

1 # ( echo "include sysbase" ; echo "include rabbitmq" ) | puppet apply -v

Viva the Unix tradition!

If you do any kind of configuration management, I highly recommend Puppet.

Needium Joins Seevibes for Beer

in
Auteur: 
François Beausoleil

I just learned this morning that Needium will join Seevibes in sponsoring the beer at the Scala Hackaton and SQL Workshop. Both events are on February 2nd. If you haven’t already done so and wish to join us, please register at EventBrite:

Announcing Scala and SQL Event on February 2nd in Montreal

in
Auteur: 
François Beausoleil

I would like to invite you to attend one or two events on February 2nd: Analyzing Twitter Social Data using Scala and Akka Actors and Social Media Metrics using SQL Engines.

Daemontools Best Practices

Auteur: 
François Beausoleil

I sometimes have to do sysadmin work, such as when I’m the sole technical person on a probject. When I need to keep a service running, I usually turn to daemontools. Daemontools was written by D. J. Bernstein, a mathematician and author of many UNIX utilities.

From daemontools’ home page:

daemontools is a collection of tools for managing UNIX services.

Running ScalaTest Tests Under IntelliJ IDEA

in
Auteur: 
François Beausoleil

I had lots of difficulties running my tests under IDEA. The exact error message was:

Error running All Tests:
Not found suite class.

Where All Tests was the name of my Run configuration.

I finally ended up with the right incantations. In my POM, I have the following:

Simple-Build-Tool: Error Getting Started

in
Auteur: 
François Beausoleil

I’m starting in Scala, because Seevibes’ code is in Scala. Scala has a tool named simple-build-tool for managing your projects. sbt is similar to Ruby’s Bundler and Clojure’s Leiningen in that it manages dependencies and helps build a project for you.

Unfortunately, I had problems getting started. After following the Setup instructions, I was consistently getting this error:

Sequel's #set_all still restricts the primary key

in
Auteur: 
François Beausoleil

I ran into a little gotcha today, using Sequel. I’m writing an importer, you know the kind: read record from database A, apply some transformations, write to database B. No rocket science required. But, Sequel has a little gotcha that stumped me for a bit. My script looked like this:

Counters: An Easy Way to Gather Metrics From Your Ruby Code

in
Auteur: 
François Beausoleil

Sometimes, you need to know what your program’s doing, or how long it’s taking to do something. You could always log to a file, then use a combination of grep, awk and/or wc to gather the statistics yourself, but why bother?

JRuby, PostgreSQL and Bulk Copy Operations

Auteur: 
François Beausoleil

1 # JRuby 1.6.0 required
2 require "sequel"
3 require "jdbc/postgresql"
4
5 DB = Sequel.connect "jdbc:postgresql://127.0.0.1:5432/mydb"
6
7 table = DB[:mytable]
8 time = Benchmark.measure do
9 (1..10000).each do |n|
10 table.insert(:a => n, :b => 2*n)
11 end
12 end
13
14 puts time

How much time do you think this is going to take? This is the most inefficient way to insert many rows to a database. Remember each call to #insert will do a round trip to the database.