From jonathan at stl.gathman.org Sat Jul 3 19:16:14 2004 From: jonathan at stl.gathman.org (Jonathan Gathman) Date: Sat, 03 Jul 2004 18:16:14 -0500 Subject: [Linux] Re: PERL SCRIPT WRITING In-Reply-To: <20040703213839.54201.qmail@web52806.mail.yahoo.com> References: <20040703213839.54201.qmail@web52806.mail.yahoo.com> Message-ID: <40E73E3E.7000704@stl.gathman.org> Hi Ronda! Regarding home movement: Elizabeth is coming July 7 to help finish up with getting this house ready to sell. We're excited that she is coming! Right now, we are pre-packing (i.e. decluttering) is part of that process, along with a thousand other details. The closing date on the new house is Aug 20, wo regardless of what happens on this house, that is when we'll start moving to the new one. Regarding Perl: If you have Linux, it's usually part of the installation, or you get it off the disks. Stuart usually recommends "freshmeat.net". However, there is also a "Perl.com", run by O'Reilly, the computer publisher. That appears to be a center for downloading, so I'm sure it has Windoze versions... One of my coworkers recently taught a Perl class for our extended group. I will ask which book he used, but I suspect it was O'Reilly. I'll write back when I hear from him. Take care, Thanks for writing! Ronda Pierce wrote: > Hi, Jonathan. Hope this message finds you and the family well. Have > you moved in your home yet? > > I am looking for an online course/good book (i.e.,perl script for > dummies) you could recommend for script writing. Perl script is what I > would like to learn but if you know of others that may be quicker and > cheaper that would be helpful as well. I would appreciate any advice on > obtaining the application as well. > > Thank you, > Ronda > > */Jonathan Gathman /* wrote: > > Don't all optical illusions present something that is so close to what > our mind expects, that it tends to adjust the picture? After all, we > have the nerve connections in the back of our eye, slightly the > outside, > where there aren't any actual receptors. We never see this "hole", but > our minds fill it in based on context. (try holding a pencil with an > eraser down and to the left (given your left eye) of the center. Move > it around, and see if you can make the eraser part "disappear".) > > I think our eye tries to line up what looks like little cylinders, the > ends represented by the blue and yellow ovals, but the cylinders are > not > placed where the mind expects, so every eye movement changes the > perspective slightly. > > Of course, all computer screens are optical illusions as well, as they > are really flashing pixels, refreshed at ver! y fast intervals. To > disprove this, I printed it out. While the colors are not as vibrant > with my printer, they still seemed to move, so we can discount the > computer monitor element... > > Thanks Scott, this is really cool! > > > SKM wrote: > > http://www.cs.toronto.edu/~moraes/illusion.html > > > > I do not know how it works, but I will bet that it is related in > part to > > the color of the ovals. If you think of this as a collection of > segments > > consisting of two ovals (blue and yellow) with a connecting black > > biconcave lens, all the circles appear to rotate "away from > yellow" and > > "towards the blue". If you convert the picture to grayscale, the > > illusion is still present but less strong. If you rotate the > image 180 > > degrees, the blue and yellow circles are on opposite sides, but the > > rules just mentioned apply. If you make it a "negative" > (inverting all > > colors) these rules still appl! y. You can see this things > yourself by > > saving the picture from your browser to your desktop and then > > manipulating it with a utility such as Irfan view. > > > > There is an explanation that I do not understand at > > http://psych.upenn.edu/backuslab/vss/vss2004/backus2004.html > > Scott > > > > _______________________________________________ > > Gathnet mailing list > > Gathnet at gathman.org > > http://bmsi.com/mailman/listinfo/gathnet > > > > -- > Jonathan Gathman > "Think, Speak and Do Well" > Urquhart Family Crest > > > _______________________________________________ > Gathnet mailing list > Gathnet at gathman.org > http://bmsi.com/mailman/listinfo/gathnet > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > -- Jonathan Gathman "Think, Speak and Do Well" Urquhart Family Crest From stuart at bmsi.com Sun Jul 4 13:40:01 2004 From: stuart at bmsi.com (Stuart D. Gathman) Date: Sun, 4 Jul 2004 13:40:01 -0400 (EDT) Subject: [Linux] Re: PERL SCRIPT WRITING In-Reply-To: <40E73E3E.7000704@stl.gathman.org> Message-ID: On Sat, 3 Jul 2004, Jonathan Gathman wrote: > Regarding Perl: > If you have Linux, it's usually part of the installation, or you get > it off the disks. Stuart usually recommends "freshmeat.net". However, > there is also a "Perl.com", run by O'Reilly, the computer publisher. > That appears to be a center for downloading, so I'm sure it has Windoze > versions... > One of my coworkers recently taught a Perl class for our extended > group. I will ask which book he used, but I suspect it was O'Reilly. > I'll write back when I hear from him. I also recommend O-Reilly for learning Perl. However, I also recommend not spending too much time learning Perl - only enough to translate to a better language. I say this based on developing a variety of projects in dozens of languages from assembler for half a dozen processors to LISP. I say this despite the fact that Larry Wall, the primary architect of Perl may be a Christian. For a scripting language on the same level with Perl, let me recommend Python. You can download Python for Windows from www.python.org. Various tutorials are online, and there is the O'Reilly book. However, the language and syntax are ridiculously simple (unlike Perl), so you learn the features of the standard library, and how to think "Pythonically" (e.g. list iteration and mapping). I have "The Python Cookbook" which will help with understanding the library and the Python Way. I have converted several non-trivial libraries from Perl to Python e.g: http://www.bmsi.com/python/pysrs.html and the Python code is half the size of Perl including extensive comments. This despite Python using a minimum of special symbols - and hence being much more readable, especially to someone not knowing the language. The culture of the Python developers is more post-modern than Christian - the language is named after Monty Python and that is the kind of humor they enjoy. What can I say? -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flamis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. From stuart at bmsi.com Tue Jul 6 12:54:27 2004 From: stuart at bmsi.com (Stuart D. Gathman) Date: Tue, 6 Jul 2004 12:54:27 -0400 (EDT) Subject: [Linux] Re: PERL SCRIPT WRITING In-Reply-To: <20040704213528.70576.qmail@web52802.mail.yahoo.com> Message-ID: On Sun, 4 Jul 2004, Ronda Pierce wrote: > maybe in the near future ). I use Rational's config./changemangement tools > ClearCase and ClearQuest. I need to create triggers for this new project > thus t! he Perl scripts. I will look into the Python. I believe I will > have the flexibility to choose. If not I will have to use the Perl. Do you > think Python will be a good beginners script and not a waste of time if I > have to learn Perl but a help? The functionality is very similar between Perl and Python. In fact, there is a project to make them use the same virtual machine. However, Perl emphasizes lots of special operators, and tempts programmers to cram as much code into a line as possible. Here is a Perl program to encode a message using RSA public key encryption: #!/bin/perl -sp0777i= $self->{HashMin}; my @secret = $self->get_secret; croak "Cannot verify a cryptographic MAC without a secret" unless @secret; my @valid = (); foreach my $secret (@secret) { my $hmac = new Digest::HMAC_SHA1($secret); foreach (@args) { $hmac->add(lc $_); } my $valid = substr($hmac->b64digest, 0, length($hash)); # We test all case sensitive matches before case insensitive # matches. While the risk of a case insensitive collision is # quite low, we might as well be careful. return 1 if $valid eq $hash; push(@valid, $valid); # Lowercase it later. } $hash = lc($hash); foreach (@valid) { if ($hash eq lc($_)) { warn "SRS: Case insensitive hash match detected. " . "Someone smashed case in the local-part."; return 1; } } return undef; } And here is the same function translated to Python: def hash_verify(self,hash,*data): if len(hash) < self.hashmin: return False secret = self.get_secret() assert secret, "Cannot create a cryptographic MAC without a secret" hashes = [] for s in secret: h = hmac.new(s,'',sha) for i in data: h.update(i.lower()) valid = base64.encodestring(h.digest())[:len(hash)] # We test all case sensitive matches before case insensitive # matches. While the risk of a case insensitive collision is # quite low, we might as well be careful. if valid == hash: return True hashes.append(valid) # lowercase it later hash = hash.lower() for h in hashes: if hash == h.lower(): self.warn("""SRS: Case insensitive hash match detected. Someone smashed case in the local-part.""") return True return False; -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flamis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial.