Gardening during COVID

Hello!

It’s been a while, and I’m trying to get back to blogging.

I’m alive and well, and I’ve spent most of this year in Kisumu. I was in Kisumu when countries started restricting international flights, and I just couldn’t decide whether to go to India or elsewhere, so I stayed put.

In hindsight, it was a great decision. I took over the office compound, which felt like an island, cut off from the realities and rapidly rising daily statistics of the outside world. The compound also has lots of space, and since I’ve always harboured ideas of living on a self-sustaining farm one day, I took up gardening.

The first order of business was to eliminate food waste from garbage. Burning is the predominant method of waste management in Kenya, and it’s sadly quite common to see plumes of smoke in the evenings as people set their garbage on fire.

I remember reading about compost circles (but I can’t seem to find any reference to it online!) and decided to use one for composting. A compost circle is a circle that’s about half or one-foot deep (depending on the amount of food waste your household produces) that you fill with your food waste. If the circle is big enough, it should take you about 6 weeks to complete a full circle, by which time the first section of the circle should have turned into fresh compost. It’s a great, continuous source of compost for your plants

Digging a compost circle

With food waste covered, it was time to make sure I had a source of fresh vegetables - I dug two patches of about 2m X 3m, and planted green beans (I found a dried-up plant elsewhere within the compound and used the dry, pearly black seeds in pods, unsure if they would grow, but grow they did), cucumbers and tomatoes. It’s astonishing how quickly beans grow and how resilient they are to poor watering and intense sunlight - While the tomato plants drooped and wilted if they weren’t watered abundantly everyday, the beans seemed to flourish. Within a month, the bean plants had flowered and produced sweet, fresh beans. I’d take a break after work meetings in the evenings to water the plants and snack on young beans fresh off the plant 😍

The cucumber plants started off well, but the leaves turned yellow and the tiny cucumbers whose growth I was so excited to monitor everyday died on the vine before they could ripen. I realised it was a mistake to plant them in a spot that received sunlight for at least eight hours everyday - While the beans and tomato plants loved the direct sunlight, I believe cucumbers like the shade. Talking to a friend about the cucumber situation, I learnt there are insects that burrow into the soil and destroy the roots of cucumber plants. I did not get to confirm this because the cucumber plants were already too far gone.

Fresh green beans and the late office dog Kike, patiently waiting for treats

I purchased tomato seeds of a variety called “Rio Grande”. I’m not sure if it’s true of tomatoes in general or the variety I tried, but tomato plants need a lot of love! Careful, plentiful watering at a consistent schedule, trellis/support, and more susceptible to diseases.

Fresh tomatoes

Gardening is such a joy, and I’m so glad I had the opportunity and the space to experiment with it. For a few years now, I’ve been thinking about finding a piece of land somewhere, growing my own food, if only just to feed myself, and living the life of a hermit in an environmentally sustainable way. COVID lockdowns gave me an opportunity to test that lifestyle, and I’m more confident now that I can swing it!

Hey Big Tech, Support Regional Languages!

A few months ago, I bumped into someone who was using Kannada as their system language on their iPhone. Curious to find out Android’s support for languages that are not English, I switched my system language to Kannada as well and was pleasantly surprised to find nearly everything on stock Android in Kannada. The app ecosystem on the other hand is a different story.

Uber and Ola, India’s leading taxi apps, don’t seem to care about regional language support - While Ola makes no attempt to support use in Kannada, Uber’s attempt at Kannada internationalization seems to be an afterthought, with entirely broken screens.

Why support regional languages?

  • Barrier to entry - As a person in tech, with friends who work in or take an interest in tech, it’s easy to forget that using technology is hard for a lot of people. Adding a language barrier into the mix makes it worse. English is intimidating to a lot of people, especially in India. Anecdotally, I’ve had relatives tell me that they’d really like to be able to use taxi apps to move around, but they’re afraid of selecting the wrong location or ordering the wrong class of taxi (resulting in memorising the flow of taps 🤦). There’s an argument to be made about better UI/UX, but I think interfaces that are exclusively in English become a barrier to entry.

  • English is not inclusive - The history of English in India is steeped in colonialism (well, duh!), casteism, and elitism. Walk around in any “second-tier” city in India, and you’ll see advertisements for a multitude of companies, schools and websites offering to teach you how to speak “fluent English”. The clamour to learn English is of course driven by its employment potential, but I’d argue that it has to do with caste and elitism as well. Indian society places a high value on English fluency, and apps are silently reinforcing the discrimination that comes with it.

  • Content availability is a problem - There’s a classic chicken-and-egg (could not find an equivalent vegan expression!) issue at play - Platforms don’t have support for regional languages, and there’s not enough regional language content to make it worthwhile for platforms to support them. It looks like Amazon is yet to support Kannada content on Kindles! For now, you have a choice from as many as TWO Kindle eBooks if you search by language. TWO!

  • $$$$ - Okay, fine! I’ll stoop to appealing to capitalism - Companies are leaving money on the table by making their products and services inaccessible to a lot of people! Think about the growth potential, the happy investors, those beautiful graphs in upswing!

  • Because squiggly letters are awesome! ದಯವಿಟ್ಟು ನಿಮ್ಮ ಫೋನ್ ಹಾಗು ಕಂಪ್ಯೂಟರ್-ಗಳಲ್ಲಿ ನಿಮ್ಮ ಭಾಷೆಯನ್ನು ಉಪಯೋಗಿಸಿ

What can you do?

  • Strength in numbers - Don’t be an elitist, prop up regional language numbers by switching your system language on your device(s)
  • Contribute translation strings to open-source projects! I started contributing Kannada translations to Signal Messenger’s Android app, and it’s surprisingly fun and very satisfying to see the number of untranslated strings go down on every submit :)
    • Find open-source projects that could use your help at Weblate
    • Join (or create) a GNOME internationalization team here
    • Contribute to Mozilla’s apps and websites
  • Lobby governments to mandate the availability of regional languages (perhaps in addition to other languages?) on government websites. In 2019, governments paying third parties taxpayer money to build websites that lack regional language support is like building footpaths that are not wheelchair-friendly - egregious and just plain criminally negligent!

Commit to Master Branch on GitHub Using Travis CI

I’m trying to turn my pet project to find visa requirements for couples, Nomad Couple, into a full-fledged progressive web app (PWA) that has regularly updated visa requirements data (from Wikipedia) through a Travis CI cron job.

As part of that, I’ve set up the wiki scraper repo to be rebuilt every month and any changes in the visa requirements for citizens of different countries (available in dist/output) to be automatically committed back to the master branch.

Attempt #1 - Travis’ Github Pages deployment

I noticed that Travis CI offers automated deployment to GitHub Pages via configuration in .travis.yml. By default, it commits code to the gh-pages branch, but the configuration has a target_branch property to customize it. This is the configuration I tried

language: node_js
node_js:
  - "lts/*"

# ...
# Unrelated configuration for node.js/electron project
# ...

script:
  - npm run scrape
deploy:
  provider: pages
  skip-cleanup: true
  target-branch: master # Commit to master instead of gh-pages
  github-token: $GH_TOKEN
  keep-history: true # By default, Travis uses push --force and wipes out commit history
  verbose: true
  on:
    branch: master

The GH_TOKEN mentioned in the config refers to a token generated (with public_repo permission) on the GitHub personal access tokens page that I’ve saved on Travis CI as an environment variable.

While this was super easy to set up, it has a few issues.

Drawbacks

  1. This approach is dependent on Travis CI’s GitHub Pages support. You’re out of luck if you’re using a different Git hosting provider or your own Git server.
  2. Travis listens for commits on the master branch and triggers a build. Since the commit at build time is pushed back to master, this triggers an infinite build loop[1]!
  3. It’s not possible (as of Apr 2018) to customize the commit message. This rules out adding "[skip ci]" to the commit message to avoid the infinite loop.

Attempt #2 - Good ol’ shell script

Travis supports after_success, a hook that is called when the build succeeds. I replaced the deploy section in .travis.yml above with:

after_success:
- sh .travis-push.sh

travis-push.sh

#!/bin/sh
# Credit: https://gist.github.com/willprice/e07efd73fb7f13f917ea

setup_git() {
  git config --global user.email "travis@travis-ci.org"
  git config --global user.name "Travis CI"
}

