Increasing Perl's Visibility

Perl has some really great community websites. But a drawback to this is that the Perl community is centred around a few domain names, which means that it isn't as visible as some other languages. Most projects use github for development and CPAN for distribution, and outside those sites, they don't have much online presence.

One thing I think might help spread Perl around the web would be if different Perl projects had their own websites.

Perl Weekly Challenge 45: Square Secret Code and Source Dumper

These are some answers to the Week 45 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Task # 1: Square Secret Code

The square secret code mechanism first removes any space from the original message. Then it lays down the message in a row of 8 columns. The coded message is then obtained by reading down the columns going left to right.

For example, the message is “The quick brown fox jumps over the lazy dog”.

Then the message would be laid out as below:

thequick
brownfox
jumpsove
rthelazy
dog

The code message would be as below:

tbjrd hruto eomhg qwpe unsl ifoa covz kxey

Perl Weekly Challenge 044: One Hundred, Two Hundred

Only 100, please

You are given a string “123456789”. Write a script that would insert ”+” or ”-” in between digits so that when you evaluate, the result should be 100.

We can populate each place “between digits” with one of three possible values: a plus sign, minus sign, or nothing. To check all the possible permutations, we’ll use an indicator function similarly to The Knapsack Problem. In this case, though, there are three possible values, so we need to loop over numbers in the ternary numeral system.

The only operation we’ll need will be the increment, so we don’t need the full support for arithmetic in base 3. We can implement the increment ourselves: we start from the right of the number, change any 2 into 0 and move left. Once we find 0 or 1, we increment it and we’re done.

To create the expression, we just need to intersperse the digits with the operators. See the apply subroutine below.

Paws L (A little party planned)

Well it looks like a wrap for PAWS XML as the last thing I am working on is getting the test suite to pass

Looking at S3 I have only 1 error with the 09_requestst.t test suite;
ok 829 - Call S3->SelectObjectContent from t/09_requests/s3-select-object-content.request
not ok 830 - Got content eq from request
#   Failed test 'Got content eq from request'
#   at t/09_requests.t line 123.
#          got: '<SelectObjectContentRequest xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><InputSerialization><CompressionType>NONE</CompressionType></InputSerialization><OutputSerialization><CSV><FieldDelimiter>\,</FieldDelimiter><QuoteCharacter>\'</QuoteCharacter><QuoteEscapeCharacter>\"</QuoteEscapeCharacter><QuoteFields>ASNEEDED</QuoteFields><RecordDelimiter>\\n</RecordDelimiter></CSV></OutputSerialization><Expression>MyExpression</Expression><ExpressionType>SQL</ExpressionType></SelectObjectContentRequest>'
#     expected: '<InputSerialization><CompressionType>NONE</CompressionType></InputSerialization><OutputSerialization><CSV><FieldDelimiter>\,</FieldDelimiter><QuoteCharacter>\'</QuoteCharacter><QuoteEscapeCharacter>\"</QuoteEscapeCharacter><QuoteFields>ASNEEDED</QuoteFields><RecordDelimiter>\\n</RecordDelimiter></CSV></OutputSerialization>' 

I rechecked the API and my real world test and found the action 'SelectObjectContent
' it is a one off case in S3 that requires the root tag and the 'xmlns' to be present;

So a simple fix to the test got that.

k-means: a brief interlude into Data Wrangling

When last we saw our heroes, what they thought was the brink of success turned out to be the precipice of hasty interpretation and now they are dangling for dear life on the branch of normalization! how's that for tortured metaphor!

If you use raw values for your k-means clustering, dimensions with large values or large ranges can swamp smaller dimensions and skew your clusters. The process of normalization tries to bring everything into the same range, usually [0,1], although your choices on how to transform the ranges are also significant. There is not always one best way to do it and, as usual, get familiar with your dataset and use your judgement.

Perl Weekly Challenge 44: Only 100, Please, and Make it $200

These are some answers to the Week 44 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Challenge # 1: Only 100, Please

You are given a string “123456789”. Write a script that would insert ”+” or ”-” in between digits so that when you evaluate, the result should be 100.

Only 100, Please, in Perl

For solving this task, we first use a recursive combine subroutine that generates all possible strings by inserting between the digits of the “123456789” string the + plus addition, the - subtraction operator, or the '' empty string (i.e. no operator). We then use the evaluate subroutine with each string to perform the various arithmetic operations and compute whether the total is 100.

Announcing MooX::Pression

Kind of like Moops but with less hacky parsing.

Paws XXXXIX (Very Close)

Finally things were looking my way. I plowed thought the remaining CloudFront actions and got them all to work without any more changes to Paws.

In the end I checked in 30+ new tests cases and over 2k of tests the other day. So I can safely say that 'CloudFront' is fully operational.

That leaves only 'Route53' to look and for me this is somewhat problematic. The Route53 api deals with 'Domains', 'Checks', 'Hosts', 'Traffic' and such. To test 90% of the actions in this API you will need

  1. Have at least one registered DNS domains to start
  2. Know how to create a Hosts for a Domain
  3. Know how to config a Host for a Domain and most importantly
  4. Have some spare cash to pay for all the actions you are mucking with

As I fail on all 4 of the above I am not comfortable with creating working scrips for this API.

Springtime in Switzerland

For over a decade now, I've been running public training classes in both presentation skills
and software development in conjunction with the Swiss Institute of Bioinformatics,
the University of Lausanne, and the École Polytechnique Fédérale de Lausanne.

This year, in the week of March 9-13, we're offering my full set of Presentation Skills classes as a three-day sequence (though, of course, you can also sign up for just one or two of the classes, if you prefer):

We’re also offering two general software development classes:

These two classes are based on my popular Perl courses on these topics, but I've now
redesigned and adapted them to be entirely language-neutral, so they're equally useful
to developers working in any other mainstream language(s).

Docker, Perl and GitHub

Why using Docker images?

There are many reasons to use Docker Images, from setting up a development environment to pushing your code to production. The primary/first reason which pushes me to start using some Docker Images is "Continuous Integration".

When maintaining a Perl package used by multiple users/companies (or not), you absolutely want to know how your code behaves on different versions of Perl. Even if you could have multiple versions of Perl installed on your development environment, most of the time, the development is only performed using a single version of Perl.

Continuous Integration system like Travis CI or GitHub Workflows allows you to run your test suite on every push, pull request... without the need of testing manually on all Perl Versions.

When testing your code on a container (or Virtual Machine) you do not want to install or compile a fresh version of Perl each time... This is a slow operation, that ideally, should be done once.

Perl Weekly Challenge 43: Olympic Rings and Self-Descripting Numbers

These are some answers to the Week 43 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a couple of days (January 19, 2020). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

Challenge # 1: Olympic Rings

There are 5 rings in the Olympic Logo as shown below. They are color coded as in Blue, Black, Red, Yellow and Green.

olympic_rings-1.jpg

We have allocated some numbers to these rings as below: Blue: 8 Yellow: 7 Green: 5 Red: 9

The Black ring is empty currently. You are given the numbers 1, 2, 3, 4 and 6. Write a script to place these numbers in the rings so that the sum of numbers in each ring is exactly 11.

Shorewall 5.2.3.5 Released!

Shorewall 5.2.3.5 is now available for download. Shorewall is a gateway/firewall configuration tool for GNU/Linux, written in Perl.

Problems Corrected:

1) A typo in the FTP documentation has been corrected.

2) The recommended mss setting when using IPSec with ipcomp
has been corrected.

3) A number of incorrect links in the manpages have been
corrected.

4) The 'bypass' option is now allowed when specifying an
NFQUEUE policy. Previously, specifying that option resulted
in an error.

5) Corrected IPv6 Address Range parsing.

Previously, such ranges were required to be of the form
[-] rather than the more standard form
[]-[]. In the snat file (and in nat actions),
the latter form was actually flagged as an error while in
other contexts, it resulted in a less obvious error being
raised.

6) The manpages have been updated to refer to https://shorewall.org rather than http://www.shorewall.org.

Call for FOSDEM 2020 Booth volunteers

