[30665] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1910 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 9 09:09:49 2008

Date: Thu, 9 Oct 2008 06:09:18 -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           Thu, 9 Oct 2008     Volume: 11 Number: 1910

Today's topics:
    Re: ($x == ($y or $z)) same as (($x==$y) or ($x==$z)) ? <willem@stack.nl>
    Re: Date Problem <graham.stow@gmail.com>
    Re: Date Problem <jurgenex@hotmail.com>
        How to make all available CPU resource to Perl/MySQL in <evillen@gmail.com>
    Re: How to make all available CPU resource to Perl/MySQ <joost@zeekat.nl>
    Re: How to make all available CPU resource to Perl/MySQ <evillen@gmail.com>
    Re: How to make all available CPU resource to Perl/MySQ <bugbear@trim_papermule.co.uk_trim>
    Re: How to make all available CPU resource to Perl/MySQ <evillen@gmail.com>
        new CPAN modules on Thu Oct  9 2008 (Randal Schwartz)
    Re: Parsing CSV and "&nbsp;&nbsp;" <josef.moellers@fujitsu-siemens.com>
    Re: update XML file with perl or other...? <waveright@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 9 Oct 2008 06:45:45 +0000 (UTC)
From: Willem <willem@stack.nl>
Subject: Re: ($x == ($y or $z)) same as (($x==$y) or ($x==$z)) ???
Message-Id: <slrngera4p.2js3.willem@snail.stack.nl>

Jim Gibson wrote:
) Because Perl is not English. I can't think of any computer language
) that will parse '($x == ($y or $z))' as '(($x==$y) or ($x==$z));'. 

Perl 6 perhaps ?  :-)


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT


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

Date: Thu, 9 Oct 2008 09:13:51 +0100
From: "Graham Stow" <graham.stow@gmail.com>
Subject: Re: Date Problem
Message-Id: <gcked8$21h5$1@energise.enta.net>

My logic is that, when the value of <$todays_date> changes, it will because 
it will have become tomorrow's date, and will not equal <$date> anymore. So 
then assign the value of <$todays_date> to <$date> and do something.

"Eric Pozharski" <whynot@pozharski.name> wrote in message 
news:unnvr5x9km.ln2@carpet.zombinet...
> Graham Stow <graham.stow@gmail.com> wrote:
> *SKIP*
>>     if ($date ne $todays_date) {
>>          $date= $todays_date;
>>         do something.....
>>     }
>
> That "does something" because I<$date> is not equal to I<$todays_date>.
>
> *CUT*
>
> Surely you're interested why condition succedes? 




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

Date: Thu, 09 Oct 2008 02:09:57 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Date Problem
Message-Id: <2eire4lh49adbbkrhimq252914ajspc3vt@4ax.com>

"Graham Stow" <graham.stow@gmail.com> wrote:
>My logic is that, when the value of <$todays_date> changes, it will because 
>it will have become tomorrow's date, and will not equal <$date> anymore. So 
>then assign the value of <$todays_date> to <$date> and do something.

So you want to do something once every day,right?

There are tasks Perl is good at and there are tasks other tools are
custom made for. For this application a cron job seems to be much better
choice.

jue


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

Date: Thu, 9 Oct 2008 01:47:12 -0700 (PDT)
From: "evillen@gmail.com" <evillen@gmail.com>
Subject: How to make all available CPU resource to Perl/MySQL in Win XP?
Message-Id: <c6908964-f513-4293-b2e9-3b735f4bfa69@a18g2000pra.googlegroups.com>

Hi

Sorry that this isn't really a 'Perl' problem, although there may be a
Perl solution...

I am developing a Perl & MySQL application - the problem I have is
that the program takes a while to run and yet when I look at the CPU
utilisation (with SysInternals Process Explorer) I see that the
programs Perl.exe & mysqld-nt.exe are barely using 2% of CPU each.

I have used the SysInternals Process Explorer's "Set Priority" feature
& set both .exe's to Realtime24 but this had negligible effect.

How can I force the .exe's to make better use of the CPU?

Thanks for any helpful suggestions

NJH


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

Date: Thu, 09 Oct 2008 10:53:31 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: How to make all available CPU resource to Perl/MySQL in Win XP?
Message-Id: <87ej2qup2s.fsf@zeekat.nl>

