Posts

Porting a Toy Path Tracer to Swift

I ported a toy path tracer to Swift. Some performance numbers: Colab, effectively single threaded: 3 Mrays/s iPhone 11 Pro Max: 18 Mrays/s iPad Pro 12.9" 2018: 21 Mrays/s iMac Pro 2017 18-core: 96 Mrays/s The hardest part of the port was reducing contention between threads. I had to replicate the tracing object (which contains the scene data) per thread in order to avoid serializing on ARC retain/release code. Swift currently has no way to share an immutable object graph across multiple threads without incurring ARC overhead every time any object in that graph is accessed. Perhaps when Swift implements some form of the Ownership Manifesto  this will be fixed.

Dropping a Dynabook: A comic that turned from Science Fiction to Science Fact

Image
Some time around 1982, I saw an amazing comic on the wall of a Xerox Alto computer room at the MIT AI Lab . Given the subject matter, I assume the comic was originally created at Xerox PARC , possibly as part of the NoteTaker project, but can't find any trace of it on the web. I have recreated it from memory, below. The comic is explaining the events that happen when a Dynabook is accidentally dropped off the top of Half Dome in Yosemite National Park . Note that a free-fall calculator  claims that it would take over 12 seconds for the Dynabook to hit the Yosemite Valley floor. T+00.000 Dynabook accidentally dropped from top of Half Dome. T+00.016 Dynabook notices that It can't sense its user. It is in zero gravity. There is a 200 MPH wind from below. Dynabook concludes that it is falling. Turns off the display to save memory.  Opens a radio connection to El Capitan radio tower. Begins backing up the user's recent changes. T+05.000 Dynabook hits...

Pro No Mo - I don't really need a MacBook Pro machine for hobby programming.

I've been trying to decide which Apple laptop to buy for hobby programming. I'm leaning towards the cheapest laptop Apple sells, the 2019 MacBook Air. As far as I can tell, is  fine for my current needs. I specced out a more powerful and future-proof laptop, a 2019 MacBook Pro with 2x the RAM and SSD storage, but it was 60% more expensive. I think it makes more sense for me to buy the cheaper laptop today, and plan on replacing it sooner. Especially because I have a lot of family members who would be fine with the cheaper laptop as a hand-me-down. It does feel a little weird to decide that I don't need a "Pro" machine. When it comes down to it, Xcode, a SSD and a retina display are all the "Pro" I need for hobby programming, and Apple has made those features available in the budget Air line.

The way I solved my daughter's "iMessage Activation" error

Writing these notes in case they help someone. My daughter recently tried to add her Apple ID to her iPhone'sApple Messages app. (Settings > Messages > Send & Receive > Add Apple ID) When she tried this, she got a dialog box where she could type in her Apple ID and password. After a 15 second delay she got an error dialog box: iMessage Activation   An error occurred during activation.         Try again She got a similar error message if she tried to activate FaceTime: FaceTime Activation   An error occurred during activation.         Try again I searched the Internet, and tried the various remedies that Apple and others suggested: Reboot Phone. Make sure the phone can receive SMS messages. Enable/disable iMessage and FaceTime. Log the iPhone out of iCloud and log back in again. Visit icloud.com and check the iCloud account to see if there's any warnings or errors. Update the phone OS to the latest re...

2018 iPad Pro 12.9" Report

After weeks of research and thought, I bought a iPad Pro 12.9" 3rd Generation. My impressions, based on a week's use: It's too expensive, especially once you include the pencil and keyboard case. It's a significant improvement over the 1st generation iPad Pro 12.9". It's physically much smaller. The new keyboard is nicer. The new pencil's magnetic charger makes it much more useful than before, because now it's always charged when I want to use it. Flaws The magnets holding the pencil to the iPad are too weak. It's easy to knock the pencil off the edge of the iPad when picking it up or carrying it. When the keyboard case is folded back, your hands touch the keys. This feels weird at first. The hardware is held back by iOS 12 and Apple App Store limitations. FWIW I think for most people the ordinary 2018 iPad, with a Logitech Crayon, would be a better purchase. But I do enjoy using it!

