Showing posts with label CPAN. Show all posts
Showing posts with label CPAN. Show all posts

Sunday, June 20, 2010

Make your desktop background a live world shot

cron this to run every 30 or 60 minutes and you have a world image updated with sun position and weather.


#!/usr/bin/env perl

use LWP::Simple;

my %image_hash = ( 'world_sunlight.jpg' => 'http://www.opentopia.com/images/cams/world_sunlight_map_rectangular.jpg',
# 'world_weather.gif' => "http://images.intellicast.com/WeatherImg/Satellite/world.gif"
);

foreach my $file (keys %image_hash) {
getstore($image_hash{$file}, $file);
}


Hopefully we don't kill the server that produces these shots.

Wednesday, May 12, 2010

Looking for Crypt::RIPEMD160 Author

I tried to contact the Crypt::RIPEMD160 author today, as well as a bunch of people listed in the README, etc. 5 of the 8 emails bounced immediately. There's a 64bit bug in the module that is causing issues with Crypt::OpenPGP.

Their name is Christian H. Geuer-Pollmann or CHGEUER in pause. If anyone knows how to contact them, I'd like to help fix some of the bugs in this module

Todd

Thursday, May 6, 2010

Looking for Net::Ident author

I tried to contact the Net::Ident author 8 days ago.

Their name is Jan-Pieter Cornet or JPC in pause. If anyone knows how to contact them, I'd like to help fix some of the bugs in this module

So far, I've tried their cpan.org email address and johnpc -- at -- xs4all.nl, but I've gotten no response
Todd

Friday, March 26, 2010

Looking for Net::Daemon author

I just tried to contact the Net::Daemon author - Malcolm H. Nooning

All of the emails I could find for him are bouncing. If anyone knows how to contact him, I'd like to help fix some of the bugs in this module

Todd

Monday, March 22, 2010

Looking for MIA CPAN Authors


I've been looking for the authors of the following modules that are in need of some minor maintenance. Most of the modules have RT queues untouched for multiple years.

If anyone knows how to reach them, please let me know.

Business::UPS - MSOLOMON@cpan.org, jwheeler@cpan.org -- jwheeler's email is bouncing.
Net::AIM - aryeh@cpan.org, perlaim@aryeh.net -- All emails bouncing
Safe::Hole - nakajima@netstock.co.jp, SEYN@cpan.org -
IO::Stty - tex@habit.com, auschutz@cpan.org -- All emails bouncing.

Dated CPAN modules need TLC

So lately, I've been trying to help the perl community by fixing modules that have had their RT queue neglected because the author has gone MIA. This requires I take over the module to fix what needs fixing. In order to take over a module, you need to do the following:

1. Open RT tickets about the issues you are having in the appropriate queue.
2. Email the author(s) with as many email addresses as you can determine, cc'ing modules@cpan.org
3. Publicly post that you're looking for the author in a frequented blog source
4. It doesn't hurt to post to perl monks either.

If all of this fails and multiple weeks go by, modules@perl.org will hook you up.

This is summarized from The PAUSE FAQ

I'll be doing this for a few modules over the next few months that have been bothering me because they have one thing or the other out of date. I've also been writing a dependency tracker for my own purposes, using the META.yml files that come with modules. A surprising amount of modules do not have a proper META.yml file.

I've already started this process on a few modules. Where I could contact the authors, I've found them to be helpful in most cases. In some cases, they fix what I had an issue with. In other cases, they just pass the PAUSE baton on to me and I can fix it myself.

Thursday, February 11, 2010

Net::Jabber::Bot in the news

Ask any CPAN author. It's rewarding and frightening at the same time to hear people mention they're using your CPAN module:

Richard Wallman mentioned Net::Jabber::Bot in his blog today

inverting a hash

Code I've written in the past to swap keys and values

my %hash = ( foo => bar, ... fee=>fo);
my %reversed_hash;
foreach my $key (keys %hash) {
$reversed_hash{$hash{$key}} = $key;
}


or... I could have just done this all along.
%hash = reverse %hash;


When you think of how this works by treating the hash as an array of key/value pairs then just reversing the order of the array, it initially feels somehow "dirty". But give it a few minutes and you realize it's really a frickin elegant solution!

Friday, July 3, 2009

How to kill your system by allocating all memory in perl

Sometimes you want to see how things behave on a host when it runs out of memory

We actually caused a linux host with 128GB RAM to hang until we pulled the plug by doing this.

