Bubble Foundry


Posts tagged with: Scala

Functional Programming in Lift
I gave a talk at Amsterdam.scala last month about how Lift makes use of functional paradigms for many of the common tasks. Read more – ‘Functional Programming in Lift’.
option.rb
Because I’m nothing if not consistent, I’ve made Yet Another Option Library, this time in Ruby: option.rb Read more – ‘option.rb’.
option.py
Because my hobby seems to be writing Option libraries in various languages, I’ve written another, in Python: option.py. Enjoy. Read more – ‘option.py’.
Using Lift’s Menu.params
Quick note for fellow Lift developers: I was happily using a Menu.param when I decided to use a Menu.params instead (see the ScalaDocs) in the hopes of both more descriptive URLs and less to calculate on the actual page. While implementing it wasn’t too hard, my new URL pattern for the menu entry was a […] Read more – ‘Using Lift’s Menu.params’.
Sending iOS Push Messages with Urban Airship and BFUrbanAirship
For iFebo I built a server last year to handle sending push messages to Urban Airship, which we use in front of the Apple Push Notification service due to its great scheduling features. To do this I needed a way to interact with the UA API and while it’s got lots of features it’s not […] Read more – ‘Sending iOS Push Messages with Urban Airship and BFUrbanAirship’.
Python-style in in Scala
Because hey, why not? In Python: >>> 1 in [1, 2, 3] True In Scala: class In(a: Any) { def in[T](s: Seq[T]) = s.contains(a) } implicit def any2In(a : Any) = new In(a)   scala> "a" in List(1, 2, "a") res0: Boolean = true   scala> "a" in List(1, 2, "b") res1: Boolean = false Read more – ‘Python-style in in Scala’.
How to get enumerations when using Scala’s parser combinators
This took me a while to figure out, so I figure it’s worth sharing here. In the end it’s quite simple thanks to Parser’s ^? method, but it took me a while to figure out: Read more – ‘How to get enumerations when using Scala’s parser combinators’.
Some experiments with natural numbers in Scala without type class wizardry
Scala doesn’t have dependent types but I wanted to see if I could wrassle up something that would approximate it for non-negative natural numbers. I’ve posted my results on GitHub. Read more – ‘Some experiments with natural numbers in Scala without type class wizardry’.
Ruby-style trailing conditionals in Scala
Ruby code often has code with trailing conditionals, which can look pretty neat. person = Person.get(name) unless name.nil? (Note: I really don’t know Ruby, I just saw syntax like this and thought was cool.) So, of course I had to implement it in Scala: You get optional values: Pretty cool, no? I tried and failed […] Read more – ‘Ruby-style trailing conditionals in Scala’.
Connecting to a Mongo database with Casbah
Because I’ve wasted too much time on Casbah tonight, I have to pass it on. Simply, not much is done for you automatically. Connect like this: val uri = MongoURI("mongodb://username:password@server:port/database") val mongo = MongoConnection(uri) val db = mongo(uri.database) db.authenticate(uri.username, uri.password.foldLeft("")(_ + _.toString)) val collection = db("something") If you call db.authenticate() a second time it will […] Read more – ‘Connecting to a Mongo database with Casbah’.