An HTML Calendar Generator

[Amazon Link]
(paid link)

[November 2019: sources moved to GitHub]

Awhile back I replaced the (increasingly unwieldy) monthly archive section over there in the right-hand column with a yearly archive section: one link per year that Pun Salad has been in existence. Each link takes you to a yearly calendar, which, in turn, contains links to the monthly archives (when you click on a month name) or daily posts (when you click on a day). Example output here for 2017.

The code to generate those calendars is embedded in the (very) special purpose CGI script that powers Pun Salad, but I thought the calendar generation code might be of interest to people.

Notes:

  • The script is run with a single year argument, and produces HTML on standard output.

  • The Perl module Time::Piece does most all of the heavy lifting for the necessary date calculations. It probably breaks down for years far in the past or future; I haven't messed with that too much. I tested that it gives the same calendar for 1901 as the Linux cal command does, so that's good.

  • The HTML::Template module is used to specify the HTML framework for the calendar. Obviously, that's where you might want to customize the appearance. The code assumes the template resides in your top-level ~/Templates directory.

  • The calendar is a table of months; each month is a table of days. This means, of course, that the generator is essentially a four-deep nested loop. Eek! A voice from my old structured programming days said: "you really shouldn't nest loops that deeply". So I broke out the month-generation into a Perl subroutine, and now I feel better about myself.

As usual, this is not earth-shattering code, but I hope someone finds it useful, if only for tutorial purposes.


Last Modified 2024-01-26 6:06 AM EDT

To The Hilt

[Amazon Link]
(paid link)

In 1998 or so, I tossed all the Dick Francis novels written up till then into my to-be-read system. Nearly twenty years later (whoa), we're reaching the end of that project. My favorite Dick Francis book is Proof, but this may be my second-favorite.

We have a true Dick Francis hero in the protagonist, Alexander Kinloch. He's a long-haired painter, and has ensconced himself up in the remote Scottish highlands hut to do his artistry. (A true Scotsman, he even plays the bagpipes.) But he gets a call from his mother: his stepfather, Ivan, has had a heart attack, and the family business, a brewery, is floundering on the edge of bankruptcy due to embezzlement by a trusted employee. Could Alexander come down and help out?

Well, sure. But no sooner does he accept than he's visited by four thugs, demanding that he cough up… something hidden, but they never say what exactly. This does not stop them from beating Alexander mercilessly and tossing him down a nearby cliff.

Like all good Francis heroes, Al lets us know that he's hurting, but doesn't let that stop him from his obligations. Back in civilization, he's in a complex world of skulduggery and violence. Ivan's biological daughter is suspicious that Al is trying to cut her out of her inheritance; her husband is even more hostile. (One thing about Francis: some of his villains are pretty obvious.) It becomes clear that Ivan is trying to protect a number of his assets from the upcoming, seemingly inevitable, bankruptcy: a horse (of course) and a trophy which he assumes has been given to Al to hide. Oops, it never actually made it to Al. But was that why he was beaten up?

Very complex and twisty, many colorful characters, and (unlike a lot of the novels I've been reading) the book never gave me the feeling it was padded to hit a contract-specified word count.


Last Modified 2024-01-26 6:06 AM EDT

Life of Crime

[3.0 stars] [IMDb Link]

[Amazon Link]
(paid link)

A Netflix DVD that was in my queue for awhile, bumped up to the top simply because of its longevity. It's OK. But given the Elmore Leonard source material, sort of disappointing.

IMDB plot summary: "Two common criminals get more than they bargained for after kidnapping the wife of a corrupt real-estate developer who shows no interest in paying the $1 million dollar ransom for her safe return." From that, I was expecting some zany hijinks, following in the noble comic tradition of O. Henry's "The Ransom of Red Chief".

But not so much. Jennifer Aniston plays Mickey, the kidnap victim. Tim Robbins is the hubby, who in addition to his real estate fraud, is also cheating on Mickey with Melanie (Isla Fisher). And he sees the kidnapping as a way to avoid a messy divorce.

Things get complicated. There are a lot of supporting characters, contributing their own confusion to the mix. Will Forte plays a hapless Lothario who, trying to weasel his way into Mickey's pants, happens upon the kidnapping. And the crooks' hapless assistant turns out to be a pervy rapist—will Mickey manage to avoid this?

Trivia: It's been a long time since I saw Quentin Tarantino's Jackie Brown, but it turns out that this movie and that one share a number of characters from the Elmore Leonard universe. This movie is based on Leonard's The Switch, while Jackie Brown was based on the book Rum Punch.


Last Modified 2024-01-26 6:06 AM EDT

URLs du Jour

2017-12-27

RESPONSIBILITY

■ After the brilliance of the previous Proverb, Proverbs 17:17 slips back into fortune-cookie mediocrity. Sad!

17 A friend loves at all times,
    and a brother is born for a time of adversity.

Note the sexist language! What about sisters? (Some translations make it "kinsfolk".)


@JonahNRO asks the musical question: Who Deserves Credit for the Trump Administration’s Accomplishments? Yes, there are some things that have conservatives and (some) libertarians cheering. But:

Aside from the mandatory flattery required of Republican elected officials, there’s remarkably little testimony that Trump has involved himself in the process of governing. Tax reform was carried across the finish line by the GOP congressional leadership. Net neutrality was repealed by independent Republicans at the Federal Communications Commission.

Foreign policy is a more mixed bag. If the president deserves credit for the defeat of Islamic State, it’s because he let “the generals” do their thing. On the other hand, credit (or blame) for recognizing Jerusalem as the capital of Israel or pulling out of the Trans-Pacific Partnership and the Paris accord on climate change certainly goes to him.

In general, it seems to me that Trump’s success (such as it is) is less attributable to sudden mastery of the issues than to staying out of the way of rank-and-file Republican policymakers, activists, and bureaucrats.

In a way, Jonah's column is a response to Roger L. Simon's demand for an apology from "remaining NeverTrumpers".


■ At Reason, Jacob Sullum is more critical of Trump's theory of Presidential responsibility. Which is, mainly: The Buck Stops Over There. One of Sullum's examples:

Comey cover. When Trump fired FBI Director James Comey in May, the White House said he did so at the recommendation of Deputy Attorney General Rod Rosenstein, who argued that Comey deserved to be sacked because he had treated Hillary Clinton unfairly while investigating her email practices as secretary of state. Trump, who had long complained that Comey went too easy on Clinton, later admitted the Rosenstein memo was nothing more than window dressing for a decision he had already made.

And more.


■ But we don't want to be super hard on Trump. The Babylon Bee, for one, is grateful: Nation’s Christians Thank Trump For Allowing First Public Celebration Of Christmas In 8 Years.

The nation’s Christian believers thanked President Donald Trump by the millions Tuesday after he allowed the first public celebration of Christmas in America in since the year Barack Obama took office, with many breaking down in tears due to their great gratitude toward the president.

Yes, it was nice to be able to buy the Baby Jesus stamps for the Christmas cards again. Thanks, Donald!


■ And your Tweet du Jour is a Venn diagram from Mark J. Perry:

Apologies to anyone offended by junk reference.


Last Modified 2018-12-28 5:43 AM EDT