Email’s not sexy

I wanted to host an email server for a project I am working on. Due to the simplicity of installing a web server in modern linux distributions I mistakenly assumed I was a few “apt-get install”s away from success. This was stupid of me.

Don’t get me wrong, I am sure that sendmail and postfix are wonderful pieces of powerful software, and as someone searching for free software to do complex things I have no right to complain, but I simply don’t care enough about email to invest time in learning. It’s just not fun or sexy to me. For whatever reason, web servers are sexier. Web servers are still tied to the future and are going interesting places. But email seems bland and tired, no longer tied to progress, like some sort of dead end, waiting to be replaced by some cooler communication system.

Basically, my search for a simple solution led me here: https://help.ubuntu.com/community/MailServer , which tells me exactly what I don’t want to hear:

Setting up an email server is a difficult process involving a number of different programs, each of which needs to be properly configured. The best approach is to install and configure each individual component one by one, ensuring that each one works, and gradually build your mail server.

Great. Perhaps my technical genius will allow me to plow through this in a few minutes?

A Mail Transfer Agent (MTA) is the program which receives and sends out the email from your server, and is therefore the key part. The default MTA in Ubuntu is Postfix, but exim4 is also fully supported and in the main repository.

Postfix – this guide explains how to set up Postfix.

But the extent of my technical genius is vastly (well, entirely) overstated and my attention span is near it’s limit. I hope this is relatively simple.

[...]

Configure Postfix to do SMTP AUTH using SASL (saslauthd):

sudo postconf -e 'smtpd_sasl_local_domain ='
sudo postconf -e 'smtpd_sasl_auth_enable = yes'
sudo postconf -e 'smtpd_sasl_security_options = noanonymous'
sudo postconf -e 'broken_sasl_auth_clients = yes'
sudo postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
sudo postconf -e 'inet_interfaces = all'

Next edit /etc/postfix/sasl/smtpd.conf and add the following lines:

pwcheck_method: saslauthd
mech_list: plain login

Generate certificates to be used for TLS encryption and/or certificate Authentication:

touch smtpd.key
chmod 600 smtpd.key
openssl genrsa 1024 > smtpd.key
openssl req -new -key smtpd.key -x509 -days 3650 -out smtpd.crt # has prompts
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650 # has prompts
sudo mv smtpd.key /etc/ssl/private/
sudo mv smtpd.crt /etc/ssl/certs/
sudo mv cakey.pem /etc/ssl/private/
sudo mv cacert.pem /etc/ssl/certs/

Configure Postfix to do TLS encryption for both incoming and outgoing mail:

[...]

Oh my god I don’t care anymore. I don’t understand why this sensible configuration isn’t built in or automated, there probably are wonderful technical reasons, but I am physically unable to force myself to type in these commands because I am bored just reading them.

If this was Node.js or clojure, the compelling nature of what they enable and how they sit at the edge of innovation might entice me to dig through config files — and yet ironically I don’t need to because the default install for those programs are fairly straightforward.

Anyways, moral of the story: The amount of garbage you are willing to put up with to get something working reflects how inherently interesting you deem that endeavor. Keep that in mind the next time you feel your temperature rising when dealing with config files. Perhaps some things are worth outsourcing instead of buckling down and working through. I feel like an intermediate knowledge of web servers will be handy in future projects, whereas becoming intimate with IMAP, SASL, MTA, and MX DNS records probably does not pave a path towards the next big thing.

What Louis CK learned from George Carlin: Throw it all away

“What do dogs do on their day off? They can’t lay around…that’s their job already.”
-George Carlin

I was struck by a video peaking on reddit earlier today of Louis CK honoring George Carlin in March 2010. It’s a fascinating monologue giving insight into how Louis eventually became a great comedian, after languishing for fifteen years:

I spent 15 years as a comedian, going in a circle that went nowhere. I hated my act, I had been doing the same hour of comedy for 15 years…and it was shit, I promise you. [...]

I was sitting in my car after the show [in a Chinese restaurant] , just feeling like this was all a big mistake: I’m just not good enough; I felt like my jokes were a trap.

In the car I listened to a CD of George Carlin talking about comedy, talking about it seriously.

The thing that blew me away about this fellow was that he kept putting out specials. Every year there would be a new George Carlin special, a new George Carlin album. How did he do it? It made me literally cry, that I could never do that. I did the same jokes for 15 years.

