Dealing with phone numbers in contact book

If you are building an app that uses the user’s contact book then their certain gotchas to avoid.

Telephone country codes are prefix-free

If a country has a country code “+91”, then no other country will get a country code like “+912” or “+913”. This scheme ensures that numbers are inherently unambiguous.

Telephone numbers can have multiple representations

Since most people don’t dial internationally, telecom systems implicitly assume a domestic call. So, someone dialing 612-555-1234 in the US is dialing “+1-612-555-1234”, while the same person in India is dialing “+91-612-555-1234”. Since international dialing would be more infrequent, telecoms require unique prefix numbers like “00” to distinguish whether someone is 612-555-1234 in their country or 0061-255-51234 in Austria. In some states, even the domestic area code is not explicitly required. So, a user might have stored “555-1234” as the phone number to which telecoms will implicitly prefix the user’s area code. And if the user wants to dial beyond their area, the telecom operator would require an additional “0” prefix to mark that it is an STD call. This localization has a massive implication regarding processing cleaning and normalizing phone numbers retrieved from the user’s contact book. Both country code and area code don’t contain “0”, and usually, that’s superfluous. So, while telecoms might be OK with calling or sending SMS to “0-612-555-1234”, they will treat a number like “91-0-612-555-1234” as incorrect.

Multiple countries can share telephone codes

USA, Canada, and many countries in the Caribbean share the “+1” telephony code. The carriers would treat calls or SMS as international, though. Italy and Vatican city share “+39”.

Continuous area codes or country codes are not always adjacent

As the population grows in certain areas more than others, the codes reserved for other regions can get allotted to them. An example of that is the San Francisco Bay area, where the first 408 and then 669 was allocated on top of the existing 650 area codes to deal with the growing population.

Confirming phone number ownership

You can never trust an incoming call or incoming SMS’s phone number. Therefore, the only way to verify that the user owns a phone number is by sending them a text message or making them a phone call.

Things to do in Cusco (Peru)

Cusco or Cuszo, an Andean city in South America, was the seat of the Inca empire and is home to world-famous Machu Picchu. I would recommend staying near the city center of Plaza De Armas (“Parade Square”). Most tourist activities are in and around the area.

Read More

Incremental testing: save time and money on CI for monorepo

To use monorepo or not is an eternal debate. Each has its pros and cons. Let’s say you decide to go with monorepo, one major issue you will face over time is slow testing. Imagine a monorepo, consisting of an Android app, an iOS app, some backend code, some web frontend code. In only very few occasions will someone modify more than one of those simultaneously.

Further, add to the fact that most of these projects confined to their directories would be using different build systems as well, for example, gradle for Android, yarn/npm for Javascript, go/rust/java/npm for the backend. The total build time, as well as test time, will only grow over time. It annoys developers making small modifications to their part of the codebase. And it slows down the development velocity drastically.

Read More

How to deploy side projects as web services for free

In 2020, the web is still the most accessible permission-less platform. For the past few months, I have been playing and building side-projects to simplify my life. I started with a Calendar Bot for scheduling events, DeckSaver for downloading decks from Docsend, AutoSnoozer for email management, and StayInTouch for maintaining follow-ups.

When I started on this journey, I had the following in my mind.

  1. Cost of domain ~ 12$ a year or 1$ a month
  2. Cost of a VM ~ 10$ a month

Read More

Docker 101: A basic web-server displaying hello world

A basic webserver

Docker containers are small OS images in themselves which one can deploy and run without worrying about dependencies or interoperability. All the dependencies are packed in the same container file. And the docker runtime takes care of the interoperability. You are not tied to using a single language or framework. You can write code in Python, Go, Java, Node.js, or any of your favorite languages and pack it in a container.

Consider a simple example of a Go-based webserver

Read More

Lassen Volcanic National Park: The most family-friendly park near San Francisco

