This week we have a very simple challenge! Again due to time, I just did the first challenge this week, but I have an idea of how I'd solve the second and I'll compare with the way others implemented it.
Anyway, to the challenge. The goal is to find the 3rd smallest element of a matrix. The simplest way is simply to flatten, sort, and pick the element. There might be absolutely more performant ways to do it, such as scanning the entire matrix once and keeping a list of the lowest three as you iterate, but this is a case where I feel that it's simply not worth it. One pass to flatten and one sort isn't worth all the extra implementation complexity. I do look forward to seeing any solutions including that technique though.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on January 28, 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: Weakest Row
You are given an m x n binary matrix i.e. only 0 and 1 where 1 always appear before 0.
A row i is weaker than a row j if one of the following is true:
a) The number of 1s in row i is less than the number of 1s in row j.
b) Both rows have the same number of 1 and i < j.
Write a script to return the order of rows from weakest to strongest.
This is not exhaustive at all and is based on github release notifications rather than MetaCPAN recent. If your perl project uses github releases please let me know so I subscribe to them. I also post them to Perl Programmers.
EPrints 3.4.5-rc1
EPrints is a document management system aimed at Higher Educational institutions and individuals. EPrints has been used to provide Open Access to research results, sharing of educational resources and providing portfolios of work. It has a flexible metadata and workflow model to support varied business needs as well as interaction with other Web and institutional systems.
EPrints 3.4.5 release candidate 1 is now available on GitHub. Full release is planned for release shortly.
Request Tracker 5.0.4
RT is an enterprise-grade issue tracking system. It allows organizations
to keep track of what needs to get done, who is working on which tasks,
what's already been done, and when tasks were (or weren't) completed.
After a break of four years, it has been my privilege to attend the 13th Perl Toolchain Summit (née Perl QA Hackathon). This is the third time the summit has been held in Lyon and the tenth summit I have been able to attend. PTS is a really important event in the Perl calendar where those working on the Perl toolchain and in Perl QA get to meet together for four days of discussions, decisions on the future of Perl, and hacking.
Arriving late on Wednesday evening, I had an overfull list of things I wanted to talk to people about and work I wanted to do. In the end I didn't even get half way though my list, but that was expected.
Today, the PSC met up … in person! We’re all in Lyon for the Perl Toolchain Summit.
Meantime, although we had a very long conversation, it boils down to just a couple things:
We talked a very long time (well, 45m) about GitHub issues labeled “BBC” and marking them “needs triage” (meaning: more info) or “not a release blocker” or “release blocker”. This will require more work, but we made good progress.
We discussed HTTP::Tiny, security, and how best to bootstrap CPAN and stay secure. More soon.
We discussed Test2 in core, which is now its own thread on p5p, enjoy!
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on January 28, 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: Split Strings
You are given an array of strings and a character separator.
Write a script to return all words separated by the given character excluding empty string.
An app’s config is everything that is likely to vary between deploys (staging, production, developer environments, etc).
The Twelve-Factor App
Storing the often changing parts of configuration in environment variables is
one of the principles of The Twelve-Factor App.
From this principle follows the need to store those environment variables and their values
in an easily accessible way. Hence, every developer maintains his or her own
project specific .env files next to the project files in the same directory
where they are used, for instance, when running locally or testing locally.
Yet Another Dotenv Solution
As if we didn’t have these enough already…
What is different with this one, except the name Env::Dot?
There wasn’t much to talk about because code freeze ahead of 5.38 is in
effect, so there isn’t much going on.
We talked further about the upcoming deprecations scheduled for
5.38.0 (smartmatch, tick-as-package-separator), and concluded that
we remain committed to keeping them deprecated on the current
schedule.
Next week’s meeting will be in person in the French city of Lyon.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on January 21, 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: Unique Sum Zero
You are given an integer, $n.
Write a script to find an array containing $n unique integers such that they add up to zero.
Example 1
Input: $n = 5
Output: (-7, -1, 1, 3, 4)
Two other possible solutions could be as below:
(-5, -1, 1, 2, 3) and (-3, -1, 2, -2, 4).
Back already with this week's solutions to the PWC #212. Spoiler alert, because the challenge doesn't close for another few days if you want to have a try.
Challenge #1 - Spinning Letters
This week we've got a simple letter rotation. Take each letter of the word provided and rotate it by each number in the list. At first I thought this would be a lot longer code. i even put it in a sub. That actually doubles the size though for absolutely no benefit, so I just simplified. We split the word, then loop through the letters and apply the rotation. If it wraps we start from the start of the alphabet. Upper-case is handled with a simple test to insert the right case of each character. Then we don't even bother putting the word back together again because we can just say it as-is.
Date of Latest Release: Feb 12, 2020
Distribution: Data-Table
Module version: 0.38
Main Contributors: Yingyao Zhou (EZDB), Guangzhou Zou
License: [perl]
Near the Christmas in 2022, I played a data engineering challenge called "Hanukkah of Data 5783". You can find it on https://hanukkah.bluebird.sh/5783 . Players can download data of either .CSV, .JSON or .SQLITE format.
The first* task is like this:
... And their phone number was their last name spelled out. I didn’t know what that meant, but apparently before there were smartphones, people had to remember phone numbers or write them down. If you wanted a phone number that was easy-to-remember, you could get a number that spelled something using the letters printed on the phone buttons: like 2 has “ABC”, and 3 “DEF”, etc."
* There is a "zeroth" task on the calendar year.
I didn't mind perish my skill on SQL, but these kinds of things immediately I thought of Perl, maybe there would be a subroutine like this:
The other day I was working on yet another side project. Almost immediately I got side tracked. Does that make the new project a side side project?
What shiny bobble or cool new tech got my attention you ask? It wasn't $buzzword, or $fancy_tech. Nawe, nothing that resumé worthy. Instead, I decided to see what a MVP for a REST API would look like in using Catalyst. Look ma, no extra modules! Except a JSON one, but I don't count it since Catalyst also uses a JSON module.
NOTE: If you are trying to be productive, you probably want to just use Catalyst::Action::REST instead of rolling your own. That's what I've used at work with great success.
Other than generating the scripts I went ahead and hand wrote out everything else and was pleasantly surprised. There was so little code that I went ahead and retyped the only three modules needed here. Apologies if there's a typo.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on January 21, 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: Special Numbers
You are given an array of integers, @ints.
Write a script to find the sum of the squares of all special elements of the given array.
An element $int[i] of @ints is called special if i divides n, i.e. n % i == 0, where n is the length of the given array. Also the array is 1-indexed for the task.
Paul, Philippe, and Ricardo had our mostly-weekly Zoom call today.
We began by discussing last week, when Pete K from TPRF joined us and we talked about what TPRF could do to help p5p. (Main topics then, which didn’t get any firm action items, were support for critical infrastructure and services and bounties for implementation of PPCs.)
Most of our time this week was spent on the upcoming v5.38.0 release, especially what might be blocking it. (Notable: two new deprecation warnings added in the last two releases — smartmatch, and tick as package separator.)
We discussed strategies used by other languages to make things more attractive for developers, like batteries included. We didn’t end up with any plan of action from this.
In a few weeks, we’ll all be in one place, and look forward to looking carefully at the color of Chartreuse.
Perl has had the CPAN and awesome websites like MetaCPAN and its predecessor search.cpan.org for a long time, so unlike how things happen in other programming language ecosystems, many Perl projects have felt no need to start their own websites for documentation, package downloads, and community — all these things were already provided.
However, I do feel that this centralization keeps Perl content on the Internet very isolated and makes Perl less visible than other programming languages.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on January 14, 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: Lucky Number
You are given a m x n matrix of distinct numbers.
Write a script to return the lucky number, if there is one, or -1 if not.
A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in its column.
Hello everybody! Back this week for weekly challenge 215, where we look for unsorted words and sets of zeros. This week both challenges took me only about 10-15 minutes each. The usual disclaimer about an early post, so don't read spoilers if you want to do the challenge yourself.
Odd One Out
This one's a very simple task to print the number of words that are not alphabetically sorted. Here's the code:
#!/usr/bin/perl
use strict;
use v5.24;
my $removed = 0;
foreach (@ARGV) {if ($_ ne join('', sort(split(//, $_)))) {$removed++}}
say $removed;
Hi ! Everyone, I am back here to ask environmental issue.
When I ran the following CGI.pm testing script before placing at /var/www/cgi-bin, but it is still at /home/mkido/bin. Perl script ran successfully at the Terminal, and replied back the OUTPUT below there.
Perl Script, check.pl
#!/usr/bin/env perl
use strict;
use warnings;
use CGI;
my $q = CGI->new;
print $q->header();
print "OK";
===================
OUTPUT
mkido@localhost$check.pl [Enter to run it.]
Content-Type: text/html; charset=ISO-8859-1
OK
mkido@localhost$
This output result evoked my recognition. Is this Rocky 9.1 Web Server running to provide charset=ISO-8859-1 ?? I want to set all replies from the Server to charset=UTF-8. The httpd.conf is already set to charset=UTF-8. Is there any other setting adjustment somewhere in environmental configuration on my server to change from charset=ISO-8859-1 to charset=UTF-8 ?? Thanks, thanks.