WWDC 2020 Random Thoughts

2020 年 6 月 22 日 • 2:51 PM

Lights, camera, action.

This asynchronous event footage could have been dry and could have been another WWDC keynote sans the audience. But thankfully it wasn’t. The camera movement, the lighting, the transitioning and virtual interactions between speakers all played out well. It made the video fun (fun enough) to watch and follow along.

Craig Federighi’s eye brows also helped a lot on the fun-ness. No crack jokes this year, though.

I wonder where Phil Schiller is. And Eddy Cue.

Pee breaks

Apple’s kind enough to include a “pee break” session where it talked about privacy. Don’t get me wrong — privacy is an utterly important issue, but the session tells me nothing on what’s new for me to experience; rather, it says you get that automatically.

This pee break was quite literal for me. And it was a good pause from the non-stop information influx of any WWDC keynote. Except that in previous years, the information was spaced out by applause, cheering, people actually walking on and off stage, speakers saying thank you, and much slower pace of a live speech.


Drawing Canada Maps in R

2020 年 1 月 7 日 • 12:00 AM

There are many reasons you may want to draw a custom map with ggplot in R — overlaying data with ggplot is a lot more flexible than in Power BI1 or other readily made BI tools. There are many blog posts on how to do this for the US, but resources regarding Canada are scarce. Fear not! With the help from StatCan, some great pointers out there2, and the spirit of exploration, we are ready to share how to draw some Canada maps.

Update March 18th, 2021

I’ve pushed the code and data onto a repository at Github. Link here: github.com/fifty8/canada-maps-r. My thanks to readers who found out about the dead link I had.

I’ve also had the chance to test how long it takes my MacBook (late-2017, 13” quad-core i7) to process the raw geo files. The whole process took about 2 hours, which is a lot longer than what I remembered when running on a Windows machine. YMMV wildly. Have patience.

By the end of the post, you will be able to —

  • Use R and ggplot to draw maps for Canada: all the 10 provinces and the 3 territories
  • Zoom in to draw only select provinces or select areas within a province
  • Apply coordinate transformation so that the maps of the Great White North appear closer to reality
  • Overlay custom data points with coordinates — we are pinning Vancouver, Calgary, Edmonton, Toronto, Ottawa, and Montréal.

Canada Maps drawn in R

You will be using —

  • Shape files from StatCan (.shp, shx, .dbf)
  • R with multiple shape file-related packages listed below
  • A hardcoded copy of latitudes and longitudes for some major Canadian cities
  1. We use Microsoft Power BI across the company. 

  2. Canada Maps - R Bloggers was my starting point. The post neatly points which packages to look into, and where to get the data. However, it falls short of explaining how to draw your own data that are not part of a shape file. A lot of code in this post is taken with only minor modifications. 


Supporting the Triple Cameras on 11 Pro

2019 年 9 月 21 日 • 12:00 AM

With the recent updates to Version 3.0, HRZN gains support for iPhone 11 and iOS 13 – you can now shoot a photo with iPhone 11’s ultra wide lens to capture massive landscapes.

For those with a dual camera phone (iPhone X, XS, 7 Plus and 8 Plus), you get sharper images with the telephoto lens.

But how?


A Swift Camera Framework

2019 年 8 月 27 日 • 12:00 AM

I have three camera apps on the App Store under my name, and I’m tinkering with two others that haven’t seen the store yet. I thought it was time I create a framework that wraps all the camera features and open up enough APIs so that —

  • I can easily deploy another camera app that takes photos;

  • I don’t have to interact with Apple’s AVFoundation framework which, while providing all the control capabilities, is cumbersome for an app that captures still images;

  • I can have all the device control logic in one place, and only update them once.