omniverse A Few Thoughts About Research and Development

Fix apt-get networking problem on MIPS

If you are building a chroot with Debian MIPS (sid, Aug 2016) or other non-primary architectures you can get a strange message during a chroot creating:

Err:1 http://httpredir.debian.org/debian sid InRelease
  Temporary failure resolving 'httpredir.debian.org'
Reading package lists... Done

It happens because IPv6 works bad or does not work on MIPS so just add a hook /var/cache/pbuilder/hooks/G90forceIPv4 with the following content:

#!/bin/sh
echo 'Acquire::ForceIPv4 "True";' > /etc/apt/apt.conf.d/80forceIPv4

Optimize Local Guides

What is Local Guides?

Usually I contribute to openstreetmap.org with non-commercial objects, transportation and fixing vector maps. They use a wonderful new iD Editor that allows you to quickly edit Maps online without offline editor such as Josm. I tried to do something useful with Google Maps because they were broken at Moscow at many aspects. Recently Google provided an excellent instrument to boost contributing to Google Maps called Local Guides. Gamification and awarding contributors seems to be a vital idea.

There are points given to you for adding a review, photo, rating to existing place, editing missing information or adding a missing place. There are five levels with a few benefits given to contributor at each level. The most attractive one is a one terabyte of Drive storage for two years (4th level). An award for the 5th level is not so useful for non-US citizens. So why not?

drive storage

Automate everything

I decided to automate tedious tasks of finding places with incomplete information. So I wrote a little Python script using Google Maps API Web Services python library and published it to the GitHub - google-incomplete-places. The script uses API for server applications. Provide a server key to specific location, replace a query type in source code and launch it. Free API is limited for several thousands of requests per day. Do not expect to run your app all day long. I had became tired long before a daily API quota had exceeded.

A good workflow is to open two web browsers and a console at two monitors, click for the next place and search for a place while the edit page is loading (it is not very fast).

Hope it helps you to accelerate a search for incomplete places and gain new rewards. This approach helped to find almost two thousands of broken places such as vet clinics, bike stores, banks, drugstores and hospitals. Now the problem is what to do with one terabyte of data!

How the script works?

The script searches a given area for a specific place type using Places Search. Search requires a place type and a query string (I used a place type here). Then we get a list of Place ids. Unfortunately they are not fully populated with details so it is needed to query Place Details for each found place. Usually a website or opening hours are missing and the script looks for them. Then it composes a handy URL that leads you directly to the edit page. Places API supports paging but limits number of pages so total amount of results is capped at 60. Be creative to formulate a query to get distinct sets of places!

Moving parts in the script are query text and place type. Script can be adapted for your place by changing location and language variables.