[32526] in Perl-Users-Digest
Perl-Users Digest, Issue: 3790 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 5 06:09:20 2012
Date: Fri, 5 Oct 2012 03:09:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 5 Oct 2012 Volume: 11 Number: 3790
Today's topics:
Differential pattern match <graham.stow@stowassocs.co.uk>
Re: Differential pattern match <justin.1210@purestblue.com>
Re: Differential pattern match <graham.stow@stowassocs.co.uk>
Re: Differential pattern match <ben@morrow.me.uk>
Re: Differential pattern match <graham.stow@gmail.com>
Re: Differential pattern match <ben@morrow.me.uk>
Re: Differential pattern match <graham.stow@stowassocs.co.uk>
Re: Fire and forget under OS/2 - solved <dave@invalid.invalid>
Fire and forget under OS/2 <dave@invalid.invalid>
Re: Fire and forget under OS/2 <ben@morrow.me.uk>
Re: Fire and forget under OS/2 <dave@invalid.invalid>
How to keep datasets between page reloads <John.Smith@invalid.com>
Re: How to keep datasets between page reloads <ben@morrow.me.uk>
Re: How to keep datasets between page reloads <rvtol+usenet@xs4all.nl>
Re: How to keep datasets between page reloads <xhoster@gmail.com>
Simple copy script called mycopy.pl <ljedamus@gmail.com>
Re: Simple copy script called mycopy.pl <ben@morrow.me.uk>
Re: Simple copy script called mycopy.pl <ljedamus@gmail.com>
Re: Simple copy script called mycopy.pl <bugbear@trim_papermule.co.uk_trim>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 4 Oct 2012 14:49:35 +0100
From: "Graham" <graham.stow@stowassocs.co.uk>
Subject: Differential pattern match
Message-Id: <5bydnUurGbhvDvDNnZ2dnUVZ7qGdnZ2d@bt.com>
I need a pattern match that will match all of the following (and other
variants too)
x1234x X99 10 10x x 12 12 12 12 12
The characters refer to chord fingering on a 6 string guitar. Up to the 9th
fret, the figering is usually tabulated as on the left above, but beyond
this one or two spaces are usually left between double figures encounted
from the 10th-24th frets.
The best pattern match I have found so far is
/[xX0-9][xX0-9\s]{4,20}[xX0-9]/
This provides for a match of x, X, or a number 0-9 on the extreme left and
right side, and for a match of x,X, a number 0-9, or a space, for between 4
and 20 'atoms' between the extreme left and right 'atoms' . However, this
also picks up the masses of spaces between each chord itself. What I need to
do somehow is to count the spaces as the regex engine parses and have it
fail the match if more than two consecutive spaces are encountered. I figure
that extended regex sequences are probably the way to do this, but I've not
encountered them before. Any help welcome.
------------------------------
Date: Thu, 4 Oct 2012 16:58:57 +0100
From: Justin C <justin.1210@purestblue.com>
Subject: Re: Differential pattern match
Message-Id: <1bo0k9-3aa.ln1@zem.masonsmusic.co.uk>
On 2012-10-04, Graham <graham.stow@stowassocs.co.uk> wrote:
> I need a pattern match that will match all of the following (and other
> variants too)
>
> x1234x X99 10 10x x 12 12 12 12 12
>
> The characters refer to chord fingering on a 6 string guitar. Up to the 9th
> fret, the figering is usually tabulated as on the left above, but beyond
> this one or two spaces are usually left between double figures encounted
> from the 10th-24th frets.
>
> The best pattern match I have found so far is
> /[xX0-9][xX0-9\s]{4,20}[xX0-9]/
>
> This provides for a match of x, X, or a number 0-9 on the extreme left and
> right side, and for a match of x,X, a number 0-9, or a space, for between 4
> and 20 'atoms' between the extreme left and right 'atoms' . However, this
> also picks up the masses of spaces between each chord itself. What I need to
> do somehow is to count the spaces as the regex engine parses and have it
> fail the match if more than two consecutive spaces are encountered. I figure
> that extended regex sequences are probably the way to do this, but I've not
> encountered them before. Any help welcome.
They may not help, but there are several modules on CPAN relating to
tab/guitar tab (I found one for ukelele tab too!). You may find you
what you're doing has already been done.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Thu, 4 Oct 2012 18:07:25 +0100
From: "Graham" <graham.stow@stowassocs.co.uk>
Subject: Re: Differential pattern match
Message-Id: <N_mdncTtoZXOX_DNnZ2dnUVZ7tidnZ2d@bt.com>
Nice thought and I checked but nothing looks suitable. Most of them are
guitar fretboard image creators and the user provides the tab in a format
prescribed by the module. The script I am writing needs to match the tab in
the myriad of formats 'out there'.
Graham S
"Justin C" <justin.1210@purestblue.com> wrote in message
news:1bo0k9-3aa.ln1@zem.masonsmusic.co.uk...
> On 2012-10-04, Graham <graham.stow@stowassocs.co.uk> wrote:
>> I need a pattern match that will match all of the following (and other
>> variants too)
>>
>> x1234x X99 10 10x x 12 12 12 12 12
>>
>> The characters refer to chord fingering on a 6 string guitar. Up to the
>> 9th
>> fret, the figering is usually tabulated as on the left above, but beyond
>> this one or two spaces are usually left between double figures encounted
>> from the 10th-24th frets.
>>
>> The best pattern match I have found so far is
>> /[xX0-9][xX0-9\s]{4,20}[xX0-9]/
>>
>> This provides for a match of x, X, or a number 0-9 on the extreme left
>> and
>> right side, and for a match of x,X, a number 0-9, or a space, for between
>> 4
>> and 20 'atoms' between the extreme left and right 'atoms' . However, this
>> also picks up the masses of spaces between each chord itself. What I need
>> to
>> do somehow is to count the spaces as the regex engine parses and have it
>> fail the match if more than two consecutive spaces are encountered. I
>> figure
>> that extended regex sequences are probably the way to do this, but I've
>> not
>> encountered them before. Any help welcome.
>
>
> They may not help, but there are several modules on CPAN relating to
> tab/guitar tab (I found one for ukelele tab too!). You may find you
> what you're doing has already been done.
>
> Justin.
>
> --
> Justin C, by the sea.
------------------------------
Date: Thu, 4 Oct 2012 18:33:24 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Differential pattern match
Message-Id: <4st0k9-6ki.ln1@anubis.morrow.me.uk>
Quoth "Graham" <graham.stow@stowassocs.co.uk>:
> I need a pattern match that will match all of the following (and other
> variants too)
>
> x1234x X99 10 10x x 12 12 12 12 12
>
> The characters refer to chord fingering on a 6 string guitar. Up to the 9th
> fret, the figering is usually tabulated as on the left above, but beyond
> this one or two spaces are usually left between double figures encounted
> from the 10th-24th frets.
Patterns of the first and third type (assuming I've understood correctly
where Xs can appear: I don't play the guiter) can be matched with
something like
m[
([xX])? (?:
([1-9]){0,4} |
[ ]{0,2} (?: ([12]?[0-9]) [ ]{1,2} ){1,4}
) ([xX])?
]x
Note that this will match the empty string, which probably isn't right;
are 'x' or 'xx' alone valid? If not you can change the 'compact' part of
the match to ([1-9]){1,4} to require at least one digit somewhere. Also
note that this will allow fret numbers up to 29; if that matters you
could change the 'extended' fret number match to (2[0-4]|1?[0-9]).
Including patterns of the second type is harder. How do you know whether
'x11 10' is 'two fingers on 1 and one on 10' or 'one finger on 11 and
one on 10'? Is there always a space after an initial 'x' if the first
group of digits is a single fret number? (Is there always an initial
'x', in which case the pattern above could have been simplified?)
If a pattern with no initial 'clustered' digits always starts with
'x ' then we can use that to distinguish:
m[
(?: ([Xx]) | ([Xx])? ([1-9]){0,4} )
(?: [ ]{1,2} ([12]?[0-9]) ){1,4}
([Xx])?
]x
All the points in the second paragraph above appy here, as well; in
addition, this will allow patterns for chords with more than four
fingers, such as 'x999 10 11 12'. That can't be sensibly fixed within
the regex, but can be easily checked by counting the capture groups
afterwards.
Ben
------------------------------
Date: Thu, 4 Oct 2012 22:10:03 +0100
From: "Graham S" <graham.stow@gmail.com>
Subject: Re: Differential pattern match
Message-Id: <k4ktvc$19f8$1@news.enta.net>
I haven't had time to check this out fully yet, but the following is a quick
guide to guitar tabs:
The six strings of a guitar, from lowest to highest pitch, are tuned EADGBE.
Thus a tab of 333x22 would mean 3rd fet on the E, A and D strings, the G
string muted (not played) and the 2nd fret on the B and E strings. This is
the normal tablature for chords where all the notes are from up to but not
exceeding the 9th fret. Beond the 9th fret, one or two spaces are left to
make it clear which strings are being played and at what fret. Thus '999x
10x' would mean 9th fret on the E, A & D strings, the G and E strings muted,
and 10th fret on the B string. However, some tab writers might equally show
this as '999x 10 x' or '9 9 9 x 10 x '. Whatever the denotation, there
should always be a reference to all 6 strings. Your reference to 'x11 10'
would therefore mean the (low) E string muted, 1st fret on the A & D
strings, 10th fret on the G string, but would be an incomplete tab as it
doesn't give the fretting for the B and (high) E strings (I also doubt if it
could be played as the person who could bridge his fingers between the 1st
and 10th frets probably hasn't been born yet :). Similarly your 'x999 10 11
12' chord is actually a tab for a seven string instrument. No problem
though - as you say, you don't play guitar.
It's important to appreciate that one x (or X) , or one digit (0-9), or two
digits (11-24), can all refer to any one string. I'm not at all worried if
the regex extends up to 29 (in fact there might be the odd 1 in a million
guitars that extends to a 29th fret).
I don't have a problem with working out what number or X refers to what
string and am enirely confident I can split an indvidual chord tab
correctly. My problem is finding a flexible pattern match to correctly
identify when a chord is a chord.
Will check out you proposed regex ASAP, but meanwhile if you've got any
further ideas having read the above, I'd be delighted to hear them.
Graham S
"Ben Morrow" <ben@morrow.me.uk> wrote in message
news:4st0k9-6ki.ln1@anubis.morrow.me.uk...
>
> Quoth "Graham" <graham.stow@stowassocs.co.uk>:
>> I need a pattern match that will match all of the following (and other
>> variants too)
>>
>> x1234x X99 10 10x x 12 12 12 12 12
>>
>> The characters refer to chord fingering on a 6 string guitar. Up to the
>> 9th
>> fret, the figering is usually tabulated as on the left above, but beyond
>> this one or two spaces are usually left between double figures encounted
>> from the 10th-24th frets.
>
> Patterns of the first and third type (assuming I've understood correctly
> where Xs can appear: I don't play the guiter) can be matched with
> something like
>
> m[
> ([xX])? (?:
> ([1-9]){0,4} |
> [ ]{0,2} (?: ([12]?[0-9]) [ ]{1,2} ){1,4}
> ) ([xX])?
> ]x
>
> Note that this will match the empty string, which probably isn't right;
> are 'x' or 'xx' alone valid? If not you can change the 'compact' part of
> the match to ([1-9]){1,4} to require at least one digit somewhere. Also
> note that this will allow fret numbers up to 29; if that matters you
> could change the 'extended' fret number match to (2[0-4]|1?[0-9]).
>
> Including patterns of the second type is harder. How do you know whether
> 'x11 10' is 'two fingers on 1 and one on 10' or 'one finger on 11 and
> one on 10'? Is there always a space after an initial 'x' if the first
> group of digits is a single fret number? (Is there always an initial
> 'x', in which case the pattern above could have been simplified?)
>
> If a pattern with no initial 'clustered' digits always starts with
> 'x ' then we can use that to distinguish:
>
> m[
> (?: ([Xx]) | ([Xx])? ([1-9]){0,4} )
> (?: [ ]{1,2} ([12]?[0-9]) ){1,4}
> ([Xx])?
> ]x
>
> All the points in the second paragraph above appy here, as well; in
> addition, this will allow patterns for chords with more than four
> fingers, such as 'x999 10 11 12'. That can't be sensibly fixed within
> the regex, but can be easily checked by counting the capture groups
> afterwards.
>
> Ben
>
------------------------------
Date: Fri, 5 Oct 2012 00:23:10 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Differential pattern match
Message-Id: <ubi1k9-0u7.ln1@anubis.morrow.me.uk>
Quoth "Graham S" <graham.stow@gmail.com>:
> I haven't had time to check this out fully yet, but the following is a quick
> guide to guitar tabs:
>
> The six strings of a guitar, from lowest to highest pitch, are tuned EADGBE.
> Thus a tab of 333x22 would mean 3rd fet on the E, A and D strings, the G
> string muted (not played) and the 2nd fret on the B and E strings. This is
> the normal tablature for chords where all the notes are from up to but not
> exceeding the 9th fret. Beond the 9th fret, one or two spaces are left to
> make it clear which strings are being played and at what fret. Thus '999x
> 10x' would mean 9th fret on the E, A & D strings, the G and E strings muted,
> and 10th fret on the B string. However, some tab writers might equally show
> this as '999x 10 x' or '9 9 9 x 10 x '. Whatever the denotation, there
> should always be a reference to all 6 strings.
OK, I see: I was assuming they were *fingers* when actually they are
strings, and I didn't understand what the Xs were for. All my previous
patterns were wrong then :).
It sounds to me like
/ (?: (?: [12][0-9] | [1-9Xx] ) [ ]* ){6} /x;
might be sufficient; that is: a string is two or one digits or an X, and
a chord has six strings possibly separated by spaces. It's important the
two possibilities are listed in that order, since the | regex operator
tries the alternatives in the order they are given and [1-9Xx] will
match the first digit of '10' if you let it.
This will allow chord patterns a human wouldn't necessarily read
correctly, like 'xxx11119' (which will be parsed as 'x x x 11 11 9'),
but that may not be a problem in practice. If it is, one way to fix it
is like this:
/ (?: (?: \b [12][0-9] \b | [1-9Xx] ) [ ]* ){6} /x
where the \bs insist that two-digit fret numbers don't get jammed up
against other numbers.
If you want to pull out just the string numbers (ignoring the spaces)
you unfortunately can't use the {6} notation, because capturing
(bracketed) groups inside repetitions still only capture once. That
means it's probably easiest to build up the pattern programatically,
like this:
my $string = '(\b [12][0-9] \b | [1-9Xx]) [ ]*';
my $chord = $string x 6;
my $text = "999x 10 x";
my @strings = $text =~ /$chord/x;
Ben
------------------------------
Date: Fri, 5 Oct 2012 08:36:24 +0100
From: "Graham" <graham.stow@stowassocs.co.uk>
Subject: Re: Differential pattern match
Message-Id: <cZadnURFpLdgEPPNnZ2dnUVZ8vSdnZ2d@bt.com>
Both these regex produced the same output. It's the best so far, but
unfirtunately it's not perfect.
Here's some 'real life' attempts using the first of these to match some of
the tabs on the page at
http://www.hakwright.co.uk/music/tab/not-the-same-without-you.shtml
Applied to the line 'Substituting a C9 shape (x32333) in place of some of
the C7 shapes work'
produced the output
'Substituting a C9 shape (
x32333
) in place of some of the C7 shapes work'
So that works fine!
Similarly, applied to the line 'x5777x x3555x x8x887 x 7 9
7 10 7'
produced the output
'x5777x
x3555x
x8x887
x 7 9 7 10 7'
So that works fine too!
However, applied to the line 'xxx200 1xx230 x7x785 xx0975'
produced the output
'2xx200 1xx230
x7x785
xx0975'
Thus the first two chord tabs on this line weren't matched
Similarly, applied to the line 'xx0563 3x353x x3545x 1x221x
07x775'
produced the output
'xx0
563 3x3
53x x35
45x 1x2
21x 07x775'
Thus none of the five chords on this line were matched correctly, with the
regex bridging the white space and matching part of one chord with part of
another in some instances (the very problem I'm trying to avoid)
Any further ideas welcome!
Graham S
"Ben Morrow" <ben@morrow.me.uk> wrote in message
news:ubi1k9-0u7.ln1@anubis.morrow.me.uk...
>
> Quoth "Graham S" <graham.stow@gmail.com>:
>> I haven't had time to check this out fully yet, but the following is a
>> quick
>> guide to guitar tabs:
>>
>> The six strings of a guitar, from lowest to highest pitch, are tuned
>> EADGBE.
>> Thus a tab of 333x22 would mean 3rd fet on the E, A and D strings, the G
>> string muted (not played) and the 2nd fret on the B and E strings. This
>> is
>> the normal tablature for chords where all the notes are from up to but
>> not
>> exceeding the 9th fret. Beond the 9th fret, one or two spaces are left to
>> make it clear which strings are being played and at what fret. Thus '999x
>> 10x' would mean 9th fret on the E, A & D strings, the G and E strings
>> muted,
>> and 10th fret on the B string. However, some tab writers might equally
>> show
>> this as '999x 10 x' or '9 9 9 x 10 x '. Whatever the denotation, there
>> should always be a reference to all 6 strings.
>
> OK, I see: I was assuming they were *fingers* when actually they are
> strings, and I didn't understand what the Xs were for. All my previous
> patterns were wrong then :).
>
> It sounds to me like
>
> / (?: (?: [12][0-9] | [1-9Xx] ) [ ]* ){6} /x;
>
> might be sufficient; that is: a string is two or one digits or an X, and
> a chord has six strings possibly separated by spaces. It's important the
> two possibilities are listed in that order, since the | regex operator
> tries the alternatives in the order they are given and [1-9Xx] will
> match the first digit of '10' if you let it.
>
> This will allow chord patterns a human wouldn't necessarily read
> correctly, like 'xxx11119' (which will be parsed as 'x x x 11 11 9'),
> but that may not be a problem in practice. If it is, one way to fix it
> is like this:
>
> / (?: (?: \b [12][0-9] \b | [1-9Xx] ) [ ]* ){6} /x
>
> where the \bs insist that two-digit fret numbers don't get jammed up
> against other numbers.
>
> If you want to pull out just the string numbers (ignoring the spaces)
> you unfortunately can't use the {6} notation, because capturing
> (bracketed) groups inside repetitions still only capture once. That
> means it's probably easiest to build up the pattern programatically,
> like this:
>
> my $string = '(\b [12][0-9] \b | [1-9Xx]) [ ]*';
> my $chord = $string x 6;
>
> my $text = "999x 10 x";
> my @strings = $text =~ /$chord/x;
>
> Ben
>
------------------------------
Date: Wed, 3 Oct 2012 18:33:36 +0000 (UTC)
From: "Dave Saville" <dave@invalid.invalid>
Subject: Re: Fire and forget under OS/2 - solved
Message-Id: <fV45K0OBJxbE-pn2-xw7exQ7LGcej@localhost>
On Wed, 3 Oct 2012 17:25:11 UTC, "Dave Saville" <dave@invalid.invalid>
wrote:
> Trying to start a process as "fire and forget" ie I want the process
> to just go off by itself and the invoking script to keep going and not
> kill the invoked process when it exits.
>
> Google around and it looks as if "system 'foo &'" should work. But
> under OS/2 ECS it does not - even though, from the command line, "sh
> foo &" from a sh prompt works as in *nix.
>
> As an aside, "system foo&" with a "ps" in another window shows an
> instance of sh with foo as child.
> system "sh -c foo &" with a "ps" in another window shows *three*
> instances of sh and one of foo in a straight chain of pids. Can't
> figure why three and not two.
Turned out to be a shell problem. Perl looks for sh. It found one, but
at some point in the past I had aliased it to ksh. Aliased pdksh to sh
and it works perfectly. :-)
--
Regards
Dave Saville
------------------------------
Date: Wed, 3 Oct 2012 17:25:11 +0000 (UTC)
From: "Dave Saville" <dave@invalid.invalid>
Subject: Fire and forget under OS/2
Message-Id: <fV45K0OBJxbE-pn2-nYHV3wtudIje@localhost>
Trying to start a process as "fire and forget" ie I want the process
to just go off by itself and the invoking script to keep going and not
kill the invoked process when it exits.
Google around and it looks as if "system 'foo &'" should work. But
under OS/2 ECS it does not - even though, from the command line, "sh
foo &" from a sh prompt works as in *nix.
As an aside, "system foo&" with a "ps" in another window shows an
instance of sh with foo as child.
system "sh -c foo &" with a "ps" in another window shows *three*
instances of sh and one of foo in a straight chain of pids. Can't
figure why three and not two.
TIA
--
Regards
Dave Saville
------------------------------
Date: Wed, 3 Oct 2012 22:34:07 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Fire and forget under OS/2
Message-Id: <fjnuj9-nl4.ln1@anubis.morrow.me.uk>
Quoth "Dave Saville" <dave@invalid.invalid>:
> Trying to start a process as "fire and forget" ie I want the process
> to just go off by itself and the invoking script to keep going and not
> kill the invoked process when it exits.
perldoc perlos2 points you to OS2::Process, which suggests something like
use OS2::Process;
system P_NOWAIT | P_UNRELATED, "foo";
may be what you want. I don't know what the difference is between the
various constants you can use for that first argument; presumably this
is explained in the OS/2 system documentation.
Ben
------------------------------
Date: Thu, 4 Oct 2012 10:33:15 +0000 (UTC)
From: "Dave Saville" <dave@invalid.invalid>
Subject: Re: Fire and forget under OS/2
Message-Id: <fV45K0OBJxbE-pn2-ckq4WvGZMxDS@localhost>
On Wed, 3 Oct 2012 21:34:07 UTC, Ben Morrow <ben@morrow.me.uk> wrote:
>
> Quoth "Dave Saville" <dave@invalid.invalid>:
> > Trying to start a process as "fire and forget" ie I want the process
> > to just go off by itself and the invoking script to keep going and not
> > kill the invoked process when it exits.
>
> perldoc perlos2 points you to OS2::Process, which suggests something like
>
> use OS2::Process;
>
> system P_NOWAIT | P_UNRELATED, "foo";
>
> may be what you want. I don't know what the difference is between the
> various constants you can use for that first argument; presumably this
> is explained in the OS/2 system documentation.
>
Hi Ben
Yes they are the same parms as some C functions use for starting
things. However, last night I had a brainwave as to why "system foo &"
did not work which google suggests should. Turns out that at some time
in the dim past I had copied ksh to sh. Having tried all the OS/2
shells I have knocking around pdksh works as one would expect on *nix.
Happy bunny.
--
Regards
Dave Saville
------------------------------
Date: Wed, 03 Oct 2012 10:36:18 +0300
From: John <John.Smith@invalid.com>
Subject: How to keep datasets between page reloads
Message-Id: <7dqn68tinon1f4rr69tk142inahhptbnm0@4ax.com>
When my www page reloads it loads a dataset of several thousand items.
When user reloads/repaints the page what is preferred way to keep the dataset?
------------------------------
Date: Wed, 3 Oct 2012 09:20:42 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to keep datasets between page reloads
Message-Id: <q39tj9-sdi.ln1@anubis.morrow.me.uk>
Quoth John.Smith@invalid.com:
> When my www page reloads it loads a dataset of several thousand items.
>
> When user reloads/repaints the page what is preferred way to keep the
> dataset?
Use a persistent backend like FCGI or mod_perl.
Ben
------------------------------
Date: Wed, 03 Oct 2012 13:26:02 +0200
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: How to keep datasets between page reloads
Message-Id: <506c20ca$0$6890$e4fe514c@news2.news.xs4all.nl>
On 2012-10-03 09:36, John wrote:
> When my www page reloads it loads a dataset of several thousand items.
>
> When user reloads/repaints the page what is preferred way to keep the dataset?
Have a look at memcached.
--
Ruud
------------------------------
Date: Wed, 03 Oct 2012 18:10:55 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: How to keep datasets between page reloads
Message-Id: <506ceabb$2$5461$ed362ca5@nr5-q3a.newsreader.com>
On 10/03/2012 12:36 AM, John wrote:
> When my www page reloads it loads a dataset of several thousand items.
Why?
> When user reloads/repaints the page what is preferred way to keep the dataset?
I don't know what it means to "repaint" the screen. That sounds like
something which is entirely the web browser's concern, so I'd probably
avoid sticking my nose into it.
Why would they be reloading the page if they wanted to have the same
several thousand items after the reload as before? Maybe you can use
frames to separate the things that change upon reloading from those that
don't.
Xho
------------------------------
Date: Thu, 04 Oct 2012 17:12:30 +0200
From: Leander Jedamus <ljedamus@gmail.com>
Subject: Simple copy script called mycopy.pl
Message-Id: <506da75f$0$9505$9b4e6d93@newsspool1.arcor-online.net>
Hi!
I just wrote a simple script to fit my needs to copy from a SD-Card only
those photos which are newer then a timestamp-file.
Use at your on risk!
It can be found at
http://paste.ubuntu.com/1259875/
A short instruction-list can be found at
http://paste.ubuntu.com/1260073/
Enjoy!
Leander Jedamus
------------------------------
Date: Thu, 4 Oct 2012 18:57:14 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Simple copy script called mycopy.pl
Message-Id: <q8v0k9-92b1.ln1@anubis.morrow.me.uk>
Quoth Leander Jedamus <ljedamus@gmail.com>:
>
> I just wrote a simple script to fit my needs to copy from a SD-Card only
> those photos which are newer then a timestamp-file.
> Use at your on risk!
>
> It can be found at
> http://paste.ubuntu.com/1259875/
- Use Term::ANSIColor rather than rolling your own.
- Don't call subs with '&' unless you need to.
- 'warn' is a builtin. Defining a sub with that name is a bad idea.
- `date -r` is not portable (on my system it does something quite
different). Use stat() and POSIX::strftime.
- This
sub mycopy
{
my $sdir = $_[0];# source dir
my $ddir = $_[1];# destination dir
my $sfiles = $_[2];# the files to copy
my $rekursive = $_[3];# if going recursive? (y/n)
my $use_stamp = $_[4];# use stamp? (y/n)
my $stamp = $_[5];# the stamp
my $warn = $_[6];# warn level
my $debug = $_[7];#
is a horrid mess. Learn how to use list assignment.
- mkdirhier is not portable (it's part of X, from the bad old days when
mkdir didn't always understand -p). Use 'mkdir -p' (which ought to be)
or File::Path (which definitely is).
- I can't follow the logic in 'mycopy' at all. It must be possible to
write it without quite so many layers of ifs.
- I don't think there is a single comment in that program which makes
anything clearer. Something like a general description of the logic
implemented by the twisty maze of ifs in mycopy would have been much
more useful than closing every sub with '};# sub foo'.
- Use multi-arg system
system "cp", "-p", $sfile, $dfile;
rather than trying to get shell quoting right. What if there's a file
with " in its name?
After that I got bored, but is this really doing anything you can't do
with find -newer | xargs cp ? Or just forget the stamps and use rsync.
Ben
------------------------------
Date: Fri, 05 Oct 2012 09:13:19 +0200
From: Leander Jedamus <ljedamus@gmail.com>
Subject: Re: Simple copy script called mycopy.pl
Message-Id: <506e8890$0$9512$9b4e6d93@newsspool1.arcor-online.net>
Am 04.10.2012 19:57, schrieb Ben Morrow:
>
> Quoth Leander Jedamus <ljedamus@gmail.com>:
>>
>> I just wrote a simple script to fit my needs to copy from a SD-Card only
>> those photos which are newer then a timestamp-file.
>> Use at your on risk!
>>
>> It can be found at
>> http://paste.ubuntu.com/1259875/
>
> - Use Term::ANSIColor rather than rolling your own.
>
> - Don't call subs with '&' unless you need to.
>
> - 'warn' is a builtin. Defining a sub with that name is a bad idea.
>
> - `date -r` is not portable (on my system it does something quite
> different). Use stat() and POSIX::strftime.
>
> - This
>
> sub mycopy
> {
> my $sdir = $_[0];# source dir
> my $ddir = $_[1];# destination dir
> my $sfiles = $_[2];# the files to copy
> my $rekursive = $_[3];# if going recursive? (y/n)
> my $use_stamp = $_[4];# use stamp? (y/n)
> my $stamp = $_[5];# the stamp
> my $warn = $_[6];# warn level
> my $debug = $_[7];#
>
> is a horrid mess. Learn how to use list assignment.
>
> - mkdirhier is not portable (it's part of X, from the bad old days when
> mkdir didn't always understand -p). Use 'mkdir -p' (which ought to be)
> or File::Path (which definitely is).
>
> - I can't follow the logic in 'mycopy' at all. It must be possible to
> write it without quite so many layers of ifs.
>
> - I don't think there is a single comment in that program which makes
> anything clearer. Something like a general description of the logic
> implemented by the twisty maze of ifs in mycopy would have been much
> more useful than closing every sub with '};# sub foo'.
>
> - Use multi-arg system
>
> system "cp", "-p", $sfile, $dfile;
>
> rather than trying to get shell quoting right. What if there's a file
> with " in its name?
>
> After that I got bored, but is this really doing anything you can't do
> with find -newer | xargs cp ? Or just forget the stamps and use rsync.
>
> Ben
>
Thanks! I will look into it.
Grüße
Leander Jedamus
------------------------------
Date: Fri, 05 Oct 2012 08:54:48 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Simple copy script called mycopy.pl
Message-Id: <QNOdnehZY43VD_PNnZ2dnUVZ8hadnZ2d@brightview.co.uk>
Ben Morrow wrote:
>
> After that I got bored, but is this really doing anything you can't do
> with find -newer | xargs cp ? Or just forget the stamps and use rsync.
I actually DO use rsync for this.
BugBear
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 3790
***************************************