Perl Weekly Challenge 140: Multiplication Tables

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

Task 1: Add Binary

This task was covered in the following blog post: http://blogs.perl.org/users/laurent_r/2021/11/perl-weekly-challenge-140-add-binary.html.

Task 2: Multiplication Table

You are given 3 positive integers, $i, $j and $k.

Write a script to print the $kth element in the sorted multiplication table of $i and $j.

Example 1:

My Favorite Warnings: experimental

Perl has had experimental features ever since I started using it at about version 5.6. These were things that were considered useful, but about which there was doubt -- about their final form, whether a satisfactory implementation existed, or whatever.

Until Perl 5.18, experimental features were simply documented as experimental. At that point, an experimental warning category was added, with sub-categories experimental::lexical_subs, experimental::lexical_topic, experimental::regex_sets, and experimental::smartmatch.

Most of the features covered by the original Perl 5.18 warning categories were actually introduced in Perl 5.10 as back-ports from Raku (or Perl 6, as it was then called), and not documented as experimental. My impression was that the relevant experimental:: warnings were introduced becaue the corresponding features were recognized as being more experimental than originally believed. Programmers already familiar with a feature might not notice an extra sentence in the documentation, but they will surely notice if their code starts spitting out experimental warnings.

Addressing CPAN vulnerabilities related to checksums

This blog post addresses checksum and signature verification vulnerabilities affecting CPAN, the cpan client, and the cpanm client, which were published in a security advisory on 23rd November 2021. If you're not aware of this topic, you might like to start by reading the advisory. This post gives a high-level description of the issues, what has been done to address them, what is still left to do, and what you should do. If you have any questions on this, you can add comments here, or email the PAUSE admins (modules at perl dot org).

Before we dig into the details, we'll first give an overview of how the relevant parts of the CPAN ecosystem work.

If you're not interested in the details, skip to the section "What do you need to do?"

TL;DR: make sure your CPAN client uses https and a trusted mirror – such as cpan.org

The Weekly Challenge - 1000 days

https://theweeklychallenge.org/blog/1000-days/

Perl Weekly Challenge 140: Add Binary

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

Spoiler Alert: This weekly challenge deadline is due in a few days from now (on November 28, 2021 at 24:00). 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: Add Binary

You are given two decimal-coded binary numbers, $a and $b.

Write a script to simulate the addition of the given binary numbers.

The script should simulate something like $a + $b. (operator overloading)

Example 1:

Input: $a = 11; $b = 1;
Output: 100

Example 2:

Input: $a = 101; $b = 1;
Output: 110

Example 3:

My Favorite Warnings: deprecated

The deprecated warning is a grab-bag. Basically, anything that is deprecated causes this warning to be generated, and the list changes from release to release.

The only reason I can think of ever to turn this off is around a deprecated construction while you are actively working to eliminate it. Silencing it and then forgetting about it will bite you, eventually.

For the curious (and to run my word count, since otherwise this would be a really short blog entry), the current list of deprecations according to the 5.34.0 perldiag is:

Vale, David

David H. Adler passed away yesterday.

David was a gentleman and a scholar: a gentle, warm, erudite, funny, clever, and deeply kind man. And one who has made a vast contribution to our Perl and Raku communities over more than quarter of a century.

My most sincere condolences to David's family...and to the countless other colleagues, acquaintances, and admirers around the world who will be mourning him today.

Like so many others, I was proud to call David my friend.
I will miss him profoundly.

The Quickest Way to Set Up HTTPS

I registered on blogs.perl.org today so that I could comment on posts about object systems. However, the very first thing I encountered was a password page with NO SSL. So, even though I have a ton to say about object systems, my first blog post will instead be about setting up SSL.

(I’m aware that this is a “legacy server problem” but I also recently learned that it doesn’t matter with traefik.)

