Perl Weekly Challenge 26: Common Letters and Mean Angles

These are some answers to the Week 25 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in several days from now (September 22, 2019). This blog post offers some solutions to this challenge. Please don't read on if you intend to complete the challenge on your own, which you're strongly encouraged to do.

Challenge # 1: Common Letters Count

Create a script that accepts two strings, let us call it, “stones” and “jewels”. It should print the count of “alphabet” from the string “stones” found in the string “jewels”. For example, if your stones is “chancellor” and “jewels” is “chocolate”, then the script should print “8”. To keep it simple, only A-Z,a-z characters are acceptable. Also make the comparison case sensitive.

We're given two strings and need to find out how many characters of the second string can be found in the first string.

Common Letters Count in Perl 5

Perl Weekly Challenge 025: Pokemon Sequence and Chaocipher

The longest sequence

Generate a longest sequence of the following “English Pokemon” names where each name starts with the last letter of previous name.

I’m not sure whether the term “sequence” has a unique and generally accepted definition. For example, does it have to contain each element just once? If not, the longest sequence might be

girafarig girafarig girafarig girafarig girafarig girafarig girafarig girafarig...

If we want each element to appear just once in the sequence, we are in the graph theory and we search for the longest simple path. For a general graph, this is an NP-hard problem, but fortunately, our input is small enough to be solved in reasonable time.

We can implement a brute-force search (i.e. trying all the possible sequences) recursively. The recursive steps takes the sequence constructed so far and tries to extend it by all the possible next steps, calling itself to extend each of them further.

Circular observations

Selfies demonstrate one of the principal laws of physics, psychosocial development of teenagers and programming. The act of observation alters that which is being observed. It becomes more complicated if the observer is observing itself. As the observer changes, so might future observations particularly if the tool being used is known to impact the parameter that is being measured; rapidly one loses hope that any meaningful data will be obtained from such a direction of development. Sounds gibberish? Look at the collection of "duckfaces" on your teenage daughter's phone (if she ever lets you near it) and I am sure you will find no resemblance of those images to anyone you would recognise as your offspring.

Let's do it any way

London Perl Workshop CFP Deadline: Mon 30 Sept

The London Perl Workshop 2019 is fast approaching on Saturday 19 October!

We've already had some great talks submitted and will start announcing these soon. If you'd like to tell people about what you have been doing with Perl 5, Perl 6 or any related topics please submit your proposal before the end of Monday 30 September.

If you have any questions then write to us at organisers@londonperlworkshop.org - we are happy to discuss ideas with you. See you at the Workshop!

Task::Kensho needs your help!

CPAN is wonderful and it is vast. Task::Kensho offers a curated look at the best it has to offer for those who don't know what to look for. But to remain useful, it must keep up with the trends of CPAN and the community. Thus, the community's input is vital to its maintenance.

Please, take a moment and look through the open issues. Comment or add a reaction in support of changes that make sense to you, and open a new issue if you think something is missing.

Perl Weekly Challenge W025 - Longest Pokemon Sequence, Chaocipher

New week new challenge!

And for this week we have two awesome tasks for this week's challenge, too awesome not to blog about it.

If you'd like to join the fun and contribute, please visit the site site managed by Mohammad S Anwar.

Task #1 - Longest Pokémon Sequence:
Generate a longest sequence of the following “English Pokemon” names where each name starts with the last letter of previous name.

audino bagon baltoy banette bidoof braviary bronzor carracosta charmeleon cresselia croagunk darmanitan deino emboar emolga exeggcute gabite girafarig gulpin haxorus heatmor heatran ivysaur jellicent jumpluff kangaskhan kricketune landorus ledyba loudred lumineon lunatone machamp magnezone mamoswine nosepass petilil pidgeotto pikachu pinsir poliwrath poochyena porygon2 porygonz registeel relicanth remoraid rufflet sableye scolipede scrafty seaking sealeo silcoon simisear snivy snorlax spoink starly tirtouga trapinch treecko tyrogue vigoroth vulpix wailord wartortle whismur wingull yamask

The above names borrowed from wiki page.

SPVM monthly report 2019/9/11

Do you hear SPVM until now?

If you don't hear SPVM, it is good chance.

SPVM is the project to improve Perl culcuration and array operation.

I recently do benchmark.

SPVM add(+) operator performance in for loop is same as C language!

