Updated: 6/10/2002; 3:00:02 a.m..
Myelin: Radio Dev
A blog for testing stuff: SharpBlog, Comment Monitor, etc
        

Saturday, 28 September 2002

After messing around for ages trying to get emacs to understand French characters in unicode (and it is NOT happy about it), I realised that what the leweblog guys are doing is encoding anything remotely dodgy into HTML.  Aha!  So now I can post with accents with bzero.  Makes for lots of typing though.  Using XML for the config file means you have to say stuff like:

description="le premier carnet web fabriqué avec <a href="http://www.myelin.co.nz/bzero/">bzero</a> sur leweblog.com"

Ouch.


11:13:16 PM    comment []

EffNews (Fredrik Lundh's RSS aggregator project) continues ...
7:44:49 PM    comment []

I just added leweblog.com to the list of options for the RSS comment monitor.

So now you can see comments for JY, Xtof and me.


4:09:15 PM    comment []

Oh good, PHP has a urlencode function to encode nonalphanumeric chars so you can put them in URLs.

c.f. urllib.urlencode() in Python.


3:56:43 PM    comment []

Now the comment monitor's RSS feed generator can tell you who's using it right now ;-)

I'm talking to Jake Savin about how to make this a builtin feature of Radio without costing UserLand a fortune in bandwidth.  Ideas?


3:28:41 PM    comment []

Use the /s regex modifier to match text over multiple lines.

For example,

/foo(.*?)bar/

will match

fooabcdefbar

but not

fooabc
defbar

But

/foo(.*?)bar/s

will match both.

The perlre man page is good to read if you're like me and forget this sort of thing easily.


3:10:48 PM    comment []

... but it's going here because I'm definitely going to need to forget it.

In a Perl script, the array @ARGV contains the command-line arguments, but not the filename of the script itself; that's stored in $0.  Not the same as in C, where argv[0] is the path to the program under execution.  (Thanks to !AWARE for this).

With any luck, this will give you the path to the script (followed by a '/' if required) or just "" if the script is in the current directory:

# Get the path to the current script
sub getPath
{
    my $scriptPath = $0;
    if ( $scriptPath =~ m|^(.*/)| )
    {
        return $1;
    }
    else
    {
        return "";
    }
}


2:42:26 PM    comment []


© Copyright 2002 Phillip Pearson.
 
September 2002
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
Aug   Oct


Click here to visit the Radio UserLand website.

Subscribe to "Myelin: Radio Dev" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.