Old news

Old news

2003-10-27:

I'm going to have to be more diligent about my updates; apparently I have a readership! The other day I listed off to someone in IM 50 reasons why Python rules, so I think I'm going to start posting a few here every day or two. Maybe when I get done with that I'll find some things to gripe about.

Also, I've improved the polyglot quine on my brainf$*&! page; now with 16.7% more glot.

OK, here's the first few Python things. I'll do some obvious things first:

Clear and uncluttered syntax:

I actually used to like crap-loads of curly braces, smatterings of semi-colons and piles of parentheses. What the fuck was I thinking? Python code is wonderfully self documenting and clear. Sure, you can write beautifully obfuscated Python, and it is possible to write clean, maintainable code in almost any other language. However, the obvious, natural and easy way to write Python happens to be a very readable version.

Almost any time you compare Python code side by side with the equivalent code in another language, the Python version is simpler, shorter, more readable and easier to type. My hands are happy.

Robust standard library:

I hate solving problems over and over again. Writing some reusable code to do it works sometimes, and sometimes you find someone else's library that does an approximation of what you want. In either case, it's usually annoying to maintain and not always portable. Interfaces aren't standardized, or aren't quite flexible enough. Quality is uneven.

If a piece of functionality is part of the language or standard library, it's usually much nicer and much more consistent. I can use the library without having to worry that it might not be available everywhere. Python has the most pleasant standard library of any language I've tried, not to mention all the problems solved by core language features. Never again will I write a command line parser or .csv parser or word wrapper.

No boilerplate:

In a language like Java or C++, you have to write a whole bunch of crap like prototypes, class declarations, header files, templates, type declarations, etc. None of that stuff actually does anything except serve to make the dumb compiler happy. Doing things "the right way" is discouraged because it requires so much extra work. In Python, you don't have to waste your time with that crap. You can just write the damn code. The result is more readable, more flexible and more maintainable. You're encouraged to write nice reusable code because it's easy. Static typing advocates can bite me.

Nice exception model:

It is now widely held that checked exceptions were a mistake in Java. Bruce Eckel sums it up nicely. They're used too much, and the "annoying" factor causes programmers to abuse them or swallow them or avoid them. You can't easily put your error checking where it's going to be most readable. In Python, exceptions are easy and fun. It is trivial to make your own custom exceptions and you have a choice if you want to handle them or let them propagate. They're so nice it's actually pleasant to use them correctly. It's very hard to go back to returning stupid error codes when stuck in a language like C, or worse, a mixture of return codes and exceptions as in C++.

2003-10-16:

Over the past few days, I've made some additions to my brain$*&! page; mostly stuff in other languages such as Path. There's even a little Perl, Python and C (all at once, actually).

2003-10-09:

I've uploaded chunky-0.8.0 (beta).

2003-10-07:

I've known about James Bamford's binaural recordings for a while, but he just uploaded a new one, and I think it's about time I plug it here. If you have a pair of headphones, you'll be absolutely amazed. If not, well, go get a pair.

Also, about a week ago, I added a new page for my little OSS project chunky. It's for parsing result files from ABC/hr listening tests, so it's of pretty narrow interest, but there might be some interesting stuff in there for other purposes, or for someone learning Python. I'm fairly new at it myself, and I think my style (in Python at least) is a bit strange. It also contains the code snippet from my last post, though it's gradually become less absurd.

2003-10-01:

I ended up refactoring the function that contained yesterday's code, but a somewhat more readable and less redundant variant of the snippet remains. I'm not sure that there is one clear way to indent it. Here is an example of one unclear way:

fmts = map(lambda sample: "%%s$%d" % (ends[sample.sample_num]+1), result)
for xfunc, lfunc in ('AVERAGE', 'AVERAGE'), ('STDEV', 'STD. DEVIATION'):
    rats, ranks = map(lambda off: map(lambda col: "=%s(%s)" % \
        (xfunc, string.join(map(lambda fmt: fmt % col, fmts), ";")),
        cols[off:numcodecs+off+2]), (2, numcodecs+5))
    rows.append(makeRow(rats, ranks, lfunc))

2003-09-30:

