Light writing

Literally writing with light, or photography, as it’s more commonly known.

I used to think that I loved photography. I think I still do, I just… never really do it anymore. At one point I had a whole mess of expensive camera gear, with the fancy full-frame digital SLR and red-ring’d lenses. And the fast primes—oh, I loved those. Studio strobes? Yup. Speedlights? Several. Fifty pounds of camera gear that stayed home because, I convinced myself, I couldn’t be arsed to carry fifty pounds of camera gear around with me.

Unless there was some kind of cool reason to. I helped shoot a wedding and did a men’s fashion shoot. Several portraits, too. But mostly, the gear stayed at home, collecting dust.

I mean, fifty pounds. I’m a relatively fit person, but come on.

So I sold it all and downsized to a small micro-four-thirds setup. A kit zoom, a couple of fast primes, and a speedlight. Fifty pounds traded for five and a bucketful of cash. Now I’d start taking more photos. Obviously.

I didn’t, of course.

Thing is, I do enjoy photography. Crafting an image is immensely satisfying. Capturing a great moment is fun. But I’ve gotten lazy about it, because the best camera is the one that’s with you, and by gum the camera on my iPhone is pretty fantastic, all things considered.

But it’s not the same. And while I don’t want to become fifty-pound camera-guy again, I do think I’ll take a cue from Ash Furrow and start walking around with my little PEN day-to-day.

I mean, look how pretty it is.

And of course, in true keeping-myself-honest fashion, I’m going to try to do a photo post every so often. Maybe once a month. Maybe some old photos, maybe some new photos, maybe a couple of words too.

More —as always— tk. šŸ“ø


Swift, UnitTemperature, And Humidex

Last week, I wrote about weather apps that use the Dark Sky forecast API for weather data lacking the Canadian humidex.

Those that do tend to be riddled with ads and all kinds of content that, well, I don’t care about. And naturally, I started thinking about how I use weather apps. All I really want from my is a couple of things:

  • Current conditions, including humidex/ windchill values;
  • Forecast conditions with highs and lows for today and tomorrow, again including humidex and windchill;
  • Probability of precipitation for the next hour, with alerts of impending rain.

Getting the actual forecast along with alerts is a solved problem, thanks to Forecast.io. Doing conversion and such between different units is also a solved problem, thanks to the new Measurement class in Cocoa.

(Here’s a great starter post on Meaurement)

So what would, say, a basic CurrentConditions object look like in my ideal app? Probably something like this:

import Foundation

struct CurrentConditions {
    var conditions: String
    var airTemperature: Measurement<UnitTemperature>
    var dewpoint: Measurement<UnitTemperature>
    
    var humidex: Measurement<UnitTemperature> {
        return Measurement(value: airTemperature.converted(to: UnitTemperature.celsius).value + 0.5555 * ((6.11 * exp(5417.7530 * ((1/273.16) - (1/dewpoint.converted(to: UnitTemperature.kelvin).value)))) - 10), unit: UnitTemperature.celsius)
    }
}

We initialize this strict with some descriptive weather conditions (e.g., “cloudy”), and values for the air (i.e., actual) temperature and dewpoint. It doesn’t really matter what units we use when we pass the values in, because the calculated property humidex will convert them to Celsius and Kelvin respectively, before returning a value in Celsius.

Then you can simply add a switch in your weather app’s settings asking the user if they prefer apparent temperature be calculated according to heat index or humidex.


How about that heat?

I don’t deal well with heat brought on by humidity. Which makes a Montreal summer pretty tough to deal with. Temperatures will routinely go over 30°C, but when combined with high humidity, it’ll feel even hotter.

Like, three-showers-a-day-ain’t-enough hot. Grimy, unpleasant, swampy hot.

And most weather apps out there don’t get it. Sure, they have a “feels like” temperature that compensates for some of it, but it never feels quite right.

