Michael J. Forster
Whew! Poor light and make-shift tools, but my SBDC001 fits now!

Whew! Poor light and make-shift tools, but my SBDC001 fits now!

R&D: Content Delivery with AWS S3, Pharo, and Zinc HTTP Components

To reduce or eliminate the need for attached persistent storage for a client’s AWS instances, I’m exploring the use of S3 and CloudFront to store and deliver static content and uploaded files.

Since most of the applications hosted on the instances are written in Pharo, I’m using the Zinc-AWS package from Sven Van Caekenberghe’s excellent Zinc HTTP Components.

Installing LispWorks 6.1 Professional (32 bit) on Slackware64 14.1

I installed LispWorks 6.1 Professional (32-bit) on multilib Slackware64 14.1 .

The Slackware64 multilib installation includes the required GTK+ 2 (>=2.4). However, attempting to run LispWorks gives the following error message:

$ /usr/local/lib/LispWorks/lispworks-6-1-0-x86-linux

(lispworks:30162): GdkPixbuf-WARNING **: Cannot open
   pixbuf loader module file 
   '/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such
   file or directory

This likely means that your installation is broken.
Try running the command
    gdk-pixbuf-query-loaders \
      > /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
...

To remedy this, I ran the 32-bit_version of gdk-pixbuf-query-loaders(1):

$ su -
# gdk-pixbuf-query-loaders-32 \
       > /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache

Following that, LispWorks started without incident.

Installing OCaml on Slackware

Here I describe my installation of the OCaml compiler and tool chain on Slackware 13.37.

The SlackBuilds OCaml script for Slackware 13.37 specifies OCaml 3.12.1. However, that’s sufficient to install OPAM, which, in turn, can be used to install not only newer but multiple versions of OCaml.

After installing OCaml 3.12.1, I downloaded the source for OPAM 1.1.0 and followed the installation instructions. I initialised OPAM, answering “yes” to the prompt to update ~/.bash_profile and ~/.ocamlinit, and logged out and back in to make sure the OPAM environment would be set properly.

With OPAM installed, I switched to OCaml 4.01.0, installed Jane Street's core, core_extended, core_bench, and async libraries, and installed utop.

I added the following lines to &;/.ocamlinit to configure the ocaml and utop toplevels:

#use "topfind";;
#thread;;
#camlp4o;;
#require "core.top";;
#require "core.syntax";;

I will open Core.Std as needed, so I didn’t add it to ~/.ocamlinit.

Installing newsbeuter on Slackware

I used the Slackbuilds script to install newsbeuter 2.5 on Slackware 13.37.

stfl was required, so I used the SlackBuilds script to install stfl 0.22.

json-c was required, so I used the SlackBuilds script to install json-c 0.9.

Using Haskell in Anger

Recently, late in a risky project, I chose to abandon my previous efforts with another language and use Haskell to solve a difficult problem. This has been one of the best professional decisions I’ve made, and much of the success must be attributed to Haskell, its community, and functional programming in general.

However, diving into paid work with Haskell has meant focusing on production and deployment concerns at some expense to learning the language itself. It’s time to document the former and plan to remedy the latter.

Developing and Deploying with Haskell

Having installed GHC and the Haskell Platform, I have a stable Haskell environment, and I want to keep it that way. So far, I’ve used cabal only to install cabal-dev, pointfree, hlint, and ghc-paths (for GHCi) into my user package database:

$ cabal install cabal-dev
$ cabal install pointfree
$ cabal install hlint
$ cabal install ghc-paths

For the project, I’ve used cabal-dev in place of cabal to install libraries and compile the executable:

$ mkdir -p /path/to/project
$ cd /path/to/project
$ cabal init -n --is-executable
...
$ cabal-dev install postgresql-simple
$ cabal-dev install datetime
...
$ cabal-dev configure
...
$ cabal-dev build && cabal-dev ghci
.\ main
...
$ cabal-dev build && cabal-dev install
./cabal-dev/bin/Main
...

Generally, I’ve followed the advice given in How to write a Haskell program and Structure of a Haskell Project.

Learning Haskell

I’ve perused both Learn You a Haskell for Great Good! and Real World Haskell sporadically over the past couple of years, but I’m working through them in earnest now.

As well, I’m using the Haskell wiki Applications and libraries section as a guide to studying GHC and its tool environment. First up is the Prelude:

The most important Haskell library is called the Prelude. It is
implicitly imported by default, and includes the most commonly used
functions. Make sure you know what they do and how to use them
effectively.

Of course, I’ll always have a tab open to Hoogle.

Reinstalling Haskell on Slackware

I had not included hscolour when I recently installed Haskell. Consequently, package documentation was not created.

I removed the GHC and Haskell Platform Slackware packages and deleted root’s and my ~/.cabal and ~/.ghc directories. Then, I built a Slackware package for hscolour using the Slackbuilds script. Finally, I installed the Slackware packages for GHC, hscolour, and Haskell Platform, in that order.

Declaring What I need: Haskell

Yesterday, I spent a few hours with a PostgreSQL database, eliminating almost 100 lines of SQL and PL/pgSQL spread over three functions and involving six explicit locks, three nested transactions at different isolation levels, and a trigger. I replaced it all with something like the following:

insert into r0 (a0, a1, a2)
select a0, a1, a2 from r1
where (a0, a1, a2) not in (select a0, a1, a2 from r0) and ...
order by a3, a4, a5 limit 1
returning a0, a1, a2;

Simple, declarative, and guaranteed to be correct and atomic. That’s why I use PostgreSQL (as poor an implementation of the Relational Model as SQL is), and that’s why I can no longer settle for less in my general purpose programming language.

Nor can I tolerate deliberate ignorance any further. Evidence, reason, and math trump aesthetics and “pragmatism.”

I need Haskell and it’s community.

Getting started with Haskell (again)

I haven’t used Haskell for almost a year, and it’s time for a refresher.

As challenging as the Haskell language is, I’ve found that installation and tooling have been greater barriers to entry for my purposes. The Haskell Platform has made great strides to address the former, but I’ve been out of touch with progress on the latter. I’m especially concerned about cabal hell.

I came across Bob Ippolito’s article, which looks to provide a reasonable starting point for a current Haskell installation.

Previously I wrote that lparallel 2.3.2 failed to compile for me under SBCL 1.0.50. James was kind enough to contact me by email to say that he has fixed that. I’m guessing we’ll see that in a future Quicklisp update.

In the near future, I plan to write about my grokking and use of lparallel in a commercial project.