Well end of day two here and had a nice walk and a nice chat with one of the local city counselors who was out glad handing I asked her when the Gardiner Express Way will be fixed up. She said by Christmas ;)
That was a Local joke now onto what I got up to today.
Ovid despite Air Frances best efforts actually did make in to the conference late the night before so he was able to give his Keynote on OO in the Perl Core, Seems we will be getting something called Corinna Soon we will have Field, Class, Role and Method to play with and if you are brave you can get the latest version of perl and play with a few parts of it. The key sticky part is Typing, Seems there is another project out there called Oshum to handle all those nasty typing problems. Well to quote the main character Sweden's best know literature
Hi everybody! Just doing one challenge again this week. Time limitations hold me back once again.
This week we're looking for the letters of a target word in a source word, and we're not allowed to use the same letter twice. Spoiler alert because it's only Wednesday and you still have the rest of the week to submit solutions if desired.
The easiest way to do this is with a dictionary hash initialized like so:
foreach (split //, $source) {$chars{$_}++}
Many people use map() to do this, but I'm not a big fan of map in many cases because I feel it makes code less readable.
This gives us the number of occurrences of each letter in the original word.
Then we iterate through the target word and look for (and remove) the letters in the dictionary:
In my recent Cloud Comparison, I mentioned that I'd look at Spot VM pricing in an update. This is the update - 6 out of the 10 providers tested offer Spot/Preemptible instance pricing.
At SpareRoom we make some good use of Spot VMs. E.g. our perl test suite gets to run on fast VM types at very low cost: currently we are using c3-highcpu-22 instances which normally come at $0.95/hour each. The spot pricing for them is more than 10x lower, at just $0.086/h. At these prices, if our test suite needed it (it's already fast), we'd be able to launch c3-highcpu-176 (176 vCPUs) at well under $1/h!
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on March 31, 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: Max Positive Negative
You are given an array of integers, @ints.
Write a script to return the maximum number of either positive or negative integers in the given array.
Example 1
Input: @ints = (-3, 1, 2, -1, 3, -2, 4)
Output: 4
Count of positive integers: 4
Count of negative integers: 3
Maximum of count of positive and negative integers: 4
[…] Corporate-employed FOSS maintainers working at a firm with these [very common] “growth and novelty” incentives [… are] in a position where their job performance is very likely to be evaluated in terms of visible growth and novelty (it might be dressed up in more abstract terms like “real-world impact” or “visibility” but it still means the same thing) even though that is exactly the wrong thing for the health of the project they’re maintaining.
I’m excerpting the gist of his article here but actually I suggest reading all of it. It’s not very long but gives flesh to this skeleton argument.
It doesn’t help that what he is talking about isn’t limited to employed maintainers; profit is not the only growth incentive structure that can lead to this novelty mindset, so this can exist entirely outside commercial context.
Today was PSC 111 — what happened to 110 you ask? Well, it was a bit of a non-meeting a few weeks ago. Nothing to say about it, sorry!
This week, we:
Said hello to Graham and goodbye to Rik
We did a bunch of handover, making sure we set up a new Zoom meeting and calendar, and talking about our usual order of business
In more normal business, we:
talked about the future of use vX, especially related to builtin:: stuff — do we want “use v5.40” to import “builtin::refaddr” for example
talked about what we’re going to do with the UNIVERSAL::import changes so we can move it forward toward someday making it fatal but without breaking half of CPAN at once
Finally have a chance to go to a North American Perl event, so after nearly 4 years since my last Perl event, thanks Covid 19 I managed to make my way down from the Ivory Tower in Ottawa to the 'Big Smoke', 'Hogtown', Queen City, TO or as most of the rest of the world knows it Toronto.
So there are about 100 us us Perl types here today, with most participants coming from across the US and Canada but there are a few that came over 'The Big Pond'
So far The talks have been very good, I had a and interesting Talk on Test2 by Chad Granum something I will have to look into as my old test suite is becoming a little flimsy and is a patchwork of kludges,
Hi everybody! Very limited time this week so just a brief blog post.
This week we're looking for any words in the list that can be created only using letters from a dictionary string. Then print the number of characters in the good words.
Spoiler Alert: This weekly challenge deadline is due in a couple of days from now (on March 24, 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: Multiply by Two
You are given an array of integers, @ints and an integer $start.
Write a script to do the following:
a) Look for $start in the array @ints, if found multiply the number by 2
Hi everybody! This week again because of time I only finished the first challenge of The Weekly Challenge. However, because work for my client requires Python, I'm busy learning Python and I thought "Why not do Python for a simple weekly challenge task?" This is the first Python code I've ever truly written and not just modified!
First, the Perl:
say $_ for (sort {$a <=> $b} (map {$_ * $_} @ARGV));
Yep, a one-liner. Normally I prefer to write longer, more readable code, but this time the task was so simple it made sense just to write it on one line.
We map each argument on the command line into its square, then sort (with a numerical sort because map defaults to strings) and then just say() them.
Originally I was sorting with a custom sort routine based on absolute values, but then I realized (thanks to other blog posts) that it would be more efficient not to abs() anything and just to replace everything with its square first, then sort.
Spoiler Alert: This weekly challenge deadline is due in a couple of days from now (on March 24, 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: Element Digit Sum
You are given an array of integers, @ints.
Write a script to evaluate the absolute difference between element and digit sum of the given array.
Four years have passed since the last Perl Toolchain Summit (PTS) in Marlow. I planned to continue working on PAUSE's web UI, but I didn't exactly remember what to do. So the first thing I did at home before the PTS was to read through the PAUSE issues and do some triage. I also resumed a virtual machine that held PAUSE clones I had worked on. There I found an untracked docker-compose.yml. It was incomplete. I must have given it up because I already had a working environment. However, I remembered a few people wanted an easier way to install PAUSE. It would be helpful if they could run PAUSE on docker. Thus I started filling missing parts of the YAML file. After making a few serious mistakes, I made a draft pull request on the first day of the PTS. Matthew Horsfall took it over then.
Hi everybody! Back this week with a solution to just the first challenge project. I know I won't have time for the second one, plus I'm not sure of an efficient solution. I really liked this first one, though! I got to try some new techniques in it.
Spoiler alert, since I know it's only Wednesday/Thursday depending on where you are, but if you're looking to solve this challenge yourself you might prefer not to read this yet.
So the goal of the first challenge is to find the 3 integers in a list that have the greatest product, and print the product.
Spoiler Alert: This weekly challenge deadline is due in a couple of days from now (on March 3, 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: Sum of Values
You are given an array of integers, @int and an integer $k.
Write a script to find the sum of values whose index binary representation has exactly $k number of 1-bit set.