bad interpreter: No such file or directory

Thursday, January 11th, 2007

You sometimes see this error message when attempting to run a Perl, Python, or shell script that uses a shebang line to find the interpreter. For example,

$ hello.pl
-bash: hello.pl: command not found

(more…)

Perl and Multiple Line Ending Characters

Saturday, January 6th, 2007

Perl uses \n (the linefeed) as its default end of line character (record separator). You can change this with -0 option on the command line to be \r (carriage return), \r\n (carriage return linefeed pair) or something else. For example, this command sets the record separator to \r before replacing every occurence of the string foo with the string bar:

$ perl –pi -e -00d ‘s/foo/bar/g’ test.html

However my files are a weird mix of Unix, Mac, and Windows conventions. A few files may even use several line ending conventions in one file. Most modern text editors can autodetect and deal with this without any problem, as can XML parsers. However as near as I can figure, Perl cannot. It expects me to know in advance what kind of file I’m feeding it.

Is there any simple way around this? There’s more than one way to do it, but is there more than one $/?

REST Pessimists

Sunday, December 3rd, 2006

Several people have started to push back on the REST vs. WS-* and RELAX vs. W3C XSD and Rails vs. JEE fronts with a self-defeating argument. Well, of course, you’re right they say; but it doesn’t matter. The big vendors are selling these big, expensive complex solutions; and that’s all the CIO hears; so that’s all that matters. Sure, you can get the job done better/faster/cheaper with Rails/REST/RELAX, but you won’t. Well, to these pessimists I have a one-word response:

CORBA
(more…)

Right-wingers Don’t Understand Software

Saturday, December 2nd, 2006

Well, at least one right-winger doesn’t. Here’s a howler from Taylor Dinerman at Pajamas Media explaining why we shouldn’t bother to test weapons systems before buying and deploying them:

Certainly testing sounds reasonable. Why not make sure the stuff works before blowing billions on it? But the testing fixation ignores that, like software, most successful weapons systems are best debugged after being deployed. And some weapons systems were never tested at all before deployment.

(more…)

IDE needed to Hack on PHP (not with PHP)

Friday, December 1st, 2006

A piece I’m writing for IBM developerWorks has turned into the article that ate Pittsburgh. Trying to understand and document a certain class keeps leading me deeper into PHP internals, and is revealing some bugs in a certain PHP extension bundled with PHP 5.1 and later. Naturally I want to fix these.

However it’s all C code, and I haven’t done any serious C work in 15 years. (I did write some C++ about eight years ago, but this is straight C, not C++.)

What IDE are folks using on the Mac (or alternately Linux) to hack PHP itself? Xcode? Eclipse with the C development tools installed? Something else? This is just a short quick open source patch project (I hope) so I’d prefer not to pay multiple hundreds of dollars; just use the simplest, quickest thing that will get the job done.
(more…)

Upgrading PHP

Wednesday, November 29th, 2006

I’m getting ready to install PHP 5.2.0 here. Mostly I just want to try to make it link to a newer version of libxml. If it all goes pear-shaped, I’ll post a note on Cafe au Lait while I restore.
(more…)