On the CD they ask him, how do you write all this material? And he says, each year I decide I’d be working on that year’s special, then I’d do that special, then I would throw away that material and start again with nothing. And I thought, that’s crazy, how do you throw away? It took me fifteen years to build this shitty hour, and if I throw it away, I got nothing.

But he gave me the courage to try it — and also I was desperate, what else would I do?

This idea that you throw everything away and you start over again. After you are done telling jokes about airplanes and dogs, you throw them away. What do you have left? You can only dig deeper. You start talking about your feelings and who you are. And then you do those jokes until they’re gone.You gotta dig deeper. So then you start thinking about your fears andyour nightmares and doing jokes about that. And then they’re gone. And then you start going into just weird shit.

It’s a process that I watched him do my whole life. And I started to try and do it.

For Louis CK, focusing on perfecting one set of jokes led only to fifteen years of comedic stagnation; he didn’t even enjoy his own act. It was only when he was able to let go the idea of these perfect jokes and explore comedy in a fuller sense, to push the boundaries in comedic space, that he became successful. And his role model, George Carlin, followed a similar process of throwing stuff away and trying to push as far away into new zones of joke-space.

In another part of his talk, Louis CK mentions he recognizes and actively seeks strange and controversial new jokes:

I was having a hard time being a father, and I wanted to say it on stage. So I thought, forget all the old jokes, start again. And I said the first thing I thought of: “I can’t have sex with my wife, because we have a baby, and our baby is a f**king a**hole.” It was how I was feeling, and I just said it. And the audience went Whoa! And I thought…oh, I’m somewhere new now.

And I said, “I never got babies in the dumpster before…but now I get it.” [audience gasps] And they did that! And I thought, I’d rather have that, then the shit tepid laughter from my fifteen-year old jokes. So I started going down this road. And he (George Carlin) was the beacon for me, always. He always gave me the courage.

For me, the larger implication of all of this is that success or prolific creativity is often not the result of directly trying to write great jokes or even of endless practice of a craft (although that often helps, e.g. John Mayer reminds us of the importance of writing terrible songs).

It may instead be more important to actively challenge yourself to do something fundamentally different from what yourself or others have done in the past. In doing so, you’re engraining more, and deeper, knowledge of what jokes are, internalizing joke-ness through your intellectual questioning.

Perhaps our metrics for weekend hacks and start-up ideas shouldn’t be judged on profitability or technical virtuosity. Perhaps we should just ask ourselves — does this make the audience go “Whoa!”? Does this project force me in new directions and is it exploring along the fringes of what is possible but not yet realized?

Entrenched interests and corrupted systems

A great post from Andrew on Everything discusses the problem where a “game” can be gamed to such an extent that what you achieve violates the original spirit or intent of the game.

He gives many examples, including the patent system (exploited by patent trolls), stock markets (exploited by high frequency trading firms), politics (exploited by politicians great at getting elected but bad at governing), and test taking (exploited by those who take intensive SAT prep courses.)

The problem is that the rules do not evolve to avoid exploitation, and so the ‘spirit’ of the system is increasingly corrupted. For example, high-frequency trading demonstrably increases market volatility, which is bad for the average investor. It also is nearly completely orthogonal to the original intent of stock exchanges, which is to allow companies to raise money and citizens to put their money to work. The only parties that benefit are the high-frequency trading firms and the exchange, which caters to HFT because of increased revenues.

At some point the rules, even if they no longer make sense, become entrenched. There becomes a large financial interest with significant power that will oppose changing those rules because they benefit from exploiting them. Political parties are a good example of this; the two-party system in the US with its archaic electoral college system, is definitely not the best way to decide who runs the country. Who benefits from this ridiculous system? The entrenched parties and the professional politicians, but definitely not the average citizen.

One thing to be aware of, is that these perverted systems can also be opportunities. The existing exchanges cater to HFT but not average citizens; could an alternate exchange that adheres more strongly to the original intent of investment transform the system? Tests like the SAT become meaningless when money can buy access to intensive over-optimizing prep courses that will not increase the student’s ability to succeed in college; they no longer measure what they are supposed to. Could a test that better correlates with college performance transform the testing market?

Although examining these examples of perverted systems can make one cynical, it seems like there ultimately must be some way to change them; those that are hurt by the systems so far outnumber those that benefit from it, if only they could organize or were actively offered the choice of an alternative.

Misunderstanding Reality: Why Kevin Mitnick Needlessly Suffered

Kevin Mitnick was promoting his new book, Ghost in the Wires, on the Colbert Report. It turned out that of his 5 years he spent in prison for hacking, the first was in solitary confinement. Why?