"evillen@gmail.com" <evillen@gmail.com> writes:

> I have used the SysInternals Process Explorer's "Set Priority" feature
> & set both .exe's to Realtime24 but this had negligible effect.
>
> How can I force the .exe's to make better use of the CPU?

You want a different algorithm so that you're not waiting on network IO
/ disc IO / other system calls / file locks / database locks.

 

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


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

Date: Thu, 9 Oct 2008 02:49:14 -0700 (PDT)
From: "evillen@gmail.com" <evillen@gmail.com>
Subject: Re: How to make all available CPU resource to Perl/MySQL in Win XP?
Message-Id: <e11fd348-7425-4c95-8cee-6bf0590476a9@s1g2000prg.googlegroups.com>

On 9 Oct, 09:53, Joost Diepenmaat <jo...@zeekat.nl> wrote:
> "evil...@gmail.com" <evil...@gmail.com> writes:
> > I have used the SysInternals Process Explorer's "Set Priority" feature
> > & set both .exe's to Realtime24 but this had negligible effect.
>
> > How can I force the .exe's to make better use of the CPU?
>
> You want a different algorithm so that you're not waiting on network IO
> / disc IO / other system calls / file locks / database locks.
>
> --
> Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/

Can you recommend some way of detecting these 'gating processes' or
'locks'?

There is no Network IO & minimal Disk IO required by my program &
there shouldn't be any files locked as it's all single user & local
resources.

When I look at Process Explorer I can't see that any other process
hogging the CPU/RAM etc.

Thanks


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

Date: Thu, 09 Oct 2008 11:03:06 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: How to make all available CPU resource to Perl/MySQL in Win XP?
Message-Id: <tcWdnbrkvdRHS3DVnZ2dnUVZ8gydnZ2d@posted.plusnet>

evillen@gmail.com wrote:
> On 9 Oct, 09:53, Joost Diepenmaat <jo...@zeekat.nl> wrote:
>> "evil...@gmail.com" <evil...@gmail.com> writes:
>>> I have used the SysInternals Process Explorer's "Set Priority" feature
>>> & set both .exe's to Realtime24 but this had negligible effect.
>>> How can I force the .exe's to make better use of the CPU?
>> You want a different algorithm so that you're not waiting on network IO
>> / disc IO / other system calls / file locks / database locks.
>>
>> --
>> Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/
> 
> Can you recommend some way of detecting these 'gating processes' or
> 'locks'?
> 
> There is no Network IO & minimal Disk IO required by my program &
> there shouldn't be any files locked as it's all single user & local
> resources.
> 
> When I look at Process Explorer I can't see that any other process
> hogging the CPU/RAM etc.

Interesting - I wonder if there is a LOT of overhead
in the communication BETWEEN your two processes?

   BugBear


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

Date: Thu, 9 Oct 2008 03:18:38 -0700 (PDT)
From: "evillen@gmail.com" <evillen@gmail.com>
Subject: Re: How to make all available CPU resource to Perl/MySQL in Win XP?
Message-Id: <c3c9e35f-4d00-4a5c-b949-a6ef67ab7393@b2g2000prf.googlegroups.com>

On 9 Oct, 11:03, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
> evil...@gmail.com wrote:
> > On 9 Oct, 09:53, Joost Diepenmaat <jo...@zeekat.nl> wrote:
> >> "evil...@gmail.com" <evil...@gmail.com> writes:
> >>> I have used the SysInternals Process Explorer's "Set Priority" featur=
e
> >>> & set both .exe's to Realtime24 but this had negligible effect.
> >>> How can I force the .exe's to make better use of the CPU?
> >> You want a different algorithm so that you're not waiting on network I=
O
> >> / disc IO / other system calls / file locks / database locks.
>
> >> --
> >> Joost Diepenmaat | blog:http://joost.zeekat.nl/|work:http://zeekat.nl/
>
> > Can you recommend some way of detecting these 'gating processes' or
> > 'locks'?
>
> > There is no Network IO & minimal Disk IO required by my program &
> > there shouldn't be any files locked as it's all single user & local
> > resources.
>
> > When I look at Process Explorer I can't see that any other process
> > hogging the CPU/RAM etc.
>
> Interesting - I wonder if there is a LOT of overhead
> in the communication BETWEEN your two processes?
>
> =A0 =A0BugBear

