fuzzy notepad

Tagged: tech

[blog] I bought a new laptop

Wow, where the hell have I been.

That whole “dying cat” thing ruined most of my April, and I spent most of May dealing with various other life crises, and then June scrambling to catch up. I’ve started and abandoned maybe half a dozen posts in that time that I will totally maybe finish someday. In the meantime, here’s something aimless and specific to me about how I bought a thing. Par for the course, then.

[blog] The controller pattern is awful (and other OO heresy)

Almost a year ago now, Jack Diederich gave a talk entitled “Stop Writing Classes“, in which he implores Python programmers to stop creating classes just for the hell of it, and specifically calls out the common pattern of a class with only a constructor/initializer and a single method—which should, of course, just be a function.

A few weeks ago, Armin Ronacher wrote a rebuttal entitled “Start Writing More Classes“, which argues that classes are essential for both writing extensible code and smoothing over crappy interfaces. (Hm. Now that I look at it again, if you read the post backwards, it almost sounds like he’s suggesting writing a class to smooth out the crappy interface you get from using too many classes
)

I’m having some trouble here, because I agree with both points of view. There must be a way to resolve this contradiction, a message that resonates with everyone.

I think I’ve found it.

Stop writing stupid classes.

[blog] CVs and file extensions

Like many employed engineers, I get roped into the hiring process from time to time. I don’t actually screen rĂ©sumĂ©s, but I do grade some code tests, and the rĂ©sumĂ© is sent along with it—in case I find myself desperately seeking an explanation for receiving five hundred lines of JavaScript arranged as haiku.

In glancing over these rĂ©sumĂ©s, I’ve observed a pattern: I’m far quicker to judge the file extension than the contents. It’s easy to lie or exaggerate in a document, but habits are far more difficult to hide. If you’re the kind of person who reaches for Microsoft Word, you’re still going to do that when writing a rĂ©sumĂ©.

I expressed this to Twitter, and not only did I get several people asking what formats I preferred, but I’m drowning in a deluge of suggestions for ridiculous rĂ©sumĂ© formats. Let us collect some here.

(Disclaimer: I don’t speak for my employer yadda yadda.)

docx: What the hell is this? Are you even a programmer? I haven’t had an office suite installed for years and I don’t plan to start now just to find out what dumb school you went to. I may open it as a ZIP and glance over the text nodes in word/document.xml; hope there’s no important formatting in here.

doc: This isn’t much better, and your office suite is ancient besides, but at least I can throw this at antiword and have a good chance of being able to read it.

pdf: Okay, sure. I apologize in advance for the horrendous mangling your hand-crafted masterpiece will experience when it encounters everyone’s HR systems from 1993.

pdf with only glyph strokes and no text information: Fuck you.

pdf clearly generated from LaTeX: Instant boner. Are you sure you’re in comp sci and not math? Maybe you want a LISP shop.

tex: Hired.

rtf: You’re either an idiot or as frustrated with the lack of light document formatting formats as I am. But it doesn’t matter because I still can’t read it.

txt: NICE, as long as it contains either RFC-style genuine plain text, Markdown, or ornate Unicode box-drawing decorations with emoji insets. Suggestions for appropriate monospace fonts a plus.

odt: This is still a pain in the ass for me to read, but kudos for trying, and double kudos for using a file format no HR department on the planet will recognize.

ps: Nice try, but I’m not a printer. Cross your fingers and hope Inkscape gets it right.

html: There is something very fundamentally wrong with emailing HTML as an attachment. If you’re so familiar with HTML then maybe you should get, like, a website.

xls, ods: Allow me to respond with this chart of how much I hate you.

xps: You are out of your goddamn mind. I’m intrigued.

xml + xsl: I’ve had enough XSLT for one lifetime, thanks.

link to a shared document on Google Drive: It appears you work for Google and they won’t let you have a real computer, only a Chromebook. They’re probably paying you more than anyone else can, so it doesn’t much matter whether we make an offer.

py: Putting your entire program in a single file is poor form. This should be a bdist egg.

exe: Acceptable only if this is a crack for expensive obscure software released in the past 15 days. I will also be judging you based on the sweet trance music that plays while it’s running.

swf: Unless this is a vim swap file, get the fuck out. If it’s a vim swap file, you direly need to delete/recover some old files, and then get the fuck out.

iso: I’m aware of precisely one psychopath who has created a disk image that boots into the OS they wrote and displays their PDF rĂ©sumĂ©. No other form of .iso submission is acceptable.

c: goddammit klange

jpg: Now you’re just fucking with me. A text-heavy image should be a PNG.

anything that 0-days my machine: You can have my job.

[blog] A little bit Rusty

Yelp had a hackathon a couple weeks ago. These affairs are mixed blessings for me: a fixed chunk of uninterrupted time to work on a single project is great, but I tend to have at least a dozen ideas that I want to do all at once, none of which can be reasonably “finished” in a scant 30 hours, and most of which are obscure enough that nobody can work on them with me.

