Thursday, January 19, 2012

Scala and Lift

I'm working on a small discrete event simulation program in scala.  I originally wrote it as a command line program, but I would like to transition it to a web based project.  I've used Lift web framework in the past for this type of project, so I decided to use it again.  It has transitioned from using Maven to sbt to build it.

The four examples provided with the latest version have an included version of sbt, but it is a relatively old version of sbt as is the version of jetty used.  I'd like to use an update version of both.

I immediately ran into problems, but I was able to solve them after a few hours of research and experimentation.

First, I had to add the following lines to the build.sbt file located in the main project directory:

 
seq(webSettings :_*)

libraryDependencies ++= Seq (
"net.liftweb" %% "lift-webkit" % "2.4-M4" % "compile",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.RC4" % "container"
)

This uses a recent version of Lift and jetty.  I tried to move the build.sbt to the project/ directory, but I got the following error:

skr@nb00:Farm$ sbt update ~container:start
/home/skr/Software/Farm/project/build.sbt:7: error: not found: value webSettings
seq(webSettings :_*)
    ^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q

So I moved build.sbt back up to the main directory.

I had to add the plugins.sbt file in the project directory consisting of:

 // plugins

libraryDependencies <+=
   sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.10"))




Once I made these changes, everything worked as advertised.

 

Software Salad - What's in a name?

Why call a blog about software, 'Software Salad'?

I often get comments in the cafeteria about the salads I create for lunch. The cafeteria charges by the container used to construct the salad, not by weight or number of ingredients. So, it pays to 'pile it on', especially, if I'm hungry.

I like a wide variety of ingredients for my salad, generally, the less processed, the better. I use ingredients from A to Z: artichoke hearts, broccoli, cabbage, carrots, eggs, peppers, spinach, sunflower seeds, tomatoes, zucchini and more. The light fluffy stuff (lettuce and other greens) go on the plate first and the heavier items last since they will compress the greens. When I'm done, I've created a work of art, as some coworkers have commented.

So what has this to do with software?

Modern software development has become much like building a salad. We have hundreds of ingredients, languages, libraries, and tool sets, to choose from. You need a plan in order to build a masterpiece.

I plan to use this blog to document my building of 'Software Salads'.