[28847] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 91 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 31 18:06:23 2007

Date: Wed, 31 Jan 2007 15:05:11 -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           Wed, 31 Jan 2007     Volume: 11 Number: 91

Today's topics:
    Re: French Accents appear incorrectly... (Marc Espie)
        How to pass array from java to perl using inline java <songtao32@gmail.com>
    Re: How to pass array from java to perl using inline ja usenet@DavidFilmer.com
    Re: How to pass array from java to perl using inline ja <DJStunks@gmail.com>
    Re: How to pass array from java to perl using inline ja <songtao32@gmail.com>
    Re: How to pass array from java to perl using inline ja <anedza@infotek-consulting.com>
    Re: How to pass array from java to perl using inline ja <DJStunks@gmail.com>
    Re: How to start some file as Perl script argument? <max@xxx.tovle.ct>
    Re: How to start some file as Perl script argument? <RedGrittyBrick@SpamWeary.foo>
        Module for Sending Keystrokes FeelLikeANut@gmail.com
    Re: Module for Sending Keystrokes <attn.steven.kuo@gmail.com>
    Re: Passing results from sub class of html::parser <bik.mido@tiscalinet.it>
    Re: Passing results from sub class of html::parser <g.h.vandoorn@gmail.com>
    Re: Regular Expression help! <sukesh@zoom.co.uk>
    Re: Regular Expression help! <mritty@gmail.com>
    Re: Regular Expression help! <bik.mido@tiscalinet.it>
    Re: Regular Expression help! <sukesh@zoom.co.uk>
    Re: Regular Expression help! <mritty@gmail.com>
    Re: sort an array unique. <mritty@gmail.com>
    Re: sort an array unique. <rs@474.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 31 Jan 2007 16:49:21 +0000 (UTC)
From: espie@lain.home (Marc Espie)
Subject: Re: French Accents appear incorrectly...
Message-Id: <epqhah$2gjt$1@biggoron.nerim.net>

In article <1170094168.515493.256380@v33g2000cwv.googlegroups.com>,
gf <greg.ferguson@icrossing.com> wrote:
>OK, first, did you EMBED the accented characters, or did you let 
>Dreamweaver do the RIGHT thing and use HTML entities?

>If you embedded the high-bit-set characters, or used the ALT+number 
>method of entering an accented character... I'm all for having you 
>flogged, because that creates a real mess. But it's easily fixed. Just 
>tell Dreamweaver to convert the characters to HTML entities and resave 
>the file. And, then, never, EVER directly enter accented characters 
>again.

Nonsense, unicode in web pages is just fine, has been for ages. If anything,
you just want to declare the right encoding in your headers.


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

Date: 31 Jan 2007 09:27:04 -0800
From: "songtao32@gmail.com" <songtao32@gmail.com>
Subject: How to pass array from java to perl using inline java
Message-Id: <1170264424.571962.216740@k78g2000cwa.googlegroups.com>

Hi,

     I try to pass a float[ ] [ ] array from inline java to perl. I
assign the java array to a perl list variable but it doesn't work. Any
suggestions?

    Thanks for help!

     Regards,

     Tom



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

Date: 31 Jan 2007 09:47:38 -0800
From: usenet@DavidFilmer.com
Subject: Re: How to pass array from java to perl using inline java
Message-Id: <1170265658.261696.9850@m58g2000cwm.googlegroups.com>

On Jan 31, 9:27 am, "songta...@gmail.com" <songta...@gmail.com> wrote:
[a multiposted question]

Please don't multipost.  It is considered bad usenet ettiquette.


--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)



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

Date: 31 Jan 2007 10:04:07 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: How to pass array from java to perl using inline java
Message-Id: <1170266646.939103.117950@j27g2000cwj.googlegroups.com>

On Jan 31, 10:27 am, "songta...@gmail.com" <songta...@gmail.com>
wrote:
> Hi,
>
>      I try to pass a float[ ] [ ] array from inline java to perl. I
> assign the java array to a perl list variable but it doesn't work. Any
> suggestions?

please post a short, but complete script which demonstrates the
issue.  have you read the posting guidelines for this group?

-jp



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

Date: 31 Jan 2007 10:50:26 -0800
From: "songtao32@gmail.com" <songtao32@gmail.com>
Subject: Re: How to pass array from java to perl using inline java
Message-Id: <1170269425.995418.239320@v45g2000cwv.googlegroups.com>

Hi,

     Sorry for the multipost.  I apologize.

     Here is the script that I try to run:

*****************************************************
     use Inline Java => <<'EOJ';
    public class TestJavaClass
{

