[25591] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 7835 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 27 00:05:46 2005

Date: Sat, 26 Feb 2005 21:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 26 Feb 2005     Volume: 10 Number: 7835

Today's topics:
        [perl-python] generate all possible pairings <xah@xahlee.org>
    Re: [perl-python] generate all possible pairings <mwm@mired.org>
    Re: create thread from within another? kongyew@w-manager.com
        dynamic update enigma261@yahoo.com
    Re: dynamic update <nospam@bigpond.com>
    Re: dynamic update <wyzelli@yahoo.com>
    Re: dynamic update enigma261@yahoo.com
    Re: generic equivalence partition <xah@xahlee.org>
    Re: generic equivalence partition <xah@xahlee.org>
    Re: generic equivalence partition <max@alcyone.com>
    Re: maximum size of a hash table <postmaster@castleamber.com>
    Re: OOP Tutorial <leslievNO@SPAMicoc.co.za>
    Re: Performance questions (SQL-statements) xhoster@gmail.com
        Perl web design <iotarhorho@REM0VEhotmail.com>
    Re: Pure Perl OpenSSL Library <No_4@dsl.pipex.com>
    Re: sequences of numbers <postmaster@castleamber.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 26 Feb 2005 17:26:31 -0800
From: "Xah Lee" <xah@xahlee.org>
Subject: [perl-python] generate all possible pairings
Message-Id: <1109467591.827686.95540@f14g2000cwb.googlegroups.com>

20050226 exercise: generate all possible pairings

given a list that is a set partitioned into subsets, generate a list
of all possible pairings of elements in any two subset.

Example:

 genpair( [[9,1],[5],[2,8,7]] );

returns:

 [[5,8],[9,5],[1,5],[9,2],[9,7],[1,8],[1,7],[5,2],[1,2],[9,8],[5,7]]

(we do not assume the given set has order, so the result is not
ordered.)

Perl code and Python code will be posted in 2 days.

This is brought to you by the perl-python community. To subscribe, see
http://xahlee.org/perl-python/python.html

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html



------------------------------

Date: Sat, 26 Feb 2005 19:46:59 -0600
From: Mike Meyer <mwm@mired.org>
Subject: Re: [perl-python] generate all possible pairings
Message-Id: <86650eg4fg.fsf@guru.mired.org>

"Xah Lee" <xah@xahlee.org> writes:

> This is brought to you by the perl-python community. To subscribe, see
> http://xahlee.org/perl-python/python.html

assert len(perl-python community) == 1

       <mike
-- 
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.


------------------------------

Date: 26 Feb 2005 14:36:37 -0800
From: kongyew@w-manager.com
Subject: Re: create thread from within another?
Message-Id: <1109457397.048918.23820@f14g2000cwb.googlegroups.com>

Hi,

     I thought cost of thread creation is smaller than process.

kongyew@w-manager.com



------------------------------

Date: 26 Feb 2005 15:09:00 -0800
From: enigma261@yahoo.com
Subject: dynamic update
Message-Id: <1109459340.628463.47660@g14g2000cwa.googlegroups.com>

Hi,

I am trying to accomplish the following ...
I have a form via which I want to execute 10 tasks (processes)
The 10 processes are execute sequentially.

I want the web page to reflect the status as each task is being run ..
For Ex...

Task 1 : Running ...
Task 2 : Waiting launch
 .
 .
 .
 .

And, the status will change depending on the current status of the
task.

Any help is appreciated.

thanks



------------------------------

Date: Sun, 27 Feb 2005 09:15:48 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: dynamic update
Message-Id: <38ce95F5kn62bU1@individual.net>

enigma261@yahoo.com wrote:

> Hi,
> 
> I am trying to accomplish the following ...
> I have a form via which I want to execute 10 tasks (processes)
> The 10 processes are execute sequentially.
> 
> I want the web page to reflect the status as each task is being run ..
Good for you.

> For Ex...
> 
> Task 1 : Running ...
> Task 2 : Waiting launch
> 
> And, the status
Of what?

> will change depending on the current status of the 
> task.
> 
> Any help is appreciated.
> 
> thanks

Sounds like a HTML or javascript issue to me.
Whats it got to do with Perl?

gtoomey



------------------------------

Date: Sat, 26 Feb 2005 23:35:54 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: dynamic update
Message-Id: <uJ7Ud.176868$K7.112394@news-server.bigpond.net.au>