This year we've got one of the high-traffic locations, on the ground floor where Free Software Foundation Europe set up last year, right next to the stairway to *all* the dev rooms. So we're looking for volunteers to come and talk about both Perl and Raku at FOSDEM 2020 in Brussels. If I haven't already talked to you, please email me at drforr [at] pobox (dot) com and give me an idea of your availability and what you'd want to do. We've made arrangements for the usual booth swag, and will have pamphlets to hand out and books to sell on both Raku and Perl.

Again, if you're able to give us a hand or know someone that can, send me email at drforr [at] pobox (dot) com and give me an idea of when you're available and how much you can help out.

Perl Weekly Challenge 043: Olympic Rings and Self-Descriptive Numbers

Olympic Rings

There are 5 rings in the Olympic Logo [as shown below]. They are colour coded as in Blue, Black, Red, Yellow and Green. We have allocated some numbers to these rings as below: Blue: 8, Yellow: 7, Green: 5, Red: 9. The Black ring is empty currently. You are given the numbers 1, 2, 3, 4 and 6. Write a script to place these numbers in the rings so that the sum of numbers in each ring is exactly 11.

My first idea was to go over all the possible permutation of the numbers and report those that satisfy the sum condition. I chose Math::Combinatorics as the module to handle the permutations.

Create PDF using Perl/PDF::API2

I wrote a practical and detailed description of Perl's PDF::API2.

It turns out that PDF::API2 is a library for performing necessary and sufficient PDF operations.

Create PDF using Perl/PDF::API2

Paws XXXXVIII (Way too many 'I' s)

Well I think it is a first here in the Paws patrol. I spent the day plunging away with CloudFront and I have no new Paws issues but I did learn and important practical lesson about using CloudFront.

I got stuck on the 'UpdateCloudFrontOriginAccessIdentity' call.

It seemed simple enough


$s3->UpdateCloudFrontOriginAccessIdentity(
    CloudFrontOriginAccessIdentityConfig => {
        CallerReference => 'Some text here',
        Comment         => 'Mr Pooppy buthole did this',
  },
  Id=> 'E3D5Y5RWA05QO1',
);

but I kept running into this error;

The request failed because it didn't meet the preconditions in one or more request-header fields.

Ok what is that?

A Date with CPAN, Update #3: Golden Jubilee

[This is an addendum post to a series.  You may want to begin at the beginning.  The last update was update #2.

IMPORTANT NOTE! When I provide you links to code on GitHub, I’m giving you links to particular commits.  This allows me to show you the code as it was at the time the blog post was written and insures that the code references will make sense in the context of this post.  Just be aware that the latest version of the code may be very different.]


In case you missed my talk on Date::Easy from a couple years back, I’ll sum it up for you: dates are hard, y’all.

No more rhyming and I k-means it!

"... anybody wanna peanut?" - Fezzik, TPB

When last we saw our heroes, they had just applied PDL::Stats::Kmeans to a CSV file of car data with no thought regarding their own well-being.

In today's episode, we see them slice through data to identify clusters of cars, only to find they know less than they did before!

Read on, true believers!

Perl Weekly Challenge 42: Octal Numbers and Balanced Parentheses

These are some answers to the Week 42 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a couple of days (January 12, 2020). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

Challenge # 1: Octal Number System

Write a script to print decimal number 0 to 50 in Octal Number System.

For example:

Decimal 0 = Octal 0
Decimal 1 = Octal 1
Decimal 2 = Octal 2
[ ... ]

For this task, I’ll start with Raku, because it is so easy in Raku.

Octal Number System in Raku

Raku has a base method to convert a number into a string representation in any base between 2 and 36.

Paws XXXXVII (What about the tests????)

I decided I might as well get busy with CloudFront and at least get most of my real world scripts written.

At the moment I am getting 400 errors such as 'InvalidArgument' or 'InvalidOrigin' on the Delete and Create actions as I do not have the proper config on the AWS end for the Creates and for the Deletes as I do not have anything on my AWS account to delete.

Reading though the API documentation is seems there is quite the procedure to actually do some of the actions, for example to invoke the DeleteStreamingDistribution action you have to follow a six pre-steps all of which must pass. So I guess I can forget a quick run on this API

So the plan is to get all the real world scripts written up and then go though the full CRUD actions for each and get them working with a good generated test case for each.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.