Perl Weekly Challenge 46: Garbled Message and Room Open

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

Spoiler Alert: This weekly challenge deadline is due in a couple of days (February 9, 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.

Garbled Message

The communication system of an office is broken and message received are not completely reliable. To send message Hello, it ended up sending these following:

H x l 4 !
c e - l o
z e 6 l g
H W l v R
q 9 m # o

Similarly, another day we received a message repeatedly like below:

The way that CPAN authors use subroutine signatures in natural

Perl's new feature is for the new Perl, but when it comes to subroutine signatures, CPAN Author also maybe wants to use it.

If CPAN authors can use subroutine signatures, both application code and CPAN module code can be written in one source.

I think new features should work with the new Perl, but I'm happy that only the subroutine signature feature can be backported.

Wouldn't it be nice if you could use subroutine signatures with tens of thousands of CPAN modules?

But is there such a way?

The way that CPAN authors use subroutine signatures in natural

Paws XXXVII (So close but yest so far)

Well I was just about ready to check everything in on S3 Paws and move onto the next part of Paws that need some love and kindness when I did one last review of all the test cases I have created over the past little while when I discovered I had left one out.

I forgot to add in a request test case for the 'DeleteBucketMetricsConfiguration' action. It took the opportunity to use my new test generator a spin as well so I fired up my real world call with the new caller and much to my chagrin I got an error;

'The specified configuration does not exist.',

Which could be the case as the Bucket I was playing with may not have a 'Metrics Configuration' on it. So I dusted off another test that does both 'PUT and 'GET' and then I slapped my 'DELETE' on the end and this was the result;

Some blogs.perl.org 10 Year Stats.

blogs.perl.org recently turned 10 years old. I was curious about the level of traffic so grabbed all of the post URLs and meta information to create the lists below. These are accurate up until the posting of this post (excluding this post):

  • Total Posts: 8,091
  • Total Posts (2016 Onwards): 2,595
  • Total Unique Authors: 676
  • Authors With Only 1 Post: 246

Most Active Authors (All Time):

  • byterock - 604
  • jt_smith - 442
  • ovid - 382
  • sawyer_x - 304
  • brian_d_foy - 227
  • steven_haryanto - 160
  • yuki_kimoto - 153
  • ron_savage - 148
  • joel_berger - 132

Most Active Authors (2016 onwards):

  • byterock - 417
  • sawyer_x - 138
  • yuki_kimoto - 93
  • dean - 72
  • mohammad_s_anwar - 69
  • melezhik - 66
  • zoffix_znet - 65
  • ovid - 59
  • neilb - 55

Most Active Months:

  • 2012-07: 163
  • 2010-08: 134
  • 2012-04: 128
  • 2011-10: 121
  • 2014-03: 121
  • 2013-02: 119
  • 2012-05: 118
  • 2012-03: 117
  • 2010-07: 114
  • 2011-11: 111

Total Post Count By Year:

  • 2009 - 116
  • 2010 - 1,023
  • 2011 - 1,094
  • 2012 - 1,274
  • 2013 - 1,006
  • 2014 - 983
  • 2015 - 542
  • 2016 - 535
  • 2017 - 459
  • 2018 - 664
  • 2019 - 395

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 Subroutine Signatures Opinion Blog

I have great respect for Perl developers.

I am always grateful for the work.


On the other hand, I have a very strong concern in the future of Perl.


I created a site for my opinions on subroutine signatures so that themes would not be missed in the discussion.

Perl Subroutine Signatures Opinion Blog


I have no final authority. I pray Perl developers make a good decision.

Apache SpamAssassin 3.4.3 has been released!

Apache SpamAssassin 3.4.3 contains numerous tweaks and bug fixes as we prepare to move to version 4.0.0 with better, native UTF-8 handling. There are a number of functional patches, improvements as well as security reasons to upgrade to 3.4.3. In this release, there is also one new plugin and there are bug fixes for two CVEs:
  • CVE-2019-12420 for Multipart Denial of Service Vulnerability
  • CVE-2018-11805 for nefarious CF files can be configured to run system commands without any output or errors.
*** On March 1, 2020, we will stop publishing rulesets with SHA-1 signatures. If you do not update to 3.4.2 or later, you will be stuck at the last ruleset with SHA-1 signatures. ***

Download: https://spamassassin.apache.org/downloads.cgi?update=201912112330

See also https://spamassassin.apache.org/news.html

Paws XXXV (Well not a wrap but close)

Well it looks like a wrap for Paws S3

I made up my own test creation caller. No rocket science in this one. I just added in a few useful attributes;

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.

Type::Tiny 1.8.0 released

Type::Tiny 1.8.0 (1.008000) was released today.

The new features are pretty minor. Most of the improvements are in documentation and testing.

  • Totally rewritten manual/tutorial.

  • Every issue on RT has been handled.

  • Bigger test suite. The exact number of tests run varies based on the availability of optional dependencies, but I just ran the test suite with EXTENDED_TESTING set to false and most of the optional dependencies installed, and it was nearly 7500 tests, compared to just over 2700 for Type::Tiny 1.6.0. With EXTENDED_TESTING true, there are nearly 13900 tests.

    This includes a set of tests for each built-in type which are intended to function both as test cases and advanced documentation.

Why is the specification of subroutine signatures so complicated?

As a general Perl user who uses Perl for text processing on Linux, I have a simple question.

Why is the specification of subroutine signatures so complicated?

Jumbo Signatures extensions discussion

The most common criticism of Perl is that it cannot read Perl grammar.

If Perl grammar evolves in an easy-to-understand direction, you are welcome.

If you are going to increase the complexity blame for Perl, think a little more.

Is this feature really useful for users who want to do text processing on Linux/Unix?

A single language cannot satisfy every need.

I have not yet seen what purpose Perl is aiming for.

CPAN Testers at meta::hack v4

For this year's MetaCPAN Hackathon, I decided I wanted to start turning the CPAN Testers mockup I made 3 years ago into a real, working site. Along the way, I built a much better development environment for CPAN Testers, making it even easier for someone to start working on the project. I also released Mojolicious::Plugin::Moai, a UI widget kit for Mojolicious.

Thanks to cPanel and Booking.com for their continued sponsorship of this event!

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.

Rewriting Perl Code for Raku IV: A New Hope

Part IV starts to get into the heart of OLE::Storage_Lite by covering the pack/unpack builtins.

Perl Weekly Challenge 037: Weekdays and Daylight Gain/Loss

Weekdays

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

I used the core module Time::Piece and its companion from the same distribution, Time::Seconds. Let’s start on the first day of the month, and keep adding one day while we stay in the same month. Along the way, count the days that aren’t Saturdays and Sundays.

Paws XXXIV (Yet more code)

Well after spending a little while trying to create an auto test generator I found the test generator script that came with PAWS.

So I decided to try it out. With only a little fudging of the code internals, no real code changes just changes to libs, I got it to work;

perl script/paws_make_testcase  S3 --region us-east-1 GetBucketLocation Bucket: "dev.cargotel.test"

the test file it generated /0001.response.test.yml;


--
tests:
  - expected: eu-west-2
    op: eq
    path: LocationConstraint

So that is ok.

However when I opened the caller file '0001.response' it contained only JSON;

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.

Working with CSV files using PDL

Ahh, the venerable comma separated variable format, beloved of data scientists.

I grabbed a couple of csv files from Matt Pettis’ csvkit talk to prepare for the datafile that I should be getting my mitts on and tripped and bumped my way through the documentation for PDL::IO::CSV and metaphorically skinned my knees, as you do when you don’t read too carefully.

Constant Platypus

A common challenge in calling C functions from any language other than C or C++ is dealing with constants. In C these are usually implemented using #define pre-processor directives which are lost by the time the code is linked into a dynamic library. (In fact it is lost before the source is even compiled, since it is a pre-processor directive). For example, the libarchive library provides these constants in its header file for dealing with errors:

/*
 * Error codes: Use archive_errno() and archive_error_string()
 * to retrieve details.  Unless specified otherwise, all functions
 * that return 'int' use these codes.
 */
#define ARCHIVE_EOF       1     /* Found end of archive. */
#define ARCHIVE_OK        0     /* Operation was successful. */
#define ARCHIVE_RETRY   (-10)   /* Retry might succeed. */
#define ARCHIVE_WARN    (-20)   /* Partial success. */
/* For example, if write_header "fails", then you can't push data. */
#define ARCHIVE_FAILED  (-25)   /* Current operation cannot complete. */
/* But if write_header is "fatal," then this archive is dead and useless. */
#define ARCHIVE_FATAL   (-30)   /* No more operations are possible. */

Paws XXXIII (A little advice please)

Well some-days it would be nice to get a little advice, without asking for it, before one heads down a very long and in the end futile path.

Today that happened to me when I was starting down a path that I dreaded. Namely creating the 'response' test suite for all those S3 requests I have fixed up over the past few weeks. This type of programming ranges from so mind numbingly dull as to cause your ears to bleed to so incredibility repetitive that you consider that career change to line supervisor at the box factory.

Looking at the prospect of coveting some 70+ working S3 units tests by hand was obviously getting me down a little. It took me a good three or four days of rather mindless hacking and re-running just to to the 'request' tests.

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.