Perl Weekly Challenge 124: Happy Women Day and Tug of War

These are some answers to the Week 124 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 August 8, 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: Happy Women Day

Write a script to print the Venus Symbol, international gender symbol for women. Please feel free to use any character.

Example:

Mid September Software Releases 2020

Perl5-IDEA 2020.2.3 (Perl5 plugins for IntelliJ IDEA)

"Profiler support and bugfixes"

https://github.com/Camelcade/Perl5-IDEA/releases/tag/2020.2.3

LemonLDAP-NG Apache::Session::Browseable v1.3.8

"This release contains fixes for CVE-2020-16093, which concerns LDAP server certificate verification when using LDAPS."

https://github.com/LemonLDAPNG/Apache-Session-Browseable/releases/tag/v1.3.8

Pulled Pork 0.7.4

"This release includes numerous bug fixes for some issues that have been around for some time. PulledPork v0.7.4 has been tested with Snort 2.16.1 and Snort 3.0.1."

https://github.com/shirkdog/pulledpork/releases/tag/v0.7.4

LedgerSMB

Releases on each maintained branch

https://github.com/ledgersmb/LedgerSMB/releases/tag/1.8.2

https://github.com/ledgersmb/LedgerSMB/releases/tag/1.7.21

https://github.com/ledgersmb/LedgerSMB/releases/tag/1.6.25


CLOC (Count Lines of Code) 1.88

"Add missing Raku_or_Prolog() subroutine; new languages and file types LLVM IR, Logos, Meson, Mojo, Odin, Jinja Templates, WXML, WXSS; support MATLAB block comments; minor bug fixes."

https://github.com/AlDanial/cloc/releases/tag/1.88

SSL Tools (rolling)

Pull requests accepted

https://github.com/noxxi/p5-ssl-tools

Week #77: Fibonacci Sum and Lonely X

Please follow the blog where I discuss the "Fibonacci Sum" and "Lonely X" task of "The Weekly Challenge - 077".

https://perlweeklychallenge.org/blog/weekly-challenge-077

Expand one into two - CY's Take on TWC#077

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

I found that I gained unnecessary promotion due to being in a GMT+8.00 timezone - my blogpost appears on the top of https://blogs.perl.org for longer hours.

---

Task 1 Fibonacci Sum

Another dish for math geek!

Really??

Coding Process

I spent a whole day on the Perl script on Fib Sum task. I worked on it until night. Then I have a rest. In the morning next day, finally I gave up a subroutine for cases like "7, 5, 3" => "6, 5, 4, 3, 2, 1" or "11, 9" => "10, 9, 8, 7". The hard time made me recall what I learnt after Challenge #055 Task 2 Wave Array, using a hash to remove any duplicates occurred -- instead of crazy handling of exception cases again and again.

Task Explanation

Perl Weekly Challenge 123: Ugly Numbers and Square Points

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

Spoiler Alert: This weekly challenge deadline is due on August 1, 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: Ugly Numbers

You are given an integer $n >= 1.

Write a script to find the $nth element of Ugly Numbers.

Ugly numbers are those number whose prime factors are 2, 3 or 5. For example, the first 10 Ugly Numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12.

Example

Input: $n = 7
Output: 8

Input: $n = 10
Output: 12

Ugly Numbers in Raku

Web Scraping with Zydeco

So I like to keep local copies of my blogs.perl.org blog posts as Atom entries, but noticed yesterday that I had a few gaps in my collection. The Atom feeds offered by blogs.perl.org only have the most recent articles though, so I decided to write a quick script to scrape the posts. Luckily, I managed to get a table containing the URLs for each post I needed, so I didn't need to bother with following links to find the pages; I just needed to grab the content from them.

I thought some people might find the code interesting especially for its use of lazy attributes. This is one of those "it only needs to be used once, so making the code maintainable isn't important" kinds of projects, do bear that in mind. I've cleaned up the whitespace and added comments for this blog post, but other than that, it's just a quickly hacked together script.

game code challenge

hi, as already indicated in that reddit post, a new bot contest was planned for next fall: it has now a planned starting date.

it would be nice to see more than ten perl lovers to join the fun, which will also permit to be seen in the loop back stats, unlike the previous contest.

i would like also to highlight:
  • the community developed an extension to write code locally.
  • the community can write contests from easy to expert: see Bender 1, 2, 3, against 4 ; or Pikaptcha 1, 2, 3, 4.
  • the admins will accept to upgrade to perl 7 when time has come, but, i guess, the level of priority will depend on the number of people asking for it.

TIL about Literate Programming

As a programmer whose first job was in the mortgage software industry, “TIL” has always meant “Truth In Lending” to me: you know, that document that the bank is required to give you when you get a mortgage, that’s supposed to explain how much you’re really paying after all the bank’s hidden finance charges, except the numbers don’t seem to make any sense so you just sign it anyway and don’t know anything more than you did before?  Yeah, that one.

Of course, nowadays it means something else, and I’ve had to redirect my ossified mental patterns into new channels, so that, now when I see “TIL,” I can have my brain recognize it as “Today I Learned.” Which is a handy phrase: it encapsulates feelings of discovery, serendipity, and epiphany all into one.  And TIL1 that the way I’ve always tried to write code has a name, a history, and a venerable progenitor—most of my life, without even realizing it, I’ve been trying to use literate programming (only without the tangling).

Perl Weekly Challenge 122: Average of Stream and Basketball Points

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

Spoiler Alert: This weekly challenge deadline is due in a few days, on July 25, 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: Average of Stream

You are given a stream of numbers, @N.

