rc3.org

Strong opinions, weakly held

Month: September 2007 (page 3 of 4)

Two views of regular expressions

Here’s the famous jwz‘s much-quoted take on regular expressions:

Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.

Here’s Steve Yegge on regular expressions:

Regexps are obviously quite useful. If you aren’t extremely proficient with regular expressions right now, then you should drop everything and go become proficient with them. I bet I use regular expressions on 350 days out of every year: in my editor, on the command-line, in my code — anywhere that using one would save me time or make my code clearer. Oh, how it hurts to think about all the so-called “programmers” out there who don’t know how to use regexps. Argh. Let’s just drop it.

Less pithy, more correct. (He makes the same recommendation regarding XPath, and he’s correct there as well.)

And yeah, I know that article is old but someone just pointed me at it and it’s interesting and true.

I am not a systems administrator

The other day I was going to write this cool post about how I’m trying to speed up the performance of Movable Type using FastCGI for the Perl bits and eAccelerator for the PHP bits. The nice thing about FreeBSD is that both packages were really, really easy to install. I can’t tell how much faster they’ve made things, but they seem to have improved the performance situation at least a little bit. (I think that part of my problem may be that the blog has over 7900 entries, and that just makes things a bit slow.)

Anyway, today I started getting email from Postfix about it rejecting incoming mail because I was out of drive space. So I logged into the server and found that the var partition was indeed 99% full. At first I thought it was because my port installs weren’t cleaning up after themselves, but I quickly discovered that the culprit was a 1.1 gigabyte Apache error log file. It turns out that when I installed eAccelerator I didn’t configure it properly, so it was running in debug mode, which meant that every time anyone accessed a PHP page on the site, eAccelerator added a line to the error log. Soon thereafter, full partition.

I’m beginning to feel like every time I touch anything, I have planted the seeds for a future outage.

The more systems administration tasks I perform, the more I understand why systems administrators tend to hate programmers.

Unlock an iPhone for free

Ed Felten explains how free iPhone unlocking software came to be released. The creators of iPhoneSimFree reverse engineered the iPhone’s configuration to figure out how to unlock the phone, and started selling the software. Someone then purchased iPhoneSimFree, reverse engineered that, and released the information on how to unlock an iPhone to the public, and now free software is available that does the job of iPhoneSimFree.

Of course, if you unlock an iPhone and move it to another network, you won’t be able to take advantage of the killer voice mail integration that the iPhone has, so it’s probably worth it to stick with AT&T anyway.

The last word on climate change?

I still have friends who are doubters when it comes to the causes of climate change. I wonder what they’ll say to the fact that President Bush’s science adviser does not appear to share those doubts. The BBC interviewed Professor John Marburger, and he was unequivocal in his agreement with the idea that increased burning of fossil fuels is causing global warming. Like most scientists, he’s not sure how much we need to reduce carbon emissions or how soon we have to do it, but he states clearly that if we don’t change anything, the consequences will be disastrous. I’d pull some juicy quotes, but unfortunately the best stuff is in the audio interview linked from the article.

Thinking about unobtrusive JavaScript

Unobtrusive JavaScript is a programming philosophy that appears to have really taken hold among Web developers. The basic idea is that just as people try to contain presentational elements within stylesheets rather than littering their markup with tags and attributes that are associated with appearance, you should also avoid littering your markup with JavaScript references, by way of the script tag, attributes associated with events (like onclick) and worst of all, javascript URLs in links.

There are other tenets of the philosophy as well, and I think as a general manifesto for Web developers, it makes a lot of sense.

Today I was thinking of it in terms of server-side developers. One thing that’s tough for people who work on applications for large companies is that they are locked into frameworks that are constrained in the type of HTML that they emit. I’m used to working in the world of open source tools with full control of the HTML that my applications produce, but many people aren’t that lucky. Unobtrusive JavaScript is a way around the platform limitations that many people run into.

As long as you can include a JavaScript file in your pages and can apply the principles of unobtrusive JavaScript, you can, by way of scripts, work around many of the limitations that server side markups impose. I was recently talking to someone who said that the framework they use allows them to use the onmousedown attribute, but not onclick. Using Prototype’s Event.observe or Yahoo UI’s event utility to move that code out of the markup altogether routes around the problem and leads to a cleaner code.

