Perl Weekly Challenge 32: Word Histogram and ASCII Bar Chart

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

Spoiler Alert: This weekly challenge deadline is due in a few days (November 3, 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.

This week, both tasks were contributed by Neil Bowers.

Task # 1: Word Histogram

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.

So with the following input in file example.txt:

Paws XVII (The last of the direct line for the Bourbons at least)

I finally (well a few days ago) had a response to another of my questions up on gitihub;

-->me I added in th status as you suggests. I found it under botocore as "location":"statusCode", It is used in a number of other classes


-->they

This means that we can make the builders put the trait on the appropiate attributes, which I see you already found ?

-->me

I added it in as a new trait as you suggested, not 100% sure on the name though

-->they

I think the name would better be ParamInStatus (just as a reflex of the other traits).

-->me

please have a look and see if I am on the right track.

-->they

I think you're on the right track ?

So I have switched over to my 's3ObjectTagging' branch and I think I all have to do is change the name of my trait from 'ParamInResponse' to 'ParamInStatus' which I found in three files and did a simple change and then reran the test and got;

Cor - Background core Perl OO

So far, the work on Cor is going well. Here's the timeline.

The London Perl Workshop 2019

I went to the London Perl Workshop 2019 this weekend. I've been attending the London Perl Workshop several times in the past, and it has always been a great workshop. This year the workshop had a brand new team of organisers, and they did a great job of following up on the legacy that is the London Perl Workshop (LPW).

Going to London

My LPW weekend, didn't start that great. I had a flight from Copenhagen to Gatwick at nine in the evening, but the flight was delayed by almost an hour. This could mean missing the last Gatwick Express train, which would mean I would arrive at the hotel past midnight. Not the best start of a short weekend trip to London.

Finally the pilot was allowed to take off, and he managed to catch up somewhat for the lost time. I had a seat on the second row, I had booked that to be able to get quickly off the plane and get to my train.

London Perl Workshop: Platinum Sponsor Booking.com

The London Perl Workshop was on Saturday, and it was awesome! If you missed it, or you'd like to reminisce, our Twitter feed has pictures through out the day. Hopefully there will be some write ups posted soon.

As well as getting the talk videos live and actioning your feedback (please fill in your survey, it really helps!) we want to say a massive thank you to everyone who made the day such a success. The attendees, the speakers, the venue and our sponsors - without any one of you it wouldn't have been the same, and in particular we'd like to thank our Platinum Sponsor Booking.com for their support.

Booking.com is a large Perl shop with some of the greatest developers and as a company they sponsor almost all Perl events around the globe to support the Perl community.

Paw XVI

Well I though I hit the correct fix when Paws does its XML parsing and drops the 'Root' node but I found I have to apply some sort 'trait' to my class rather than an attribute so I am going to start this time with my code for 'RestXMLResponse.pm' first and then work that fix back into boto and the templates.

What I want to do is this

Perl Weekly Challenge 030: Sunday Christmas and Series with sum 12

Sunday Christmas

Write a script to list dates for Sunday Christmas between 2019 and 2100. For example, 25 Dec 2022 is Sunday.

I used the core module Time::Piece to check the dates.

It’s easy to create a string representing Christmas: just concatenate the year with '-12-25'. The module’s strptime method can be used to create an object if we provide a format of the input string, in this case it’s '%Y-%m-%d'. The object’s method day_of_week now tells us what day the object represents, 0 corresponds to Sunday, which is the day we’re interested in.

Get your 36c3 ticket NOW!

Unten in Deutsch. (German version below.)

It’s that time of the year again! The 36th Chaos Communication Congress (36c3) is coming to Leipzig in Germany. From December 27 to December 30 my hometown will hold the yearly convention of the Chaos Communication Club. It’s the largest hacker conference in Europe and also covers topics like politics, science, making and art.

Vouchers for receiving a ticket through any CCC-related community are being distributed right now. Reach out immediately to your nearest CCC Erfa, hackerspace or similar community to get a ticket smoothly! For the more adventurous there will be public presales on November 8, November 10, November 21. Although the queuing system is sophisticated these are usually sold out in seconds.

London Perl Workshop: Gold Sponsor Eligo

The London Perl Workshop is today! If you can make it, hopefully you have already planned your journey there - please remember we're at a new venue this year. If you're thinking about your journey home, after the event we are going for after drinks, with food provided by our sponsors at the Running Horse in Aldgate. We'd like to thank our last gold sponsor Eligo for their continued support of London Perl events.

Eligo are a niche boutique recruitment consultancy with a team of dedicated Perl Consultants. We live and breathe our markets. In fact we like to think we are as passionate about the sector as those who work within it. If you want proof of it stop by and meet Rick Deller one of our Senior Perl Consultants at LPW today.

Paws the XV (Still Some Way to Go)

In my last post I got nicely snookered by the S3 call 'GetBucketLocation' which was one of the call that had a 'todo' test.

The XML coming back from ASW is correct

<?xml version="1.0" encoding="UTF-8"?> <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-0301/"> EU </LocationConstraint> but no matter what I tried on 'XML::Simple' I could not get it to parse just the way I want though I did get very close with this

 my $xml = XML::Simple->new(
      ForceArray    => qr/^(?:item|Errors)/i,
      KeyAttr       => '',
      SuppressEmpty => undef,
++    KeepRoot => 1
    );
    return $xml->parse_string($data);

Why forward compatibility is important when trying to add a new grammar to Perl

There is a lot of discussion about adding a new grammar to Perl.

Most of the time, because the issues are not shared, my opinion is a minority in that place.

When you try to add a new grammar to Perl, it is goot to think why forward compatibility is important.

What is forward compatibility?

you've heard of the term backward compatibility, but many people don't yet hear the term forward compatibility.

Forward compatibility means that new features in Perl are compatible with older versions of Perl.

This means that forward-compatible features can work with the latest grammar with the help of modules, even if the Perl is the old Perl 5.8.7.

If the new grammar has forward compatibility, you can use the grammar in the most CPAN module

I have subroutine signature 2019 In the article, I wrote about forward compatibility.

Change offers amazing opportunites

The Camelia mascot of the language now known as Raku is a brightly coloured metaphor for the transition from Perl 6 to it's new identity. My hope is that having emerged from it's cocoon, Raku will flap it's wings and fly skyward, boldy seeking new adventures.

I congratulate the team for making this decision, specifically Elizabeth Mattijsen for being so bold as to propose the change request that triggered the end game. No doubt other people where involved that I am not familiar with, they deserve generous praise and recognition too.

My personal involvement in Raku/Perl6 is literally zero. So I make this post as a person for whom Perl 5 continues to be a delight for personal projects, and sadly declining professionally.

Reading through the public comments there are a lot of strong feelings - some of them hurt feelings. Humans are fundamentally emotional creatures, and the grief associated with strong disappointment follows the same path to acceptance no matter how rational a person fancies themselves.

Perlyglot

Our small team really enjoys organizing the mostly-annual DC-Baltimore Perl Workshop, and we're working on it again for 2020 (NOTE: CFP IS OPEN!!! http://bit.ly/dcbpw2020-cfp). We get a lot out of it, both technically and socially.

One aspect of the joy comes embracing ALL sorts of technology, from Arduinos to rockets, from compilers to web apps. So with the recent update in the Perl-Family languages of Perl 6 → Raku ... we took this as a fun time to update our own name!

We shall be henceforth known as the DC-Baltimore Perlyglot Workshop! Coming to you live on April 18-19 at Johns Hopkins University, just north of Baltimore, MD. I sure hope you'll join us :)

Be there or be :onion:!

Paws XIV (The Sun King)

Well carrying on with my quest to clean up the Paws S3 code I decided while I am waiting for my last batch of changes to be reviewed I decided to review some of the 'TODO' tests.

TODO passed: 6364, 6370, 7896, 10045, 10052, 10137

First a 'TODO' test is a stubbed in test that will most likely fail and if it does it will not effect the final Pass/Fail of test case. It is basically one of these

The first one I am going to play with is 's3-get-bucket-location.response.test.yml which looks like this

--- todo: 'S3 is not stable' call: GetBucketLocation service: S3 tests: - expected: EU op: eq path: LocationConstraint

So the first thing I did was chop off that 'todo' line;

--- --todo: 'S3 is not stable' call: GetBucketLocation service: S3 …

and then check the content in the '3-get-bucket-location.response';

--- content: | <?xml version="1.0" encoding="UTF-8"?> <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">EU</LocationConstraint> headers: [] status: 200

London Perl Workshop: Gold Sponsor cPanel

It's Wednesday today, which must mean it is time to think about the weekend :-) If you are planning to come to the London Perl Workshop on Saturday, you might like to know that we'll be serving tea and coffee at registration from 9:15, with the first talk starting at 9:50. There will also be a mid-morning and mid-afternoon break with tea, coffee and some delicious snacks and all of this is only possible due to the support of our sponsors. Today we're saying thank you to cPanel - we are grateful to have them as a gold sponsor of LPW2019.

First released in 1997, cPanel & WHM is the leading web hosting control panel globally, and is preferred by most hosting service providers. Its users in an ever-growing user base prefer its familiar, feature-full, and simple interface. This interface can be used to build, manage and update a company's their entire online presence, from websites to email addresses.

Cor - A proposal for core Perl OO

I've been working with Sawyer X and Stevan Little to try to bring OO into the Perl core. Most of this work is based on Stevan's work, with me trying to add a final "polish" layer to make it clean and still feel like Perl.

It's being called "Cor" to distinguish it from current OO systems.

This is an example:

You can read the full description of Cor here.

Feel free to comment on the proposal here or on the gist.

Perl Weekly Challenge 30: Sunday Christmas and Triplets

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

Spoiler Alert: This weekly challenge deadline is due in a few days from now (October 20, 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: Sunday Christmas

Write a script to list dates for Sunday Christmas between 2019 and 2100. For example, 25 Dec 2022 is Sunday.

Christmas on Sunday in Perl 5

I'll be using the Time::Local core module which provides reciprocal functions of the gmtime and localtime built-in functions.

Paws XIII (The Unlucky one)

I left off in my last post with all my bits and bods to get the proper structure in my generated perl class from the Json data. Now I have to get the 'status' out of the response and then into my class.

By now I know where to start to look to in the code to apply my changes. I started in Paws::Net::RestXMLResponse' class at its 'process' sub which looks at the response 'status' and takes either the error path (>=300) or the happy path (<300). We are interested in the happy path and that takes us to the 'response_to_object' sub.

First I can see that I have the 'status' very soon in the sub;

London Perl Workshop: Gold Sponsor Pirum

Happy Friday! If you are coming to the London Perl Workshop tomorrow, or even if you can't make it tomorrow but are in London today, you are welcome to join the pre workshop social this evening from 18:30 at The Draft House, Seething Lane.

The first few rounds will be courtesy of our fantastic sponsors, so today we'd like to thank Pirum for coming on board this year as a gold sponsor!

Pirum is a small dynamic FinTech company established in 2000, which provides Software-as-a-service the top-tier financial institutions in Securities Lending throughout the world.

Data Science and Perl

Our company goes into many other companies and helps them build new Perl systems or fix old ones. Needless to say, we see how many companies work and a typical example is one of our clients I'll call "AlphaCorp." They use lots and lots of Perl. Their primary web site is almost entirely Perl. So when I went in to help them with their A/B testing (amongst other things), I was surprised that they also used a lot of Python. It turns out they had a specific need that Python fills and Perl does not: data science.

Because they hired so many Python developers to work in their data science area, they had more and more Python creeping into non-data science areas. Their Python devs didn't do much Perl and vice versa. Thus, while AlphaCorp said they'd rather not split themselves over multiple programming languages, they really had no choice. And that's a problem for Perl's future.

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.