Geek notes

Dec 07, 2004 23:30

My apologies to the vast majority out there who don't care about any of this....

1. PHP is annoying
I've been programming in Perl for most of the past decade, and my experience there has generally been that the more of the language I learn, the more I like it. I've been programming in PHP for three or four months, and my experience has generally been that the more of that language I learn, the less I like it.

PHP has a memory_limit setting to keep any given script from monopolizing the machine's memory. It also has a convenient readfile() function for printing the entire contents of a file. It turns out that readfile() sucks the entire file into memory, then prints it out, no matter how big it is. Thus, if the file is bigger than the memory_limit setting, the script fails due to trying to use too much memory.

The intelligent thing for readfile() to do, of course, would be to read a chunk of the file, print that chunk, and keep going until the end of the file -- never using more memory than the chunk size. So I wrote a small function to do that in 1MB chunks. But why doesn't readfile() do this anyway?

2. Soekris + m0n0wall = nice small firewall
At work I needed a highly customizable NAT router/firewall to connect two separate office network segments to DSL, with separate IP addresses. The DSL router itself couldn't deal with more than one internal segment and one external address. So I put that into bridge mode, and behind it I stuck a little three-port Soekris Net4501 box. Inside that box is a CompactFlash card with m0n0wall software: a miniaturized FreeBSD with IPFilter packet-filtering software, and an administration interface using thttpd and lots of PHP (OK, it's not all bad) using and controlling an XML-based configuration file. It has all sorts of handy little features that the cheap "broadband routers" miss.

It's quite powerful and flexible, and has no moving parts. The $200 hardware cost is more than a hacked Linksys WRT54G or used 486, but much less than any new PC. Two thumbs up.

3. Geek Showdown: Debian vs Cartoon Nudity
I'm not sure what to think about the latest controversy to hit the Debian GNU/Linux project....

One of the classic Unix/Linux desktop utilities is a program to indicate how hard the computer is working. In the past this sort of program has ranged from a simple graph to a lava-lamp simulation. Now someone has come up with the bright idea of a program that displays a cartoon woman with less clothing the harder the computer is working. This seems like the epitome of a geekboy program -- positive points for cleverness, negative points for taste. (The fact that the five standard images (not exactly work safe, and I suggest starting at the bottom) can be replaced with your own does open up possibilities, however.)

Then someone proposed including this program in Debian. Debian is a global community-driven project, which strives to distribute software that meets its standards for freedom. But things get tricky when some of that software might be partially or entirely illegal in some jurisdictions; in this case, the program could be illegal to give to a minor in parts of the U.S., not to mention totally illegal in some places. The Debian debate went from there to asking whether a document on anarchism or even the Bible are appropriate to include in Debian, since they could both be illegal in some parts of the world. And even ignoring legalities there is the debate between those who have different priorities for what should be considered verboten and what should be considered no big deal: the nudity, the politics, or the religion.

perl, debian, programming, software, work, firewall, legal, security, php, rights

Previous post Next post
Up