Re: pound sign trouble
Michael Higgins wrote: Allegakoen, Justin Devanandan wrote: Peter, I was playing around with this earlier. Heres what I get:- Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Perl\Programsperl -e print ord(''); 163 C:\Perl\Programsperl -e print chr(163); C:\Perl\Programsperl for(150..170) { print $_ = , chr($_) , \n; } ^D 150 = 151 = 152 = 153 = 154 = 155 = 156 = 157 = 158 = 159 = 160 = 161 = 162 = 163 = 164 = 165 = 166 = 167 = 168 = 169 = 170 = C:\Perl\Programsperl -e print chr(156); C:\Perl\Programs Is that right? Just in Justin -- Yeah, that's exactly what I got hung up on... and then too hastily posted my hangup. I'm glad you sussed out what I'm gettin' at. I guess the char just gets translated when it prints to STDOUT -- as printing to a file and opening in the same text editor seems to produce the expected character. Basically, I was grabbing a pound value, maybe like m/([\d,]+) and then s//\$/ on a var givent the results of $1 -- and not getting the subs I expected, or errors about unknown characters when I started tweaking it. My 'googling' led me to think I'd have better results if I knew the hex value... and I saw the phenomenon you posted. I finally just replaced them using my text editor and fixed the numbers up with a script. So, at one point, I'd concluded the problem lay with running the script by shelling out from my text editor or maybe just within my code... but why _does_ the char seem to get changed from 163 to 156? Anyway, below is what I came up with, warts 'n all, to try to change a price list from pounds to dollars, and it seems to work, perhaps because I don't capture '' and try to sub it in the result. I have to imagine there's something already done to take care of this in a more authoritative way, but I didn't find it quickly and it seemed it should be easy. I was suprised to find it wasn't, and then, in looking on the web, that other folks had apparently had similar problems, but no posted suggestion I read helped me. I see others just weighed in as well. Thanks to all! -- mike higgins 8 - - - - - - - - - 8 - - - - - - - - $rate = 1.65; foreach my $line (DATA){ $line =~ m/([\d,]+)/; $price = $1; $price =~ s/,//g; $price = sprintf %.2f,($price * $rate); $line =~ s/[\d,]+/\$$price/; print $line; } Or just put it all in a RE and substitute: foreach ... $line =~ s/([\d,]+)/{ my $tmp = $1; $tmp =~ s#,##g; $_ = sprintf '$%.02f', $tmp * $rate }/e; print ... } or maybe more readable: $line =~ s# ([\d,]+) # { my $tmp = $1; $tmp =~ s/,//g; sprintf '$%.02f', $tmp * $rate }#ex; __DATA__ Licence 500 User Licence 250 Users* 2,250 Users 4,250 live data only) 6,900 -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (Free site for Perl/Lakers) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: [Perl-unix-users] Telnet to AIX
Title: Telnet to AIX what does the -a do, the aix server has the same setting -Original Message-From: Sullivan, Patrick [mailto:[EMAIL PROTECTED]Sent: 07 July 2003 04:36 PMTo: Mundell, R. (Ronald); Perl-Unix-Users (E-mail); Perl-Win32-Users (E-mail)Subject: RE: [Perl-unix-users] Telnet to AIX Check your /etc/inetd.conf file - look for the telnet line, if it contains a "-a" after the telnetd (as follows): telnet stream tcp6 nowait root /usr/sbin/telnetd telnetd -a I know this causes some problems on AIX, I am not sure if this is yours but, remove the -a and refresh -s inetd and try again. Thank you,Patrick SullivanCentura Health -Original Message-From: Mundell, R. (Ronald) [mailto:[EMAIL PROTECTED]Sent: Monday, July 07, 2003 5:20 AMTo: Perl-Unix-Users (E-mail); Perl-Win32-Users (E-mail)Subject: [Perl-unix-users] Telnet to AIX Good Day All I am experiencing some strange problems when I telnet to an AIX Unix box. I login Successful, but when I execute a unix call eg. ls -l it does not return any data. If someone knows how to solve this problem or got some advise please help #!/usr/bin/perl -w use strict; use Net::Telnet(); my $Servers = qw|goblin|; my $username = qq|test|; my $password = qq|12345|; my $timeout = 30; my $t = new Net::Telnet( Timeout = $timeout, Prompt = '/[\w:\w:\w+]$/' ); print qq|Open $Server\n|; $t-open ( qq|$Server| ); print qq|Login $Server\n|; $t-login ( $username, $password ); print qq|Done Login $Server\n|; foreach my $user ( sort @UserList ) { chomp $user; my $hostname = $t-cmd ( qq|hostname| ); print qq|Hostname: $hostname\n|; my (@forecast) = $t-cmd ( qq|ls -l| ); print qq|@forecast\n|; } Thank you, Ronald Mundell Technical Specialist Information Security EF24 105 West Street Sandton Tel: 011 8813751(W) 083407(C) This email and any accompanying attachments may contain confidential and proprietary information. This information is private and protected by law and, accordingly, if you are not the intended recipient, you are requested to delete this entire communication immediately and are notified that any disclosure, copying or distribution of or taking any action based on this information is prohibited. Emails cannot be guaranteed to be secure or free of errors or viruses. The sender does not accept any liability or responsibility for any interception, corruption, destruction, loss, late arrival or incompleteness of or tampering or interference with any of the information contained in this email or for its incorrect delivery or non-delivery for whatsoever reason or for its effect on any electronic device of the recipient. If verification of this email or any attachment is required, please request a hard-copy version. This communication is for the use of the intended recipient only. It may contain information that is privileged and confidential. If you are not the intended recipient of this communication, any disclosure, copying, further distribution or use thereof is prohibited. If you have received this communication in error, please advise me by return e-mail or by telephone and delete/destroy it. This email and any accompanying attachments may contain confidential and proprietary information. This information is private and protected by law and, accordingly, if you are not the intended recipient, you are requested to delete this entire communication immediately and are notified that any disclosure, copying or distribution of or taking any action based on this information is prohibited. Emails cannot be guaranteed to be secure or free of errors or viruses. The sender does not accept any liability or responsibility for any interception, corruption, destruction, loss, late arrival or incompleteness of or tampering or interference with any of the information contained in this email or for its incorrect delivery or non-delivery for whatsoever reason or for its effect on any electronic device of the recipient. If verification of this email or any attachment is required, please request a hard-copy version.
Re: pound sign trouble
- Original Message - From: Peter Guzis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 11:30 AM Subject: RE: pound sign trouble My Windows 2000 box exhibits the same behavior. I believe you are running into an ancient limitation of the DOS shell. DOS and its descendents have never been particularly good at handling extended characters. Back in the day, if you tried to print a text file containing those characters to a printer it was not what one would expect. perl -e print ord(someextendedcharacter); will yield wildly inaccurate results. However, if you place the same statement in a perl script file and run it, everything works as intended. It seems to be always a matter of converting between cp850(DOS) and cp1252 (Windows) codesets - which can be done with Text::Iconv or the Encode module (perl 5.8 only). The annoying thing is that it's difficult to anticipate when such conversions are going to be necessary. I would have expected that perl -e print ord(''); would produce '156', in which case no such conversion would be needed. I expected that becauses if I run the following script and enter the symbol at the prompt, it prints 156. my $sym = STDIN; chomp($sym); print ord($sym); I am no longer surprised when my expectations are incorrect :-) Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Quote
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 12:19 AM Subject: Quote THIS E-MAIL CONTAINS CONFIDENTIAL AND PRIVILEGED INFORMATION = Hi all: I have this perl script that runs each .sql's line by line and I need to quote each line, Is there a way to do this? By putting the @sqc_in in quotes? Here is example of the code? Thanks, -S open (INFILE,$sqlfilename) or die (\n\n *** Die: Cannot open $sqlfilename file for Inputs\n); @sqc_in = INFILE; chomp(@sqc_in); close(INFILE); for(@sqc_in) {print $_, \n} Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: pound sign trouble
On 08/07/2003 02:20:33 perl-win32-users-admin wrote: Allegakoen, Justin Devanandan wrote: Peter, I was playing around with this earlier. Heres what I get:- Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Perl\Programsperl -e print ord('£'); 163 C:\Perl\Programsperl -e print chr(163); ú [snip] I know that I have to type Alt-156 (numeric keypad) to get a £ into this message. I also know to do the same in my Vim editor, I have to type ^V163. I also know that if I cut and paste from Vim to my email it works fine too. I guess it's just magic. :) I would think that the 163 would be correct and the 156 scancode is a Windoze keyboard/console thingy. No, it's a different codepage thingy. The command prompt window uses CP437 (?) or CP85x whereas Windows would use something like CP125x (sort of ISO Latin). If you redirect that output to a file and then look at the file with an editor (Vim in my case), This depends on the editor, DOS-based editors may interpret 156 as the pound sign whereas Windows-based ones (e.g. Notepad) will display 163 as the pound sign. perl -wle print chr(156),chr(163) pound.txt If you type pound.txt you will see pound sign followed by accented u. Opening it with Notepad you'll see an o-e ligature (or a black box) and a pound sign. -- Csaba Ráduly, Software Engineer, Sophos Anti-Virus Email: [EMAIL PROTECTED], Tel: 01235 559933, Web: www.sophos.com Add live virus info to your website: http://www.sophos.com/link/vfeed ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: pound sign trouble
[EMAIL PROTECTED] wrote: If you redirect that output to a file and then look at the file with an editor (Vim in my case), This depends on the editor, DOS-based editors may interpret 156 as the pound sign whereas Windows-based ones (e.g. Notepad) will display 163 as the pound sign. Windoze doesn't have a real editor - you have to get a real editor from somewhere else. :) -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (Free site for Perl/Lakers) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re[2]: Displaying a status bar
0002 $| = 1;... 5010 $Workbook-SaveAs($path); 5020 $Workbook-Close(); 5030 $Excel-Quit(); 5040 print scriptsetPercent(100)/script; 5050 print h2(Query Completed); 5060 print $r-end_html; Sorry, I don't know the JavaScript you're talking about. But, What happens if you make like 5035 (above) read sleep(10); Does the bar pause? What's the $r object? CGI or mod_perl or something? Make sure you have whatever it is send the correct headers *before* anything else, and that the other HTML elements are good, otherwise the browser may be doing unexpected things. -- Cheers Lee $$=qw$808273788400074285838400657879847269820080698276007265677569820727$; $$=~s$(\d\d)$\$_.=chr(\$1+32)$ge;eval; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: download patches.
Title: RE: download patches. Janardhan, We are working on the same solution... The XML file from shavlik is a little better to play with but microsoft in their infinate wisdom allowed Shavlik to make the XML file so convoluted that it is almost imposible (from my side at least) to get the correct files... What I do is use the XML files from microsoft and shavlik to get the newest bulletins and then use code to compare what the server/workstation has against a hand coded standard. works ok for us.. -Original Message- From: Molumuri, Janardhan [mailto:[EMAIL PROTECTED]] Sent: Monday, July 07, 2003 11:09 PM To: '[EMAIL PROTECTED]' Subject: download patches. Hi all, Can we automatically download patches, by parsing HFnetchk output and XML file. Thanks, --janardhan. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
case insensitive index() ?
Is there a way to do an index function that is case-insensitive? For example: sub stripTag { my $startTag = $_[0]; my $endTag = $_[1]; while (index($content, $startTag)0) { my $first = substr($content, 0, index($content, $startTag) ); my $last = substr($content, (index($content, $endTag)+length($endTag) ) ); $content = $first.$last; } } stripTag(font,); stripTag(FONT,); this code has to be called with each case variant, or I'd have to put a lot of IFs inside the SUB James ps, tips on improving the above coding welcome, I'm just starting to come to grips with Perl. I know there are modules that include similar functions, but I'm doing this as a learning exercise. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: case insensitive index() ?
=James Birkholz= wrote, on Tuesday, July 08, 2003 9:54 AM : Is there a way to do an index function that is case-insensitive? sub stripTagCaseInsensitive { my $startTag = lc($_[0]); my $endTag = lc($_[1]); my $contentCI = lc($content); while (index($contentCI, $startTag)0) { my $first = substr($content, 0, index($contentCI, $startTag)); my $last = substr($content, (index($contentCI, $endTag)+length($endTag))); $content = $first.$last; $contentCI = lc($content); } } stripTagCaseInsensitive(FoNt,); But wouldn't it be easier to use a regex? $content =~ s/\Q$startTag.*?$endTag//i; # untested! Good luck, Joe == Joseph P. Discenza, Sr. Programmer/Analyst mailto:[EMAIL PROTECTED] Carleton Inc. http://www.carletoninc.com 574.243.6040 ext. 300fax: 574.243.6060 Providing Financial Solutions and Compliance for over 30 Years * Please note that our Area Code has changed to 574! * ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: pound sign trouble
$Bill Luebkert wrote: [snip ugly code and verbiage] Or just put it all in a RE and substitute: foreach ... $line =~ s/([\d,]+)/{ my $tmp = $1; $tmp =~ s#,##g; $_ = sprintf '$%.02f', $tmp * $rate }/e; print ... } or maybe more readable: $line =~ s# ([\d,]+) # { my $tmp = $1; $tmp =~ s/,//g; sprintf '$%.02f', $tmp * $rate }#ex; Ahh. That's what I was hoping to do, until I got tripped up by the quirks in the shell and then just got the doco off my plate. Once I re-did it later for the 'pricelist' (which obviously has but one pound denomination per line), I thought, next I'll need a global substitution for a narrative, not just a list. I realized I'd have to loop over the line the way I'd done it, or do it in one shot in a regex, the right way. So, $rate = 1.65; foreach my $line (DATA){ $line =~ s#([\d,]+)# { my $tmp = $1; $tmp =~ s/,//g; (sprintf '$%.02f', $tmp * $rate) } #eg; print $line; } ... seems to work just fine. Thanks for the help. -- mike higgins ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Displaying a status bar
Mark, I set buffering to off ($| = 0) just before saving Excel Workook, it seems to do what I want it to do. Even though I'm not setting the status bar to 100, it seems to disappear smoothly when the processing is done. BTW, here is how I am looping to increment the status bar. $n=0; While ($i) # $i = 7 { ... $n = $n + 4 # I had to play with this number to make it work, finally 4 seems to increment well. print scriptincrement($n)/script; } ... $| = 0; 501 $Workbook-SaveAs($path); 502 $Workbook-Close(); 503 $Excel-Quit(); 504 sleep(1); 505 print h2(Query Completed); 506 print $r-end_html; Mark, thanks for your help and the status bar script. Lee, thanks for you suggestion, I did use sleep just to delay a sec. for the bar to disappear, before printing. Regards, David -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Monday, July 07, 2003 3:01 PM To: 'Hsu, David'; Thomas, Mark - BLS CTR; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Displaying a status bar Hsu, David [mailto:[EMAIL PROTECTED] wrote: Thanks Mark for the status bar. It seems to work well and definitely what I want, but the status bar is disappearing too soon, even though I am controlling when to disappear. [...] The thing is that once the status bar disappears, I am still waiting (~ 45sec) before line 505 is printed. I think it is still processing the Excel workbook because the saved file has not appeared. Any ideas? How are you incrementing the progress bar? Perhaps it's getting to 100% before your setPercent(100) call, and automatically disappearing. Try removing the setPercent(100) and see if the bar still disappears. If that test shows that the bar remains on the page to the end, try putting the setPercent(100) in the body onload event, i.e. body onload=setPercent(100) - Mark. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 2:23 PM To: 'Hsu, David'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Displaying a status bar Hello, Can someone let me know of a method of displaying a status bar on screen(html) in Perl script while it is processing a task. I have tried to print html, but it won't display the image until it has finished processing, and then it displays with the rest of the information. Your problem may be output buffering. Put $|++; in your program before sending any output and you can then print html to the screen. That being said, I've created a javascript library that puts a graphical status bar on the screen, and the percentage, overlay text, and color can be set by a perl program as it running, and at the end, it disappears so as not to interfere with the output. It's useful for long-running programs. Contact me off-list if you want it. - Mark. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Displaying a status bar
Mark, I set buffering to off ($| = 0) just before saving Excel Workook, it seems to do what I want it to do. Even though I'm not setting the status bar to 100, it seems to disappear smoothly when the processing is done. Coincidence. It happens to go over 100 near the end of your loop, and thus automatically disappears. BTW, here is how I am looping to increment the status bar. $n=0; While ($i) # $i = 7 { ... $n = $n + 4 # I had to play with this number to make it work, finally 4 seems to increment well. print scriptincrement($n)/script; } Iteration 1: increment(4), bar at 4% Iteration 2: increment(8), bar at 12% Iteration 3: increment(12), bar at 24% Iteration 4: increment(16), bar at 40% Iteration 5: increment(20), bar at 60% Iteration 6: increment(24), bar at 84% Iteration 7: increment(28), bar at 112% (disappears) This is what you're doing. Is it really what you want? You'd probably be better off using setPercent($p) where $p = 100/$maxsteps * $iteration ... $| = 0; 501 $Workbook-SaveAs($path); 502 $Workbook-Close(); 503 $Excel-Quit(); 504 sleep(1); 505 print h2(Query Completed); 506 print $r-end_html; Mark, thanks for your help and the status bar script. Lee, thanks for you suggestion, I did use sleep just to delay a sec. for the bar to disappear, before printing. This is unnecessary. If the half-second delay after passing 100% is too long, you can send scripthidebar()/script to hide it immediately. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: pound sign trouble
- Original Message - From: $Bill Luebkert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 05:05 Subject: Re: pound sign trouble [EMAIL PROTECTED] wrote: If you redirect that output to a file and then look at the file with an editor (Vim in my case), This depends on the editor, DOS-based editors may interpret 156 as the pound sign whereas Windows-based ones (e.g. Notepad) will display 163 as the pound sign. Windoze doesn't have a real editor - you have to get a real editor from somewhere else. :) In addition to the thoughts on codepage difference, this could also be a font issue. The command prompt uses a different font set than say, for example, Notepad. The monetary pound character is more than likely mapped to different locations within the fonts. I looked at both a Courier and Times New Roman fonts, and both have the monetary pound character mapped to location 163. A console window normally uses raster fonts, which I cannot locate to examine. You can try changing the console font to Lucinda Console, which does have the monetary pound character mapped to location 163. Dirk Bremer - Systems Programmer II - ESS/AMS - NISC St. Peters USA Central Time Zone 636-922-9158 ext. 8652 fax 636-447-4471 [EMAIL PROTECTED] www.nisc.cc ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: case insensitive index() ?
On Tue, 8 Jul 2003, =James Birkholz= wrote: Is there a way to do an index function that is case-insensitive? For example: sub stripTag { my $startTag = $_[0]; my $endTag = $_[1]; while (index($content, $startTag)0) { my $first = substr($content, 0, index($content, $startTag) ); my $last = substr($content, (index($content, $endTag)+length($endTag) ) ); $content = $first.$last; } } stripTag(font,); stripTag(FONT,); this code has to be called with each case variant, or I'd have to put a lot of IFs inside the SUB James ps, tips on improving the above coding welcome, I'm just starting to come to grips with Perl. I know there are modules that include similar functions, but I'm doing this as a learning exercise. In the StripTag sub, my suggestion would be to lowercase the tags and also lower case a copy of the content and do your index on the copy. [EMAIL PROTECTED] Carl Jolley All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: [Perl-unix-users] Telnet to AIX
More info: http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/cmds/aixcmds5/telnetd.htm . . . Flags -a Causes the PTY and socket to be linked directly in the kernel so that the data handling remains in the kernel to improve the performance . . . For use some of our client software just hangs even though the log in works without a hitch. Thank you, Patrick Sullivan Centura Health 303-643-4021 -Original Message- From: Mundell, R. (Ronald) [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 12:02 AM To: Sullivan, Patrick; Mundell, R. (Ronald); Perl-Unix-Users (E-mail); Perl-Win32-Users (E-mail) Subject: RE: [Perl-unix-users] Telnet to AIX what does the -a do, the aix server has the same setting -Original Message- From: Sullivan, Patrick [mailto:[EMAIL PROTECTED] Sent: 07 July 2003 04:36 PM To: Mundell, R. (Ronald); Perl-Unix-Users (E-mail); Perl-Win32-Users (E-mail) Subject: RE: [Perl-unix-users] Telnet to AIX Check your /etc/inetd.conf file - look for the telnet line, if it contains a -a after the telnetd (as follows): telnet stream tcp6 nowait root /usr/sbin/telnetd telnetd -a I know this causes some problems on AIX, I am not sure if this is yours but, remove the -a and refresh -s inetd and try again. Thank you, Patrick Sullivan Centura Health -Original Message- From: Mundell, R. (Ronald) [mailto:[EMAIL PROTECTED] Sent: Monday, July 07, 2003 5:20 AM To: Perl-Unix-Users (E-mail); Perl-Win32-Users (E-mail) Subject: [Perl-unix-users] Telnet to AIX Good Day All I am experiencing some strange problems when I telnet to an AIX Unix box. I login Successful, but when I execute a unix call eg. ls -l it does not return any data. If someone knows how to solve this problem or got some advise please help #!/usr/bin/perl -w use strict; use Net::Telnet(); my $Servers= qw|goblin|; my $username = qq|test|; my $password = qq|12345|; my $timeout= 30; my $t = new Net::Telnet( Timeout = $timeout, Prompt = '/[\w:\w:\w+]$/' ); print qq|Open $Server\n|; $t-open ( qq|$Server| ); print qq|Login $Server\n|; $t-login ( $username, $password ); print qq|Done Login $Server\n|; foreach my $user ( sort @UserList ) { chomp $user; my $hostname = $t-cmd ( qq|hostname| ); print qq|Hostname: $hostname\n|; my (@forecast) = $t-cmd ( qq|ls -l| ); print qq|@forecast\n|; } Thank you, Ronald Mundell Technical Specialist Information Security EF24 105 West Street Sandton Tel: 011 8813751(W) 083407(C) This email and any accompanying attachments may contain confidential and proprietary information. This information is private and protected by law and, accordingly, if you are not the intended recipient, you are requested to delete this entire communication immediately and are notified that any disclosure, copying or distribution of or taking any action based on this information is prohibited. Emails cannot be guaranteed to be secure or free of errors or viruses. The sender does not accept any liability or responsibility for any interception, corruption, destruction, loss, late arrival or incompleteness of or tampering or interference with any of the information contained in this email or for its incorrect delivery or non-delivery for whatsoever reason or for its effect on any electronic device of the recipient. If verification of this email or any attachment is required, please request a hard-copy version. This communication is for the use of the intended recipient only. It may contain information that is privileged and confidential. If you are not the intended recipient of this communication, any disclosure, copying, further distribution or use thereof is prohibited. If you have received this communication in error, please advise me by return e-mail or by telephone and delete/destroy it. This email and any accompanying attachments may contain confidential and proprietary information. This information is private and protected by law and, accordingly, if you are not the intended recipient, you are requested to delete this entire communication immediately and are notified that any disclosure, copying or distribution of or taking any action based on this information is prohibited. Emails cannot be guaranteed to be secure or free of errors or viruses. The sender does not accept any liability or responsibility for any interception, corruption, destruction, loss, late arrival or incompleteness of or tampering or interference with any of the information contained in this email or for its incorrect delivery or non-delivery for whatsoever reason or for its effect on any electronic device of the recipient. If verification of this email or any attachment is required, please request a hard-copy version. This communication is for the use of the intended recipient only. It may contain information that is privileged and
RE: pound sign trouble
Message: 19 From: Sisyphus [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: pound sign trouble Date: Tue, 8 Jul 2003 16:55:46 +1000 - Original Message - From: Peter Guzis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 11:30 AM Subject: RE: pound sign trouble My Windows 2000 box exhibits the same behavior. I believe you are running into an ancient limitation of the DOS shell. DOS and its descendents have never been particularly good at handling extended characters. Back in the day, if you tried to print a text file containing those characters to a printer it was not what one would expect. perl -e print ord(someextendedcharacter); will yield wildly inaccurate results. However, if you place the same statement in a perl script file and run it, everything works as intended. It seems to be always a matter of converting between cp850(DOS) and cp1252 (Windows) codesets - which can be done with Text::Iconv or the Encode module (perl 5.8 only). The annoying thing is that it's difficult to anticipate when such conversions are going to be necessary. I would have expected that perl -e print ord('£'); would produce '156', in which case no such conversion would be needed. I expected that becauses if I run the following script and enter the £ symbol at the prompt, it prints 156. my $sym = STDIN; chomp($sym); print ord($sym); I am no longer surprised when my expectations are incorrect :-) Cheers, Rob What Rob said... Basically, when IBM(or ?) created the extended characterset, they reserved 127-161 as non usable characters (there a few exceptions). Then, of course, Mircosoft ignored said standard and put in some special characters into those Decimal bytes places in the windows-1252 codepage. Such characters as the left qoute, right quote, florin, elipse(looks like 3 periods, but is a single character), etc. Note that this is NOT the same as Latin-1, Latin-2, or any other Latin-x ISO encoding. All of the Latin ISO encodings properly follow this standard of not using these reserved characters. This is something which is a hugh headache when using XML since XML parsers assume (in theory, we will eventually get there) that all passed data is encoded as utf-8. If you try to parse a file containing either one of the Latin-x or windows-1252 characters in which the XML encoding has not been declared, then the parser will croak (this is what is is supposed to do by the way for any newbies). This is to encorage users to start saving all their data in utf-8 format(encoding) in the first place. The basic thing is, most OS's do not support utf-8 directly in their shells at this point(correct me if I am wrong on this), and this is the problem you are seeing with the double character glyph junk which makes up a single character when read. Hope that makes everything clear as mud for ya'll. Joe ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Displaying a status bar
Should've known there's always a correct way. I was just adding the increments without realizing the percentage bar numbers. Took your advice and used setPercent() and removed the sleep(), and left buffering on. Works great. Thanks again, David -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 12:13 PM To: 'Hsu, David'; Thomas, Mark - BLS CTR; [EMAIL PROTECTED] Cc: 'Lee Goddard' Subject: RE: Displaying a status bar Mark, I set buffering to off ($| = 0) just before saving Excel Workook, it seems to do what I want it to do. Even Though I'm not setting the status bar to 100, it seems to disappear smoothly when the processing is done. Coincidence. It happens to go over 100 near the end of your loop, and thus automatically disappears. BTW, here is how I am looping to increment the status bar. $n=0; While ($i) # $i = 7 { ... $n = $n + 4 # I had to play with this number to make it work, finally 4 seems to increment well. print scriptincrement($n)/script; } Iteration 1: increment(4), bar at 4% Iteration 2: increment(8), bar at 12% Iteration 3: increment(12), bar at 24% Iteration 4: increment(16), bar at 40% Iteration 5: increment(20), bar at 60% Iteration 6: increment(24), bar at 84% Iteration 7: increment(28), bar at 112% (disappears) This is what you're doing. Is it really what you want? You'd probably be better off using setPercent($p) where $p = 100/$maxsteps * $iteration ... $| = 0; 501 $Workbook-SaveAs($path); 502 $Workbook-Close(); 503 $Excel-Quit(); 504 sleep(1); 505 print h2(Query Completed); 506 print $r-end_html; Mark, thanks for your help and the status bar script. Lee, thanks for you suggestion, I did use sleep just to delay a sec. for the bar to disappear, before printing. This is unnecessary. If the half-second delay after passing 100% is too long, you can send scripthidebar()/script to hide it immediately. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: case insensitive index() ?
Thanks, Joseph, I'll chew on this tonight. I didn't start by trying a regex, as $content still has many \n in it, but in researching your use of the \Q (which isn't in my tutorial book), I ran across the s modifier. Or I could change all the \n to placeholders and then change them back later. Guess tonight I hit the perl doc on regex. I presume that the \Q is needed to process the variables? I didn't think that was needed. I'm confused about the ? after the * . $content =~ s/\Q$startTag.*?$endTag//i; # untested! At 10:35 AM 7/8/03, Joseph Discenza wrote: =James Birkholz= wrote, on Tuesday, July 08, 2003 9:54 AM : Is there a way to do an index function that is case-insensitive? sub stripTagCaseInsensitive { my $startTag = lc($_[0]); my $endTag = lc($_[1]); my $contentCI = lc($content); while (index($contentCI, $startTag)0) { my $first = substr($content, 0, index($contentCI, $startTag)); my $last = substr($content, (index($contentCI, $endTag)+length($endTag))); $content = $first.$last; $contentCI = lc($content); } } stripTagCaseInsensitive(FoNt,); But wouldn't it be easier to use a regex? $content =~ s/\Q$startTag.*?$endTag//i; # untested! Good luck, Joe == Joseph P. Discenza, Sr. Programmer/Analyst mailto:[EMAIL PROTECTED] Carleton Inc. http://www.carletoninc.com 574.243.6040 ext. 300fax: 574.243.6060 Providing Financial Solutions and Compliance for over 30 Years * Please note that our Area Code has changed to 574! * ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs James Birkholz admin, Posen-L mailing list and website http://www.Posen-L.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: download patches.
I tried this once and gave up due to lack of time. While parsing XML data can be fun, I think you will find it much easier to parse the hfnetchk output than try to sort through the monster XML file it uses. A larger problem is how to download patches. Microsoft does not use one standard web page for all technet/knowledge base/patch files. This is especially true with older patches. In some cases you have a pulldown with different languages and a submit button. In others you have a table of different downloads. Sometimes you have a pseudo-tree view with a patch details branch that needs to be expanded. Do you see a pattern here? A few questions: 1. How many systems would this be running on? 2. Would this be for use on a production network? 3. Are you wanting to automatically install the patches too? 4. Is there a reason the Automatic Updates feature of Windows XP/Windows 2000 SP3 and above won't work? Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Molumuri, Janardhan [mailto:[EMAIL PROTECTED] Sent: Monday, July 07, 2003 9:09 PM To: '[EMAIL PROTECTED]' Subject: download patches. Hi all, Can we automatically download patches, by parsing HFnetchk output and XML file. Thanks, --janardhan. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: download patches.
Not sure if you have investigated Microsoft's Software Update Services (SUS - http://www.microsoft.com/windows2000/windowsupdate/sus/default.asp)... it may be what you are looking to achieve. jeff e. -Original Message- From: Peter Guzis [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 12:23 PM To: [EMAIL PROTECTED] Subject: RE: download patches. I tried this once and gave up due to lack of time. While parsing XML data can be fun, I think you will find it much easier to parse the hfnetchk output than try to sort through the monster XML file it uses. A larger problem is how to download patches. Microsoft does not use one standard web page for all technet/knowledge base/patch files. This is especially true with older patches. In some cases you have a pulldown with different languages and a submit button. In others you have a table of different downloads. Sometimes you have a pseudo-tree view with a patch details branch that needs to be expanded. Do you see a pattern here? A few questions: 1. How many systems would this be running on? 2. Would this be for use on a production network? 3. Are you wanting to automatically install the patches too? 4. Is there a reason the Automatic Updates feature of Windows XP/Windows 2000 SP3 and above won't work? Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Molumuri, Janardhan [mailto:[EMAIL PROTECTED] Sent: Monday, July 07, 2003 9:09 PM To: '[EMAIL PROTECTED]' Subject: download patches. Hi all, Can we automatically download patches, by parsing HFnetchk output and XML file. Thanks, --janardhan. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
module to show the owner of a file
Hello all, Is there a perl module or function which gives me the owner of a file and Directory on both win 2000 and win nt? Thxs, Mohammed Gazal. Register for the Interwoven 6 Launch - putting your content to work http://www.interwoven.com/launch03 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: download patches.
Title: RE: download patches. SUS is your friend: http://www.microsoft.com/windows2000/windowsupdate/sus/default.asp I run this on a little over 1100 computers and it makes my life sooo much easier. Key points: Web based server management Controlled distribution GPO based (or registry based) client management Schedulable automatic nightly sync with Microsoft's servers oh, and free! -Original Message- From: Molumuri, Janardhan [mailto:[EMAIL PROTECTED]] Sent: Monday, July 07, 2003 10:09 PM To: '[EMAIL PROTECTED]' Subject: download patches. Hi all, Can we automatically download patches, by parsing HFnetchk output and XML file. Thanks, --janardhan. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs