Spoiler Alert: This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.
Task 2: Digit Count Value
You are given an array of positive integers, @ints.
Write a script to return true if for every index i in the range 0 <= i < size of array, the digit i occurs exactly the $ints[$i] times in the given array otherwise return false.
Chapter 3 of Higher Order Perl describes various approaches to memoization of an expensive function: private cache and the Memoize module. The book was written in 2005 (Perl was at version 5.8 back then) , so it does not include another way for function caching that is now available : caching through state variables (introduced in Perl 5.10). The Fibonacci example considered in HOP also requires the ability to initialize state hash variables (available since Perl 5.28). The code below contrasts the implementation with a state variable v.s. the memoize module:
We talked about HTTPS in core, and some ideas about it, while the CPAN
Security Group is preparing some proposals. Today was the deadline for
releasing 5.41.1, but we don’t have volunteers yet, so Graham said he
would do it sometime soon.
We also noted that we’ll need some volunteers for the next 10 or so
development releases.
Following up on my previous post (MariaDB 10 and Perl DBIx::Class::Schema::Loader), I wanted to try the 'deploy' feature to create database tables from Schema/Result classes.
I was surprised that I could not create a table in the database when a timestamp field had a default of current_time(). The problem was that the generated CREATE TABLE entry placed quotes around 'current_timestamp()' causing an error and rejected entry.
As mentioned in a previous post, I had created file SQL/Translator/Producer/MariDB.pm as part of the effort to get MariaDB 10 clients to work correctly with DBIx::Class::Schema::Loader. Initially it was a clone of the MySQL.pm file with name substitutions. To correct the current_timestamp problem I added a search/replace in the existing create_field subroutine in the MariaDB.pm file to remove the quotes.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on August 18, 2024, at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.
Task 1: Good Integer
You are given a positive integer, $int, having 3 or more digits.
Write a script to return the Good Integer in the given integer or -1 if none found.
A good integer is exactly three consecutive matching digits.
We're happy to confirm the venue and date of this year's London Perl & Raku Workshop.
When: Saturday 26th October 2024 Where: The Trampery, 239 Old Street, London EC1V 9EY
This year's workshop will be held at The Trampery, at Old Street. A dedicated modern event space in central London. We have hired both The Ballroom and The Library; allowing us to run a main track for up to 160 attendees, and second smaller track for up to 35 attendees.
The Trampery in Old Street is located a two minute walk from the Northern Line's Old Street tube station in central London. The Northern Line has stops at most of the major train stations in London, or trivial links to others, so we recommend taking the tube to get to the venue.
If you haven't already, please signup and submit talks using the official workshop site: https://act.yapc.eu/lpw2024/
Thanks to this year's sponsors, without whom LPW would not happen:
The paella must be possibly the worst national dish ever created, I thought to myself as I looked at the charred remains in my pan. It is as if the mind of some ancient Spanish conquistador, returned from his conquests abroad feeling hungry and unfulfilled, dreamt
of bringing byriani to Spain, but in the midst of pillaging had forgotten to take culinary notes.
"How difficult can it be, Jose?" the weary warrior muses,
"Yeah, yeah, its just rice and meat, innit", says his Catalan colleague coming from the Spanish equivalent of Birmingham.
"We could use something flavourless, amorphous and chewy, like mussels, instead of meat",
"Whoaaah, nice,",
"And langoustines...",
"langa-what?",
"I know, right? Just throw them all in, don't bother shelling them",
"Raphael has some tomatoes he doesn't need for pelting passing pedestrians",
"Ahh...the flavours", fanning the flames as the smell of their concoction cooking brings back fond memories of far-away burning villages.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on August 11, 2024, at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.
Task 2: Knight’s Move
A Knight in chess can move from its current position to any square two rows or columns plus one column or row away. So in the diagram below, if it starts a S, it can move to any of the squares marked E.
Write a script which takes a starting position and an ending position and calculates the least number of moves required.
Fixing DBIx::Class::Schema::Loader For Use With MariaDB 10 Client Software
I recently set up a virtual Server Running Rocky Linux 9 as a client from which to query a remote MariaDB database. I used perlbrew to install Perl 5.38.2. I installed client related RPMs for MariaDB 10.5, I installed DBIx::Class as a relational mapper that can create Perl Schema Result Classes for each table in the database. If you are new to DBIx::Class, you can review its purpose and features in DBIx::Class::Manual::Intro. The Result Classes used by Perl to query the database are stored on the client server in a schema directory. They are created with the DBIx::Class::Schema::Loader module.
This year I was invited to the PTS conference in Lisbon as part of the CPAN Security group. Together we have been working on ways to improve the security of the Perl ecosystem. This was a great chance for members of the CPANSec group to meet in person, get to know each other better and discuss some of the items we have been working on lately. Welcome to Nicolas our newest member.
The new Carp::Object module is an object-oriented replacement for Carp or Carp::Clan. What is the point ? Well, here is some motivation.
The Carp module and its croak function have been around since perl 5.000. Errors can then be reported from the perspective of where the module was called, instead of the line where the error is raised. This excellent example from Mastering Perl explains why this is useful :
1 package Local::Math {
2 use Carp qw(croak);
3 sub divide {
4 my( $class, $numerator, $denominator ) = @_;
5 croak q(Can't divide by zero!) if $denominator == 0;
6 $numerator / $denominator;
7 }
8 }
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on August 11, 2024, at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.
Task 1: Check Color
You are given coordinates, a string that represents the coordinates of a square of the chessboard as shown below:
Write a script to return true if the square is light, and false if the square is dark.
Sometimes life catches up with you. I've felt that way for the last few years and I'm probably not alone.
During that time the cpancover project has basically just been plodding along, pretty much just working. As new modules were uploaded to CPAN, cpancover would pick them up, calculate the test coverage, and make the results available to be displayed on metacpan, along with detailed output on cpancover.com.
A little while ago I decided it was probably about time that I should update the OS and perl version and libraries and stuff.
Tried posting this on Reddit instead, but there seem to be some issues with code insert there, so here it is properly: Although Benchmark::DKbench is a good overall indicator for generic CPU performance for comparing different systems (especially when it comes to Perl software), the best benchmark is always your own code. Hence, the module now lets you incorporate your own custom benchmarks. You can either have them run together with the default benchmarks, or run only your own set, just taking advantage of the framework (reports, multi-threading, monotonic precision timing, configurable repeats with averages/stdev, calculation of thread scaling etc). Here's an example where I run a couple of custom benchmarks on their own with Benchmark::DKbench:
We were back from the PTS in Lisbon, and had a shorter meeting than usual, during which we mostly discussed the last remaining release blockers for 5.40.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on August 4, 2024, at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.
Task 1: Count Asterisks
You are given a string, $str, where every two consecutive vertical bars are grouped into a pair.
Write a script to return the number of asterisks, *, excluding any between each pair of vertical bars.
Example 1
Input: $str = "p|*e*rl|w**e|*ekly|"
Ouput: 2
The characters we are looking here are "p" and "w**e".
I just got back from the Perl Toolchain Summit 2024 in Lisbon Portugal!
Thank you to Grant Street Group for sponsoring my attendance at the event! Grant Street Group is an amazing place to work, and GSG is hiring! Contact me on irc.perl.org (Exodist) if you would like a referral.
This year I took a little side trip before the PTS to explore Lisbon with my wife. It is an amazing city, with a lot of history. I highly recommend visiting it and exploring the castles, palaces, and archaeological sights!
My goal for the PTS was to polish up Yath 2.0 and get it out the door. Spoiler alert: I did not achieve this goal, though I did make good progress. Instead several other things occurred that were even better as far as achieving things that require collaboration go!
The London Perl & Raku Workshop (LPW) will take place this year on Saturday 26th October and you are encouraged to submit your talk proposals now. We have already had 30 registrations for the workshop so we anticipate a good turnout this year.
We welcome proposals relating to Perl 5, Raku, other languages, and supporting technologies. We may even have space for a couple of talks entirely tangential as we are close to finalising the venue (very central London) and should have room for two tracks.
Talks may be long (40mins), short (20 mins), or very short (aka lightning, 5 mins) but we would prefer talks to be on the shorter side and will likely prioritise 20min talks. We would also be pleased to accept proposals for tutorials and discussions. The deadline for submissions is 30th September.
We would really like to have more first time speakers. If you’d like help with a talk proposal, and/or the talk itself, let us know - we’ve got people happy to be your talk buddy!