Colbert: Why a year in solitary confinement? You don’t look like a dangerous guy.

Mitnick: [...] The prosecutor had told the judge during a bail hearing that I could pick up the telephone and connect to NORAD and whistle the launch codes and launch a nuclear weapon. And because of this the judge had a special order that I’d have to be held in prison without access to a telephone. So, the only place they could put me was in solitary confinement. So I was there about a year.Colbert: Can you do that? Could you do that? Because that would be bad-ass.

What???

This seems like another situation in which sci-fi author Arthur C. Clarke’s third law applies:

Any sufficiently advanced technology is indistinguishable from magic.

To those who misunderstand reality and what is possible, the prosecutor’s ridiculous assertion seems plasuible. That is, when technology seems like magic to you, your intuitions of what this magic is capable of are going to be awful. As a result, a man was needlessly separated from human contact for a year.

Book Review: Breakthrough

I just finished reading Breakthrough: Stories and Strategies of Radical Innovation by Mark and Barbara Stefik, which is built from many interviews of successful innovators at famous research labs like Bell, PARC, and MIT’s Media Lab.

The book provides some interesting stories about how innovation works. However, rather than the author’s synthesis of the material (although it is sometimes insightful), what I found most interesting was just good quotes from really smart people on the nature of innovation.

Here are a few of my favorites:

Chuck Thacker was quoted as saying:

You can’t build railroads before it is railroad time.

What a cool sound-bite! My interpretation is that sometimes the pieces you need to get somewhere don’t yet exist, and you can’t force it to come together without it. Railroads needed a steam engine to be feasible. If the algorithm or market necessary for your super-cool idea to flourish doesn’t yet exist, it may not yet be railroad time no matter how hard you try.

Allan Newell:

People think that science is riskier than it actually is. If you take a group of smart people and send them down some path, they generally come back with something interesting.

In the context of start-up culture, this could imply that it may be more important just to collect a group of inspired hackers and set them loose rather than have some kind of methodical plan for what you want them to do. You may know that no matter what project Hacker X works on, it will end up being cool.

Walter Bishop Jr. (a jazz musician):

Once you’ve created your own sound and you have agood sense of the history of the music, then you think of where the music hasn’t gone and where it can go — and that’s innovation.

This is exactly what start-ups do, they are typically exploring the fringe of what is possible. To do so, you have to understand what has been possible in the past, and what the emerging tools of new technology are making feasible that wasn’t before. And among those things that are newly feasible, which are the most compelling or interesting that could potentially create monetary value?

John Mayer on Finishing Projects (even if they are awful)

John Mayer came to Berklee to talk with the music students there. One quote stood out to me:

“I can’t stress enough how important it is to write bad songs. There’s a lot of people who don’t want to finish songs because they don’t think they’re any good. Well they’re not good enough. Write it!  I want you to write me the worst songs you could possible write me because you won’t write bad songs. You’re thinking they’re bad so you don’t have to finish it. That’s what I really think it is. Well it’s all right. Well, how do you know? It’s not done!”

The quote reminds me of the unfinished game projects written in GW-BASIC that littered the diskettes of my childhood. I would start to write a new game, driven by an unrealistic vision in my head. Then after I’d made the menu and a few lines of the main loop, the initial burst of excitement would subside. The reality of the hard work necessary to make any progress and the immaturity of my skill set were insurmountable.

Rather than finish something terrible or try a smaller project, I’d accumulate these stillborn games. My embryonic ideas never got the chance to develop. And so my talents remained relatively stillborn themselves until I gained the self-discipline necessary to follow through.

In order to make something great, you usually have to make a lot of bad things first. And while everyone wants to make awesome things, few have the patience and persistence to slog through the necessity of first making the awful things.

Bookalyzer: Exploiting Critical Mass to Make Magic and Explore History

One reason I love linux is the wide array of packages that can either be instantly installed from the command line or easily downloaded from third party sites. While this doesn’t necessarily distinguish linux from windows, the linux ecosystem is designed for power users.  With Linux you can quickly cobble together an impressive tool from wide-ranging components using a scripting language as glue.

Because the system of components available for linux has reached a critical mass (just about anything you might need probably exists), the things you can accomplish in four hours of tinkering are surprising. For example, in this post I detail a tool I made that can investigate whether our literature is getting dumber.

The Problem: Monotonous Word Counting

