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.
(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.
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.
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.
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).
... before coding
Long time no blogging for The Weekly Challenge!
I found that I use "and/or" quite frequently in writing. I know, (mathematical-)logically we only need "or". It seems to me to be a language tricky part as the use of gender neutral terms.
I made a logical error for the "Lonely X" task in challenge 077.
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.
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.
This blog post describes a common task my colleagues ask often about repeating a dynamic string in a defined token and adding some or, and, = in between, plus finishing smartly.
This is a quick reminder that the quarterly San Diego Perl Mongers meeting will be occurring on Tuesday evening, starting at our normal time of 7 PM PDT. As has been for the last several meetings, we’re going to meet online, as in-person meetings are discouraged, and online meetings seem to be a bit more popular.
Tau Station, "the free-to-play narrative sci-fi
MMORPG (TM)", has a nicely complex database. Currently, we have 190 tables with
740 relationships between those tables. DBIx::Class does an amazing job at
managing that complexity, since each relationship is simply an accessor on the
DBIx::Class::Row object.
However, there is a subtle issue when using those relationship accessors. Using
a relationship accessor creates a new Row object and stores it in the calling
object. This behavior can easily leads to duplicate DBIC Row objects for a
single database row. At best, the duplicates cause wasted resources duplicating
the Rows. At worst, they cause update anomalies, since updates done to one Row
object are not seen by the duplicate objects.
With a highly-connected schema like we have in Tau Station, trying to handle the
object duplication can pretty soon feel like we're trying to handle
rabbits in Australia.
In order to avoid this Row duplication, we have developed a cache of DBIC Row
objects that is shared within the application. In most cases, this allows us
to ensure that we have one DBIC Row object per database row while processing
an HTTP request, avoiding those subtle update anomalies.
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)
Several months ago I read a tutorial on module creation. It got me thinking about releasing some of my modules. I got to work getting my code organized. At the time I had all of my work in the directory for my site. So I moved my general purpose modules to their own directory and then started reading more about what is needed to get a module published on CPAN.
I first installed Module::Starter. It seemed like a good place to start, but then Dist::Zilla was suggested, so I installed it. Most recently Minilla suggested, and now it is installed. The problem is, I do not know which one to use. Do I use any of those at all, or is there yet another packaging module (with executable) out there?
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on November 21, 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: JostSort
You are given a list of numbers.
Write a script to implement JortSort. It should return true/false depending if the given list of numbers are already sorted.
Example 1:
Input: @n = (1,2,3,4,5)
Output: 1
Since the array is sorted, it prints 1.
Just over one year ago, I wrote about how I had become enchanted with the D programming language as part of my journey in exploring new programming languages. I still really like D for all of the reasons I wrote about, but as I alluded to in the conclusion of that piece, I fully expected to “get distracted by the next new shiny thing that comes along.” Turns out that the next new shiny thing happens to be … Perl!
That’s right: a language that Larry Wall first developed back in 1987 happens to have caught my fancy and I’m as surprised as anyone.
If you haven't heard, Hacktoberfest has now become opt-in, to reduce the number of spammy, or pointless, pull requests that people were doing, to get the t-shirt.
In this post I'll describe how to opt your repos in, how to find opted-in repos, and why your repo might not be turning up in searches.
So if you've got repos with issues that you'd be happy to receive pull requests on,
add the topic hacktoberfest, and make sure that your repo turns up in searches.