Spoiler Alert: This weekly challenge deadline is due in a few days from now (on September 8, 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: Making Change
Compute the number of ways to make change for given amount in cents. By using the coins e.g. Penny, Nickel, Dime, Quarter and Half-dollar, in how many distinct ways can the total value equal to the given amount? Order of coin selection does not matter.
A penny (P) is equal to 1 cent.
A nickel (N) is equal to 5 cents.
A dime (D) is equal to 10 cents.
A quarter (Q) is equal to 25 cents.
A half-dollar (HD) is equal to 50 cents.
We discussed the recently reported closure memory leak in 5.40, which existed in older perls and was fixed in a way that caused other breakage instead, and we agreed that if it isn’t fixable we need to address it by at least providing guidance on how to code around it
We discussed the removal of apostrophe as a package separator, and agreed that it should likely be feature-guarded, but the verdict on the fallout is not yet in
We continued the discussion on how to simultaneously encourage low ecosystem churn while helping users enjoy all the latest goodies
We agreed on writing a few position paper articles to explain our thinking and the attitude we think a PSC should take
Perl v5.40 introduced native true and false keywords. Unfortunately not all CPAN modules are ready to use them. One of those not yet ready is Mojo::Pg.
Normally you'd want to pass booleans to your queries as just 1's and 0's. However, since Mojo::JSON's true & false stringify to 1 and 0, my 5.38-using codebase is full of Mojo::Pg queries with Mojo::JSON's true and false as arguments.
This is a problem if I want to upgrade the perl interpreter of that project to Perl v5.40, because if I write "use v5.40;" in the file that contains those boolean keywords, Perl's builtin booleans will be used instead, which don't stringify to 1 and 0, but to 1 and the empty string, which can't be used by DBD::Pg in boolean fields and makes DBD::Pg throw an exception.
The solution I found was to subclass Mojo::Pg::Database, and wrap the query method, so that if Perl's builtin booleans are found, they are replaced in the query with native Pg booleans.
The source of the module and a lot more information can be found in my blogpost, here.
I have not been able to figure out how to run an async thread in the background while using a REPL like reply. The moment I run the main loop, it takes over the input from the REPL. Here's what a typical failed REPL session might look like.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on September 1, 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: Lucky Integer
You are given an array of integers, @ints.
Write a script to find the lucky integer if found otherwise return -1. If there are more than one then return the largest.
A lucky integer is an integer that has a frequency in the array equal to its value.
Well, after taking a very long break inspired (to understate it a bit) by the pandemic, I’m back to attending in-person Perl events with my seventh YAPC. Or, The Perl Conference, I suppose, but it still feels like YAPC to me. As per usual, here are some reflections.
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.
I remember when one one of my grandchildren helpfully decided reorganise a bookshelf whilst by himself. Upon being discovered, sitting in front of an empty shelf with books strewn all around him, his instinctive reaction made me feel proud to be his grandpa. He looked up and said, “Oh dear! Oh dear! what happened?”, as if this calamity had occurred spontaneously, astonishing him as much as the angry parent who was going to have to tidy it all up. It is hard to hide amusement when you watch your kids have to deal with their kids.
Advanced Disaster Management Strategy for Grandchildren and Programmers
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.
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 2: Changing Keys
You are given an alphabetic string, $str, as typed by user.
Write a script to find the number of times user had to change the key to type the given string. Changing key is defined as using a key different from the last used key. The shift and caps lock keys won’t be counted.
Wir freuen uns, die Veröffentlichung von OTOBO 11 bekannt zu geben! Die neueste Version der beliebten Open-Source-Ticketsystem-Software bringt zahlreiche Verbesserungen und neue Funktionen mit sich. Erfahren Sie mehr über die neuen Features und Änderungen auf OTOBO
Over the years that I have existed in four dimensions, I have come to accept that time is not a linear concept heading inexorably in one direction at a uniform rate. It didn't take an Einstein or Hawking to convince me either. Time is as malleable as the distortions applied by our consciousness, or imposed by those around us. Consider my youngest daughter's
essay due to be handed in on Tuesday, a task assigned 4 months earlier. At 4,000 words, it represented roughly 6 words an hour allowing for eating, sleeping, work, weekend fun, and other essential time-devouring activities. Yet the "I have got plennnnty of time, chill, dad!" of a few months ago, has now turned into cries of despair, as she has to do an all nighter at her desk instead of being at some selfie-rich event critical to her mental well-being and social standing.
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.
In the week 270, the second task was really interesting and difficult. Here’s a slightly reformulated version:
We’re given an array of positive integers @ints and two additional integers, $x and $y. We can apply any sequence of the following two operations: 1. Increment one element of @ints. 2. Increment two elements of @ints. The cost of each application of operation 1 is $x, the cost of operation 2 is $y. What’s the minimal cost of a sequence of operations that makes all the elements of @ints equal?
Why do I say it was difficult? I compared all the Perl and Raku solutions I could find in the GitHub repository and none of them gave the same results as mine. It took me several days to find an algorithm that would answer the tricky inputs I generated with a pen and paper, and one more day to optimise it to find the solutions in a reasonable time.
Last year at the Perl Toolchain Summit (PTS) in Lyon, I left three draft pull requests: one about the class declaration introduced in Perl 5.37, one about the PAUSE on docker, and one about multifactor authentication. I wanted to brush them up and ask Andreas König to merge some, but which should I prioritize this year?
Just Aristotle and Philippe this time (Graham chipped in on IRC):
we discussed the apostrophe situation: we will watch 5.41.3 break CPAN, and then evaluate the actual fallout. We like the idea of guarding this with a feature (which might need to be split in two, for the string interpolation case)
we had a long discussion about backwards compatibility and use VERSION.
Should "did you use VERSION?" become the new "did you use strict and warnings?"