Thursday, August 5, 2010
Perl and SQLite
Finally got around to finishing my little SQLite and Perl program. To speed things up, I used a shell script with remote SSH commands to grab the data, then used Perl to stuff it into SQLite. Very cool! Need to use Perl's Net-SNMP on next version but this was mainly an excuse to use SQLite. Glad I did. There's a lot of strangeness - can't get used to putting a dot in front of commands and many of my favorite SQL commands are missing or renamed. Still - SO COOL to be able to create a database on the fly like that.
Saturday, July 10, 2010
Nifty Perl Hack
I threw together a tiny bit of code with the example code from Net::IMAP::Simple to make a program that watches for Mailman unsubscribe messages, logs them, then deletes the message. It was a 5 minute job (except for the part where my iteration was off by one and kept deleting the wrong message). Perl is so handy for things like this.
Friday, May 28, 2010
Juniper Switches and Perl
We have some new switches at work - Juniper. I had a few scripts that could look at a Cisco switch and I could configure and modify Cisco switches. I had heard that the Juniper switches used Perl. Looks like they do. There are quite a few Juniper OS (Junos) Perl modules so maybe this won't be too bad.
Wednesday, May 12, 2010
Jr. High Math - Perl to the rescue
My daughter needed a calculator to check square roots last night. I couldn't believe it - we didn't have one! Well, I had my beloved HP 15C from engineering school days. RPN is cool - right?! Yeah, you can imagine how that went over. So, then I grabbed a slide rule. I know! You guessed it - worse reaction than RPN. So then I grabbed her Dell netbook, which was running Ubuntu Linux , and wrote a Perl hack that was basically
#!/usr/bin/perl
print "Enter a number\n";
$number = stdin;
chomp $number;
$root = sqrt $number;
print "The square root of $number is $root\n";
Ha! It worked and she used it. Perl to the rescue!
#!/usr/bin/perl
print "Enter a number\n";
$number = stdin
chomp $number;
$root = sqrt $number;
print "The square root of $number is $root\n";
Ha! It worked and she used it. Perl to the rescue!
Thursday, April 22, 2010
Programming for kids
I'm always on the lookout for books to get my kids interested in programming - you know - easy introductions. I recently found one while following a link off of PerlBuzz called Falling out of love with a language. In this, the author talks about getting bored with Perl and then discovering Ruby which was described as "Perl done right". I was intrigued so I googled and found a list of the best Ruby books. I then ordered this one used from Amazon:
Learn to Program, Second Edition (The Facets of Ruby Series)
I was really impressed with Ruby. I ran through the 20 minute tutorial and then started reading this book. The book is great! The author teaches children so he knows how to hold your attention. It's fun! I honestly have never in my life seen a better introduction to programming for kids or beginners. So, hopefully, the kids will enjoy learning Ruby this summer. I'm pretty sure my son will like the idea of programming an old style, text based adventure game. When they're done with that, I'll show them Perl.
Wednesday, February 24, 2010
Love the New System Admin w/Perl book (and RCS)!
I've been doing a bit of Perl-LDAP programming and I had always found the 2000 version of Perl for System Administration to be really helpful - especially the tutorials in the appendix (more on that in a bit). I just got the the new version: Automating System Administration with Perl. I was amazed at how much more useful it was. Not only is there 50% more material, ALL of the older stuff has been reworked and freshened. The LDAP section I was using heavily is MUCH improved. Too much goodness to cover now - check it out yourself!
The reason I decided to make the post was to mention RCS, in the books appendix, the author has a 5 Minute RCS Tutorial which makes a strong case for using RCS instead of all of those other revision control systems. I've tried RSC in the past and I've tried CVS and the guys in the office recently tried to get me to use Mercurial (Wow! Talk about overkill for what I do!!) But the authors argument was, this is so simple and easy for your small scripts lying around - why not use it. I was initially daunted by all of the commands and things you could do when I had looked at it years ago but the author distilled it down to a handful of commands. I am going to distill it down further:
1) Check in and unlock your program (leaving a copy):
$ ci -u program
2) To edit, check out and lock your program:
$ co -l program
3) View your revision logs:
$ rlog program
So far, that works well enough for me. Be sure to read the whole 5 Minute RCS Tutorial (see link above). I wish I had used this on my most recent, arduous LDAP programming job. Instead made numbered versions and left them lying all over. I then had to open them to see why this one was named program-4 and how it differed from program-3, etc. I know - silly. Should've stuck with this when I looked at in in 1997 (Hey! I remember the project that caused me to consider rcs then - that's not weird!)
The reason I decided to make the post was to mention RCS, in the books appendix, the author has a 5 Minute RCS Tutorial which makes a strong case for using RCS instead of all of those other revision control systems. I've tried RSC in the past and I've tried CVS and the guys in the office recently tried to get me to use Mercurial (Wow! Talk about overkill for what I do!!) But the authors argument was, this is so simple and easy for your small scripts lying around - why not use it. I was initially daunted by all of the commands and things you could do when I had looked at it years ago but the author distilled it down to a handful of commands. I am going to distill it down further:
1) Check in and unlock your program (leaving a copy):
$ ci -u program
2) To edit, check out and lock your program:
$ co -l program
3) View your revision logs:
$ rlog program
So far, that works well enough for me. Be sure to read the whole 5 Minute RCS Tutorial (see link above). I wish I had used this on my most recent, arduous LDAP programming job. Instead made numbered versions and left them lying all over. I then had to open them to see why this one was named program-4 and how it differed from program-3, etc. I know - silly. Should've stuck with this when I looked at in in 1997 (Hey! I remember the project that caused me to consider rcs then - that's not weird!)
Tuesday, December 15, 2009
Slackware, Perl, SQLite and SOAP
I was playing around with a project and decided it would be nice to finally try to do something useful with SQLite (and I threw in a SOAP server just-for-fun). I recently reloaded my system with Slackware 13. I was amazed at how easy it was to add Perl modules with Slackware. This is probably making someone out there go "Duh!" but under Fedora and Ubuntu (and Xubuntu, which I use a lot) installing modules on a vanilla system means configuring the CPAN.pm. That's not a big deal but Slackware must have a lot of the CPAN.pm config finished already. It just took off and ran! I had all of the modules I use downloaded in nothing flat and with NONE of the usual haggling I usually have to do to get some of them to load. You have to see it to appreciate it.
Subscribe to:
Posts (Atom)
