Continuing on with the last article let's talk about old hardware with UEFI. It can be difficult (for me) to know how to get Linux OpenSuSE installed properly.
Perl has had experimental features ever since I started using it at about version 5.6. These were things that were considered useful, but about which there was doubt -- about their final form, whether a satisfactory implementation existed, or whatever.
Until Perl 5.18, experimental features were simply documented as experimental. At that point, an experimental warning category was added, with sub-categories experimental::lexical_subs, experimental::lexical_topic, experimental::regex_sets, and experimental::smartmatch.
Most of the features covered by the original Perl 5.18 warning categories were actually introduced in Perl 5.10 as back-ports from Raku (or Perl 6, as it was then called), and not documented as experimental. My impression was that the relevant experimental:: warnings were introduced becaue the corresponding features were recognized as being more experimental than originally believed. Programmers already familiar with a feature might not notice an extra sentence in the documentation, but they will surely notice if their code starts spitting out experimental warnings.
Two friends, Foo and Bar gone on holidays separately to the same city. You are given their schedule i.e. start date and end date.
To keep the task simple, the date is in the form DD-MM and all dates belong to the same calendar year i.e. between 01-01 and 31-12. Also the year is non-leap year and both dates are inclusive.
Write a script to find out for the given schedule, how many days they spent together in the city, if at all.
Example 1
Input: Foo => SD: '12-01' ED: '20-01'
Bar => SD: '15-01' ED: '18-01'
Output: 4 days
I've released version 1.36 of berrybrew, the Perlbrew for Windows. I've also reached out to see how I can become part of the Strawberry Perl team to get back on track with the release of new Strawberry Perls.
If you have any information on the release procedure for Strawberry, or know anyone on that team I might be able to contact to get things moving forward again, please let me know.
This release contains one significant new feature, the ability to use Powershell as the shell when opening or using a Perl. In the UI, when you "Open" your current Perl, or "use" any Perl you have installed, if the "Use Powershell" option is checked, instead of a cmd.exe shell, you'll be presented with a Powershell one instead (same applies for the command line berrybrew use $version.
The other changes in this release enhance the unit testing infrastructure, and the tests themselves.
Other notable changes since my last blog post:
The berrybrew associate command now has an alias of assoc for fewer keystrokes
Better exception handling in several cases
Documentation clarifications
Removed the upgrade command. It's now recommended to use the Installer to manage upgrades
Fix issue when using berrybrew to manage file associations where arguments passed to perl were being handled incorrectly
Continuing from the last article, let's talk about the hardware failures and server upgrade.
Mouse Input Support
Hardware Failure
Server Upgrade
UEFI vs OpenSuSE Installer
32bit -> 64bit & Perl's Storable
All your bad sectors are belong to us.....
Ugh, seeing these sort of log errors screams panic to me
Nov 25 03:44:25 Dev smartd[627]: Device: /dev/sda [SAT], Self-Test Log error count increased from 3 to 4
Nov 25 03:44:25 Dev smartd[627]: Device: /dev/sda [SAT], previous self-test completed with error (read test element)
Nov 25 03:44:25 Dev smartd[627]: Device: /dev/sda [SAT], Failed SMART usage Attribute: 184 End-to-End_Error.
Nov 25 03:44:25 Dev smartd[627]: Device: /dev/sda [SAT], 136 Offline uncorrectable sectors
Nov 25 03:44:25 Dev smartd[627]: Device: /dev/sda [SAT], 136 Currently unreadable (pending) sectors
I've had
https://github.com/Perl-OpenMP
up for a while, but I only recently thought to post an open invitation for others interested in this exploration topic to join.
#openmp
on
irc.perl.org
exists, semi-related IRC channels inlcude:
#native
and
#pdl
.
My confidence in the value of this line of work was bolstered recently when I shoved in an old finite element of 2dheat conduction into a Perl script using,
The second of these examples takes an example from Inline::C::Cookbook that shows how to process an array reference, coupled with an OpenMP reduction by OMP_NUM_THREADS threads.
gcc
has supported
OpenMP's 4.5
specification as of version 7. So it's there and there are many ways that it can be leveraged via Perl.
Sooner or later any programmer, writing in any language, will run across something like this Perl warning: Subroutine foo redefined. This is telling you that somehow, somewhere, you tried to create two subroutines with the same name.
Tracking this down can be tricky, and remediation equally so. The possibilities include:
If one of your own subroutines is involved, you can rename it.
If an imported subroutine that you do not need is involved, you can just not import it. This, of course, involves figuring out which imports you do need. The use of default import lists can make tracking this one down tricky.
You can use Importer to import a subroutine under a different name.
You can ignore the import mechanism and populate the symbol table yourself with something like BEGIN { require Some::Module; *foo = \&Some::Module::bar; }, after which bar() calls Some::Module::foo().
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on October 31, 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: Two Friendly
You are given 2 positive numbers, $m and $n.
Write a script to find out if the given two numbers are Two Friendly.
Two positive numbers, m and n are two friendly when gcd(m, n) = 2 ^ p where p > 0. The greatest common divisor (gcd) of a set of numbers is the largest positive number that divides all the numbers in the set without remainder.
Let me start by saying.... I DO NOT KNOW WHAT I AM DOING.
Literally, developing a game engine is not on my resume... yet! So
any code or ways of doing anything you read here, is just what I've
figured out and works for me, which by no means should suggest to you
that it is the proper way to do what ever it may be. Please consult your
local guru first.
OK, now that we have that established... Please consider the
following as entertainment and should you learn along the way with me,
that's wonderful!
Now, by the time of writing this article, I am several months into
this undertaking. I'll describe in future posts what the engine is
capable of, but for today, let me tell you about what happened over the
last 2 weeks. I will likely break them up into separate posts for easier
consumption.
Here's a quick list of the accomplishments, disasters and discoveries.
I've blogged a bit about my steps to get Net::Pcap to compile again - I won't paste the complete text here unless there is demand, but I'm posting the link to the article here :)
On August 21, 2021, famous Polish mathematician Andrzej Schinzel passed away at the age of 84. He was one of the great minds behind modern number theory. May he rest in peace.
I have extended one of my CPAN modules relating to his work and dedicated the release to his memory.
One of the things the Perl 5 Porters work hard on is issuing diagnostics that are actually diagnostic. I think they do a pretty good job at this, but sometimes I need a bit more explanation than the typical one-line message.
Now, there is documentation on all of these in perldiag, but paging through that looking for my message is a pain.
Fortunately, there is a module for that: diagnostics. This module causes diagnostics to be expanded into their full explanation as it appears in perldiag.
Typically you would not put a use diagnostics; in your Perl code, though of course you could. Instead, you would load it via a command-line option to perl, or maybe via environment variable PERL5OPT. That is, either
To most in the know, coding a game engine with Perl would be a surprise. I've certainly been asked, "Why Perl?". You see, unlike C++, C#, Java and others, which are well established languages in game engine design, Perl is not (well) known for it's role in the development of games. Especially not as a game engine language. You are much more likely to see Perl managing the network infrastructure for the gaming industry then you are to see it powering your favourite video games.
So why use Perl then?
Because It's what I know. It's that simple. I've spent many years using Perl to solve many problems throughout my career. I've been fortunate to write Perl code that interacts with a wide variety of hardware, Linux servers and network services. But never a game engine. So I answer "Why Perl?" with "Why not Perl?"
Why design another game engine? Why not just use an existing engine to make games?
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on October 24, 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: Middle 3-digits
You are given an integer.
Write a script find out the middle 3-digits of the given integer, if possible otherwise throw sensible error.
Syntax::Keyword::Match is a module to enable match syntax in the current Perl by Paul Evans who is one of the current Perl Steering Councils. See perlgov about the Perl Steering Council.
Syntax::Keyword::Match Examples
Syntax::Keyword::Match Examples
Number matching
Number matching. Match syntax is similar as a switch syntax of C language.
Term::ReadLine is a core module (since Perl 5.002) that provides an extremely limited text interface of the prompt-and-type variety. Its main virtue is that you can add a back end which gives it things like command history, editing, and completion.
The back ends live in the Term::ReadLine::* name space, and you can control which one you get by defining the PERL_RL environment variable as documented at Term::ReadLine. If this is not defined, various undocumented things are tried; if none works you get the bundled minimal interface, Term::ReadLine::Stub.
The preferred back end (at least, according to Bundle::CPAN as of this writing) is Term::ReadLine::Perl. This is a shy, retiring module, with no POD documentation at all, which provides readline-style history, editing, and completion. By default the only completion you get is file name completion, but with some work you can expand this to do whatever you can figure out.
At this point, some words of caution are probably in order.
The month of September is very special to me personaly.
Why?
Well, I got married in the very same month 18 years ago. The best part is, I choose the day 11 to get married. I have never missed my wedding anniversary, thanks to all the TV news channel.
How?
On the day, every year I find every TV news channel talk about 9/11 episode. It works like reminder to me.
Let's get back to the main topic ...
For the last few months, I have been late in making monthly report on time. This has created many problems for me. One of them and the most important is that I don't remember what I did last month. I then look back my activities on various social platforms that I am active on e.g. Facebook, Twitter and LinkedIn. It doesn't always help as I am not very active either socially these days.
BTW, I started working on this report around 6 am today.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on Oct. 16, 2022 at 23:59). 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: Zip List
You are given two lists @a and @b of same size.
Create a subroutine sub zip(@a, @b) that merges the two lists as shown in the example below.
Example:
Input: @a = qw/1 2 3/; @b = qw/a b c/;
Output: zip(@a, @b) should return qw/1 a 2 b 3 c/;
zip(@b, @a) should return qw/a 1 b 2 c 3/;
Announcing here
Web::PageMeta
which is lazy build-ed HTTP-GET and web-scrape-data module able to work both in classic code and also to behave non-blocking in async code.
More info
on my blog
or
on CPAN
or
on GitHub
.