Paws XXVIII (Just one More )

Seems I lied in my last post when I said there where no longer any boto changes for my S3 fixes. There is still one call 'GetBucketLocation' that is using a new bit I added to boto

"keep_root":true 

I stumbled upon this when I added in a few fixed cases from another branch and when I ran the suite I
got;

ok 10052 - Call S3->GetBucketLocation from t/10_responses/s3-get-bucket-location.response not ok 10053 - Can't test method access because something went horribly wrong in the call to GetBucketLocation # TODO t/10_responses/s3-get-bucket-location.response.test.yml

My present output of the call is

Perl Weekly Challenge 41: Attractive Numbers and Leonardo Numbers

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

Spoiler Alert: This weekly challenge deadline is due in a couple of days (January 5, 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: Attractive Numbers

Write a script to display attractive number between 1 and 50.

A number is an attractive number if the number of its prime factors is also prime number.

The number 20 is an attractive number, whose prime factors are 2, 2 and 5. The total prime factors is 3 which is also a prime number.

First comment: we’re obviously interested only with proper prime factors, i.e. prime factors of a number other than 1 and the number itself.

Convos - A multiuser chat application.

From the blurb:

Convos is the simplest way to use IRC. It is always online, and accessible to your web browser, both on desktop and mobile. Run it on your home server, or cloud service easily. It can be deployed to Docker-based cloud services, or you can just run it as a normal Mojolicious application.

Check it out at: https://convos.by/ or on Github.

The UI style is familiar to users of popular "Team Communication" platforms.


2019-10-26-conversation.jpg

There is an online demo running at demo.convos.by. Register with your email address and try it out. There should be someone lurking in the #test channel.

Would you like to get one user instead of the top of TIBOE?

Would you like to get one user instead of the top of TIBOE?

TIBOE provides rankings with a biased perspective.

A few leading engineers understand that TIBOE has no value

Many dishonest media continue to introduce TIBOE ranking.

Rather than getting the top of the biased ranking,

Wouldn't it be better to get one excellent and sincere engineer?

Marketing is not to mislead people.

Low quality marketing is done around the world, but there is no reason for Perl users to join it.

High quality marketing looks at the mind of a one user.

Paws XXVI (The Big Clean)

So time to hold on a bit and go back and and see if my latest changes have broken anything or for that matter fixed something that was already broken?

So back to my tests script and and I got my first fail on

'PutBucketCors'

and surprise it was a bit of Mooso poop.


You must pass a package name and it cannot be blessed at /wwwveh/lib/x86_64-linux-thread-multi/Moose/Meta/Attribute.pm line 867
        Moose::Meta::Attribute::get_value('Moose::Meta::Class::__ANON__::SERIAL::12=HASH(0x4ad5358)', 'http://www.example.com') called at /home/scolesj/aws-sdk-perl/

So I checked the generated 'PutBucketCors,pm' file with one from a clean .41 build and there was no changes there so it must be someplace else?

Well lots of debugging later I found it here

Perl Weekly Challenge 40: Multiple Arrays Content and Sublist Sorting

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

Spoiler Alert: This weekly challenge deadline is due in a couple of days (December 29, 2019). 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: Multiple Arrays Content

You are given two or more arrays. Write a script to display values of each list at a given index.

For example:

Array 1: [ I L O V E Y O U ]
Array 2: [ 2 4 0 3 2 0 1 9 ]
Array 3: [ ! ? £ $ % ^ & * ]

We expect the following output:

Sympa 6.2.48 released

I missed this release but it's only a little over a month old, so its still news.

Sympa 6.2.48 is the newest stable version of Sympa 6.2.

Sympa is an electronic mailing list manager. It is used to automate list management functions such as subscription, moderation and management of archives. Sympa also manages sending of messages to the lists, and makes it possible to reduce the load on the system. Provided that you have enough memory on your system, Sympa is especially well adapted for big lists. For a list with 20 000 subscribers, it takes 5 minutes to send a message to 90% of subscribers, of course considering that the network is available. Check out the full list of features.

From the release notices

Significant changes
  • Data sources: Codebase has entirely been rewritten. It will work a bit faster with less memory usage in exchange for some changes on behaviors.
  • Perl: From now on, Perl earlier than 5.10.1 will never be supported.

The full Change Log is here.

RPM Packages are in Fedora and EPEL, and Sympa is in the FreeBSD ports tree. Otherwise you can just install from source tar ball.

Also, a new Logo for the project has been proposed. Check it out too.

Developer on Fire Interview

On October 22nd I was interviewed by Dave Rael for Developer On Fire podcast.

It has been an interesting experience, and Dave has been a great host making me feel very comfortable during the whole process.

I talked about Open Source, archery, cats and PostgreSQL.
Here there is something more to read about, and for listening the interview just click on the image.


developersonfire.png

Devel::PPPort has been updated

Devel::PPPort 3.55 has more than two hundred commits since the last major releases. The documentation has been extensively revised to make it clearer how to use, and to contribute. And it has been updated to know about the latest blead; the first such update in 5 or more years.

Dozens of functions and macros are newly implemented. The suite of SV handling functions is more complete, with more flags handled. Also the character classification macros (alpha, punct, etc) and case changing functions are greatly expanded. There is more Unicode support, including modern security standards.

ppport.h --api-info foo

is much more complete than before. If you make 'foo' to instead be '/./' you'll get information about every known API element.

And it still supports 5.003, with a surprising number of elements functioning that far back.

The full documentation is available at .

The version backporting is valid for is unknown for quite a few API elements. That is because documentation is lacking on the parameters these take, and so the automatic tests for these elements can't be generated. If you know what some of the missing things do, we would greatly appreciate your contributing documentation for them. in the form of a github pull request.

Perl Weekly Challenge # 39: Guest House and Reverse Polish Notation

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

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

Task # 1: Guest House

A guest house had a policy that the light remain ON as long as the at least one guest is in the house. There is guest book which tracks all guest in/out time. Write a script to find out how long in minutes the light were ON.

The guest book looks as follows:

Paws XXIII (Bad Paws!! Bad Paws!!)

So I have been happily plugging away at the Paws 'S3' actions and my little Boto fix of


/{Bucket}?action
/{Bucket}?action&id={Id}

I was able to get all of these 'Actions' to work;

  • DeleteBucketAnalyticsConfiguration
  • DeleteBucketInventoryConfiguration
  • DeleteBucketMetricsConfiguration
  • GetBucketAnalyticsConfiguration
  • GetBucketInventoryConfiguration
  • GetBucketMetricsConfiguration
  • ListBucketInventoryConfiguration
  • ListBucketMetricsConfiguration
  • PutBucketInventoryConfiguration
  • PutBucketMetricsConfiguration

Also my 'Flatten' fix seem to clean up at least five or six others so a good day. Then I ran into this one; 'GetBucketPolicy' and on reading the ASW API doc I saw;

Perl Weekly Challenge 033: Count Letters & Formatted Multiplication Table

Count Letters

Create a script that accepts one or more files specified on the command-line and count the number of times letters appeared in the files.

From the example we can see that we should count the letters in a case insensitive way (see the lc in the example below). Similarly to Challenge 032, we can use a hash to keep the counts.

#!/usr/bin/perl
use warnings;
use strict;
use feature qw{ say };

my %count;
while (<>) {
    ++$count{ lc $1 } while /([a-zA-Z])/g;
}
for my $char (sort keys %count) {
    say "$char: $count{$char}";
}

Tabs or spaces for indentation? Statistics on 3.8 million Perl files created in 24 years

I spotted this on The Twitter, someone processed lots of code to find the truth on this topic of disagreement.

"After I have processed data in the database, I decided to watch from each author he uses for padding. I expect that the most popular will be the use of only spaces, the second place by popularity will be using only tabs, and the third place in popularity is the simultaneous use of tabs and spaces. But it turned out that I was completely wrong. "

Read on: https://squareperl.com/en/tabs-vs-spaces-in-millions-of-perl-files

Perl Weekly Challenge 38: Date Finder and Word Game

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

Challenge # 1: Date Finder

Create a script to accept a 7 digits number, where the first number can only be 1 or 2. The second and third digits can be anything 0-9. The fourth and fifth digits corresponds to the month i.e. 01,02,03…,11,12. And the last 2 digits represents the days in the month i.e. 01,02,03….29,30,31. Your script should validate if the given number is valid as per the rule and then convert into human readable format date.

Rules:

1) If 1st digit is 1, then prepend 20 otherwise 19 to the 2nd and 3rd digits to make it 4-digits year.

