Andrew Conner

Gambler's Verity?

How in small sets, randomness can be quite surprising

Flip a fair coin four times. Consider the cases, if any, after a heads. Since you're flipping a fair coin—you reason—you should notice no significant patterns in the flips after a heads, because flips are independent. However, you have heard of “hot streaks” or how random events become “due”, so you record your results.

You flip HTHH, and . . .

Read More

October 06, 2015

Using Java Futures in Scala

Occasionally, you may need to interface with Java Futures in Scala. Unfortunately, it is “an abomination”. Several older Java libraries, like Amazon's SDK, provides asynchronous interfaces using Java's Futures. java.util.concurrent.Future only provides a .get, and no mechanism to react to completion. The best solution to avoid . . .

Read More

October 01, 2015

Scalaz Task ↔ Scala Future

Since many asynchronous APIs in Scala use Futures, if you prefer using Task, you'll need to convert between the two. Here are two simple classes that enhance scalaz.concurrent.Task and scala.concurrent.Future:

import scalaz.concurrent.Taskimport scala.concurrent.{ Promise, Future }final class FutureExtensionOps[A](x: => Future[A]) {  . . .

Read More

September 25, 2015

Caution when using Play! TemporaryFile

The case of the random File deletion

Play! Framework provides several BodyParsers out of the box to parse common HTTP request bodies. One of them is for file uploads. Since Play can't reasonably know what you're doing with the body, they can't aggressively delete the file after the result is returned. Their solution is to clean up the file when the variable is . . .

Read More

September 07, 2015

Scala Days 2015 Talks

Scala Days 2015 talks have posted. My favorites:

Read More

April 11, 2015

Useful Scala snippets

There's a few classes and functions I've collected over the past few years that I find incredibly useful with day-to-day Scala development.

Get the calling stack

Often, during development, it's useful to find out “who is calling this?” If this happens to be called many times or concurrently, it's difficult to use a debugger. . . .

Read More

April 09, 2015

Dialogue above debate

I'm drawn to people who engage in direct dialogue about the fundamental concepts behind complex and polarizing issues. Recently I've been listening to podcast episodes about this — individuals who are a member of a “side”, and yet are drawn away from debate and instead deeply explore what the “other side” believes.

Here are a few that . . .

Read More

August 05, 2014