Closeum - closed-source in disguise

Earlier, the Software world was rigidly divided between closed and open-source software. Microsoft Windows is closed-source, GNU/Linux is open-source. Microsoft Office and Lotus Notes are closed-source, LibreOffice is open-source. Turbo C++ is closed-source, and GCC is open-source. But now, a new class of software products has emerged whose core is open-source, but still, the open-source software is of limited use. One model is to offer some critical and useful functionality in a closed-source layer via a managed service in AWS/GCP/Azure, for example, Redis is open-source, but useful modules on top of it are not. Another model is to use licensing gimmickry, for example, MongoDB is licensed under SSPL which requires that if anyone offers MongoDB as a service, then the source code of the full service must be published under this license. The third approach is to make the core software open-source but make it dependent on closed-source cloud services. For example, the node package manager (npm) is open-source, but a closed source company owns the default npm registry. Android is open-source, but most day-to-day application ranging from Google Maps to Google Music are closed-source. Now onwards, rather than calling such software open-source, we should call them closeum. ...

Android Logo

Android: Fragment related pitfalls and how to avoid them

Don’t use platform fragments (android.app.Fragment), they have been deprecated and can trigger version-specific bugs. Use the support library fragments ( android.support.v4.app.Fragment) instead. A Fragment is created explicitly via your code or recreated implicitly by the FragmentManager. The FragmentManager can only recreate a Fragment if it’s a public non-anonymous class. To test for this, rotate your screen while the Fragment is visible. FragmentTransaction#commit can fail if the activity has been destroyed. “java.lang.IllegalStateException: Activity has been destroyed” Why - This can happen in the wild where say right before FragmentTransaction#commit() executes, the user gets a phone call and your activity is backgrounded and destroyed. How to trigger manually - The easy way to manually test this is to add a call to Activity#finish() right before FragmentTransaction#commit. Fix - Before doing FragmentTransaction#commit(), check that the activity has not been destroyed - Activity#isDestroyed() should return false. ...

Bora Bora as seen from Motu Tapu

Cruising in French Polynesia

We sailed on the Windstar cruise in French Polynesia. On a 7-day cruise, we stopped on six different islands, including two days in Bora Bora. The cruise ship has a crew of 99 and 74 staterooms for~150 passengers. This ratio ensures exceptionally personalized service, and you get to know pretty much everyone else on the ship. The crew members learn everyone’s name pretty quickly, and, especially, in our case, we got custom orders for vegetarian food of our choice regularly. ...

Water Bungalows in Bora Bora

French Polynesia - the basics

Getting to French Polynesia Getting from the US to French Polynesia used to be hard and expensive, with Air Tahiti Nui being the only option from the Los Angeles airport (LAX). In 2018, French Bee and United Airlines started direct flights from San Francisco (SFO) to Papeete (PPT). Papeete, the main island, is relatively dull, and there is nothing much to do at it. The two best islands are Moorea and Bora Bora. Alternatively, one can take a 10+ day-long cruise from New Zealand or Australia. ...

Android Logo

Android: Handling JPEG images with Exif orientation flags

A JPEG file can have Exif metadata which can provide the rotation/translation field information for a raw JPEG image. So, a landscape raw JPEG image could actually be a portrait because it’s EXIF orientation could be set to ORIENTATION_ROTATE_90, the best way to handle such scenarios is to either use a library like Picasso or Glide or at least learn from them. Here is a piece of code from Picasso which loads a JPEG as an in-memory bitmap and performs the right translation/rotation. ...

Sipapu Bridge

Hiking Natural Bridges National Monument

Natural Bridges National Monument in Utah is a National Park consisting of three natural bridges. One can spend ~1-3 hours hiking nearby each of the bridges. The hikes are short and require ascent/descent. Even without the hike, one can drive around to see the views. While one can hike to the bottom of Sipapu Bridge, the Kachina bridge can only be seen from a distance. And that too after a hike. If you are short on time, skip this one. ...

Why Nations Fail

Book summary: Why Nations Fail

The book is a good read on why some nations are rich today while others are poor.

Mac OS logo

Mac OS: App Translocation and Android Studio updates failure

I installed Android Studio via homebrew “brew cask install android-studio” as a part of my automated Mac OS setup. Recently, Android Studio prompted me that an update is available. When I accepted to update, it failed with an error “Studio does not have write access to /private/var/folders/wt/rjv6_wcn4f97_2nth7fqftqh0000gn/T/AppTranslocation/19A80F28-865B-41FC-AA87-B8E43C826FCB/d/Android Studio.app/Contents. Please run it by a privileged user to update.” This error was confusing; I was running Android Studio as myself, a nonprivileged user and the same user owned this directory. Googling it a bit for AppTranslocation took me here. ...

Android Logo

Cross-language bridge error handling: JS-to-Java Example

All languages have certain semantics for dealing with error cases. C deals with them by setting error codes. Java deals with them by throwing exceptions. JavaScript deals with them by throwing exceptions as well but unlike Java, it does have any concept of checked Exceptions. The JS interpreter just stops. And this has some interesting implications in hybrid scenarios like a Webview based app. Consider a simple Android app where most of the code is in JavaScript but is making a request to Java layer. ...

Made to Stick by Chip Heath and Dan Heath

Book summary: Made to Stick by Chip Heath and Dan Heath

The book is aimed at anyone who has an idea to convey and is trying to ensure that what they are trying to communicate sticks with their audience. Proverbs and folklores survive while corporate marketing material does not.