Unfortunately, what I’m also finding is that the same people who are stuck using inflexible frameworks also aren’t allowed to make use of the free JavaScript libraries out there that make unobtrusive JavaScript more tolerable to apply. I had thought that resistance to open source approaches was essentially gone, and I’m a bit surprised to find that not to be the case.

One refugee’s story

Baghdad blogger Riverbend posted her first hand account of departing Iraq for life in Syria as a refugee last week. The story is heartbreaking, but I’m glad she and her family are safe, or at least safer.

Fred Clark puts her post in the wider context.

The final word on the iPhone rebate

Sometimes, only satire can suffice. To wit: Jobs Offers Apple Lisa Early Adopters Store Credit.

My old friend Perl

Recently I’ve been reacquainting myself with Perl. I was once a heavy duty Perl programmer, and used it to write everything from large Web applications to throwaway utility scripts. Over the years, though, I’ve spent more time working with Java, and lately I’ve been investing a lot of my effort in Ruby. Over the past couple of weeks, though, I’ve realized that Perl needs to be part of my day to day life again.

This coincides with a realization that one thing I haven’t been very good at recently is just sitting down and dashing off little scripts to make my life easier. I’ve become so used to designing things and thinking about how to keep them simple, clean, and maintainable that I’ve gotten away from just hacking. Perl used to be my “just for hacking” language, and when stopped writing as much Perl, I stopped “just hacking.” (Call this “Java programmer syndrome.”)

Anyway, what’s occurred to me is that Perl presents a couple of advantages beyond just being a language I like to use.

The first is that Perl is the same everywhere. My MacBook has Perl 5.8.6 installed. My FreeBSD server is running Perl 5.8.8. The Red Hat Enterprise Linux servers I use have Perl 5.8.5. I love Ruby, but it’s not even installed by default under Red Hat Enterprise Linux. Getting the right version of Ruby installed isn’t a big deal when a server is going to be used to host a Ruby on Rails application, but it’s probably not worth the time when you want to write a five line script that cleans up some messy HTML. With Perl you never have to worry about it. The correct version is always around.

The second is that Perl has a massive library of modules available, and most of those modules are widely used and well tested. The current version of Perl includes a large set of modules by default and there are plenty of other modules available if you need them. Regardless of what you’re trying to do, chances are someone has already done it and published the module.

Both of these advantages are marks of maturity, and also of stability. I haven’t been keeping track of what’s going on with Perl 6, and I suspect that’s true of many Perl programmers. Perl 5 was, in essence, finished. It does all the stuff that we’d ever need Perl to do, and the only real way to improve the language substantially would be to make it something that’s not Perl.

I don’t see Perl coming back and taking the place of Java or Ruby on Rails for writing Web applications (at least for me), but I feel like ignoring it completely has been a mistake. For a large class of tasks, Perl is the right tool for the job. Recently I’ve been glad to find that Perl is still where I left it, waiting to help me get things done in a quick and relatively painless way, regardless of which server I happen to be logged into.

Links from September 8

Former Bush administration foot soldier Jack Goldsmith has written a book saying that the Bush administration has gone too far in expanding its power and shirking accountability. That says something.

Disgraced former New York Times reporter Judith Miller has found a new job at a conservative think tank.

Old software never dies.

Texas Monthly digs into the case of the border patrol agents who were prosecuted for shooting a drug dealer and trying to cover it up. This story is a really outstanding piece of reporting.

The Washington Post published a story on wrapping up production of the final episode of The Wire. I haven’t even seen season four yet and I already miss the show. Jason Kottke posted some interesting stuff about The Wire as well.

The No Hand King is a local micro-celebrity. I found his URL because he painted it on a sheet and hung it in front of his house.

Obligatory tech link: a huge table of JVM options.

Apple killed iToner

Last week I spent $15 on iToner, which allows you to turn MP3 files into custom ring tones for your iPhone. I’m not a fan of ring tones, but I thought that iToner was a cool hack, so I went ahead and bought it. Unfortunately, Apple killed it with this week’s iTunes 7.4. Ambrosia is promising a fix, so we’ll see what happens. I hope Apple didn’t kill it deliberately, but it wouldn’t surprise me if they did.

Older posts Newer posts

© 2024 rc3.org

Theme by Anders NorenUp ↑