Default and customized lift-json type hints

Not just for in Lift web apps, the lift-json library serves as a useful, fast, and sophisticated method of handling JSON in your Scala projects. In general usage, the lift-json library is pretty smart about serializing/deserializing messages, which are based on case classes. However, under certain circumstances the case classes in question may be indistinguishable, […]

One-liner for a URL’s Last-Modified header as Date

I’m working on a project where I want to look at the last modified date of a URL for comparative purposes, and decided to come up with a brief method of fetching the headers and parsing it as a java.util.Date. As with many HTTP-related operations, the go-to project here was the awesome Dispatch project, which […]

Configuring Scala compile options in sbt 0.10.x versus previous versions

Upgrading a few existing sbt-based projects from 0.7.7 to 0.10.0 was relatively straightforward, but came with a few hurdles. One of these was the enabling of Scala compiler options such as -unchecked and -deprecation. Previously these could be declared by creating (or editing) a project definition file in project/build, something like the following: This method […]

Lightweight type erasure matching

Scala’s pattern matching is much touted as a killer feature, and generally easy and convenient to use, but due to type erasure one needs to be somewhat careful with typed collections. Check out the following bit of code: It’s tempting to say, “this worked,” and move along, but consider the following similar code where we […]

Down-casing a String using implicit conversions

The Scala RichString class provides some nice hooks for string manipulation beyond those provided by java.lang.String, including a capitalize method that returns a Java String with the first letter up-cased. For whatever, reason, an “uncapitalize” equivalent is not defined to downcase the first character. Using implicit conversions, one can relatively straightforwardly add such a method […]

Getting IP address, MAC address, and subnet mask of localhost

Determining local IP address is easy, but determining MAC address, and subnet mask in Java has always been one of those hairy problems that sends me Googling. Using some of those same Java utilities, we can add a few Scala-isms and shorten the whole thing up significantly. To get the IP address we can just […]

println(“Hello World!”)

Ah, the dreaded “first post”. Gotta put something. Ideally I’d dive right in and offer up a useful chunk of info, but I’d like to get something showing on the site so here it is. Soon you’ll see my own unique take on things I’m picking up as I work with and better learn Scala, […]