Posts
Erik's Ponderings
Cancel

Meat without the hurt

The world's first cruelty-free hamburger <blockquote class="tr_bq">My own view is that being a vegetarian or vegan is not an end in itself, but a means towards reducing both human and animal ...

Science, defended

Science Is Not Your Enemy, by Steven PinkerThis is just a beautifully written piece. I am grateful to people like Steven Pinker for being able to present ideas so clearly. It’s not that I have lear...

Facebook: quality vs. quantity

Why Are Dead People Liking Stuff On Facebook? If Facebook can’t get this under control, what does that say about the value of its data? The persistence of these fake likes is an unnerving thing...

Canada the "rogue, reckless petrostate"

Oh, Canada<blockquote class="tr_bq">Over the last decade, as oil prices increased fivefold, oil companies invested approximately $160 billion to develop bitumen in Alberta, and it has finally...

"For humans, copying is learning"

Why Copying Is Fucking Awesome And Innovation Is Truly Overrated<blockquote class="tr_bq">Let me ask you something, when the first human figured out how to use fire to keep warm, what do you ...

Taxes buy civilization

How wealth of Silicon Valley’s tech elite created a world apart<div><blockquote class="tr_bq">Commuters who struggle with the crowded municipal bus service openly envy the spacious tech...

Are we in the "Great Stagnation"?

Driverless cars, pilotless planes … will there be jobs left for a human being?<blockquote class="tr_bq">Professor Tyler Cowen the future is even darker. It is not only that automation and rob...

Scala array comparison (without a PhD)

Scala collections and equality Scala collections follow a simple set of general equality rules1. Two collections are equal if: they are in the same overall category (Seq, Set, or Map) they c...

Map.map vs. Map.mapValues

I just hit a bug caused by a misunderstanding of how Map.mapValues works. Consider: val original = Map("a" -> 1, "b" -> 2) val modified = original map { case (k, v) => k -> (v + 1) } ...

Implicit conversion to the Unit type in Scala

In Scala, you have a few ways to express that a function returns the Unit type.1 A common way is to use the function syntax and specify a result type of Unit: def foo: Unit = ... Like for any re...

Getting to know CanBuildFrom (without a PhD)

Recently I needed to write a pretty simple function: given a sequence of (name, value) pairs, return a sequence of (name, some collection of all the values having that name) pairs. Here is a simple...

More iterators goodness

Following-up on the previous post about iterators, say we have a clean Scala API with Option instead: class Foo { def parent: Option[Foo] = … } def findBar(foo: Foo) = Option[Bar] = … It turns ...

Scala iterators and Iterator.iterate

There is a common programming pattern where you navigate a hierarchy in order to find an element satisfying a certain condition. I have written code like this in Java probably a million times: cla...

Scala tip: getOrElseUpdate

I found myself recently looking at the following code which I wrote when I was getting started with Scala: def getModelState(modelPrefixedId: String) = modelStates.get(modelPrefixedId) match { ...

Scala tip: import renames

In Java, you often write things like this, which are rather verbose: URLEncoder.encode(...) URLDecoder.decode(...) Since Java 1.5 you can use static imports, but then you are stuck with the orig...

Scala partial functions (without a PhD)

If you have done some Scala for a while, you know about pattern matching and match/case. Things like: value match { case Some(value) => … case None => … } But there is another use of t...

Continuations in Scala (without a PhD)

With @avernet we have been thinking lately about continuations, for a few reasons: Continuations pop up on the web as a concept that could help with event-based programming Scala has a contin...

48 hours of Nexus One

I just used a Nexus One for 48 hours (thanks Pierre). Here are a few quick notes/thoughts from the perspective of an iPhone 3G user.Getting started <ul><li>Take the SIM card out of the...

2009: Products I Can’t Live Without

Mike Arrington has just posted his 2009 list of products he can’t live without. After my own 2008 list, here is my update for 2009 as I think it’s fun to observe how our computing environment evolv...

Upgrading Your 17" MacBook Pro Hard Drive

A few days ago I upgraded my MacBook Pro’s hard drive after realizing 320 GB drives sell for USD 110 - which made constantly worrying about disk space ridiculous. This also should extend my old MBP...