[25486] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7730 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 3 14:05:27 2005

Date: Thu, 3 Feb 2005 11:05:15 -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           Thu, 3 Feb 2005     Volume: 10 Number: 7730

Today's topics:
    Re: "Re-run script" sub bogdan_czyz@hotmail.com
        ...How to parse search engine results fast? (VB)
    Re: ...How to parse search engine results fast? <phaylon@dunkelheit.at>
    Re: ...How to parse search engine results fast? (Anno Siegel)
    Re: a very bad question <mritty@gmail.com>
    Re: a very bad question <jl_post@hotmail.com>
    Re: a very bad question <dbent@comcast.net>
    Re: a very bad question <phaylon@dunkelheit.at>
    Re: a very bad question (Anno Siegel)
    Re: a very bad question <sbryce@scottbryce.com>
    Re: a very bad question <matternc@comcast.net>
    Re: a very bad question jhunterj@gmail.com
        Finding disk space used by Windows or Unix directory john_ramsden@sagitta-ps.com
    Re: Finding disk space used by Windows or Unix director (Anno Siegel)
    Re: Finding disk space used by Windows or Unix director <jurgenex@hotmail.com>
        Hash value not being interpolated <evillen@innocent.com>
    Re: Hash value not being interpolated <mjl69mjl69@myaccmyacc.net>
    Re: Hash value not being interpolated xhoster@gmail.com
    Re: in line editing <perl@my-header.org>
    Re: Newbie Hash question. <dbent@comcast.net>
    Re: PAR/PP on Windows XP with ActiveState starsy@gmail.com
    Re: PAR/PP on Windows XP with ActiveState sigzero@gmail.com
    Re: Perl "pipe" command, cant print binary to handle <nobull@mail.com>
    Re: Perl on Mac finding files by colour? <spamtrap@dot-app.org>
    Re: perlgtk embed window <zentara@highstream.net>
    Re: recursive function and hashe <sppNOSPAM@libello.com>
    Re: recursive function and hashe <nobull@mail.com>
    Re: Regex to match say char 't' exactly once in a strin <tadmc@augustmail.com>
    Re: Regex to match say char 't' exactly once in a strin <rasto@gmx.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 3 Feb 2005 08:37:52 -0800
From: bogdan_czyz@hotmail.com
Subject: Re: "Re-run script" sub
Message-Id: <1107448671.975627.185360@z14g2000cwz.googlegroups.com>

>
>    BEGIN:
>    {  Startup();
>
>       ...
>
>       redo BEGIN;
>    }


This one works for me. Thanks a lot for solution and suggestions
regarding calling subs.

Bogdan



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

Date: 3 Feb 2005 08:17:23 -0800
From: vincenzo.bacarella@gmail.com (VB)
Subject: ...How to parse search engine results fast?
Message-Id: <ee7ab11a.0502030817.2a727129@posting.google.com>

Hi, 

I'm building a metaseach engine based on data mining techniques....but
this is not important...

My question is about performances of the activity of scraping search
engine results from an HTML response page.

I see that some metasearch engines (Mamma, DogPile, Vivisimo & C.)
present top 50 results of 3-5 search engines in about 1 seconds.

With my perl script I am able to retrieve top 100 results of Google in
about 1,5 seconds, but from only one search engine!

Somebody (very much skilled in Perl) can tell me some advanced
technique (parallelism, thread...bo?) to retrieve from 3-5 search
engines very fast? (Hardware not included in this issue, I have a fast
hardware)


