Happy New Year and Remember to Update your Copyright Date!

I’m still living in 2023, even though it is now January 1, 2024. But my git repositories don’t need to live in 2023.

Picture this: you have a line at the top of your source file that looks like this:

// Copyright (C) 2012-2023 Joelle Maslak, All Rights Reserved

The problem is that I’m not usually working on the comment in the file, I’m usually working on something else in the file and forget to update these lines when I edit the files. I found a simple git hook to check for outdated copyrights on new checkins.

Photo by Pixabay on Pexels.com
Continue reading “Happy New Year and Remember to Update your Copyright Date!”

The Sorry State of Network Maintenance Notices

It’s nearly impossible to automatically parse network maintenance notices from internet providers. Let me tell you about a few ways providers mess this up!

I was driven to create this article after receiving a network maintenance notice, which my parsing code rejected. The problem today? The maintenance was to begin and end at 6:00 GMT. Even the most trivial maintenance activities take a minute or two, but this escaped their system and found its way to my parsing code. Sadly this isn’t unusual.

Photo by Brett Sayles on Pexels.com

What will it take for providers to send maintenance notices that can be parsed by a mere mortal?

Continue reading “The Sorry State of Network Maintenance Notices”

Perl Weekly Challenge 12 – Euclid Numbers

This week’s Perl Weekly Challenge, problem 1, reads:

The numbers formed by adding one to the products of the smallest primes are called the Euclid Numbers (see wiki). Write a script that finds the smallest Euclid Number that is not prime. This challenge was proposed by Laurent Rosenfeld.

The first Euclid numbers are 3, 7, and 31.   These are computed as follows:

We’ll take the first three prime numbers – 2, 3, and 5.

The corresponding Euclid number is the prime number multiplied by all the smaller prime numbers, with 1 added to it.

So the first one, 3, is just 2 (nothing to multiply it against) plus 1.

The second one is 3 * 2 plus 1, or 7.

The third one is 5 * 3 *2 + 1, which is 31.

How do you do this in code? Continue reading “Perl Weekly Challenge 12 – Euclid Numbers”

Converting Decimal to Roman Numbers in Perl 6

This week’s (week 10) Perl Request Challenge, challenge 1, was:

Write a script to encode/decode Roman numerals. For example, given Roman numeral CCXLVI, it should return 246. Similarly, for decimal number 39, it should return XXXIX. Checkout wikipedia page for more informaiton.

For this blog, I’m going to talk about converting a decimal to a Roman numeral.

To start with, I read the Wikipedia page referenced in the challenge, and realized there were several different systems for writing Roman numerals – it wasn’t as standardized as I thought! That said, I stuck with the style used in the description of the challenge, specifically “subtractive” notation.  Essentially, the symbols are written from the largest value to the smallest value, left to right, with no more than 3 of any symbol used.  When four of a symbol would normally be used (for instance, IIII to mean 4), instead it would be written as IV, meaning one less than 4 (you see this because the smaller number is before the bigger number).

So that’s what I’ll talk about below – the part of the code that converts an integer to a Roman number.

Continue reading “Converting Decimal to Roman Numbers in Perl 6”

Solving the Sparkpost Challenge

The Perl Weekly Challenge for week 9 includes an optional third challenge – essentially, use the Sparkpost service’s API to send an email.  Sparkpost is a service that allows sending emails via an HTTP interface, just by posting a JSON form response.

I’ve noticed people have not known how to solve these API-usage challenges, so I will share my method of solving them, using Perl 6.

Continue reading “Solving the Sparkpost Challenge”

Anagrams – in O(N)

If you understand “big O” notation, skip on down to the “Solving Week 5 Problem 2” heading.

I’m going to discuss this using Perl 6, but I think an intermediate Perl 5 user will be able to figure out what the code does and how it would be able to be implemented in Perl 5.

“Big O” Notation

Most students of computer science have been exposed to “big O” notation.  Essentially, algorithms can be classified by performance.  N represents the size of the data being processed, while O() is shorthand for “execution time on the order of …”

Continue reading “Anagrams – in O(N)”

Open Up Your Open Source Module – Part 4: Contributor Credit

This is Part 4 of a 5 part series.  Links to other parts (as they become available) are below.

We’ve previously talked about adding the CONTRIBUTING, TODO and CODE_OF_CONDUCT files. But how about giving contributors credit? This is a short, and easy, tip.

Continue reading “Open Up Your Open Source Module – Part 4: Contributor Credit”

Open Up Your Open Source Module – Part 3: CODE_OF_CONDUCT File

This is Part 3 of a 5 part series.  Links to other parts (as they become available) are below.

We’ve previously talked about adding the CONTRIBUTING and TODO files, so now we’ll get to the post I’ve been dreading: the CODE_OF_CONDUCT file. I believe strongly in the value of codes of conduct, and think every project should have one.

So, why would I dread it?

Continue reading “Open Up Your Open Source Module – Part 3: CODE_OF_CONDUCT File”

Open Up Your Open Source Module – Part 2: TODO File

This is Part 2 of a 5 part series.  Links to other parts (as they become available) are below.

So, you’ve added a CONTRIBUTING file to your module (in part 1).  That’s great! Now people know the ground rules for contributing to your module.  But there is another thing you can do to encourage the contributions you want: Simply tell the potential developer what changes you might appreciate.

Continue reading “Open Up Your Open Source Module – Part 2: TODO File”