For example, during this most recent event, I wrote a roguelike. In Rust.

Long-time readers may recall that I’ve attempted to write a roguelike before, in Python, but fell prey to architecture astronomy. This time would be different! Because I would only have 30 hours. Also because static typing limits my options, thus making it easier to overcome choice paralysis. (It’s a working theory.)

But first: a bunch of people have asked what I think of Rust, and now I’ve actually written something approaching a real program in it, so let’s start there.

[blog] Heteroglot: #15 in COBOL

Introduction

Many moons ago, I started a ridiculous quest to solve every Project Euler problem, in order, with a different programming language. I called it “heteroglot“.

Partway through that, I gave myself the additional unwritten rule that the next language would be selected by polling the nearest group of nerds. This has resulted in math problems solved in such wildly inappropriate languages as vimscript, MUMPS, LOLcode, and XSLT.

It’s been a while since I did one of these, but I still remember that the next language I’m stuck using is COBOL. I don’t know who suggested it, but I hope he chokes on a rake. ♄

I figure if this is interesting to me, it might be interesting to someone else. So let’s learn some math and/or COBOL.

[blog] Stripe CTF 2.0

This is a thing I did. It was a cracking contest held by Stripe (who run a pretty neat service, btw), and it ended today. I was third to beat level 7 and twentieth to beat level 8, so here is the tale of how I came upon the solutions.

I haven’t reproduced the entirety of each puzzle below, because that would suck, but if you’re lucky maybe you can still sign up and follow along. If not, Stripe has promised to release the puzzles (and solutions) tomorrow. I think.

[blog] Quick doesn’t have to mean dirty

From TechCrunch:

Anyway, my sympathy for PHP’s deviltry is because I appreciate its ethos. Its just-get-it-done attitude. Or, as Melvin Tercan put it in his recent blog post, “here’s to the PHP Misfits. The pragmatic ones who would pick up anything – even double-clawed hammers – to build their own future. Often ridiculed and belittled by the hip guys in class who write cool code in Ruby or Python, but always the ones who just get shit done.”

He’s on to something there. The best is the enemy of the good, and shipping some working PHP code is approximately a million times better than designing something mindblowing in Haskell that never actually ships. I fully support Jeff Atwood’s call to replace PHP once and for all–but I hope that everyone realizes that eliminating its many, many, multitudinous flaws won’t be enough; they’ll have to somehow duplicate its just-make-it-work ethos, too.

This is a recurring sentiment: developers telling me, well, yeah, Python may be all cool in your ivory tower, man, but like, I just want to write some programs.

To which I say: what the fuck are you people smoking? Whence comes this belief that anything claimed to be a better tool must be some hellacious academic-only monstrosity which actively resists real-world use?

But, hey, I’m sick of talking about PHP. So let’s talk about Python. In honor of the 90s, let’s make a guestbook.

[blog] PHP: a fractal of bad design

(This article has been translated into Spanish (PDF, with some additions) by Jorge Amado Soria Ramirez — thanks!)

Preface

I’m cranky. I complain about a lot of things. There’s a lot in the world of technology I don’t like, and that’s really to be expected—programming is a hilariously young discipline, and none of us have the slightest clue what we’re doing. Combine with Sturgeon’s Law, and I have a lifetime’s worth of stuff to gripe about.

This is not the same. PHP is not merely awkward to use, or ill-suited for what I want, or suboptimal, or against my religion. I can tell you all manner of good things about languages I avoid, and all manner of bad things about languages I enjoy. Go on, ask! It makes for interesting conversation.

PHP is the lone exception. Virtually every feature in PHP is broken somehow. The language, the framework, the ecosystem, are all just bad. And I can’t even point out any single damning thing, because the damage is so systemic. Every time I try to compile a list of PHP gripes, I get stuck in this depth-first search discovering more and more appalling trivia. (Hence, fractal.)

PHP is an embarrassment, a blight upon my craft. It’s so broken, but so lauded by every empowered amateur who’s yet to learn anything else, as to be maddening. It has paltry few redeeming qualities and I would prefer to forget it exists at all.

But I’ve got to get this out of my system. So here goes, one last try.

An analogy

I just blurted this out to Mel to explain my frustration and she insisted that I reproduce it here.

I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.

You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.

You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.

Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.

That’s what’s wrong with PHP.

[blog] On principle

Alice shows some code to Bob. Something about it catches Bob’s eye; he tells her that some mechanism is a bad idea and she should find another approach. She asks why.

Bob, despite being absolutely correct, can’t answer.

Or maybe he can, but is worse off nonetheless: for every pitfall or potential consequence he dreams up, Alice fires back with how she’ll compensate or why it doesn’t apply in this case. Eventually Bob runs out of ideas, and Alice carries on with what she’s doing, now feeling more vindicated—she’s fought for her work and won, after all.