Excuse me for my english (I'm italian) and for my poor Perl skills.

Thanks,

VB


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

Date: Thu, 03 Feb 2005 17:39:12 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: ...How to parse search engine results fast?
Message-Id: <pan.2005.02.03.16.39.12.304704@dunkelheit.at>

VB wrote:

> My question is about performances of the activity of scraping search
> engine results from an HTML response page.

Maybe they /asked/ and used the API provided by some SE's?
 
> Somebody (very much skilled in Perl) can tell me some advanced technique
> (parallelism, thread...bo?) to retrieve from 3-5 search engines very fast?
> (Hardware not included in this issue, I have a fast hardware)

- Very fast hardware with enough resources.
- Internet Connection
- Interfaces, see above.

There may be much more, but I can't see the Perl relation (I've written in
Perl may be not enough, this group is more on coding Perl, not about
technologies which can be coded with Perl, would be a wide field.);

hth,
p

-- 
http://www.dunkelheit.at/
      ...and in darkness bind them.



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

Date: 3 Feb 2005 17:01:04 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: ...How to parse search engine results fast?
Message-Id: <cttlcg$3ap$1@mamenchi.zrz.TU-Berlin.DE>

VB <vincenzo.bacarella@gmail.com> wrote in comp.lang.perl.misc:
> Hi, 
> 
> I'm building a metaseach engine based on data mining techniques....but
> this is not important...

Then why mention it?

> My question is about performances of the activity of scraping search
> engine results from an HTML response page.

Looks like you use "scraping" to mean, roughly, parsing.

The answer would depend on the format of the response page.  Since you
don't mention which search engines you are tapping into, there is
nothing we can say about that.

Except that the time needed to parse the results will most likely
be small compared to the time taken to retrieve them.

> I see that some metasearch engines (Mamma, DogPile, Vivisimo & C.)
> present top 50 results of 3-5 search engines in about 1 seconds.
> 
> With my perl script I am able to retrieve top 100 results of Google in
> about 1,5 seconds, but from only one search engine!

Well, Perl isn't the fastest of languages.  If you want super-fast,
don't use Perl.

> Somebody (very much skilled in Perl) can tell me some advanced
> technique (parallelism, thread...bo?) to retrieve from 3-5 search
> engines very fast? ...

Finally you get to the core of your question.  The one thing you can
do to arrive at results faster is to handle multiple queries in
parallel.  See "perldoc perlipc" for general techniques, and "perldoc
-f fork" and "perldoc -f open" for the basic methods.  Also check out
LWP::Parallel on CPAN, it could be useful.

> ... (Hardware not included in this issue, I have a fast hardware)

Again, your local processing speed will not be the limiting factor.  Net
delay and the vastly more extensive processing on the actual search engine
will.

Anno


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

Date: Thu, 03 Feb 2005 15:10:27 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: a very bad question
Message-Id: <D9rMd.5275$ya6.1203@trndny01>

<leo.hou@gmail.com> wrote in message
news:1107394580.644080.49610@c13g2000cwb.googlegroups.com...
> Hi guys, prepare for a bad question... I want to know how to pronounce
> "~" and "#" in English

In addition to the other responses, you should be aware that some people
refer to '#' as a 'number sign'.

Paul Lalli



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

Date: 3 Feb 2005 07:19:15 -0800
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: a very bad question
Message-Id: <1107443955.236843.213440@z14g2000cwz.googlegroups.com>

> <leo.hou@gmail.com> wrote in message
> news:1107394580.644080.49610@c13g2000cwb.googlegroups.com...
> >
> > Hi guys, prepare for a bad question... I want to know
> > how to pronounce "~" and "#" in English

Paul Lalli wrote:
>
> In addition to the other responses, you should be aware
> that some people refer to '#' as a 'number sign'.


