Archive for July, 2006

31
Jul
06

Xenoestrogenoia

This is mildly terrifying.

A quick aside about Nalgene bottles: I bought a one-litre branded Nalgene-alike from my university bookstore for what I thought was the exorbitant price of $8.95. Turns out, that was the best nine bucks I ever spent (well, except perhaps for that four-pack of Flying Dog Imperial Porter, but I digress). What that green plastic bottle does is make it trivially easy for me to drink water — lots of water. I’ve probably doubled my water consumption (which has never been particularly low) since buying that thing. I’ve also stopped buying soft drinks just because I need something to wash down a meal, which I imagine has done wonderful things for my blood sugar levels.

I don’t, however, boil water in that bottle.

30
Jul
06

A quick rant about drinking ages

Okay, hang on just a fucking minute.

I notice that Pilsner Urquell’s website doesn’t particularly solicit traffic from what some of us laughingly call “minors”.

Heh heh heh.

Yeah, like the — what, dozen or so? — “underage” teenagers who want to browse around their purported website (I can’t actually verify that they have a website: apparently, I have an insufficiently 31337 Flash plugin) aren’t clever enough to falsify their birthdates. And yeah, I’m really quite confident that drinking age restrictions have reduced the rate of underage drinking. (If you believe that, please by God send me money. You’re gullible and I’m a starving student.)

Come the fuck on. Everyone who wants to drink will drink. If so-called “underage” drinkers want some boozeahol, they’ll get it. Within five or six years, they’ll (probably) grow out of it, and their livers will probably still be intact.

I’m disgusted by the fact that we (I’m speaking as an American now) let eighteen-year-old men and women fight, kill, and die for our country, but refuse them a fucking beer. I dunno, you tell me: what takes more maturity? Centering a post inside a notch, pressing a trigger, and killing another human being, or taking a sip of dilute ethanol?

I fucking wonder.

I have nothing but respect for those who serve, and nothing but contempt for those who insist on treating them as irresponsible children. “Support our troops”, indeed.

30
Jul
06

Beers of Vancouver, vol. 2

Well, not really: I mean “beers of the Czech Republic, available in Vancouver”.  Anyway.

So I can get 500mL bottles of Czechvar for $2.30 and 500mL cans of Pilsner Urquell for $2.40.  I’m having more than a little bit of difficulty figuring out why I’d want to buy anything else when I can get awesome Euro-lagers for far less than the cost of a six-pack of anything else that doesn’t suck.

Can someone tell me why the Czech fucking Republic can import export its awesome beer to us from across the Atlantic fucking Ocean at delightfully low prices, but I can’t get Flying Dog here to save my life?  (That bit’s no longer true.)

Oh wait, no, never mind.

I don’t care.

See, I’m too happy drinking Pilsner Urquell that’s cheaper than Kokanee Gold to give a shit!

Never mind, as you were.

29
Jul
06

…a slight non-Euclidean curvature

This is brilliant.

In other news, I’ve been thinking about curvature lately. Remember a few weeks ago, when I wrote about multiresolution meshes? I mentioned that level-of-detail (LOD) people are trying to cover the screen in pixel-sized triangles, and that I don’t think video cards are really powerful enough to do that at satisfying resolutions (say, 1920×1200) and seamless frame rates (60 Hz).

Even if they are, so what? If you can save a few thousand triangles per frame without creating a new bottleneck, I can put those triangles to good use.

That said, the idea of drawing pixel-sized (give or take) triangles is pretty elegant in terms of sampling: you’re basically sampling at the pixel-level anyway (well, if you’ve turned on hardware antialiasing, you’re sampling at two, four, eight, or whatever times the pixel resolution, then averaging; still, at some point you’re taking point samples on a regular rectangular grid, which is the point I’m trying to make). Drawing pixel-sized tris is about as good as you can get.

A few interesting things fall out of this:

  1. You can’t faithfully sample geometry with a higher frequency than your frame buffer’s Nyquist limit. Really — I’ve tried it. (I drew a heightfield terrain model with subpixel-sized tris.) You get sparkles in the undersampled geometry as different triangles on the same pixel “win” the Z-buffer test.So drawing geometry at full resolution all the time is actually a bad idea, even if you have sufficiently powerful enough hardware to do so.The “frequency” of your geometry, unfortunately, isn’t constant. It changes as the model gets further away from the viewpoint, covering fewer pixels.
  2. When you draw (read: “sample”) a mesh, you’re actually sampling it twice: first when you figure out which triangles to draw, and again when you rasterize those triangles into pixels. The relationship between these two sampling steps is what makes multiresolution rendering interesting.
  3. Parts of the model with low-frequency information don’t need to be sampled at the same rate as high-frequency parts — if you have a good way to reconstruct the low-frequency information. The problem is, for the most part we don’t have a particularly efficient way to reconstruct the low-frequency mesh. All we have are triangles — which are inconveniently flat.Suppose you have a model of a sphere. There’s not a hell of a lot of information involved there — just a centre and a radius, basically. Low-frequency. On the other hand, to render that sphere — with triangles — at a reasonable level of fidelity (to the point where it actually looks like a sphere, rather than a faceted approximation), you need to sample it fairly densely.
  4. In some parts of the science-and-engineering world, you run into the idea of importance sampling. It’s pretty intuitive: sample more where the signal is more interesting. Well, we can’t do much about the distribution of samples on the monitor, but we can do quite a bit about the distribution of triangles on the mesh.

