Perl Weekly Challenge 272: String Score

These are some answers to the Week 272, Task 2, 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 June 9, 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: String Score

You are given a string, $str.

Write a script to return the score of the given string.

The score of a string is defined as the sum of the absolute difference between the ASCII values of adjacent characters.

Example 1

This week in PSC (135) | 2024-02-08

This week, the three of us:

  • noted that use VERSION restrictions have had mostly positive responses
  • thought that Data::Printer can’t go in core as-is, but there’s a use case for a debugging helper, some of which might be hidden in D:P’s core
  • discussed adding a builtin::numify function (and the corresponding OP in core)
  • quickly reviewed the PPCs currently being implemented:
    • we should ping the implementors of PPC0014 (English names) and PPC0021 (optional chaining)
    • PPC0022 (meta) has an implementation on CPAN
    • PPC0019 (qt strings) implementation is in progress, but unlikely to be done by 5.40
    • PPC0013 (overload in join) is currently stalled

Perl & Raku Conference 2024 to Host a Science Track!

I am very pleased to announce that the 2024 Perl & Raku Conference Planning Committee (TPRC) is moving forward with the addition of a new track that targets academic, governmental, and industrial STEM applications. It will strive to be organized as a traditional science conference track; meaning the talks will be based on paper and poster submissions. (more on this in a future announcement!)

The decision by the TPRC Planning Committee is the result of an overwhelmingly positive response to the Science Track Survey that was held late in 2023. Everyone involved in organizing the survey deeply appreciates those who filled out the survey or shared it with others.

The track is being organized in tight cooperation with the TPRC, by the Science Perl Committee (SPC); a separately organized group of Perl and STEM enthusiasts that anyone of good will is welcome to join.

What to expect now: ...

Cosmoshop unterstützt den Deutschen Perl/Raku-Workshop

We are happy to announce that CosmoShop supports the German Perl/Raku-Workshop.

CosmoShop is the largest pure Perl based shop system.

Since 1997, we have been implementing sophisticated and individual eCommerce projects in the B2B sector with our specially developed store software. We are the central point of contact for the entire spectrum.

Perl Weekly Challenge 272: Defang IP Address

These are some answers to the Week 272, Task 1, 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 June 9, 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: Defang IP Address

You are given a valid IPv4 address.

Write a script to return the defanged version of the given IP address.

A defanged IP address replaces every period “.” with “[.]".

Example 1

Input: $ip = "1.1.1.1"
Output: "1[.]1[.]1[.]1"

Example 2

Input: $ip = "255.101.1.0"
Output: "255[.]101[.]1[.]0"

This the first time that I hear that an IP address could be "defanged."

Defang IP Address in Raku

Step Counter (Advent of Code 2023/21)

The Task

We’re given a grid with obstacles, we’re supposed to count all the reachable plots in the grid in a given number of steps (we can only move one plot at a time horizontally or vertically).

The sample input looks like this:

...........
.....###.#.
.###.##..#.
..#.#...#..
....#.#....
.##..S####.
.##..#...#.
.......##..
.##.#.####.
.##..##.##.
...........

where S is the starting position.

This week in PSC (129) | 2023-12-21

We

  • Arranged for a representative from TPRF to join us in January to discuss roadmaps
  • Started discussing what might turn up in the PSC talk at FOSDEM

We’re skipping next week due to Christmas, so next meeting should be on 2024-01-04

Migrating from DBD::mysql to DBD::MariaDB

DBD::mysql has long provided the interface to connect to the MySQL database from Perl code. But as old as it is, it was implemented with some critical bugs that cannot simply be corrected without breaking mountains of existing code relying on those bugs. For this same reason, though DBD::MariaDB corrects these bugs, care must be taken when migrating existing code to avoid subtle breakage.

This blog post is far too short to explain Unicode and encodings like UTF-8; for anyone seeking a more solid grasp on the concepts, I recommend a read through The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) by Joel Spolsky.

Perl Weekly Challenge 271: Sort by 1 Bits

These are some answers to the Week 271, Task 2, 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 June 2, 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: Sort by 1 Bits

You are given an array of integers, @ints.

Write a script to sort the integers in ascending order by the number of 1 bits in their binary representation. In case more than one integers have the same number of 1 bits then sort them in ascending order.

Example 1

Brain Memory Management

My next dev article about the important concept of cognitive load of code and how to manage it.

This week in PSC (128) | 2023-12-14

This week, Graham was on holidays, so Paul and Philippe:

  • reviewed new mailing list threads. Just one - a rethink of signatures.
  • submitted a talk proposal to the Perl dev room at FOSDEM
  • continued to discuss the complexities of moving past the number ‘5’ for the major part of the language version

Quote of the week: “There are features that make the language slow, but those are the features that make the language.”

It's the Twelve Days of Dancer, 2023 edition!

