Recent Entries »

Golang: Promoted methods, method sets and embedded types

In Go, interfaces are implemented implicitly by ensuring that the implementing type’s method set contains all the methods of the interface. That is, if a type A contains a method set that is a superset of interface I’s method set, then type A implements interface I.

This seems pretty straightforward, but can get a little convoluted when dealing with struct types that have embedded/anonymous fields.


Converting CAD to USD using the DLR ETF

If you’re converting a large amount of CAD to USD (to buy US-listed/denominated securities, or to purchase US goods, or whatever) the spreads your bank offers you may not be the best way. Instead, if you have a brokerage account (one for both CAD and USD), you can use the Horizons DLR ETF to do the conversion for a lower cost.

Horizons has a nice PDF detailing the procedure, but I wanted to go through my experience with the process.


Python script to search CBC Radio 2 broadcast/play log history

I’m a fan of CBC Radio 2. Okay, that’s not exactly true, but I do have my $10 radio alarm clock tuned to 94.1 FM to wake me on weekdays. I often find myself in a stupor or only semi-awake when the tunes start blasting away before dawn, and as such, I often have trouble remembering what was exactly on the radio that morning. However, once during the day I remembered that a certain Ben Folds Five song had received airtime on CBC Radio 2 during my morning wake-up, but could not recall the exact day. It bothered me.

Thankfully, they did have broadcast/play logs of all tracks they had aired, along with the date/times, providing for a succinct history. Unfortunately, it didn’t seem possible to search them, and I didn’t feel like searching through each day’s play log for the particular title. What to do?

Scripting to the rescue!