|
||
|
||
| Fri, 19 May 2006 |
|
||
|
So, in a bold and brash move, someone actually mentioned Perl at the Perl Mongers Meeting last night. In fact, in addition to Patrick talking about Parrot, we actually wrote Perl code as well. It must be a first. Jeff had an issue where the wonderful admins at his workplace weren't getting the DNS straight on a new DNS server. So, given several hundred names, and a list of the correct IP's, how does one show the admin's which names don't have correct IP's on the new DNS server? Why, you use Perl of course. The simple, boring, 10 minute answer is this code: #!/usr/bin/perl use strict; use warnings; use Net::DNS; my = or die "First argument should be the nameserver\n"; my = or die "Second argument should be the file\n"; open FH, or die "Can't open ]\n"; my = Net::DNS::Resolver->new( nameservers => ); while (my = That takes a nameserver, and file, as arguments. The file has one name / ip per line. It then looks up the hostname at the specified nameserver... and if the IP the nameserver returns is not the same as the IP listen in the file, it displays an error. The real fun was, how little code can one use to perform this task? Golf, as they say! Todd used a bunch of shell commands, and had it in some 75 characters. Well, that doesn't really count, that's like being on a different golf course, but saying you finished with fewer strokes ;-) At the meeting last night, I was able to get it down to 95 characters of pure Perl: perl -MSocket -nle '($x,$y)=split/,/;$y;$z=inet_ntoa((gethostbyname($x)));print if$z ne$y' h I've since shortened it to 81 characters by using a different method to perform the DNS lookup: perl -MSocket -nle '($x,$y)=split/,/;$z=inet_ntoa inet_aton $x;print if$z ne$y' h And then, 75 characters by dropping the need for $z, and getting rid of some spaces: perl -MSocket -nle'($x,$y)=split/,/;print if(inet_ntoa inet_aton $x)ne$y' h Is it possible to not assign variables in the split? I'm not sure, but I think that may be the only avenue left for shortening it more :-) Update: Okay, we can in fact drop the variable assignment in split, and use the default array, @_. I was originally hoping split set $a and $b the way sort does... it doesn't seem to. But, using @_. we can get it down to 73 characters: perl -MSocket -nle'split/,/;print if(inet_ntoa inet_aton $_)ne$_' h Update 2: Aha! We can get rid of split, with a good 'ol regex, bringing us in at 69 characters: perl -MSocket -nle'/(.*),(.*)/;print if(inet_ntoa inet_aton$1)ne$2' h Update 3: Woo! Save a char by using -p instead of -n, 68 chars: perl -MSocket -ple'/(.*),(.*)/;$_=""if(inet_ntoa inet_aton$1)eq$2' h |
||
| /Blog/Computers/Organizations/HPM | Permanent Link | Comments (0) | ||
|
|
||
| Fri, 24 Mar 2006 |
|
||
|
So, I thought maybe the cops finally caught up with me. As I was pulled over shortly after 11pm while on the way home from my Monthly Perl Meeting, I wondered which of my crimes it was they wanted me for. To my surprise, my only offense that bothered him was the fact that not one, but both of the lights by my license plate were out. Oops. He didn't seem very concerned, but he proceeded to ask for my license and registration, which I dug up and gave him. I didn't realize then, but after I arrived at home without incident, I looked at the registration I handed him, and discovered that it was expired. Heh. So, I either gave it to him with enough confidence that he didn't notice the year, or he mumbled something about what an idiot I was, but let me go because he didn't feel like doing any paperwork. Hrm. Update: For the record, I do actually have a current registration. I just handed him the wrong one :-) |
||
| /Blog/Computers/Organizations/HPM | Permanent Link | Comments (2) | ||
|
|
||
| Thu, 18 Mar 2004 |
|
||
|
We had a fun meeting last night. It sounds like a lot of folks want to do some more exploration of additional languages. I kind of like the idea, but I wanted to explore what exactly everyone wants out of that. While I'm eager to explore a variety of languages, I'd also like to see this continue to be primarily a Perl group. Specifically, a group of Perl users who enjoy exploring a variety of languages. I think people who like Perl have something that other programmers don't. It's a certain way of thinking, and a certain kind of passion. It's the reason there are both Perl groups and Perl conferences all across the world, there's nothing like it for any other language development community. It sounds like this is what the other guys are interested in as well, which is wonderful. In a few months (who has time for this stuff), I'd like to do some exploration of O'Caml. It seems that programs written in it do really well in many of the programming contests out there. That made be curious about O'Caml, and the people that use it. |
||
| /Blog/Computers/Organizations/HPM | Permanent Link | Comments (0) | ||
|
|
||
| Wed, 02 Jul 2003 |
|
||
|
The technical meeting this month was smaller than usual, but we talked about a whole bunch of stuff -- it was a lot of fun. This month, it was just Daniel, Shana, and myself. We met at my place, as our usual meeting place wasn't available. I'm not sure yet, but we may end up meeting at individual houses more often. Daniel has been exploring some different IDE's for the Perl coding he does at work. Two of those are IBM's Eclipse and jEdit. Both are Open Source. Both are written in Java. Both support plugins. Both seems kinda neat. They both seem to offer a lot of features to Perl developers. At a glance, it appears that the best feature that Eclipse offers to Perl users is it's ability to tell you, while you're writing code, what is wrong with the code you wrote. If you type "use LPW;" (instead of "use LWP;"), it will immediatly let you know that it couldn't find LPW in @INC. The worst feature that Eclipse offers is, also, the fact that it tells you this in real time. Not that it's not neat or useful, but that it causes the system to get laggy. In fact, Eclipse in general seems a little laggy. Okay, we can disable the syntax checking. But now, we might as well be using jEdit, as jEdit seems to offer a few extra features that makes it worthwhile. This is definitely something to explore though -- even just one plugin could completely change the outlook on the usefulness of the entire system. Shana really took a liking to jEdit. Personally, I'm quite happy with Vim. In fact, there's very little anyone could show me that an IDE offered that Vim either can't offer, or couldn't be easily programmed to offer. Want to see the entire layout of your program in a side panel, and be able to immediatly jump to any subroutine, file, or variable? Just use the Vim Tag List Plugin. Tired of typing out words? How about tab completion? Do you want to complete variables and subroutines in the current file, or more generically complete reserved words from your favorite language? Don't see what you want? Check out the hundreds of plugins on Vim's website. Still no? Vim lets you configure it using Perl, so you have a powerful language at your fingertips which you can use to extend your editor. I'd very much like to hear what an IDE can do that Vim can't. I also spent much of the evening trying to get Perl Panel to work. Perl Panel is kinda neat, it's like a minimal GNOME Panel, but it doesn't require any particular window manager or windowing environment, and it's written in Perl. Why did I spend all evening on it? It's not because Perl Panel is tough to install. Actually, it's quite simple. But I couldn't get it's prequisites to install properly. It wants the more recent versions of Perl-Gtk2. Which, in turn, requires Perl-Glib. And the latest version (0.24) of Perl-Glib released on Sourceforge doesn't compile on RH 9. Argh. Luckily, I ran across some newer beta releases which compile just fine. With that, Perl Panel ran like a champ. I don't know that I'm quite ready to get rid of my GNOME Panel -- but I'm willing too if the right applets come out. Namely, I'd like applets which control XMMS, GAIM, and a battery monitor. A few applets to waste CPU cycles would be nice, having a fish floating around the bottom of my screen has become oddly important to me :-) That's probably easy enough to create though. At the end of our get-together, we explored the differences of DVD <--> TV connectors. RCA, S-Video, and Component Video. We hooked up all three, and flipped through them to visually explore the difference. The result -- we did notice a difference, but the difference was definitely slight. The RCA connection is good, S-Video is slightly better, and Component Video is slightly better than that. The difference we noticed was in some coloring, RCA came across as just a tiny bit darker than the other two, losing some minor color accents that were more visible with S-Video and Component Video. Text was also a bit blurry with RCA -- and less blurry in S-Video. It was still not perfect in Component Video, but there was a visible difference.All the above was with close inspection of all three, when we could immediatly switch back and forth between them. When they aren't all up at the same time, you really can't tell a difference. Daniel felt that it's probably not worth paying extra to get Component Video. I think that if you can get S-Video, that's probably good enough. And now we know :-) |
||
| /Blog/Computers/Organizations/HPM | Permanent Link | Comments (0) | ||
|
|
||
| Sun, 15 Jun 2003 |
|
||
|
Saturday was the first /Burgh?/ Meetup, a get-together of the Harrisburg Perl Mongers and Pittsburgh Perl Mongers. It went pretty well, with a variety of neat talks. Though I don't personally think I'll end up using it, we got a good overview of Interchange. Shana pointed out that one of our friends who runs a music store might have some luck with something like that, without requiring us to write all that functionality from scratch. Hmm, maybe. Chris spoke about generating Java from Perl. While it was pretty neat, at first I didn't think I'd be able to use it. I'm lucky enought to be using Perl at work, I don't need to generate code for other languages. But then I remembered cgi::application::generator does exactly that. Though I don't currently use it, the point is that there are cases where one might even want to generate Perl code from Perl code. So, I'll be keeping an eye open for where that could be put to use :-) I had a fun Lightning Talk on Pittsbughese, with a corresponding module that will convert one's program to Pittsburghese by simply using the module. It's called Lingua::Dialects::Pittsburghese. It's currently quite simple, but I learned about how to use Filter::Simple, which was pretty cool :-) We had a lot of fun, and it sounds like we're all hoping to do it again. Maybe we'll even invite more folks next time. That is, maybe we can invite the guys from Philadelphia, or even the Baltimore group. |
||
| /Blog/Computers/Organizations/HPM | Permanent Link | Comments (0) | ||
|
|
||
| Thu, 13 Feb 2003 |
|
||
|
We had our Harrisburg Perl Mongers social meeting again this Wednesday. We
meet every second Wednesday. I am well aware that people have been
particularly busy lately. Some have been having difficulty seeing their own
wives, let alone finding time for a Perl meeting. Knowing people's schedules, I was particularly pleased to see the turnout this week. It was several people more than I had expected. Although a few notable faces were missed, we definitely had a good time. It's certainly a neat group to get together with. One person in particular who couldn't make it, was Maurice, the group leader. He found himself in a bummer of a predicament recently, when he found himself looking for a job. After many months, he finally found one... which was two and a half hours away. He's currently commuting. Maurice is looking to hand over the reigns, as he doesn't feel that he'll be able to participate as much as he'd hope. Left nominated, is me. While no one has responded to his public query for thoughts on his nomination, I'm inclined to think that most could care less. Not that anyone is cynicle, but that our group is fairly self sufficient. Maurice provided a lot to the group, helping to keep everyone involved, find out how they are using Perl, and such. Others frequently pitch in too, making everyone an important asset. I would happily accept, I feel that I have a lot of great ideas that we can implement as a group. At the same time, great leaders often lead best by inspiring people, and then staying out of the way. There is certainly a compromise in the above. Surely I'll have an opportunity to explore the line. Equally as certain is the fact that I'll error on both sides at one time or another. It appears to be a neat learning experience for me though, and hopefully I'll be able to make a difference, and help the Harrisburg Perl Mongers to thrive. It should be fun. |
||
| /Blog/Computers/Organizations/HPM | Permanent Link | Comments (0) | ||
|
|
||
|
Also, be sure to check out the OpenThought Web Application Environment |
|
Copyright 2003 Eric Andreychek |