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:

Writing a SNES assembler compiler/disassembler - Day 1

Writing a SNES assembler compiler/disassembler

Why ? Because I can. More seriously I have a project where I need to inject new Snes code in a running game and I want to express directly this new code in my Raku component (A webserver service). I want to have special sub that returns me Snes bytecode but that contains Snes assembler.

I tried injecting a SLANG in Raku already. Like writing my $byte-code = SNES lda $42; sta $54; rtl; But it’s rather tricky and I will probably just have a additional Slang with its own grammar in a dedicated file.

Developing A Game Engine with Perl: Part 5 - 32bit -> 64bit & Perl's Storable

If you haven't heard already... I DO NOT KNOW WHAT I AM DOING.

Closures

A casual remark about closures which I made in My Favorite Warnings: redefine touched off a long off-topic exchange with Aristotle that I thought ought to be promoted to a top-level blog entry. The big thing I learned was that any Perl subroutine can be a closure. The rest of this blog will try to make clear why I now believe this. The words are my own, as are any errors or misconceptions.

The second sentence of Wikipedia's definition of a closure says "Operationally, a closure is a record storing a function together with an environment." This makes it sound a lot like an object, and therefore of little additional interest in an O-O environment.

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: http://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:

I finally start to translate Japanese Perl Zemi to English.

I finally started to translate Japanese Perl Zemi to English.

Perl Zemi | Perl Zemi|Perl Installation, Perl Tutorial, Many Examples

Perl Zemi is Japanese Perl Tutorial site which is well known and red in Japan. Most of all Japanese Perl users know Perl Zemi and read the document repeatedly.

The volume of content is large and has a reputation for being easy to understand.

This site is originally Japanese. I started to translate this site into English at 2021-11 using an automatically translation tool. I plan that the not very good descriptions and examples by the automatic translation will be gradually fixed until 2023-01.

I'm really going to achieve it.

Let's enjoy Perl with me!

Developing A Game Engine with Perl : Part 4 - UEFI vs OpenSuSE Installer

I'm still learning so remember... I DO NOT KNOW WHAT I AM DOING.

If you want to start reading from the beginning. Check out the first article in this series

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.

  • Mouse Input Support
  • Hardware Failure
  • Server Upgrade
  • UEFI vs OpenSuSE Installer
  • 32bit -> 64bit & Perl's Storable

A small computer and almost destroying it...

TWC 138: Partition-free Weekends

Placeholder for overdue explanation of my solution to Task#2, using regex exponential exhaustion.

A dream resyntaxed

[Author’s note: If you’ve read Curtis Poe’s most recent blog post, what follows is going to seem eerily familiar. This post uses the same concepts, arguments, and code examples as his, and reaches exactly the same conclusions. That’s because both posts originate from a long and wide-ranging email discussion between Curtis and myself, as I’ve been privately consulting with him over the past few months on the design of Corinna.

When I read Curtis’s post I almost decided to bin this one, as he managed to cover everything necessary in his usual succinct, eloquent, and engaging style. But he has encouraged me to post my version of this discussion too, as it provides a little more detail on some of the issues we’re addressing, and on the design rationale for the changes we are jointly proposing.

I made a calculator

I created a very basic calculator using wxGlade and the Wx Perl module on CPAN.

wxCalc.png

This is a short one. I've been playing around with wxGlade because it generates Perl code. It is pretty easy to get started on Ubuntu using the base perl.

  • sudo apt-get install wxGlade
  • sudo apt-get install libwx-perl

It took me a while to get the feel of wxGlade, so hang in there. The pay off is when you figure out how to:

  1. build a basic GUI using the builder tools
  2. generate Perl code to just show the GUI (with no actions)
  3. inspect the Perl code
  4. run Perl code
  5. start defining the event handlers

It also takes some time to get an idea about how the Perl code via wxGlade gets injected into the Perl file. I recommend experimenting with the different places in wxGlade you can put in code.

Creating the All Important Flow

Developing A Game Engine with Perl: Part 3 - Hardware Failure & Server Upgrade

Remember... I DO NOT KNOW WHAT I AM DOING.

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

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

The Ephemeral Miniconf

The Ephemeral Miniconf is planned on thursday 18th of november 2021!

Have you heard about The Ephemeral Miniconf ?

flyeren2small.png

It's a Perl/Raku free and online miniconf that will take place on Zoom!
Think "TPRCiC" but smaller with only one track :)

I'm honored to have some experienced speakers about Perl, Github, Devops, LDAP etc... You will enjoy I promise!

More informations on my big blog serie about on devto or on the website.

I can give you already the connections informations:

Meeting ID: 818 6906 5466
Pass: 42

It's planned at 3pm UTC+1(Paris time) so check the timezone planner to know when it is for you.

It's in the morning if you're in US, in the afternoon if you're in Europe and very late if you're in Asia or Australia (sorry).

The planning will be something like this:
planningsmall.png

(it could last longer or change a bit inside the range, like shifting talks, but at the moment here it is)

I'm also possibly preparing some surprises that I don't want to reveal for now.

So my message is basically, it's coming, book your calendar and I'm looking forward to see you at The Ephemeral Miniconf!

My Favorite (?) Warnings - Ex-Warnings

Warning categories have proliferated since the warnings pragma was first introduced in Perl 5.6: from 50 in Perl 5.6.2 to 79 in Perl 5.35.5 (the latest as of this writing). But warnings have been removed as well as added. This post documents these -- mostly for historical interest on my part.

Developing A Game Engine with Perl : Part 2 - Mouse Input

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.

  • Mouse Input Support
  • Hardware Failure
  • Server Upgrade
  • UEFI vs OpenSuSE Installer
  • 32bit -> 64bit & Perl's Storable

Mouse Input Support

Monthly Report - October

In the festive mood again ...

The festive season began already and I miss celebrating festivals with family and friends. But this is nothing new, I should get used to it now. Still sometimes it hurts really bad after all we are humans. In the past, we tried to be with family during festive season. The truth is it didn't feel the same. I don't know why. Could it be we are no longer carefree souls? But that can't be true. I have seen some of my friends on Facebook sharing celebration moments with family. It looks so beautiful and cute. The only difference I can think of is that they with family and I don't.

I would like to mention one friend from Nepal. We never met but I always watch his Facebook post having great time with his family. I think we became friends because of common love for Perl.

Perl Weekly Challenge 137: Long Year and Lychrel Number

These are some answers to the Week 137 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 7, 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: Long Year

Write a script to find all the years between 1900 and 2100 which is a Long Year.

A year is Long if it has 53 weeks.

Expected Output:

berrybrew version 1.36 released!

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.

berrybrew-ui_use_powershell.png

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
  • Unit test infrastructure enhancements

Developing A Game Engine with Perl

Perl? What... really?

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?

open invitation to participate in Perl-OpenMP on Github

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, Two interesting examples follow:

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.

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.