2) The 4th and 5th digits together should be a valid month.

3) The 6th and 7th digits together should be a valid day for the above month.

For example, the given number is 2230120, it should print 1923-01-20.

Paws XX (Dos Equis)

Well the saw-buck edition of Paws proved to be a real tough one a least for me. I my last post I was just thinking of fixing all the S3 calls that do not have a test I was just going to start with all the delete calls but I decided to rater take a functional approach and tackle the calls in that order so I started out with the 'Analytics' calls

  • DeleteBucketAnalyticsConfiguration
  • GetBucketAnalyticsConfiguration
  • ListBucketAnalyticsConfigurations
  • PutBucketAnalyticsConfiguration

The first one I was going to play with was the 'PutBucketAnalyticsConfiguration'. This is where I ran into a little bit of a sticky wicket.

I noticed that I could easily write up a 10_resposne test but no where did I see in the test case that would test how the data is being called?? There are a few S3 call tests in 05_service_calls.t which look like this

Tabs vs Spaces. Article about symbols that are used for indentation in 3.8 million Perl files on CPAN

There are 135 thousand releases on CPAN now. In those releases there are about 3.8 million files with extensions .pm, .pl, .t or .pod.

Here is a link with a small research what symbols are used for indentation in all that files.

There is obvious trend, but unfortunately in this article there is no exact answer why it happen.

