Back to USACO

August 2nd, 2012, 01:54

I was missing some algorithmic problem solving, so I’m back to the USACO Training Gateway problems. I lost my old source files, so I’ve committed myself to start everything from scratch. This means that I’ll eventually have to solve some of those boring problems where you spend more time implementing the input-parsing routine or modeling some weird restrictions other than actually coming up with the right algorithm. In fact, I’m currently in one of those problems (Packing Rectangles from IOI’95). In this case, implementing the search algorithm is quite straightforward, but figuring out those layouts (actually interpreting them out from the pictures) is a PITA.

In order to avoid losing the sources all over again, I’m putting everything on Github now.

Random Movie Quotes: Dark City

July 31st, 2012, 19:52

I just mean during the day. Daylight. When was the last time you remember seeing it? And I’m not talking about some distant, half-forgotten childhood memory, I mean like yesterday. Last week. Can you come up with a single memory? You can’t, can you? You know something, I don’t think the sun even… exists… in this place. ‘Cause I’ve been up for hours, and hours, and hours, and the night never ends here.

Random Movie Quotes: The Man from Earth

July 31st, 2012, 19:47

Time… you can’t see it, you can’t hear it, you can’t weigh it, you can’t… measure it in a laboratory. It is a subjective sense of… becoming, what we… are, instead of what we were a nanosecond ago, becoming what we will be in another nanosecond. The whole piece of time’s a landscape existing, we form behind us and we move, we move through it… slice by slice.

The making of Warcraft: the Dune 2 inspiration and the multi-unit selection feature

July 25th, 2012, 23:59

It’s always nice to read historical posts on the making of a particular software. This one is a little long, but there are two highlights I found particularly interesting. First of all, I lost the notion that Warcraft was that old, and I had no idea that it was inspired by Dune 2:

We were inspired to create Warcraft after playing (and replaying and replaying) a game called Dune 2, by Westwood Studios. Dune 2 was arguably the first modern real-time strategy (RTS) game; with a scrolling world map, real-time unit construction and movement, and individual unit combat. It isn’t that much different in design than a modern RTS like Starcraft 2, excepting perhaps a certain scale and graphics quality.

Second of all, Warcraft was the predecessor of a feature that I thought had been always present on real time strategy games:

One feature of which I was particularly proud was unit-selection. Unlike Dune 2, which only allowed the user to select a single unit at a time, and which necessitated frenzied mouse-clicking to initiate joint-unit tactical combat, it was obvious that enabling players to select more than one unit would speed task-force deployment and dramatically improve game combat.

— Patrick Wyatt. The making of Warcraft part 1.

Why use Scala? by Alex Payne

July 25th, 2012, 23:46

A short interview with Alex Payne on the advantages of using Scala, posted on the O’Reilly Radar. It focus on the advantages of combining object-oriented and functional capabilities in a programming language and back-end service development.

Some Lisp books

July 25th, 2012, 23:39

Mike Fogus has put up on his blog a nice collection of lesser-known Lisp books. I have Let Over Lambda by Doug Hoyte on my wish list and he classifies it as “mind-blowing and bombastic”, which might slightly increase its priority. I also have Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp on my shelf for a while, waiting for the perfect reading context. I frequently stumble upon On Lisp, by Paul Graham. Excluding the clojure books, which I wouldn’t classify as “lesser-known”, the others I’ve never heard of. Symbolic Computing with Lisp and Prolog caught my attention, especially because it has example programs written both in Lisp and Prolog. I figured it would be hard to find, but apparently has some used ones through other sellers.

Build compelling alternatives to PHP

June 29th, 2012, 13:07

Therefore, I’d like to submit a humble suggestion to my fellow programmers. The next time you feel the urge to write Yet Another Epic Critique of PHP, consider that:

  1. We get it already. PHP is horrible, but it’s used everywhere. Guess what? It was just as horrible in 2008. And 2005. And 2002. There’s a pattern here, but it’s subtle. You have to look very closely to see it. On second thought, never mind. You’re probably not smart enough to figure it out.
  2. The best way to combat something as pervasively and institutionally awful as PHP is not to point out all its (many, many, many) faults, but to build compelling alternatives and make sure these alternatives are equally pervasive, as easy to set up and use as possible.

— Jeff Atwood. The PHP Singularity.

Poe’s law

June 27th, 2012, 19:36

Without a winking smiley or other blatant display of humour, it is impossible to create a parody of fundamentalism that someone won’t mistake for the real thing.

— Tom Chivers. Internet rules and laws: the top 10, from Godwin to Poe.

Emacs 24.1 released

June 11th, 2012, 02:36

I’ve been running a non-stable release for a while now, but, yesterday, Emacs 24.1 was relased. It comes packed with some new interesting features, out of which I have to name the new packaging system and the support for lexical scoping on emacs lisp. The latter comes as a major update and one that, according to the documentation here, should provide code that “(…) is also much more friendly to concurrency, which we want to add to Emacs in the near future”. Here’s some stuff I highlight from the complete list of new features:

  • An Emacs Lisp package manager is now included. This is a convenient way to download and install additional packages, from a package repository at
  • New command `M-x customize-themes’, which provides a convenient interface for enabling and disabling Custom themes.
  • New commands `count-words-region’ and `count-words’.
  • The “Copy”, “Cut”, and “Paste” items in the “Edit” menu are now exactly equivalent to M-w, C-w, and C-y respectively.
  • New feature to “guess” the style in an existing buffer (in CC mode).
  • Org mode has been updated to version 7.8.09.
  • New global minor mode electric-pair-mode.
  • New global minor mode electric-indent-mode.
  • New global minor mode electric-layout-mode.
  • Code can now use lexical scoping by default instead of dynamic scoping. The `lexical-binding’ variable enables lexical scoping for local variables. It is typically set via a file-local variable in the first line of the file, in which case it applies to all the code in that file.
  • An Emacs Lisp testing tool is now included. Emacs Lisp developers can use this tool to write automated tests for their code. See the ERT info manual for details.
  • `call-process’ and `call-process-region’ allow a `(:file “file”)’ spec to redirect STDOUT to a file.
  • On Mac OS X, dragging a file into Emacs visits the file, like on other platforms, rather than inserting its contents into the buffer.

Thinking about programs as data pipelines

June 9th, 2012, 17:35

Thinking about the program as a data pipeline keeps me thinking about what needs to happen, instead of how each step should be done. It’s a higher level of thinking that keeps us from bogging down in implementation details at the design phase.

— Jessica Kerr. Why Functional Matters: Your white board will never be the same.