Bob is arguing from principle, and Alice is scoffing at the idea of principle for its own sake. Principles are for academics; out here in the real world, whatever gets the job done is good enough.

Right?

[blog] tmux is sweet as heck

People occasionally ask me why tmux is significantly better than screen, and I end up mumbling the first few things that come to mind. This has yet to sway anyone. Here, then, are some things that I enjoy about using tmux.

First, some terminology, so the rest of this makes any sense at all.

  • tmux and screen, if you were not aware, are multiplexers—they let you run multiple terminals (or terminal programs) at the same time, switch between them, and disconnect or close your terminal without killing everything you were running. If you didn’t know this then you should probably stop now and poke around tmux’s site or something.
  • A session is a particular group of terminals owned by tmux (or screen). When you run tmux bare, you get a new session.
  • A window is a numbered terminal inside a session.
  • A pane is each compartment within a split window. (I lied above; a window might actually have several panes and thus several terminals. But a window is identified by one number.)
  • An xterm is a single GUI terminal window (or tab). You may be using another terminal emulator, or you may be in a non-GUI virtual terminal; I’m using “xterm” as an umbrella term for all of these.

I’m also assuming that ^A is your multiplexer trigger key, although tmux defaults to the more awkward ^B.

Works out of the box

Here’s my .screenrc, fiddled by hand over the course of many months after I started using screen.

1
2
3
4
5
6
7
8
9
caption always "%{= kw}%?%-Lw%?%{Kw}%n*%f %t%?(%u)%?%{kw}%?%+Lw%? %=%{= dw} %H "

# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"

What the fuck is any of this? The only real configuration here is the first line, which sets a fairly simple status bar. The rest is unreadable sludge picked off of Google to make terminals inside screen work the same way as terminals outside it. I see this as a serious failing in the one core feature that defines a multiplexer: being invisible.

Some of this might not be necessary any more; maybe termcaps have been improved in the meantime. Part of the very problem is that I can’t know; the best I can do is delete bits of it and see if screen still behaves correctly, assuming I remember all the quirks I was trying to fix in the first place. It’s 2012. I shouldn’t ever see the word “termcap”.

Contrast with tmux, which just worked. The only terminal-related fudging I ever had to do was set my $TERM to xterm-256color for it to respect 256-color sequences. Not entirely unreasonable.

tmux can also inherit parts of the environment when it’s detected a change; by default it looks for some common X and SSH stuff. The upshot of this is that your SSH agent continues to work across SSH connections; the new environment only applies to newly-created windows, but zero hacks are necessary.

By default as of tmux 1.6 (I think), when you create a new window, it’ll get the same current working directory as the current window.

[blog] FUCK PASSWORDS

I’m so tired of passwords. So, so, so tired.

Most people don’t understand this. Most people use the same password everywhere. Most people can just mechanically type out password3 in every password box, smirking to themselves at how clever they are, because who would ever guess 3 instead of 1?

I don’t do that. Let me tell you what i do.

I generate a different password for every service, based on a convoluted master password and the name of the thing. I do this because it’s what you’re supposed to do; it’s what security nerds (including myself for the purposes of this post) tell everyone else to do. “Ho ho!” we all chuckled to ourselves after the Gawker leak, and the subsequent breakins to various other things that used the same passwords. “If only these chumps had been generating different random passwords for every service!”

So my passwords look like 'fC`29ap5w78r3IJ, or Ab3HE4 2Iv5hJk\K, or mw@\_h<~o04neHiJ{. Those are actual examples i just generated. I’m eating my own dogfood, so to speak.

It’s not without its drawbacks.

[blog] In which i use GitHub, and IRC is awesome

I just wasted way too much time migrating all of my git repositories to GitHub. It’s way less janky than the old thing, and the guys running it seem to be acceptably hipster-nerdy.

I’m still using Redmine as a bug tracker, and i have a cron going that updates the old repositories regularly, so commits will still appear in tickets and whatnot. This is just a change of canon.

I am considering giving GitHub Issues a shot for small new projects, just to get a feel for it. Redmine is powerful but feels like it’s targeted at my manager. GitHub is, i must admit, very much targeted at the people on the ground doing the hacking.

Anyway, here is a story.

[blog] GNOME 3 revisited

How did I write this? I don’t know what happened. I was just jotting down notes and prose came out.

I wrote a whole thing about Shell and Unity before, but it was kinda knee-jerk ranting. With my newfound blog fame, here’s a lame attempt at a more constructive list of specific criticisms of GNOME 3, now that I’ve actually used it for a while on my laptop.

[blog] Python FAQ

I lurk in #python. It gets a lot of questions that are, shall we say, frequently asked. This is my attempt to catalogue interesting and useful questions. The answers will gradually become separate posts—perhaps on other blogs if someone else gets to them first. Let me know if there should be other questions, if the answers are unclear, or the answers have bugs in them!