Archive for August, 2006

Success

From Seth Godin:

I’m afraid we come back to something that marketers have been struggling with for a really long time—the best way to succeed is to have a really great product.

Installing HAppS

Update: HAppS 0.8.2 is out, which works with the latest version of FPS. (FPS 0.8 from latest darcs)

HAppS is an application server for Haskell. An initial read of the documentation makes it seem like a very good platform for building web applications.

The inspiration for HAppS has come from frameworks such as Python’s twisted, but with the type safety and speed that Haskell can offer. Initial performance benchmarks look quite promising.

To actually evaluate HAppS, it first needs to be installed. Below is the list of packages that go together to get it running on Mac OS X Tiger.

Versions

  • HAppS (from darcs 2006-08-20) - Haskell App Server
  • FPS 0.5 - Fast Packed String library
  • GHC 6.4.1 for Mac OS X - Haskell compiler
  • Haddock 0.7 - Documentation generator
  • Happy 1.15 - Parser generator system
  • HaXml 1.13.1 - XML library
  • Alex 2.0.1 - Lexical analyser generator
  • cpphs 1.2 - Haskell preprocessor

For Haddock to work you will also need a LaTeX system and the DocBook XSL stylesheets.

Building

GHC installs as a binary package. The remainder of the packages are installed using a reasonably standard configure; build; install process.

Haskell has its own build system, based around Cabal files that list dependencies. Most source packages will include a Setup.hs file and a *.Cabal file.

To invoke the Setup.hs file, use either the runhaskell script or make the Setup.hs file executable (it will then hunt for runhaskell). You need to have /usr/local/bin in your path.


% runhaskell ./Setup.hs configure
% runhaskell ./Setup.hs build
% sudo runhaskell ./Setup.hs install

FPS

The Fast Packed String library allows for fast string manipulation from within Haskell. However, there is a bit of a version problem with HAppS.

  • HAppS 0.8 - needs FPS 0.4 (or earlier)
  • HAppS dev - needs FPS 0.5 (0.7 breaks)

FPS changes its interface between minor versions, thus breaking dependencies for HAppS. It would be good for the HAppS installation to include the list of versions used to build against, or for FPS to use better versioning.

Examples

The example that looks most interesting is httpd.hs. Based on the behavior of http://happs.org/ it appears that they are running this example as base of the site.

In the examples directory, change the import statement for the httpd.hs file as follows:


import Data.ByteString.Char8
--import Data.FastPackedString

Assuming that you are using FPS 0.5 and the development version of HAppS.

The example can then be run from examples/ as follows:


% make
% mkdir HAppS
% echo '<h1>Hello World</h1>' > HAppS/README.html
% ./httpd

Then point Safari to http://localhost:5000/. The example will redirect to the file created above and serve the page.

SVN, RSS and shell magic on Mac OS X

Bill Bumgarner has a wonderful post on how to setup an RSS feed for a SVN server. This is an interesting approach, especially given how most of my workflow is now RSS based - email, photos, news.

However, the thing that caught my attention was a little command in the midst of his shell scripting:


pbpaste > post-commit

pbpaste isn’t a command I’ve come across before, but one that I looked at and went, “Wow!”.

I’m already a fan of open and have attempted to replicate its behavior on both Windows and KDE to limited success. pbpaste is going to make me miss working on my Mac even more.

pbpaste and its cousin, pbcopy, allow you to redirect the clipboard (PasteBoard) to and from the shell respectively. One of those obvious integration things that makes life a bit easier.

Thanks Apple, you’ve made it harder again to switch away from Mac OS X, and I don’t even have Time Machine … yet.

Magic

One of my favorite quotes!

Any sufficiently advanced technology is indistinguishable from magic.

Arthur C. Clarke, “Profiles of The Future”, 1961 (Clarke’s third law)

On a recent trip to Germany, opened my dictionary from high school and found prose that I recorded:

The kernel of all jealousy is a lack of love

- C. Jung

Courage, love, friendship,
Compassion, and empathy
Lift us above the simple beasts
And define humanity.

- The Book of Counted Sorrows

And one more discovered recently:

Beauty must be constantly recreated as truth

- jean-christophe ammann