XML validating (no DTD)

2004-09-02 Thread Ing. Branislav Gerzo
Hello perlers, I know how to validate XML, but still error massages appears on STDOUT, anyone knows how to avoid them ? my code looks: use strict; use XML::Checker::Parser; my $xml_file = 'data.xml'; my $xp = new XML::Checker::Parser ( Handlers => { } ); eval { $xp->parsefile($xml_file); l

Re: XML validating (no DTD)

2004-09-02 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Thursday, September 02, 2004 at 12:34 (+0200) wrote these comments: IBG> I know how to validate XML, but still error massages appears on IBG> STDOUT, anyone knows how to avoid them ? I answer to my simple question, Brano, it is easy, just wite this: use

Re: can´t call method "xyz" on an undefined value at...

2004-09-03 Thread Ing. Branislav Gerzo
Bastian Angerstein [BA], on Friday, September 3, 2004 at 10:19 (+0200) wrote these comments: BA> I, once again, have a question. BA> How can I check if a Method is undefined or not without getting this error? maybe defined() helps. -- ...m8s, cu l8r, Brano. [Love conquers all things but pov

Re: A regex problem.

2004-09-06 Thread Ing. Branislav Gerzo
Denham Eva [DE], on Monday, September 6, 2004 at 14:41 (+0200) typed: DE> my $filedate =~ s/(\d+)//g; DE> ** DATA DE> C:/directory/MSISExport_20040814.csv DE> C:/directory/MSISExport_20040813.csv DE> Can someone help me with that regex? I am having a frustrating time of I hop

Re: sub routine syntax

2004-09-06 Thread Ing. Branislav Gerzo
Mike Blezien [MB], on Monday, September 06, 2004 at 15:40 (-0500) has on mind: MB> 1) some_subroutine(); use this one. MB> is one a more prefered or more effecient to use then the other(s)?? I think is a more prefered, about eficienty it is same. &sub() is good only when it has the same name as

HINT: regex coach

2004-09-08 Thread Ing. Branislav Gerzo
Hi, many of us need sometime fast help with regex. I recently found on the web really nice and easy program. Maybe someone of you already know it, for those, who don't it is REGEX COACH, download it from: http://www.weitz.de/regex-coach/ Notes: The Regex Coach is a graphical application for Linu

Re: How to extract the exact URL

2004-09-15 Thread Ing. Branislav Gerzo
Franklin Zhang [FZ], on Wednesday, September 15, 2004 at 11:20 (+0800) wrote these comments: FZ> Now, there are three kind of URL that I want to extract: FZ> 1. href="/Archives/1190192/000101968704002050/0001019687-04-002050-index.htm">2 FZ> 2. href="/Archives/1190192/000101968704002050/0001019

Re: How to extract the exact URL

2004-09-15 Thread Ing. Branislav Gerzo
Chris Devers [CD], on Wednesday, September 15, 2004 at 07:31 (-0400 (EDT)) wrote: >> if ( $line =~ /href="([^")">2 Typo? That bracket is unbalanced. Try this: CD> if ( $line =~ /href="([^"]+)">22http://learn.perl.org/>

can't use Scalar ref...

2004-09-15 Thread Ing. Branislav Gerzo
Hi pals, use strict; use warnings; my $foo = 'test'; my @bar = ( 'foo', '[%foo%]', 'bar' ); my @list = (); foreach my $x (@bar) { $x =~ s/^\[%([^%]+)%\]$/${$1}/g; print $x . " "; } -- ...it gives me compilation error: Can't use string ("foo") as a SCALAR ref while "strict refs"

Re: can't use Scalar ref...

2004-09-15 Thread Ing. Branislav Gerzo
JupiterHost.Net [JN], on Wednesday, September 15, 2004 at 16:52 (-0500) made these points: >> my $foo = 'test'; >> my @bar = ( 'foo', '[%foo%]', 'bar' ); JN> The question would be why you're doing ${$1} since nothing in @bar is a JN> reference. I want change [%foo%] to $foo, so I expect in result

Re: can't use Scalar ref...

2004-09-15 Thread Ing. Branislav Gerzo
JupiterHost.Net [JN], on Wednesday, September 15, 2004 at 17:21 (-0500) made these points: JN> Then you need to do 'no strict;' before you do that: JN> no strict; JN> $x =~ s/^\[%([^%]+)%\]$/${$1}/g; JN> use strict; I think turning off strict is bad idea, also, that doesn't work either. JN> Why

Re: can't use Scalar ref...

2004-09-15 Thread Ing. Branislav Gerzo
Jenda Krynicky [JK], on Thursday, September 16, 2004 at 00:34 (+0200) typed the following: JK> You most probably want to store the data you want to fill into the JK> template in a hash (some call it associative array, please don't): JK> my %data = ( JK>foo =>> 'test', JK>bar =>> '

array rotate question

2004-09-21 Thread Ing. Branislav Gerzo
Hello! I am thinking about making clear and short script to rotate array, let's say: input: @list = (1 .. 20); $start = 10; #starting position $values = 10;#how much values in result how to get output: @result = ( 5, 6, 7, 8, 9, 11, 12, 13, 14, 15 ); #10 values (I don't want $sta

Re: array rotate question

2004-09-21 Thread Ing. Branislav Gerzo
Jenda Krynicky [JK], on Wednesday, September 22, 2004 at 00:02 (+0200) made these points: >> $values = 10;#how much values in result JK> many (taky si to furt pletu) :) thanks for correcting me. JK> Assuming $values does not get bigger than the number of items in the JK> list and $start

Image::Magick problem

2004-09-23 Thread Ing. Branislav Gerzo
Hi there, I hope someone is using Image::Magick here. I just installed it (win xp, active Perl...), I'm trying to anotate some text, here is my example script: use Image::Magick; my $colour1 = ("ff"); my $colour2 = ("ff"); my $text = ("Hello World"); my $image=Image::Magick->new; $image->

connect through socks

2004-09-26 Thread Ing. Branislav Gerzo
Hi perlers, anyone knows how to connect to a website and download it through socks (ver 4,5) ? I tried IO::Socket::Socks and Net::SOCKS, but I can't get them to work. Also my next question is: can I access to whois service through socks? Is here anyone who has some experiences with this ? Thanks.

ntlm auth

2004-10-15 Thread Ing. Branislav Gerzo
Hi all, I changed my work, I'm behind MS proxy, I need authenticate on our proxy (NTLM). But I can't get it to work: use LWP::Debug qw(+); use LWP::UserAgent; use HTTP::Request::Common; my $url = 'http://www.google.com'; # Set up the ntlm client and then the base64 encoded ntlm handshake message

Re: ntlm auth

2004-10-15 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Friday, October 15, 2004 at 10:45 (+0200) typed: IBG> I changed my work, I'm behind MS proxy, I need authenticate on our IBG> proxy (NTLM). But I can't get it to work: I tried 'NTLM Authorization Proxy Server' v.0.9.7. ( http://www.geociti

Re: connect through socks

2004-10-03 Thread Ing. Branislav Gerzo
Jim [J], on Thursday, September 30, 2004 at 08:17 (-0400) contributed this to our collective wisdom: J> you could always do this: J> use Socket; ... thanks, I will try that. -- ...m8s, cu l8r, Brano. [Roy the Ranger's Famous Quote: Red Dragon? Big deal--I'm married!] -=x=- Skontrolované

Re: Append on top

2004-10-29 Thread Ing. Branislav Gerzo
Rajesh Dorairajan [RD], on Thursday, October 28, 2004 at 18:11 (-0700) thoughtfully wrote the following: RD> Does anyone know of a way to open a file in append mode and append on top of RD> the file? I don't think it is possible. You have to read source file, and after print your results to new f

formatting problem

2004-10-30 Thread Ing. Branislav Gerzo
Hi all, I have little formatting problem, we have code: sub test { $sth = $dbh->prepare_cached(finish; return; } this of course doesn't work, because SQL is not at begining of the line. I tried: $sth = $dbh->prepare_cached(<<" SQL"

gzip, deflate LWP

2004-10-30 Thread Ing. Branislav Gerzo
Hi again, I'm sending request to http with: $ua->default_header('Accept-Encoding' => 'deflate, gzip, x-gzip, identity'); ofcourse, I get compressed response. How to know wich method is used and also how to decompress it. Maybe something is written in header, when server response and using right

DN <-> IP

2004-10-31 Thread Ing. Branislav Gerzo
Hi all, I just wrote small script to resolve domain name on basis IP address and vice versa, do you think it is the best and fastest way? Thanks. use strict; use warnings; use Socket; my ($host, $ip); $host = 'www.google.com'; $ip = inet_ntoa(inet_aton($host)) || 'no IP'; print "$host: $ip\n";

how to benchmark connection

2004-11-01 Thread Ing. Branislav Gerzo
Hi all, anoyone could me show the start point for measuring response time of some server on some port ? I don't want ICMP ping. I'd like to know time, when server send, that connection was succesful. Thanks. -=x=- Skontrolované antivírovým programom NOD32 -- To unsubscribe, e-mail: [EMAIL P

Re: extract anything between escape characters

2004-11-02 Thread Ing. Branislav Gerzo
Khairul Azmi [KA], on Tuesday, November 2, 2004 at 16:43 (+0800) contributed this to our collective wisdom: KA> I am newbies in this regex world. I just want to extract the character KA> double quotes at the beginning and the ending of a string. KA> $string1 = "this is the string"; KA> so that $s

Re: extract anything between escape characters

2004-11-02 Thread Ing. Branislav Gerzo
Khairul Azmi [KA], on Tuesday, November 2, 2004 at 17:15 (+0800) wrote: KA> $string1="\"email title\""; KA> $string2='email title'; if you want string2 equal to string1, you have to remove double quotes. So, you should try: $string1="\"email title\""; $string2='email title'; $string1 =~ s/\"//

Re: extract anything between escape characters

2004-11-02 Thread Ing. Branislav Gerzo
Khairul Azmi [KA], on Tuesday, November 2, 2004 at 17:52 (+0800) typed: KA> The problem is I would not any double quote in the middle of the KA> sentence to be removed. KA> For example KA> $string="\" email title. \" username \""; you have to be more specific, what do you want. If the sentence

LWP::Parallel in other way

2004-11-02 Thread Ing. Branislav Gerzo
Hi all, I'm using LWP::Parallel and it works good for me. But I have one curious problem - I want change PUA agent for every request. But I don't know how to to that. Result of this code are 15 txt files, but, content is not what I expect. I'd like to have in TXT something like this: "HTTP_HOST:

Re: Spider-friendly URLs in Perl

2004-11-05 Thread Ing. Branislav Gerzo
GEV_256 [G2], on Friday, November 5, 2004 at 17:52 (+0600) thinks about: G2> There is CGI script /cgi-bin/some.pl. Some user input this address in G2> browser. But it's needed when he inputs it, web-server will response G2> page generated by another script - /cgi-bin/any.pl. G2> How to make it? u

Re: LWP::Parallel in other way

2004-11-07 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Tuesday, November 2, 2004 at 16:50 (+0100) made these points: IBG> I'm using LWP::Parallel and it works good for me. But I have one IBG> curious problem - I want change PUA agent for every request. But I so, maybe I have comlicated question, so no on

slow ForkManager

2004-11-07 Thread Ing. Branislav Gerzo
Hi all, could me anyone explain, why is this so slow? use strict; use warnings; use Parallel::ForkManager; my @links=(1..10); my $pm=new Parallel::ForkManager(5); foreach my $x (0..$#links) { $pm->start and next; print "$links[$x]\n"; $pm->finish; } print "Too slow.\

simple hash question

2004-11-08 Thread Ing. Branislav Gerzo
Hi pals, I have simple hash question, lets we have example code: my %hash = ( 1 => 2, 2 => 3, 3 => 4, 4 => 5 ); while (my($key, $value) = each(%hash)) { print "$key => $value\n"; } how I can print all values, if I want print that in this order: 2 => 3 4 => 5 3 => 4 1 => 2 thanks for any ideas.

Re: simple hash question

2004-11-08 Thread Ing. Branislav Gerzo
Edward Wijaya [EW], on Tuesday, November 09, 2004 at 03:14 (+0800) wrote: EW> use Tie::IxHash module from CPAN, to preserve order in a Hash. thanks for answer, indeed, I created small subroutine, to look... sub hash_look { while ( my ($key, $value) = each(%tab_def) ) { print "$ke

regexp for ip address

2004-11-11 Thread Ing. Branislav Gerzo
Hi all, anyone knows how looks _good_ ip adress regexp ? I use something like: (\d{1,3}\.){3}\d{1,3} but that also matches for example 888.777.444.222, which is of course not good ip adress. I don't want use any module for this, I only want fing proper regular expression for IPs. I thought about

Re: regexp for ip address

2004-11-11 Thread Ing. Branislav Gerzo
Gunnar Hjalmarsson [GH], on Friday, November 12, 2004 at 00:59 (+0100) contributed this to our collective wisdom: GH> What's your definition of a "good" IP address? Do you care about correct GH> DNS, do you care about whether the address is in use? I care about that, if its syntax is correct: 1-2

Re: regexp for ip address

2004-11-12 Thread Ing. Branislav Gerzo
Chasecreek Systemhouse [CS], on Friday, November 12, 2004 at 03:18 (-0500) typed: CS> For theose "less inclined" to work with such a R/E - CS> This module accepts valid IP Addresses: CS> http://search.cpan.org/~frajulac/Net-IPv4Addr-0.10/IPv4Addr.pm Ok, but I also wrote about IP:PORT, and at the

Re: regexp for ip address

2004-11-12 Thread Ing. Branislav Gerzo
Gunnar Hjalmarsson [GH], on Friday, November 12, 2004 at 09:23 (+0100) typed the following: GH> I think I would have done it in more than one step. Leaving the ports GH> aside, you could for instance start with extracting possible IP GH> addresses with something like: GH> /(\d{1,3}(?:\.\d{1,

Re: regexp for ip address

2004-11-13 Thread Ing. Branislav Gerzo
PS> This isn't shorter, but it is easier to understand :-) PS> /^(\d+)(??{ $1 > 0 && $1 < 256 ? "" : "(?!)" }) \. PS>(\d+)(??{ $2 > 0 && $2 < 256 ? "" : "(?!)" }) \. PS>(\d+)(??{ $3 > 0 && $3 < 256 ? "" : "(?!)" }) \. PS>(\d+)(??{ $4 > 0 && $4 < 256 ? "

postincrement in scalar

2004-11-15 Thread Ing. Branislav Gerzo
Hi [EMAIL PROTECTED], I have code snippet, which gave me statistics of lines in file: foreach my $item (@list) { chomp($item); if ($seen{$item}) { $seen{$item}++; } else { $seen{$item} = 1; } } this is quite simple, so I rewrite that as: foreach my $item (@lis

Re: postincrement in scalar

2004-11-15 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Monday, November 15, 2004 at 09:20 (-0600) typed: CKC> : $seen{$item} ? $seen{$item}++ : $seen{$item} = 1; } CKC> $seen{$item} = $seen{$item} ? ++$seen{$item} : 1; ok I understand, but I don't know why my line doesn't work. I thought (exp) ? (true) : (false)

Re: postincrement in scalar

2004-11-15 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Monday, November 15, 2004 at 10:00 (-0600) wrote: CKC> ( $seen{$item} ? $seen{$item}++ : $seen{$item} ) = 1; CKC> When you probably meant this: CKC> $seen{$item} ? ($seen{$item}++) : ($seen{$item} = 1); CKC> According to the docs: "The operator may be assigne

Re: why $000 is a valid variable name?

2004-11-18 Thread Ing. Branislav Gerzo
Zeng Nan [ZN], on Thursday, November 18, 2004 at 13:43 (+0800) wrote these comments: ZN> As said in "Learning Perl", a perl identifier is "a letter or ZN> underscore, and then possibly more letters, or digits, or underscores". ZN> Because of this, $123 is an invalid name, but why $000 or $00 w

Re: Print an array without the duplicate

2004-11-18 Thread Ing. Branislav Gerzo
Li, Aiguo (NIH/NCI) [LA], on Thursday, November 18, 2004 at 11:24 (-0500) contributed this to our collective wisdom: LA> I need to print a header line without duplicated item and am struglling with my %seen = (); my @uniqu = grep { ! $seen{$_} ++ } @header; -- ...m8s, cu l8r, Brano. ["The Na

Re: How to monitor a scritp

2004-11-23 Thread Ing. Branislav Gerzo
Mauro [M], on Tuesday, November 23, 2004 at 10:44 (+0100) wrote: M> I made a script that works fine. M> When a try to run it in crontab it seems it doesn't work. it is maybe path related problem. Try tu run exactly that script as in crontab, but be in other directory, where script, or crontab run

Re: missing results

2004-11-23 Thread Ing. Branislav Gerzo
Rene Borchers [RB], on Tuesday, November 23, 2004 at 12:24 (+0100) wrote these comments: RB> When I search altavista for dummie it returns 33.200 hits, when I use RB> perl it returns 33,100 hits. Any suggestions where are the 100 missing RB> hits. I can't simulate it right now, I did similar thin

decompress downloaded page

2004-11-24 Thread Ing. Branislav Gerzo
Hi all, I have this snippet, and I'd like to decompress its contents: sub dwl { my $ua = LWP::UserAgent->new; $ua->default_header('Accept-Encoding' => 'gzip, deflate'); $resp = $ua->get(@_); return ($resp->content, $resp->status_line, $resp->is_success) if wantarray; return un

Re: decompress downloaded page

2004-11-24 Thread Ing. Branislav Gerzo
Kelvin Wu [KW], on Wednesday, November 24, 2004 at 21:46 (+0800) made these points: KW> use Compress::Zlib; KW> my $results = Compress::Zlib::memGunzip($resp->content); thanks a lot, I knew that will be so easy :) hm, what exactly means deflate ? It is not compressed content ? So my browser accep

Re: a question about the return value of a subroutine

2004-11-25 Thread Ing. Branislav Gerzo
Zeng Nan [ZN], on Thursday, November 25, 2004 at 16:04 (+0800) typed the following: >>6 sub total { >>7 my $sum; >>8 foreach(@_){ $sum += $_ } >>9 $sum; >>10 } ZN> My question is without line 9, the return value is nothing, while I ZN> expect it will return the value of $sum, as it is the l

Re: how to get count in DBI

2004-11-26 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Friday, November 26, 2004 at 04:32 (-0600) wrote these comments: CKC>my $rows = $dbh->>selectall_arrayref( CKC> 'SELECT sessionid FROM session' CKC> ); CKC> my $row_count = @$rows; isn't faster using SELECT COUNT(*) FROM session ? --

Re: how to get count in DBI

2004-11-27 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Friday, November 26, 2004 at 05:30 (-0600) has on mind: CKC> It would be slower and less accurate. To use your CKC> suggestion would require another query on the database. CKC> That count might also not return the same count as is CKC> in "scalar @$rows" if the da

Re: how to get count in DBI

2004-11-27 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Saturday, November 27, 2004 at 15:20 (+0100) has on mind: as I see, I should use better benchmarking: http://uk.builder.com/webdevelopment/scripting/0,39026636,39220598-2,00.htm but that not changes my conclusion :) -- ...m8s, cu l8r, Brano. [I tawt I taw a

Re: how to get count in DBI

2004-11-27 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Saturday, November 27, 2004 at 10:21 (-0600) thinks about: CKC> Here's the method you presented. CKC> my $rows = $dbh->>selectall_arrayref( CKC> 'SELECT sessionid FROM session' CKC> ); CKC> my $row_count = $dbh->do( CKC>

problem with Net::SOCKS;

2004-11-28 Thread Ing. Branislav Gerzo
Hi all, I have timeout problem with Net::SOCKS, when connecting to socks4/5, sometime it gets no timeout, so it "freezes" at that point. I also modify SOCKS.pm and add Timeout => 10 to: ${*self}{fh} = new IO::Socket::INET ( Timeout => 10, PeerAddr => ${*self}{

Re: problem with Net::SOCKS;

2004-11-28 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Sunday, November 28, 2004 at 10:11 (+0100) has on mind: IBG> but it doesn't help. Has anyone some idea, how I can modify this to IBG> work, or using another module for socks 4/5 ? I also saw on CPAN IBG> Net::SC, but I don't know how to compile t

Re: problem with function

2004-11-29 Thread Ing. Branislav Gerzo
Jenda Krynicky [JK], on Monday, November 29, 2004 at 15:56 (+0100) typed the following: >>my [EMAIL PROTECTED]; JK> my $datenbank = shift(); JK> or JK> my ($datenbank) = @_; heh, this is common mistake, I did it today too, but I found it. I add my suggestion: my $datenbank = $_[0]; --

Re: Messenger module?

2004-11-30 Thread Ing. Branislav Gerzo
Octavian Rasnita [OR], on Tuesday, November 30, 2004 at 13:27 (+0200) wrote: OR> Does anyone know if there is a perl module that could communicate as a OR> client with MSN Or Yahoo or Skype or AOL messengers? did you try search on cpan ? I think not: http://search.cpan.org/search?query=msn&mode=

HTML::Tree help

2004-11-30 Thread Ing. Branislav Gerzo
Hi all, I have to parse some thousand of html files, so I'd like to use some html parser, and not my own regexpes. Htmls I am parsing are quite complex, so I need your help. First of all, is HTML::Tree good and fast module? Because, I am not sure if I have to look for some criteria using if( my $

Re: HTML::Tree help

2004-11-30 Thread Ing. Branislav Gerzo
Randy W. Sims [RWS], on Tuesday, November 30, 2004 at 11:41 (-0500) wrote: first of all - thanks for reply, I thought, I didn't get one, because I have always specific problems, such this :) RWS> There are basically two types of parser: 1) the type that reads in html, RWS> xml, etc. and builds an

Re: HTML::Tree help

2004-11-30 Thread Ing. Branislav Gerzo
Jonathan Paton [JP], on Tuesday, November 30, 2004 at 16:04 (+) thinks about: JP> As always, programmer time is more valuable than computer time. I have to agree, I now this. My office computer never stops count something (on idle time it counts mersenne prime number:) JP> Correctness is als

Re: Checking if a scalar value is a number or not

2004-12-01 Thread Ing. Branislav Gerzo
Mat Harris [MH], on Wednesday, December 1, 2004 at 12:19 (+) contributed this to our collective wisdom: >> Is there any special function for that job? MH> personally I would use a rexex: MH> if ($myunknownvalue =~ m/^\d*$/) personally I would change this regex to: if ($myunknownvalue =~ m/^\

Re: Checking if a scalar value is a number or not

2004-12-01 Thread Ing. Branislav Gerzo
Bob Showalter [BS], on Wednesday, December 1, 2004 at 08:34 (-0500 ) wrote these comments: >> if ($myunknownvalue =~ m/^\d+$/) BS> Your regex matches the string "123\n", if it matters. I think, it is good, and 99% users expect that, even they don't know that. -- ...m8s, cu l8r, Brano. [Dave.

help on structure definition

2004-12-03 Thread Ing. Branislav Gerzo
Hi! I am thinking about best hash structure, I want save all datas from hash to database. Example: 'name' => { 'ra' => { 'do' => undef, 'od' => '1996-01-07', 'name' => 'brano' } 'ro' => {

Re: help on structure definition

2004-12-03 Thread Ing. Branislav Gerzo
Randy W. Sims [RWS], on Friday, December 03, 2004 at 05:23 (-0500) has on mind: RWS> In 'ro', is there a particular reason your using numbers 1, 2, ... as RWS> keys? If there is not, I'd use an array. Something like: not, there is no reason. I thought it must be something simplier than mine. Than

push hash to array

2004-12-03 Thread Ing. Branislav Gerzo
My next question is: how I can push hash to array, without creating next hash ? Example, which works: %hasha = ( 'b' => 'c', 'd' => 'e' ); %hashb = ( 'f' => 'g' ); @array = ( \%hasha ); push (@array,\%hashb); but,I want use push without %hashb, I tried: %hasha = ( 'b' => 'c', 'd' => 'e' ); @arra

Re: push hash to array

2004-12-03 Thread Ing. Branislav Gerzo
Jonathan Paton [JP], on Friday, December 3, 2004 at 11:19 (+) has on mind: JP> push @array, { JP> f => 'g' JP> }; Ahm, so {} helps. Thanks a lot. -- ...m8s, cu l8r, Brano. [Mr. Greene is about to impress us with his piloting skills.] -- To unsubscribe, e-mail: [EMAIL PROTECTED] F

Re: How's a simpler way to do this? (pattern)

2004-12-05 Thread Ing. Branislav Gerzo
pablo wablo [pw], on Saturday, December 4, 2004 at 21:07 (-0800 (PST)) has on mind: pw> $in =~ /\b[rR] ( ([0-9]) | ( [12][0-9] ) | ( 3[01] pw> ))\b/x; pw> it works fine but I'm not satisfied with it.. (too pw> long!) it's nothing bad on your regexp, just you could use \d instead [0-9]. Defining

Re: ipv4_checkip

2004-12-05 Thread Ing. Branislav Gerzo
[EMAIL PROTECTED] [D], on Sunday, December 5, 2004 at 06:50 (-0500) made these points: try reading mid:[EMAIL PROTECTED] posts, and what about using something like this: print "Good IP address\n" if goodIP('11.22.33.44'); sub goodIP { gethostbyaddr pack('C4', split /\./, shift), 2 } also there

mysql timeout

2004-12-06 Thread Ing. Branislav Gerzo
Hi all, maybe this is not perl related, but I am not sure. I'm connecting to mysql, and after I'm executing some queries. Sometimes - when query is too complicated, or I start second complicated query, I get: DBD::mysql::st execute failed: Lost connection to MySQL server during query at... Do yo

Re: Trouble with compound regular expression matching

2004-12-07 Thread Ing. Branislav Gerzo
Jeffrey Paul Burger [JPB], on Monday, December 06, 2004 at 17:05 (-0700) typed the following: JPB> if ($file_name !~ /tif$/i) {} JPB> if ($file_name !~ m/tif\b/i) {} JPB> if ($file_name !~ m/.*.tif/i) {} what about this: print "PIC is $1" if ($file_name =~ /\.(tif?f|jpe?g)$/i); -- ...m8s, cu

Re: FW: Trouble with compound regular expression matching

2004-12-07 Thread Ing. Branislav Gerzo
Paul Ohashi [PO], on Monday, December 6, 2004 at 16:24 (-0800) made these points: PO> I did need to add the case-insensitivity to the regex: PO>/^.*\.[tj][pi][gfe].*$/i PO> That's better, I think. I'm not sure if this is good solution, because it matches also those, you won't: tpg, tpf, tpe,

Re: Trouble with compound regular expression matching

2004-12-07 Thread Ing. Branislav Gerzo
Stout, Joel R [SJR], on Tuesday, December 7, 2004 at 00:55 (-) typed: SJR> use File::Basename; SJR> $fullname = "/usr/local/pics/sample.tiff"; #for example SJR> ($file,$dir,$_) = fileparse($fullname, qr/\..*/); SJR> if (/\.(tif|tiff|jpg|jpeg)$/) { SJR> print "This is an image file.\n"; SJR

Re: How to find a file in a directory structure

2004-12-07 Thread Ing. Branislav Gerzo
[EMAIL PROTECTED] [am], on Tuesday, December 7, 2004 at 15:27 (+0530) typed the following: am> I have to search for a file in a PATH and then once the file is found is the PATH same as your ENV PATH ? Try to use $myfile = `which file`; Did you look at File::Find ? -- ...m8s, cu l8r, Brano.

Re: ip4 check

2004-12-08 Thread Ing. Branislav Gerzo
[EMAIL PROTECTED] [D], on Tuesday, December 7, 2004 at 11:49 (-0500) thinks about: D> Did anyone have any ideas I only received one response! Thanks what was bad on my response ? Maybe you wanted whole code...here it is: use IO::Socket; my $ip = '192.168.1.1'; $ip_ok = inet_aton($ip) || di

array statistic (different)

2004-12-08 Thread Ing. Branislav Gerzo
Hello, I have one question - I know how to do this, but maybe someone shows me, how to do it better (for sure!). Ok, here we comes: I have: my @array = ( '1/2/1', '1/2/2', '1/4/2', '2/1/1', '2/1/1', '3/1/1' ); and now the tas

Re: array statistic (different)

2004-12-08 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Wednesday, December 8, 2004 at 13:03 (+0100) wrote: IBG> I think this is nice example for recursive function, do you agree ? I agree too :) IBG> Ok, I am code that, so I am looking for your suggestions, too :) Ok, here is my solution, not the best one, beca

Re: array statistic (different)

2004-12-08 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Wednesday, December 8, 2004 at 14:28 (+0100) wrote these comments: IBG> Ok, here is my solution, not the best one, because it return random IBG> value if max is not exactly defined (we ends with the same values for IBG> strings) ok, if anyone interested -

Re: array statistic (different)

2004-12-08 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Wednesday, December 8, 2004 at 08:32 (-0600) thinks about: CKC> What is it representative of? What is the application? CKC> Will there be only didgits? What is the range of values CKC> available. It will be not digits, I give bad example, I should use some words.

Re: array statistic (different)

2004-12-09 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Wednesday, December 8, 2004 at 08:32 (-0600) wrote about: CKC> What is it representative of? What is the application? CKC> Will there be only didgits? What is the range of values CKC> available. ok, I rewrote that script a bit, the best solution to me is using "s

Re: perl problems

2004-12-13 Thread Ing. Branislav Gerzo
Ken Gillett [KG], on Monday, December 13, 2004 at 08:33 (+) typed: KG> fairly complex perl script that parsed an XML file and contained the KG> following line:- KG>last if /^\t{0,2}<$tag>$/; why you don't use some XML module for parsing XML files ? Sooner or later you will use it anyw

Re: SFTP problem...Please help me !.....

2004-12-13 Thread Ing. Branislav Gerzo
roime puniran [rp], on Tuesday, December 14, 2004 at 01:27 (-0800 (PST)) typed the following: rp> transfered and remove successfull ..Below is my rp> script... it works, if you have in your source directory only 1 file, for example data.dat ? -- ...m8s, cu l8r, Brano. [He's mostly dead Jim.

Re: $sftp->put problem.............

2004-12-15 Thread Ing. Branislav Gerzo
roime puniran [rp], on Wednesday, December 15, 2004 at 00:33 (-0800 (PST)) typed: $sftp->>put("$file", "$remote_path") or die "...problem rp> !..."; try to remove ", so it should be like $sftp->put($file, $remote_path) or ... -- ...m8s, cu l8r, Brano. [You may be recognized soon. Perhaps yo

Re: Digest MD5 and speed

2004-12-15 Thread Ing. Branislav Gerzo
Benjamin Jeeves [BJ], on Wednesday, December 15, 2004 at 14:34 (+) typed: BJ> in the right way too? If I do not md5sum the files it print to the screen in BJ> about 2 mins? I don't think there should be much impromevent in speed, because Digest::MD5 uses C library for calculating MD5. So you

Re: Using variables in REs

2004-12-17 Thread Ing. Branislav Gerzo
Michael Kraus [MK], on Friday, December 17, 2004 at 11:33 (+1100) has on mind: MK> How are they interpreted? (Would the "\" just escape the next character MK> appearing or would it be interpreted literally? I'm guessing the former, MK> as I'm pretty sure I can use "\d" to indicate a digit.) try

Re: Assigning a match to a varible without an IF

2004-12-14 Thread Ing. Branislav Gerzo
S.A. Birl [SAB], on Tuesday, December 14, 2004 at 09:58 (-0500 (EST)) contributed this to our collective wisdom: SAB> Problem is: SAB> $from_ = $From =~ /@/; SAB> returns 1. you should use this: ($from_ = $From) =~ /@/; but your regexp isn't right. maybe this will work: ($from_ = $

Re: Installing Gd

2004-12-20 Thread Ing. Branislav Gerzo
Octavian Rasnita [OR], on Monday, December 20, 2004 at 16:24 (+0200) wrote: OR> And BTW. I hope I won't need to install a C compiler, then download Gd OR> tarball, and compile it manually if ( $your_perl_dist eq "Activestate" ) { `ppm install gd`; } else { download_activestate_perl() }

Re: Installing Gd

2004-12-20 Thread Ing. Branislav Gerzo
Octavian Rasnita [OR], on Monday, December 20, 2004 at 17:59 (+0200) wrote about: OR> Thanks. I have tried that, but it told me that it cannot find the ppd for OR> GD. [c:\4nt]ppm install GD Install 'GD' version 2.16 in ActivePerl 5.8.4.810. ... ... mayb

Re: Use of uninitialized value in String

2004-12-28 Thread Ing. Branislav Gerzo
Anish Kumar K. [AKK], on Tuesday, December 28, 2004 at 16:37 (+0530) wrote about: AKK> 6: if ($browserName eq "") unless ($browserName) { ... I think you have null value in db. -- ...m8s, cu l8r, Brano. [Kids love the rich taste of titanium - Joel] -- To unsubscribe, e-mail: [EMAIL PRO

measuring memory

2005-01-03 Thread Ing. Branislav Gerzo
Hi there! is there good module for memory usage of current running script ? I have script in perl and I want see how much memory is using in some state. It is good for that some perl module, or just some external memory info program (first I check PID, after that I run external program, and will g

LWP::UserAgent

2005-01-04 Thread Ing. Branislav Gerzo
Hi there, just pretty simple question: is LWP::UserAgent encode URL ? for example I have: my $ua = LWP::UserAgent->new; my $resp = $ua->get('http://something.net/this:is+just test'); my question is, if LWP first encode (escape) path in URL as is written in RFC 1738, or I have to care about it in

Re: measuring memory

2005-01-04 Thread Ing. Branislav Gerzo
zentara [z], on Tuesday, January 04, 2005 at 07:58 (-0500) contributed this to our collective wisdom: z> On Linux, just pit the following script somewhere in your perl5lib. very nice. I thought Free BSD has /proc too, but it doesnt, so I have to do that via top -n | grep -- ...m8s, cu l8r,

Re: measuring memory

2005-01-04 Thread Ing. Branislav Gerzo
zentara [z], on Tuesday, January 04, 2005 at 07:58 (-0500) wrote about: or: ps -u -- ...m8s, cu l8r, Brano. ["Et Tu Gryphon?" - Quickling] -=x=- Skontrolované antivírovým programom NOD32 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Regarding strings

2005-01-10 Thread Ing. Branislav Gerzo
[EMAIL PROTECTED] [am], on Friday, January 7, 2005 at 23:17 (+0530) wrote: am> Found solution. am> am> $len = length($temp); am> if ($len > 2) am> { am> $temp=substr($temp,$len-2,2); am> } am> hm, what about: $temp = $1 if $temp /(\d\d)$/

complex data structure

2005-01-10 Thread Ing. Branislav Gerzo
Hi pals, How can I add values to hash, when key is the same ? Example: my %ha = ( 'test1' => [ { 'test1_a' => 'a', 'test1_b' => 'b', }, { 'test1_a

Re: complex data structure

2005-01-10 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Monday, January 10, 2005 at 13:03 (+0100) thinks about: IBG> How can I add values to hash, when key is the same ? Example: I am answering to myself: writing own code should be complex, why not to use module for that? try a look at: http://search.cpan.org/~mney

Re: complex data structure

2005-01-10 Thread Ing. Branislav Gerzo
Moon, John [MJ], on Monday, January 10, 2005 at 07:31 (-0500) made these points: MJ> Hope this helps .. thanks a lot for your time, I appreciate that! -- ...m8s, cu l8r, Brano. [Rifles don't pick up the phone in the middle of a down load] -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: complex data structure

2005-01-11 Thread Ing. Branislav Gerzo
[EMAIL PROTECTED] [m], on Monday, January 10, 2005 at 13:23 (-0500) made these points: mon> I can try, I personaly perfer RoHoH..., looks like you have RoHoAoH thanks, maybe I will change that to RoHoH, I'd like to insert those values to database, where keys will be name of columns. -- ...m8s

Re: Write stdout to a file as well as stdout

2005-01-12 Thread Ing. Branislav Gerzo
Larry Guest [LG], on Tuesday, January 11, 2005 at 15:40 (-0800) contributed this to our collective wisdom: LG> I have a script that does all kinds stuff. LG> When its running it outputs all kinds of useful information to the LG> screen and exits. LG> What I want to do is have this also sent to a f

Re: checking for errors

2005-01-13 Thread Ing. Branislav Gerzo
Tim Wolak [TW], on Thursday, January 13, 2005 at 09:15 (-0600) wrote about: TW> if ($newlog =~ /^Read failed on socket/ || /^EFIXException::/) { for me it seems, this line is bad, when you rewrite it to: if ($newlog =~ /^(Read failed on socket|EFIXException::)/) { it works ? -- ...

Re: atom syndication

2005-01-16 Thread Ing. Branislav Gerzo
Harsh Busa [HB], on Sunday, January 16, 2005 at 01:42 (+0530) thinks about: HB> my $doc = $atomic->get('http://www.timaoutloud.org/xml/atom.xml'); in this line you have error, you have to write: my ($doc) = $atomic->get('http://www.timaoutloud.org/xml/atom.xml'); -- ...m8s, cu l8r, Brano. [

Re: atom syndication

2005-01-16 Thread Ing. Branislav Gerzo
Jenda Krynicky [JK], on Sunday, January 16, 2005 at 23:56 (+0100) contributed this to our collective wisdom: >> in this line you have error, you have to write: >> my ($doc) = >> $atomic->get('http://www.timaoutloud.org/xml/atom.xml'); JK> Don't think so. This may make a difference, but I don't th

  1   2   3   >