        public float[ ] [ ]  returnArrayData(){
                 .
                 .
                 .
                 return ArrayData[m][n];
	}
}

EOJ

my @mylist =  TestJavaClass. returnArrayData();

print "$mylist[0]";

*****************************************************

I got the following output:

Inline::Java::Array=ARRAY(0xa52e234)

Thanks for your help!

Regards,

Tom








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

Date: 31 Jan 2007 11:45:24 -0800
From: "Andy" <anedza@infotek-consulting.com>
Subject: Re: How to pass array from java to perl using inline java
Message-Id: <1170272723.868006.59190@j27g2000cwj.googlegroups.com>

According to the output you've posted, you've succeeded.  Perl is
reporting you have an array of pointers to other arrays of numbers.
The question now is how to read the contents of the arrays that were
returned from java.

All languages do not store their numbers in the same way, so the way a
floating point number is stored in Java may not be compatible with the
way Perl stores it.  The IEEE defines a standard format for
representing floating point numbers in memory.

If both Perl and Java are IEEE compliant for floating point numbers,
you should have little translation problems between the two languages
(in that if you experiment with the different ways of using arrays in
Perl, one of them should automatically work with what Java returned).
Sorry, I don't know if Perl is IEEE compliant, although I know Java
is.

>
> Inline::Java::Array=ARRAY(0xa52e234)
>





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

Date: 31 Jan 2007 11:58:27 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: How to pass array from java to perl using inline java
Message-Id: <1170273507.395075.309900@k78g2000cwa.googlegroups.com>

On Jan 31, 11:50 am, "songta...@gmail.com" <songta...@gmail.com>
wrote:
> Hi,
>
>      Sorry for the multipost.  I apologize.
>
>      Here is the script that I try to run:
>
> *****************************************************
>      use Inline Java => <<'EOJ';
>     public class TestJavaClass
> {
>
>         public float[ ] [ ]  returnArrayData(){
>                  .
>                  .
>                  .
>                  return ArrayData[m][n];
>         }
>
> }
>
> EOJ
>
> my @mylist =  TestJavaClass. returnArrayData();
>
> print "$mylist[0]";
>
> *****************************************************
>
> I got the following output:
>
> Inline::Java::Array=ARRAY(0xa52e234)

When you respond on this list you're asked to quote the attribution
and some appropriate context.  Also this script does not look
"complete".

Anyway, you've said your problem is accessing a 2D array, so why are
you only printing the first dimension?  In fact, when you do, Perl is
telling you that that first dimension is itself made up of an array.
This is as it should be.

If you're passing a 2D array, you need to access it in two dimensions.

  print $mylist[0][0];

for instance should work, but I'm unable to verify it.

-jp

PS: read perldoc -q vars



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

Date: Wed, 31 Jan 2007 20:43:29 +0100
From: "max" <max@xxx.tovle.ct>
Subject: Re: How to start some file as Perl script argument?
Message-Id: <epqrgo$hrn$1@ss408.t-com.hr>

No! I want start perl script with XLS document as argument.
Start in CMD with typing perl script.pl someexcel.xls is normaly work,
I want star it with click on Excel document, How to do it in Windows OS?


> > How to start some file as Perl script argument?
>
>
> What does "start some file" mean when you say it?
>
> You cannot "start" an Excel file because it is not executable.
>
>
> > How to start it as
> > perlscript.pl someexcel.xls
>
>
> You run this command line:
>
>    perlscript.pl someexcel.xls
>
>
> If you instead meant that you want to run an external program, such
> as Excel, then you should have asked how to run an external program.
>
> The answer given in this FAQ:
>
>    perldoc -q external
>
> outlines the three basic ways of running external commands.
>
>
> -- 
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: Wed, 31 Jan 2007 20:44:27 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: How to start some file as Perl script argument?
Message-Id: <c5idnXnvEfc4Yl3YRVnyhQA@bt.com>

I've corrected your top-posting. Please don't top-post, write your below 
BELOW the text you are replying to and trim any non-relevant material 
from the quotation. If you don't do this you'll annoy many of the people 
you want to get help from.

max wrote:
>>> How to start some file as Perl script argument?
>>> How to start it as
>>> perlscript.pl someexcel.xls
>>
>> You run this command line:
>>
>>    perlscript.pl someexcel.xls
>>
> No! I want start perl script with XLS document as argument.
> Start in CMD with typing perl script.pl someexcel.xls is normaly work,
> I want star it with click on Excel document, How to do it in Windows OS?

In windows you do it by making a file association. This question would 
have been best asked in a Windows newsgroup or forum.

See <http://support.microsoft.com/kb/307859>


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