https://squareperl.com/en/tabs-vs-spaces-in-millions-of-perl-files

I start to write SPVM Language Specification in English.

I start to write SPVM Language Specification in English.

SPVM 1.0 Language Specification

I write SPVM language for 3 years. Language Specification is completed by 95%.

It is time to write SPVM Language Specification in English.

Let's try to

cpanm SPVM

Perl Weekly Challenge 37: Week Days in Each Month and Daylight Gain/loss

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

Spoiler Alert: This weekly challenge deadline is due in a couple of days (December 8, 2019). 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: Week Days in Each Month

Write a script to calculate the total number of weekdays (Mon-Fri) in each month of the year 2019.

Paws XXV (A break though)

Well today’s post marks a tuning point in Paws me thinks, at least in the S3 name-space. I have been spending quite allot of time trying to get this action to work;

PutBucketAcl

It is the most nasty bit of AWS code I have come across so far. First one needs to send this XML up to AWS;

<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Owner>
    <ID>852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID</ID>
    <DisplayName>OwnerDisplayName</DisplayName>
  </Owner>
  <AccessControlList>
    <Grant>
      <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
        <ID>852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID</ID>
        <DisplayName>OwnerDisplayName</DisplayName>
      </Grantee>
      <Permission>FULL_CONTROL</Permission>
    </Grant>

You will notice that in the 'Grantee' tag there are some XML attributes!!. Sure enough it is in boto JSON

Perl Weekly Challenge 032: Frequency Table & ASCII Bar Chart

Frequency Table

Create a script that either reads standard input or one or more files specified on the command-line. Count the number of times and then print a summary, sorted by the count of each entry.

The original title of the task was “Count instances”, but I’ve always known the output as the “frequency table”. For years, I’ve used the following bash script to produce it:

#! /bin/bash
cat "$@" | sort | uniq -c | sort -n

The first element in the pipeline is cat. It outputs all the files given to it as arguments, or the standard input if there are no arguments. sort sorts the output so duplicate lines are adjacent, which is needed for uniq. Its -c argument means “count”: it prepends the number of occurrences to each line. The final sort is invoked with -n for “numerical”, i.e. it sorts the output by the number of occurrences.

Creating a similar table in Perl is a FAQ. We store each line in a hash, incrementing the corresponding value while reading the input line by line.

If we look carefully at the assignment of the task, though, we can notice that the output should be formatted differently: the numbers should go last and the columns should be aligned. Also, there’s the extra credit which we definitely want.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.