Hi Bugbear - do you have any suggestions about how I could determine/
measure the overhead required between Perl & MySQL?


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

Date: Thu, 9 Oct 2008 04:42:21 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Oct  9 2008
Message-Id: <K8GFqL.32x@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

AUBBC-2.0
http://search.cpan.org/~sflex/AUBBC-2.0/
----
App-Hachero-0.01_01
http://search.cpan.org/~danjou/App-Hachero-0.01_01/
a plaggable log analyzing framework 
----
App-sh2p-0.04
http://search.cpan.org/~clive/App-sh2p-0.04/
Perl program to aid for conversion from UNIX shell to Perl 
----
Audio-Ecasound-Multitrack-0.973
http://search.cpan.org/~ganglion/Audio-Ecasound-Multitrack-0.973/
Perl libraries for multitrack audio processing using the Ecasound signal-processing engine. 
----
Bio-GMOD-GenericGenePage-0.11
http://search.cpan.org/~scain/Bio-GMOD-GenericGenePage-0.11/
Generic GMOD gene page base class 
----
Business-MaxMind-1.48
http://search.cpan.org/~borisz/Business-MaxMind-1.48/
----
CGI-Ajax-0.707
http://search.cpan.org/~bpederse/CGI-Ajax-0.707/
a perl-specific system for writing Asynchronous web applications 
----
CGI-Compress-Gzip-1.01
http://search.cpan.org/~cdolan/CGI-Compress-Gzip-1.01/
CGI with automatically compressed output 
----
Cache-CacheFactory-1.08_01
http://search.cpan.org/~sgraham/Cache-CacheFactory-1.08_01/
factory class for Cache::Cache and other modules. 
----
Catalyst-Authentication-Credential-Flickr-0.04
http://search.cpan.org/~blom/Catalyst-Authentication-Credential-Flickr-0.04/
Flickr authentication for Catalyst 
----
Catalyst-Model-WebService-Solr-0.01
http://search.cpan.org/~bricas/Catalyst-Model-WebService-Solr-0.01/
Use WebService::Solr in your Catalyst application 
----
Class-Accessor-Constructor-0.06
http://search.cpan.org/~marcel/Class-Accessor-Constructor-0.06/
constructor generator 
----
Crypt-Skip32-Base64URLSafe-0.33
http://search.cpan.org/~lbrocard/Crypt-Skip32-Base64URLSafe-0.33/
Create URL-safe encodings of 32-bit values 
----
Data-Pack-0.01
http://search.cpan.org/~marcel/Data-Pack-0.01/
pack data structures so only real content remains 
----
Data-Page-2.01
http://search.cpan.org/~lbrocard/Data-Page-2.01/
help when paging through sets of results 
----
Data-Peek-0.20
http://search.cpan.org/~hmbrand/Data-Peek-0.20/
A collection of low-level debug facilities 
----
Data-UUID-Base64URLSafe-0.33
http://search.cpan.org/~lbrocard/Data-UUID-Base64URLSafe-0.33/
URL-safe UUIDs 
----
Date-EzDate-1.11
http://search.cpan.org/~miko/Date-EzDate-1.11/
Date and time manipulation made easy 
----
DateTime-Stringify-4.11
http://search.cpan.org/~lbrocard/DateTime-Stringify-4.11/
DateTime objects (no longer needed) 
----
Devel-NYTProf-2.05
http://search.cpan.org/~timb/Devel-NYTProf-2.05/
Powerful feature-rich perl source code profiler 
----
Dist-Zilla-1.002
http://search.cpan.org/~rjbs/Dist-Zilla-1.002/
distribution builder; installer not included! 
----
Doc-Simply-0.02
http://search.cpan.org/~rkrimen/Doc-Simply-0.02/
Generate POD-like documentation from embedded comments in JavaScript, Java, C, C++ source 
----
Exception-Base-0.18
http://search.cpan.org/~dexter/Exception-Base-0.18/
Lightweight exceptions 
----
Exception-System-0.10
http://search.cpan.org/~dexter/Exception-System-0.10/
The exception class for system or library calls 
----
Geo-Direction-Name-0.0.3
http://search.cpan.org/~kokogiko/Geo-Direction-Name-0.0.3/
Transform direction name and degree each other. 
----
Geo-Formatter-0.0.1
http://search.cpan.org/~kokogiko/Geo-Formatter-0.0.1/
Encode / decode latitude & longitude in degree to / from other format 
----
Google-Chart-0.05008
http://search.cpan.org/~dmaki/Google-Chart-0.05008/
Interface to Google Charts API 
----
HTTP-MobileAgent-Plugin-Location-0.0.5
http://search.cpan.org/~kokogiko/HTTP-MobileAgent-Plugin-Location-0.0.5/
Add location fuctions to HTTP::MobileAgent 
----
Kx-0.037
http://search.cpan.org/~markpf/Kx-0.037/
Perl extension for Kdb+ http://kx.com 
----
LCFG-Build-Tools-0.0.40
http://search.cpan.org/~sjquinney/LCFG-Build-Tools-0.0.40/
LCFG software release tools 
----
Mail-IMAPClient-3.11
http://search.cpan.org/~markov/Mail-IMAPClient-3.11/
An IMAP Client API 
----
Method-Signatures-20081007
http://search.cpan.org/~mschwern/Method-Signatures-20081007/
method declarations with signatures and no source filter 
----
Method-Signatures-20081008
http://search.cpan.org/~mschwern/Method-Signatures-20081008/
method declarations with signatures and no source filter 
----
Muldis-D-0.49.0
http://search.cpan.org/~duncand/Muldis-D-0.49.0/
Formal spec of Muldis D relational DBMS lang 
----
Net-DRI-0.92
http://search.cpan.org/~pmevzek/Net-DRI-0.92/
Interface to Domain Name Registries/Registrars/Resellers 
----
Net-Interface-0.11
http://search.cpan.org/~miker/Net-Interface-0.11/
Perl extension to access network interfaces 
----
OAuth-Lite-1.13
http://search.cpan.org/~lyokato/OAuth-Lite-1.13/
OAuth framework 
----
OpenOffice-OODoc-2.104
http://search.cpan.org/~jmgdoc/OpenOffice-OODoc-2.104/
The Perl Open OpenDocument Connector 
----
OpenOffice-OODoc-2.105
http://search.cpan.org/~jmgdoc/OpenOffice-OODoc-2.105/
The Perl Open OpenDocument Connector 
----
PAR-Dist-0.37
http://search.cpan.org/~smueller/PAR-Dist-0.37/
Create and manipulate PAR distributions 
----
PICA-Record-0.38
http://search.cpan.org/~voj/PICA-Record-0.38/
Perl extension for handling PICA+ records 
----
POE-Component-SmokeBox-0.01_05
http://search.cpan.org/~bingos/POE-Component-SmokeBox-0.01_05/
POE enabled CPAN smoke testing with added value. 
----
POE-Component-SmokeBox-0.01_06
http://search.cpan.org/~bingos/POE-Component-SmokeBox-0.01_06/
POE enabled CPAN smoke testing with added value. 
----
POEIKC-0.03_01
http://search.cpan.org/~suzuki/POEIKC-0.03_01/
A framework to make a daemon or P2P with "PoCo::IKC" 
----
Parley-1.0.1
http://search.cpan.org/~chisel/Parley-1.0.1/
Message board / forum application 
----
Parse-Eyapp-1.119
http://search.cpan.org/~casiano/Parse-Eyapp-1.119/
Extensions for Parse::Yapp 
----
Parse-Eyapp-1.120
http://search.cpan.org/~casiano/Parse-Eyapp-1.120/
Extensions for Parse::Yapp 
----
RDF-Redland-Model-ExifTool-0.05
http://search.cpan.org/~arnhemcr/RDF-Redland-Model-ExifTool-0.05/
extends RDF model to process Exif meta data 
----
Rose-DBx-Object-Renderer-0.39
http://search.cpan.org/~danny/Rose-DBx-Object-Renderer-0.39/
Web UI Rendering for Rose::DB::Object 
----
Sub-ParamFrame-0.04
http://search.cpan.org/~schoejo/Sub-ParamFrame-0.04/
Supply key alias and defaults of named arguments. 
----
Test-Resub-1.04
http://search.cpan.org/~airwave/Test-Resub-1.04/
Lexically scoped subroutine replacement for testing 
----
Test-Unit-Lite-0.10
http://search.cpan.org/~dexter/Test-Unit-Lite-0.10/
Unit testing without external dependencies 
----
Test-Wiretap-1.00
http://search.cpan.org/~airwave/Test-Wiretap-1.00/
----
Text-BibTeX-0.38
http://search.cpan.org/~ambs/Text-BibTeX-0.38/
interface to read and parse BibTeX files 
----
Text-Template-Simple-0.62_01
http://search.cpan.org/~burak/Text-Template-Simple-0.62_01/
Simple text template engine 
----
Video-ZVBI-0.2.4
http://search.cpan.org/~tomzo/Video-ZVBI-0.2.4/
VBI decoding (teletext, closed caption, ...) 
----
WWW-Mechanize-Plugin-AutoWrite-0.04
http://search.cpan.org/~potyl/WWW-Mechanize-Plugin-AutoWrite-0.04/
WWW::Mechanize plugin that writes the fetched pages to the disk. 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Thu, 09 Oct 2008 08:41:34 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Parsing CSV and "&nbsp;&nbsp;"
Message-Id: <gck92r$e4j$1@nntp.fujitsu-siemens.com>