The 2023 Dancer Advent Calendar, the Twelve Days of Dancer is up and running! We hope you'll enjoy this year's version - there's a lot of fun and practical gifts to be found there.

Hot on the heels of our earlier gift (Dancer2 1.1.0) come two more plugin releases, Dancer2::Plugin::Cache::CHI and Dancer2::Plugin::Syntax::GetPost.

Enjoy! Let us know what you think. Happy holidays to all! (and now it is time for this Dancer to enjoy a long winter's nap)

Jason/CromeDome

Perl Weekly Challenge 271: Maximum Ones

These are some answers to the Week 271, Task 1, 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 June 2, 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: Maximum Ones

You are given a m x n binary matrix.

Write a script to return the row number containing maximum ones, in case of more than one rows then return smallest row number.

Example 1

Input: $matrix = [ [0, 1],
                   [1, 0],
                 ]
Output: 1

Row 1 and Row 2 have the same number of ones, so return row 1.

System Thinking

I started to also post on dev.to and will post there mostly about topics larger than Perl : psychology of programming, software engineering and alike.

This week in PSC (127) | 2023-12-07

This week we:

  • Worked out final resolving actions for security issues.
  • Discussed recent mailing-list posts about making method non-public by default. This probably won’t work but we could open a PPC discussion on my method + $obj->&method syntax.
  • Reviewed Projects in Flight - posted below
  • Merged the PR for PPC 0022 (Metaprogramming API). Discussions on individual points can be made using GH Issues

Projects in Flight

  • HTTPS out of the box — (Paul) has nudged Mark Gardner by email
  • PPC 0013 overload in join — (Philippe) should open an issue with his thoughts on the topic
  • PPC 0014 English names — (Paul) should check in with Joe McMahon
  • PPC 0019 qt Strings — (Paul) now has TPF Core Development Grant so can start writing this Any Day Now(TM)
  • PPC 0021 Optional chaining — (Paul) should check in with Veesh Goldman
  • PPC 0022 Metaprogramming API — (Paul) has a CPAN module, would be nice if anyone started using it for any reason
  • (Graham) to write a PPC for ->&
  • Perl roadmap for 2024 — Yeah it’d be nice if we had one, but without having any weight of promise behind it it’s just words
  • TODDR to write a draft pod/security_disclosure_process.pod (not in December), and also offered to coordinate the next incident

Is Perl a write only language?

I am sick and tired of hearing this, so let's put it this to the test. Assume you know little of Perl, or any programming language for that matter. Can you parse the code?

https://chrisarg.github.io/Killing-It-with-PERL/2023/12/06/Is-Perl-a-write-only-language.html

I hope the piece above is the first in a series to convince people to consider the reality before passing judgement. It was inspired by one of our research analysts discovering Perl and awk to simplify their lives when cleaning data.

# Perl Weekly Challenge 270: Special Positions

These are some answers to the Week 270, Task 1, 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 May 26, 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 Positions

You are given a m x n binary matrix.

Write a script to return the number of special positions in the given binary matrix.

A position (i, j) is called special if $matrix[i][j] == 1 and all other elements in the row i and column j are 0.

Example 1

The YAMLScript Advent Blog

Season's Greetings, Perl!

I've spent almost all of my time since my [last post here]( https://blogs.perl.org/users/ingy_dot_net/2023/05/perl-toolchain-synergy.html) working on a new programming language, YAMLScript.

It's working now and I've decided a do a [2023 Advent YAMLScript Blog]( https://yamlscript.org/posts/advent-2023/index/) for it. The blog started last Friday and will continue (at least) until December 24th.

I encourage you to follow along. At some point this month YAMLScript modules will become available for CPAN and Raku and many other languages. I also encourage you to try writing an [Advent of Code 2023]( https://adventofcode.com/) solution in YAMLScript, if you are playing along with AoC this year.

All the Best, Ingy döt Net

This week in PSC (134) | 2024-02-01

All three of us returned.

We only had one issue to discuss, the pressing matter of how to handle lexical unimports, builtin version bundles, the integration with use VERSION, and various related topics.

It’s complicated. We’ve been putting together a longer mail on the subject and that will come out as its own thread soon.

Dancer2 1.1.0 Released

Hey everyone,

Happy Holidays! Dancer2 1.1.0 has been released and is on its way to CPAN. It has one really awesome new feature: named routes.

With this update, you can name each route in your Dancer2 application, then refer to that route by name with a new keyword, uri_for_route. You have a lot of control over how this route is constructed, and can use it anywhere you were previously using uri_for. This helps you to avoid the need for lengthy URL references in your code, and makes it easier for you to build applications that are easier to grow, maintain, and later refactor.

You can read more about it in the Dancer2 manual, or check out the pull request that introduced the change. As a bonus, the Twelve Days of Dancer (our mini-advent calendar) launches this week, and Sawyer has written a great article that covers this new feature and keyword in-depth.

Happy Dancing! Jason/CromeDome

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.