Solving the anemone puzzle in Botanicula

Botanicula is a whimsical graphical adventure game for the iPad and other computers. One of the puzzles near the end of the game requires a bit of thinking to solve. When I came upon it, after a couple of hours of play, I was too tired to think. So I wrote some code to brute-force the solution. I'm unreasonably pleased that it worked the first time. Here's the code, cleaned up and commented:

Computer History Museum Oral Histories

Image
The Computer History Museum Oral Histories are a wonderful project. They are deep, long, interviews with many different programmers. Lots of never-before-made-public details about important projects. For example, this oral history by Oral History of Kenneth Kocienda and Richard Williamson goes into details of how iOS was designed: Or if you prefer PDFs: Oral History Part 1 Oral History Part 2 One of the interesting things I found out was that there was an attempt to use HTML/Web APIs to write iPhone apps, and that for the first two or three iOS releases some of the apps, including the Stocks and Weather apps were implemented as HTML/Web apps.

Girls Who Code iPhone App Development Course Review

One of my daughters recently took the Girls Who Code iPhone App Development course. This was a two-week summer course, taught 9 am to 4 pm in a high school computer science classroom. The first week the girls were taught the basics of the Swift programming language and iPhone App development. The second week the girls formed into 4-person teams and wrote their own iPhone apps. The girls learned how to use modern software development tools like Stack Overflow, GitHub, and Trello. Much of the instruction during the first week was by way of working through examples from a private Girls Who Code website. What worked well: The girls learned the basics of iOS app development, especially the Interface Builder. The girls learned how to work in small teams, how to design apps, how to meet deadlines, etc. The girls were motivated by the assignment of writing an app to improve society/the world. The girls learned how to present their final project to a group. What could have been...

On-the-cheap Machine Learning, revisited

A short update on my  On the Cheap Machine Learning  blog post. After almost a year of use, I’m still pretty happy with the setup. The hardware has worked well. I haven’t done as much independent ML research as I had hoped, but I have contributed many hours of night-time GPU cycles to the Leela Zero open-source Go-game-AI project. I don’t think I would change anything about the build, and there’s nothing about it I want to upgrade yet. However, in the past year a new option has appeared for on-the-cheap machine learning: Google’s Colaboratory  project. Colaboratory is a free web-based IDE for writing machine learning applications. What’s especially cool about it is that comes with access to a cloud-based GPU. The GPU they provide is the NVIDIA K80, which is not the fastest GPU, but it’s still plenty fast for experimenting with machine learning. [Disclosure: I work for Google, but not in any groups related to Google Colaboratory.] Colaboratory puts machine learning wi...

What I learned in 2017

