Gambler's Verity?

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 H T H H, and record “tails” and “heads” (bolded the flips after a heads). You flip T T H T and record “tails” from the 4th position... (more) →

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 I’ve especially enjoyed. .. (more) →

Habits

One of the most influential books I’ve read is The Power of Habit, by Charles Duhigg. He explores how habits work, and how we build (and change) them. A habit I built shortly after reading this book was reading every morning before I left for work, for at least 20 minutes. I’m a utilitarian reader — there’s many other things I’d do for pleasure — so primarily read out of a love of learning. 20 minutes is short enough that I don’t miss sleep, and long enough to make progress every day... (more) →

Launching Kifi

After over a year of hard work, my colleagues and friends have been working on a product that — we hope! — will revolutionize searching, bookmarks, and discovery. Briefly, it means you never have to organize your bookmarks again. Search Google, and relevant links show up on the top. To organize your links make it work well, FortyTwo has built a brilliant team of search experts who are creating the future of search. It’s been an amazing year with a fantastic team... (more) →

Recently, I moved this site to be a static site (via Hugo), as well as moving to .com (instead of .org, which I’ve owned for a lot longer). I didn’t want to break previous URLs, but my new posts have entirely new paths, so a simple path-for-path 301 redirect won’t work. Most importantly, I wanted the redirection to require nearly no maintenance and be near free. To avoid running a small server, I considered serverless approaches that would handle the URL rewriting for me... (more) →

Essential Slick review

Essential Slick by Jonathan Ferguson and Richard Dallaway was recently updated to include Slick 3, which was a big update from Slick 2. Slick is a “functional relational mapping” library for Scala. Instead of focusing on Table ↔ Object relations, Slick uses functional programming concepts to build queries, bind data, and stream results. In Slick 3, the preferred API treats queries and IO operations (called DBIO) as values, which can be modified and stored without the presence of a database. This is familiar to anyone who has used scalaz’s Task or Haskell’s IO... (more) →

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 blocking a thread checking for completion (or simply .geting inside another thread) is to periodically check for completion. .. (more) →

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: .. (more) →