Date: 31 Jan 2007 08:20:19 -0800
From: FeelLikeANut@gmail.com
Subject: Module for Sending Keystrokes
Message-Id: <1170260416.799064.105970@p10g2000cwp.googlegroups.com>

I want to control another program through its GUI -- for instance,
using ALT to access menus and using TAB to move between form controls.
I searched CPAN a bit, but I didn't find what I need. Does anyone have
any suggestions or recommendations?



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

Date: 31 Jan 2007 08:44:42 -0800
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Module for Sending Keystrokes
Message-Id: <1170261882.788762.218770@a75g2000cwd.googlegroups.com>

On Jan 31, 8:20 am, FeelLikeA...@gmail.com wrote:
> I want to control another program through its GUI -- for instance,
> using ALT to access menus and using TAB to move between form controls.
> I searched CPAN a bit, but I didn't find what I need. Does anyone have
> any suggestions or recommendations?



You may have overlooked Win32::GuiTest and X11::GUITest.
Both modules are available from CPAN.

--
Hope this helps,
Steven




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

Date: Wed, 31 Jan 2007 17:29:26 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Passing results from sub class of html::parser
Message-Id: <jog1s2l60j01emsmd2upvp8n33blvkd909@4ax.com>

On 31 Jan 2007 06:06:35 -0800, "Gerwin" <g.h.vandoorn@gmail.com>
wrote:

>What am I doing wrong here?
>
>package MyParser;
>use base qw(HTML::Parser);
>
>my %vars = (
>   text_output         => undef
>);
>
>sub text {
>	my ($self, $text) = @_;
>	$vars->{'text_output'} = $text;
>}
>
>sub getTextOutput {
>	return $vars->{'text_output'};
>}
>
>package main;
>use LWP::Simple;
>
>my $parser = MyParser->new;
>
>my $url = @ARGV[0];
>
>my $html = get $url; die "Couldn't get $url" unless defined $html;
>
>$parser->parse( $html );
>$parser->eof;
>print $parser->getTextOutput();

I don't see anything that would put in $MyParser::vars{text_output}
the parsed text. I suppose you may want to implement a parse() method
that would call the base class one AND cache it there. But in any
case, do you really want the cached info to be the same across each
MyParser object?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 31 Jan 2007 10:21:04 -0800
From: "Gerwin" <g.h.vandoorn@gmail.com>
Subject: Re: Passing results from sub class of html::parser
Message-Id: <1170267664.147555.129530@h3g2000cwc.googlegroups.com>

On Jan 31, 5:29 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On 31 Jan 2007 06:06:35 -0800, "Gerwin" <g.h.vando...@gmail.com>
> wrote:
>
>
>
> >What am I doing wrong here?
>
> >package MyParser;
> >use base qw(HTML::Parser);
>
> >my %vars = (
> >   text_output         => undef
> >);
>
> >sub text {
> >    my ($self, $text) = @_;
> >    $vars->{'text_output'} = $text;
> >}
>
> >sub getTextOutput {
> >    return $vars->{'text_output'};
> >}
>
> >package main;
> >use LWP::Simple;
>
> >my $parser = MyParser->new;
>
> >my $url = @ARGV[0];
>
> >my $html = get $url; die "Couldn't get $url" unless defined $html;
>
> >$parser->parse( $html );
> >$parser->eof;
> >print $parser->getTextOutput();
>
> I don't see anything that would put in $MyParser::vars{text_output}
> the parsed text. I suppose you may want to implement a parse() method
> that would call the base class one AND cache it there. But in any
> case, do you really want the cached info to be the same across each
> MyParser object?
>
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Hmm well the "text" sub routine is called and i figured that if i
stored the parsed text in an extra variable, you could retrieve it
with that get sub routine. I do not know what the best method is for
doing this. I just find it weird that assigning a string to "$vars-
>{'text_output'} = "bladiebla";" will return "bladiebla" but assigning
the value "$text" doesn't. Who can shine a light on this?



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

Date: 31 Jan 2007 08:10:53 -0800
From: "Suk" <sukesh@zoom.co.uk>
Subject: Re: Regular Expression help!
Message-Id: <1170259853.392452.13400@l53g2000cwa.googlegroups.com>

Sorry I meant  -

open CSVFILE, "data.csv" or die "failed to open changes $!";

while (<CSVFILE>) {

        print "$`$3/$2/$1$'" if (/(\d{2})\/(\d{2})\/(\d{4})/);

}

Which just alters the first date- I need to alter all of them



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

Date: 31 Jan 2007 08:16:35 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Regular Expression help!
Message-Id: <1170260195.241796.19800@k78g2000cwa.googlegroups.com>