<enigma261@yahoo.com> wrote in message
news:1109459340.628463.47660@g14g2000cwa.googlegroups.com...
> Hi,
>
> I am trying to accomplish the following ...
> I have a form via which I want to execute 10 tasks (processes)
> The 10 processes are execute sequentially.
>
> I want the web page to reflect the status as each task is being run ..
> For Ex...
>
> Task 1 : Running ...
> Task 2 : Waiting launch
> .
> .
> .
> .
>
> And, the status will change depending on the current status of the
> task.
>
> Any help is appreciated.

Generate 10 sequential redirections.... (to a self updating script even...)

P




------------------------------

Date: 26 Feb 2005 15:50:46 -0800
From: enigma261@yahoo.com
Subject: Re: dynamic update
Message-Id: <1109461846.537272.174010@f14g2000cwb.googlegroups.com>

Thanks Peter,

Your suggestion would work for sure.
After posting the question, I did some searching and found
the concept of "server push" in cgi.pm module.

It is designed just for continuously updating webpages ..
A good example is a clock that refreshes time at designated interval

thanks

Peter Wyzl wrote:
> <enigma261@yahoo.com> wrote in message
> news:1109459340.628463.47660@g14g2000cwa.googlegroups.com...
> > Hi,
> >
> > I am trying to accomplish the following ...
> > I have a form via which I want to execute 10 tasks (processes)
> > The 10 processes are execute sequentially.
> >
> > I want the web page to reflect the status as each task is being run
 ..
> > For Ex...
> >
> > Task 1 : Running ...
> > Task 2 : Waiting launch
> > .
> > .
> > .
> > .
> >
> > And, the status will change depending on the current status of the
> > task.
> >
> > Any help is appreciated.
>
> Generate 10 sequential redirections.... (to a self updating script
even...)
> 
> P



------------------------------

Date: 26 Feb 2005 13:38:13 -0800
From: "Xah Lee" <xah@xahlee.org>
Subject: Re: generic equivalence partition
Message-Id: <1109453893.313217.66290@f14g2000cwb.googlegroups.com>

folks:

when using google to post a reply, it sometimes truncates the subject
line. i.e. [perl-python] is lost. This software error is obvious, they
could not have not noticed it.

another thing more egregious is that google _intentionally_ edit with
people's posts. (e.g. they change email address lines without author's
permission, and they also change program codes so it no longer run).
Please spread these google irresponsibility to all related forums on
software responsibility and online forum issues.

Ostensible incorrect behavior like these by google is egregious enough
to generate a law suit and if such company do not take software
correctness seriously, we must punish them.

Please spread this awareness.

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html



------------------------------

Date: 26 Feb 2005 16:06:46 -0800
From: "Xah Lee" <xah@xahlee.org>
Subject: Re: generic equivalence partition
Message-Id: <1109462806.608717.309810@o13g2000cwo.googlegroups.com>

People,

 ... sorry for the latching on on this broadside issue, but it is
impotant ...

here's are some germane points from another online discussion:

the bug-reporting issue has came up so many times by so many people i
thought i'd make a comment of my view.

when a software is ostensibly incorrect, and if it is likely in
connection to egregious irresponsibility as most software companies are
thru their irresponsible licensing, the thing one should not do is to
fawn up to their ass as in filing a bug report, and that is also the
least effective in correcting the software.

the common attitude of bug-reporting is one reason that contributed to
the tremendous egregious irresponsible fuckups in computer software
industry that each of us have to endure daily all the time. (e.g.
software A clashed, software B can't do this, C can't do that, D i
don't know how to use, E download location currently broken, F i need
to join discussion group to find a work-around, G is all pretty and
dysfunctional... )

when a software is ostensibly incorrect and when the company is
irresponsible with their licensing, the most effective and moral
attitude is to do legal harm to the legal entity. This one an do by
filing a law suit or spreading the fact. Filing a law suit is
appropriate in severe and serious cases, and provided you have such
devotion to the cause. For most cases, we should just spread the fact.
When a company see facts flying about their incompetence or
irresponsibility, they will immediately mend the problem source, or
cease to exist.

Another harm sprang from the fucking bug-reporting attitude rampant
among IT morons is the multiplication of pop-ups that bug users for
bug-reporting, complete with their privacy intrusion legalese.

http://xahlee.org/UnixResource_dir/writ/responsible_license.html

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html


Xah Lee wrote:
> folks:
>
> when using google to post a reply, it sometimes truncates the subject
> line. i.e. [perl-python] is lost. This software error is obvious,
they
> could not have not noticed it.
>
> another thing more egregious is that google _intentionally_ edit with
> people's posts. (e.g. they change email address lines without
author's
> permission, and they also change program codes so it no longer run).
> Please spread these google irresponsibility to all related forums on
> software responsibility and online forum issues.
>
> Ostensible incorrect behavior like these by google is egregious
enough
> to generate a law suit and if such company do not take software
> correctness seriously, we must punish them.
>
> Please spread this awareness.
> 
>  Xah
>  xah@xahlee.org
>  http://xahlee.org/PageTwo_dir/more.html