In this grand year of 2021 you can add SSL to any site, on any architecture, for free, by adding 3 files to your server, making one small config change to Apache, and running a service. We are truly living in the future.

traefik

is the first file. It comes from https://github.com/traefik/traefik/releases, and there is one for any architecture, for instance:

I finally start to translate Japanese Perl Zemi to English.

I finally started to translate Japanese Perl Zemi to English.

Perl Zemi | Perl Zemi|Perl Installation, Perl Tutorial, Many Examples

Perl Zemi is Japanese Perl Tutorial site which is well known and red in Japan. Most of all Japanese Perl users know Perl Zemi and read the document repeatedly.

The volume of content is large and has a reputation for being easy to understand.

This site is originally Japanese. I started to translate this site into English at 2021-11 using an automatically translation tool. I plan that the not very good descriptions and examples by the automatic translation will be gradually fixed until 2023-01.

I'm really going to achieve it.

Let's enjoy Perl with me!

I made a calculator

I created a very basic calculator using wxGlade and the Wx Perl module on CPAN.

wxCalc.png

This is a short one. I've been playing around with wxGlade because it generates Perl code. It is pretty easy to get started on Ubuntu using the base perl.

  • sudo apt-get install wxGlade
  • sudo apt-get install libwx-perl

It took me a while to get the feel of wxGlade, so hang in there. The pay off is when you figure out how to:

  1. build a basic GUI using the builder tools
  2. generate Perl code to just show the GUI (with no actions)
  3. inspect the Perl code
  4. run Perl code
  5. start defining the event handlers

It also takes some time to get an idea about how the Perl code via wxGlade gets injected into the Perl file. I recommend experimenting with the different places in wxGlade you can put in code.

Creating the All Important Flow

A dream resyntaxed

[Author’s note: If you’ve read Curtis Poe’s most recent blog post, what follows is going to seem eerily familiar. This post uses the same concepts, arguments, and code examples as his, and reaches exactly the same conclusions. That’s because both posts originate from a long and wide-ranging email discussion between Curtis and myself, as I’ve been privately consulting with him over the past few months on the design of Corinna.

When I read Curtis’s post I almost decided to bin this one, as he managed to cover everything necessary in his usual succinct, eloquent, and engaging style. But he has encouraged me to post my version of this discussion too, as it provides a little more detail on some of the issues we’re addressing, and on the design rationale for the changes we are jointly proposing.

The Ephemeral Miniconf

The Ephemeral Miniconf is planned on thursday 18th of november 2021!

Have you heard about The Ephemeral Miniconf ?

flyeren2small.png

It's a Perl/Raku free and online miniconf that will take place on Zoom!
Think "TPRCiC" but smaller with only one track :)

I'm honored to have some experienced speakers about Perl, Github, Devops, LDAP etc... You will enjoy I promise!

More informations on my big blog serie about on devto or on the website.

I can give you already the connections informations:

Meeting ID: 818 6906 5466
Pass: 42

It's planned at 3pm UTC+1(Paris time) so check the timezone planner to know when it is for you.

It's in the morning if you're in US, in the afternoon if you're in Europe and very late if you're in Asia or Australia (sorry).

The planning will be something like this:
planningsmall.png

(it could last longer or change a bit inside the range, like shifting talks, but at the moment here it is)

I'm also possibly preparing some surprises that I don't want to reveal for now.

So my message is basically, it's coming, book your calendar and I'm looking forward to see you at The Ephemeral Miniconf!

Monthly Report - October

In the festive mood again ...

The festive season began already and I miss celebrating festivals with family and friends. But this is nothing new, I should get used to it now. Still sometimes it hurts really bad after all we are humans. In the past, we tried to be with family during festive season. The truth is it didn't feel the same. I don't know why. Could it be we are no longer carefree souls? But that can't be true. I have seen some of my friends on Facebook sharing celebration moments with family. It looks so beautiful and cute. The only difference I can think of is that they with family and I don't.

