Math.max in JavaScriptPublished at 18:49, Wed 26 Nov 2008
JavaScript is a fine language in many ways — a fact that many people have
noticed by now. But one of its biggest problems is the design of
its standard library. There’s a lot of low-hanging fruit to complain about;
this note covers just Math.max.
runN programPublished at 12:40, Wed 9 Jul 2008
Nearly a year ago, Mark Jason Dominus blogged about runN, a program
he’d written. I’ve stol– uh, I mean, adapted his version for my own ends,
with a couple of differences. This is a rationale for my changes.
Published at 13:35, Mon 3 Mar 2008
Today I read an article by Zed Shaw about the strengths and weaknesses of Ruby, part of a series of similar articles about several dynamic languages, each written by an appropriate expert.
Most of it was just as you’d expect: a description of the Ruby landscape, and the places it works well. But buried here are there are one or two comments that just make no sense whatsoever.
Published at 17:11, Sun 2 Mar 2008
Eric Sink has an interesting piece about MeWare, ThemWare, and UsWare. The basic idea is that one way of categorising software is by who uses it:
I think most programmers can see what Eric’s getting at there. If you’ve ever worked on, say, a piece of software used exclusively by people in a different department of the company you work for, you know how hard it can be to ensure that the software actually meets those people’s needs.
However, I took issue with one particular thing Eric says.
Published at 14:47, Wed 27 Feb 2008
I’m hardly the first person to observe that it’s hard to test code that needs a database. Production usage almost certainly needs a database server, but then the tests need some way of getting a suitable database handle.
Published at 12:42, Thu 14 Feb 2008
A colleague approached me today regarding a unit test he was writing. He was constructing a series of test cases from a data structure; his code at the time used a multi-line string of which each line had several fields which together described a test to run.
time_tPublished at 12:37, Mon 4 Feb 2008
In the context of a discussion about the Y2.038K problem, Craig
Berry surmised that the 32-bit Unix time_t type originated on 16-bit
machines. That’s entirely true; for those with too much time on their
hands, here’s a short history of Unix time handling.
Published at 00:46, Fri 28 Dec 2007
I seem to have accidentally written a CPAN module, and by remote control at that.
There’s been some discussion on p5p about perhaps making the next stable version of Perl (version 5.12) automatically enable strictures (and maybe even warnings).
Published at 11:30, Wed 10 Oct 2007
Here’s a MySQL query issued by some Perl code:
$db->do(q{
CREATE TEMPORARY TABLE byline_age (
byline_id int PRIMARY KEY,
last_used int not null
)
SELECT byline_id, MAX(IfNull(published_at, ?)) AS last_used
FROM article
GROUP BY byline_id
}, undef, time());
Spot the bug? No, nor did I.
Published at 17:08, Fri 3 Aug 2007
[Also published here.]
Mastering Regular
Expressions has been around for a long time — this is the third
edition of a book originally published a decade ago. Does that actually
reflect justified popularity, or is it just that this is the only
book-length treatment of the various regex engines, how they differ, and how
to get the most out of them? I’m glad to say that doesn’t seem to be case:
if you use regexes in any depth at all, you should probably read this book.
Published at 18:31, Sun 28 Jan 2007
[Previously published here.]
Russ Cox recently wrote an article about the worst-case run time of two different implementation strategies for matching regexes: Thompson NFA, and backtracking NFA. In particular, Russ points to the Perl regex engine as an example of how not to do it.
The article’s an interesting read. But I don’t think the approach described is necessarily easy and/or useful to fit into Perl, though.