Tuesday, August 30, 2005
Tau Zero
I just finished Tau Zero by Poul Anderson. Good stuff, read it if you get the chance. Reminded me somewhat of the Isaac Asimov short story The Last Question
If you're wondering who to blame...
19:20 -!- Netsplit zelazny.freenode.net <-> irc.freenode.net quits: caff-work, stefan, thoran, VeerZ
19:20 -!- Netsplit over, joins: thoran, stefan, caff-work
19:21 -!- Netsplit over, joins: VeerZ
19:22 -!- mrsolo [n=mrsolo@dsl092-025-194.sfo1.dsl.speakeasy.net] has quit ["Leaving"]
19:24 < rue> Is it just me or have we had a lot of splits?
19:25 < imperator> it's you
19:25 < rue> Hm
19:25 < imperator> it's ALWAYS you
19:25 < imperator> netsplits? rue
19:25 < imperator> syntax errors? rue
19:26 < imperator> world hunger, famine, war, disease - rue, rue, rue, RUE!
19:26 < dagbrown> Trolls?
19:26 < imperator> rue
-- #ruby-lang on freenode
When I first tried to post this via email, Blogger ate the newlines in the message, and since the log snippet is marked up with <pre> it made the log pretty useless. So I reported this problem to Blogger, and then did a cut 'n paste into the web interface, which is somewhat of a pain. I think it's rue's fault. :-)
Who knows what I want better than me?
A couple months ago, I ran into something I hadn’t seen before. I googled for something, clicked on a link, and found that my search term was hightlighted on the page. Obviously, people are getting clever and looking at the referer to see if it’s from a search engine and pulling out the search term.
Since then, I’ve seen it a couple more times. I don’t like it. If I’d wanted it hightlighted, I would. But it’s a minor thing, so I’m trying to put my finger on why I mind it so much. Maybe it’s a control thing: I don’t want some PHP monkey coder telling me that I’m obviously using a browser without adequate searching features, so he’ll just step in and “fix” it for me. Heck, as long as they think they know what we want better than we do, maybe they should look at the User-Agent and only give highlighting if it’s IE. :-)
Sunday, August 28, 2005
PHP Magic Quotes
PHP has a “feature” called Magic Quotes. Basically, if it’s on, all user data (GET, POST, cookies) is automatically escaped for use in a SQL query. This, in and of itself, is not too horrible, it just makes you have to explicitly un-escape instead of explicitly escape. I still think it’s a bad idea, because it’s designed to let you drop request variables directly into a SQL query without validation, which is still a bad idea, even if SQL injection isn’t possible.
But do you know what they did? They made it an option. That’s right. One PHP hosting service might have it on, and another might have it off, so you have to code for both cases. So you have to wrap getting request varibles into a helper function that checks for you at runtime and does whatever behavior you want.
This means that Magic Quotes actually makes it harder to do the right thing than if the feature didn’t exist! You have to go to extra work to make sure that your program works correctly in all cases.
On the other hand, if you don’t care about doing the Right Thing, PHP might just be for you.
Thursday, August 25, 2005
Regrets
I may not be the man I want to be;
I may not be the man I ought to be;
I may not be the man I could be;
I may not be the man I can be;
but praise God, I’m not the man I once was.
—Martin Luther King, Jr.
Wednesday, August 24, 2005
Python Challenge
A couple days ago I found the Python Challenge. It’s a series of riddles designed to be solved with the help of Python. It doesn’t actually have to be Python: Most other languages would work just as well. I’ve been using Ruby. But, as their FAQ explains, a couple puzzles use Python-dependent features. So you might have trouble if you haven’t use Python at all.
Sunday, August 21, 2005
Apple's four button mouse
This is old news, but Apple is selling a four button mouse, which this FoxTrot comic refers to. Why did Apple wait so long?
Wednesday, August 17, 2005
Google "language" tools
If you go to the Google Language Tools page, you’ll see some interesting “languages”, including Klingon, Bork, bork, bork!, Pig Latin, Elmer Fudd and Hacker (Unfortunately, Google does not appear to agree with the Jargon File definition, and this is just leet speak. Still hiliarious to view Google help pages, though.)
Monday, August 15, 2005
Fun tetris games
In the “interesting tetris clone” department, we’ve got bastet, a tetris clone that actually selects the worse possible piece for you on purpose. Pure evil to play. And then there’s 1D Tetris. Yeah, you read that right.
EDIT: Almost forgot. If you ever feel the need to play a good game of Tetris without loading up an entire OS, you can always play ktris, a tetris game written in 8086 assembler that can fit in the boot sector.
Funny slashdot comment
This comment was posted on a story about a documentary on the BBS era
Saturday, August 13, 2005
Quote of the day
A passage from Surely You’re Joking, Mr. Feynman!
There were a lot of fools at that conference – pompus fools – and pompous fools drive me up the wall. Ordinary foolks are all right; you can talk to them, and try to help them out. But pompus fools – guys who are fools and are covering it all over and impressing people as to how wonderful they are with all this hocus pocus – THAT, I CANNOT STAND! An ordinary fool isn’t a faker; an honest fool is all right. But a dishonest fool is terrible!
Thursday, August 11, 2005
Converting text to HTML anywhere
I posted eariler about how I’m using Textile to convert readable plain text to HTML. I’m using RedCloth, a Ruby library, but there’s also a Textile library for Python
Not extremely interesting in an of itself, (unless you like Python), but the author has posted a bookmarklet that allows you to select text in any textarea, and then click the bookmarklet to convert the selected text to HTML. It passes your text through a Python CGI running on his server, and you’ve got clean, easy HTML everywhere.
Wednesday, August 10, 2005
Infrequently Asked Questions in comp.lang.c
Sunday, August 07, 2005
Posting via email
Blogger has a nice feature where you can send email to a magic address, and then it automatically posts to your blog. I’ve set up some mutt aliases and send-hooks to filter mail to blogger.com through Red Cloth, which is a Ruby implementation of the Textile text-to-HTML language.
Now I don’t have to worry about matching tags, or making sure everything is properly escaped, and I’ll probably end up posting more often, which may or may not be a good thing.
Saturday, August 06, 2005
A Conundrum
Why can't I remember how to spell "mnemonic" without looking it up?
Assembly-like programming games
A few days ago, I found AT-Robots, an old DOS game I used to play on my parent's 25Mhz 486SX Packard Bell computer with 4 megs of RAM. The basic idea is you program robots in an assembly-like langauge, and then they fight in an arena. If that sounds boring, this program probably isn't for you, go find something else to read. Anyway, AT-Robots runs fine under dosemu, so I've been trying my hand at making some robots. I wish I had my old ones saved somewhere so I could see if I've gotten any better over the years.
Also of interest is corewars, another programming game using an assembly-like language. What makes corewars different is that instead of telling your robot how to navigate a virtual physical space, you battle over the memory ("core") of a virtual machine, trying to overwrite the other programs. Self-modifing code everywhere. It's really interesting, but much harder for me to wrap my brain around than AT-Robot's simple turn and shoot style of robots.
Friday, August 05, 2005
"Things My Girlfriend and I Have Argued About"
Wow, my third post today. Just like real bloggers, except without actual content and lower quality of writing. Oh, and since I'm using an off-the-shelf free blogging server, my blog doesn't look as nice, there's no (Ping|Track)backs, and there's a useless little "toolbar" at the top.
But other than that, just like real bloggers
Anyway, this is too funny not to post: Things My Girlfriend and I Have Argued About. Don't read while drinking something.
The future of the space shuttle
Windows isn't ready for the desktop
Here's another story about how Linux isn't for the desktop.
All the points he raises are, in my opinion, valid. The typical Linux distribution is not a great OS for the average user. But is Windows ready for the desktop? No, really? Of those "average users", for whom Windows is supposedly such a great platform, how many of them actually think that Windows is a great platform? When I talk to people who use computers because they have to, not because they want to, I've never heard anybody talk about how easy Windows is. I've never heard anybody talk about how everything is simple and clear, and nothing ever goes wrong, and life is good.
You know why? 'cause it's not. Computers are not easy to use. I don't care if you wrap it in a GUI, I don't care if you have a "desktop metaphor", I don't care if you've got tooltips, I don't care if you have a talking paper clip, computers are not easy to use. Period. We don't life in a perfect, happy world where people who's never used a computer before can sit down at a GUI and start clicking, draging and droping within minutes, his face aglow with magic of it all. Sorry, doesn't happen. Please stop telling me that Windows makes it easy for people with no training to use some of the most complex machines ever made. It doesn't, and pretending it does doesn't fix anything.
Of course, all this is just whining. If Windows, isn't good enough, what is? And if "nothing" isn't a good enough answer, then what do we do? I see people struggling to use their computers and I wish it were easier for them. I wish they could just do what they wanted simply and easily and not spend hours trying to fix something that they, and a fundamental level, don't care about. Of course, I'm selfish, so mostly I just wish they would stop having to call me with their problems. I don't know what a good user interface looks like. But I'm fairly convinced it isn't Windows, or anything else that I've seen.
Thursday, August 04, 2005
What Business Can Learn From Open Source
Paul Graham has posted a new essay. Quoting from the link:
When I say business can learn from open source, I don't mean any specific business can. I mean business can learn about new conditions the same way a gene pool does. I'm not claiming companies can get smarter, just that dumb ones will die.
Tuesday, August 02, 2005
PHP scope when require()'ing
I know I whined about PHP in my last post, but this behavior ticked me off enough to write once again about the language I love to hate.
if you require() or include() a file, it gets the scope of the caller. So if you have a file like so:
$foo = read_some_db_table();
foreach($foo as $name => $value) {
$libray_variable[$name] = $value;
}
# Define library functions and classes that use $library_variable
And the if you do a "require()" (or a "require_once()") when you have, say, a $name (or $foo or $value. And, of course, $library_variable, but presumably the risk is lower with prefixed names) variable, it gets clobbered by the required file. To avoid this, you have to stuff the init logic into a function:
function library_init() {
global $library_variable;
$foo = read_some_db_table();
foreach($foo as $name => $value) {
$libray_variable[$name] = $value;
}
}
library_init();
# Define library functions and classes that use $library_variable
Okay, maybe I should figure out a better than than using a global to avoid hitting the database more than once. But still, I don't see any good use for having required files use the same scope. It binds you too tightly to the code you're loading: Variables you defined could effect it, and variables it defines could effect you. It's not an abstraction if you have to know implementation details to use it safely.
Once again, the behavior is well documented, but this doesn't seem like a good excuse to me. "Didn't you read the signs? The dragon eats someone every week!"