My Favorite Warnings: precedence

Perl possesses a rich and expressive set of operators. So rich, in fact, that other adjectives can come to mind, such as prolix, or even Byzantine.

Requests for help navigating Perl's operator space appear repeatedly on outlets such as PerlMonks. These seem to me to involve two sorts of confusion: precedence (discussed here) and functionality (string versus numeric -- maybe another blog post).

The precedence warnings category has some help here, though as of Perl 5.34 there are only two diagnostics under it:

Perl Weekly Challenge 149: Fibonacci Digit Sum and Largest Square

These are some answers to the Week 149 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 January 30, 2022 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: Fibonacci Digit Sum

Given an input $N, generate the first $N numbers for which the sum of their digits is a Fibonacci number.

Example:

f(20)=[0, 1, 2, 3, 5, 8, 10, 11, 12, 14, 17, 20, 21, 23, 26, 30, 32, 35, 41, 44]

Fibonacci Digit Sum in Raku

We first populate a Set (for fast look-up) with the Fibonacci numbers up to 1000. Note that we could choose a much smaller maximum value, but it doesn’t cost much and it will work with very large sequences.

United Domains unterstützt den Deutschen Perl Workshop 2022

united domains, das ist ein Team von rund 80 qualifizierten und erfahrenen Mitarbeiterinnen und Mitarbeitern, die sich zuverlässig und mit Leidenschaft um Ihre Domains kümmern. Unser Versprechen lautet: »Die besten Adressen fürs Web«. Denn wir sind überzeugt, dass es einen Unterschied macht, wer Ihre Domains betreut. united-domains ist mit mehr als 1,6 Millionen registrierten Domains und mehr als 300.000 zufriedenen Kunden einer der führenden Domain-Registrare in Europa. Wir bieten über 850 Domain-Endungen: Von .ag wie Antigua bis .za für Südafrika oder neue Domain-Endungen wie .app oder .dev. Der weltweite Domain-Check, eine schnelle und sichere Domain-Registrierung und die übersichtliche Domain-Verwaltung sind unsere Markenzeichen.

Call for Papers, Perl & Raku Conference in Houston 2022

CFP closes March 1st, 2022 10am PST

"The Perl & Raku Conference is a high-quality, inexpensive, technical Conference that celebrates the family of Perl programming languages. The beauty of the conference is that it remains accessible to everyone regardless of experience, yet it is still valuable to the most skilled programmers.
The Perl & Raku Conference 2022 will be held in Houston, TX from June 21-25, 2022. The main conference will be June 22-24, 2022 with tutorials on June 21 and 25."

CFP: https://www.papercall.io/tprchou22

Conference: https://perlconference.us/tprc-2022-hou/

My Favorite Warnings: qw

When I first came to Perl I thought the qw{} construction was pretty neat. Give it a bunch of white-space-delimited text and it gives you back a list separated on the blanks. So

say for qw{ Fee fie foe fum! };

prints 'Fee', 'fie', 'foe', and 'fum!', each on its own line. But if you add punctuation, and warnings are enabled,

say for qw{ Fee, fie, foe, fum! };

gets you 'Possible attempt to separate words with commas ...'.

For a while, I was dealing with this using a weird assortment of quoting techniques. But then I discovered how to tell Perl I meant to do that:

no warnings 'qw';

Perl Weekly Challenge 148: Eban Numbers and Cardano Triplets

These are some answers to the Week 148 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 January 23, 2022 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: Eban Numbers

Write a script to generate all Eban Numbers <= 100.

*An Eban number is a number that has no letter ‘e’ in it when the number is spelled in English (American or British).

Example:

2, 4, 6, 30, 32 are the first 5 Eban numbers.

The task asks us to list the Eban integers smaller than or equal to 100. To start with, 100 (”one hundred”) has two ‘e’, so it is not an Eban number. So we can limit our search to all Eban Numbers < 100, so that we can limit our search to integers with one or two digits.

Rother OSS GmbH / OTOBO unterstützt den Deutschen Perl/Raku-Workshop 12/01/22

Seit 2011 setzt die Rother OSS GmbH mit Sitz in Süddeutschland und über das ganze Land verteiltem Team auf die Kombination aus OS-Ticketsystem und Business Services vom Experten. Konkret: Consulting, Entwicklung und Support zu den freien OTRS-Versionen.

TWC 147: Prime without Left, and Pent without Quad

In which we bravely overcome ambiguity, and dodge two approaches in the face of (O³).

Perl is not dead

Came across an interesting video from one of the users of Perl: Is Perl dead? @Randal L. Schwartz on Dart and Flutter @Code Maven

To whom this MySQL UTF-8 news may concern

Strictly speaking not news exactly, given that it dates from early 2018, but it was news to me, and since I haven’t seen it make the rounds I still find it worth disseminating. From the MySQL 8.0.11 release notes:

The utf8mb3 character set will be replaced by utf8mb4 in a future MySQL version. The utf8 character set is currently an alias for utf8mb3, but will at that point become a reference to utf8mb4. To avoid ambiguity about the meaning of utf8, consider specifying utf8mb4 explicitly for character set references instead of utf8.

