My life in Year 2020

By | Editorial

The year 2020 might be a lot for many people. Here is my summary for the Year 2020.

Nothing significant happened in the month of Jan and Feb. In March 2020, just two days before lock-down was imposed in Maharashtra, India, my main working machine, MacBook Air decided not to power itself on. It was very distressing situation for me, as at the time that was the only machine which I use exclusively for work related activity, be it development or resolving day to day client queries.

At the time, I had Intel NUC and an Samsung Laptop working as development and production server for my business activities, which I never intended to use as my work machine. But I tried to up working station by setting up Intel NUC in 10 hours.

Although the very next day I found a shop which can repair MacBook Air. I had no intention of giving MacBook Air to Authorized repair center as I heard a lot of horror stories about the inefficiency about them not delivering the machine on time[1] and overcharging the customer by providing wrong information about the fault[2].

The local repair shop repaired the laptop the very same day within 8 hours and didn’t charged kidney for repair. I was happy that I got my work machine back. The most shocking news came after reaching home after collecting MacBook air that a Lock-down will be announced in state from very next day.

In upcoming few days, a nationwide lock-down also got announced. The major problem while having this was that a product require can not be procured either via local shops or via online selling platforms. One of the water pump also gave up during this period and thanks to backup water pump, all was set to go.

This all set me thinking what if my machine give up and if there is an urgent request from the client? The answer was that I will have a lot of problem. In the month of May, when my production server decided to die I had restless sleep for few days. I backed up the production server on Intel NUC and got it up running within 24 hours, thanks to an awesome technology called docker :)

This sudden death of main server boosted my thinking of having multiple point of backups. So when the lock-down eased I’ve done following :

  1. Increased RAM of Intel NUC from 8GB to 16GB
  2. Purchased a Raspberry Pi 4 8GB model for backup workstation
  3. Purchased additional backup disks and have backup on all these backup disk.
  4. Started Investing in Solar Backup.(40W at the time of writing)
  5. Having backup routers.

From July 2020, I start getting lots of request for Online admission system, which was almost like ready for me. The most important part was recording the payment activity as client were not inclined towards integrating payment gateway(as of writing this article the clients are now ready to integrate the payment gateway as transaction reference for NEFT, UPI are very notorious which can appear differently in band statements of Payee and Payer.) This goes on till Dec 2020. In the meantime I shifted all my Evernote data to Joplin, and sync it across devices using Local Web DAV server.

Also I tried unsuccessfully the roof top gardening since Mar 2020, and I think I am not good at it. But the garden is yielding a lot of Tulsi herbs lately which I never planned. So let go with whatever grows without any problem :)

References:

[1] Tweets by Rajesh Pandey (https://twitter.com/ePandu/status/1295345475403489280)

Reference: Bad after service by Apple in India (Credits : Rajesh Pandey (https://twitter.com/ePandu)

Reference: Bad after service by Apple in India Tweet Credits : Rajesh Pandey https://twitter.com/ePandu

[2] Rants by Louis Rossmann on his channel  (https://www.youtube.com/user/rossmanngroup)

How to Get M5Stack Battery Status with UIFlow 1.3.2 MicroPython

By | Coding Laboratory, Python Code

Recently I’ve got my hands on the M5Stack Core device. This device, not only brought possibilities of awesome ideas, but also bring me close to the world of MicroPython. For those who are unaware, MicroPython is software implementation of Programming language largely compatible with Python 3. In short, MicroPython is Python Compiler which can run on Microcontroller.

In this post, we will use MicroPython’s “machine” library for accessing i2c bus of the M5Stack Core. The battery circuit of M5Stack core is composed of IC IP5306, which provides i2c interface at 0x75 address with Battery Percentage of 0%, 25%, 50%, 75% and 100%.

To get started, UIFlow 1.3.2 firmware need to be flashed to the M5Stack Core device.

Flashing UIFlow 1.3.2 and connecting the M5Stack device in USB Mode

You can watch video till (2 Minutes 5 Sec) https://www.youtube.com/watch?v=Y9pOWgsNgKk for Flashing and connecting the M5Stack device in USB Mode.

Running Program

While device is connected with your Computer/Laptop in USB Mode, run UI Flow Desktop IDE. It will prompt for Connecting the IDE with device. Set the correct com port and you should be good to go for running the program. Select Python Mode and use the following code to access i2c bus and get the device’s battery status

Run the code and voila! you can now get battery statistics on the screen.

Create a Database Connected WebApp (Part I)

By | Django

In this post we will install MySQL connector for Python for getting started with Database connected Application on Django.

On MAC OS X, following additional steps need to be done for installing the Database connector, others can skip directly to Installing MySQL connector for Python.

First we need to install mysql-client on the system, so that the MySQL driver can be installed properly using pip. To do so, install homebrew if not installed. Once homebrew is installed, install mysql-client binary by using following command

brew install mysql-client

It will install mysql-client on your system. To make mysql-client available over terminal, add the following to your .zshrc or .bashrc file.

export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export PATH="/usr/local/opt/mysql-client/bin:$PATH"

Also add the following environment variable in your .zshrc or .bashrc file for SSL binary which get installed with mysql-client binary

export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

Now restart your terminal, and you will be good to go.

Installing MySQL Connector for Python

Install MySQL Connector by passing following command to the terminal.

pip install mysqlclient

In second part, we will use mysqlclient package to connect our Application with the database.