------------------------------

Date: Sat, 26 Feb 2005 16:08:54 -0800
From: Erik Max Francis <max@alcyone.com>
Subject: Re: generic equivalence partition
Message-Id: <CamdnSDfBvYLkrzfRVn-sg@speakeasy.net>

Xah Lee wrote:

> ... sorry for the latching on on this broadside issue, but it is
> impotant ...

You made a typo in that last word there.  Obviously you meant to write 
an _e_ instead of an _a_.

-- 
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   All bad poetry springs from genuine feeling.
   -- Oscar Wilde


------------------------------

Date: 26 Feb 2005 18:34:09 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: maximum size of a hash table
Message-Id: <Xns96097FDC1C9Fcastleamber@130.133.1.4>

Anno Siegel wrote:

> John Bokma  <postmaster@castleamber.com> wrote in comp.lang.perl.misc:
>> Anno Siegel wrote:
>> 
>> > John Bokma  <postmaster@castleamber.com> wrote in
>> > comp.lang.perl.misc: 
>> >> Tassilo v. Parseval wrote:
>> >> 
>> >> > Also sprach John Bokma:
>> >> 
>> >> > Yet, the number of those bits (as
>> >> > you put it) has no bearing on the capacity of a hash. You could
>> >> > use a hash function that only returns 2bit-wide numbers and
>> >> > still store an amount of items only limited by the available
>> >> > memory in the hash. 
>> >> 
>> >> Yes, but than one ends up with a hash table with O(n) look up time
>> >> :-) So if the hash function is limited to n bits there is a point
>> >> that the hash table acts more like 2^n big lists instead of a hash
>> >> table. 
>> > 
>> > That's no contradiction.  A hash of size k (with this kind of
>> > collision management) *is* a way to distribute a long list of
>> > length n over k lists of average length n/k, no more, no less. 
>> > Keeping the average length <= 1 is an option, but not the only way
>> > to run a hash. 
>> 
>> I am more than aware of that, (they teach those things in Utrecht,
>> you know 
> 
> Hey, what's wrong?  It's a public discussion.  Some readers may
> appreciate an explicit argument.

Yup, but it sounded to me a bit like that I had no clue how a hash table 
works :-D So apologies if I read it wrong.

>> ;-) ). I didn't state it was a contradiction, but only that O(n) hash
>> look up is not what I want out of a hash table.
>>
>> I am happy with constant avg length of c, and hence O(1) look up.
> 
> Fine.  My point is that there are useful applications of hash tables
> also in the O(n) range.

Uhm, like? (Ok, memory stress testing is one).

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

Date: Sun, 27 Feb 2005 00:40:45 +0200
From: Leslie Viljoen <leslievNO@SPAMicoc.co.za>
Subject: Re: OOP Tutorial
Message-Id: <yP6dneHaoI9nZ73fRVn-oA@is.co.za>

Bart Lateur wrote:
> Abigail wrote:
> 
> 
>>//  We must bow to the demands of the masses:
>>//  http://www.icon.co.za/~mobeus/easyoop.pdf.zip
>>
>>
>>wget failed to get it, repeatedly. Timeouts.
> 
> 
> It must have been due to high popularity.  ;-)
> 
> No, actually, I can't even connect to <http://www.icon.co.za/>.
> 
> DNS finds it, as [196.41.128.101] AKA mercedes.worldonline.co.za, but
> ping times out.
> 

My service provider has been known to have a fairly useless web server.
Here is a better location:
http://www.acesonline.org.za/easyoop.pdf.zip

Hope you'll download it after all this! Sorry for the hassles.

Leslie


------------------------------

Date: 26 Feb 2005 17:22:13 GMT
From: xhoster@gmail.com
Subject: Re: Performance questions (SQL-statements)
Message-Id: <20050226122213.257$S7@newsreader.com>

