The mysterious case of the SVt_PVIV

The other day I wanted to send my friend some silly emojis on LINE and so I updated my flaky old Unicode browser to the new-fangled Unicode with values above 0x10000, so that I could fetch the Emojis, which start around here. The thing also features a perl script which fetches values from Unicode::UCD using the charinfo function. I also updated to Perl 5.32 around the same time. Now the funny thing was that I started getting all kinds of errors about invalid JSON in the browser console. My Perl script was sending something of the form {... "script":Common ...} from my module JSON::Create, which is not valid JSON due to not having quotes around Common, and obviously my module was faulty.

CY's Take on PWC#087

If you want to challenge yourself on programming, especially on Perl and/or Raku, go to https://perlweeklychallenge.org, code the latest challenges, submit codes on-time (by GitHub or email).

After the long-haul Sudoku Task, this week we come to meet two tiny tasks.

Task 1 Longest Consecutive Sequence

It seems unavoidable for me that we have to sort the input first:

sub long_consec{
    my @list = sort {$a<=>$b@_;
    #...

Then I use a for loop and a temporary list variable @potential_max_opp

    my $max_len = 1;
    my @max_opp;

    my @potential_max_opp = ($list[0]);
    for (1..$#list) { 
        if ($list[$_-1] == $list[$_]-1) {
            push @potential_max_opp$list[$_];
        } else
        {
            if (scalar @potential_max_opp > $max_len) {
                $max_len = scalar @potential_max_opp;
                @max_opp = @potential_max_opp;
            }
            @potential_max_opp = ($list[$_]);
        }
    }

    return \@max_opp;
}

Pretty straight-forward.

Some ideas: There should be some more efficient algorithms, maybe similar to counting sort , if the range of integers is given and the integers are "dense" enough.
---

Where is Rob?

Does anybody know Rob Seegel (aka RCS), the author/maintainer of Tk::MListbox?

I tried to contact the author by e-mail but didn't get any feedback so far.
I would like to adopt the module Tk::MListbox (and the other packages).

Perl Weekly Challenge 87: Longest Consecutive Sequences and Largest Rectangle

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

Spoiler Alert: This weekly challenge deadline is due in a few days (November 22, 2020). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

Task 1: Longest Consecutive Sequences

You are given an unsorted array of integers @N.

Write a script to find the longest consecutive sequence. Print 0 if none sequence found.

Example 1:

Input: @N = (100, 4, 50, 3, 2)
Output: (2, 3, 4)

Example 2:

Input: @N = (20, 30, 10, 40, 50)
Output: 0

Example 3:

Input: @N = (20, 19, 9, 11, 10)
Output: (9, 10, 11)

JSON::Create now features indentation

In version 0.27 of JSON::Create I added a new indentation feature. This was added basically out of necessity. Originally the purpose of the module was sending short bits of JSON over the internet, but I've been using JSON more and more for processing data too. I've spent quite a long time working on a web site for recognition of Chinese, and I've been using JSON more and more extensively. The basic data file for the web site is a 168 megabyte JSON file. Not indenting this kind of file makes for "interesting" problems if one accidentally opens it in an editor or on a terminal screen, a million characters all on one line tends to confuse the best-written text reading utilities. So after years of suffering the relief is tremendous, and now I have tab-based indentation in JSON::Create.

Originally I thought that I should make all kinds of customisable indentation possible, but then it occurred to me that basically any fool armed with a regular expression could easily alter the indentation however they want to. I put a simple example in the documentation.

REST::Neo4p catches up to Neo4j V4.0+

For a long time (since 2012), REST::Neo4p has provided a way for Perlers to play, and even work, with the graph database Neo4j.

Neo4j has made many changes and improvements in its server and its query language in that time. However, as it has become successful commercially, it has made breaking API changes of one kind or another more and more regularly. In the last major release, version 4.0, Neo4j retired the REST endpoint on which REST::Neo4p was based. This endpoint was "entity-based", as it were, allowing direct access to nodes, relationships, and the like via entity IDs. It was well suited to the object (HAR HAR) of REST::Neo4p. But Neo4j decided to focus exclusively on its declarative query language Cypher, and to move away from the "graph walking" paradigm that the REST endpoint represented.

Permutations and Recursion

(Originally published on samirparikh.com.)

I founded a company called Perl Research Institute, Ltd.

I founded a company called Perl Research Institute, Ltd in Japan.

The main purpose of the Perl Research Institute is to restore Perl's honor.

Its reputation was miserable compared to the excellence of Perl's features.

Perl and its users have suffered in many negative campaigns.

Perl was seen by the people who say We are loved in the whole world as an abandoned stone.

I'm not afraid to talk about Perl Even if I'm surrounded by mighty powers who Do a lot of cheating.

Perl Research Institute

Perl Weekly Challenge 86: Pair Differences and Sudoku Puzzles

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

Spoiler Alert: This weekly challenge deadline is due in a day or so (November 15, 2020). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

Task 1: Pair Differences

You are given an array of integers @N and an integer $A.

Write a script to find find if there exists a pair of elements in the array whose difference is $A.

Print 1 if exists otherwise 0.

Example 1:

Input: @N = (10, 8, 12, 15, 5) and $A = 7
Output: 1 as 15 - 8 = 7

Example 2:

Input: @N = (1, 5, 2, 9, 7) and $A = 6
Output: 1 as 7 - 1 = 6

Example 3:

CY's Take on PWC#086

pascal_userinterface.jpg# (I will write more some hours later. This may not be a good practice. But) #HKT November 15, 2020 3:32 PM

I am excited by the Sudoku task and eager to share.

If you want to challenge yourself on programming, especially on Perl and/or Raku, go to https://perlweeklychallenge.org, code the latest challenge - Challenge 086, submit codes on-time (by GitHub or email).



Perl Podcasts

(Originally published on samirparikh.com.)

Like any well-entrenched programming language, Perl has a rich history and a number of personalities who shape and lead its community. In addition to wanting to learn its syntax and how to write simple scripts with it, I'm also trying to learn more about that history and the people who influence it today. I do this by following some blogs (which perhaps I'll write about later) and reading online books and articles but the best way for me is to listen to relevant podcasts. I'm an avid podcast listener and love learning about new concepts or technologies while walking the dog, doing the dishes, or pre-pandemic, sitting in traffic. Over the past few weeks, I've been listening to some contemporary as well as not so recent Perl-related podcasts and thought I'd share some select episodes that others may find interesting:

Is it possible to return to development with traditional P5P mailing lists?

Is it possible to return to development with traditional P5P mailing lists?

I still think the traditional method is suitable for advancing Perl development.

why?

We're used to it, and Perl development has been done that way.

We tend to think of it as a poor method, but it's actually a good one.

The first is that it will be developed with backward compatibility in mind.

The second is that we will not proceed unless there is a lot of consensus on the important points.

Some people say that Perl development can't proceed because of opposition.

I think there is no need to proceed with development with a lot of opposition.

I think it's important to find a way that as many people as possible can agree.

The culture of being able to decide everything because we have a majority is not good.

Make everything public and discuss about important decisions.

Small decisions are made by good P5P leaders.

On the other hand, big decisions will be disclosed and discussed to all users.

If the opposite happens, it's a normal reaction.

Is it possible to adjust features and modifications to the point where an agreement can be reached?

Is it possible to return to development with traditional P5P mailing lists?

Thank You, Coveralls.io

For letting me know my test coverage has increased by 0.00006%.

Coveralls.io screenshot

(Seriously it's a pretty cool service though.)

#Perl on Dev.TO

Dave Cross already suggested to use other forums for Perl-related posts, especially pointing to dev.to where our posts can be more visible to the outside world than here on bpo.

I followed his advice and started to post there too. I even volunteered to become a moderator of the #perl tag on dev.to.

So I'd like to invite you to follow that tag and to post articles there using the #perl tag and other tags that might be relevant to your posts.

News regarding GraphViz2

Ed J has taken over maintenance of my suite of GraphViz2 modules.

The first change has been to split it into multiple distros, so that anyone using just GraphViz2 will have a much smaller download and only 6 pre-reqs.

Another change is to rework the decision, which I copied from the original www.graphviz.org, and which meant nodes and port names were joined with a colon. For e.g. MS Windows users wanting to represent disk names like C:, this is clearly problematic.

There is a new option combine_node_and_port, which defaults to true but in May 2021 or so will switch to defaulting to false. When true, the current problematic behaviour occurs. When false, more DWIM-ish behaviour happens:

Monthly Report - October

Men Don't Cry.

I must confess I do cry and cry like a baby. It feels nice afterwards, I must say.

Last month was really difficult for me, on personal and professional front. On personal level, I am undergoing therapy for Depression and Anxiety.

On professional front, I missed many things. For the first time, I couldn't take part in Hacktoberfest in the same passion as before.

Another low point, I stopped contributing in Swift for The Weekly Challenge.

Then I stopped taking part in the weekly challenge completely. No weekly blog either talking about my contributions.

I didn't stop there, I even stopped doing live session video.

At one point, I even decided not to do monthly report.

With all the negativity, I received plenty of support and helping hands. Thanks everyone.

Let's take a quick look through last month main activities.


Pull Request

Finding Squares in Matrices

I don't usually take part in the Perl Weekly Challenge but one of this week's challenges caught my eye. I thought it could be a fun thing to attempt and decided to use Zydeco to help solve it.

The problem is that you're given a matrix of 0s and 1s:

You need to find any squares (equal length sides) where all four corners are 1s:

Amusewiki 2.500

Well, well, today I released Amusewiki 2.500 and I noticed that time has passed since the last announcement here. This doesn't mean that the Amusewiki development has stopped. On the contrary. The development pace has been steady, with new features, improvements and bug-fixes. In the meanwhile Amusewiki got a new logo as well!

The most notable changes are:

  • Installation size has been cut down to the minimum with a TeXlive! repackaging (which can be installed on the fly by the installation script or via the unofficial Debian packages).

  • Support for attached files has been extended. You can now upload and display audio and video files.

  • Custom category types: you are no longer limited to authors and topics, you can have custom categories.

As usual, documentation for old and new features can be found at amusewiki.org, unofficial Debian package are at packages.amusewiki.org and sources are at https://github.com/melmothx/amusewiki.

Detailed changelogs can be found here: https://amusewiki.org/category/topic/releases.

It's worth noting that the Emacs Muse markup is supported by Pandoc (as a reader and a writer) since version 2.0, and if you use the Atom editor, there is a package for it.

Enjoy!

Why you should use ppport.h in your XS code modules


The answer comes down to two words: Security and Reliability.
As a bonus, less work on your part.

It's surprising to find that there are modules on CPAN that aren't using
ppport.h that could stand to benefit from it.

ppport.h is a file that is part of the Devel::PPPort distribution. As you
know, Perl has evolved over the years, adding new features, and new API for XS
writers to use. Some of that is to support the new features, and some to make
tasks easier to accomplish. ppport.h implements portions of the API that
people have found desirable to have when a module gets installed in a Perl that
was released before that API element was created. You can write your module
using the latest API, and have it automatically work on old Perls, simply by
#including ppport.h in your XS code. ppport.h generally provides support for
an API element as is reasonably practicable, with many supported to 5.03007.

System Setup for Modern Perl Projects

From 2015, but it came across my screen this morning. Seems like it is still relevant.

System setup for modern perl projects

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.