This site has been archived and will no longer be updated.
You can find my new profile at neilpahl.com. My new blog is at 808.ninja.
Thu, 14 Jun 2012:
First, your going to need to install sbt. you can use your package manager like "apt-get install sbt", but last time it gave me the older version. I followed the unix instructions:
Download sbt-launch.jar and place it in
~/bin
.Create a script to run the jar, by placing this in a file called
sbt
in your~/bin
directory:java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar `dirname $0`/sbt-launch.jar "$@"Make the script executable:
$ chmod u+x ~/bin/sbt
Then, going through the process of figuring out sbt for the second time, I realized its actually quite easy if you follow the instructions they have on assembla. The first time was confusing because they give instructions for the outdated version (which has a higher version number [0.7 > 0.10] when .10 is actually newer)
Lift documentation seems to be trying to catch up to the switch from sbt 0.7 to 0.10 (i still dont get why .1 is new than .7 since .7 is clearly greater than .1, is it normal to have .10 meaning "point ten"?) but the the using sbt section of assembla provided a good starting point.
Basically, create a folder for a project with a build.sbt in the root, then a projectName/project/plugins.sbt containing the following which is now being suggested by the documentation:
build.sbt
name := "projname" scalaVersion := "2.9.1" seq(webSettings: _*) // If using JRebel with 0.1.0 of the sbt web plugin //jettyScanDirs := Nil // using 0.2.4+ of the sbt web plugin scanDirectories in Compile := Nil //resolvers += "Java.net Maven2 Repository" at "http://download.java.net/maven/2/" // you can also add multiple repositories at the same time resolvers ++= Seq( "Scala Tools Releases" at "http://scala-tools.org/repo-releases/", "Java.net Maven2 Repository" at "http://download.java.net/maven/2/" ) // if you have issues pulling dependencies from the scala-tools repositories (checksums don't match), you can disable checksums //checksums := Nil libraryDependencies ++= { val liftVersion = "2.4" // Put the current/latest lift version here Seq( "net.liftweb" %% "lift-webkit" % liftVersion % "compile->default", "net.liftweb" %% "lift-mapper" % liftVersion % "compile->default", "net.liftweb" %% "lift-wizard" % liftVersion % "compile->default") } // when using the sbt web app plugin 0.2.4+, use "container" instead of "jetty" for the context // Customize any further dependencies as desired libraryDependencies ++= Seq( "org.eclipse.jetty" % "jetty-webapp" % "8.0.4.v20111024" % "container", // For Jetty 8 //"org.eclipse.jetty" % "jetty-webapp" % "7.3.0.v20110203" % "container", // For Jetty 7 //"org.mortbay.jetty" % "jetty" % "6.1.22" % "jetty,test", // For Jetty 6, add scope test to make jetty avl. for tests "org.scala-tools.testing" % "specs_2.9.0" % "1.6.8" % "test", // For specs.org tests "junit" % "junit" % "4.8" % "test->default", // For JUnit 4 testing "javax.servlet" % "servlet-api" % "2.5" % "provided->default", "com.h2database" % "h2" % "1.2.138", // In-process database, useful for development systems "ch.qos.logback" % "logback-classic" % "0.9.26" % "compile->default" // Logging ) // by default, it listens on port 8080; use the following to override port in container.Configuration := 8081
in the project/plugins.sbt put:
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.10")) // moved to repo1 // for the older version of the plugin, use the following instead: // you will need to change jetty's scope from 'container' to 'jetty' above //libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.1.0-"+v))
then put your scala files in ../projectRoot/src/main/scala, and web template files in ../projectRoot/src/main/webapp
I used this configuration to work through the chat tutorial on the liftweb.net
Another option to quickly get your lift app going is to use lifty. this sbt plugin will create a lift app according to a certain recipe which you can use their sample or define your own. It worked quite well and I had their sample webapp runnign in no time.
However, as a newcomer it didn't help me much because althoguh it put all the code in, I wasn't quite sure what it was doing. I think I prefer manualy setting up my lift project and will use lifty later on when I get a better clue. Hopefully learing to define my own recipes will be easy enough.
Now to learn the fundamentals of lift...
Wed, 13 Jun 2012:
I've been meaning to post this for a bit, but a very strange bug caused by a third party service provided by my web host had my page rendered uneditable for a brief while. I wouldn't mind hosting this site on my own servers, but I've already paid for this place... Anyways, back to the post:
At first, when I first started studying scala and lift, I was under the impression that Maven was the way to go to manage ones Lift (liftweb) projects. I began with (and still am) reading Programming in Scala (http://www.artima.com/shop/programming_in_scala) to learn the fascinating scala language.
After reading enough to get an idea, I am ready to dive in and get some hands on experience with it.
Really wanting to get my lift skills going, I figured I'd start with a mainly theoretical knowledge of scala, while hoping to exercise my scala skills while using lift.
Perhaps I will will work on some scala desktop tools and applications as well as some scala/lift applications so I can learn from 2 angles simultaneously.
I set up maven, followed some tutorials with it, then went to download lift. Hmm.. Lift was using SBT (Simple Build Tool) now? ok, now I'll have to play with them a bit and decide.
Maven appeared to be the more robust and enterprise-ish ready, but SBT was what it promised to be, simple. The commands to start and manage a new project in SBT, to me, seemed much simpler that Mavens Architypes which needed to be defined. I can't image memorising the syntax of them all that need to be defined for a lift project. It seemed to me that everyone who used Maven just copied and pasted the same long line into the command line to get things started. Given the time, I try to avoid these situations of doing complex things 'just because' and without knowing the configurations.
So, SBT was my choice in the end.
However, SBT is evolving quickly, even doing a major update from 0.7 to 0.10 which broke a lot of the documentation since they were not backwards compatible. Many of the sample lift projects and templates are a bit confusing because its hard to tell which version of sbt, lift, and scala they used. I worked out the kinks, and finally have my environment the way I want it:
- vim as my IDE
- SBT to manage projects and dependencies
- SBT container (called container now, instead of jetty. I believe it's still jetty 8) running a non-default port (SBT 0.7 and 0.10 have different ways of setting the default port).
Unfortunately, I didn't log things as I was figuring them out.. so, I'll try track down which configurations I made and versions I used to put together some sort of tutorial/log
Fri, 01 Jun 2012:
Ok, I was tempted to get Diablo 3... BUT, why waste my time with that when I could be timkering around with my newly arrived Raspberry Pi.
A life long pie lover and converted linux freak, the raspberry pi seemed like the perfect flavor for me to get my linux fix.
And what a cheap fix it was. This credit card sized linux box was only $35 US. You can learn more from their web site...
The minascule COMPUTER seems like it would make a very nice thin client. Although, I would probably work better as one if it ran a gigabit ethernet (it has 10/100). Neverthelss, I hope that after diving in, I will find all the stress of ordering during their release worth while. You may of heard how all the hype about it ended up crashing the notable farnel and RS sites... I would have gotten one of the first batch had I gotten an account beforehand, shucks...
I think its going to be cool to load different setups onto different SD cards. I think I will dedicate an SD card to learning how to use Archlinux as I've been wanting to learn a more 'advanced' distro for a while. Apart form that, basiacally just looking for other uses for this thing... don't get me wrong though, I think its going to be a great tool for letting kids learn about computers and programming, but I know there is so many more possibilities~
If only I had played around with something like this when I was young...
Sat, 05 May 2012:
I have added my vim configurations to github at:
https://github.com/neildaemond/np-vim
feel free to check it out~
Fri, 04 May 2012:
Growing up, I used Notepad. Then some MS Visual studios and Eclipse. I went on to use Notepad++ for c programming, then progressed back into text-based IDE's by trying out Emacs.
While Emacs made my pinky sore, VIM... well, I just fell in love with vim.
I focused a solid few weeks doing everything in vim, even though the learning curve was steep. I kept the keyboard cheat sheet nearby and drudged on. Now the VIM-style keyboard navigation is second nature and is a lot more efficient and less frustrating then reaching over for that retched mouse.
I've added a few plugins since then, and hope to progress into creating my own macros and things..
so far, my favorite plugins have been NERD tree and NERD Commenter. With a few more settings to the .vimrc I got syntax highlighting and more~
In this log topic, I plan to talk about Vim configurations and plugins... and my efforts in becoming a Vim master~