<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Hello. My name is Chris, I am a software developer, this is where I blog about it.</description><title>I Am Chris</title><generator>Tumblr (3.0; @iamchrislewis)</generator><link>http://iamchrislewis.tumblr.com/</link><item><title>A Look at How Scala Compiles to Java</title><description>&lt;p&gt;
Consider this contrived example, based on an example from &lt;a href="http://www.amazon.com/Beginning-Scala-David-Pollak/dp/1430219890/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1257878604&amp;sr=8-1"&gt;Beginning Scala&lt;/a&gt;. The point of the snippet was to demonstrate the congruency between using the &lt;a href="http://en.wikipedia.org/wiki/Higher-order_function"&gt;higher-order functions&lt;/a&gt; &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;flatMap&lt;/code&gt;, &lt;code&gt;foreach&lt;/code&gt;, and &lt;code&gt;filter&lt;/code&gt; (see &lt;a href="http://www.scala-lang.org/docu/files/api/scala/Iterable.html"&gt;Iterable&lt;/a&gt;), and performing the same operations inside a &lt;a href="http://www.scala-lang.org/node/111"&gt;for comprehension&lt;/a&gt;.
&lt;/p&gt;

&lt;pre&gt;
object App {
	
	def isEven(i: Int) = i % 2 == 0
	
	def isOdd(i: Int) = i % 2 == 1
	
	def main(args: Array[String]): Unit = {
		val n = (1 to 10).toList
		n.filter(isEven).flatMap(i =&gt; n.filter(isOdd).map(j =&gt; i * j))
	}
	
}
&lt;/pre&gt;

&lt;p&gt;
Save this code to a file named &lt;code&gt;App.scala&lt;/code&gt;, or anything you want (scala doesn’t have the same file/class name restrictions as java). Assuming you chose App.scala, compile it:
&lt;/p&gt;

&lt;pre&gt;
clewis$ scalac App.scala
&lt;/pre&gt;

&lt;p&gt;
Now check out the generated class files (&lt;code&gt;ls App*class&lt;/code&gt;). You should see the following:
&lt;/p&gt;

&lt;pre&gt;
App$$anonfun$main$1.class
App$$anonfun$main$2$$anonfun$apply$1.class
App$$anonfun$main$2$$anonfun$apply$2.class
App$$anonfun$main$2.class
App$.class
App.class
&lt;/pre&gt;

&lt;p&gt;
Why were 6 classes compiled from this one singleton definition? Let’s start with &lt;code&gt;App.class&lt;/code&gt; and &lt;code&gt;App$.class&lt;/code&gt;.
&lt;/p&gt;

&lt;h3&gt;The Singleton Object&lt;/h3&gt;

&lt;p&gt;
Scala does away with Java’s statics. Instead we get singleton objects, which are declared with a syntax similar to that used for class declarations, but using the &lt;code&gt;object&lt;/code&gt; keyword instead. When a singleton object shares the same name as a class, it becomes that classes “companion” object. Companion objects have special privileges, including access to private instance fields on instances of the companion type. In this example, &lt;code&gt;App&lt;/code&gt; is simply a singleton object, since we haven’t also defined a class named App.
&lt;/p&gt;

&lt;p&gt;
The Scala compiler implements companion objects by generating an anonymous class inside the companion class (the class of the same name as the object). The same is done for singleton objects, but the compiler also generates the containing class. Like the Java compiler, Scala names anonymous the class as [class name]$. Because we created an object named App, we get 2 classes: &lt;code&gt;App&lt;/code&gt; and &lt;code&gt;App$&lt;/code&gt;.
&lt;/p&gt;

&lt;h3&gt;Higher Order Functions and Their Function Arguments&lt;/h3&gt;

&lt;p&gt;
In Scala, functions are objects; instances of one of the Function&lt;i&gt;N&lt;/i&gt; traits. Of course this knowledge isn’t obvious by the Scala syntax, and that’s part of the beauty: it just feels right. The compiler compiles any functions down to anonymous classes inside the containing class. If you understand Java’s scoping rules for inner classes, then you should now have some understanding of how Scala implements closures.
&lt;/p&gt;

