My PerlCon 2019 report

https://domm.plix.at/perl/2019_08_perlcon_riga.html

Perl Weekly Challenge # 20: Split String on Character Change and Amicable Numbers

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

Spoiler Alert: This weekly challenge deadline is due in several days from now (August 11, 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: Split String on Character Change (P5 and P6)

Write a script to accept a string from command line and split it on change of character. For example, if the string is "ABBCDEEF", then it should split like "A", "BB", "C", "D", "EE", "F".

For this, it seemed fairly obvious to me that a simple regex in a one-liner should do the trick. Well, it turned out to be slightly more complicated that I anticipated in Perl 5. For example, running this very simple Perl 5 one-liner:

$ perl -E 'say join " ", "ABBCDEEF" =~ /((.)\2*)/g;'
A A BB B C C D D EE E F F

Driving in Perl

Redhat just posted a podcast entitled "Diving for Perl" and also (strangely) "Driving in Perl" on some pages.

Blurb is as follows:

Languages come and go. A few have the right stuff to rise to the top--and fewer stay there. Perl had a spectacular rise, a quiet slump, and has now found its place in the world of programming.

Perl seemed destined to rule the web. Michael Stevenson and Mike Bursell describe how Perl's design made it ideal for the early web. We hear from Conor Myhrvold about its motto: "There is more than one way to do it." Elizabeth Mattijsen shares how--despite Perl's strengths--a long development cycle slowed Perl's growth. And although it's not the top web language anymore, John Siracusa points out that Perl lives on as a niche tool.

Check it out here

Greed is good, balance is better, beauty is best.

Avidis, avidus natura parum est

One of my first forays into Perl programming, 20 years ago now, was a tool that takes a piece of plaintext, analyzes its structure, and formats it neatly for a given line width. It’s a moderately sophisticated line wrapping application that I use daily to tidy up email correspondence, software documentation, and blog entries.

So the second task of the 19th Weekly Challenge—to implement a “greedy”
line-wrapping algorithm—is in many ways an old friend to me.

Greedy line wrapping simply takes each word in the input text and adds it to the
current line of output unless doing so would cause the output line to exceed the required maximal line width, in which case it breaks the line at that point and continues filling the second line, et cetera. So a 45-column greedily wrapped paragraph looks like this:

announcing Data::Table::Dynamic

Looks like I like tables. But unlike Math::Matrix this will be about organizing any data.

Dancer2 0.208001 Released

The Dancer Core Team just released a minor update, which is on its way to your favorite CPAN mirror now. The fixes include:

  • GH #1515: Add Types::Standard to cpanfile (Russell @veryrusty Jenkins)
  • GH #1513: Fix Dancer2::Test typo (Utkarsh Gupta)

Keep on Dancing!

Giblog 1.0 Released Git Managed Websites and Blog Generator

Giblog 1.0 released. Giblog is a tool for generating a Web site and blog generation tool that can be managed by Git produced by Perl seminar.

Giblog 1.0 Released

Website created by Giblog

You can easily create a static website that can be managed by Git.


Git manage all pages

Advanced SEO measures

Responsive

Inquiry form

Fast rebuild

Advanced security

Easy search and replace of articles

Windows Mac Linux compatible

Customize freely with Perl

Rebuilt 645 pages in 0.78 seconds. You can manage all of the pages as static files, so you can freely edit and replace using Perl.

Since everything is a static page, the strongest security that does not create vulnerabilities such as page rewriting.

Windows, Mac, Linux compatible.

Function requests such as adding a Twitter card can be realized using Perl.

Upload to Github Pages and your page will be ready.

We also support inquiry form if you can use CGI.

By default, it provides advanced SEO measures that have been proven in Perl seminar.

Smartphone compatible by default. Modern website design is also available with CSS modifications.

Of course Giblog official site is produced by Giblog!

Try Giblog

Perl Weekly Challenge 019: Five Weekends and Paragraph Wrapping

This week’s challenge was a bit easier than the recent ones, but I was glad for that. The Perl Conference in Riga is coming and I still don’t have my slides ready!

Five Weekends

Write a script to display months from the year 1900 to 2019 where you find 5 weekends, i.e. 5 Fridays, 5 Saturdays, and 5 Sundays.

I started by running the cal utility (part of the util-linux package) to see how such months might look. For example, this is the output of cal 1904 (5 weekends highlighted manually be me):

Monthly Report - July

Chopping substrings

The first task of the 18th Weekly Challenge was to find the longest common substring(s) in a set of strings. That is, given a set of strings like “ABABC”, “BABCA” and “ABCBA”, print out “ABC”.

The “best practice” solution is a technique known as suffix trees, which requires some moderately complex coding. However, we can get very reasonable performance for strings up to hundreds of thousands of characters long using a much simpler approach.

Let’s start with a very concise, but suboptimal, solution. If we has a list of all the possible substrings for each string:

ABABC: ABABC, ABAB, BABC, ABA, BAB, ABC, AB, BA, BC, A, B, C
BABCA: BABCA, BABC, ABCA, BAB, ABC, BCA, BA, AB, BC, CA, B, A, C
ABCBA: ABCBA, ABCB, BCBA, ABC, BCB, CBA, AB, BC, CB, BA, A, B, C

...then we could treat each list as a set, take the intersection of those sets:

ABC, AB, BA, BC, A, B, C

...then simply find the longest element: ABC

Perl Weekly Challenge # 19: Weekends and Wrapping Lines

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

Spoiler Alert: This weekly challenge deadline is due in several days from now (August 4, 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: Five Weekends in a Month

Write a script to display months from the year 1900 to 2019 where you find 5 weekends i.e. 5 Friday, 5 Saturday and 5 Sunday.

This time, I'll start with Perl 6, because the built-in Date type seems to make it easier.

Five Weekends in Perl 6

Perl Weekly Challenge 018/2: Priority Queue

Write a script to implement Priority Queue. It is like regular queue except each element has a priority associated with it. In a priority queue, an element with high priority is served before an element with low priority. Please check this wiki page for more information. It should serve the following operations:
  1. is_empty: check whether the queue has no elements.
  2. insert_with_priority: add an element to the queue with an associated priority.
  3. pull_highest_priority_element: remove the element from the queue that has the highest priority, and return it. If two elements have the same priority, then return element added first.

The Naive Implementation

If the priorities are non-negative integers and bounded by a reasonable maximum, the following implementation might be all you need. Let’s implement the queue as an array of arrays, each array element at position $p represents all the queue elements with priority $p.

next Math::Matrix releases

As you can see in the Changefile, there is a lot stuff coming in the next release of Math::Matrix, the de facto standard for now for Perl 6 Matrix Math, as mentioned in the docs. However, I have further plans I want to announce here and also ask my readers if I should do the proposed change of name space or not. This should be maybe a lightning talk in at TPC in Riga, but I already have a regular and a lightning there, so I choose this format.

London Perl Workshop - 2019

With great pleasure, we would like announce the London Perl Workshop 2019. After 12 years, we're moving on from Westminster University to David Game College, 31 Jewry St, London EC3N 2ET. Thanks to Westminster University for hosting us for so long. We are holding the workshop a little earlier than normal because we wanted to avoid clashing with various other things and not be too close to Xmas We would like to invite you to join us for one day technical conference on Saturday 19th October 2019.

You could register if you don't already have an account otherwise login and register.

We are also accepting talk proposal now. If you would like to be a speaker at London Perl Workshop 2019 then please submit your proposal as soon as possible.

You are free to pick your favourite technology to talk about whether it is Perl 5, Perl 6 or any other languages/technologies.

Last but not the least, we are looking for sponsors. For more information, please visit the page.

We hope to see you there,

Tom, Lee, Katherine, Julien and Mohammad (the organising team)

It's time to consider avoiding IP fragmentation in the DNS

An article on APNIC was posted earlier this month with the above title. It demonstrates the impacts of IP fragmentation in DNS by demonstrating two successful attacked using it. It is notable to us on this blog because all the examples are in Perl, in addition to everyone hopefully being concerned with running or using reliable and secure DNS.

Check it out at: https://blog.apnic.net/2019/07/12/its-time-to-consider-avoiding-ip-fragmentation-in-the-dns/

Perl Weekly Challenge 018/1: Longest Common Substring

Write a script that takes 2 or more strings as command line parameters and prints the longest common substring.

A naive solution

For a naive solution, we first need to make an observation: although the longest common substring (lcs) must be a substring of all the strings, we don’t have to process all pairs of strings to find it. We can just take all the substrings of one of the strings (using the shortest one would be fastest) and try to find each substring in all other strings. If the substring is present in all the strings and is longer than the lcs found so far, we have a new lcs candidate. I decided to keep all the lcs’s of the same length.

Perl Weekly Challenge # 18: Priority Queues and Binary Heaps In Perl 6

In this previous blog post, I provided some answers to the Week 18 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

However, I omitted the Perl 6 solution to the priority queues part of the challenge, because I wanted to use a binary heap to solve it, and this required too many explanations: the blog post was just getting too long. So this post will complete the previous post and look into binary heaps in Perl 6.

Spoiler Alert: This weekly challenge deadline is due in several days from now (July 28, 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.

This part of the challenge goes like this:

Six slices of pie

The first task of the 15th Weekly Challenge was to find the optimal position in the line for dessert.

This is a reformulation of the old conundrum of creating buggy whips or cowboy movies or physical book stores or carbon-based energy sources: when is the best time to opt in for an ever-increasing slice of an ever-diminishing pie?

In this task, the pie is big enough for 100 people, but the first person in line gets a slice equivalent to only 1% of it. The second person gets 2% of what’s left, the third gets 3% of what remains after that, et cetera, et cetera, until the one-hundredth person receives 100% of whatever crumbs are left after the preceding ninety-nine have taken their share. In other words, we’re “Making Apple-pie Great Again!”

Windows and Perl

Doing development work on Windows is becoming easier and better all the time. However, it's still somewhat cumbersome to do development work ON Windows, FOR Windows.

Strawberry
Luckily for us Perl developers, the team making Strawberry Perl have done an excellent job for quite some time. Their efforts make installing and using Perl on our Windows environments (PowerShell or cmd.exe) dead simple.

BerryBrew
That being said, something we find ourselves doing more and more frequently when doing development work on Linux is switching between versions of Perl quickly and easily. This has been available to us with BerryBrew for some time.

What Have I Done?! (PSPerl)
What I've started work on recently is a PowerShell version of a Perl environment switcher, called PSPerl. On linux we have perlbrew and plenv, why not have another option on Windows?

Given that it's written entirely in PowerShell v5+, it should be easy to update, maintain, and add new features - or even implement your own features. Give it a try. Find problems. Help me fix them.

The Perl Community - a mixed bag of sometimes intollerance and sometimes fantastic help

I've had occassions to post a post like this a number of times in the past over a lot of years but I've resisted until now. I have little experience of other programming languages in forums/IRC/blogs etc recently because these days I've largely written Perl and PL/SQL but in the past before the WWW was prevelant I programmed in Fortran, Pascal, C, Macro 32, VMS, Z80, 8086, 6502 etc before I volunteered to port a large code base from VMS to UNIX.

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.