January 2013
1 post
Braindump: The Twitter stack →
johanoskarsson: For various reasons, including performance and cost, Twitter has poured significant engineering effort into breaking down the site backend into smaller JVM based services. As a nice side effect we’ve been able to open source several of the libraries and other useful tools that came out of this…
Jan 14th
39 notes
April 2012
1 post
Coderspiel: Testing Scala Libraries →
coderspiel: In the course of developing some Scala libraries that have stuck around, I’ve generally found it helpful to users if I release artifacts compatible with the two most recent major versions of Scala. So at the moment I support everything between 2.8.0 and 2.9.1-1. Binary compatibility across minor…
Apr 2nd
2 notes
March 2012
1 post
Some ways to write function literals in Scala
coderspiel: Just cuz iheardata asked and I can’t find a set of examples I like. (i: Int) => i + 1 { (i) => i + 1 } : (Int => Int) ( (i) => i + 1 ) : (Int => Int) { i => i + 1 } : (Int => Int) ( i => i + 1 ) : (Int => Int) { _ + 1 } : (Int => Int) ( _ + 1 ) : (Int => Int) (_: Int) + 1
Mar 7th
4 notes
December 2011
2 posts
giter8 0.3.2 - implicit.ly →
coderspiel: Giter8 templates can now use ls to resolve the latest published version of a library. There is some serious Scala web API ecosystem Zen going on here. Check it out. Oh and it uses parser combinators for the ls(…) business, so it’s l337.
Dec 27th
19 notes
I think we can manage
tl’dr: sbt Managed dependencies using git submodules on heroku. It can be done. A post about source compatibility recently stirred up some commotion in the Scala community. I too have felt some of the compatibility pain, but even though I have only been dancing the Odersky waltz for only a fraction of the time it takes to get on scala’s Dancing with the Stars, I believe I have seen...
Dec 13th
32 notes
November 2011
1 post
411s, InputStreams and chunked content
tbje: Working on our API the other day I came over an incompatibility issue with our front end server and the Dispatch http library. Some web servers does not accept chunked data input by default (nginx for instance) and will reply with a 411 error code. If you post a file using an InputStream with Dispatch, it will send the data in chunks which is great unless an incompatible server is...
Nov 25th
5 notes
February 2011
1 post
sticking ? where it doesn't belong
One fondness I have in common with Ruby, Clojure, and even Coffeescript is a syntactic idiom of ending the names of functions and methods that return a false value with a ?. The idea is to immediately convey the intent of the function by means of an expectation you’ve developed reading natural language. When you read something that ends in a ?, you intuitively assume, without thinking,...
Feb 20th
5 notes
December 2010
2 posts
1 tag
mime seating arrangments on airplanes
Recently I’ve been getting more into the idea of cloud hosting for tiny apps. Google App Engine is a perfect fitting glass shoe for applications written in java and other jvm languages of the future. The the world of scala we have sbt, and in the world of sbt we have plugins and in a world of repeatable tasks, we even have templates. Anyway… Even with a world of such luxury we...
Dec 15th
1 note
magic match sticks and burnt fingers
First class pattern matching support is one of the many ways Scala stole my heart. I now use pattern matching as a superior refactoring and design tool in place of most every use case where I would historically insert another stray branch into a nest of ifs or query methods. Scala’s match keyword does what most languages switch or case keywords should do. Some may argue there’s too...
Dec 5th
3 notes
August 2010
1 post
1 tag
Holy Blinking MAGENTA
a paraphrased back-in-my-day Have you ever wondered how some command line programs add artistically horrid colors to textual output? Ever wonder why you might see an ls listing showing directories in yellow or soft-linked files in red on some machine terminals and not others. I love colors as much as anyone else does, so I’m curious too. Well, back in the days before we had a style...
Aug 2nd
2 notes
July 2010
2 posts
1 tag
a well formed cupcake
Here’s a simple little sprinkle for anyone wondering how to serve xml with self-closing tags in Scala. The basic cooking ingredients in Scala’s xml kitchen will output closing tags, even when the recipe does not call for them. val selfClosingCupcake = <cupcake /> Will always unsuspectingly return <cupcake></cupcake> When your cupcakes are html tags,...
Jul 19th
2 notes
1 tag
please yield to passing monads
One of the most common functional programming topics tossed about in the Scala community are monads. Even if you may not know what they are, chances are, you probably use them all the time. Though there are already some decent postings on monads in Scala, I’d like to take a time out and describe how they are used in the Scala you probably use every day. Raise your hand if you’ve...
Jul 11th
2 notes
May 2010
1 post
1 tag
referential transparencies
Oftentimes when shifting back and forth between languages it’s easy to fudge syntactic nuances out of habit. Sometimes when you fudge you learn something new. Today I fudged some Java in my Scala. What would you guess the return type of the following method to be? def guess(what: String) { "%s? really?" format what } One who is used to Scala by now knows there’s no need to...
May 15th
1 note
April 2010
2 posts
1 tag
a transitional suitcase for source
With the recent announcement of Scala 2.8.0 RC1, I finally decided it was time to start transitioning some of my projects. For more motivation, as 2.8 becomes main stream I’m sure some issues are bound to pop up. does a cat’s pur make a sound if no one is around to hear it I picked a smaller project to start out with, because low hanging fruit usually tastes better when...
Apr 18th
1 note
there are only some ways to mix a cat
A newish mixology There’s something to be said for the ability of a language allow the design types of objects through composition rather than traditional class inheritance. It awesome! Aristotle was correct in that things can be classified according to thier common characteristics. In software, it seems kind of overly ambitious to think that this should be the same basis of all object...
Apr 5th
1 note
March 2010
6 posts
1 tag
an old man and a park bench
I sat down next to an old man on a park bench today. He said to me: Are you just going to sit there? So I said: Why do you ask? To which he replied: I’m an old man. These days, what I enjoy most is to sit here and watch others go about their business, over and over, and over again. I went on my way. I came back to the bench the next day and the old man and the bench was...
Mar 23rd
1 note
scope escaping shadow of peter pan
I just thought the error message the following code generates was a little silly. object PeterPan { private case class Shadow(length: Int) def shadow = Shadow(10) } error: private class Shadow escapes its defining scope as part of type PeterPan.Shadow
Mar 22nd
3 notes
an applied case for red ninjas
One of my favorite things about scala are case classes. Those coming from a java background might be used to writing code like this. public class Ninja { private int experience; private List<Weapon> weapons; private String color; public Ninja(int experience, List<Weapon> weapons, String color) { this.experience = experience; this.weapons = weapons; this.color =...
Mar 20th
implicitly subtle imports
One of Scala’s cheekier features, implicit declarations, can sometimes conjure up subtle gotchas. Besides being infamous for being a pimp, Scala’s implicits are also play the role of a magician by providing the illusion of default function arguments, a first class feature in 2.8. I recently came across a subtle gotcha when using implicit function arguments, but first, it might be...
Mar 16th
1 note
1 tag
37 salad dressings
I’m thinking of a spork with no knives As a younger man, one of my favorite types of restaurants to eat at were buffets.  What can be better than an endless supply of everything? I pay one price and get as much as I want. So many choices! As I got a little older, I started noticing a couple things about these types of restaurants.  For starters, I never actually ate everything on the...
Mar 13th
2 tags
i've got objects in my specs
If you are a bdd’r and just happen to be upgrading from sbt 0.5.6 to 0.7.1, when you run your specs, you just might be greeted with the lovely message: Could not instantiate class foo.Bar: foo.Bar The quick fix is to write your specs as classes rather than objects. I know. Classes? I’m using the latest 2.7.7 supported version of specs. val specs = "org.scala-tools.testing" %...
Mar 2nd
1 note