hotkitty wrote:
> I'm trying to parse the following csv file in a linux environment:
> 
> "this is row1 column0","this is row1 column1","this is row1
> column2","this is row1 column3","this
> is row1 column4"
> "this is row2 column0","this is row2 column1","this is row2
> column2","this is row2 column3","this is
> row2 column4"
> 
> Pretty standard CSV but with the last column running onto the next
> line it gets screwed up somehow as my script doesn't recognize when a
> new row starts.

A pragmatic approach:
Collect lines until you have an even number of quotes:
<untested>
my $line;
while (1) {
     $line .= <$src>;
     chomp $line;
     last if ($line =~ tr/"//) %2 == 0;
}

-- 
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html


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

Date: Wed, 8 Oct 2008 22:00:20 -0700 (PDT)
From: Todd Wade <waveright@gmail.com>
Subject: Re: update XML file with perl or other...?
Message-Id: <29082cff-04ed-49b3-9149-0c6b0e10020c@42g2000pry.googlegroups.com>

On Oct 6, 10:25=A0pm, inetquestion <inetquest...@hotmail.com> wrote:
> I have an XML document which I would like to modify based on the
> results of a test. =A0A subset of information contained in the XML file
> is shown below. =A0If a 'test' to each server:port were to fail, then
> the xml file should be modified such that the attribute 'off' is set
> to a value of 1. =A0 =A0I was thinking of doing this in perl, but would
> like to get some suggestions based on ease of modifying files, etc...
> I've written some basic perl scripts to read an xml file before, but
> ran into some confusion when trying to write them back out. =A0Any
> suggestions or pointers?
>
> ...
> ...
> <app name=3D"hokiepokie">
> =A0 =A0 <instance host=3D"server01" port=3D"8080" Off=3D"0"/>
> =A0 =A0 <instance host=3D"server02" port=3D"8081" Off=3D"0"/>
> =A0 =A0 <instance host=3D"server03" port=3D"8082" Off=3D"0"/>
> </app>
> ...
> ...
>
> -Inet

Here is a way to do it using the XML::XPath module:

use warnings;
use strict;
use XML::XPath;

my $document =3D XML::XPath->new( xml =3D> join('', <DATA>) );
my $query =3D '/app/instance';
my $instances =3D $document->find($query);

foreach my $instance ( $instances->get_nodelist ) {
  my $host =3D $instance->findvalue('./@host');
  my $port =3D $instance->findvalue('./@port');

  # conditional to decide if you want to change the Off attribute
  if ( $host eq 'server02' ) {
    $instance->getAttributeNode('Off')->setNodeValue(1);
  }
}

print $document->findnodes_as_string('/');

__DATA__
<app name=3D"hokiepokie">
    <instance host=3D"server01" port=3D"8080" Off=3D"0"/>
    <instance host=3D"server02" port=3D"8081" Off=3D"0"/>
    <instance host=3D"server03" port=3D"8082" Off=3D"0"/>
</app>


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

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 V11 Issue 1910
***************************************


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