Write a script to print the average of the stream at every point.

Example:

Input: @N = (10, 20, 30, 40, 50, 60, 70, 80, 90, ...)
Output:      10, 15, 20, 25, 30, 35, 40, 45, 50, ...

Average of first number is 10.
Average of first 2 numbers (10+20)/2 = 15
Average of first 3 numbers (10+20+30)/3 = 20
Average of first 4 numbers (10+20+30+40)/4 = 25 and so on.

Week #76: Prime Sum

Please follow the blog where I discuss the "Prime Sum" task of "The Weekly Challenge - 076".

https://perlweeklychallenge.org/blog/weekly-challenge-076

Sum of Individuals Gives Meaning - CY's Take on PWC#076

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

---

Task 1 Prime Sum

What a dish for math geeks! Goldbach's conjecture is immediately recalled. I have chosen to print the answer first, than give the expression and explanation.

RxPerl release candidate is out

I was working on the completely fresh rewrite of perlmodules.net, when I decided I want to use WebSockets with this site.

So "innovations" started flowing through my mind in order to achieve WebSocketry, and ended-up deciding it would be very helpful if I could use ReactiveX on my Mojolicious site, in terms of size and neatness of the code, buglessness and maintainability.

This is how we ended up with RxPerl, a project I spent a lot of time to make it work well.

Now at version v0.16.0 on CPAN, it is a release candidate. I would like to ask anyone interested to take a look and see if they can find things they don't like about it, in advance of its proper v6.0.0 release which could happen late next week.

https://metacpan.org/pod/RxPerl

Thanks.

Perl Weekly Challenge 121: Invert Bit

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

Spoiler Alert: This weekly challenge deadline is due on July 18, 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.

You are given integers 0 <= $m <= 255 and 1 <= $n <= 8.

Write a script to invert $n bit from the end of the binary representation of $m and print the decimal representation of the new binary number.

Example:

A concise mtime sorted directory listing application

Today we will focus on a simple task: listing the files contained in a directory, sort them by modification time (see mtime and display the result in a JSON array.

We are gonna use Mojo::File for the file system part and Mojolicious::Lite to expose those data on a simple but effective JSON API.

Monthly Report - August

Time for another monthly report? Time just flies.

It was the most busiest month of the year 2020 for me. Of course, most of my spare time was dedicated to The Weekly Challenge. We, as a team, created record of 100+ contributions 4 weeks in a row. It was hectic and exhausting, I must admit.

With every passing week, the team is also growing. Team members are blogging more often. As of today, we have received 3000+ Perl contributions and 2000+ Raku contributions. For blogs, very soon we would cross 1000 mark, currently it stands at 940. Did I expect such response in the beginning? No, never dream of such support.

Encouraged by Gabor Szabo, I created my Patreon profile for the first time. I am overwhelmed by the support I have received so far. I would like to take this opportunitity to thank each and every supporters.

Why I don't try the Perl Weekly Challenges

A little over a month ago I learned about the Perl Weekly Challenges. The site states the challenges are for any skill level. So, I went and took a look. After looking at the first challenge that week, I realized “any skill level” did not mean my skill level.

My skill level is pretty basic.

I can …

  • open, read, and close text files and do simple manipulation of the data.
  • add, subtract, multiply, and divide when it comes to math.
  • tack on words or phrases to the beginnings or ends of strings okay with loops.
  • write some basic regexen.
  • even roll things randomly.
  • do most of the above conditionally.

… that is about it.

I read the challenges and my mind is totally blank on where to start after…

#!/usr/bin/perl
use strict;
use warnings;

I wish I could grasp the concepts in the Perl Weekly Challenges, especially the math. I have not taken a math class in over 30 years, and what math I remember is, as I said, pretty basic.

Oh, and one needs to be more than a little familiar with Git and GitHub to contribute, which I am not.

Perl Weekly Challenge 120: Swap Odd/Even Bits and Clock Angle

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

Spoiler Alert: This weekly challenge deadline is due in a couple of days, on July 11, 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: Swap Odd/Even Bits

You are given a positive integer $N less than or equal to 255.

Write a script to swap the odd positioned bit with even positioned bit and print the decimal equivalent of the new binary representation.

Example:

How and What to do in Programming (CY's Take on PWC#075 Task 2) [Edited]

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

---

Continued from the discussion of Task 1.

Task 2 Largest Rectangle Histogram

I am not a narcissist; though some of my actions are narcissistic traits, it does not imply that there is yet another narcissist; I am motivating myself for a better self.

Back to the task. This look like a task testing our overall commanding of the language (especially when the bonus is also considered), not an algorithm-oriented task.

At the first sight, looking for the largest rectangle seems uneasy. My order of coding has been: Perl code, Python code, Java code (3 at a time because I got a day-off on Tuesday) and (after a few days) Lisp code. The following is my note during coding the Perl of the task, informally:

Week #075: Coins Sum & Largest Rectangle Histogram

Please follow the blog where I discuss the two tasks "Coins Sum" and "Largest Rectangle Histogram" of "The Weekly Challenge - 075".

https://perlweeklychallenge.org/blog/weekly-challenge-075

Thoughts on Marshalling and Unmarshalling in Zydeco

Prompted by a recent question on PerlMonks, I've been thinking a bit recently on marshalling and unmarshalling Perl objects. If you're happy using Data::Dumper's format, then it's trivial, but today we're looking at JSON.

If you just want to encode your objects as JSON, that's very easy. Just add a TO_JSON method to all your classes. This can be done in a role to eliminate duplication, and in most cases can be as simple as:

The difficulty comes in going the other direction.

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.