timer/display
This will sound silly. I need to come up with a simple status indicator of some sort. I have in mind a "spinner." You've seen them before I'm sure, where there's a '-' then it changes to '\' then '|' then '/' then '-' and so forth, so that it appears to be spinning. Actually, I really don't care what the status indicator looks like, I just want it to be easy to code and move in such a way that long-time Windows users will understand that the computer is working and has not hung. My solution so far is just to tuck a print "*" thing in a while loop that's already present doing other work. This is inelegant though, as it prints just thousands of asterisks. I was hoping someone knew of a better way. Is there a module? (I have a DBI search tool that can handle lots of text strings matched against a large db. It takes 2-15 minutes to run and users keep killing the program because they think it's "stuck." For some reason, they never read the instruction line, printed to the screen, that says "This may take up to 15 minutes.") Thanks, John
Re: timer/display-DISPLAY WORKING;THANKS
I don't fully understand why yet; that select(undefPAUSE) thing eludes me, but I'll hit the books tonight. -John Jeff 'japhy' Pinyan To: [EMAIL PROTECTED] Subject: Re: timer/display 07/09/01 02:37 PM Please respond to japhy On Jul 9, [EMAIL PROTECTED] said: >I need to come up with a simple status indicator of some sort. I have in >mind a "spinner." You've seen them before I'm sure, where there's a '-' >then it changes to '\' then '|' then '/' then '-' and so forth, so that it >appears to be spinning. Actually, I really don't care what the status >indicator looks like, I just want it to be easy to code and move in such a >way that long-time Windows users will understand that the computer is >working and has not hung. My solution so far is just to tuck a print "*" >thing in a while loop that's already present doing other work. This is >inelegant though, as it prints just thousands of asterisks. I was hoping >someone knew of a better way. Is there a module? All you need to do is: 1. fork a process to do the spinning 2. have it spin 3. have the main process kill it when the time-consuming part is done Here's the bare code needed: use constant PAUSE => .5; # time to pause in seconds # part 1 if (my $pid = fork) { # DO LONG DBI STUFF # part 3 kill TERM => $pid; # kill the spinning part } elsif (defined $pid) { # part 2 my @chars = qw( / - \ | ); my $i = 0; $| = 1; # turn off output buffering while (1) { print $chars[$i++], "\r"; select(undef, undef, undef, PAUSE); } } -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun. Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734 ** Manning Publications, Co, is publishing my Perl Regex book **
Re: Problems with ^M
--Warning-- Answer coming from relative Newbie! I think you need to press CTRL V and then CTRL M to represent that character. Caret-M doesn't work. I had this problem with some stuff on FreeBSD and was pointed to the following link: http://www.freebsddiary.org/control-m.php Several solutions are provided. -John "System AdministratorTo: <[EMAIL PROTECTED]> "cc: 07/16/01 11:48 AM This is for newbies, right? Can anyone tell me why a s/^M//g won't get rid of the annoying ^M on the end of each line of an imported Paradox database? Is there a better way? I know this has to be simple, yet I can find no reference in my plethora of Perl books. TIA for any and all help - you guys are great and I appreciate the time you all put into this effort to help folks like me :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ok brain fart here...
--Warning-- Newbie responding In what way is it not working? I may be making the same mistake as you. It looks good to me, excepting that there's no prompt to tell someone to type in a string. So if it ran as-is, it would appear to be hanging there, when it's just waiting for input. -John Richie Crews cc: Subject: Ok brain fart here... 07/18/01 08:26 AM Ok I am beating my head why this is not working... $fname = ; chomp $fname; $fletter = substr($fname,0,1); # now we have the first letter of the first name if ( $fletter =~ /[a-f]/i) { print "First letter is a-f\n"; } You get the picture I would have other if's based on the first letter however my regex is not working any idea I just need another prospective on it. Richie Crews Unix Systems Administrator (706) 773 - 3436 CELL (706) 634 - 3681 DESK (706) 634 - 3831 FAX ~ Disclaimer: Any errors in spelling, tact, or fact are transmission errors and not the fault of the sender. ~ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Bundle for cryptography-related stuff?
I just wanted to get some ssh and/or ssl-related modules, since I was toying with writing a simple encrypted data transfer client/server. However, I can't seem to get CPAN to fetch the stuff, since each module requires other modules, which require other modules and so forth and CPAN invariably fails with an error on some front while pushing through layers of requirements. Is there a bundle containing all this stuff? I couldn't find one; thought you folks might know. Thanks, John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
this is basically a regex question; processing 'ps'
Basically, what I want to do here is catch the output from ps. The ultimate goal is to find processes meeting certain criteria (not yet detailed) and kill them. One of the things I'll want to do is find out how long a process has been running, so essentially I'm trying to extract the date from ps and convert it to epoch seconds so that I can make a neat subtraction. Among other things, I'm lousing up the first pattern match. The string would look something like: rootWed Aug 22 04:44:59 2001 DLs I was fussing with split, but the delimiters are inconsistent--could be one space, could be four spaces depending on the length of the user name etc, and I want to pass the entire date section to the subroutine in one scalar. If anyone has any advice, that'd be swell. Obviously, I barely know what the heck I'm doing with pattern matches, and the design itself may be flawed. (And in any case, not everything is in the program; I ripped a bunch of stuff out--including the strict pragma until such time as I know how far down my wrongness goes.) Such are the costs of an inconsistent education ;) Thanks, John === #!/usr/bin/perl use warnings; use Time::Local; sub convert($); @procs=`ps axo user,lstart,state`; shift @procs; #REMOVE HEADER LINE my $currentdate = convert(`date`); ###ARRGH for(@procs){ chomp; $_ =~ /^([a-z]+)\b(\w.*\d{4})\s+?(\S+?)$/; print "$1\t$2\t$3\n"; } #== sub convert { my $datetime = shift; my ($day, $month, $mday, $time, $zone, $year,$hour, $min, $sec) = "null"; if($datetime =~ /PDT/){ ($day, $month, $mday, $time, $zone, $year)=split (/\s+?/, $datetime); ($hour, $min, $sec)= split (/:/, $time); }else { ($day, $month, $mday, $time, $year)=split(/\s+/, $datetime); ($hour, $min, $sec)= split (/:/, $time); } return(timelocal($sec,$min,$hour,$mday,$month,$year)); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
regex: can't match pattern... dang
I posted a similar question last week; this is a rephrasing. I have the following strings: rootWed Aug 22 04:44:59 2001 DLs rootWed Aug 22 04:44:59 2001 ILs rootWed Aug 22 04:44:59 2001 DL rootWed Aug 22 04:44:59 2001 DL rootWed Aug 22 04:44:59 2001 DL rootWed Aug 22 04:44:59 2001 DL rootWed Aug 22 04:46:37 2001 Is rootWed Aug 22 11:46:38 2001 Ss rootWed Aug 22 11:46:39 2001 Ss daemon Wed Aug 22 11:46:40 2001 Is rootWed Aug 22 11:46:41 2001 Is rootWed Aug 22 11:46:41 2001 Ss rootWed Aug 22 11:46:41 2001 Is rootWed Aug 22 12:31:21 2001 Is postfix Wed Aug 22 12:31:21 2001 I rootWed Aug 22 12:32:21 2001 Ss nobody Wed Aug 22 12:32:21 2001 I nobody Wed Aug 22 12:32:22 2001 I nobody Wed Aug 22 12:32:22 2001 I nobody Wed Aug 22 12:32:22 2001 I I want three things: user, the entire date, the state. I'm currently trying to get this with: for(@procs){ /^(.{7})\s+?(.{24})\s+?(\S+?)$/; I want $1 to be the user (e.g. 'root' 'postfix'). I want $2 to be something like 'Wed Aug 23 05:30:01 2001'. I want $3 to be the state, which was a lot of forms, but which is, for example 'DLs' above. Shouldn't this get the first 7, then 24 characters, then the glop that's left over? What am I doing wrong? -John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: extracting character string
Regular expression, unpack(); depends on exactly what you want to do... Can you be more specific, or give an example? _J COLLINEAU Franck FTRD/DMI/TAM <[EMAIL PROTECTED]To: "Perl (E-mail)" <[EMAIL PROTECTED]> lecom.com> cc: Subject: extracting character string 09/25/01 05:10 AM Hi! How can i do to extract a string between two others strings ? Thanks Franck -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Net::FTP module
http://www.cpan.org/modules/01modules.index.html Complete module list. I may be wrong (relative newbie) but I thought Net-FTP was part of the perl-5.6.1 package... If you have a Windoze system, you can use 'ppm' at the command line. Then at 'ppm> ' you can 'search Net' to see what's available or 'query' to see what you've got. -J Sofia cc: Subject: Net::FTP module 09/25/01 09:40 AM >From where can I download the Net::FTP module? Thanks in advance __ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: parsing strings
(Newbie responding) I think: $part2 = substr($part1, 0, 4); That's string, position from which to start, length The parentheses aren't technically necessary; I just like them... -J Greg.Froese@Fe derated.CATo: [EMAIL PROTECTED] cc: 09/25/01 10:32Subject: parsing strings AM Hi, I've been programming for a number of years, but I'm VERY new to Perl, and it looks like a lot of fun. However, I'm very much in the learning stage, so please be patient, I'm still learning all the keywords etc... I'm curious how I can parse part of one variable into another ex: $part1 = "this is a great day" # I want $part2 = the first four letters of $part1 (this) how would I do this? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with 'use strict'
--Newbie answering! Grain o' salt... Could it be that strict is objecting to the non-localized variables in the library script? What do the errors look like? Also--and I may not understand this fully, so don't trust anything I say--shouldn't the initialize_dbi subroutine return something to be used the main script. Seems like there needs to be a handle in there somewhere... ? I'll be interested to see what others say... -J David Gilden <[EMAIL PROTECTED]>, [EMAIL PROTECTED] cc: 10/26/01 02:39 Subject: Re: problem with 'use strict' PM On Friday, October 26, 2001 at 5:38 PM, [EMAIL PROTECTED] (Brett W. McCoy) wrote: > > Sorry, I meant that to say "And it runs without 'use strict'? Yes the code works fine, untill I try to use strict Dave ** * Cora Connection Your West African Music Source * * http://www.coraconnection.com/ * * Resources, Recordings, Instruments & More! * ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Off-Topic (200%) - Where are you from?
Seattle, Washington -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Fwd: RE: Sendmail alternatives]
I've become fond of postfix. It's reputed to be highly secure and is reasonably fast. And it's much, much easier to configure (to my mind anyway). See postfix.org -John Seattle,WA "Johnson, Shaunn" To: 'Miles Sapp' <[EMAIL PROTECTED]>, bsm.com> cc: Subject: RE: [Fwd: RE: Sendmail alternatives] 11/14/01 02:44 PM --ah. --i haven't been on this list for very long. coming from a unix background, there *are* things that are quirky, thus, you should at least keep up within a few versions of sendmail. --i should read the bad things that were said about sendmail. i mean, you can pretty much customize it (the mc files are getting pretty easy to put together) any way you choose. there is also a list of security features you can flag to make it 'secure' (i use the term loosely). --but if you're not interested in sendmail, what type of OS platforms are you using? maybe i can get an idea of what other tools we use and make a constructive suggestion. --is it that you need another mailer and didn't want to go with sendmail? (like smail or whatever?) -X -Original Message- From: Miles Sapp [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 14, 2001 5:22 PM To: [EMAIL PROTECTED] Subject: [Fwd: RE: Sendmail alternatives] I'm not referring to anything specific. I don't know that much about it, I've just seen people say bad things about Sendmail on this mailing list in the past and wondered if there is something better that is in common use. Original Message Subject: RE: Sendmail alternatives Date: Wed, 14 Nov 2001 16:48:05 -0500 From: "Johnson, Shaunn" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] --howdy --just a question: what version of sendmail are you referring to? there are a slew of items that has security measures (some of it is due in part of your system security), but sendmail is getting pretty good at telling people what they are and how to fix it. as a rule of thumb, never go with the default installation. --before i go much further, i haven't touched sendmail since 8.8.X ... i know a lot has changed. what security problem are you referring to. (this might be a question that is best taken off line from the 'perl.org' mail list). -X -Original Message- From: Miles Sapp [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 14, 2001 4:21 PM To: [EMAIL PROTECTED] Subject: Sendmail alternatives I've heard Sendmail isn't a very good mail program because of security holes, etc. Can anyone recommend a good alternative script for sending mail from an HTML form? Thanks! Miles -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is A File Encrypted?
I assume you mean just files on a drive, rather than files in an email... (which could be s/mime or openpgp or just flat out encrypted). I can't really think of any better tests--although I think you'd have to be careful looking for patterns in the text. Could someone with a different character set throw you off? Anyway, ascii armored pgp and gnupg files usually have a comment section at the beginning of the encryption block that reads, for example, "-BEGIN PGP MESSAGE-" (That's five hyphens I believe.) Following it is a version line, which may also be useful if you want to capture it. Mine reads: Version: Gnupg v1.0.6 (SunOS) Hope that helps. -John Ahmed Moustafa To: Ray Murphy <[EMAIL PROTECTED]> Subject: Re: Is A File Encrypted? 12/06/01 09:13 AM If you expect a certian pattern of text in the file, I think, you can grep the file from the expected text pattern. If you find any, then the file is not encrypted; otherwise, the probability of the file being encrypted would be higher. --Ahmed [EMAIL PROTECTED] | http://arbornet.org/~ahmed On Thu, 6 Dec 2001, Ray Murphy wrote: > Hello, > > Want to make sure I'm not missing anything here. My > task is to see if a file looks like it's encrypted. > I'm splitting the path/filename/extension via > File::Basename and checking to see if the extension is > ..pgp or .gpg. I'm also checking to see if the file is > a text file via 'if (-T $file)'. Is there any other > (better) way of testing to see if a file is encrypted? > I don't want to call the decryption routines if the > file is not encrypted. > > Cheers > > Ray. > > __ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Advice Wanted: authenticating users with perl
Okay, let me just start by saying that I'm only looking for advice and triage. (In other words, I'm not asking you to do the work for me. Please don't send nasty emails along the lines of "Use Google you moron." Done that; there's a lot out there.) So my big project for Jan is the following: Write a client/server where- -client runs on Windows w/activestate -daemon runs on Solaris -client taps server, server responds with query for password -client takes password from user (preferably without echoing) and encrypts or hashes it -sends to server, which authenticates agains the Unix password file -server oks -client sends file across socket -server checks file, severs connection; does something with file This is probably trivial for some of you, but it's a big project for me. I'd love advice on the password authentication component in particular (e.g. module suggestions). But if anyone can recommend a site with sample code I can play with, or any number of books on the subject that would be great. I just want models and examples and references. I've ordered a book by the oft-acclaimed Lincoln Stein, "Network Programming with Perl." Do you think this will go a long way toward helping me? (As I hope.) Thanks, John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: C vs. Perl
I personally think if you have working, secure scripts in Perl, and are accustomed to maintaining them, then it is not worthwhile to port to C. While it is faster, I think the time spent fussing with the porting, etc is not worth it. If you really, really need more speed, I would suggest that throwing more hardware at the problem is probably the better, cheaper way. (Cheaper when you measure the cost of the time you'd spend otherwise...) -J "Agustin Rivera" To: <[EMAIL PROTECTED]> Subject: C vs. Perl 01/02/02 09:10 AM Ok, the local Linux guru has proclaimed that C would be faster than Perl. I know C is very effecient so I don't really doubt him, but my question is would it make that much of a difference? I certainly wouldn't mind learning C, the only question is would be worth the time to port our Perl scripts over to it? Right now our setup is Apache w/modperl, and I'm getting quite good at taking advantage of modperl's benefits. Hope everyone had a safe New Year, Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Security advice: SHA vs crypt for authenticator
Hello, I'm using a nice little GDBM file for authentication. It just stores users and passwords as SHA1 hashes. When I need to authenticate someone (fewer than 15 lines in the dbm file) I just tie it and compare the SHA'd user input against the hex value in the dbm file. (The file is not publicly readable.) It has been suggested, however, that this is not adequately secure and that the passwords would be better stored crypted or some such. I don't really see the difference between a SHA password and a crypted password in this context. Wouldn't they be equally difficult to crack? Oh, I should add that the authenticator runs as part of a server daemon on a remote system, and so authentication is performed as the same user each time. Just wanted to collect some opinions before I go further. (I'm perfectly willing to accept the possibility I'm wrong--if I weren't I wouldn't ask--so fire away.) Thanks, John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Term::ReadKey on Win32 Changing Readmode?
Okay, I've got a little script that takes user passwords on a Win32 terminal client. I've used Term::ReadKey from the activestate module list to turn off screen echo. So it's something like sub{ ReadMode 2; #turns off echo Prompt for password; Get password; ReadMode 1; #should turn echo back on } So it turns the screen echo off nicely, but echo won't turn back on. I've tried ReadMode 0 as well. The docs suggest that ReadMode 1 is 'normal' but danged if I can get it back. Am I missing something stupid? Thanks, John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Advice wanted: source code to perl-postgres web app
Hello, I'm looking to prototype a system with a postgresql back end where the gui is provided conveniently in a web browser. Though I considered using php for connectivity, I currently lean toward perl. (I'm not trolling here. My only reason for choosing perl over php is that I know more about it.) I am new at this though, and I think it would help me to be able to root though source code to an existing app, just to see how it all hooks together. Does anyone know of a postgresql-perl-apache application available for download with source code -- preferably well-commented? I just got the Practical Postgresql book from O'Reilly, which really talks up this LXP app server component. Anyone used it, or used it in combination with Perl? Thanks, John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
^] : what is this?
Sorting through a dump from FileMaker Pro (which, let me digress to mention, I _hate_) trying to wedge the stuff in a little checking/reconciliation script. I ran it through dos2unix, but still find a character that looks like ^] all over the place. What is this? Tried a few subs in vi and perl and haven't hit it yet. Thanks, John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]