Lassen Volcanic Park has a lot to offer for everyone. The park has wide roads, and most tourist spots are easily accessible. Here’s what I would recommend

  1. Subway cave Lava tubes – easy 1/3 mile underground hike

    Lava Tubes Entrance

    Lava Tubes Entrance

  2. Hydrothermal Areas – Hydrothermal areas from where Sulpher escapes regularly. Some right next to the road and some accessible via a short hike.

    Sulpher bubbling in the background

    Sulpher bubbling in the background

  3. Walk and play on snow-covered areas – all along the park

Strenuous hikes

There are three strenuous hikes. I would only recommend one or two of these

  1. Lassen Peak – this one is snow-covered almost year-round
    Taken along the Lassen Peak hike

    Taken along the Lassen Peak hike

    At Lassen Peak

    At Lassen Peak

  2. Cinder Cone Nature Trail – This one is less strenuous compared to the other two. It is still hard due to the gravel-covered surfaceCinder Cone seen from the bottomCinder Cone seen from the bottom

    Cinder cone from the top

    Cinder cone from the top

  3. Brokeoff Mountain Trail – this can be snow-covered hike depending on the time of the year

    Brokeoff Mountain Trail

    Brokeoff Mountain Trail

Things to do in Yosemite National Park

Strenuous hikes

Half Dome hike

17-miles 12-hours with a breath-taking dangerous climb holding chains on the majestic half dome at the end. This hike requires a permit for the final half dome climb.

Hiking Half Dome

Hiking Half Dome

The Clouds Rest Trail

12-miles 7-hours hike. The trail ends at a point higher than the Half dome. One gets a great view of the park as well as the Half dome from here.

Half Dome as seen from Clouds Rest

Half Dome as seen from Clouds Rest

I would recommend doing only one of these two hikes in a single trip.

Scenic viewpoints and Small hikes

Yosemite falls

The lower falls are easily accessible with a short walk. The upper falls require a 6-mile hike. I only did the former.

Dry Yosemite Lower Falls during off-season

Dry Yosemite Lower Falls during the off-season

Bridalveil Falls

Another gorgeous falls accessible with a short 10-minute walk.

Bridal Veil Falls

Bridal Veil Falls

Glacier Point

Glacier Point provides a great view of the half dome for non-hikers. It is located about an hour away from Yosemite Valley and close to south exit towards Fresno. For hikers, I would recommend doing Sentinel Dome or Taft point; both are one-mile hikes with starting point about 2-miles drive from the Glacier Point.

Sentinel Dome

Sentinel Dome

Mariposa Grove of Giant Sequoias

Mariposa Grove has multiple hikes ranging from short walks to 7-mile hikes where one can see the giant sequoias. Due to time constraints, I only did the short hike here.

Where to stay

If you are doing in the Half Dome, then stay at the Yosemite Valley the previous night to start hiking early morning (4-5 AM). Curry Village has the cheapest lodging, and the camps are located conveniently inside the Yosemite valley. Book well in advance.

The park is huge. Roads wind around mountains and hilly. Driving inside the park can consume significant time, I would recommend planning for that in advance.

Troublshooting Android Emulator: “Emulator: Process finished with exit code 1”

Emulator: Process finished with exit code 1

You opened AVD Manager in Android Studio and tried to start an AVD, you got
“Emulator: Process finished with exit code 1”. Following are the steps to debug
this

  1. Find out the name of the emulator.
    Click the down arrow 🔽 which is to the right of play arrow ▶️, to find out the name of the AVD. Let’s say the name is “Nexus_5X_API_28_x86”.
  2. Try starting the AVD directly from command-line
    It fails with another cryptic error, but that’s at least more actionable

    Let’s retry in the verbose mode to see a detailed error

    So, the system image is missing.
  3. Install system image
  4. Now try starting the AVD again.

    Turns out there is another version of emulator installed in $(dirname $(dirname $(which android)))/emulator/emulator. And the emulator I was using is a stray one.