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.

Testing resumable uploads

The core idea behind resumable upload is straightforward if you are uploading a big file, then you are going to encounter users in the network conditions where they cannot upload the file in a single network session. The client-side code, to avoid restarting the file upload from the beginning, must figure out what portion of the file was uploaded and “resume” the upload of the rest. How to do resumable upload Before starting the upload, send a unique ID generated from the file contents to the server like MD-5 or SHA-256. The server decides and declares what the format of that unique ID is. Next, the server responds with an offset which indicates how many bytes server already has. The client uploads rest of the bytes with a Content-Range header. ...

falls_cover3

Five days in Kauai, Hawaii

Kauai is the nature island of Hawai’i. It is smaller than Big Island and way less developed than Oahu. Kauai is more about hikes and waterfalls than watersports. Day 1 We started our first day with Kauai’s Hindu Monastery It’s a beautiful temple with picturesque surroundings. I would recommend reserving a few hours to check out the whole area. The monastery is only accessible till noon, so, plan accordingly. Then we headed to Makauwahi cave, it’s a bit of drive, but the caves are accessible only for a few days every week from 10 AM -2 PM. Unfortunately, the caves were closed due to a medical emergency, but the short hike to the caves and the tortoise farm was excellent. ...

Antelope Canyon

A trip to Antelope Canyon

Antelope Canyon is probably the most photographed canyon in the world. Located in the Navajo Indian preservation, only guided tours are permitted. We took a trip to Antelope Canyon Tours. The tour lasts about an hour, and it takes ~20 mins one-way drive to reach the canyon. There aren’t any hikes, just simple walks in the canyon. Everyone is crazy running around and taking photos, so it does become a bit hard to enjoy in the mad rush. Even then, if you are in the area, I would recommend booking a tour in advance to visit the canyon. ...

How to speed up HTML5 videos

Some video streaming websites like YouTube provides an option for speeding up/slowing down videos; some don’t. The trick is simple, find out the Video object via Js 1 document.querySelector("video") and then set its playbackRate property to the desired value ...