I wrote the following python code today, which I think means I'm suddenly a functional programming junkie, or I'm insane. Actual functional programming junkies may take offense because this probably isn't sensible code, but I stand behind my "I'm insane" assertion. I may clean it up some to make it more readable and obviously remove the duplicate stuff, but it worked on the first try, which I like because I don't remember putting any correct code in there.

fmts = map(lambda sample: "%%s$%d" % (ends[sample.sample_num]+1), result)
for xfunc in ('AVERAGE', 'STDEV'):
    rows.append(makeRow(codecs,
        map(lambda col: "=%s(%s)" % \
                (xfunc, string.join(map(lambda fmt: fmt % col, fmts), ";")),
            cols[2:numcodecs+2]),
        map(lambda col: "=%s(%s)" % \
                (xfunc, string.join(map(lambda fmt: fmt % col, fmts), ";")),
            cols[numcodecs+3:numcodecs*2+3]),
        xfunc ))

I find myself using things like map() and filter() a lot, which is no surprise because I used map and grep a lot in Perl. However, I'm doing much more in the way of creating local functions, passing functions as parameters, returning functions, etc. I'm finding lots of reasons to make things like lambda (or function) generating functions.

2003-09-22:

The results are in for Roberto Amorim's 64kbps listening test. Check them out here. There's discussion going on on Hydrogen Audio in this thread. I've posted a summary of the results in a spreadsheet in my audio section.

I've decided that "over the years" is one of those phrases that is over-used and should be retired. I think most people would use fewer cliché phrases if they actually took the time to think out what they say and what it means. For example, the grossly over-used phrase "for all intents and purposes" means exactly what is says, not what everyone uses it for. The same goes for all kinds of incorrect word usage. Another is "99%" or "99.9%" or "99.999999%". Those are usually used when the actual number is "95%" or "90%" or "80%" or even "10%". Please be sure your percentage guesstimates actually make some sort of sense.

The only thing worse than using a cliché is using one incorrectly. It's DEFINITELY NOT "all intensive purposes." That doesn't make any damn sense. Also, I don't think anyone who uses the phrase "undisputed" has any idea what the word means. It's most commonly used by boxers, who make a living being hit in the head repeatedly by other large, well muscled people. What's your excuse? Usually things that gets labeled "undisputed" are, in fact, quite widely disputed.

While I'm on a rant, I might as well get on my pet peeve about adverbs. Use them! Or at least, don't use adjectives where an adverb is called for. Don't neglect the 'ly'. You want "well" not "good", "badly" instead of "bad" or "quickly" instead of "fast". I know, it's better to come up with a more descriptive verb, but if you've got to modify a verb, do it properly. See how I used "properly" and not "proper" or "right"? Its such a pervasive problem in language today I am constantly correcting MYSELF.

I've only got one more. I promise. Please use "fewer" and "less" correctly. I ate fewer apples than John but he ate less applesauce than Joe.

I'll let Bob handle the apostrophe issue.

2003-09-05:

I've posted some of my brainfuck code and related scripts.

2003-09-03:

Check out how crazy I'm not.

bug #94035------- Additional Comments From ... 2003-09-03 05:05 -------
Please consider raising the priority of this bug:
Motivation: macromedia flash
* Websites have through flash potential access to a camera and/or microphone
available on your computer,
* Websites can store information (default <= 100 kilobytes) through flash on
your computer. Thus websites can avoid security restrictions on cookies by
simply using flash...

Please take a look at:
http://www.macromedia.com/support/flashplayer/help/settings/

2003-08-28:

I've decided that the amount I despise a programming language is directly proportional to the amount of boilerplate that is required to get what you want working. C++ and Java, for example, have obscene amounts. Perl has a less. Python has virtually none.

Speaking of things that have lots of boilerplate, how about today's standards for HTML? I'm transitioning to a new, less ugly layout, so bear with me during the, um, transition.

2003-08-27:

I'm sick of hearing the phrase "[verb] like a rock star." It was bad enough when it was just "party like a rock star." Now we have to endure people doing EVERYTHING like a rock star. If you really want to party like a rock star, just knock up a groupie, go on a coke bender and crash your Lamborghini into a utility pole.

2003-08-26:

A new comic was posted at Bob the Angry Flower, which, being a SCII reference, I felt the need to post it here. Also, take a look at the previous Star Control II reference.

segway...