It is faster than Perl 100x.

I'm creating SPVM document in Japanese.

You can see the following.

SPVM Document

I almost finish(90%) specifications.

SPVM Launguage Specification

SPVM Exchange API Specification - Link Perl world to SPVM world

SPVM Native API - Link SPVM World to C World

Perl Weekly Challenge 25: Pokémon Sequence and Chaocipher

These are some answers to the Week 25 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in several days from now (September 15, 2019). This blog post offers some solutions to this challenge, please don't read on if you intend to complete the challenge on your own.

Challenge # 1: Sequence of Pokémon Names

Generate a longest sequence of the following English Pokemon names where each name starts with the last letter of previous name.ù

audino bagon baltoy banette bidoof braviary bronzor carracosta charmeleon cresselia croagunk darmanitan deino emboar emolga exeggcute gabite girafarig gulpin haxorus heatmor heatran ivysaur jellicent jumpluff kangaskhan kricketune landorus ledyba loudred lumineon lunatone machamp magnezone mamoswine nosepass petilil pidgeotto pikachu pinsir poliwrath poochyena porygon2 porygonz registeel relicanth remoraid rufflet sableye scolipede scrafty seaking sealeo silcoon simisear snivy snorlax spoink starly tirtouga trapinch treecko tyrogue vigoroth vulpix wailord wartortle whismur wingull yamask

Simple CLIs using Do v1.70

Command-line Interfaces using Modern Perl

If you Perl or you're Perl-curious, or you build command-line interfaces, you should read this, but before we dive in building the command-line application, lets first talk about the command line.

Command-line programs have been with us since the early days of the computer and are programs based upon on commands (single or multiple). A command-line program is a program that operates from the command-line or shell.

A command-line interface is a user interface that is navigated by typing commands in a terminal, shell or console, as opposed to using a GUI (graphical user interface). The console is a display mode for which the entire monitor screen shows only text, no images or GUI objects.

According to Wikipedia:

Perl Weekly Challenge 024: Inverted Index and Shortest Oneliner

I’ll start with the second task, as the first one is somehow different (see below).

Inverted Index

Create a script to implement full text search functionality using Inverted Index.

An inverted index is an index storing a mapping from content to its location. I chose to store the filename and line number for all words in a given list of files.

Perl Newbies weekly report 2019/9/11

I started Perl Newbies recently.

Perl Newbies is for yung people who want to learn Perl.

Perl Newbies describes basic things of Perl, not complex things.

Perl Newbies weekly report

I add the following entries about Functions and module.

What is "use strict"?

You may think you see perl program at first.

I describe effects of strict module.

Time Flies, Memories leak...GUIDeFATE getting a timer

It appears that I have not had single blog post for 1 whole year. Let's face it, there isn't enough time in the day to everything one might want to do. Procrastination steals more than just time though. The longer one is away from a particular activity the more difficult it is to return to that activity physically or intellectually. Some of you will recall that I developed what I claimed to be the world's simplest GUI designer, GUIDeFATE. This was the topic of a couple of presentations already but as all such projects, remains in a state of flux.

Perl Weekly Challenge W024 - Smallest Script, Inverted Index

I've been doing the Perl Weekly Challenge (PWC) for 3 weeks now. So far there's been unique challenges that made me utilize different modules. I even submitted a solution using APIs which I haven't done in my work because I didn't have any reason to. (lol)

If you'd like to join the fun and contribute, please visit the site link managed by Mohammad S Anwar.

Task #1 - Smallest Script: The tasks for this week's challenge (#24) are a bit confusing at first but I just did what was asked. The first task was to create the smallest script as described below:
Create a smallest script in terms of size that on execution doesn’t throw any error. The script doesn’t have to do anything special. You could even come up with smallest one-liner.
There is no problem to solve, so in my entry I just put a $% :
perl -e '$%'

Signatures vs. Methods

I've still been thinking about proper OO in the Perl core and hit an interesting case.

Imagine the following, hypothetical Perl 5 OO syntax. Inheritance is handled via is and inheritance order is assumed to parent class declaration order. Thus, UnlovedChild inherits from MissingFather first.

What do you think the output should be?

class MissingFather {
    method shout() { say "I'm outta here!" }
}

class DrunkenMother {
    method shout($message) { say "$message!" }
}

class UnlovedChild is MissingFather, DrunkenMother {}

