TheJach.com

Jach's personal blog

(Largely containing a mind-dump to myselves: past, present, and future)
Current favorite quote: "Supposedly smart people are weirdly ignorant of Bayes' Rule." William B Vogt, 2010

Vim's learning curve is wrong

This image has been around for years:
learning curve

(I actually found this blog post while searching for the image, it's worth a quick read but touches on a different point.)

Here's my first complaint. The axes aren't labeled. Well, I guess that's better than being incorrectly labeled, since now you have a chance to interpret it correctly. The horizontal axis being time is usually a good guess, and in this case is correct. (Which is why emacs is funny.) Learning curves are fairly arbitrary anyway. I think that they're supposed to measure the rate at which one acquires knowledge or ability, the rate at which one learns. They're supposed to measure velocity. Typically, however, creators of graphs intend them to measure either difficulty, frustration, or total ability or amount learned, with perhaps specific pieces of knowledge along the way. They represent your position. Position where? On some path to total mastery. In the above graph, we have a lot of interpretations to work with. I'm going to present the Proper Interpretation of each editor, which is the interpretation I chose for this post, and then explain why vim's is wrong no matter how you look at it.

See Full Post and Comments

Apache's Common Log Format Datetime converted to Unix Timestamp with C++

The datetime in Apache's log format looks like this: day/month/year:hour:minute:second zone. It usually has wrapping brackets but I'm assuming those have been taken care of. The datetime format has a standard name but I don't remember it right now. An example would be "04/Apr/2012:10:37:29 -0500".

This is great for displaying to humans but annoying to pass around to computers, so let's convert it to a Unix timestamp that is simply the number of seconds since the Unix epoch, i.e. 1970-01-01 00:00:00 +0000. Notice that since the simple seconds timestamp has no time zone information, that information will be lost.

The code, released in public domain (I don't think one could assert copyright over this anyway):

See Full Post and Comments

Dumb patent of the month: Emotional Context

Okay, I'm not even sure if this is a real patent or not: http://www.patentauction.com/patent.php?nb=7385 It's a "Method of Adding Emotional Context to Electronic Messages". They want $10,000 for a license, but it comes with a free dotcom domain name!

The "patent number" referenced doesn't lead anywhere searching with Google or the US patent search, so who knows if this is real. It wouldn't surprise me. The site itself is probably a scam site, it looks pretty shady to me, but I have no idea. Anyway, let's just look at it and mock it. (I could have picked the Linked List patent or the Cat Chasing Laser patent if I wanted a real patent, but those have been mentioned before. I'll try harder next month if I remember. (Not that it's hard to find a bogus patent in any field that should never have been granted.))

This patent is nothing but an assertion of monopoly rights over how to style text to convey emotion. Luckily my use of italics there doesn't violate it, as we shall see.

See Full Post and Comments

So, PHP...

There was yet another wave of PHP-hate across the interwebs over the last couple weeks. It's truly fascinating that a language as decent as PHP can have hatred that rivals and sometimes exceeds the hatred for BASIC and even for some people COBOL. Since I haven't written anything in a while (lots of drafts), I figured I'd write about some of the things that I like about PHP.

First off however is what I don't like about PHP, since I can't say I'm gushing happiness with the language. I don't like the syntax (with the exception of sigils and double-quote-inlining) and their choice of OOP implementation that's an unholy mix of C++ and Java. After years of Python and a few decently sized projects in Clojure, coming back to PHP feels like just a nicer version of Java. (Of course, after years of programming Java, I don't particularly hate it either...) I don't like the function argument order ambiguity and inconsistency, a problem that is mitigated through memorization and "php.net/func-name" but would be best mitigated with specifying default arguments at call-time in a way similar to what Python allows, which makes remembering the order irrelevant. I also think PHP could be faster, given I think of it as "the C of the web" (which will probably generate some hate). I hate the choice of a backslash for namespaces. I hate the lack of $_PUT and $_PATCH and $_CUSTOM and so on. Sometimes I pine for a REPL. I wish it handled utf-8 better. I wish it supported multiple inheritance.

That about sums up my issues with modern (>= 5.3) PHP. God help you if you're still supporting PHP 4 code.

See Full Post and Comments

Wolf PAC is worse than useless

I watch The Young Turks since it's a reasonably entertaining way to stay informed about not-very-important-to-me topics so that I have things to smalltalk or argue about with the Commoners. Sure they're biased, but they're biased in only a slightly more way than we all are. They're nowhere near the Fox News style of conscious bias and conscious we-must-say-this-or-else style. They reflect the cultural bias of American upper-middle class society. I also get to select what I want to watch out of the subscription box based on title instead of hoping the next segment is decent, but I digress to a general statement that à la carte entertainment will always beat pre-programmed entertainment in a fair fight. (And even in an unfair fight Netflix is still kicking ass.)

So anyway, TYT sometimes pushes this group they created called Wolf PAC. Please go look at their home page so you get the full context, because I'm going to demolish it in pieces. It's cute, but also harmful. That's what it means to be worse than useless. It's harmful because it's going to fail miserably, destroy wealth (albeit a minimal amount), and crush the hopes and dreams of any supporters it gathers. It also would in all probability be harmful if it actually succeeded.

Our politicians are bought. Everyone knows it. Conservatives know it. Liberals know it. The Democrats are bought. The Republicans are bought. They don’t represent us. They represent their corporate donors who fund their campaigns and promise them well paying jobs after they leave office. We have taxation without representation. Our democracy is in serious trouble.

See Full Post and Comments

Weeder courses: yea or nay?

A lot of schools take pride in having "weeder" courses for various fields that, as the name implies, weed out those students unworthy to pursue the field. Some of the better schools however often have a second track for students who are interested but don't necessarily want to become professionals or professors in the field. But let's pretend we're looking at a program where no alternate track exists. Are weeder courses a good idea?

There are three big problems with weeder courses. The first is that reality is a graph, not a hierarchy. The common assumption underlying the argument in favor of weeder courses is that if those courses cannot be passed, nothing else will make sense. Weeder courses are only in base-level courses without which nothing further can be gained.

This assumption is false in general. Of course for localized special cases it holds: one needs to know addition before multiplication and multiplication before exponentiation and exponentiation before Knuth's up-arrows. But one does not need to deeply (or in some instances not even shallowly) understand the differential or the integral calculi before one can understand fuzzy logic, discrete probability, frequency, combinatorial game theory, number theory, or how to feed instructions to a computer. (How to feed instructions that calculate via differential equations on the other hand... But you don't need to be good at it; the Deep Blue programmers weren't better than Kasparov at Chess, they just needed to understand the basics of how Chess worked.)

See Full Post and Comments

Clojure and jMonkeyEngine Tutorial 2

Another simple translation to Clojure code. There are some repetitions that are popping up that we might want to abstract into functions or macros, but so far it's fairly pedestrian.

As a philosophical side note, defining a new function in Java takes effort. It's no wonder it's not done as much. You have to pick a class to put it in, you have to decide its class-scoping, you have to specify its argument and return types, any thrown exceptions, decide if it should be part of an interface somewhere... In practice, code changes. There's nothing wrong with type checking at compile time, but that's only useful when you're reasonably sure the code being checked isn't going to fundamentally change.

Anyway. Here's the code for tutorial 2:

See Full Post and Comments