Although it's fairly rare, some people will even refer to '#' as the
"tic-tac-toe" sign.  (Tic-tac-toe is a simple game played with X's and
O's.)

-- Jean-Luc



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

Date: 3 Feb 2005 07:46:31 -0800
From: "Wondering" <dbent@comcast.net>
Subject: Re: a very bad question
Message-Id: <1107445591.597749.279030@o13g2000cwo.googlegroups.com>

Wow. I've read the replies, and not one gives the truly correct name
for this symbol "#"

It's an octothorpe - though most people use the more generally
understood terms included in the other posts.

Other symbols typically not reffered to by their correct names -
/    Virgule
\   Anti-virgule

I thought there were more compulsive folks reading this group.



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

Date: Thu, 03 Feb 2005 16:46:19 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: a very bad question
Message-Id: <pan.2005.02.03.15.46.19.582938@dunkelheit.at>

Wondering wrote:

> Wow. I've read the replies, and not one gives the truly correct name for
> this symbol "#"
> 
> It's an octothorpe

Try again: <flb9d2-ht2.ln1@moldev.cmagroup.co.uk>


p

-- 
http://www.dunkelheit.at/
Thru the darkness of futures past, the magician longs to see.
One chants out between two worlds: Fire, walk with me.
                                     -- Twin Peaks, »Bob«



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

Date: 3 Feb 2005 16:14:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: a very bad question
Message-Id: <cttikd$1br$2@mamenchi.zrz.TU-Berlin.DE>

Wondering <dbent@comcast.net> wrote in comp.lang.perl.misc:
> Wow. I've read the replies, and not one gives the truly correct name
> for this symbol "#"
> 
> It's an octothorpe - though most people use the more generally
> understood terms included in the other posts.

That statement only shows that you don't know what you are talking about.

The "truly correct name" for # has been discussed on Usenet hundreds of
times.  The result is invariably that there is none.

Here is what the alt.usage.english FAQ has to say about "octothorpe":

   Finally, in a failed attempt to avoid the naming problem by
   creating a new name, the term "octothorp(e)" (which MWCD10 dates
   1971) was invented for "#", allegedly by Bell Labs engineers when...

Anno



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

Date: Thu, 03 Feb 2005 09:21:23 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: a very bad question
Message-Id: <U6GdnYllg8H80p_fRVn-gg@comcast.com>

Paul Lalli wrote:

> In addition to the other responses, you should be aware that some people
> refer to '#' as a 'number sign'.

or "sharp."



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

Date: Thu, 03 Feb 2005 11:42:36 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: a very bad question
Message-Id: <pMadnQkseqnjyZ_fRVn-vg@comcast.com>

Scott Bryce wrote:

> Paul Lalli wrote:
> 
>> In addition to the other responses, you should be aware that some people
>> refer to '#' as a 'number sign'.
> 
> or "sharp."

Actually, in spite of what Microsoft would have you believe, a musical
sharp sign, although very similar in appearance to hash/pound/octothorpe,
is in fact different.  If you'll look at Unicode UTF-8, you will discover 
that the musical sharp sign is code 0x266f.

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: 3 Feb 2005 10:35:32 -0800
From: jhunterj@gmail.com
Subject: Re: a very bad question
Message-Id: <1107455732.913291.236970@l41g2000cwc.googlegroups.com>


Chris Mattern wrote:
> Scott Bryce wrote:
>
> > Paul Lalli wrote:
> >
> >> In addition to the other responses, you should be aware that some
people
> >> refer to '#' as a 'number sign'.
> >
> > or "sharp."
>
> Actually, in spite of what Microsoft would have you believe,

You misspelled "ANSI" as "Microsoft" there.  ANSI decided that
computers would know #.

> a musical sharp sign,

Who said "musical sharp sign"?  Scott said some people call # a sharp,
and so they do.

> although very similar in appearance to hash/pound/octothorpe,
> is in fact different.  If you'll look at Unicode UTF-8, you will
discover
> that the musical sharp sign is code 0x266f.

Unicode doesn't dictate English pronunciation of ASCII symbols though.

--
http://www.hunterandlori.com



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

Date: 3 Feb 2005 10:00:47 -0800
From: john_ramsden@sagitta-ps.com
Subject: Finding disk space used by Windows or Unix directory
Message-Id: <1107453647.356206.109910@l41g2000cwc.googlegroups.com>


For Windows and Unix I need a perl module or script[s] that
returns the disk space occupied by a specified directory
(including all files and subdirectories recursively).

I could write one using File::Find or equivalent; but I'd
rather not reinvent the wheel if there's already a tried
and tested module or code out there, which having spent
some fruitless time searching I'm beginning to doubt.


Cheers

John R Ramsden

P.S. Filesys::DiskSpace is no good for what I need, as it
only returns the space available & used on an entire file
system.



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

Date: 3 Feb 2005 18:33:49 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Finding disk space used by Windows or Unix directory
Message-Id: <cttqqd$6au$3@mamenchi.zrz.TU-Berlin.DE>

 <john_ramsden@sagitta-ps.com> wrote in comp.lang.perl.misc:
> 
> For Windows and Unix I need a perl module or script[s] that
> returns the disk space occupied by a specified directory
> (including all files and subdirectories recursively).
> 
> I could write one using File::Find or equivalent; but I'd
> rather not reinvent the wheel if there's already a tried
> and tested module or code out there, which having spent
> some fruitless time searching I'm beginning to doubt.

The problem with disk space measurement is not so much gathering the data
(easy with File::Find), but the interpretation.  Under Unix there are hard
and soft links to consider.  There is no way of treating them right under
all circumstances.  This particular wheel needs the re-invention of one 
or two spokes every time.

Anno


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

Date: Thu, 03 Feb 2005 18:42:24 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Finding disk space used by Windows or Unix directory
Message-Id: <kguMd.4242$uc.3516@trnddc02>

john_ramsden@sagitta-ps.com wrote:
> For Windows and Unix I need a perl module or script[s] that
> returns the disk space occupied by a specified directory
> (including all files and subdirectories recursively).
>
> I could write one using File::Find or equivalent; but I'd
> rather not reinvent the wheel if there's already a tried
> and tested module or code out there, which having spent
> some fruitless time searching I'm beginning to doubt.

Oh come on, that's a five-liner:

use File::Find;
my $total;
sub wanted {$total += -s;}
find (\&wanted, 'c:/tmp');
print $total;

jue 




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

Date: 3 Feb 2005 10:01:40 -0800
From: "evillen@innocent.com" <evillen@innocent.com>
Subject: Hash value not being interpolated
Message-Id: <1107453700.493734.148830@o13g2000cwo.googlegroups.com>

Hi

Please help, I can't figure out why my hash value not being
interpolated correctly?

code snippet:
begin
-------
@symbol_data = (CONN_UMP_3MM_SMT, sym.req:0554,
lib.name:conn_ump_3mm_smt, height:3.00mm, used:01ATiss1/Whitney RF,
(rev:2,NJH,26/05/04));
$symbols_and_data{$symbol_data[0]} = @symbol_data;
print "\$symbol_data[0] is: $symbol_data[0]\n";
print "Hash value is currently: $symbols_and_data{$symbol_data[0]}\n";
-------
end

description of problem:

I have the following array which has six elements:
	@symbol_data = (CONN_UMP_3MM_SMT, sym.req:0554,
lib.name:conn_ump_3mm_smt, height:3.00mm, used:01ATiss1/Whitney RF,
(rev:2,NJH,26/05/04))


So far so good, I then dynamically declare and assign a hash key:
	$symbols_and_data{$symbol_data[0]} = @symbol_data; #Create a Hash with
symbol name as key and data as value


Then I want to check a value:
	print "\$symbol_data[0] is: $symbol_data[0]\n";

that produces this:
	"$symbol_data[0] is: CONN_UMP_3MM_SMT"


Finally I want to see my hash key's values:
	print "Hash value is currently: $symbols_and_data{$symbol_data[0]}\n";


that produces this:
	"Hash value is currently: 6"
this appears to be the number of elements, rather than the values of
the elements.


I am expecting to see this:
	"Hash value is currently: CONN_UMP_3MM_SMT, sym.req:0554,
lib.name:conn_ump_3mm_smt, height:3.00mm, used:01ATiss1/Whitney RF,
rev:2,NJH,26/05/04"

Sorry about the horrible Google formatting - I am looking into a proper
Usenet service...

Many thanks
Len



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

Date: 3 Feb 2005 18:17:25 GMT
From: "mjl69" <mjl69mjl69@myaccmyacc.net>
Subject: Re: Hash value not being interpolated
Message-Id: <36f85lF51d7raU1@individual.net>

evillen@innocent.com wrote:

> Hi
> 
> Please help, I can't figure out why my hash value not being
> interpolated correctly?
> 

> print "Hash value is currently: $symbols_and_data{$symbol_data[0]}\n";

try

print "Hash value is currently: '
	.$symbols_and_data{$symbol_data[0]}.
	"\n";

Try News.Individual.NET


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

Date: 03 Feb 2005 18:27:07 GMT
From: xhoster@gmail.com
Subject: Re: Hash value not being interpolated
Message-Id: <20050203132707.958$4K@newsreader.com>

"evillen@innocent.com" <evillen@innocent.com> wrote:
> Hi
>
> Please help, I can't figure out why my hash value not being
> interpolated correctly?

The problem is that your hash value is not being assigned correctly.

> $symbols_and_data{$symbol_data[0]} = @symbol_data;

The left hand side is a scalar.  Which means the right hand side
is interpreted in scalar context.  Using an array in scalar context
yields the length of the array.

$symbols_and_data{$symbol_data[0]} = \@symbol_data;
or
$symbols_and_data{$symbol_data[0]} = [@symbol_data];
or
@{$symbols_and_data{$symbol_data[0]}} = @symbol_data;

Read up on perl references and data structures (perldoc perlref,
perldoc perldata, etc.).

BTW, it doesn't look like you are using warnings or strict.  Do so.

Xho

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


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

Date: Thu, 03 Feb 2005 17:35:32 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: in line editing
Message-Id: <2mk401hh06si163sqvhbp8af2ld1hs4e6p@4ax.com>

X-Ftn-To: Eric Schwartz 

Eric Schwartz <emschwar@fc.hp.com> wrote:
>>>explains the line below.
>>
>> This is FAQ, perldoc Tie::File
>
>That's overkill for a problem that can be solved with a simple 
>
>perl -pi.bak -e 's/this/that/' file
>
>don't you think?  

No, I don't; perhaps OP wants to apply more logic to his line substitution
so oneliner might not be the right thing. On the other hand, this is
actually FAQ,

perldoc -q "change one line"



-- 
Matija


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

Date: 3 Feb 2005 07:58:18 -0800
From: "Wondering" <dbent@comcast.net>
Subject: Re: Newbie Hash question.
Message-Id: <1107446298.159190.83880@f14g2000cwb.googlegroups.com>

The responses have been most helpful, and I have not only solved my
immediate problem, but I have a much better understanding of hashes in
general. Thanks all!



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

Date: 3 Feb 2005 08:09:39 -0800
From: starsy@gmail.com
Subject: Re: PAR/PP on Windows XP with ActiveState
Message-Id: <1107446979.252226.127500@f14g2000cwb.googlegroups.com>

try perlcc? already included in AS distribution



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

Date: 3 Feb 2005 08:13:36 -0800
From: sigzero@gmail.com
Subject: Re: PAR/PP on Windows XP with ActiveState
Message-Id: <1107447216.754003.245920@c13g2000cwb.googlegroups.com>

>From the docs:

"The code generated in this way is not guaranteed to work. The whole
codegen suite (perlcc included) should be considered very experimental.
Use for production purposes is strongly discouraged."



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

Date: 3 Feb 2005 10:18:28 -0800
From: "nobull@mail.com" <nobull@mail.com>
Subject: Re: Perl "pipe" command, cant print binary to handle
Message-Id: <1107454708.535076.68280@c13g2000cwb.googlegroups.com>


David wrote:

> pipe(STDIN, TOSTDIN);
> print TOSTDIN $input;

> it hangs when tring to "print TOSTDIN $input;".

A pipe is a pipe not a storage medium.  You can only put so much in
before you have to wait for somthing to start taking stuff out the
other end.

You probably wanted:

open STDIN, '<', \$input;



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

Date: Thu, 03 Feb 2005 09:22:35 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Perl on Mac finding files by colour?
Message-Id: <HaCdnYbCIJwwrp_fRVn-pw@adelphia.com>

daninbrum@hotmail.com wrote:

> At the moment, it uses file::find to dig out files with a .doc
> extension created since it last ran. However, my colleague wants it to
> find files marked with a certain colour (Apple OS-X lets you colour
> mark files). Is that possible?

It's easy with Mac::Files, which is bundled with Mac::Carbon.

Example:

    #!/usr/bin/perl

    use strict;
    use warnings;

    use File::Find;
    use Mac::Files;

    my @colors = qw(*none* gray green purple blue yellow red orange );

    my $searchDir = '/Users/sherm/test_dir';
    find (\&wanted, $searchDir);

    sub wanted {
        my $fname = $File::Find::name;

        # Get the file info
        my $finfo = FSpGetFInfo($fname);
        if (ref($finfo) eq 'FInfo') {
            # Get the finder flags, and mask the color bits
            my $finder_flags = $finfo->fdFlags;
            my $color = ($finder_flags & kColor) >> 1;
            print $fname, " = ", $colors[$color], "\n";
        }
    }

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 03 Feb 2005 12:35:37 -0500
From: zentara <zentara@highstream.net>
Subject: Re: perlgtk embed window
Message-Id: <g0o4011h91ouds5b6nivgro3cpifqpo5rg@4ax.com>

On Wed, 02 Feb 2005 19:09:04 -0500, JiggaHertz <none@nospam.com> wrote:

>I'm trying to reparent an external window into a perlgtk script.  I
>create an xterm and the result I get from xwininfo is.
>
>xwininfo: Window id: 0x1c0000e
>
>Running the following script does nothing to the external window, the
>same if I create a gtk window.  I've tried this using fluxbox and kde,
>same results.  Any help as to what I'm doing wrong would be greatly
>appreciated.

Here is a working example from Perl/Tk. You should be able to adapt
it to gtk.
I've toyed around with this,
and found that you need some octal conversions

Look for the oct() 

#!/usr/bin/perl
# $Id: ptk_steal.pl,v 1.1 1999/07/01 19:56:31 eserte Exp $ 
# Author: Slaven Rezic 
# Copyright (C) 1999 Slaven Rezic. All rights reserved. 
# This program is free software; you can redistribute it and/or 
# modify it under the same terms as Perl itself. 
# Mail: eserte@cs.tu-berlin.de 
# WWW:  http://user.cs.tu-berlin.de/~eserte/ 
# 
use Tk;
use X11::Protocol;

$x   = X11::Protocol->new();
$top = MainWindow->new;

system("xterm -name WindowToSteal &");

$check = $top->repeat(
    50,
    sub {
        $wid = get_window_by_name("WindowToSteal");
    }
);

while ( !defined $wid ) {
    $top->waitVariable( \$wid );
}
$check->cancel;

#warn sprintf("%x\n", $wid); 
$top->geometry("+10+10");
$top->Label( -text => "A xterm:" )->pack;
if ( $Tk::VERSION >= 800 ) {
    $f = $top->Frame( '-container' => 1 )->pack;
}
else {
    $f = $top->Frame( -width => 500, -height => 400 )->pack;
}

$f->update;
$x->ReparentWindow( $wid, oct( $f->id ), 0, 0 );

sub get_window_by_name {
    _get_window_by_name( $x->{'root'}, $_[0] );
}

sub _get_window_by_name {
    my ( $root, $searchname ) = @_;
    my ( $dummy, $dummy2, @new_kids ) = $x->QueryTree($root);
    foreach my $k (@new_kids) {
        my $atomnr;

        #warn sprintf("%x\n", $k); 
        foreach my $atom ( $x->ListProperties($k) ) {
            if ( $x->GetAtomName($atom) eq "WM_CLASS" ) {
                $atomnr = $atom;
                last;
            }
        }
        if ( defined $atomnr ) {
            my ($classprop) =
              $x->GetProperty( $k, $atomnr, "AnyPropertyType", 0, 256, 0
);
            my ( $class, $name ) = split( /\0/, $classprop );
            if ( $class eq $searchname ) {
                return $k;
            }
        }
        my $ret = _get_window_by_name( $k, $searchname );
        if ( defined $ret ) {
            return $ret;
        }
    }
    undef;
}

MainLoop;
__END__




-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


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

Date: Thu, 03 Feb 2005 17:17:16 +0100
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <sppNOSPAM@libello.com>
Subject: Re: recursive function and hashe
Message-Id: <42024e8c$0$536$626a14ce@news.free.fr>

Anno Siegel wrote:

[snip]

>> I'm planning to make a program that allow me to determine from which
>> country is a Credit Card.
>> I've downloaded the BIN table that is basically like this:
>> MinCC-MaxCC      Network(VISA,MASTER,NATIONAL,etc...)    Country
>> The problem is that each interval do not contains the same number of
>> Credit Card.
>> ie:
>> 1234000000000000-1234999999999999    VISA    USA
>> 1235678900000000-1235678999999999    VISA    CHN
>> 2567894561000000-2567894561999999    MASTER  TUR
>> etc...
> 
> [...]
> 
> Look on CPAN for ready-made solutions.  Tie::RangeHash looks good, there
> may be others.
> 
> Anno

Thanks I've modified my program for Tie::RangeHash, it seems to work exactly
as I need.
Once the BIN table loaded, my program as 33 Mo size, but it answers quickly.
The recursive method I've implemented works either, but the code is bigger.

Thanks again Anno.

Sébastien

-- 
[ retirer NOSPAM pour répondre directement
 remove NOSPAM to reply directly ]


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

Date: 3 Feb 2005 10:12:09 -0800
From: "nobull@mail.com" <nobull@mail.com>
Subject: Re: recursive function and hashe
Message-Id: <1107454329.316027.151780@l41g2000cwc.googlegroups.com>

S=E9bastien Cottalorda wrote:
>
> Anno Siegel wrote:
>
> > Look on CPAN for ready-made solutions.  Tie::RangeHash looks good
>
> Thanks I've modified my program for Tie::RangeHash

Tie::RangeHash was also the solution I was going to mention.

[ Ealier in this thread S=E9bastien had accidently replied to me
personally rather than the group and I said I would recommend a CPAN
module but I wouldn't say which one unless he responded to me in the
group :-) ]



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

Date: Thu, 3 Feb 2005 08:05:52 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Regex to match say char 't' exactly once in a string  and no more than once
Message-Id: <slrnd04bu0.2uj.tadmc@magna.augustmail.com>

Gancy <ganesh_tiwari@hotmail.com> wrote:

> I want to match a specifice charecter in a string, say 't', exactly
> once anywhere in the string, but should not match 't' more than once.


   /^[^t]*t[^t]*$/


> sounds simple is it not.


Looks pretty simple to me...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 03 Feb 2005 15:19:00 +0100
From: Rasto Levrinc <rasto@gmx.at>
Subject: Re: Regex to match say char 't' exactly once in a string  and no more than once
Message-Id: <420231fb$0$11352$3b214f66@tunews.univie.ac.at>

Gancy wrote:

> I want to match a specifice charecter in a string, say 't', exactly
> once anywhere in the string, but should not match 't' more than once.
> sounds simple is it not.
> 

Here is funny way to do it without using regexp.

if (abs index($string, $char) == rindex($string, $char)) {
     ...
}

-- 

Rasto Levrinc
http://sourceforge.net/projects/rlocate/


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

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


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