Many moons ago, I wrote a Firefox extension to make it easy to copy an image inside a link, which is handy when posting images from a Gallery or whatnot. Since then, the Firefox extension API has changed significantly, so it stopped working a while ago.
I was inspired to revive it because Firefox Quantum just came out, and it’s much faster than it used to be! If you switched to Chrome for performance reasons, I’d invite you to check out Firefox again – it’s good to have an ecosystem of web browsers, especially one that isn’t controlled by a big company like Google or Microsoft.
Another cool thing is that Mozilla developed a language called Rust that some of the new parts of Firefox use. It’s a pretty interesting language – almost as fast as C, but more modern and supposedly it’s possible to write provably concurrency-safe code. I’m reading through the Rust book slowly…
Anyway, ThumbnailCopy is back!
Over the weekend I published an update to my Floating Point to Hex calculator that allows you to swap the endianness of the hex bytes! Pretty exciting, no? (the answer is: meh)
It was actually more work than it looks like, because I decided to go ahead and update the backing script to Python 3, which meant I had to recompile the C module it uses. When I was about to start doing this I was disappointed to see that I didn’t have any tests in the project, so I went ahead and wrote those before changing everything. And even before I started changing things I found a few bugs (oh negative zero, you are tricky), so it was time well-spent!
I did have to refactor a few things to make the script testable, but I can’t imagine doing a refactor with only the help of spot-checking things, which is what I used to do. Just like writing clean code, writing tests is useful for future you as well as others!
So I got an email from someone this week who casually mentioned that Bill James had mentioned my baseball win expectancy calculator to him!
Yes, that Bill James!
I’m happy to announce that Airport Guides (now with terminal maps for over 90 airports worldwide) is now available as a free app for Android! (the Windows 10 version is still available, too!)
Now that Xamarin is included for free with Visual Studio, I thought it would be fun to try it out. Xamarin lets you make apps for Windows/Android/iOS by writing code in C#. Usually you have to then design your UI in the appropriate language (Java for Android, Objective-C/Swift for iOS), but with Xamarin.Forms you can even write a cross-platform UI in C#!
Since most of the work in the Airport Guides app is maintaining the maps themselves, the app is pretty small so I thought it would be a good candidate for porting as opposed to something like Bridge Scorer which has a ton of custom UI. The experience was pretty good – writing the UI in Xamarin.Forms is a lot like writing it in UWP for Windows 10, except all the keywords are different 🙂
I did run into some frustrations along the way. One was not realizing that you can’t test in-app purchase stuff without a real device. (although in retrospect the documentation does mention this…somehow I missed it) Another was that while the Android emulator for Visual Studio is literally 10x faster than the default emulator, there’s at least one bug that doesn’t show up in the real emulator. For the record, it was fetching a particular web page that would always timeout…I still never figured out why! Pinch/zoom was also tricky to get working until someone pointed me to MR.Gestures (which I always pronounce “Mr. Gestures” in my head 🙂 ), but I still am disappointed that every platform doesn’t have an easy builtin way to make pinch/zoom on an image work. Shoutout to Alan Clark from Xamarin for helping me through some of these!
Since the baseball season is almost over, I wrote up a little math problem based on FiveThirtyEight’s MLB predictions. Check it out!
I finished updating my floating point to hex calculator – here’s the new version! It looks a bit nicer and also shows a neat breakdown of where the bits go in IEEE 754 floating-point format. Check it out!
– I literally had to buy a React+d3.js ebook to figure out how to get all this crap set up. (the book is pretty good, by the by)
– The book recommends starting from a particular git repository. To clone that on my linux machine I had to set up some SSH key stuff, which seemed like overkill. (why do I need to do that for anonymous access?)
– To set it up, it downloads something on the order of 300 packages through npm. I wish I were exaggerating.
– React now recommends you use ES6 instead of calling React.createClass(), and there are some niceties there. But there also some stupid gotchas, like the fact that you have to call
.bind(this) on every method for it to be able to access
– For some reason I’m not able to debug with Firefox’s debugging tools. (luckily Edge seems to work well)
– I wasted an hour because the new fancy
fetch standard (not supported in some versions of IE so you need a polyfill) has a method called
text() that returns the text of the response. Wait, no, it actually returns a promise that has the text of the response. I never realized how much I liked C#’s standard of ending asynchronous methods with “Async” before…