2004-10-30-0358Z


Winding down on my RAC job... about to break out the tequila bottle and call it a night. It wasn't all that hard, but I was trying to make it a learning experience, so I went through a lot of hair-pulling getting javascript to work reliably, and learning some finer points of sed to do stuff I would previously have relegated to Perl.

I didn't know before, for example, that you could set form variables via the script that you specify as your "onsubmit" code, and that you can tack on a question mark and parameters to a plain-old .htm URL and retrieve them via javascript to affect the behavior of the form on the page. For example, based on what the user entered into the form, you could set a hidden variable to any arbitrary variable:

if (myform.email.value == "jcomeau@nosuch.dom") myform.debug.value = true;

Not sure that's correct, nor illustrative of the concept even... but that's the idea. Those of you who use javascript regularly are saying "ho-hum", but hey, I almost never touch the stuff... to me it was a revelation. You have to already have put that element into the form, though, without a value, sic:

<INPUT TYPE="hidden" NAME="debug" VALUE="">

I'm trying to get my sedit sound editor script working again; invoking it gave me a strange error:

: bad interpreter: No such file or directory/python

That looked vaguely familiar. Futzing around with strace didn't help at all; invoking it with "python sedit.py" avoided the problem... aha! I wrote this when I was still running Cygwin; I bet it has embedded CRs... xxd sedit.py... sure enough! A quick perl -pi -e 's/\r//' sedit.py later and now I'm on to the real bugs.

Back to blog or home page

last updated 2013-01-10 20:32:08. served from tektonic.jcomeau.com