What's the friggin' deal with the ten commandments crap? I mean, I think there are bigger problems in the world out there (such as bills proposing that intelligent design be taught in public schools), but I don't see how it's anything OTHER than government endorsement of religion. Heck, its an endorsement of a particular interpretation of a particular branch of Christianity. There's more than one set of ten commandments.

Now, if it was a sculpture depicting the ten commandments in the context of law-making throughout history (i.e. also featuring figures such as Hammurabi), I wouldn't have a problem with it. It would also be fine if any religion (or non-religion) had the same opportunity to place their particular set of rules there. I don't think there's any ambiguity in the constitution on this issue.

Further, the claim that all the "founding fathers" were Christians, or that this country was founded on "Christian principles" is revisionist history. I'm being too kind. It's a big fat lie. Most (or all) were deists. Here are some choice quotes:

"I have examined all the known superstitions of the world, and I do not find in our particular superstition of Christianity one redeeming feature. They are all alike founded on fables and mythology." -- Thomas Jefferson

"The Government of the United States is not in any sense founded on the Christian religion." -- Excerpt from the Treaty of Tripoli, which was passed by unanimous vote by the US Senate in 1797

This site has some more.

Contrary to some bigoted beliefs, it is quite possible to live a good and moral life without belonging to any Judeo-Christian religion. Forming laws does not require the instruction of a superior being. We have minds of our own in spite of how some make it appear!

2003-08-25:

OK, there's this whole tabs vs. spaces holy war that has gone on since the beginning of time, and I've decided to finally discuss it. I know I'm talking to myself, which is nice when discussing this sort of thing.

To be honest, I don't have strong feelings about the subject. If you want to use tabs or spaces, that's fine with me. I'm actually on the fence about it myself, and go back and forth in which one I use. I've found the following to be critical though:

  1. Tab-stops of 8 suck. Completely unacceptable. 4 is plenty, even fewer is better sometimes. Does anybody like tab-stops of 8? OK, apparently Linus does, but I'm convinced that's caused by a tumor.
  2. Tabs should only be used for indentation. Using them for other things is bad. It will cause problems.
  3. Really, they should only be used for indentation. I ain't fuckin' around here. Don't use them elsewhere.
  4. You MUST be consistent. If you switch back and forth you're gonna break something. If somebody has their tabstop set differently, it's gonna go all to hell.

That last rule is a big deal in Python. I am tending to like syntactic white-space for indentation, but Python interprets tabs as 8 spaces. If you mix tabs and spaces and have your tabstop set at something other than 8, you will break things like crazy. This makes tabs dangerous to use in Python. I use tabs in Python because I use list mode in vim, which makes tabs visible, which looks really snazzy in Python. The solution is to use -tt in your Python files. At least -t. I'm going to use it every time. It would also be nice to have some pragma that told python what your tab-stops were.

Some people use an indent style that's a mix of tabs and spaces. I.e. the first indent level is 4 spaces. The next is a tab. After that is a tab plus 4 spaces. What is the point of that? Making the file smaller? Pick one or the other for goodness sake. The mix thing is just fucking crazy and makes it hell for others to edit later if they don't use the exact same setting.

To be quite honest, though I like using tabs sometimes, the world would be a much simpler place if they'd never been invented. Or better, if 8 spaces never became the standard interpretation (i.e. no interpretation unless a tabstop has been set). It ought to be part of people's terminal settings or something and they're interpreted the same way in everything. That way people would only rely on them for indentation because they wouldn't work reliably elsewhere (which is the way it is now, though people DO use them elsewhere).

2003-08-20:

I had my ICQ number stolen a while back (it was a low number), and haven't gotten around to getting a new IM identity. That is, until today. I'm now phong@mtu.net (jabber). Yay.

Add the following to your user.js file to enable Javascript only for specific sites in Mozilla.

user_pref("capability.policy.policynames", "jsok");
user_pref("capability.policy.default.javascript.enabled", "noAccess");
user_pref("capability.policy.jsok.sites", "http://www.safe1.com http://www...");
user_pref("capability.policy.jsok.javascript.enabled", "allAccess");

RANT: Mozilla's security controls still suck after all this time. Let me make a table:

Issue Privacy/Security risk Annoyance factor Available Mozilla Controls
Images very low low to medium Excellent: Easily controlled via right-click.
Animated Images low low to medium-high Good: Can set to loop just once or not at all via preferences dialog. Would be nice to be able to "restart" an animation when loop once is set or animation is disabled. It would also be nice to be able to easily configure the maximum animation speed (or minimum delay between frames), but the current default is pretty good.
Cookies medium medium Good: Can be set to on, off or ask with a "always do the same thing for this site" check-box. I would prefer a "off" with a "allow" list with wild-cards I can add to easily, but the current scheme is pretty good if a bit annoying.
Javascript medium-high medium to very high Marginal: Can be set to on or off. Inexplicably, no per-site controls (Konqueror does this fine) via any config box. It's only possible by editing a poorly documented .js file, and requires restarting the browser. Even IE lets you control this on a per-zone basis.
Java medium-high high to very high Poor: Can be set to on or off. AFAIK cannot be controlled on a per-site basis at all.
Plug-ins very high Satan Abomination: All you can do is query the list of installed plug-ins with about:plugins. Cannot be turned off except by manually deleting the corresponding dll/library. You'll be asked to install them again the next time you run into them. No per-site controls. No way to disable the "would you like to install this stupid plug-in" box without deleting the plug-in installer plug-in. There is nothing to prevent programs on your computer from installing plug-ins behind your back.

Notice how the privacy/security risk and annoyance factors are inversely proportional to the available controls in Mozilla. Even though plug-ins are very annoying, and are a serious security threat, controls for plug-ins are completely non-existent. On the other hand, the controls over images are great. If you see an annoying banner ad, boom - it's gone. Somebody put some quality thought into how to do that, and came up with a powerful, intuitive, slick solution. But unwanted images are usually just an annoyance. Why the hell don't people seem to care as much about the more serious issues?

Edit: I knew I wasn't crazy. Here's a bugzilla entry about it. This is obviously a wanted feature.

There are some extras and plug-ins you can get that alleviate these partially, but these are things that should be part of the browser proper and they're incomplete solutions. For example, there is a plug-in that blocks Flash until you click to allow a particular flash element through. It's a damn site better than no control, but it's annoying and only controls flash. It would be nice to have a unified control for all plug-ins so you can turn them on just on the sites you want, and not have to worry about it ever again.

There are "quick-prefs" menus that let you turn things on and off more easily, but that's really only a workaround for things that should have per-site controls but don't. Also, there are tools to make editing the all the hidden settings easier. They're a big improvement over the edit file, restart browser dance, but they're incomplete and only help for those things that can be configured via the .js files. Some things just have little or no configurability at all. It's strange mostly because so much of Mozilla can be configured to your heart's desire (the interface and chrome stuff for example).

Older stuff:

I've added some stuff on my OpenGL experiments. Check it out - *ENJOY THE CODE*, as our Orz friends might say.

This guy is funny as hell. His review of Signs is SPOT ON.

Quite some time ago, I realized that I can't stand the Beatles. In fact, I realized (to no great surprise) that they suck. The worst part is hearing a bunch of new miserable recordings and tributes every time one of them dies. I'm not alone:
Help! The Beatles Suck. - The hate mail is hilarious.
Beatle Haters International
The Beatles Poured Evil Into the Earth - For the sake of your nose, don't drink milk while reading this one.

I can never remember the magic words for a meta refresh so I'm putting them here. Replace [delay] with a number of seconds to delay before the refresh, and replace [url] with the target URL (relative or absolute).

<META HTTP-EQUIV="Refresh" CONTENT="[delay];url=[url]">

Here's my current JAPH. I know it's not very obfuscated. I've only spent a couple minutes on it.

#!/usr/bin/perl
sub _{@_=map{ord}split'',"Js nte elhce.\nrka rPrhoatu";$;=_;for(0..$#_){(
$!,@_)=(@_[0..$_],@_[$_+1..$#_]);$;=($!|$;)&(~$!|~$;);$_[@_]=$;;}$;=F;for((
$/)x@_){($!,@_)=@_;$_[@_]=chr($!^$;);$;=$!;}print $_,pop while($_=shift);}_

I've collected a few quotes I find interesting. They aren't sorted in any way, or organized to demonstrate any views of mine (though the quotes, being of my choosing certainly must reflect on me somehow). Read them here.

I now have an OpenPGP public key.