To really understand how it works, you need a weather app made by Canadians, for Canadians. Because Canadians use a humidex.

Feels like

Humidex distinguishes itself from the US heat index in that it’s proportional to the dew point, not relative humidity. And generally, it’s significantly higher.

I’ve seen days where the “actual” temperature (i.e., air temperature) is in the high twenties, but the “feels like” humidex is mid-thirties. That’s a huge difference—what’s comfortable to wear at one temperature may not be at the other. Or worse: if you’re living with some medical conditions, the decision to leave the comfort of air conditioning may even be fatal.

A cursory look at weather apps (I’ve used many) shows that most use Forecast.io’s API. It’s a great data source, especially for its hyper-local precipitation forecasts. But—and this of course makes sense, given market sizes—it doesn’t use Canadian humidex calculations to derive the apparent temperature, so I never feel like I can trust these apps for forecast highs.

All I really want from a weather app is accurate alerts for incoming precipitation, and (humidex-corrected) forecast highs for the day. I’ve keep telling myself that I don’t want to take on new projects, but having to switch between a couple of apps every day is kind of a pain.

šŸ¤”


The Give-A-šŸ’© Manifesto

WHEREAS IT IS AGREED THAT

  1. There exist THINGS which one MUST DO; and
  2. There exist THINGS which one WOULD ENJOY DOING; and
  3. The above-listed THINGS may be MUTUALLY EXCLUSIVE;

IT IS RESOLVED THAT

  1. Where a THING is ENJOYED and MUST BE DONE, one shall REVEL for one can easily give a šŸ’© about it; and
  2. Where a THING is ENJOYED but whose execution is NOT REQUIRED, one shall strive to MAKE THE TIME for it, for it is good to do things one gives a šŸ’© about; and
  3. Where a THING is NOT ENJOYABLE but MUST BE DONE, one shall give a šŸ’© about executing the THING with CARE AND ATTENTION; and
  4. Where a THING is NOT ENJOYABLE and is NOT REQUIRED, one shall strive to ELIMINATE IT from the list of things one invites into their lives, for one should strive to fill their lives with things one gives a šŸ’© about.

AND THE MANIFESTO IS THUS RELEASED FOR APPLICATION on this day in the presence of these WITNESSES, the READERS.


Wallet-based business cards

A couple of months ago I played a little bit with PassKit and Wallet after finding this little tutorial on adding a business card to Passbook (now named Wallet).

A Wallet pass is pretty easy to create—just fill some metadata into a JSON file, create a Pass Type ID certificate in your Apple Developer account, and then run a signing utility. The whole process is pretty well described, step-by-step, here, so I won’t re-iterate, but here are a couple of little perils and pitfalls to watch out for:

  • To run signpass, you’ll need to download the Xcode project in the Wallet Developer Guide. Unzip the download and open signpass.xcodeproj in the signpass folder. Build it, right-click on the executable in the Products folder in Xcode’s file navigator, and select “Show in Finder”; drag and drop it into your Documents folder.

  • After you run signpass from the Terminal, run open PassName.pkpass and it’ll open in a Preview QuickLook window. From here, you can click on the “Add to Wallet” button and it’ll go up to iCloud and download to your iOS devices, without having to upload it to a server.

Preview QuickLook

  • If the pass doesn’t show up in your iOS device, there’s probably a typo in your JSON. Look for extra/missing commas, parentheses, square brackets, &cet.

  • You can double-check by launching Xcode’s Simulator, launching the Wallet app, and dragging and dropping your .pkpass file from the Finder into your Simulator Wallet. If everything checks out, it’ll ask if you want to add it.

Simulator add pass

  • If you’re uploading it to S3, make sure you set the Content-Type to application/vnd.apple.pkpass. Normally, this is a dropdown, but you can also just type whatever you want in there and S3 will accept it.

S3 Content-Type

And now you have a fancy electronic business card that other iPhone users can scan and download. Have fun!