I would like to mention one friend from Nepal. We never met but I always watch his Facebook post having great time with his family. I think we became friends because of common love for Perl.

berrybrew version 1.36 released!

I've released version 1.36 of berrybrew, the Perlbrew for Windows. I've also reached out to see how I can become part of the Strawberry Perl team to get back on track with the release of new Strawberry Perls.

If you have any information on the release procedure for Strawberry, or know anyone on that team I might be able to contact to get things moving forward again, please let me know.

This release contains one significant new feature, the ability to use Powershell as the shell when opening or using a Perl. In the UI, when you "Open" your current Perl, or "use" any Perl you have installed, if the "Use Powershell" option is checked, instead of a cmd.exe shell, you'll be presented with a Powershell one instead (same applies for the command line berrybrew use $version.

berrybrew-ui_use_powershell.png

The other changes in this release enhance the unit testing infrastructure, and the tests themselves.

Other notable changes since my last blog post:

  • The berrybrew associate command now has an alias of assoc for fewer keystrokes
  • Better exception handling in several cases
  • Documentation clarifications
  • Removed the upgrade command. It's now recommended to use the Installer to manage upgrades
  • Fix issue when using berrybrew to manage file associations where arguments passed to perl were being handled incorrectly
  • Unit test infrastructure enhancements

open invitation to participate in Perl-OpenMP on Github

I've had https://github.com/Perl-OpenMP up for a while, but I only recently thought to post an open invitation for others interested in this exploration topic to join. #openmp on irc.perl.org exists, semi-related IRC channels inlcude: #native and #pdl .

My confidence in the value of this line of work was bolstered recently when I shoved in an old finite element of 2dheat conduction into a Perl script using, Two interesting examples follow:

The second of these examples takes an example from Inline::C::Cookbook that shows how to process an array reference, coupled with an OpenMP reduction by OMP_NUM_THREADS threads.

gcc has supported OpenMP's 4.5 specification as of version 7. So it's there and there are many ways that it can be leveraged via Perl.

Reviving Net::Pcap

I've blogged a bit about my steps to get Net::Pcap to compile again - I won't paste the complete text here unless there is demand, but I'm posting the link to the article here :)

https://corion.net/blog/2021/10/26/reviving-net-pcap/

Some Perl Code In Memory of a Great Scientist

On August 21, 2021, famous Polish mathematician Andrzej Schinzel passed away at the age of 84. He was one of the great minds behind modern number theory. May he rest in peace. I have extended one of my CPAN modules relating to his work and dedicated the release to his memory.

I try match syntax using Syntax::Keyword::Match


Syntax::Keyword::Match is a module to enable match syntax in the current Perl by Paul Evans who is one of the current Perl Steering Councils. See perlgov about the Perl Steering Council.

Syntax::Keyword::Match Examples

Syntax::Keyword::Match Examples

Number matching

Number matching. Match syntax is similar as a switch syntax of C language.

Web::PageMeta - a mixed sync/async lazy Perl Moose HTTP-GET module

Announcing here Web::PageMeta which is lazy build-ed HTTP-GET and web-scrape-data module able to work both in classic code and also to behave non-blocking in async code. More info on my blog or on CPAN or on GitHub .

TWC 127: Intersection on a Sunday Afternoon

This is my entry for

The Weekly Challenge, week 127

Task 1, "Disjoint Sets" was basically something I've done before somewhere else. In fact, what I'm using is overkill for just determining if two sets intersect. I imagine most people would probably use the FAQ answer. However, I'm a fan of what cardinal LanX of Perl Monks fame was trying to do in making set intersection a more "organic" operation. I don't know how much those ideas developed, however, so I'll be looking at the other solutions to see if there's anything new.

I actually did use my perlmonks code on real problem a few years ago, in modified form. It does the trick pretty quickly compared to other approaches. Thanks perl hashing!

You can find my code for Task #1 here.

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.