Re: 25 Years of Perl

2012-11-20 Thread B Maqueira

Not sure if they would fit on the same league of DBI and TT, but to me LWP
and WWW::Mechanize are also true PERL gems.

 On 19/11/2012 17:29, Dave Cross wrote:
 What CPAN modules deserve to be mentioned as part of Perl's history?
 Which Perl infrastructure projects are (or were) important? Are there
 any other technical things that need to be covered?

 I know Tim will not blow his own trumpet but ...
 One of the biggies was and is DBI.

 We used oraperl and ingperl (perl5 stuff) prior to DBI
 and did the oraperl v6 to v7 migration - even in those long
 ago days, perl was being used with real databases for real
 business apps.

 Another biggie was mod_perl,fastCGI and MP's precursor/
 standin/placeholder - cgi-minisvr.





Re: Cool/useful short examples of Perl?

2011-05-30 Thread B Maqueira
Hi Leo,

I have an example on my blog of a script to build sitemaps using TT 
Mechanize (http://codelab.ferrarihaines.com/archives/135). Feel free to
use it if it suits your purpose...

Cheers...

Braudel

 Hi,

 I'm working on http://learn.perl.org/ and I'd like to have a few rotating
 example of what can be done with Perl on the home page.

 The first two I've thought of are below, does anyone have others?

 They don't have to use CPAN modules, one liners are fine as long as it
 is simple to see what they do. I'll have a 'more' link which goes on to
 show full example with line by line explanations.

 Module preference is anything from
 http://search.cpan.org/dist/Task-Kensho/

 E.g.:

 This is probably max sort of size...

   # Send an email
   use Email::Sender::Simple qw(sendmail);
   use Email::Simple;
   use Email::Simple::Creator;

   my $email = Email::Simple-create(
 header = [
   To  = 'Xavier Q. Ample x.am...@example.com',
   From= 'Bob Fishman o...@example.mil',
   Subject = don't forget to *enjoy the sauce*,
 ],
 body = This message is short, but at least it's cheap.\n,
   );

   sendmail($email);

 or

   # Serve static files from document root with a directory index
   # app.psgi
   use Plack::App::Directory;
   my $app = Plack::App::Directory-new({ root = /path/to/htdocs
 })-to_app;

plackup
Accepting connections at http://0:5000/

 Thanks in advance!

 Leo



 ---
 Dr Braudel Maqueira-Iglesias
 Senior Software Engineer
 CSR Plc
 t: +44 (0)790 2664862
 e: brau...@ferrarihaines.com
http://codelab.ferrarihaines.com
 --



Efficient sorting of SNMP oids

2009-10-31 Thread B Maqueira
Dear all,

I need to sort eficiently a large array (~9000) of SNMP OIDs.

I am currently trying the following code:

my @sorted_oids = map { $_-[0] }
  sort { $a-[1] cmp $b-[1] }
 map { [$_, pack('w*', split(/\./,
$_))]  } @oids;

But this fails since it outputs 1.3.6.1.4.1.2333.3.2.61001.1.10 before
than 1.3.6.1.4.1.2333.3.2.8080.1.1.1

Any ideas?

_
Dr Braudel Maqueira
brau...@ferrarihaines.com



Re: Efficient sorting of SNMP oids

2009-10-31 Thread B Maqueira
Peter Corlett wrote:
 On 31 Oct 2009, at 16:03, B Maqueira wrote:
 I need to sort eficiently a large array (~9000) of SNMP OIDs.

 I am currently trying the following code:

 my @sorted_oids = map { $_-[0] }
  sort { $a-[1] cmp $b-[1] }
 map { [$_, pack('w*', split(/\./,
 $_))]  } @oids;

 But this fails since it outputs 1.3.6.1.4.1.2333.3.2.61001.1.10 before
 than 1.3.6.1.4.1.2333.3.2.8080.1.1.1

 Any ideas?

 That's because w format is a BER encoding, and this does not map
 integers into strings such that ordering is maintained. For example,
 16383 encodes to \xff\x7f, but 16384 encodes to \x81\x80\x00 which
 string-sorts earlier.

 Relatively few encodings *do* maintain that ordering. Big-endian
 fixed-width does. So I'd use N* instead in your pack format, mainly
 because I'm not entirely sure whether the components of SNMP OIDs can
 ever be greater than 65535 and thus whether I could thus get away with
 n* to halve the storage required.


Thank you all for the advice.

Using Sort::Key::OID or sort::maker would have been great, except that
we need to deploy the script to a rather large number of servers and it
is traditionally long and painful to get modules approved and deployed
in our machines.

Using N* certainly did the trick. I guess I must read the RFC for OIDs
+ work out what is the range covered using N*. But right now I have some
oids looking like BASE.8129.1.10.1402551989 and
BASE.61003.1.10.2138245292 that seem to be working fine.

Again, huge thanks to you all for your replies!
 


Re: Recession rates

2009-03-11 Thread B Maqueira
Perhaps we should try to advertise the  jobs.perl.org mailing list  
more aggressively to companies that use perl as the best way of  
advertising perl jobs without agencies. I think the list does a great  
job, but there are usually many job ads only available via agencies  
and job-sites (some of them fake I suppose).



On Mar 10, 2009, at 5:12 PM, Dave Cross d...@dave.org.uk wrote:


Paul Makepeace wrote:
Has anyone found the recession/depression affecting contracting  
rates? I was

surprised to have a recruiter recently suggest a bunch of candidates
for £375/day


I saw this today[1], advertising for a pretty impressive list of  
skills for £175/day. I think the company were taking the piss. I've  
seen other things on stupid money over the last few weeks too.


Personally, I haven't seen any drop in the number of phone calls and  
emails that I'm getting. And I've just started another contract at  
10% more than the previous one.


And, bizarrely, I'm getting lots of enquiries about running training  
courses. I guess that companies want to ensure they're getting the  
most out of their employees.


Cheers,

Dave...

[1] http://www.jobsite.co.uk/cgi-bin/vacdetails.pl?selection=931442513