Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Chris Fedde
why post a python solution here? On Thu, Oct 25, 2018 at 8:58 AM Asad wrote: > Hi , > > Yes i have the code : > > import re > import datetime > from datetime import timedelta > > Header = "*" > > f3 = open ( r"D:\QI\logA.txt", 'r' ) > string =

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Chris Fedde
I cannot emphasize enough how fragile the perhaps obvious regex based comparisons of timestamps can be. I second the approach demonstrated by Илья Рассадин above. There are subtle and difficult to debug problems buried in timestamps. Not least of which is locale ambiguity, discontinuities like

Re: perlbrew and cron

2017-12-07 Thread Chris Fedde
You have to make sure that the cron job has the right path. Usually it can be as easy as calling a wrapper script that sets up the correct environment. On Thu, Dec 7, 2017 at 1:38 PM, SSC_perl wrote: > After moving to a VPS, I'm finally able to use perlbrew to

Re: How to use Text::Wrap correctly

2017-08-23 Thread Chris Fedde
I have a utility I use to wrap logging lines and make them easier to look at. It has different features than you want but down in the core might be a few clues of some use. Without options it generates output like the below: $ wrap /var/log/mail.log Aug 23 10:39:52 crf

Re: DBI and hosts file entries

2017-06-01 Thread Chris Fedde
first you want to be sure that your host can connect to the remote host onn the right port. You can use the telnet command to do that telnet server port where server is the name for the server in your /etc/hosts file and port is the port number on the remote where sybase is listening. iirc

Re: Warnings when sorting by hashref

2017-04-11 Thread Chris Fedde
I like to define a value subroutine. sub myvalue { return uc($options{$_[0]}->{type} // "") } This particular one returns the empty string ("") if $options{$_[0]}->{type} is undefined. Now the sort becomes: sort {myvalue($a) cmp myvalue($b)} keys %options This code is

Re: Using PerlPod creatively

2017-03-30 Thread Chris Fedde
? Thats why i wanted > help decrypting that. > > Thanks > > On Thu, Mar 30, 2017 at 8:41 AM, Chris Fedde <ch...@fedde.us> wrote: > >> Ahamedee1. >> >> The little aphorism "It's always the middle of the story" is just a >> remi

Re: Using PerlPod creatively

2017-03-27 Thread Chris Fedde
Three pieces of advice: One: Remember the Kübler-Ross model: denial, anger, bargaining, depression, acceptance. Two: SQL is going to be a part of Information technology for a long time. Three: It's always the middle of the story. chris On Fri, Mar 24, 2017 at 1:17 AM, Sami Joseph

Re: [OT] app (ncurses?) mechanizer?

2017-03-27 Thread Chris Fedde
About as close as you can get is via the Expect module. It provides ways to interact with interactive programs. https://metacpan.org/pod/Expect There are other ways. One way is to use the POE module. But that is a much more complex approach. By the way, in my opinion this is not OT. :-) chris

Re: How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-16 Thread Chris Fedde
Other comments on this question discuss elevating user permissions via suid, sudo the setuid bit and so on. There are good reasons to need to create files with owner/group that are different from your own, they usually come up in system administration situations. Most common situation where

Re: suggestion for print format string based on configuration

2017-01-03 Thread Chris Fedde
Luca, I think you have a reasonable solution to the problem as you present it. Adding a couple strategic comments might help the clarity. A concern for me is how the $condition variable gets set. If the source data dictates the $condition then deriving them both in the same parser might help:

Re: event driven daemon

2017-01-02 Thread Chris Fedde
which means I can simply tidy up and utilise existing proof-of-concept > scripts that I've already started collecting together (e.g. LED blinker) > > Just as an aside, when did this list get so quiet? I can't believe how few > posts there have been since my OP > > On Wednesday 23

Re: event driven daemon

2016-11-23 Thread Chris Fedde
It might not be too bad an idea to just use processes rather than getting wrapped up in event loops and asynch IO. Forking is cheap and fast in linux. In my opinion it gets overlooked for many cases where it is a perfectly acceptable approach. There are lots of approaches to work queues. The

Re: if element exists in an array

2016-08-18 Thread Chris Fedde
Here is one approach using a perl repl. re.pl $ my @x = qw(3 1 4 2 9 0) $VAR1 = 3; $VAR2 = 1; $VAR3 = 4; $VAR4 = 2; $VAR5 = 9; $VAR6 = 0; $ grep {$_ == 4} @x and 'true' grep {$_ == 10} @x and 'true' or 'false' On Thu, Aug 18, 2016 at 7:35 PM, wrote: > Hello, > > What's the

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-20 Thread Chris Fedde
Kenneth, Below the cut is my example implementation as I understand your requirements. Note that the "compare" routine uses $a and $b which are "special" to perl sort routines. Also the compare routine is written for obviousness rather than for brevity or elegance. The return from compare