&lt;p&gt;
Methods in Scala are also different from functions. Methods are functions defined as part of a class definition with the the &lt;code&gt;def&lt;/code&gt; keyword. Functions are instances of one of the Function&lt;i&gt;N&lt;/i&gt; traits, and the Scala syntax provides several different ways to express them tersely. Methods are the only primitives (non-objects) in Scala, but the compiler makes it easy to promote methods to function instances. Back to our example, notice that we define the methods &lt;code&gt;isEven&lt;/code&gt; and &lt;code&gt;isOdd&lt;/code&gt; in our singleton object. They are method primitives, not functions. Because the compiler recognizes that methods often want to be treated as functions, it makes provisions; one such provision is that we can pass a method to a higher-order function.
&lt;/p&gt;

&lt;h3&gt;Method Promotions&lt;/h3&gt;

&lt;p&gt;
In order for the compiler to promote a method to a function instance, it must create an anonymous class for that instance. In our example, we first pass the method &lt;code&gt;isEven&lt;/code&gt; as an argument to the higher-order function &lt;code&gt;filter&lt;/code&gt;, and so the compiler generated the class &lt;code&gt;App$$anonfun$main$1&lt;/code&gt;, which is our promoted method. Note that we also pass the &lt;code&gt;isOdd&lt;/code&gt; to a subsequent call to &lt;code&gt;filter&lt;/code&gt;, a promotion for which the compiler generated the class &lt;code&gt;App$$anonfun$main$2$$anonfun$apply$1&lt;/code&gt;.
&lt;/p&gt;

&lt;h3&gt;Function Literals&lt;/h3&gt;

&lt;p&gt;
We’ve covered all but 2 of the generated classes. As it turns out, there are still 2 functions we haven’t discussed in the series of transformations. Take another look:
&lt;/p&gt;

&lt;pre&gt;
n.filter(isEven).flatMap(i =&gt; n.filter(isOdd).map(j =&gt; i * j))
&lt;/pre&gt;

&lt;p&gt;
Did you see them? If you’re new to Scala, you may not spot them at first because they are using function-literal syntax. The functions &lt;code&gt;flatMap&lt;/code&gt; and &lt;code&gt;map&lt;/code&gt; also take functions as arguments, and so we define them literally, embedding the one passed to &lt;code&gt;map&lt;/code&gt; inside the one passed to &lt;code&gt;flatMap&lt;/code&gt;. For these two function literals, the compiler generated the anonymous classes &lt;code&gt;App$$anonfun$main$2&lt;/code&gt; and &lt;code&gt;App$$anonfun$main$2$$anonfun$apply$2&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
To seal in what’s happening here, fire up the Scala REPL and run this code:
&lt;/p&gt;

&lt;pre&gt;
List(1,2,3).map(j =&gt; j + 1)
&lt;/pre&gt;

&lt;p&gt;Now run this code:&lt;/p&gt;

&lt;pre&gt;
List(1,2,3).map(new Function1[Int, Int] {
	override def apply(j: Int) = j + 1
})
&lt;/pre&gt;

&lt;p&gt;
The two do the exact same thing, because they are exactly the same.
&lt;/p&gt;

&lt;p&gt;
The literal syntax may look strange, and even non-obvious at first. I thought so too, but it didn’t take long for me to greatly appreciate and recognize it as easily as you might recognize a class definition.
&lt;/p&gt;

&lt;h3&gt;A Word on the Class Names&lt;/h3&gt;

&lt;p&gt;
You may have noticed a pattern in the anonymous function class names. For starters, they’re prefixed with &lt;code&gt;App$$anonfun$main$&lt;/code&gt; and then continue in with &lt;code&gt;1.class&lt;/code&gt; and &lt;code&gt;2.class&lt;/code&gt;. There’s also another level nested inside the first level. If you inspect each of these using &lt;code&gt;javap -c [class]&lt;/code&gt;, you’ll notice the ordering and nesting follows the order in which we use function objects (by passing them as arguments to other functions).
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;isEven&lt;/code&gt; is the first function we pass, so it is the first function for which an anonymous class is generated, yielding &lt;code&gt;App$$anonfun$main$1&lt;/code&gt;.
&lt;/li&gt;

&lt;li&gt;
The second is the literal function passed to &lt;code&gt;flatMap&lt;/code&gt;, so &lt;code&gt;App$$anonfun$main$2&lt;/code&gt; is generated for it.
&lt;/li&gt;
&lt;li&gt;
The third is &lt;code&gt;isOdd&lt;/code&gt;, yielding the class &lt;code&gt;App$$anonfun$main$2$$anonfun$apply$1&lt;/code&gt;. This function is used inside the function passed to &lt;code&gt;flatMap&lt;/code&gt;. It’s the first function in this scope, and it’s nested, so its name reflects its nesting and order in the sequence.
&lt;/li&gt;
&lt;li&gt;
Finally we arrive at the literal function passed to &lt;code&gt;map&gt;&lt;/code&gt;, resulting in &lt;code&gt;App$$anonfun$main$2$$anonfun$apply$2&lt;/code&gt;. It’s the second function referenced inside the function passed to &lt;code&gt;flatMap&lt;/code&gt;, and so its name also reflects its nesting and order.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
This ordering and nesting is deliberate. In Java, an inner class has access to its parent’s scope, which includes class instance variables and local variables (if the inner class was created in a method). This is what makes closures in Scala possible. Look again at the literal function passed to &lt;code&gt;map&lt;/code&gt;:
&lt;/p&gt;

&lt;pre&gt;
n.filter(isEven).flatMap(i =&gt; n.filter(isOdd).map(j =&gt; i * j))
&lt;/pre&gt;

&lt;p&gt;
The function multiplies a “free” variable &lt;code&gt;i&lt;/code&gt; by its single argument &lt;code&gt;j&lt;/code&gt;. Where did &lt;code&gt;i&lt;/code&gt; come from? Again, this function is defined inside another literal function passed to &lt;code&gt;flatMap&lt;/code&gt;. That function receives a single argument, which it labels &lt;code&gt;i&lt;/code&gt;. Because the function passed to &lt;code&gt;map&lt;/code&gt; is nested inside the one passed to &lt;code&gt;flatMap&lt;/code&gt;, it has access to that scope.
&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/239967776</link><guid>http://iamchrislewis.tumblr.com/post/239967776</guid><pubDate>Wed, 11 Nov 2009 00:43:24 -0500</pubDate><category>scala</category><category>java</category></item><item><title>Lift Off</title><description>&lt;p&gt;I arrived at the FGM building by way of my couchsurfing host, Jenny. At the moment, Reston looks a bit like London (at least if you look straight up). Fall has painted the leaves brilliantly, a sight I’m left wanting in Florida.&lt;/p&gt;

&lt;p&gt;Jenny graciously dropped me off at the FGM building on her way to school (she’s a school teacher). I gladly accepted arriving an hour early for a free ride, and so I just started wandering the office park. I stumbled on this office “cafe” as it were, and here I sit. I seem to be just outside a free guest wifi network, but that’s ok. For a first-timer at an unconference, or any tech conference for that matter, I feel fairly prepared.&lt;/p&gt;

&lt;p&gt;I’ve just made my way into the FGM suite. So far we’re about 32-30 strong!&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/227895642</link><guid>http://iamchrislewis.tumblr.com/post/227895642</guid><pubDate>Fri, 30 Oct 2009 08:54:35 -0400</pubDate><category>scala</category><category>lift</category></item><item><title>Functional Content Negotiation in Scala</title><description>&lt;p&gt;Today I needed some code to assess if an HTTP request matched certain criteria, based on its declared content type. Essentially, I needed to know if the user-agent wanted XML (or JSON), and that it wanted only that type.&lt;/p&gt;
&lt;p&gt;Requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Check the &lt;code&gt;Accept&lt;/code&gt; request header for a given content type.&lt;/li&gt;
&lt;li&gt;Support a non-standard &lt;code&gt;X-Accept&lt;/code&gt; header serving the same purpose as &lt;code&gt;Accept&lt;/code&gt; (IE doesn’t let XmlHttpRequest specify the Accept header).&lt;/li&gt;
&lt;li&gt;The header value is specifically required to be one, and only one MIME type, without an explicit “q” value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Assuming we have an &lt;code&gt;HttpServletRequest&lt;/code&gt; instance that only accepts &lt;code&gt;application/xml&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;scala&gt; req.getHeader("Accept")&lt;br/&gt;res6: String = application/xml&lt;/pre&gt;
&lt;p&gt;and that we have an object with a method implementing the match algorithm, we should see this behavior:&lt;/p&gt;
&lt;pre&gt;scala&gt; matcher accepts(req, "application/xml")&lt;br/&gt;res7: Boolean = true&lt;br/&gt;&lt;br/&gt;scala&gt; matcher accepts(req, "application/json")&lt;br/&gt;res8: Boolean = false&lt;/pre&gt;
&lt;p&gt;The complete code:&lt;/p&gt;
&lt;pre&gt;type HttpServletRequest = {&lt;br/&gt;  def getHeader(h: String): String&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;object req {&lt;br/&gt;  def getHeader(h: String) = h match {&lt;br/&gt;    case "Accept" =&gt; "application/xml"&lt;br/&gt;    case "X-Accept" =&gt; "text/html"&lt;br/&gt;    case _ =&gt; null&lt;br/&gt;  }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;trait Acceptor {&lt;br/&gt;&lt;br/&gt;  val headers = "Accept" :: "X-Accept" :: Nil&lt;br/&gt;&lt;br/&gt;  def accepts(request: HttpServletRequest, contentType: String) =&lt;br/&gt;    headers map (request.getHeader) filter(_ != null) map {&lt;br/&gt;      _ == contentType&lt;br/&gt;    } reduceLeft(_ || _)&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;object matcher extends Acceptor&lt;/pre&gt;
&lt;p&gt;Not much, but let’s look at it more closely.&lt;/p&gt;
&lt;pre&gt;type HttpServletRequest = {&lt;br/&gt;  def getHeader(h: String): String&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;A type alias. This is a structural type, aliased as &lt;code&gt;HttpServletRequest&lt;/code&gt;, with a method &lt;code&gt;getHeader(String): String&lt;/code&gt;. This makes it easy to prototype the code in the scala REPL, or compile it against &lt;code&gt;javax.servlet.http.HttpServletRequest&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Next, a singleton instance of the aliased type:&lt;/p&gt;
&lt;pre&gt;object req {&lt;br/&gt;  def getHeader(h: String) = h match {&lt;br/&gt;    case "Accept" =&gt; "application/xml"&lt;br/&gt;    case "X-Accept" =&gt; "text/html"&lt;br/&gt;    case _ =&gt; null&lt;br/&gt;  }&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;This conforms to our requirements above, and also behaves like a real HttpServletRequest in that it returns the dreaded null if no header by the provided name exists.&lt;/p&gt;
&lt;p&gt;Next is the trait:&lt;/p&gt;
&lt;pre&gt;trait Acceptor {&lt;br/&gt;&lt;br/&gt;  val headers = "Accept" :: "X-Accept" :: Nil&lt;br/&gt;&lt;br/&gt;  def accepts(request: HttpServletRequest, contentType: String) =&lt;br/&gt;    headers map (request.getHeader) filter(_ != null) map {&lt;br/&gt;    _ == contentType&lt;br/&gt;  } reduceLeft(_ || _)&lt;br/&gt;&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;Notice the headers val. This is a list of strings containing the header names to read from the request and interpret as &lt;code&gt;Accept&lt;/code&gt; header values.&lt;/p&gt;
&lt;p&gt;The fun part is the accepts method, which takes a servlet request (conveniently aliased for REPL play), and a content (MIME) type. This is purely functional; there are no side-affects, it is deterministic, and the algorithm is a series of four transformations occurring on one collection after another. Through the transformations, the collection is reduced to a single boolean value. Let’s start with the first line:&lt;/p&gt;
&lt;pre&gt;headers map (request.getHeader) filter(_ != null)&lt;/pre&gt;
&lt;p&gt;Starting with the list of header names to inspect in the request,  we map it with &lt;code&gt;request.getHeader&lt;/code&gt;. This creates a new list, where each element is the result of applying &lt;code&gt;request.getHeader&lt;/code&gt; to each element in the original headers list. The original list contains 2 elements, “Accept” and “X-Accept”, and so the resulting list now looks like this: &lt;code&gt;List(application/xml, text/html)&lt;/code&gt;. Our request object responded to the query for “Accept” with “application/xml”, and “text/html” to “X-Accept.” Had either of those header names not been present, a &lt;code&gt;null&lt;/code&gt; value would now be present in the list.&lt;/p&gt;
&lt;p&gt;Now we filter this resulting list. Filter, like map, applies a function to each element in the collection and results in a new collection. The function receives each element and returns a boolean value. For each invocation that results in true, that element is added to the resulting list (you filter a collection using a function). We use a literal shorthand to assert that the element is not null, and so the resulting list will contain non-null strings. This filtering is simply protection against null. Our transformed list doesn’t contain any nulls, so the new list looks the same as the old one: &lt;code&gt;List(application/xml, text/html)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Next we have another mapping operation, using brackets instead of parentheses.&lt;/p&gt;
&lt;pre&gt;map {&lt;br/&gt;  _ == contentType&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;The use of brackets here is a style choice, and in this case is the same as writing &lt;code&gt;map(_ == contentType)&lt;/code&gt;. This part also evolved from a &lt;i&gt;partial function&lt;/i&gt;, where the body is a case statement, matching on the single argument. The function being mapped simply checks if each element is equal to the &lt;code&gt;contentType&lt;/code&gt; argument. Remember that == in scala, contrary to java, is an object equality test and not an identity test (eq is for identity tests). We left off at &lt;code&gt;List(application/xml, text/html)&lt;/code&gt;, and after this mapping transformation, arrive at List(true, false).&lt;/p&gt;
&lt;p&gt;The final transformation, simple as it is, actually took me a bit to realize. The function itself had undergone a few iterations, each representing in some way, a group of header values in the request that did or didn’t match a given content type. I couldn’t seem to reach a solution that felt natural. I thought about filtering on true, and then checking that the result list wasn’t empty, but that didn’t really express the essence of the computation. Same for a find (and then matching on Option(true)). They would have worked, but they missed the point and, as all point-missers do, cluttered the algorithm.&lt;/p&gt;
&lt;p&gt;Then it hit me:&lt;/p&gt;
&lt;pre&gt;reduceLeft(_ || _)&lt;/pre&gt;
&lt;p&gt;Exactly what I wanted. &lt;a href="http://www.scala-lang.org/docu/files/api/scala/List.html#reduceLeft%28%28B%2CA%29%3D%3EB%29"&gt;reduceLeft&lt;/a&gt; receives a 2 argument function, walks the contents of the collection, and returns the accumulated result. On each invocation, it passes the current and the next element as arguments, progressing from left to right, until the collection is exhausted. The result of one invocation becomes the input to the next. As a simple example, consider list summations:&lt;/p&gt;
&lt;pre&gt;scala&gt; List(1,2,3) reduceLeft(_ + _)&lt;br/&gt;res14: Int = 6&lt;br/&gt;&lt;br/&gt;scala&gt; List(1,2,3,4) reduceLeft(_ + _)&lt;br/&gt;res15: Int = 10&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Back to our exmaple, using function-literal shorthand, I OR the two arguments. This means that if either of the two are true, the resulting value is true. Reducing a list of booleans with this function results in a single boolean value. Because I’m using OR, a single true value in the list will result in a true result at the end of the reduction. We left off at a &lt;code&gt;List(true, false)&lt;/code&gt;, and after our reduction, arrive at a single &lt;code&gt;true&lt;/code&gt; result. Perfect.&lt;/p&gt;
&lt;p&gt;Last of all, a singleton that mixes in the Acceptor trait.&lt;/p&gt;
&lt;pre&gt;object matcher extends Acceptor&lt;/pre&gt;
&lt;p&gt;This just gives us an object with Acceptor behavior mixed in, so we can play in the REPL.&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/214321293</link><guid>http://iamchrislewis.tumblr.com/post/214321293</guid><pubDate>Thu, 15 Oct 2009 22:44:00 -0400</pubDate><category>scala</category><category>functional</category></item><item><title>"Great minds discuss ideas; Average minds discuss events; Small minds discuss people."</title><description>“Great minds discuss ideas; Average minds discuss events; Small minds discuss people.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Eleanor Roosevelt&lt;/em&gt;</description><link>http://iamchrislewis.tumblr.com/post/211562734</link><guid>http://iamchrislewis.tumblr.com/post/211562734</guid><pubDate>Mon, 12 Oct 2009 21:59:25 -0400</pubDate><category>quotes</category><category>culture</category></item><item><title>A Solution to the Set Combinations Problem</title><description>&lt;p&gt;&lt;pre&gt;def combine[T](sets: List[List[T]]): List[List[T]] = sets match {
  case List(l1, l2) =&gt; l1.flatMap(i1 =&gt; l2.map(List(i1, _)))
  case head :: tail =&gt; combine(tail).flatMap(set =&gt; head.map(_ :: set))
  case _ =&gt; sets
}
&lt;/pre&gt;&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/211561726</link><guid>http://iamchrislewis.tumblr.com/post/211561726</guid><pubDate>Mon, 12 Oct 2009 21:58:13 -0400</pubDate><category>scala</category><category>recursion</category></item><item><title>Recursion with an Arbitrary Number of Lists</title><description>&lt;p&gt;{ apple, banana }&lt;br/&gt;{ milk, cheese, yogurt }&lt;br/&gt;{ nuts, legumes }&lt;/p&gt;
&lt;p&gt;— would result in —&lt;/p&gt;
&lt;p&gt;{ apple, milk, nuts }&lt;br/&gt;{ apple, milk, legumes }&lt;br/&gt;{ apple, cheese, nuts }&lt;br/&gt;{ apple, cheese, legumes }&lt;br/&gt;{ apple, yogurt, nuts }&lt;br/&gt;{ apple, yogurt, legumes }&lt;br/&gt;{ banana, milk, nuts }&lt;br/&gt;{ banana, milk, legumes }&lt;br/&gt;{ banana, cheese, nuts }&lt;br/&gt;{ banana, cheese, legumes }&lt;br/&gt;{ banana, yogurt, nuts }&lt;br/&gt;{ banana, yogurt, legumes }&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/200207603</link><guid>http://iamchrislewis.tumblr.com/post/200207603</guid><pubDate>Tue, 29 Sep 2009 13:00:18 -0400</pubDate><category>recursion</category><category>func</category><category>Functional</category></item><item><title>Dependency Injection Using Language-only Constructs</title><description>&lt;p&gt;I’ve been exploring dependency injection in Scala. Digesting &lt;a href="http://debasishg.blogspot.com/2008/02/scala-to-di-or-not-to-di.html"&gt;this article&lt;/a&gt; by Debasish Ghosh, I was inspired to play with the code. At the time of the article’s posting it needed a few pieces to compile. You can find the inferred working source &lt;a href="http://bit.ly/discala"&gt;here&lt;/a&gt;. As an exploratory exercise, I transposed it to &lt;a href="http://bit.ly/dijava"&gt;java&lt;/a&gt;. Chew on it a bit; it clarified some things for me about both the technique and the workings of Scala abstractions.&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/164543087</link><guid>http://iamchrislewis.tumblr.com/post/164543087</guid><pubDate>Sun, 16 Aug 2009 22:29:40 -0400</pubDate><category>scala</category><category>java</category><category>dependencyinjection</category><category>ioc</category></item><item><title>Vote for ROSA LOVES!</title><description>&lt;a href="http://www.nau.com/collective/grant-for-change/rosa-loves;-mike-fretto-381.html.share"&gt;Vote for ROSA LOVES!&lt;/a&gt;</description><link>http://iamchrislewis.tumblr.com/post/143006531</link><guid>http://iamchrislewis.tumblr.com/post/143006531</guid><pubDate>Thu, 16 Jul 2009 16:36:15 -0400</pubDate></item><item><title>Super quick start with Lift's ProtoUser</title><description>&lt;p&gt;&lt;a href="http://liftweb.net/"&gt;Lift&lt;/a&gt; provides a trait called &lt;a href="http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/mapper/ProtoUser.html"&gt;ProtoUser&lt;/a&gt;, which helps you in quickly adding base functionality to your application for user-specific data. The &lt;a href="http://groups.google.com/group/the-lift-book"&gt;Lift book&lt;/a&gt; mentions this class very briefly, but it makes the assumption that the reader will be to intuit how to complete the example code to have a base starting point. Here’s what you must have (assuming this is in the model directory):&lt;/p&gt;
&lt;p&gt;package app.model&lt;br/&gt;&lt;br/&gt;class User extends ProtoUser[User] with LongKeyedMapper[User] {&lt;br/&gt; def getSingleton = User&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;object User extends User with LongKeyedMetaMapper[User]&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;You need to mix in the LongKeyedMapper trait, and you need the User singleton.&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/141132296</link><guid>http://iamchrislewis.tumblr.com/post/141132296</guid><pubDate>Mon, 13 Jul 2009 21:44:00 -0400</pubDate><category>scala</category><category>lift</category></item><item><title>Erin nailing the word but missing the number - by far the best...</title><description>&lt;img src="http://12.media.tumblr.com/bfWsP04Vupk1n8i4NkaGpqWdo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Erin nailing the word but missing the number - by far the best sparkler art of the night!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://erinlewis.tumblr.com/post/136109713/this-year-titled-happy-backwards-four-the"&gt;erinlewis&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;this year.&lt;/p&gt;
&lt;p&gt;titled: “happy backwards four + the letter t”&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://iamchrislewis.tumblr.com/post/136117585</link><guid>http://iamchrislewis.tumblr.com/post/136117585</guid><pubDate>Sun, 05 Jul 2009 21:32:57 -0400</pubDate></item><item><title>erinlewis:

these are from last year.
hope to make lots more...</title><description>&lt;img src="http://22.media.tumblr.com/bfWsP04Vupi4nlwm2xyED8Qlo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://erinlewis.tumblr.com/post/135407374/these-are-from-last-year-hope-to-make-lots-more"&gt;erinlewis&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;these are from last year.&lt;/p&gt;
&lt;p&gt;hope to make lots more tonight.&lt;/p&gt;
&lt;p&gt;happy 4th.&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://iamchrislewis.tumblr.com/post/135407985</link><guid>http://iamchrislewis.tumblr.com/post/135407985</guid><pubDate>Sat, 04 Jul 2009 13:04:26 -0400</pubDate></item><item><title>http://groups.google.com/group/the-lift-book/files</title><description>&lt;a href="http://groups.google.com/group/the-lift-book/files"&gt;http://groups.google.com/group/the-lift-book/files&lt;/a&gt;: &lt;p&gt;The Lift Book group provides the built source of the full book “The Definitive Guide to Lift.” Grab the full PDF here (master.pdf).&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/135405654</link><guid>http://iamchrislewis.tumblr.com/post/135405654</guid><pubDate>Sat, 04 Jul 2009 12:58:50 -0400</pubDate><category>Scala</category><category>lift</category><category>programming</category></item><item><title>Lift Walk-through at Developerworks</title><description>&lt;a href="http://www.ibm.com/developerworks/opensource/library/os-ag-lift/"&gt;Lift Walk-through at Developerworks&lt;/a&gt;</description><link>http://iamchrislewis.tumblr.com/post/135403294</link><guid>http://iamchrislewis.tumblr.com/post/135403294</guid><pubDate>Sat, 04 Jul 2009 12:53:00 -0400</pubDate><category>Scala</category><category>programming</category><category>lift</category></item><item><title>Lift Framework API</title><description>&lt;a href="http://scala-tools.org/scaladocs/liftweb/1.0/"&gt;Lift Framework API&lt;/a&gt;</description><link>http://iamchrislewis.tumblr.com/post/135402134</link><guid>http://iamchrislewis.tumblr.com/post/135402134</guid><pubDate>Sat, 04 Jul 2009 12:50:00 -0400</pubDate><category>Scala</category><category>api</category><category>programming</category><category>lift</category></item><item><title>Dear Neighbors</title><description>&lt;p&gt;I live in &lt;a href="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=32080&amp;sll=37.649034,-95.712891&amp;sspn=39.457058,91.933594&amp;ie=UTF8&amp;z=11&amp;iwloc=A"&gt;St. Augustine Beach&lt;/a&gt;. If you live in the low-numbered streets or the early letter streets, chances are we’ve seen each other. I’m writing to tell you that yesterday, Sunday, June 21, my house was broken into and robbed. Our door was locked as it always is when we are gone, but the door was kicked in. Noone was harmed (noone was home), and fortunately no major damage was done to the house. However…&lt;/p&gt;
&lt;p&gt;&lt;b style="font-size: 16px;"&gt;MY LAPTOP WAS STOLEN&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Being a software engineer, this is a painful blow. If you live anywhere near me, I ask of you 2 things.&lt;/p&gt;
&lt;p&gt;1) Please contact me if someone you know comes in to a new MacBook Pro 17in glossy screen. Model from late 2007 (pre black monitor trim).&lt;/p&gt;
&lt;p&gt;2) Get an alarm system and a strong door. Apparently these kinds of robberies are on the rise in our area. What a shame.&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/128071466</link><guid>http://iamchrislewis.tumblr.com/post/128071466</guid><pubDate>Mon, 22 Jun 2009 08:37:38 -0400</pubDate><category>local</category><category>crime</category></item><item><title>"In many “OO” languages, especially those with dot notation, the methods are owned by the..."</title><description>“In many “OO” languages, especially those with dot notation, the methods are owned by the class, and you cannot access a method without compiler promises that the object it will call that method with is of a class that owns that method.  This is not object-orientation, it is just plain lunacy.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Erik Naggum, &lt;a href="http://groups.google.com/group/comp.lang.lisp/msg/60f4c36a707db3fe"&gt;comp.lang.lisp&lt;/a&gt;&lt;/em&gt;</description><link>http://iamchrislewis.tumblr.com/post/127826665</link><guid>http://iamchrislewis.tumblr.com/post/127826665</guid><pubDate>Sun, 21 Jun 2009 22:07:00 -0400</pubDate></item><item><title>100+</title><description>&lt;p&gt;It’s been a nice weekend. Great time with friends on Friday night, Saturday and Sunday at the in-laws, and lots of &lt;strike&gt;hacking&lt;/strike&gt; relaxing interspersed throughout. This week I’ll be giving an expanded presentation on &lt;a href="http://scala-lang.org"&gt;Scala&lt;/a&gt;, which is where most of my hack time has been spent.&lt;/p&gt;
&lt;p&gt;Bonus: Erin is playing the piano&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/127521363</link><guid>http://iamchrislewis.tumblr.com/post/127521363</guid><pubDate>Sun, 21 Jun 2009 09:29:50 -0400</pubDate><category>scala</category><category>programming</category></item><item><title>http://delicious.com/chris_lewis</title><description>&lt;a href="http://delicious.com/chris_lewis"&gt;http://delicious.com/chris_lewis&lt;/a&gt;: &lt;p&gt;I realized that for a while I was using tumblr in cases where delicious would have better fit. Sooo - here’s my delicious page.&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/127518059</link><guid>http://iamchrislewis.tumblr.com/post/127518059</guid><pubDate>Sun, 21 Jun 2009 09:19:56 -0400</pubDate></item><item><title>Wishlist</title><description>&lt;p&gt;I’ve created a book a &lt;a href="http://www.amazon.com/gp/registry/wishlist/2Z3T183QVCTX0?reveal=unpurchased&amp;filter=all&amp;sort=priority&amp;layout=standard&amp;x=10&amp;y=16"&gt;book wishlist&lt;/a&gt; at Amazon. If you feel compelled to hook me up, that’d be a good place to look :-)&lt;/p&gt;</description><link>http://iamchrislewis.tumblr.com/post/95742114</link><guid>http://iamchrislewis.tumblr.com/post/95742114</guid><pubDate>Mon, 13 Apr 2009 09:47:53 -0400</pubDate></item><item><title>Parleys: The Feel Of Scala</title><description>&lt;a href="http://www.parleys.com/display/PARLEYS/Home#title=The%20Feel%20Of%20Scala;talk=27131945;slide=8"&gt;Parleys: The Feel Of Scala&lt;/a&gt;</description><link>http://iamchrislewis.tumblr.com/post/93000578</link><guid>http://iamchrislewis.tumblr.com/post/93000578</guid><pubDate>Sat, 04 Apr 2009 19:11:32 -0400</pubDate><category>scala</category><category>programming</category></item></channel></rss>
