Day One at SWP 2019 Olten

Day one here at the SPW coming home again the Florian in Olten CH.
We started the day with Liz Mattijen debunking myths found on the inter-web about Perl 6, Raku, Cammila ah what-ever they are calling it these days.

Liz was very passionate about Perl6 and it was a little sad to hear her story the state of Perl 5 and Perl 6 but we can always hope.

I was up next and was a little flustered to go up next to one of the legends but I think my talk on the history of routes and my personal style of writing route when ok, at least the crowd laughed at the parts I though where funny.

The PerlCon 2019 Riga - Report

Last week, I attended my second European Perl Conference in Riga (PerlCon). I was very lucky this time, I went alone for the Conference and arrived at the hotel a day before i.e. 6th August 2019.

At the airport, I met Mark Keating and his team waiting for their taxi to take recording kits. I booked my taxi and went to the hotel by myself. By the time, I reached hotel, it was 12 'o clock but the check-in time was 3 pm. I had to kill few hours before I could check-in. I saw Barbie and his team in the Lounge relaxing. I feel so confident now that I went straight to him to say "Hello". He suggested place across the bridge for quick tour. I handed in my trolley bag and went on a short tour.

Solving two problems

A Regular Question

This weeks perl weekly challenge had a pretty straightforward question: take a string and split it when the characters change. That's a fairly straightforward regex issue:

perl -pE's/(.) \g1*/$& /gx'

Here we match any character (.) once. We capture this in a group. Then, we use backreferencing to match as many more copies of that group as we can. We use the s operator to then replace what we found with itself ($& is the entire match that was found) followed by a space.

Conveniently, the challenge didn't specify what 'splitting' entails, so this is technically all we need to do. However, it gives us an extra empty space at the end of the match. In order to get rid of that (the proverbial second problem introduced by regexes), we have two approaches.

The RegEx Rabbit Hole

We could tell the regex not to match if it gets to the end of the string. We would do that with a zero width negative lookahead:

Perl Weekly Challenge 020: Split on change + amicable numbers

I spent this week in Rīga at the Perl Conference. I had two talks there, a standard 20-minutes one and a lightning talk (5 minutes). I dedicated all my free time to the preparation of the slides, but fortunately the assignments were rather easy this week, so I submitted the solutions on Monday already before leaving for Rīga.

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.

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.