I plan to release SPVM 1.0 at the end of July.
I plan to release SPVM 1.0 at the end of July.
If you have any feedback on the bugs or features, please contact Github Issue or kimoto.yuki@gmail.com
Perl Weekly Challenge 111: Search Matrix and Ordered Letters
These are some answers to the Week 111 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a few days (May 9, 2021). 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: Search Matrix
You are given 5x5 matrix filled with integers such that each row is sorted from left to right and the first integer of each row is greater than the last integer of the previous row.
Write a script to find a given integer in the matrix using an efficient search algorithm.
Example:
Cannot change password
Wouldn't it be nice to be able to change my (hacked) password for blogs.perl.org?
Unfortunately, the password change form complains that it couldn't verify my current password, which doesn't come as a surprise as there is no field on the form to enter it.
Handling Perl character codes is very easy even for beginners.
I feel that Perl users are losing confidence because of negative feedback from other communities.
The opinions of people who intend to harm Perl are 99% useless in my experience.
Handling character codes is actually simple.
Because all you have to do is remember the following three things.
1. use utf8 and save file as UTF-8
2. if you print text, encode text to platform charset(Linux is UTF-8, Windows is cp932)
3. if you get text from outside, decode text from platform charset(Linux is UTF-8, Windows is cp932)
If "use v7;" enabled "use utf8", it would be less memorable and less mistake.
Beginners will first remember that Perl source code is stored in UTF-8.
Next, the introductory person will notice that using a print statement results in a "Malformed ..." warning.
And, to get rid of the warning, he will have to encode with the platform character code.
Once he have learned that, he will naturally learn that he need to decode when he bring in text from the platform.
Contacting author of Net::Azure::StorageClient
I am trying to contact Junnama Noda author of Net::Azure::StorageClient
I have sent two emails now to the public email address listed in his public github profile and have received no bounce or response.
If anyone is in contact with him, please have him contact me
Dean
CY's Post on PWC#064 - my shortcomings
Task 1:
A runner has to run from the upper-left corner to the lower-right corner in a race. The stadium of this race is rectangular, and each square meter area has different level of difficulty (caused by sand, cement, grass, slope...). Our runner has to choose a path with the least difficulty to complete the race.
My description makes it look like something from a competitive programming problem. Maybe someone will discover sometimes I made sentimental names in the codes. (I was a long-distance runner in high school and university, by the way.)
The heart of my solution for this task is:
Perl Weekly Challenge 64: Minimum Sum Path and Word Break
These are some answers to the Week 64 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a few hours . 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: Minimum Sum Path
Given an m × n matrix with non-negative integers, write a script to find a path from top left to bottom right which minimizes the sum of all numbers along its path. You can only move either down or right at any point in time.
Example
Input:
[ 1 2 3 ]
[ 4 5 6 ]
[ 7 8 9 ]
The minimum sum path looks like this:
+1 "use v7;" in Perl 7
As one of Perl user, +1 "use v7;" in newer version of Perl.
The use v syntax is worth it.
use v5.14
This syntax is the history of Perl and is also a mechanism for maintaining backward compatibility with newer versions of Perl.
The reason this was not used is simply the small granularity.
I don't remember much about Perl, so I can't tell the difference between use v5.20 and use v5.30.
And because the warnings and utf8 aren't turn on, I couldn't find a meaning to actively use it.
use v7; is very easy to understand.
use v7;
Imagine an application user actively uses it instead of writing use strict, use warnings, use utf8;, use feature'say', ....
I also think that I use it aggressively in application code.
graphql-perl - plugin to make GraphQL "just work" with Mojo publish/subscribe functionality
GraphQL is the new, shiny way to do APIs. It minimises number of round-trips for clients to query what need. But what about real-time updates? How can we cut down the time needed for clients to get new information? Are we forcing them to constantly poll? That seems expensive and also slow.
GraphQL's official standard now includes "subscriptions". The obvious transport for that is WebSockets, and the de facto standard for that is Apollo GraphQL's subscriptions-transport-ws
.
As of 0.16, Mojolicious::Plugin::GraphQL supports WebSockets, and GraphQL subscriptions, conforming to the Apollo protocol.
A well-known model for distributing information in an event-driven way is "publish/subscribe" (or "pub/sub"). To both demonstrate the subscription capability, and to provide useful functionality, there is now a new "convert plugin" for GraphQL with the two Mojo modules that implement pub/sub (with Redis and PostgreSQL): GraphQL::Plugin::Convert::MojoPubSub.
CY's Recent Submission for PWC(061-063)
Miss out blogging for a while. Here just write some lines on the recent PWC coding experience.
Challenge 061
ch-1 :
Enumeration
ch-2 :
Before coding, I had thought it was a complicated task for regular expression. It turned out smoother.
I use a subroutine possible_octet to check whether a number can be a part of IPv4 octet.
Its content:
my $item = $_[0];
if ($item =~ /^[0-9]$/ or $item =~ /^[1-9][0-9]$/ ) {
return 1; }
elsif ($item =~ /^[1-9][0-9][0-9]$/) {
return ( $item <= 255) ;
}
else {
return 0;
}
}
Perl Weekly Challenge 63: Last Word and Rotate String
These are some answers to the Week 63 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a couple of days (June 7, 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: Last Word Matching a Regex
Define sub last_word($string, $regexp)
that returns the last word matching $regexp
found in the given string, or undef if the string does not contain a word matching $regexp
.
For this challenge, a “word” is defined as any character sequence consisting of non-whitespace characters (\S
) only. That means punctuation and other symbols are part of the word.
The $regexp
is a regular expression. Take care that the regexp can only match individual words! See the Examples for one way this can break if you are not careful.
Examples:
Stack Overflow Developer Survey 2020
There's a lot in it and we could question some of the methodology, but here's some thoughts.
Perl developers are older (and there aren't that many of them) but salaries are excellent.
I would note that TIOBE didn't match up too closely with common usage but there's no silver lining.
Ruby is now in consistent decline, I have read people linking this to Twitter moving away from Ruby on Rails but can't cite that claim. My observation is that RoR seems to have gone out of fashion in favor of lightweight server frameworks and I would suggest that Kubernetes has sidelined Puppet, so organizations aren't bringing in Ruby via apps/frameworks they want to use.
New Arel like SQL Manager
Some months ago I started working in a system similar to ActiveRecord. But then it became pretty big so then I centered my attention in a SQL AST manager instead.
So I made a library that is basically an Arel port. You can see the README with most of the basic info. After looking at implementations in CPAN I realized there are many of them already but all of them based on hash structures.
This impl can instead represent a full SQL AST mainly using builder chainable methods.
I need some feedback on wether you think it will be something that is useful.
Thanks in advance.
Repo link: https://bitbucket.org/juankpro/perl-sql/src/master/
PD: Here is another question. If you try to download and use the lib right now it will not work because it depends on another library made by me as well: https://bitbucket.org/juankpro/model-support/admin
This library is a group of packages with somewhat unrelated utility functions that allows me to support my own perl OOP engine implementation shared through other libraries I'm working on. I don't know what's the best approach to handle this. Is it ok to upload this library separately? if I need to reuse this code again, how do I prevent collisions if my other libs will use it as well?
Perl Weekly Challenge 110: Valid Phone Numbers and Transposed File
These are some answers to the Week 110 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a couple of days (May 2, 2021). 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: Valid Phone Numbers
You are given a text file.
Write a script to display all valid phone numbers in the given text file.
Acceptable Phone Number Formats:
+nn nnnnnnnnnn
(nn) nnnnnnnnnn
nnnn nnnnnnnnnn
Input File:
Prima: release v1.59 adds major text rendering functionality
Previously it was only possible to output text with strings using
text_out()
method. Now, a more versatile and modern way is added withtext_shape()
method that converts text string in a series of glyphs, that allows the following:- Full unicode bidi processing
- Support for font ligatures
- Native support for right-to-left text
- Transparent font substituion where a single font does not contain necessary glyphs
In addition to that, infrastructure was added to support RTL and shaping in all standard Prima widgets. Run
podview Prima::Drawable::Glyphs
and check out the examples in the end of the document.PostScript backend rewritten to generate embedded Type1 fonts. This allows to generate unicode text in PostScript documents.
In X11 backend, standard key combination (Ctrl+Shift+U) accepts unicode hex number as a character input. Try typing "a" then Ctrl+Shift+U 300 ENTER.
Prima::*Dialog packages are moved to Prima::Dialog::* namespace
Dancer2 0.300004 Released
The Dancer Core Team would like to announce the availability of Dancer2 0.300004. This release brings several important fixes and enhancements:
Session cookies can be restricted to a first-party or same-site context
There were a number of spots where Dancer2 would return a 500 error upon receiving an invalid request, rather than (correctly) returning 400 - Bad Request. Many, if not all, of these have been fixed.
For more information about same-site context, please refer to [RFC-6265bis]( https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site).
To use this, add the cookie_same_site
key to your session engine configuration
in the appropriate YAML file. Valid settings include Strict
, Lax
, and None
.
The complete changelog is as follows: 0.300004 2020-05-26 20:52:34-04:00 America/New_York
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.