PietLaroy@hotmail.com (Piet L.) wrote:
>
> To illustrate the problem:
> - here is an exctracting out of the database:
>         BOOK
>         book_id
>         title
>         publication_date
>
>         BOOK_AUTHOR
>         book_id
>         person_id
>
>         LIST_AUTHORS
>         person_id
>         name
>         firstname
>         email
>
> - here is an example of the query I execute:
>         " show all the books written by author 124"
>         (Remark: a book can have more than one author
>          So I want something like:
>                 book_title 1
>                         author1_name, author2_name
>                 book_title 2
>                         author3_name, author1_name, author3_name,
>         author4_name )
>
>         The query is:
>         "SELECT b.*, ba.* from book b, book_author ba
>          LEFT JOIN list_authors l
>          ON ba.person_id = l.person_id
>          WHERE b.book_id = ba.book_id
>          AND ba.person_id = 124"

Almost never should you use b.* notation in production code.  Spell
out the columns that you want.

Why do you think the left join is necessary?  Indeed, why is any join
against list_authors necessary when you never retrieve any of the fields
on that table?


> The problem is thus that this takes (some) minutes to execute all of
> this (even if there are a few records as result),
> I think the problem is with the JOIN, but I am not sure.

If you think your problem is with your join (which is executed on MySQL),
and not with your Perl, then why did you post it to a Perl group?


> Also a question extra, Should I use CGI or isn't this neccessary?

It is not *necessary*, but it is not clear what you think the alternative
to using it would be.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: Sun, 27 Feb 2005 04:25:58 GMT
From: "IRR" <iotarhorho@REM0VEhotmail.com>
Subject: Perl web design
Message-Id: <qZbUd.7502$OU1.2287@newssvr21.news.prodigy.com>

May not be a well posed question, but I thought I'd give it a try....

I've been programming in Perl for some time, pretty applied stuff though, 
and I've recently started becoming interested in website design.  I'm 
interested in examples or ideas of how to use Perl to make a better website, 
i.e. are there things I can do with a website knowing a good bit about Perl 
that I might not be able to do otherwise?  Can anyone recommend maybe 
example websites and/or a few good books or online tutorials for getting my 
feet wet?




------------------------------

Date: Sat, 26 Feb 2005 22:42:35 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Pure Perl OpenSSL Library
Message-Id: <opqdnfFo55nHZr3fRVnyvQ@pipex.net>

Marc wrote:
 >
> This will be behind an Apache server. I first wrote the test system
> using Python, but Perl is widely used here, so I must use it ;)

    You missed my point.  Perl is an option, not a requirement.

>>    My suspicion is that if you are worried about the cost of forking
>>then you're looking at the wrong thing.
>..... 
> You are right. But if I just want to get some some field from the
> certificates, forking is a bit heavy for this... But I will investigate
> this. Thanks for the remark ;)

    Forking isn't *that* heavy.  However, modules such as IO::Socket::SSL 
do certificate verification, so perhaps you could look through that to see 
how it does it?  Presumably to verify it it must look at the certificate 
fields.

> 
> Yes, but if you read the openssl manual, you will se that this is some
> sort of 'demo' tool not intended to but used for a CA...

    You could make it so with a little work....

>                                                          It is not
> locking the cert db,

    So, write a simple Perl module which does this before calling openssl....

>                       return status not very easy to use in script (must
> read stderr to see if the certificate has been added for example)

    ...and which then parses stderr and returns the status.

>                                 I thought maybe someone did such a
> lib, as it is possible to find all sort of thing in Perl... why not?

    Waiting for someone to do it?  Are you volunteering?


-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.


------------------------------

Date: 26 Feb 2005 18:41:16 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: sequences of numbers
Message-Id: <Xns96098110EF8A1castleamber@130.133.1.4>

Big Daddy wrote:

> If I have an array that has elements of the following form
> 
> 
> #!usr/bin/perl
> 
> my @array;
> 
> $array[0] = "0 1 2 3 4 4 5";
> 
> $array[1] = "0 2 2 2 3 4 5";
> 
> $array[2] = "0 2 2 2 2 3 4";
> 
> $array[3] = "0 2 6 8 9 10 12";
> 
> How would I get rid of any elements of the array that have 4 or more 
> adjacent alike elements?  For example, in the above array, I would
> want to get rid of element 2 because it has the number 2 in 4 adjecent
> elements. 

use strict;
use warnings;

my @array;

$array[0] = "0 1 2 3 4 4 5";

$array[1] = "0 2 2 2 3 4 5";

$array[2] = "0 2 2 2 2 3 4";

$array[3] = "0 2 6 8 9 10 12";


s/(\d+) (\1( ?))+/$1$3/g for @array;
print map { "[$_]\n" } @array;

[0 1 2 3 4 5]
[0 2 3 4 5]
[0 2 3 4]
[0 2 6 8 9 10 12]

seems to work, no idea if it's fool proof.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

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:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#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 V10 Issue 7835
***************************************


home help back first fref pref prev next nref lref last post