Re: Parsing of HEX bytes using Perl

2006-10-26 Thread Deane . Rothenmaier

USE ENGLISH, not IM-lish; this is NOT an AOL chat room, and we're not a bunch of 14-year-olds.

Ur is not a word, it is the name of an ancient Chaldean city. It's also a prefix meaning original or prototypical, as in ur-lord, for you Thomas Covenant fans. 

What ur might mean to anyone for whom American English (not to dignify it as being anything of the sort) is not their native tongue is, as was previously mentioned by another poster, open to misinterpretation and causes unnecessary confusion.

If ur (you're) as lazy in ur (your) coding as ur (you are) in your emailing, one would be amazed to find that you have anything that wurx.

IMHO, it's bad enough that smileys and acronyms, such as IMHO, have weaseled their way into this forum; don't make things worse by using IM-lish.

Don't make me come through these wires and smack your fingers with my ruler!

Deane Rothenmaier
Systems Architect
Walgreens Corp.
847-914-5150

Truth is eternal, knowledge is changeable. It is disastrous to confuse them. -- Madeleine L'Engle___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Parsing of HEX bytes using Perl

2006-10-26 Thread Dharshana Eswaran
Hi Deane Rothenmaier,I am sorry for using IM-lish. I will surely make sure that i don't commit this mistake again in any mailing lists. Since i was in a hurry, i did not notice the IM-lish language used by me. Sorry once again and Thanks for the feedback.
I completely understand what you have told in the mail. Thanks and Regards,DharshanaOn 10/26/06, 
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

USE ENGLISH, not IM-lish; this is NOT an AOL chat room, and we're not a bunch of 14-year-olds.

Ur is not a word, it is the name of an ancient Chaldean city. It's also a prefix meaning original or prototypical, as in ur-lord, for you Thomas Covenant fans. 


What ur might mean to anyone for whom American English (not to dignify it as being anything of the sort) is not their native tongue is, as was previously mentioned by another poster, open to misinterpretation and causes unnecessary confusion.


If ur (you're) as lazy in ur (your) coding as ur (you are) in your emailing, one would be amazed to find that you have anything that wurx.

IMHO, it's bad enough that smileys and acronyms, such as IMHO, have weaseled their way into this forum; don't make things worse by using IM-lish.

Don't make me come through these wires and smack your fingers with my ruler!

Deane Rothenmaier
Systems Architect
Walgreens Corp.
847-914-5150

Truth is eternal, knowledge is changeable. It is disastrous to confuse them. -- Madeleine L'Engle
___Perl-Win32-Users mailing listPerl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: OT: Parsing of HEX bytes using Perl

2006-10-26 Thread Huub Peters
As far as I can tell there is no need for you (Dharsana) to appologies.
It was not you but Chris Wagner that used the IM-lish language.

Normally I would not interfere in these discussions but when someone
is complaining about 'protocols' (Deane Rothenmaier) while making a
big mailing-list 'nono' himself (posting in HTML) I can't sit back and say
nothing.

Not intended as a flame or anything, I agree with the things Deane stated 
but
I hope he takes my critisism to value as well.
May we all enjoy a nice and proper mailing list :-)

(Yes I did end that with a smilie on purpose)

Regards,

Huub Peters



- Original Message - 
From: Dharshana Eswaran
To: [EMAIL PROTECTED]
Cc: perl-win32-users@listserv.activestate.com
Sent: Thursday, October 26, 2006 3:54 PM
Subject: Re: Parsing of HEX bytes using Perl



Hi Deane Rothenmaier,

I am sorry for using IM-lish. I will surely make sure that i don't commit 
this mistake again in any mailing lists.

Since i was in a hurry, i did not notice the IM-lish language used by me. 
Sorry once again and Thanks for the feedback.

I completely understand what you have told in the mail.

Thanks and Regards,
Dharshana



On 10/26/06, [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote:

USE ENGLISH, not IM-lish; this is NOT an AOL chat room, and we're not a 
bunch of 14-year-olds.

Ur is not a word, it is the name of an ancient Chaldean city. It's also a 
prefix meaning original or prototypical, as in ur-lord, for you Thomas 
Covenant fans.

What ur might mean to anyone for whom American English (not to dignify it 
as being anything of the sort) is not their native tongue is, as was 
previously mentioned by another poster, open to misinterpretation and causes 
unnecessary confusion.

If ur (you're)  as lazy in ur (your) coding as ur (you are) in your 
emailing, one would be amazed to find that you have anything that wurx.

IMHO, it's bad enough that smileys and acronyms, such as IMHO, have weaseled 
their way into this forum; don't make things worse by using IM-lish.

Don't make me come through these wires and smack your fingers with my ruler!

Deane Rothenmaier
Systems Architect
Walgreens Corp.
847-914-5150

Truth is eternal, knowledge is changeable.  It is disastrous to confuse 
them. -- Madeleine L'Engle
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs








___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: OT - Deane screed

2006-10-26 Thread Chris Wagner
At 08:16 AM 10/26/2006 -0500, [EMAIL PROTECTED] wrote:
USE ENGLISH, not IM-lish; this is NOT an AOL chat room, and we're not a 
bunch of 14-year-olds.

If ur is not a word then neither is PCMCIA nor BOFH nor Deane.  Good thing
u work at Walgreens.  U can get the employee discount on those enema kits
which u obviously use to warsh out ur arse on a daily basis.

Don't bring up such nonsense and don't post in HTML.





--
REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =--
...ne cede malis

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Logger::Simple Deep Recursion Error

2006-10-26 Thread Michael Papet
Hi,

I'm trying to use Logger::Simple in my program with an
empty log file.  When I go to nmake test I get the
following error:

Deep recursion on subroutine Logger::Simple::write
at
C:/Perl/site/lib/Logger/Simple.pm line 84
(#3)

Relevent code from that file:
  push @{$$self{HISTORY}},$error;
  carp $error\n if $$self{CARP};
  $self-write($error); # line 84
}

1. Is there something I'm missing?  
2. Can someone suggest a fix?
3. Is there a working logger in the activestate repo? 
4. Where do I report bugs? Activestate or back to author?

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Time::HiRes inaccurate on win?

2006-10-26 Thread Daniel McBrearty
I wrote a script today that started a thread that was polling every
1000ms. I used

use Time::HiRes qw( usleep );
usleep(1000 * 1000);

I didn't get the stopwatch out, but it looked as if the timing was way
off. As I need to scale to much shorter timings, I need to use this
module.

Does anyone else have this experience and know why it is so?

cheers

Daniel

-- 
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: OT - Deane screed

2006-10-26 Thread Deane . Rothenmaier

Okay, I take back what I said about us not all being 14-year-olds

Deane Rothenmaier
Systems Architect
Walgreens Corp.
847-914-5150

Truth is eternal, knowledge is changeable. It is disastrous to confuse them. -- Madeleine L'Engle___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: help with sockets

2006-10-26 Thread Alejandro Santillan
Thanks Rob. I think that my problem is just the terminator character, but on
the string sent by the server, and not mine.

I am using this script now:
use IO::Socket;

# create a tcp connection to the specified host and port
$handle = IO::Socket::INET-new(Proto = tcp,
PeerAddr  = $host,
PeerPort  = $port,
Type = SOCK_STREAM)
   or die can't connect to port $port on $host: $!;


$handle-autoflush(1);  # so output gets there right away
print STDERR [Connected to $host:$port]\n;

#Now I begin to talk to the server:
#this is the
$message=8=FIX.4.0.C9=3935=A9998=D37659997=44437349996=Bara10=180;
#and I send it in the face of the server:
print $handle $message\n;

#Now I read the response, and here is the problem:

#1. This failed miserably. The program hanged indefinitely
# @answerfromserver=$handle;
#$answerfromserver=join ,@answerfromserver;
#print $anserfromserver;

#2. This failed also miserably. The program hanged indefinitely
#my $byte;
#while (sysread($handle, $byte, 1) == 1) {
#print $byte;
#}

#3. This worked, after several tries when I gess correctly the right length
of the answer to be 55 bytes!!!
for($i=0;$i57;$i++){
sysread($handle,$byte,1);
print $byte;
}


The output was:
8=FIX.4.0.C35=A52=10/26/2006 8:16:10 AM100=PFG10=999
What is simply correct, but if I put 58 instead of 57, the program hangs
indefinitely.
Obviously I don't know the lengh fo the message beforehand.

Anyone has any idea why this happens and how to avoid it?

Thanks

Alejandro


- Original Message - 
From: Sisyphus [EMAIL PROTECTED]
To: Alejandro Santillan [EMAIL PROTECTED];
activeperl@listserv.ActiveState.com
Cc: perl-win32-user perl-win32-users@listserv.ActiveState.com
Sent: Thursday, October 26, 2006 1:24 AM
Subject: Re: help with sockets



- Original Message - 
From: Alejandro Santillan [EMAIL PROTECTED]
.
.

 use IO::Socket;

 $message1=8=FIX.4.0.c☺35=A☺9998=D3765☺9997=4443734☺9996=Bara☺;

#Try instead:
$message1=8=FIX.4.0.c☺35=A☺9998=D3765☺9997=4443734☺9996=Bara☺\n;

I don't know if that will fix the problem, but it's worth a try.

Cheers,
Rob


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: help with sockets

2006-10-26 Thread Alejandro Santillan
Thanks Rob. I think that my problem is just the terminator character, but on
the string sent by the server, and not mine.

I am using this script now:
use IO::Socket;

# create a tcp connection to the specified host and port
$handle = IO::Socket::INET-new(Proto = tcp,
PeerAddr  = $host,
PeerPort  = $port,
Type = SOCK_STREAM)
   or die can't connect to port $port on $host: $!;


$handle-autoflush(1);  # so output gets there right away
print STDERR [Connected to $host:$port]\n;

#Now I begin to talk to the server:
#this is the
$message=8=FIX.4.0.C9=3935=A9998=D37659997=44437349996=Bara10=180;
#and I send it in the face of the server:
print $handle $message\n;

#Now I read the response, and here is the problem:

#1. This failed miserably. The program hanged indefinitely
# @answerfromserver=$handle;
#$answerfromserver=join ,@answerfromserver;
#print $anserfromserver;

#2. This failed also miserably. The program hanged indefinitely
#my $byte;
#while (sysread($handle, $byte, 1) == 1) {
#print $byte;
#}

#3. This worked, after several tries when I gess correctly the right length
of the answer to be 55 bytes!!!
for($i=0;$i57;$i++){
sysread($handle,$byte,1);
print $byte;
}


The output was:
8=FIX.4.0.C35=A52=10/26/2006 8:16:10 AM100=PFG10=999
What is simply correct, but if I put 58 instead of 57, the program hangs
indefinitely.
Obviously I don't know the lengh fo the message beforehand.

Anyone has any idea why this happens and how to avoid it?

Thanks

Alejandro


- Original Message - 
From: Sisyphus [EMAIL PROTECTED]
To: Alejandro Santillan [EMAIL PROTECTED];
activeperl@listserv.ActiveState.com
Cc: perl-win32-user perl-win32-users@listserv.ActiveState.com
Sent: Thursday, October 26, 2006 1:24 AM
Subject: Re: help with sockets



- Original Message - 
From: Alejandro Santillan [EMAIL PROTECTED]
.
.

 use IO::Socket;

 $message1=8=FIX.4.0.c☺35=A☺9998=D3765☺9997=4443734☺9996=Bara☺;

#Try instead:
$message1=8=FIX.4.0.c☺35=A☺9998=D3765☺9997=4443734☺9996=Bara☺\n;

I don't know if that will fix the problem, but it's worth a try.

Cheers,
Rob


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: help with sockets

2006-10-26 Thread $Bill Luebkert
Alejandro Santillan wrote:

 The output was:
 8=FIX.4.0.C35=A52=10/26/2006 8:16:10 AM100=PFG10=999
 What is simply correct, but if I put 58 instead of 57, the program hangs
 indefinitely.
 Obviously I don't know the lengh fo the message beforehand.
 
 Anyone has any idea why this happens and how to avoid it?

Try just reading a max size buffer and taking what you get:

my $buffer;
my $bytes = sysread ($handle, $buffer, 1024);
if (not defined $bytes or $bytes  0) {
# err
} elsif ($bytes == 0) {
# EOF
}
# we now have $bytes worth of data in $buffer.
# process the data and do a select before the next read
# unless blocking is OK
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Time::HiRes inaccurate on win?

2006-10-26 Thread $Bill Luebkert
Daniel McBrearty wrote:

 I wrote a script today that started a thread that was polling every
 1000ms. I used
 
 use Time::HiRes qw( usleep );
 usleep(1000 * 1000);
 
 I didn't get the stopwatch out, but it looked as if the timing was way
 off. As I need to scale to much shorter timings, I need to use this
 module.
 
 Does anyone else have this experience and know why it is so?

Works for me - the longer the time, the more accurate it should be since
timers don't have the same resolution that clocks do.  I think they're
accurate to 10-15 msec on Intel and use message passing which could affect
shorter times.  You can also use Win32::GetTickCount for a possibly more
accurate resolution (not a timer per se).  QueryPerformanceCounter /
QueryPerformanceFrequency can access an 8 usec counter if avail.  I have
some code after this snippet that you could try if you need to time a
chunk of code accurately - just call start_PC_timer before and stop_PC_timer
after.

Try this and see what you get (also try varying the time - I'm using
10 secs below):

use strict;
use warnings;
use Time::HiRes qw(usleep);

for (1 .. 10) {
my $pt0 = Win32::GetTickCount ();
usleep ($_ * 1000 * 1000);
printf %.3f seconds\n, (Win32::GetTickCount () - $pt0) / 1000;
}

__END__


#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

use strict;
use warnings;
use Win32::API;

my $QueryPerformanceCounter;# API function obj once set in PC_init
my $QueryPerformanceFrequency;  # API function obj once set in PC_init
my $PC_Freq;# computed performance counter freq in seconds
my $QPC_Ovhd;   # computed overhead of QPC API call in seconds

sub init_PC {   # set 4 global vrbls for using timing routines

return if $QueryPerformanceCounter;

$QueryPerformanceCounter = new Win32::API('kernel32',
  'QueryPerformanceCounter', [qw(P)], 'I') or die
  'Failed to get QueryPerformanceCounter:', Win32::FormatMessage (
  Win32::GetLastError ());  # set global

$QueryPerformanceFrequency = new Win32::API('kernel32',
  'QueryPerformanceFrequency', [qw(P)], 'I') or die
  'Failed to get QueryPerformanceFrequency:', Win32::FormatMessage (
  Win32::GetLastError ());  # set global

my $Freq = pack 'I2', 0;
if (not $QueryPerformanceFrequency-Call($Freq)) {
die 'QueryPerformanceFrequency call failed:',
Win32::FormatMessage (Win32::GetLastError ());
}

my @Freq = reverse unpack 'I2', $Freq;
$PC_Freq = $Freq[0] * 2**32 + $Freq[1]; # set global

printf QueryPerformanceCounter freq: 1/%u sec\n\n, $PC_Freq if $debug;

$QPC_Ovhd = get_QPC_overhead ();# set global

}

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub get_QPC_overhead {

my $Ctr1 = pack 'I2', 0;
my $Ctr2 = pack 'I2', 0;
if (not $QueryPerformanceCounter-Call($Ctr1)) {
die 'QueryPerformanceCounter call failed:',
Win32::FormatMessage (Win32::GetLastError ());
}

my $max_loops = 100;# adjust down to lower overhead
my $total = 0;
for (1 .. $max_loops) {

$QueryPerformanceCounter-Call($Ctr1);
$QueryPerformanceCounter-Call($Ctr2);

my @Ctr1 = reverse unpack 'I2', $Ctr1;
my @Ctr2 = reverse unpack 'I2', $Ctr2;

printf Start Value: %u, %u\n, $Ctr1[0], $Ctr1[1] if $debug;
printf End Value:   %u, %u\n, $Ctr2[0], $Ctr2[1] if $debug;

my $diff = ($Ctr2[0] * 2**32 + $Ctr2[1]) -
  ($Ctr1[0] * 2**32 + $Ctr1[1]);
printf diff: %u / freq: %u = %f\n\n, $diff, $PC_Freq,
  $diff / $PC_Freq if $debug;
$total += $diff;
}
my $ovhd = $total / $max_loops / $PC_Freq;
printf API Overhead: %.8f seconds\n, $ovhd if $debug;
return $ovhd

}

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub start_PC_timer {

init_PC ();
my $Ctr1 = pack 'I2', 0;
$QueryPerformanceCounter-Call($Ctr1);
my @Ctr1 = reverse unpack 'I2', $Ctr1;
return [EMAIL PROTECTED];

}

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub stop_PC_timer {
my $Ctr1ref = shift;

my $Ctr2 = pack 'I2', 0;
$QueryPerformanceCounter-Call($Ctr2);
my @Ctr2 = reverse unpack 'I2', $Ctr2;
my $diff = ($Ctr2[0] * 2**32 + $Ctr2[1]) - ($Ctr1ref-[0] * 2**32 +
  $Ctr1ref-[1]);
my $et = ($diff - $QPC_Ovhd) / $PC_Freq;
printf Elapsed time: %f\n, $et if $debug;
return $et;

}

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Wrapper-initiated app doesn't return control

2006-10-26 Thread Dennis Daupert




I have a perl wrapper script that initiates three applications.

First app is PuTTY's pageant, which holds the user's credentials,
so that the second process, pscp,  can securely login to remote
server and copy a file over.

wrapper starts pageant this way:
my $pageant_cmd = pageant $the-{keypath}/$the-{private_key};

eval {
 $return = system($pageant_cmd);
};

pageant starts, but doesn't return control to my wrapper;
it's designed to run in the system tray;
its icon displays; I can open a second cmd prompt, and
login to remote system without password prompt, as designed.
But in the first cmd prompt, my wrapper is hung.

If I CTRL-C, then rerun wrapper, it works fine. Since pageant is
already started, he simply continues on and runs the other stuff.
But I need to run this as a scheduled job.

How can I get control back, so wrapper can continue?

ActiveState Perl 5.8.8, build 819.

best,

 /dennis



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Time::HiRes inaccurate on win?

2006-10-26 Thread Jan Dubois
$Bill writes:
 Works for me - the longer the time, the more accurate it should be since
 timers don't have the same resolution that clocks do.  I think they're
 accurate to 10-15 msec on Intel and use message passing which could affect
 shorter times.  You can also use Win32::GetTickCount for a possibly more
 accurate resolution (not a timer per se).  QueryPerformanceCounter /
 QueryPerformanceFrequency can access an 8 usec counter if avail.  I have
 some code after this snippet that you could try if you need to time a
 chunk of code accurately - just call start_PC_timer before and stop_PC_timer
 after.

Time::HiRes already uses the performance counter method on Windows, so
you shouldn't need to fiddle with it yourself.

There is some logic in Time::HiRes to adjust for the drift between the
performance counters and the real time clock, which may affect accuracy
for long time intervals.

Cheers,
-Jan

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Strawberry Perl Bugs Report

2006-10-26 Thread as-win32-users
On Mon, 23 Oct 2006, Michael Papet wrote:

 After some more testing, errors appear related to
 Log::Log4Perl

 This is the package that seems to trigger the
 dependency to IO::Tty.

Log::Log4perl does *not* depend on IO::Tty and works fine on Windows.

If you see a problem, please narrow it down to a couple of lines of
reproducable code and post them.

-- Mike

Mike Schilli
[EMAIL PROTECTED]


 You can reproduce the bug by starting cpan and
 entering upgrade.  Admittedly, this is not a great
 idea right now, but it produces the issue on XPSP2.

 Any ideas on how to address this one?

 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 ___
 Perl-Win32-Users mailing list
 Perl-Win32-Users@listserv.ActiveState.com
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs