Drawing a blank with XS

I spent quite a lot of time trying to work out what this error message meant:

Error: Unterminated '#if/#ifdef/#ifndef' in Libpng.xs, line 1328

The first problem here is that line 1328 is the end of the file, so that wasn't a big help.

After spending a lot of time counting #if and #endif statements in the file over and over again, in the end I had the bright idea of looking at the actual XS output, and managed to find the problem. Apologies for quoting it in full here but I can't think of a good way to truncate it:

Perl Weekly Challenge 143: Calculator and Stealthy Numbers

These are some answers to the Week 143 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 December 19, 2021 at 24:00). 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: Calculator

You are given a string, $s, containing mathematical expression.

Write a script to print the result of the mathematical expression. To keep it simple, please only accept + - * ().

Example 1:

Input: $s = "10 + 20 - 5"
Output: 25

Example 2:

Input: $s = "(10 + 20 - 5) * 2"
Output: 50

Calculator in Raku

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.)

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.

Perl Weekly Challenge 142: Divisor Last Digit and Sleep Sort

These are some answers to the Week 142 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 December 12, 2021 at 24:00). 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: Divisor Last Digit

You are given positive integers, $m and $n.

Write a script to find total count of divisors of $m having last digit $n.

Example 1:

Input: $m = 24, $n = 2
Output: 2

The divisors of 24 are 1, 2, 3, 4, 6, 8 and 12.
There are only 2 divisors having last digit 2 are 2 and 12.

Example 2:

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

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:

Perl Weekly Challenge 141: Number Divisors and Like Numbers

These are some answers to the Week 141 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 December 5, 2021 at 24:00). 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: Number Divisors

Write a script to find lowest 10 positive integers having exactly 8 divisors.

Example:

24 is the first such number having exactly 8 divisors.
1, 2, 3, 4, 6, 8, 12 and 24.

This is quite straight forward. We can look at consecutive integers, count their factors, and stop when we reach ten integers having 8 divisors.

Number Divisors in Raku

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:

Perl Weekly Challenge 140: Multiplication Tables

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

Task 1: Add Binary

This task was covered in the following blog post: https://blogs.perl.org/users/laurent_r/2021/11/perl-weekly-challenge-140-add-binary.html.

Task 2: Multiplication Table

You are given 3 positive integers, $i, $j and $k.

Write a script to print the $kth element in the sorted multiplication table of $i and $j.

Example 1:

Perl Weekly Challenge 085

(Originally published on samirparikh.com.)

The latest installment of the Perl Weekly Challenge just dropped so I thought I would take a crack at it. Please note that the challenge is still currently open (as of date of publishing) in case you are participating.

Task #1

Task #1 asks the following:

You are given an array of real numbers greater than zero.

Write a script to find if there exists a triplet (a,b,c) such that 1 < a+b+c < 2. Print 1 if you succeed otherwise 0.

Example 1:

Input: @R = (1.2, 0.4, 0.1, 2.5)

Output: 1 as 1 < 1.2 + 0.4 + 0.1 < 2

Example 2:

Input: @R = (0.2, 1.5, 0.9, 1.1)

Output: 0

Example 3:

Input: @R = (0.5, 1.1, 0.3, 0.7)

Output: 1 as 1 < 0.5 + 1.1 + 0.3 < 2

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:

Perl Weekly Challenge 140: Add Binary

These are some answers to the Week 140 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 November 28, 2021 at 24:00). 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: Add Binary

You are given two decimal-coded binary numbers, $a and $b.

Write a script to simulate the addition of the given binary numbers.

The script should simulate something like $a + $b. (operator overloading)

Example 1:

Input: $a = 11; $b = 1;
Output: 100

Example 2:

Input: $a = 101; $b = 1;
Output: 110

Example 3:

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?

Perl Weekly Challenge 084

(Originally published on samirparikh.com. Apologies in advance for going into some of the minute details of my thought process but I thought this might help others who are learning the language like I am.)

As I mentioned in yesterday's post, I've been trying to learn the Perl programming language. You can read all the books and tutorials you want, but for me, the only way to really learn a language is to apply it to real world problems. Unfortunately for me, I currently don't have any real world problems (suitable to be solved by Perl) so I've been practicing by solving coding puzzles on the internet. In addition to making my way through the bioinformatics site Rosalind, I've also started working on the Perl Weekly Challenges. This week, I managed to muddle my way through the latest installment, Challenge 084. The deadline to submit solutions is fast approaching so if you haven't solved it yourself yet, you may want to come back to this post later.

Task 1

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.