This a declaration of intent rather than a change that has happened… but still. It’s been a very long September

(To prepare for this you’ll want to note what you need to take into account regarding the way utf8mb4 and indexes interact.)

Eertree: Palindromic Tree

The Weekly Challenge 145

The Task 2 of the Weekly Challenge #145 asked us to build a Palindromic Tree. It also linked to a blog post explaining the "Eertree" data structure.

Maybe it was just me, but I found the blog post confusing. Fortunately, it further linked to a scientific paper that introduced the structure around 2014.

TWC 146: 10K Prime and CW Trees (redirect)

Please go here instead.

Opening Files Quickly from Inside vim

I use ot a lot when it comes to opening files. I wanted to be able to use this tool from inside vim as well. It turns out, the solution is quite simple.

Full post: https://www.olafalders.com/2022/01/05/open-this-file-from-inside-vim/

Writing a SNES assembler compiler/disassembler - Day 4

Testing

It's time to test what we have written so far. If you look at the asar project, there are already some test files and they come with their own test syntax. It's actually pretty neat since it's embedded in the ASM files comments, so you don't need to write specific tests files.

The format is documented here https://github.com/RPGHacker/asar#test-format but for now, we will just keep the offset and byte value part.

Testing grammar

We could write a loop with like files.IO.slurp.lines and be done to handle this. But let use again a grammar. No action associated with it since it's very basic.

My new modules in 2021

Perl

I had a reasonably productive year, releasing several modules that I think/hope are useful for the wider ecosystem.

Crypt::Passphrase

This module manages the passwords in a cryptographically agile manner. That means that it can not only verify passwords using different ciphers, but it also aids in gradually upgrading passwords hashed with an outdated cipher (or outdated settings) to the current one; for example when you want to upgrade from bcrypt to argon2. Password hashing is both a rather common form of cryptography, and one that is more subject to change than others; you should probably reevaluate your password handling every couple of years. With this module, you can initiate such a transition with a simple configuration change.

This also includes a number of extension distributions (e.g. Crypt::Passphrase::Argon2, Crypt::Passphrase::Bcrypt, etc…), and one new backend module (Crypt::Bcrypt)

Thread::Csp

Draft: Dancer2 Deprecation Policy

Hello fellow Dancers!

I have posted a draft deprecation policy for the Dancer2 code base for public review.

The Dancer Core Team has done our best to look at this every which way and cover all potential issues and use cases, but we're sure to have missed something here or there. So take a look and let us know. Your feedback is welcome - please add comments, feedback, and suggestions on the issue.

Thanks in advance! :-)

Monthly Report - November

Time to relax before ...

What a shame, I delayed the Monthy Report once again. Although I did manage to publish last month on time i.e. 4th Nov.

Do I have reason to justify the delay?

Well, December, is always the busiest month. It is the month when I spend more time with family than ususal. Also I was busy with the Advent Calendar 2021.

As you must have guessed, today I am done with the final gift. Hence, the monthly report is getting time. There was another reason for the delay as I started Live Coding again. I have done few, which I will talk about in the end of year report in a week time, insha-ALLAH.

So, what was the highlight of last month?

Writing a SNES assembler compiler/disassembler - Day 3

Assembling the Assembler

Grammar fix

When starting implementing the compiler part of this. I noticed that the grammar does not actually really work, especially if you introduce new lines. If I parse a file with 3 instructions, we catch the \n sometime and the asm-comment token is too greedy.

Let's change the ws rule to only capture horizontal blank (space and tab) and introduce an eol token, this makes the grammar more clear on what we are working on also.

PDL 2.063_01 released

There have been a couple of developments in PDL since the last announcement on here I could find, from 2013. To hypersummarise: 64-bit indexing, native complex number support, automatic pthreading using all available CPU cores, faster installation thanks to parallel-building, memory-mapped data, repository hosted on GitHub, easy to use "with" Inline. Returning you to the announcement:

PDL 2.063_01 has just been released. Notable changes since 2.062:

  • Various API changes (see below)
  • Improvements to $MACRONAME() handling including that arguments can now contain (balanced) brackets
  • redodims no longer leaks memory
  • The PROJ.4 interface has been updated to use the PROJ v6+ interface, finally
  • A zeroes() regression from 2.057_01 where it ignored the type of an input PDL has been fixed
  • PDL::Compression is now thread-safe (thanks Derek for the report!)

An attempt has been made to fix the older-clang/LLVM compilation errors - if you have clang 12.0.0 or earlier and can try installing this version and report results here, that would be very helpful!

A (not so) simple matter of privacy

You may have seen Ovid's recent post on his discussions with the Perl Steering Committee about moving forward with implementing an initial subset of the Corinna proposal in the Perl core.

One of the issues that came up during those discussions was the best way to provide private methods in Corinna. The current Corinna proposal is that this would be done (like almost everything else in Corinna) via an attribute:

method do_internal :private () {...}

Thereafter, the do_internal() method can only be called from within the current class, and is never overridden by derived-class methods when it is called within its original class.

In other words, the :private method effectively prepends the following code to the start of the method:

croak "Can't call method 'do_internal'"
    if caller ne __CLASS__;

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.