All of these factors suggest that multiresolution rendering is a pretty cool problem.

So where does curvature come in? Curvature — in particular, negative curvature — is an important perceptual clue for humans (and humans are the ones buying video games and reviewing grant proposals), along with a few other things like silhouette and shadow. Well, I have a few tricks for dealing with silhouette, and shadow is essentially silhouette — from the point of view of the light source. Now I want to do something about curvature.

28
Jul
06

Thoughts on excellence

To begin with, read this article by Dan John:

(No, really; read it.)

You didn’t read it, did you? Okay, here’s what I got out of the article:

  1. Compared to the world’s best, most of us suck
  2. The road from suck to well, pretty good, I mean okay, I guess is long and hard
  3. It’s worth much more to progress than to wallow in mediocrity, even if you never get to “pretty good”
  4. Excellence is what you think you should be doing with all the bullshit stripped away

Well, isn’t that just lovely. Blows sunshine right up my ass — what about you? What does this have to do with anything I care about?

Let’s move on to our second article:

(Read the comments, too.)

So:

Science students get worse grades than non-science students.

[...]

Paul Romer, an economics professor at the Graduate School of Business at Stanford University, who has studied the issue, wrote in an article for Stanford Business that “the grades assigned in science courses are systematically lower than grades in other disciplines, and students rely heavily on grades as signals about the fields for which they are best suited.” Thus, he concluded, students usher themselves out of the science track.

Gee, why are science grades lower? Surely it must be some sort of unhealthy cultural thing:

Several experts suggested that the culture of scientists has kept science grades down, while science students at many institutions have watched longingly as humanities grades have drifted up and away like a helium balloon.

“There’s a difficult culture here,” said Daryl Chubin, director of the American Association for the Advancement of Sciences’ Center for Advancing Science & Engineering Capacity. “The culture of science says, ‘not everybody is good enough to cut it, and we’re going to make it hard for them, and the cream will rise to the top.’ ”

You’re goddamn right. And you know what? It needs to be that way. 200-level courses in science and engineering aren’t called “filter courses” because we get our rocks off on failing hapless undergrads, 200-level science and engineering courses are “filter courses” because they are fundamental prerequisites for what happens next.

If you fail “Software Engineering I”, you will also fail “Software Engineering II”, “Operating Systems”, “Compiler Design”, “User Interface Design”, and just about everything else that depends on SE-I. You cannot write a compiler if you don’t know how to write a program. Science and engineering depend strictly and rigorously on what has come before — you can’t just drop into a computability class without a background in algorithms and realistically expect to catch up as you go along unless you’re extraordinarily clever. In different words:

Math and science are taught “vertically,” meaning students are often made to slog through two years of large, formulaic introductory courses that teach fundamentals before they get any taste of the hands-on work that makes a career in science attractive to most scientists.

Students are “made to slog through two years of large, formulaic introductory courses that teach fundamentals” because those fundamentals are, in fact, fundamental! Drop someone into an a differential topology course before teaching them what an integral means and they won’t have a fucking clue what’s going on.

People drop out of science and engineering programmes because science and engineering are hard, and they take a lot of work before you get beyond suck to pretty good, I guess. But once you get there, you can do some pretty cool things, and if you’re willing to put in the time and effort to get from pretty good to excellent, well, that’s why they give people Fields medals and Turing awards (and, oh yeah, those Nobel things in Sweden).

See the connection between these articles?

27
Jul
06

Why I hate Toronto

The Toronto Star asks:

Well, I can’t speak for the rest of the rest of the country, but I’ll do my best:

I’ve only spent time in Toronto’s airport, Pearson International, and everyone who works there has a stick up his or her ass with a stick up its ass. Douglas R. Hofstadter could write a clever little story about Achilles and the tortoise and someone from Toronto with a stick (with a stick (with a stick (with a stick (…) up its ass) up its ass) up its ass) up its ass up his ass, and no-one would suspect it was fiction. From the INS officer who grilled me for fifteen minutes about going to grad school in BC when there are plenty of perfectly good colleges in the States to the bartender who refused to serve me because my passport might have been faked, all the people I’ve dealt with at Pearson take themselves way too seriously.

My opinions on Calgary can be derived from the fact that I grew up in Edmonton.

26
Jul
06

Get something cool ASAP

