Found in a library book. Had it been a higher denomination or not so old, I would have found a way to return it.
Category: goatee-stroking musing, or something
-
Calculating the second last Friday of the month
My boss, bless ‘im (no really, do; he’s a sound bloke, great guy to work for, and is just getting through some serious health problems), needs a monthly status report on the second last Friday of every month. I live by my calendar applications reminding me to do things, so I thought it’d be no problem getting Outlook to set up a reminder.
No dice; it will only set up appointments on the 1st, 2nd, 3rd etc., starting from the beginning of the month. I did a web search, and really thought I’d found a solution for iCal. It was not to be; this was for a Unix program called ICal; dratted case-insensitive search. Curiously, it appears that the ics spec might support a second-from-last syntax, but Outlook and iCal (and Google Calendar) can’t create them. Phooey.
So I tried excel; and really thought I’d found the basis of an answer: Last Friday of the month. And indeed, most of their assumptions are right; the code
DATE(year,month+1,1)-WEEKDAY(DATE(year,month+1,1),1)
really does give you the date of the last Saturday in the month. But you can’t assume that the day before the last Saturday is the last Friday – it is the second last, if the month ends on a Friday (April 2010 is a test case).
So I tried the Swiss Army chainsaw of brute-force date calculation: Perl with Date::Calc. What I do here is create an array of every Friday in the month, then print the second last member; never known to fail:
#!/usr/bin/perl -w # second_last_friday.pl - show date of 2nd last friday use strict; use Date::Calc qw(Today Nth_Weekday_of_Month_Year Add_Delta_YMD); my ( $new_year, $new_month ) = 0; my ( $year, $month, $day ) = Today; foreach ( 1 .. 24 ) { my @fridays = (); # for every friday in this month foreach my $week ( 1 .. 5 ) { if ( ( $new_year, $new_month, $day ) = Nth_Weekday_of_Month_Year( $year, $month, 5, $week ) ) { # day of week 5 is Friday push @fridays, $day; } else { last; # not a valid Friday } } printf( "%4d/%02d/%02d\n", $year, $month, $fridays[-2] ); ( $year, $month, $day ) = Add_Delta_YMD( $year, $month, 1, 0, 1, 0 ) ; # month++ } exit;
and this gives
2009/11/20 2009/12/18 2010/01/22 2010/02/19 2010/03/19 2010/04/23 2010/05/21 ...
See, notice the tricksy 23 April 2010, which – considering thirty days hath April et al – ends on a Friday and threw that simple Excel calculation off.
I’m disappointed that all these new applications like Outlook and iCal don’t seem to handle dates as elegantly as the old unix programs I used to use. pcal, in particular, could generate incredibly complex date formulae. I must dig around to solve this problem – and for now, actually have to remember to write that report on the second last Friday of this month …
-
she’s a star in The Star
Whee! Catherine‘s featured in the Toronto Star today: Burning through the branches – thestar.com.
-
big-ass spider
This is one of the last surviving garden spiders. It’s huge – perspective makes it look smaller than my thumb, but it’s about the same size.
It looks weary and arthritic. May not see november.
-
I would *totally* go as the owl pellet
— from the ever-wonderful SUBNORMALITY! -
foo
I am in oakwood village library, trying WordPress for BlackBerry.
-
Save Chambers Harrap in Edinburgh
Harry writes:
As you may have heard, the historic dictionary firm of Chambers in
Edinburgh is threatened with closure by the parent company Hachette
Livre.They intend moving the English dictionaries to London and the
bilingual Harrap titles to Paris, involving not just the loss of 27
jobs in Edinburgh but the end of a publishing tradition going back
nearly two centuries. Chambers is a Scottish and British institution
dear to the hearts of word-lovers.Yes, the advent of free resources on the internet has changed the
world of reference publishing, but it is far from clear whether all
options for the future of Chambers Harrap have been properly
considered in what appears to be a very drastic and possibly even
underhand move by Hachette. I feel strongly we shouldn’t just accept
this as inevitable. Hachette should be forced at the very least to
undertake a properly full and open review of the situation first, in
due consultation with the NUJ. If you wish to join with others in
urging them to think again, you may like to sign the online petition
at http://www.ipetitions.com/petition/chambers-in-edinburgh/. It only
takes a few seconds.More at http://sn.im/chambersharrap and http://harrycampbell.blogspot.com.
-
she says I’m boring her camera
I missed my old Pentax MX. Of all of the cameras I’ve ever owned, it was probably the one with the most charm – and I don’t mean that in the same way that former Eastern bloc cameras were “charmingly” unreliable.
The MX doesn’t do much, but does all you need. It is tiny, but it’s a very solid chunk of metal. The shutter/mirror makes a very civilized little klipp! when fired. All the controls are where you’d expect them. The pancake 40mm lens gives my MX a snub-nosed appearance. I used to have the bigger and heavier 50mm f/1.4, which some lens nerds consider to be one of the finest lenses ever made.
Sure, it has its faults. The advance lever will poke you in the eye if you change shutter speed on the fly. And, well, y’know, film.
-
like 8-bit on a green screen
Saw a forces type wearing CADPAT on the subway. He looked like old-school 8-bit, so I thought I could improve on the design:
-
Artwork by David Barnes
Artwork by David Barnes / thebeewithwheels. Medium: pen on index card, 3×5" (76 x 127 mm) David Barnes does all the artwork for Of Montreal. He’s recently opened an Etsy store under his thebeewithwheels moniker. I bought his print of the Aldhils Arboretum cover, and inside he included a little drawing. Keep running, finch-headed man!
-
Ink
Vinegar’s remarkable ability to clean up spilled ink from a plain wood table is matched only by Waterman Encre Havane’s near-praeternatural ability to get everywhere.
-
They really add something, you know?
Good dills really make a sandwich, wouldn’t you agree?
-
We found tastiness at Makkal Chon
We went to Makkal Chon (1975 Lawrence Ave E, near Warden) and had truly amazing Korean food. It’s such an unassuming little place, but worth it. Kal bi frenzy!