UnlovedChild->shout("Where's my beer?!")

berrybrew, the Perlbrew for Windows v1.26 released

I've finally found some time to get some wanted and needed changes implemented into berrybrew.

Some changes were for development and testing of the software itself, a couple of features were added due to community requests, and yet more were requested by a client.

Here's a summary of the new features:

Fastmail and Perl: an interview with Ricardo Signes

Ricardo (Rik) Signes is a member of the Perl community who has helped the programming language move forward as far as features, stability, and popularity. Previously, he was Perl’s Pumpking (manager of the core Perl 5 language), during which time he oversaw 5 major releases. Currently, he is a board member at the Perl Foundation and CTO at Fastmail, leading a development team working in Perl every day.

This blog post is brought to you by Fastmail, a gold sponsor for PTS. More information about Fastmail is provided at the end of this article.

Monthly Report - August

The main activity for me last month was "The Perl Conference in Riga". It was my second European Perl Conference and the most memorable one. You can read my full report, if you are interested. During the conference, I got to meet, Heart & Soul of any Perl event, Liz & Wendy. It is embarrassing that I still don't know who's Liz and who's Wendy. One day, I will sort that out once for all next time when I meet them. I hope they would attend the London Perl Workshop next month. I met Paul Johnson first time in person. I have interacted with him on Twitter before. I also met many CPAN contributors who received Pull Request from me in the past. Icing on the cake was a gift, a book titled "Learning to program with Perl6: First Steps" by JJ Merelo.

To compute a constant of calculus
(A treatise on multiple ways)

𝑒 is for economics

The first task of the 21st Perl weekly challenge was a very old one:
to find (what would eventually become known as) Euler’s number.

The story starts back in 1683 with Jacob Bernoulli, and his investigation of the mathematics of loan sharking. For example, suppose you offered a one-year loan of $1000 at 100% interest, payable annually. Obviously, at the end of the year the markclient has to pay you back the $1000, plus ($1000 × 100%) in interest...so you now have $2000. What can I say? It’s a sweet racket!

Is Perl 6 Being Renamed?

By now, many of you have seen the Perl 6 Github issue "Perl" in the name "Perl 6" is confusing and irritating. The issue suggested renaming Perl 6. While some may think that the name of the issue is trolling, or offensive, the actual issue was created by Elizabeth (Liz) Mattijsen, one of the core Perl 6 developers, a long-time Perl 5 developer, and with her spouse, Wendy, has long been an enthusiastic support of Perl 5/6. There is no trolling here. There is a lot of deep thought, careful discussion, and a genuine desire to find a way to bypass some deeply divisive issues in the Perl community.

While the proposed name was "camelia", Damian Conway made a strong argument in favor of "raku" and it appears the community is leaning towards this name for various reasons.

This post is my attempt to summarize what's going on for those who have missed it. Any errors are, of course, Damian's. (just kidding!)

Shorewall 5.2.3.4 Released

Shorewall 5.2.3.4 is now available for download. Shorewall is a gateway/firewall configuration tool for GNU/Linux, written in Perl.

Problems Corrected:

1) If multi-queue NFQUEUE (e.g., NFQUEUE(0:1) ) WAS used as a policy, an error such as the following was previously incorrectly raised.

ERROR: Invalid policy (NFQUEUE(0) /etc/shorewall/policy (line
15)

That has been corrected such that no error is raised.

2) If multi-queue NFQUEUE( e.g., NFQUEUE(0:1,bypass) ) was passed to a
macro, an error such as the following was previously incorrectly
raised:

ERROR: Invalid ACTION (PARAM:1c,bypass)))
/usr/share/shorewall/macro.BitTorrent (line 12)
from /etc/shorewall/rules (line 40)

Now, the NFQUEUE action is correctly substituted for PARAM in
the Macro body.

3) If shorewall[6].conf didn't set AUTOMAKE, the 'update' command
previously produced a new file with 'AUTOMAKE=Yes'. This resulted
in an unexpected change of behavior. Now, the new file contains
'AUTOMAKE=No', which preserves the pre-update behavior.

4) Shorewall-rules(5) incorrectly stated that the 'bypass' option to
NFQUEUE causes the rule to be silently bypassed if there is no
application attached to the queue. The actual behavior is that the
rule acts like ACCEPT in that case. Shorewall-rules(5) has been
corrected.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.