To allocate more memory, change $procs to a bigger number. If you have 64bit perl, you can kill the host with 1 process, just concatenating strings with the subroutine below.


#!perl
use forks;

my $procs = 2;
for (1..$procs) {
print "Forking: " . `date`;
threads->new(\&mem_load);
}
print "sleeping: " . `date`;
sleep 10;


sub mem_load {
my $str = "0123456789abcdef" x 1024;
$str = $str x 1024;

my $mem = $str;
for (1..130) {
$mem .= $str;
print "$$: $_\n";
}
sleep 9999999;
}

How to create high CPU load in perl

Sometimes you need to test how a host behaves when it's bogged down.

This code is fairly safe. Change $procs to a big number if you want to see it kill your host.


#!perl
use forks;

my $procs = 2;
for (1..$procs) {
threads->new(\&fpu_load);
threads->new(\&cpu_load);
}
sleep 100;

sub fpu_load {
my ($f1, $f2, $sum);
while(1) {
$f1 = rand(1000);
$f2 = rand(1000);
$sum = $f1 * $f2;
}
}

sub cpu_load {
my ($f1, $f2, $sum);
while(1) {
$f1 = rand(1000);
$f2 = rand(1000);
$sum = $f1 * $f2;
}
}

How we should address the DarkPan problem

I just finished reading nperez's blog concerning DarkPan

No, DarkPan is not Larry Wall telling you he's your father. It's a reference to the immense amount of code out there in businesses that are written using old perl practices that most modern developers stopped using 10 years ago. As a result, when we discuss putting new features into perl5, the attitude is to make no changes to the language that would break previous code.

I lost a good 10 hours of sleep at YAPC discussing DarkPan issues. Reading NPEREZ's the blog, I See the same sub issues we discussed at YAPC: CPAN, vendor dependence, fear of upgrade.

CPAN: This is it's own discussion, but I think CPAN really suffers from not being perl version aware. This is why I think it comes up as a DarkPan topic every time. Right now I can say version 1.2 of module XX supports 5.8.8 but 1.3 requires 5.10. The problem is if I use 5.8.8 perl and run 'report updates' in CPAN, it's not smart enough to say you have the most up to date copy of module XX. Instead it reports that version 1.3 is available for download and install.

Dependence on vendor perl: Most UNIX operating systems depend on perl. For this reason, it's messy to tweak the perl that comes with the OS. FINE! Compile your own.

I propose we establish a best practices policy that custom perl be compiled to /usr/local/perl/5.10 and /usr/local/perl/5.8.8, etc. I'm sorry, but it's just not that hard to compile your own and you only have to do it once. As for dependence on binaries like openssl, etc: Compile them too with prefix=/usr/local/perl/utils. Then when compiling your perl modules, make sure LD_RUN_PATH points to /usr/local/perl/utils/lib. Perl is now completely self contained.

Vendor problem solved. You've now got a handy dandy tarball you can throw around on all your hosts that doesn't get in the way of anything vendor related. This goes to the comment Schwern made at YAPC about what PHP does right: You pull it out of the box, install it, and it just works.

Fear of upgrade: How do you eat a 2 ton elephant? 1 Bite at a time. If we have standards for custom perl locations for various versions, then the upgrade can be phased in. When you've decided your script is now 5.10 capable, simply change your first line to be #!/usr/local/perl/510/bin/perl and you're now declaring the script to be 5.10 compliant.

This said, I have a hard time feeling sympathy for DarkPan (my own company included) whining that they have to fix their code if they want their 5.8.3 code to work on 5.10. How is this different from any other language or platform? Off the top of my head, I believe this is a problem in .net, java, IBM WebSphere, etc. Most of these platforms would tell you if you complained: "You want the new features in the new version of the language? You're going to have to upgrade your code"

Modern Perl:
Perl5 does a bad job encouraging good programming practices. While at YAPC, I saw this topic come up in many forms: Modern Perl, perl5i, DarkPan, etc. There's alotta frustration with perl 5 because as we release new versions of perl5, we continue to allow all of the old sloppy programming practices.

My take:
1. Enable strict/warnings by default.
2. add warnings when &subname, is called and tell the coder that their perl4 code needs to be upgraded to use subname();
3. turn on frickin say/switch, etc by default
4. I'm sure there's more.

If the DarkPan code breaks, tell em to go put 1 line of code in their scripts: use sloppyperl;, which would effectively revert the language without requiring a re-code. If all these DarkPan users are so eager to upgrade, make em sweat a little by forcing them to add that one line of code to their scripts.