For a research project I was looking to estimate word counts of popular books and their readibility (i.e. is a particular book written for a highly educated audience or the masses?). One characteristic of hackers is that they are lazy in a special sense: they generally dislike drudging intellectually-void work like manually counting words on a page. So, I investigated automated alternatives.

Bookalyzer: Scraping Google Books Previews

I noticed that excerpts from many books are available through google books. However, the text is not copy/paste-able (i.e. it is an image rendered through javascript). In order to automatically analyze a book’s contents I would need to convert the images into machine-friendly text, not a simple task.

Whimsically and unrealistically, I thought it’d be great to have a tool that would: 1) control a web-browser to use google books, 2) go to an arbitrary page,  3) take a screenshot, 4) run the screenshot through OCR (optical character recognition) and 5) analyze the resultant text. It seems like an ambitious ungainly project, especially since I hadn’t had any experience with browser automation or OCR tools.

Naturally, my initial rational impulse was to give up and just do the work manually. Luckily though, my allergy to dull work prevailed. In fifteen minutes of web searching, a somewhat realistic plan had congealed:

1. From the title of the book, query the google books api to determine an ISBN

2. Feed the ISBN into a html document that uses the google books embedded viewer api to zoom in and scroll a few pages in to reach a representative page (hopefully full of text).

3. Use selenium to drive firefox to render the html document and take a screenshot

4. Take the screenshot, do some cropping and basic segmentation with imagemagick to isolate the text

5. Translate the image into text through tesseract, an open-source OCR engine that is fairly good.

6. Finally, use the page count and the words on this particular page as a (admittedly rough) estimate of the book’s word count, and calculate a basic readibility metric

Surprisingly, this plan worked; I was able to implement a basic functional version of the tool in about four hours. I’ve posted my code on git-hub if you would like to leapfrog from it, although it is a hack. I’m calling it bookalyzer.

Dummy Test: Does It Measure Anything

The text gets a bit garbled from the OCR; it isn’t perfect. Also, sometimes the page you choose from the google books sample might not be representative of the whole book (e.g. perhaps you choose a particularly dense page). Both of these points imply that there will be some noise in the readibility measure.

So, to test whether bookalyzer measures anything at all, I ran the tool on a set of biology textbooks and on children’s fiction (a selection of R.L. Stein’s Goosebumps series, for those that remember). The question was whether the bookalyzer tool could differentiate the reading levels of these two sets. Here is a plot of the resultant readibility scores:

You can see that there is a clear difference: The children’s books have an average readibility of around 5th grade, while the Biology textbooks float around an 11-12th grade reading level. So, despite the noise, the readibility test run on an OCR’d page of a google-book preview has some measuring power.

Fun Application: Are Books Getting Dumber?

It seems somewhat believable that best-selling books might be getting dumber over time. We think of past generations as possibly more well-read, and of the current generation (perhaps unfairly) as celebrity-gossip-seeking Jersey-shore-watching idiots. Perhaps every generation believes the next is stupider.

Interestingly, given the ability to estimate the readability of any google-previewable book and a list of best-selling books over a few decades, one can actually investigate this claim (albeit on a superficial level). I grabbed a list of bestselling books going back a few decades from a class website and ran the readibility tool. Here are the results:

The data does suggest a slight downwards trend (-0.03 grades per year),  although the correlation was weak (-0.09) and the p-test was not significant (0.18). In other words, we might be getting dumber, but the data is not conclusive.

