# Social feature creep

Back in 2006 I got a gmail account. It was fantastic. I could get to my email from any PC with a web browser, I never had to worry about backups (I assumed that Google could do a better job than me), and storage was effectively unlimited. Compared to institutional email at the time, which usually had mail quotas like 20Mb, going with gmail was a no-brainer.

Over time, though, things have changed. Gmail used to be just email, but now that Google is doing the whole “social” thing, my Google account is a whole lot of things:

I can’t see this changing, especially with players like Facebook in the marketplace. Some people do want a basic email service, or one that offers encrypted storage, but these are under attack in the US:

“We’ve seen a lot of demand for, you know, people who want email but don’t necessarily want it lumped in and profiled along with their searches or their browsing history or any of their other Internet activities.” (Ladar Levison, interview on Democracy Now)

I’m not sure how we should respond to the larger political and social problem here, but in the mean time I have deleted my 7 year old gmail account along with all the associated accounts (Youtube, Location History, Blogger, etc). I’m running my own mail server on a Debian Squeeze VM, which I set up by following the excellent ISPmail tutorial at workaround.org. Another small change is that I now use Firefox instead of Chrome, along with the ghostery add-on. The first few days that I used ghostery were eye-opening. I never appreciated how many tracking things are embedded in websites that otherwise look normal.

I found that the easiest way to extract all of my gmail messages was to use mpop. Here’s my .mpoprc:

defaults
tls on

account gmail
host pop.gmail.com
keep on
only_new off
tls_starttls off
delivery mbox ~/gmail-backup/gmail.mbox

# Set a default account
account default : gmail


Then to retrieve the mail:

mpop --tls-certcheck=off -a


To import it into Thunderbird, I used the ImportExportTools add-on, which happily pulled in the 3.7Gb mbox file.

# New Yesod blog

I’ve ditched my old WordPress blog in favour of a blog system that I wrote myself using Yesod. Source code is here: https://github.com/carlohamalainen/cli-yesod-blog.

Overall, the development process was pleasant. Many things like configuration settings, routes, and SQL queries can be checked by the compiler, so a whole class of run-time errors just never happened. I was able to do some fairly involved refactorings of the code, and once it compiled, it Just Worked (TM). This is in stark contrast to my experience of developing Python applications in my day job.

Reflecting on the qualitative feeling during the development process, I was reminded of a talk by Rich Hickey called Simple Made Easy. Some of the main points that Rich made during the talk really resonated with me, even though he had Clojure in mind, not Haskell. (Thanks to obeautifulcode.com for making notes).

On familiarity:

“If you want everything to be familiar you will never learn anything new because it cannot be significantly different from what you already know and not drift away from the familiarity.”

Writing my blog system using Yesod definitely pushed me beyond what was familiar. A surprisingly simple problem, adding ReCAPTCHA verification for comments, gave me a concrete reason to dig into the details for applicative forms in Yesod.

On ego:

“… this starts trampling on our egos … due to combination of hubris and insecurity we never talk about something being outside of our capabilities.”

The flipside, if one can get past the ego, is that there are lots of smart people in the Haskell community. The Haskell Cafe is a nice place to lurk – my to-do list from there is ever-increasing.

Lastly:

We are too focused on the experience of programming rather than the artifacts – the programs that gets produced and run. We should assess quality based on our artifacts, not on the experience of typing programs into an editor!

For me, and I may be reading something into this that Rich did not intend, Haskell/GHC provides the best experience for maintaining code due to the ability of the compiler to check so many things. On Lisp vs Java, here’s a similar opinion:

> “The difference between Lisp and Java, as Paul Graham has pointed out, is that Lisp is for working with computational ideas and expression, whereas Java is for expressing completed programs. As James [Gosling] says, Java requires you to pin down decisions early on…”

My experience with modifying Lisp and Java programs has largely been the opposite. I’ve been working on a Java application for the past few weeks, and the design of the program has changed several times as I’ve thought of new features to add and cleaner ways to organize my code. Today, I had a class X that was responsible for keeping track of a certain variable, and I wanted to move that responsibility to class Y. I deleted the relevant field and all references to it in class X, and Eclipse highlighted all of the errors that change introduced. I fixed the highlighted errors and added the new methods I needed to class Y, and when I tested the relevant functionality, I saw that I had introduced only one minor bug, which I fixed with a single line of code. There was nothing difficult about the process.

I’ve found refactoring Lisp programs to be more difficult. When I was writing a prototype of this same application in Lisp (Clojure more specifically), I had a macro to implement a small DSL. The macro was not particularly complex, although it was non-trivial: it did some code walking and called some helper functions. When my DSL grew past a certain size, making changes to its implementation became rather difficult. Sometimes the compiler would report errors at runtime, but more often than not, things would just stop working in mysterious ways whenever I made a change. The macro’s output was also quite different than the kind of code I would write by hand, so debugging was difficult.

I’m not the best Lisp programmer, so I’m not trying to say that Lisp always makes it hard to change your programs. But there are cases where Java makes it very easy to change your programs.

Anyway, back to my blog system. The interface is all on the command line, because I like to live in a GNU Screen session and use vim whenever possible. For example, to add a new post, I type

$blog-utils --add 'title of the post'  and vim is opened on a temporary file. When I save and quit, the post is added to the system, but is invisible: "/tmp/blah.html" 40L, 1533C written Key {unKey = PersistInt64 104}$ blog-utils  --list | grep 'New Yesod'
104 HIDDEN 2013/8/8/new-yesod-blog  'New Yesod blog'  I've ditched my old WordPress blog i


To set it to be visible:

\$ blog-utils --set-post-visible 104


Easy 🙂

One niggly issue was that I had to set up a proxy from Apache to Nginx. This is not the usual direction, but I have a number of sites running on Apache and it seemed the path of least resistance. So for Debian Squeeze, here ar ethe magic lines (nginx runs on port 8080 which is not visible to the outside world):

LoadModule  proxy_module         /usr/lib/apache2/modules/mod_proxy.so

ProxyPass /blog http://carlo-hamalainen.net:8080/blog
ProxyPassReverse /blog http://carlo-hamalainen.net:8080/blog

ProxyPass /static http://carlo-hamalainen.net:8080/static
ProxyPassReverse /static http://carlo-hamalainen.net:8080/static