commit_country_json_files() {
  git checkout master
  # Current month and year, e.g: Apr 2018
  dateAndMonth=`date "+%b %Y"`
  # Stage the modified files in dist/output
  git add -f dist/output/*.json
  # Create a new commit with a custom build message
  # with "[skip ci]" to avoid a build loop
  # and Travis build number for reference
  git commit -m "Travis update: $dateAndMonth (Build $TRAVIS_BUILD_NUMBER)" -m "[skip ci]"
}

upload_files() {
  # Remove existing "origin"
  git remote rm origin
  # Add new "origin" with access token in the git URL for authentication
  git remote add origin https://vinaygopinath:${GH_TOKEN}@github.com/vinaygopinath/visa-req-wiki-scraper.git > /dev/null 2>&1
  git push origin master --quiet
}

setup_git

commit_country_json_files

# Attempt to commit to git only if "git commit" succeeded
if [ $? -eq 0 ]; then
  echo "A new commit with changed country JSON files exists. Uploading to GitHub"
  upload_files
else
  echo "No changes in country JSON files. Nothing to do"
fi

TODO: If you’re using Travis on public GitHub repositories, your build log is publicly visible. If there are any Git related errors, it is possible that the origin URL (with your GitHub personal access token with access to ALL your public repositories) may be logged, which is a huge security risk. It is strongly recommended to redirect the output of all git commands to /dev/null (e.g, git push origin master --quiet > /dev/null 2>&1) once you’ve verified that the script works for your repo.

References:

Social media rich snippets with AngularJS and ngMeta

ngMeta, my Angular1 SEO meta tags library, has frequently seen issues related to the preview snippets or rich snippets generated by Facebook, Twitter, Skype, Whatsapp and others when a URL of an Angular site using ngMeta is shared. I’ve addressed it on Github several times, so I thought I would explain the issue in greater detail here.

Sites like Facebook and Twitter use crawlers to fetch URLs and extract the Open Graph meta values. When Open Graph data is not available, they fall back on the basic meta tags (title, description and others). Social media crawlers generally do not execute Javascript, meaning that they pick up the values provided in meta tags as-is. For sites that use ngMeta, meta tags might look like this:

<title ng-bind="ngMeta.title"></title>
<meta name="description" content="{{ngMeta.description}}" />
<meta property="og:title" content="{{ngMeta.title}}" />
<meta property="og:description" content="{{ngMeta.description}}" />

As a result, the rich snippet generated by social media sites is not pleasant (Remember, no Javascript!): Facebook rich snippet

However, Google search’s crawlers do execute Javascript and the search result snippet uses the title, description and other tags set through ngMeta, as expected.

It is technically impossible for a front-end framework library like ngMeta to force crawlers to execute Javascript and pick up the meta content values set through Javascript. Instead, solutions include serving pre-rendered pages, or redirecting requests by crawlers to a specific service that serves a static page with meta tags relevant to the requested URL. For more on the latter, check out angular-social-demo on GitHub.

Another option: If you’re willing to forsake the customization of meta tags for different pages to get rid of uninterpolated Angular expressions like ngMeta.title in your social media snippets, consider adding fallback meta tags that provide a title, description and image for your site. These fallback meta tags must have ng-if="false" so that they are removed in a Javascript-enabled environment:

<title ng-bind="ngMeta.title"></title>
<meta name="description" content="{{ngMeta.description}}" />
<meta property="og:title" content="Site name or other general title" ng-if="false" />
<meta property="og:description" content="Site description" ng-if="false" />
<meta property="og:image" content="https://your-site.com/fallback-snippet-image.jpg" ng-if="false"/>

Feel free to check out the source code of the ngMeta demo site. I’ve just updated it with fallback meta tags.

Android app for Torun's city bike system

I’m a big fan of Toruń, and I’ve spent a lot of time exploring the city over the last year. I’m also a big fan of cycling, so when Toruń’s city bike system relaunched in March after its winter hiatus, I took to cycling around the city. As an outsider, it wasn’t always easy locating the nearest bike station. Sometimes, I’d walk to a known station, only to find that there were no bikes. I couldn’t find an app to help me out with the city bike system, so I made one myself that uses the data available on the website.

The app uses the Google Maps Android API to show all the bike stations in the city as well as your current location. Using the Locate icon floating action button, you can locate the bike station that’s nearest to you from any location in the city.

Once you’ve identified a bike station, you can check the number of available bikes, and use the Navigate icon floating action button to get walking directions to the station from Google Maps. The app is capable of working offline, using a cache of bike stations, but, needless to say, realtime bike availability information needs a working internet connection.

Demo

Technical details

The app supports Android 4.0.3 (API Level 15 - Ice cream sandwich) and above, covering 98.6%+ of all Android devices 1. The context-aware floating action button, sliding bottom sheet and the themed action bar are based on material design guidelines. The app is compatible with the “new” permission system applicable to Android 6 and above: Devices running Android 6 (Marshmallow) and above use runtime permission requests, while all permissions must be granted at installation time on devices running older versions of Android.

Check out TRM Torun on Google Play