On Jan 31, 11:10 am, "Suk" <suk...@zoom.co.uk> wrote:
> Sorry I meant  -
>
> open CSVFILE, "data.csv" or die "failed to open changes $!";
>
> while (<CSVFILE>) {
>
>         print "$`$3/$2/$1$'" if (/(\d{2})\/(\d{2})\/(\d{4})/);
>
> }
>
> Which just alters the first date- I need to alter all of them

So change your pattern-match-within-an-if to s///g, and print the
results.
s/(\d{2})\/(\d{2})\/(\d{4})/$3/$2/$1/g;
print;

Paul Lalli



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

Date: Wed, 31 Jan 2007 17:33:03 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Regular Expression help!
Message-Id: <n0h1s25b8um47osfr9q0g2kfdnd6iao0nt@4ax.com>

On Wed, 31 Jan 2007 16:07:16 +0100, Josef Moellers
<josef.moellers@fujitsu-siemens.com> wrote:

>Subject: Re: Regular Expression help!

Not necessarily!

>> Look at the excerpt from a CSV file below

Text::CSV_XS, or similar...


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 31 Jan 2007 09:44:45 -0800
From: "Suk" <sukesh@zoom.co.uk>
Subject: Re: Regular Expression help!
Message-Id: <1170265485.277602.128480@v33g2000cwv.googlegroups.com>

Thanks Paul, your suggestion has worked - dont why i never thought of
it earlier!!


Unfortunately I'm not allowed to use non-standard perl modules so
Text::CSV_XS wont help.



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

Date: 31 Jan 2007 09:49:31 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Regular Expression help!
Message-Id: <1170265771.247086.38600@h3g2000cwc.googlegroups.com>

On Jan 31, 11:16 am, "Paul Lalli" <mri...@gmail.com> wrote:
> On Jan 31, 11:10 am, "Suk" <suk...@zoom.co.uk> wrote:
>
> > Sorry I meant  -
>
> > open CSVFILE, "data.csv" or die "failed to open changes $!";
>
> > while (<CSVFILE>) {
>
> >         print "$`$3/$2/$1$'" if (/(\d{2})\/(\d{2})\/(\d{4})/);
>
> > }
>
> > Which just alters the first date- I need to alter all of them
>
> So change your pattern-match-within-an-if to s///g, and print the
> results.
> s/(\d{2})\/(\d{2})\/(\d{4})/$3/$2/$1/g;
> print;

Ugh.  Gotta escape those last two slashes...

s/(\d{2})\/(\d{2})\/(\d{4})/$3\/$2\/$1/g;

Or, preferably, just stop using / as your delimiter in the s/// :

s!(\d{2})/(\d{2})/(\d{4})!$3/$2/$1!g;

Paul Lalli




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

Date: 31 Jan 2007 08:21:28 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: sort an array unique.
Message-Id: <1170260488.363851.43870@l53g2000cwa.googlegroups.com>

On Jan 31, 10:43 am, Robert 'phaylon' Sedlacek <r...@474.at> wrote:
> Paul Lalli wrote:
> > On Jan 31, 9:23 am, "rajendra" <rajendra.pra...@in.bosch.com> wrote:
> >> Is there any command to sort an array uniquelly,something similar to
> >> "sort -u" in unix.
>
> > Not built-in, but it's fairly easy to implement:
>
> JFYI, it's also in List::MoreUtils as 'uniq'.
>
> http://search.cpan.org/dist/List-MoreUtils/lib/List/MoreUtils.pm

Huh, so it is.  For some reason, I'd forgotten about that.  So my
short example gets even further reduced to:
$ perl -MList::MoreUtils=uniq -le'
my @unsorted_with_dups = qw/d a e c b e d a c b e a b c e d/;
my @sorted_uniques = sort(uniq(@unsorted_with_dups));
print "@sorted_uniques\n";
'
a b c d e

Thanks for the reminder,
Paul Lalli



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

Date: Wed, 31 Jan 2007 17:42:21 +0100
From: Robert 'phaylon' Sedlacek <rs@474.at>
Subject: Re: sort an array unique.
Message-Id: <45c0c6ed$0$30317$9b4e6d93@newsspool1.arcor-online.net>

Paul Lalli wrote:

> $ perl -MList::MoreUtils=uniq -le'
> [...]
> Thanks for the reminder,

No problem. I just learned how to import() via -M from you, so we're quid :)

-- 
# Robert 'phaylon' Sedlacek
# Perl 5/Catalyst Developer in Hamburg, Germany
{ EMail => ' rs@474.at ', Web => ' http://474.at ' }


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

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 91
*************************************


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