Someone could probably do a better job either (and probably someone already has) if they 1) work at google and have full access to the text of all these books, or 2) using the ngram dataset dataset from google (http://ngrams.googlelabs.com/datasets) in a clever way with a word-based readibility metric.

Conclusion

Powerful open platforms like Linux and freely-available internet APIs (like google books) organize into a critical mass that potentiates a limitless swathe of unforeseen applications. What strange magic can you bring to life in four hours?

Ubuntu/Linux: What to do when a window or dialog won’t fit on-screen

On my laptop, sometimes an application’s throws up a pop-up menu or form that is too long to fit on the screen. If the form has no scroll-bar to get to the bottom of the form, which often has an OK button that needs to be pressed to move on, it is a very frustrating experience.

I’ve had this problem with cinelerra, a powerful opensource video editor  as well as with the android SDK. The solution is to press ALT+F7, which will allow you to ‘grab’ the window and manually adjust it upwards and allow you to click the OK button and move on!

Pivots, Veers, and Omniscience

Jason Freedman posted about companies that change direction to exploit assets they’ve created in different ways. A company pivots if it has made a drastic change that renders it almost unrecognizable from its original conception (Groupon is a common example, they started out in online fundraising and switched to group coupons only as a last resort.) A company veers if it has made a less dramatic change.

Jason’s argument was that in many cases it may be better to veer than to pivot because huge unprincipled changes in a company’s vision may be disastrous and overly dependent upon luck.  You see similar things in natural evolution; most large mutations to organisms are really bad, and so, by and large, natural evolution proceeds by small incremental change.

Of course, drastic changes can happen slowly over the course of natural evolution; a modern species will superficially not resemble its ancient ancestors. Many tiny pivots, an accumulation of adaptations to local environment, have so changed an organism that it’s core purpose seems no longer the same as its ancestors. For example, I hope that no one confuses me with my great^100000 grandfather, the flat-worm.

Pivoting, veering, or in general, a shift of any kind in core purpose of a company, is admitting that we are not omniscient. The core idea of a company, formulated idealistically in advance, may not reflect the ever-changing needs of users, and thus must adapt when implemented. Core assets designed for one purpose may be exapted to other contexts, and our preconceptions of what customers want or need often turn out to be misinformed.

I’ve recently launched a side project, and based on the luke-warm response I’ve received so far, it seems as if veering or pivoting will be in my near-future as well. One hopes for a grand reception for a new project, and is disappointed when it is received with indifference. Yet, this is how most sites implemented in isolation from users (as mine was) begin, because an entrepreneur’s internal model of what would excite people, or what people needed is often wrong.

The niche I thought I was filling (sensical price comparisons for supplements) either doesn’t exist, or I’ve formulated it in the wrong way, or my implementation is way off-base. I need to re-examine what I’ve done, seek sharp criticism, and see if there is anything salvageable. Perhaps there is a way to slightly veer to more favorable winds.

I’m not omniscient, but hopefully I can be smart enough to listen and adapt what I’ve created to what people actually want or care about.

The lesson behind veering and pivoting is that stubbornly following your initial plan, when that is clearly not working or is misinformed, is a fool’s errand. Veering is about embracing serendipity and the unique opportunities that result from the assets you’ve built, and following where those things naturally lead, even if it means letting go of where you initially thought you were going. No one is omniscient.

12,000 Minds

A quick post I wrote up and submitted to hacker news on Saturday afternoon unexpectedly resonated and was #1 on the front page for a few hours. I checked my web stats an hour ago and found that 12,000 unique visitors had read the article over the course of two days (lighttpd hosted on prgmr.com handled the traffic without a problem, they are a great tech-friendly web host.)

This was exciting and largely humbling; nothing I’ve written has reached so many people, and being featured on a site I frequent and whose visitors I respect was an honor. For anyone who is solely a ‘consumer’ of content, I’d encourage you to try your hand at producing; it is rewarding if you can find something interesting to say. (Hint: A good article may illustrate something counter-intuitive in a compelling way, e.g. viewing something ordinary from a novel angle,  or provide easy access to information otherwise requiring significant investment, e.g. how to circumvent a particular bug.)

As a Ph.D. student, at a conference I may have a “crowd” of 50 people listen to a presentation, or 300 people may read an academic paper of mine over the course of a year (if I’m lucky). My thesis will reflect countless hours of work, yet will be read by few. Now, I love what I do and am not complaining, but it’s incredible that I’ve somehow managed to reach 12,000 minds with substantially less effort (and a healthy dose of luck).

This is one aspect of what hacking is about: Finding (or creating) levers to pull that create a greater magnitude of opportunities with proportionally less investment. So, while I’m not about to quit my Ph.D. program, the beginner’s luck I’ve had with blogging has convinced me to continue investing in this particular direction. Not because I know where it will lead me, but because it can potentially lead to so many different places that I might not otherwise reach.

Blogging is about connecting and building an interesting asset around a community of people interested in the same things that you are. I’m reminded of a cool quote from Xianhang Zhang (I recommend reading his post in its entirety):

What I’ve found though, is that the most exciting startup ideas are mostly not in this pool [rather trivial ideas for web startups: Games! Group Messaging! Coupons!] but are, instead, backed by a hidden asset.

When I talk about assets, cash is the least interesting of all of these. Instead, I’m talking about more intangible assets like skills, reputation, relationships, attention & fame. I’m of the strong opinion that the most reliable path towards startup success is to focus relentlessly on acquiring interesting assets and then execute on the startups that naturally fall out of them.