Musing #56: My First Smartwatch Face



A smart life deserves a smartwatch, or perhaps it is smarter to be without one. Setting wisdom aside, I purchased my first one earlier this week - Samsung Gear Fit2 Pro. By being 1/3rd as expensive as a WiFi-only Series 3 Apple Watch, it won my wallet, if not my heart. I will reserve judgement on the device for the review, which isn't likely to materialise until I have used it extensively.

This post, then, is about a watch face, to be precise, my first creation of it. Kudos to Samsung for making available an easy-to-use designer, utilising which I was able to create the watch face in hours and survive the royal wedding. Having not found what I was looking for, I decided to create one for myself. The focus in this case was on information density and making the most of the colours on the AMOLED display without straining the battery life excessively.


The result is a crowded watch face that includes all the details that I could wish for. Besides the inclusion of all the fitness information, the icons for weather, music, settings, calendar, step count, floors and heart rate are all tapable with the date redirecting to the 'Today' view.


I was also inclined to keep the display "always-on" and hence chose a minimalist approach for this scenario. It fulfils the purpose of telling time while making it possible to keep an eye on the ever-draining battery. As per the analysis available within the designer, the current on pixel ratio is 1.5% with the minimum being below 1%.

I will mostly publish this watch face in the Samsung Galaxy App Store in the coming week, so be on the lookout for that. On the other hand, if you have some suggestions for future watch faces, then don't hesitate to leave a comment.

(Originally published on May 19, 2018)

Update #1 (May 20, 2018): The higher than expected battery drain in the "always on" mode over the past few hours made me investigate the possibilities of reducing the power consumption while still retaining this mode. A little bit of digging brought up this article which indicates that the next best thing to black is green. Effecting this change for the "always on" mode produces the following result:


The maximum 'Current on Pixel Ratio' is now 1/3rd (there's that ratio again!) of the original one. In fact due to the usage of green, this ratio now remains more or less constant and drops to 0.4% on certain occasions. Finally, I am not open to compromising the "Active" mode too much for power saving, but I have demoted the white to "seconds" which should help a bit.


Update #2 (May 22, 2018): A few more tweaks and optimisations went in to the watch face over the past couple of days and I assume that it can't get any denser than this. With the audience of one being satisfied, I have submitted the watch face to the 'Samsung Galaxy Apps' store and hope that it makes its way through to countless others. For now, I shall leave you with a cover image.


Tutorial #15: Running Comanche Gold on Windows 10


There are those indescribable moments in life when you come across a relic from the past and are instantly flooded with fond memories. This was precisely the case when I stumbled across a mention of Comanche 3 on the web, one of the earliest PC games in my life that I spent countless hours on at a friend's place (though candidly it was more of watching than playing, ala wingman to the PC occupier).

This meant I couldn't resist the temptation of digging through my treasure trove for the Comanche Gold disc. Comanche Gold is essentially Comanche 3 for Windows with few extra missions and being 32-bit meant it could be run natively on current 64-bit PCs without the need for virtualisation. The geek in me couldn't resist the challenge of getting it running once again on Windows 10 (Creators Update Build 15063.413 as of this writing) and hence this guide details out the steps to getting it done.

First things first, you need to have the following things on hand:

1. The Game Disc, of course, though I recommend creating an image of it for sheer convenience. The image can be directly mounted on Windows 10 as a DVD drive, can be archived and used on tablets that lack an optical drive.

2. Comanche Gold Patch Pack: I had come across various mentions of patches for Windows 7/8/10 but most of the links were long dead. However, the most recent mention of it can be found here. All credit is due to the original author(s) and contributor(s) of the patch. Since things tend to get lost with time, I have uploaded a copy of the patch to Google Drive.

3. DXGL: This seems to be the real differentiator in getting the game to run properly on Windows 10 with the correct video mode. As of this writing, the version used was 0.5.11.

The ideal scenario would have been that I just install the game and replace the files with the patch as depicted in the forum post from SimHQ that I have linked to previously. However, that is not how it panned out for me and I had to engage in some trial and error to get the game working. Below are the fruits of my labour laid out in sequence.

1. Install the game to a simple directory structure (eg.: C:\Games\Comanche Gold) using the 'Large Install' option. Installation to the default 'Program Files' directory resulted in the game starting in the 'Multiplayer only No-CD' mode, despite the fact that the patch contains an exe that removes the CD verification.

2. Extract the contents of the Comanche Gold Patch Pack to the root game directory, overwriting files wherever necessary.

3. Install DXGL, add the Wc3.exe file and retain all the default settings. The only change I made was to change the Video mode to 'Aspect corrected stretch' but you can easily change this to 'Stretch to screen' in case you are not a fan of letterboxing.

4. At this stage, I still couldn't get the Wc3 exe to launch as it only lead to a Windows error, none of which could be rectified using any of the compatibility options. Turns out the game needs the obscure 'DirectPlay' feature in Windows to be enabled which is a long deprecated DirectX API.

As it turned out, this was the last hoop I had to go through. Thereafter, the game launched in full screen mode and I was able to push the resolution to 1024*768, though 1280*1024 led the game to crash. Considering the age of the game, I would say it is an achievement to get it working perfectly two decades later. Love it or hate it, Windows compatibility and its legacy support is worth its weight in nostalgia, in spite of all the cruft.

(Originally published on July 4, 2017)

Update #1 (May 12, 2018): The game installs and works fine on the April 2018 Update of Windows 10 (Build 1803) with the same instructions.



Things are now much easier as even the default settings on the current version of DXGL (0.5.13) work fine and Windows automatically prompts the installation of 'DirectPlay'. I would still recommend using the 'Aspect corrected stretch' option as otherwise Windows changes the resolution rapidly and pops up a 'fix blurry text' prompt on first run.


Tutorial #20: Home (Network) Improvement using a Pi


I had previously shared some tutorials in setting up the Pi and putting it to good use. However, the use cases I mentioned then have ceased to exist. The Fire TV has taken care of most of my multimedia needs and I have come to realise that I really don't have much time to go back in time for nostalgia. For the retro needs that remain, the lesser-used Core M 5Y10 equipped Windows tablet of mine does a much better job plugged in to the TV.

Hence, it is time to put the Pi to good use in a different sense. Thankfully, the versatility of the Pi means that it is not difficult to identify its next project. Ads can become a nuisance, especially for the more aged members of the family and hence my first intent was to set up an ad blocker across my home network. However, putting the Pi to such limited use and keeping it on 24/7 would be quite a waste, so I decided to also repurpose it as a download box with centralised storage.

Setting up the tools necessary to accomplish these tasks seemed straightforward. However, the relevancy of publicly available tutorials diminish over time due to changes in technology. In fact, I had to put quite some effort beyond the listed tutorials and hence I have decided to put the same to words for posterity.

Before starting out:

PINN is a great utility when multi-booting across different distributions on the same SD card. However, Raspbian alone fits the bill for the current use case. Hence, writing the raw Raspbian image directly on the card is preferable as it provides more usable space. As far as writing on the card goes, Etcher is the way to go.

1. Pi-hole®

As the website so prominently displays, all you need is a single command.

curl -sSL https://install.pi-hole.net | bash
However, I made a couple of settings that are worth mentioning:

a. The predefined list of upstream DNS providers does not yet include Cloudflare which I found to be the fastest of the lot. Hence, it would be worthwhile to use the custom option and enter the Cloudflare DNS Server IP addresses of 1.1.1.1 and 1.0.0.1.

b. The other part of the equation is setting up the home equipment to use the local DNS server. In case of Asus routers, this implies changing the DNS Server IP address to the Pi-hole one, not only on the WAN page (under WAN DNS Settings) but also under LAN > DHCP Server > DNS and WINS Server Setting. Make sure that there are no other IP addresses present in either of the pages. You could also run the DHCP server on Pi-hole, in which case the latter setting is not needed. However, since I use the router-assigned IP addresses for other functions (eg. VPN), I prefer to have the DHCP server running on the router itself.

2. qBittorrent

qBittorrent has been my preferred Bittorrent client for quite some time with it being open-source and having proper support for proxies as against Transmission. It can be installed easily using APT, though I prefer the headless route.

sudo apt-get install qbittorrent-nox
My primary endeavour was to have the downloaded files ready on the USB 3.0 hard disk connected to my router (and thus acting like a NAS) while minimising the read-write operations. Since it is not a great idea to write to the SD card running the client, I decided to plug in an old 32 GB pen drive to act as the "working folder" by adding it under Downloads > Hard Disk > Save files to location.

The next part was to add the network drive as the final resting place by entering its address under  Downloads > Hard Disk >  Copy .torrent files for finished downloads to. This necessitates mounting of the network drive within Raspbian on boot which can be accomplished by editing /etc/fstab with these details:

mount -t cifs //xx.xx.xx.xx/folder /media/NAS -o rw,vers=2.0,username=abc,password=xyz
where,
xx.xx.xx.xx -> LAN IP address as configured on the router running the Samba server
folder -> Path to the folder on the network drive that needs to be mounted
/media/NAS -> Path on the Pi where the network drive is to be mounted

In my case, I had to specifically mention the SMB version (2.0), without which the mounting would fail as well as the rw argument to be able to write to the device. Also. it is a good idea to update the cifs-util package from APT prior to editing the fstab file, as mentioned above.

Finally, to cover for unexpected reboots, it is preferable to have qBittorrent autostart which can be accomplished using systemd. First, create the startup script using:

sudo nano /etc/systemd/system/qbittorrent.service
Next, enter its contents as follows:

[Unit]
Description=qBittorrent Daemon Service
After=network.target
[Service]
User=pi
ExecStart=/usr/bin/qbittorrent-nox
ExecStop=/usr/bin/killall -w qbittorrent-nox
[Install]
WantedBy=multi-user.target 
Lastly, enable the script.

sudo systemctl enable qbittorrent
3. pyLoad

The final part of the exercise was to set up a download manager. I had briefly given thought to JDownloader but decided against running JRE just for it. Hence, I opted for pyLoad instead. The tutorial listed over here works fine for the most part but needed quite some tweaks along the way. For the sake of completion, I will list all the steps in brief.

1. Create system user for pyload

sudo adduser --system pyload
2. Edit /etc/apt/sources.list to be able to install the dependencies. For Raspbian Scratch, the source URLs are as follows:

deb http://mirrordirector.raspbian.org/raspbian/ scratch main contrib non-free rpi
deb-src http://archive.raspbian.org/raspbian/ scratch main contrib non-free rpi
3. Update package list and install dependencies.

sudo apt-get update
sudo apt-get -y install git liblept4 python python-crypto python-pycurl python-imaging tesseract-ocr zip unzip python-openssl libmozjs-24-bin
sudo apt-get -y build-dep rar unrar-nonfree
sudo apt-get source -b unrar-nonfree
sudo dpkg -i unrar_*_armhf.deb
sudo rm -rf unrar-*sudo apt-get update
sudo apt-get -y install git liblept4 python python-crypto python-pycurl python-imaging tesseract-ocr zip unzip python-openssl libmozjs-24-bin
sudo apt-get -y build-dep rar unrar-nonfree
sudo apt-get source -b unrar-nonfree
sudo dpkg -i unrar_*_armhf.deb
sudo rm -rf unrar-*
4.  Create symlink to get "spidermonkey" working. In my case, I received a "File exists" message for the symlink.

cd /usr/bin
ln -s js24 js
5. Unlike in the linked tutorial, I had to first switch to the stable branch before I could initiate the pyLoad setup. This is done as follows:

cd /opt
git clone https://github.com/pyload/pyload.git
cd pyload
git branch -r
git checkout stable 
 6. The next step, as per the linked tutorial, should have been the initiation of the pyLoad setup using:

sudo -u pyload python pyLoadCore.py
However, doing so produced the following error: "ImportError: No module named pycurl". Hence the next logical step was to install pycurl:

sudo pip -v install pycurl --upgrade
This in turn resulted in the error: "InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-IsWfyN/pycurl/". This was resolved by:

sudo apt-get install libcurl4-gnutls-devpip
 As you can now guess, this in turn resulted in yet another error: "Failed building wheel for pycurl" which was remedied as follows:

sudo apt-get install libgnutls28-dev

After all this effort, I was finally able to install pycurl using the command mentioned previously...

sudo pip -v install pycurl --upgrade 
...and execute the pyLoad setup using a slightly shorter command:

 python pyLoadCore.py
The final tweak was to get pyLoad running on boot with the commands executed in a manner similar to what has been already covered for qBittorrent.

sudo nano /etc/systemd/system/pyload.service 
[Unit]
Description=Python Downloader
After=network.target
[Service]
User=pyload
ExecStart=/usr/bin/python /opt/pyload/pyLoadCore.py
[Install]
WantedBy=multi-user.target
 sudo systemctl enable pyload.service
Beyond Home

The benefits of this setup can be extended beyond the home network, though a lot depends on the vagaries of the network setup.

Pi-hole can be put to use on external networks by accessing the home network over OpenVPN, though speed and latency might be factors to consider. It can also be setup as a Public DNS but it is extremely risky and not at all recommended.

qBittorrent and pyLoad can be simply accessed using the IP address and port, provided they have been setup to be accessible from outside the LAN. For dynamic IP addresses, the Dynamic DNS (DDNS) option available on most routers can be put to use and my suggestion would be to pick up a cheap $1 domain from NameCheap for this purpose. However, if you happen to be under a multi-layered NAT network under ISP control like me, then there is no option other than to pay for a static IP for public access.

Thankfully, there is a last resort to access the Pi over a public network. The licensed copy of RealVNC that comes with Raspbian offers Cloud Connect that enables one to remotely control the OS and thereby all applications on it. It is quite cumbersome to use if your intent is to only load some links on qBittorrent or pyLoad, but it is better than nothing.

Thus, the Pi can be extremely useful even when used in a rather sedentary capacity and you grow to appreciate the efforts that everyone has put in to make this possible.

Sundry #11: Name Me!

I always find it worthwhile to enrol for contests that don't take more than 10 minutes to complete an entry. Sometimes, I end up winning which makes it a bit more worth my time. A while back I happened to turn in a couple of entries for the naming of a transport management system for employees. I happened to come across it today and in hindsight, the entries seem wacky and tacky in the same breath. Even then, as some wise person would say, it is the thought that counts. In that vein, I put forth my entries, as submitted. Who knows, it might just inspire someone to something altogether different.

ENTRY #1:


Name:
Salvahan

Idea behind the name:
The name is a portmanteau of 'Salva' and 'Vahan'.

Salva is the neuter-plural second declension of the latin adjective 'salvus' meaning safe, sound, healthy. Besides the English word 'safe', its descendants include 'sauf' in French, 'salv' in Romansh, Catalan and 'salvo' in Italian, Spanish; all of which convey the same message of safety that is in accordance with the objective of establishing this transport management system.

Vahan refers to a vehicle in multiple Indian languages, primarily Hindi, but also in other Indian languages like Marathi, Bengali, Punjabi, Kannada, Telugu with minor variations. In combination with 'salva', the name can be conceived to be a reference to 'safe travel'.

Logo:
The open but encompassing palms are a universal indicator of care and safety. At the same time, they closely mimic wings indicating smooth and fast transportation. The car being lodged between the palms indicates 'safe travel', thereby depicting the suggested name. The red smile stretching from one headlight to another not only expresses satisfaction but also indicates 'end-to-end' transportation between source and destination, viz. between home and office.

Bonus (Abbreviation):
Each letter of the suggested name can be expanded to capture the intent of the transportation system.
Safe
And
Likeable
Vehicle
Assisting
Humans
Ambulate
Nicely

ENTRY #2:

Name:
transME!

Idea behind the name:
The name can be construed to be an abbreviation for Transport Management for Employees. On its own, the prefix ‘trans’ means across or beyond but works well as a reference to ‘transportation’. The capitalized ‘ME’ in the name is meant to invoke the personal nature of the transport system. Together with the exclamation mark (!), the word can be pronounced akin to ‘transmit’, indicating a sense of conveyance.

Logo:
The logo is primarily designed to capture the name in a stylized fashion. The word ‘trans’ in grey and its overlap with the road is meant to evoke a sense of ‘rubber on road’. The letter ‘M’ is depicted using the headlights of a car as it moves within the contours of the road, thereby conveying the purpose of the system. The letter ‘E’ represents points of interest along the road while the exclamation mark is meant to convey a sense of excitement.

Variation:
Depending on the availability of the name, it can be adjusted to ‘transMET’ using the same logo. The idea then would be that it refers to transportation across the metro.

Musing #54: Impact of standard deduction in FY2019



The introduction of standard deduction in FY2019 lieu of transport allowance and medical reimbursement is unanimously portrayed as being beneficial to employees, at least by HR personnel. To a large extent that is true, even though the mention of the additional 1% education cess is conveniently omitted.

However, I had a query from a lesser financially inclined colleague of mine about the extent of benefit  that this change brings about. Considering my past example of helping out colleagues and my interest in economics and taxation, I decided to get cracking on preparing a spreadsheet capturing the difference in taxation in FY2019 over the past financial year based on these specific changes. It is a simplistic model created in a few minutes for the purpose of understanding. It considers the taxable income to be the income post all exemptions apart from the ones that are part of the subject matter.

As can be seen by the graph, benefit is a subjective consideration but it is helps to be an optimist. The crossover happens at ₹12,64,000, so I assume a large proportion of the population would be happy about the change, especially if they couldn't produce the necessary medical bills in the past years for reimbursement. The maximum benefit of ₹1070 is, of course, at a taxable income of ₹5,40,000 which would have been in the 20% bracket in FY2018 compared to the 5% bracket in FY2019.

The spreadsheet, formatted for Google Sheets can be accessed here.

Review #52: Tale of three (make that five) 3-in-1 cables


Cables are like humans, more than one can imagine. Looks can be deceiving and it is what's inside that matters. However, one can only perceive what one can see and hence the truth lies largely concealed. Thankfully, that is where the similarities end since marketing buzzwords like "gold plated", "tinned copper", "braided nylon" wouldn't really work well as complements for humans.

My tryst for the holy grail of cables started some time back when I started off with the Flome 3-in-1 cable, which, for the record, left me thoroughly disappointed. I have resigned myself to the fact that as long as reputable brands don't get in to the game, the possibility of expecting the ultimate phone charging cable to come from no-name brands in China is as large as catching the unicorn at the end of the rainbow. However, that hasn't deterred me from trying.

Since my last look at charging cables, I have added a couple more 3-in-1 cables, one from Baseus and another from "Fake Mi". The Baseus brand has proliferated quite a bit and I had my first go at it when I purchased a tempered glass for my iPhone. As it turned out, the mention of glass for the product was an euphemism but even then, the brand gets full marks for design and half for deception. I had a good experience with Mi's 2-in-1 cable which I had received with the Mi Power Bank Pro and although there is no mention of a 3-in-1 cable on Mi China's website, I went along for the ride by placing an order for the "Fake Mi" 3-in-1 cable. In this case, it was better to judge the cable by its cover since the package was branded as "Zaofeng" but the product could easily pass off  as an official Mi one.

Along with these three "the last cable you will ever need" cables, I have roped in two "not so in name but in function" pseudo 3-in-1 cables in the form of the Mi 2-in-1 and the EasyAcc Micro USB cable. In case you are confused, then don't be, as technically any Micro USB cable can be used as a Lightning or Type-C cable with the help of adapters. Sure, you don't get the official certifications, but it can get the job done as far as charging is concerned. In this case, the adapters came from the cannibalisation of other cables. After all, all's fair in love, war and charging.

Here's the fate of the contenders after being put through the trial with an Anker PowerPort 4 charger.


It is easy to draw some quick observations/conclusions from the above.

  • As expected, none of the 3-in-1 cables are up to much good, though the Baseus one seems to be the best of the lot. The finest option yet, as far as charging goes, is to get a good quality Micro USB cable and then use adapters to switch between devices.
  • The adapter quality can affect charging as can be seen by the performance difference of the Lightning one between Flome and Zaofeng. They are available for a few cents and can be jerry-rigged to function like a 3-in-1, though I presume at some point someone will release adapters with clasps. Cannibalisation from existing cables is always an option.
  • It is not a co-incidence that the shorter cables are usually the best. You should get a cable that is only as long as you need it to be. As I had mentioned previously, the longer they are, the easier they fail.
  • While not visible in the table above, the iPhone current draw was markedly different from the Mi devices. While the Mi devices charged flat out at the same current level irrespective of usage, the iPhone switched between 0.9-1.7A  depending on how the device was being utilised. I could draw the maximum current only by recording in 4K. This indicates that the iPhone maintains a preset charging rate for the battery while utilising additional current draw from the charger for on-screen activity. I guess these benefits come through the utilisation of much more expensive power management ICs.