Most of the code I write, for my research or just for fun, isn’t writen to a hard deadline. Consequently, it’s too damn easy to ignore it and write blog entries, read other people’s blogs, go for a beer: in general, without a looming deadline it’s too easy to procrastinate.

I’ve read a fair bit about “agile processes” — eXtreme Programming and so forth — and like what I’ve read. Index cards, refactoring, test-driven development. It’s all good, but it doesn’t address the procrastination issue.

I’ve also read some sorta-conflicting advice from such people as Steve McConnell and Joel Spolsky — lightweight schedules, functional specs, and so forth — and also like what I’ve read. It’s good stuff, but it still doesn’t address procrastination.

I’ve written programs that work. I’ve also started projects that never got past the design document, or the first header file, or what have you. What’s the difference between the two? Why do some of my projects take off, and others fall flat?

The ones that get going do interesting things right away.

For example, in my copious spare time I’ve found myself writing a hex map library in SDL and OpenGL. I started by opening a text editor and writing:

libhex design

0. Introduction
Libhex is a hexmap library, written in C. It uses SDL and OpenGL to draw the hexmap.

Then I got bored writing design documents and wrote a program that opened an SDL window. It took me all of about thirty seconds, and already I had something running. FIve minutes later, I could draw a white hexagon outline on a black background.

Hey, neat: a hex!

From there it’s just a matter of saying “glBegin(GL_TRIANGLE_FAN)” instead of “glBegin(GL_LINE_LOOP)” and adding a couple more vertices and I have a filled hex. Half a dozen small and easy changes later, my program can load a hexmap from a text file and draw it. This took me about three hours.

If you’re up on your Agile Methods theology, you’ll recognize this process as something of a cross between a Vertical Slice (get a small end-to-end working solution ASAP) and Test-Driven Development (make a small change, make sure it works, refactor, repeat). Okay, I’m not actually writing formal unit tests — perhaps I should be, but that’s a rant for another time. The thought process is the same: “It’d be really cool if my code did <foo>. It doesn’t. Let’s make it do <foo> — oh wait, that’s too complicated. Let’s make it do <bar>, which is a good first step. <code, code, code> Hey, that was easy. Run it — look, it does <bar>; outstanding. Now it’s just a matter of adding <baz> — that shouldn’t be too hard.” And so it goes.

There’s one catch: refactoring is vital to the process. If you start with a program that does one thing well enough to give you a shot of satisfaction and keep glomming features on top of it, you’ll end up with a big ball of bullshit. Adding more and more features will take longer and longer and cost you more and more pain, and eventually you’ll give up. The whole point of this method is that you stay motivated — every time you do something, you end up with either a program that does something new or a codebase that looks prettier. Let the refactoring slide and you end up with a codebase that looks awful and a program to which you can’t add features without excruciating pain.

So this is all cool when you have a long list of small features to add, but what do you do when you run out of easy little features? Daydream. Think of features you’d love to end up with until you hit something that fires you up — remember, the primary goal here is motivation to keep hacking. Motivation is mother, motivation is father. Once you get something that’s cool enough to get you motivated — but not intimidatingly complex — start picking at it until you’ve decomposed it into a good long list of easy little features. Then fire up Vim and start hacking.

Another caveat: I’ve never tried this approach as part of a team, and I’m not sure I want to. The goal isn’t to keep a team working productively, it’s to keep a programmer motivated enough to get stuff done.

25
Jul
06

No-shit news flash: whole grains are good for you

Low GI foods help burn fat, improve heart disease risk: study

No kidding. From the article:

The theory is that highly processed, rapidly digested carbohydrates that are high on the glycemic index such as mashed potatoes or cookies cause fluctuations in blood sugar and insulin levels that contribute to hunger and prevent the breakdown of fat.

Yeah, that’s a theory in the same way that Newtonian physics is a theory. Maybe it breaks down at absurdly high velocities or extremely small scales, but for most of us it works consistently and well.

The bit I just don’t get from this article is the “whole grains vs. high protein” conflict the study’s authors somehow manufactured. What, if I eat a lot of meat I’m prohibited from loading up on broccoli and brown rice? How’s that work again?

“I’m sorry sir, I can’t let you buy that inside round oven roast in combination with apples, carrots, and broccoli. It’s one or the other. Don’t make me call the food police, sir.”

Right. And don’t get me started on the idea of “reduced-fat” diets for fat loss (or anything else, either).

The moral of this story is that depending on CBC News for nutritional advice is a terrible idea. Getting advice from, say, half a dozen qualified sources is a great idea. Let’s give this a shot:

  1. John Berardi
  2. Testosterone Nation
  3. Clarence Bass
  4. Dave Draper
  5. Marty Gallagher
  6. Alwyn Cosgrove

These sources tend to disagree with each other, and I don’t necessarily agree with everything they say. Life sucks, get a helmet. That’s what critical thinking skills are for.




anarchocapitalist agitprop

Be advised

I say fuck a lot
Grammar Nazi

Categories

Archives

Statistics FTW