Shipping an Audio Pipeline In 2017 I shipped a new audio rendering pipeline for the iOS version of  Google Play Music . I use it to render a particular flavor of fragmented MP4 that we use in the Google Play Music streaming music service. It was quite a learning experience to write and ship real-time audio code on iOS. If you are looking to write an audio pipeline for iOS, I highly recommend basing it on  The Amazing Audio Engine 2 . Core Audio is a powerful library with an peculiar API. TAAE2 provides a much nicer API on top of Core Audio, without adding much overhead. I had designed and implemented much of my new audio pipeline in 2016, but 2017 was the year that I deployed the pipeline to production. I learned that shipping an audio rendering pipeline comes with a long tail of bugs, most of which have the same symptom: "I was listening to a song when it stopped". I was able to find and fix most of my bugs by using a combination of: Great base libraries. (TAAE...

The Modern Family's Guide to Technology to take on a European Vacation

Image
This summer I took my Seattle-based family of five for a three-week trip to Europe. We had been promising the trip to our kids since they were little, and this year we were finally able to go. We had a wonderful time! Using our phones at the Eiffel Tower Here are my tech-related traveling tips. Disclaimer: I am not being paid to write this, and there are no affiliate links. I'm writing this to help me remember my trip, and in the hope that it will be helpful to other families (and maybe even couples and individuals) planning similar trips. Hardware Tips Take your mobile phones Take one modern mobile phone per person. Android, iPhone, either is fine, but you'll want something with a SIM slot and nice camera. Leave your laptops at home I didn't take any laptops with me, and I was able to do everything I needed to do using just my mobile phone. It was a relief to not have to lug around a laptop. A few times I had to request the desktop version of a web s...

Family Computers, 2017 Edition

A quick update on my family's computers, as we start the 2017-2018 school year My family's current setup Google WiFi iPhones Macbooks Windows Gaming PC School-provided Windows convertible tablets  iPads AppleTV Wii Chromecast Audio Laserprinter All-in-One. High speed document scanner Nest thermostats Google Home Changes since last year Home Network I bought a set of Google WiFi routers. I love them. They have worked flawlessly since the day I plugged them in. Best Google hardware product ever! Phones I upgraded my kids to refurbished iPhone 6s+s in Incipio cases. They are happy campers. We kept their old iPhone 5s's as backup phones for science projects and vacation trips. No more Beats headphones I've been having problems with my kids' Beats headphones. I had two sets of headphones, and they both needed to be repaired twice while under warrantee. When they broke again after the warrantee had expired, I just threw them away. I no...

Team Blue Iris ICFP 2017 Programming Contest Postmortem

Image
Team Blue Iris ICFP 2017 Programming Contest Postmortem My son and I competed as team "Blue Iris" in the ICFP 2017 programming contest . The ICFP programming contest is an annual 3-day programming contest sponsored by the  International Conference on Functional Programming . Functional programming is an approach to writing programs that stresses writing as much of the program as possible in terms of functions. That's as opposed to the more commonly used imperative programming . In the contest, people form teams to compete for three days to solve a problem, using any combination of programming languages. People compete for the joy of problem solving in the language of their choice. It's common for people to use outlandish or obscure programming languages. It's sort of like the Wacky Races  of programming contests. I've competed in this contest about six times over the past 10 years. This year was the first year my son joined me. My son's got a...

On-the-cheap Machine Learning computer

I recently put together a cheap-and-cheerful machine-learning-capable PC. https://pcpartpicker.com/list/wwyQ2R Highlights are: Pentium G4560 CPU NVIDIA 1060 6GB GPU 16 GB RAM 512 GB SSD The main difference from a budget gaming rig is that I chose a relatively overpowered GPU. This is because for machine learning I think the main bottleneck will be GPU RAM size. This particular GPU model has a lot of RAM (6GB) for a relatively low price. The other extravagance is the 512 GB SSD. It would have been cheaper to use a smaller SSD coupled with a traditional hard drive. I went with a single SSD because I don't want to deal with the hard drive. So far my son's done far more gaming than I've done machine learning. He likes the system a lot. It's >10x the graphics performance of his previous machine, a 2012 Mac Mini running Windows 10 in Bootcamp.

Overheating fanless Scooter Computer

A few months ago, inspired by The Scooter Computer , I bought a fanless Intel Broadwell 5257u  computer. I set it up as a Core OS Docker host, but quickly discovered that I didn't actually have much use for Docker or Core OS. Recently I tried to repurpose it as a low-end Windows 10 game box. That unfortunately ran into heat-related stability issues. Windows 10 worked fine as long as I didn't try playing 3D games. Playing 3D games like Counterstrike GO would crash after 10 to 15 minutes, with a very hot heat sink. Fiddling with BIOS settings and drivers didn't make a difference. I guess the lesson to learn from this is, when buying a fanless computer, not to get the highest powered available CPU. Safer to get the lowest power CPU that meets your performance needs. Or just get a fan. :-P

Family Computers, 2016 edition

As the summer of 2016 draws to an end, it's time to plan my family's IT setup for the 2016-2017 school year. My current setup iPhones Macbooks iPads Apple TV Chromecast Audio Printer/scanner. Apple Time Capsule No-name " scooter computer " for playing with docker. Phones for kids The big change this year was that my youngest kids got their own phones. The process went well. I'm glad I spent the extra money to buy refurbished iPhone 5s's instead of cheaper phones. The iPhone 5s's have been reliable and easy to administer. The 16 GB of storage has occasionally been a problem. I restrict my youngest kids' phones so that they can't install apps. It's tedious to have to unlock and then relock the phones to install apps for them, but I like being able to have a say on which apps they have on their phones. I bought Otterbox cases, which worked well at protecting the phones. So far all the phones have survived. One phone did ge...

Two thumbs up for DigiPen ProjectFun

I sent my kids to the DigiPen ProjectFun summer camp this year. It's expensive ($1400 for 10 days). It is very well run. My kids loved the experience, and they learned a lot about the topics (animation and game programming) they took. The classes were structured as 7 days of instruction, 2-and-one-half days of final project, and then a demonstration on the afternoon of the last day. FWIW I am well versed in both animation and game programming. I've tried to teach my kids these subject. They learned more from these courses than when I tried to teach them at home. The instructors emailed me a detailed "what we did in class today" letter every day. I found it helpful to read the letter and use it to prompt discussion with my kids. A nice side benefit is that my kids were exposed to relatable role models in the game industry, through the many DigiPen students who are helping run the camp. "Dad, everybody has nose rings." Only drawback: m...

Scanning old documents

That which is resisted, persists. I'm going paperless in my home office. Over my 30+ years of adulthood I have accumulated 20+ filing cabinet drawers of paper records. Plus there's a ton of unsorted bills and junk mail piled up. My strategy is to tackle the filing cabinets first, then work on the unsorted bills and junk mail. My reasoning is that doing the filing cabinets first will help me set up my taxonomy on Google Docs, making it easier to file the new documents later. My strategy for scanning my filing cabinets is: Go through each file cabinet drawer and storage box, one at a time. Sort docs into 3 categories: scan & keep, scan & shred, shred. Scan documents to PDF files with a Fuji ScanSnap ix500. Store the scanned documents in folders (with the same name as the original folders) on Google Docs. Put the "keep" documents back into the same folder and cabinet drawer that they came from. Make a backup copy of the scanned documents to a U...

2015 Year in Review

Here's my take on tech trends in 2015 and predictions for 2016. Personal trends in 2015. I started using Twitter, following a mix of optimistic tech bloggers, economists and comic-book artists. Always something interesting to read. I don't tweet much. (Nothing to say :-P) Podcasts. I'm following a bunch of tech, gamer, and comedy podcasts. I especially like The Voicemail , Accidental Tech Podcast , Melton, and Guys we F*cked (NSFW) . I switched to a large-sized iPhone 6s+. The big screen is great. I stopped maintaining my "Terminal Emulator for Android" program, because I lost interest in the idea of an on-device terminal emulator for Android. (And I lost interest in maintaining the project in the face of frequent Android UX and build system churn.) Open Source I've been doing less open-source software work than in previous years. My OSS work has been driven by emotion and "hack value". This year I haven't come up with any ideas th...

Family IT Information, end-of-year edition

Just an update on my family IT use. The T-Mobile family plan has worked great for us. T-Mobile's plans are nice for us because: The third, fourth, and fifth lines are only $10 / month. When the paid-for data is exhausted, the plans automatically switch over to unlimited free low-speed data for the rest of the month. Streaming music doesn't count against the data caps. Free phone calls, texts, and low-speed data in Canada and Taiwan. (It was great using Google Maps to get around Vancouver. I was using many short cuts that I didn't know about when I was navigating using paper maps.) For the last 3 months of 2015 T-Mobile had a special where they gave everyone unlimited high-speed data for free. I ended up getting used iPhone 5s 's for all my kids. I had the kids pick their own otterbox commuter cases.  My son was initially frustrated at having to give up his rooted and customized Android phone for the smaller, less customizable iPhone. He's grown us...