05 September 2020

Keyboard cleaning

The good thing about freelancing is that one gets a good amount of spare time to relax the eyes and go for a digital detox. Add to that a global pandemic, and you get to learn some new things.
I decided to open my keyboard which had been gathering dirt for many years. Here's the "before" picture.


Opening it up showed how much dirt had accumulated over the years. But I also noticed that the reason that the keys didn't have a smooth movement when pressed down was not the dirt. It was because they had to slide down the plastic, and there was no lubrication.


This is the membrane the keys push down. It's a "dome switch" which completes the circuit when the finger presses it down.


The circuitry under the domes. I was surprised at how minimalist it is.


A word of caution. When removing the key caps, don't use a compass or an object that exerts force at a single point, because it'll cut a groove in the plastic, as shown in the image below. It's better to use an old debit card or a professional key cap remover or even make one yourself using metal wires.


After cleaning and drying, the keyboard looks good as new!!! I wanted to apply some grease too, but some forums and comments warned against using grease or oil without first checking how it'd affect the plastic.


Don't forget to take a photo of the keyboard before opening it up. It'll help when you are putting back the key-caps.
Next time I'd go for either an ergonomic mechanical keyboard or a buckling-spring keyboard.

02 August 2020

When using the Hemmingway Editor, take the grading with a pinch of salt

For writing assignments, many people recommend the free Hemmingway editor, which help remove unhelpful adverbs, passive voice and in general, helps improve your sentences by making them simpler and easier to read. These features are really useful.

However, recently when I wrote some simple sentences, the editor said they were at Grade 11, when these were simple sentences that even a 7th or 8th grader could understand. So I did a little experiment. I chose sentences from two children's books and checked to see what Hemmingway editor would report.

First book: The call of the wild.

This is a version simplified for children, meant for 3rd, 4th or 5th graders. While most paragraphs showed a “Grade 5” or “Grade 6”, a sentence whose only fault was that it was too long, showed a “Grade 7” difficulty.


Moreover, copying and pasting the same sentence repeatedly, brought the score up to Grade 11. From there, it was not difficult taking it up to Grade 13. This is a serious flaw in the algorithm.






Second book: Chips (story of a rabbit).

This book has very simple sentences meant for children in the 2nd or 3rd grade. While most paragraphs showed grades ranging from “Grade 5” to “Grade 9”, some sentences gave these results:


Oddly, removing a few sentences brought it to Grade 10.



Removing more sentences pushed it to Grade 11.



By repeating the same sentence, I could push it to Grade 14.


I've written to the creators of the editor, showing them these examples. Hope they'd correct it soon. Meanwhile, writers should take the gradation score with a pinch of salt. The editor is still a good method of evaluating your text for the other features it provides.

01 July 2020

Repairing grub in a dual boot system without using Boot Repair

After installing Windows, installing Ubuntu detects Windows and installs fine, giving you a dual boot system. But if you re-install Windows or install another OS on another partition, chances are you'll get a MokManager error that looks like this:


Before attempting to repair Grub2, go to your BIOS (as shown in this page) and select the grubx64.efi file or whichever efi file is relevant to your installation, and reboot. Chances are that the non-booting is just being caused because the computer does not know which efi file is safe. I think this happens due to secure boot being enabled, but please don't disable secure boot. Just specifying the correct efi file may help.

If it still isn't booting and you want to repair Grub2, follow the steps in this or this website. I had tried using Boot Repair, which worked nicely, but only once. So I now prefer doing it manually.

Steps:
1. Boot from a live CD or live USB which has the same Ubuntu version as your latest installed Ubuntu.
2. Use sudo fdisk -l and sudo blkid or GParted to determine which sda Ubuntu is installed on. Let's assume it's on sda4.
3. sudo mount /dev/sda4 /mnt
4. for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
5. If Ubuntu is on an efi partition (check using sudo fdisk -l | grep -i efi), mount it with sudo mount /dev/sda4 /mnt/boot/efi.
6. sudo chroot /mnt
7. update-grub (if this doesn't work, goto step 8. Else, step 10).
8. grub-install /dev/sda
9. update-grub. To locate and add Windows to grub menu.
10. If Ubuntu was installed in efi mode, run this: blkid | grep -i efi; grep -i efi /etc/fstab
11. Reboot the computer.

Even now, the "Failed to start MokManager" error may show up. Just go to BIOS and select the right efi file and reboot. Everything should work fine now.



09 June 2020

Removing malware from PDF's

Sometimes PDF files can contain malware. Although the techniques listed below are not a fool-proof guarantee of getting rid of malware, it can get rid of malware that's embedded in the metadata of PDF files.

First, confirm that the PDF has malware.

Now create the following bash script in a file named malwareRemover.sh:
(make sure you use a tab instead of spaces for the lines within the for loop).

#!/bin/bash
clear
for f in *.pdf; do
    echo "Removing malware from $f:"
    echo "-------------------------------"
    echo ""
    #---convert
    tempFilename="temp.ps"
    echo "Converting $f to $tempFilename"
    pdf2ps $f $tempFilename
    echo "Deleting $f"
    rm $f
    echo "Converting $tempFilename back to $f"
    ps2pdf $tempFilename $f
    echo "Deleting the ps file"
    rm $tempFilename
done


Change the permissions of the file and install ghostscript:
chmod +x malwareRemover.sh
sudo apt-get install ghostscript

Run it with all the PDF files in the same folder as malwareRemover.sh.
./malwareRemover.sh


If you are using Didier Stevens' tools, this script will help:

#!/bin/bash
clear
for f in *.pdf; do  
    echo "Scanning $f for malicious data:"
    echo "-------------------------------"
    echo ""
    #---scan
    python3 pdfid.py $f
done

echo ""
echo "How to interpret the info:"
echo "------------------------------"
echo "* Almost every PDF documents will contain the first 7 words (obj through startxref), and to a lesser extent stream and endstream. I’ve found a couple of PDF documents without xref or trailer, but these are rare (BTW, this is not an indication of a malicious PDF document)."
echo "* /Page gives an indication of the number of pages in the PDF document. Most malicious PDF document have only one page."
echo "* /Encrypt indicates that the PDF document has DRM or needs a password to be read."
echo "* /ObjStm counts the number of object streams. An object stream is a stream object that can contain other objects, and can therefor be used to obfuscate objects (by using different filters)."
echo "* /JS and /JavaScript indicate that the PDF document contains JavaScript. Almost all malicious PDF documents that I’ve found in the wild contain JavaScript (to exploit a JavaScript vulnerability and/or to execute a heap spray). Of course, you can also find JavaScript in PDF documents without malicious intend."
echo "* /AA and /OpenAction indicate an automatic action to be performed when the page/document is viewed. All malicious PDF documents with JavaScript I’ve seen in the wild had an automatic action to launch the JavaScript without user interaction."
echo "* The combination of automatic action  and JavaScript makes a PDF document very suspicious."
echo "* /JBIG2Decode indicates if the PDF document uses JBIG2 compression. This is not necessarily and indication of a malicious PDF document, but requires further investigation."
echo "* /RichMedia is for embedded Flash."
echo "* /Launch counts launch actions."
echo "* /XFA is for XML Forms Architecture."
echo "* A number that appears between parentheses after the counter represents the number of obfuscated occurrences. For example, /JBIG2Decode 1(1) tells you that the PDF document contains the name /JBIG2Decode and that it was obfuscated (using hexcodes, e.g. /JBIG#32Decode)."
echo "* BTW, all the counters can be skewed if the PDF document is saved with incremental updates."
echo ""

 

06 May 2020

Which conferences and journals allow pre prints on ArXiv and which don't?

ArXiv, TechRxiv (owned by IEEE) and HAL are pre-print repositories where scientific papers can be submitted as proof of precedence, so that the ideas do not get scooped. Especially when you are submitting a paper to a journal, it's better to put it on a pre-print repository, because the journal's review process can take very long and the process of making corrections and resubmitting can take many years until the paper finally gets published.
But there may be conferences or journals which may not allow authors to publish their work on pre-print repositories, because it would interfere with the double-blind review process.


These are conferences/journals which allow authors to publish on ArXiv:


These are conferences/journals that don't allow it:
  • KDD. Prior to 2019, KDD used to allow pre-prints on ArXiv.

I hope to update this page with more names of conferences and journals. If you know of any, please mention it in the comments.

02 April 2020

GMail's autocorrect messing up your email? You have our sympathies.

We don't allow children to drive cars, but somehow people think it's ok to allow a self-driving car on the road...an algorithm that has no clue about what the world is and no clue about what driving is. AI has a long way to go before becoming intelligent.

Similarly, GMail's team thought it'd be a great idea to autocorrect our words for us, without even highlighting the words it autocorrected. The result? I typed "presenter" in a sentence and in the next sentence when I typed "presenting", GMail discreetly autocorrected it to "presenter", giving the sentence a grammatical error which gave a bad impression to the reader. I noticed the error only after sending the email. The minimum GMail could have done was to highlight the word that had been autocorrected or to ask for my consent before introducing the feature. Google seems to need better engineers.

When I first heard that a person lost his job because of autocorrect correcting a word to "hash brown" when he emailed a colleague, I didn't actually believe it happened unintentionally. But after seeing how autocorrect messed up my email, that man has all my sympathies.

There are many such examples. Some of these may be fictional, but they do drive home the point.

Autocorrect can be switched off in GMail in the General Settings. I recommend switching off all of the AI features of GMail.

01 March 2020

IISc Open Day 29th Feb 2020

The Indian Institute of Science's Open Day is a yearly event during which the general public can visit the campus free of cost and every department exhibits some fascinating experiments or presents the research that students are doing there. Most of these are at the cutting edge of technology, so it's an excellent learning experience for everyone. The campus is so vast that even for someone arriving at 9am, it's hard to visit all the stalls and view all demo's and experiments. Of the many demo's, here are some:


Also known as Magic Mud or Oobleck, the video I took, shows how a person who inserts their hand slowly into the liquid is able to, but the person who jumps on it does not sink. The liquid is just a 1:1.25 ratio mixture of water and corn-starch. The corn-starch doesn't dissolve in the water, and stays suspended as a non-Newtonian fluid. If you are gentle, the liquid parts and allows solids to enter. If you punch it or run over it, if feels like a solid object. I took a thin, sturdy leaf stalk and thrust it into the liquid, but it wasn't able to penetrate. So surface area didn't matter. I'd like to have seen if a knife edge's surface area would be able to penetrate. When I suggested it could be used for bullet-proofing, the organisers said that's one of the applications considered for this fluid. I jumped on it, ran on it and even punched it. Solid as a rock! Be gentle, and it's cooperative. Made me realise that many people behave like non-Newtonian fluids too. :-)



Studies are being conducted on the structure and role of certain proteins which play a role in how ambient light affects the body's sleep cycle.



This was an actual brain-machine interface demo where the person wearing a skull-cap that noted his brain's gamma waves, was able to control a circle on the screen and make it move left or right just by using his thoughts.






Hardware relics from the past.



The presence of such ponds and greenery in an institute campus speaks a lot about the quality and care that goes into maintaining it.



This is a pacman game where they train a deep neural network using the visitor's hand gestures that indicate up, down, left or right motions. The visitor then uses these gestures to move pacman on the screen and play the game of escaping the ghosts. Cumbersome, but interesting.



A functional hydroponics setup that's 90% more water-efficient than traditional farming. The nutrient-enhanced water mist gives nutrition to the roots.




Just a car that follows a trail using infra-red light.




Research being done on mice to understand how the hippocampus stores information on spatial recognition. The brain has grid cells, head direction cells, boundary detection cells etc.




A working demo of the Tesla tower. The CFL bulb glows due to wireless electricity (ionization).




A demonstration of how Tsunami waves are formed, how the wave appears to recede just before the main wave strikes and how barriers may help push the wave backward to cancel out incoming waves; demonstrated by a guy who appears to be infected with the Corona virus :-).




One of the e-rickshaws at IISc that the public could use for free. They are labelled "Transvahan", which initially gets interpreted as "Transgender vahan", but it's actually "Transport vahan". There's very few of these vehicles, and most of the time I saw them transporting water and food. It would've been nice if there would be plenty of bicycles that'd help traverse the vast expanse of the campus during such events. They did a really good job of arranging for plenty of good quality drinking water sources all over the campus.

There were so many many more stalls and demo's that I didn't mention just for the sake of brevity. Overall, a really good experience. Open Day is a must-visit for science-lovers.


04 February 2020

Configuring LiClipse to run Anaconda or Miniconda

I'll have to admit, it is indeed better to use a virtual environment when dealing with Python. If you mess up your native Python, the system won't work properly. But the problem with using Python this way, is that there may be packages that aren't available for install via conda for particular versions of Python. That gets very annoying.
This article explains how to setup LiClipse to work with Anaconda or Miniconda. Specifically, Miniconda.

Open LiClipse. In the main menu, goto Window > Preferences.
Type "interpreters" in the search box.
Click "Python interpreter".
Click the "Browse for Python/pypy exe" button.
Close the first window that opens and you'll see this:


Browse to your Miniconda folder and select the python3 or python file in ~/miniconda3/bin.

In Interpreter Name, enter a name of your choice: MinicondaPython3.7, for example.

One more window opens up. Click Ok.

Now (assuming your Python project is open), in the main menu of LiClipse, select Run > Run Configurations.
In the left column, right click on Python Run. Select "New Configuration".

Under the "main" tab, choose your project name and specify the main file.
In the "interpreter" tab, select MinicondaPython3.7.

That's it. Install any necessary Python packages using the conda command, and you are ready to run your project!

02 January 2020

Clearing swap space in Ubuntu

When having two large applications open in Ubuntu can cause slow performance because of swapping memory from hard disk to RAM, it leaves one perplexed to see swap space still being used after all applications are closed.



I investigated this a bit more to find out that it's better not to mess around with the kernel's swappiness parameter, and that using the "top" program or other scripts is not really necessary. You don't even need to use vmstat to check the si and so columns to see if swaps-in and swaps-out are happening.

There's a far simpler option that promptly copies all swap memory back to RAM.

sudo swapoff -a; sudo swapon -a


I opened a large application by the time I took the screenshot, hence the greater usage


Enjoy!

01 December 2019

Converting webp files to more familiar formats in Ubuntu

With Google's efforts at better image compression, came an acquisition that gave rise to the webp image format. Although it was announced in 2010, I was surprised that Ubuntu 16.04 didn't support it natively.
To use it with Gimp, you need one of the latest versions. Good news is, ImageMagik supports it if you install webp. Once installed, you can batch convert your webp files to png too. Two simple steps.

To install:
sudo apt-get install webp

To convert all webp files in a directory to png:
find ./ -name "*.webp" -exec dwebp {} -o {}.png \;

To delete the original webp files after converting to png (though I'm sure there has to be a better way):
find ./ -name "*.webp" -exec dwebp {} -o {}.png \;; find . -type f -name '*.webp' -delete

12 November 2019

The precious thing frequently stolen from you: Sleep



More than seven years of noting observations and trying to correlate the causes of severe eye strain and poor vision, led me to the root cause: The lack of uninterrupted deep sleep for seven to eight hours every night. The funny part is, that if you ask anyone if they are getting enough sleep, they'll immediately say "yes", even though they are actually getting only around four or six hours of bad sleep. Even I said "Yes" to the first doctor who asked if I was getting sufficient sleep (when my eye strain was at its severest and I was getting only 4 hours sleep).

There are bodily repair processes that do not get completed if deep sleep is interrupted before 8 hours, and the debt accumulates over the years. I've confirmed this multiple times. There's a huge difference between "resting" and "8 hours uninterrupted sleep". I have good reason to say it's the lack of sleep and lack of proper nutrition that end up giving people weak vision and a lot of other health issues. Six hours or four hours sleep is not enough. The people who have been insisting for all these decades about seven to eight hours, were always correct.

Did these affect you?
  • Children being woken up early for school.
  • Children being told to stay awake late or wake up early to study during exams.
  • Children staying up late to watch TV or play video games etc.
  • Adults being forced to work late due to deadlines.
  • Having to use an alarm clock to wake and not be late for work or to cook breakfast.
  • Doctors being woken up for emergency cases.
  • Family members of patients being woken up during a hospital stay.
  • Taxi drivers and auto-rickshaw drivers losing sleep to make ends meet.
  • Phone calls and extraneous noises when sleeping.
  • Health issues that cause people to wake up once or more at night.
  • Improperly cooked food or adulterants or burnt particles in food affecting the digestive system and causing sleep loss.

Sleep Requirements researched by the National Sleep Foundation.

Is there anything we can do to change the culture of sleep loss?
  • Insist on properly cooked, unadulterated, un-burnt, healthy food and water at home, canteens and restaurants.
  • Allow for flexible work cultures and work-from-home options.
  • Allow schools, colleges and offices to begin at 11am for some people (night-birds) and at 9am for other people (larks). 
  • Spread awareness of this at school level and get a buy-in from parents and employers.
  • Arrange for better work shifts and recruit more people to handle workload.

We need to create ways to make this happen in a cut-throat rat-race. We've been through centuries of brainwashing about the heroics of equating hard-work with not sleeping. "How many people's health are you permanently willing to ruin in order to make a living?". Losing sleep even occasionally is not good. Don't allow people to nudge you into it. Don't nudge children into it.


There's no heroism in losing sleep.



Healing eye strain: https://nrecursions.blogspot.com/2018/03/eye-strain-is-not-caused-by-digital.html


02 October 2019

Copy pasting and clearing screen in the Ubuntu terminal

Copy pasting with Ctrl+c and Ctrl+v works fine on the MacOS terminal, but doesn't work in Ubuntu. I assumed this may be some security feature or because Ctrl+c is the age-old command for an interrupt, so I didn't give it much thought and just used the mouse to copy paste.

But today it just struck me that I should find out the real reason, and viola! It's just a matter of pressing Shift.

To copy:
Shift+Ctrl+c

To paste:
Shift+Ctrl+v

and as a bonus:
To clear screen on the terminal:
Ctrl+L

This clear screen also supposedly works in Matlab, MySQL etc., though I can confirm it works on the Python terminal.

01 October 2019

Aquaplaning, and how to avoid it

Long back, I was curious about why Formula One racing cars had such "smooth" tyres. The racing slicks. Turns out, when there's no water on the road, it's actually more beneficial for more of the tyre to make contact with the road and provide more grip. Having grooves would lessen the grip. When the road is wet however, the grooves/treads on the tyres are absolutely necessary to prevent aquaplaning. The rain tyres allow water on the road to enter the grooves, thus allowing the remaining part of the tyre to make contact with the road and give better grip. Without this, the car would go completely out of control.

Exactly the same principle is used when designing footwear. The process of cutting such slits is called Siping. Recently, I purchased a new pair of rubber slippers and noticed that it didn't give any grip on wet surfaces. I even slipped and fell down once.

On examining the sole, I realized why.


No grooves.


So I took a knife and cut out some crude grooves all along the front, mid and back portions of the slippers. Just these crude grooves were enough to give a good grip on wet surfaces. I also wrote to the company, chiding them for not considering this basic design element. They wrote back thanking me for the valuable feedback and stating that they were the number one footwear brand in the country. The number one brand? With a safety aspect like this disregarded, I definitely don't consider them number one, but I'd be willing to consider it if they make the necessary design changes.

Update: The horizontal groove I made was a mistake. When the slippers flex when walking, the groove deepens and causes the rubber to break at that point. So the better option is to either cut grooves vertically or just buy new slippers with better soles.


02 September 2019

Realtime plotting in Python

If you intend to create plots/graphs with Python, your first choice may be Matplotlib. Don't use it unless your plots are extremely simple and isn't expected to grow more demanding with time. I used Matplotlib for realtime graph plotting for a really tiny graph and it was disappointingly slow. Moreover, it required installation of Python 3.6, which wasn't available readily for Ubuntu 16, and caused even more problems.

Then I came across PyQtGraph, and was impressed by the super-fast plotting speed and the mind-blowingly impressive variety of graphing functionalities. Really. You gotta see this.

Install it using: pip install pyqtgraph
Run the examples with: python3 -m pyqtgraph.examples
And prepare to be impressed!!!




I've come to understand that the rendering is quick because the underlying code is in C/C++ and the Python bindings are merely meant for invoking that code.


Still, even though the graphs are very impressive, the non-linearity of the code examples and the lack of code comments make it really hard for a newbie to understand how to get a basic graph running.

Here's where I help. After spending an extraordinarily long time figuring it out on my own, I've created a simple, basic example with which you can create a realtime graph. Hope it helps...


import time
import random
import pyqtgraph as pg
from collections import deque
from pyqtgraph.Qt import QtGui, QtCore

class Graph:
    def __init__(self, ):
        self.dat = deque()
        self.maxLen = 50#max number of data points to show on graph
        self.app = QtGui.QApplication([])
        self.win = pg.GraphicsWindow()
       
        self.p1 = self.win.addPlot(colspan=2)
        self.win.nextRow()
        self.p2 = self.win.addPlot(colspan=2)
        self.win.nextRow()
        self.p3 = self.win.addPlot(colspan=2)
       
        self.curve1 = self.p1.plot()
        self.curve2 = self.p2.plot()
        self.curve3 = self.p3.plot()
       
        graphUpdateSpeedMs = 50
        timer = QtCore.QTimer()#to create a thread that calls a function at intervals
        timer.timeout.connect(self.update)#the update function keeps getting called at intervals
        timer.start(graphUpdateSpeedMs)   
        QtGui.QApplication.instance().exec_()
       
    def update(self):
        if len(self.dat) > self.maxLen:
            self.dat.popleft() #remove oldest
        self.dat.append(random.randint(0,100)); 

        self.curve1.setData(self.dat)
        self.curve2.setData(self.dat)
        self.curve3.setData(self.dat)
        self.app.processEvents()  
       

if __name__ == '__main__':
    g = Graph()

   
   

28 August 2019

Unable to signout / logout of GMail?

The fact that GMail used via the mobile web browser has such a silly bug that didn't get fixed even after I reported it thrice, is a sad state of affairs.

Anyway, if the signout menu isn't appearing, simply type "google.com" in the address bar and you'll see a signout button at the top right corner.

That's it!

07 August 2019

The 10X programmer


Can you call yourself a 10X programmer if you get work done ten times faster than other programmers or can do the work of 10 average programmers?
I don't think so.

There have been some discussions recently about 10X programmers, where some say it's a myth, some say it isn't, and some examine the logic of it. Even a CEO I knew, used to wish for a 10X programmer. He was completely bought into the concept, thinking that such programmers existed at top companies.

Here's my take on it:

Yes, there are programmers who can get work done faster than others.
Yes, there are programmers who are more expert at specific languages and skills than others.


But are any of the above programmers 10X? Nope! 


The measurement of 10X is not done based on how quickly a product was delivered with minimal errors.

10X is measured over a long duration based on:
  • Whether requirements have been understood, documented and verified with the customer.
  • Whether the software architecture and design patterns have been subject to peer-review from experienced people and is as future-proof as possible.
  • Whether the software language and tools have been chosen based on careful evaluation, as per the requirements and anticipated changes.
  • Whether version control, test-cases, bug-trackers, continuous integration and quality checks are performed.
  • Whether the programmer and the team share a good chemistry and fit well into company culture.
Face it. It only makes sense to measure 10X over a span of many years. A programmer who delivers poorly planned code quickly may seem like a hero initially, but when (s)he gets hit by a bus or when more members are added to a team or when the client requests more changes and the software suddenly requires a complete overhaul, that's when you realize that the initial 10X advantage you thought you got (even in a startup), is actually much more costly than if you had invested time in ensuring the bulleted points mentioned above were fulfilled.

I've seen plenty of programmers and companies getting stuck with trying to deliver quickly and then ending up wasting more than double that time making up for errors and unaccounted factors. Moreover, working overtime, trying to be 10X can also get people burnt out with severe health problems; some of which may be irreversible.


Don't go for a 10X programmer. Go for good planning, documentation, execution and teamwork. 
That's where the real 10X is.


01 August 2019

Solving the MokManager mmx64.efi Not Found errors and the missing Mok menu problem

Until I used Ubuntu 16.04, I didn't have much of a problem with UEFI. Just the first time it was confusing and took a while to find the solution, but everything else, like third party drivers and VirtualBox worked without problems.

But when trying to install Ubuntu 16.04.6, the system wouldn't even start. It showed the below message and shutdown.

Unable to find mmx64.efi file:


Failed to open \EFI\BOOT\mmx64.efi - Not Found.
Something has gone seriously wrong.

It sounded like Russel Peter's Dad saying "Somebody's gonna get hurt real bad".

For a long time, searching the internet didn't yield a solution, but some posts mentioned renaming grubx64.efi to mmx64.efi. The trouble with that is, that if you try to rename the file in Ubuntu, it won't work. Ubuntu shows you a totally different filesystem. You have to go to Windows. In Windows, you won't be able to see all the files in the pen drive. It just shows you one folder into which you have to navigate into, find the grubx64.efi file and rename it to mmx64.efi.
Viola! You'll now be able to boot from the pen drive.

Funny thing is, after installing Ubuntu, you have to rename that file on the pen drive back to grubx64.efi (and you have to do it in Windows; not in Ubuntu), or else you won't be able to boot from the pen drive.



Need to set the Mok state after reboot but the screen never shows up:

When installing VirtualBox or the third party drivers in Ubuntu, the screen says that on reboot, you'll have to type a password to enroll mok.


You'll notice VirtualBox generating a private key for Mok

However, when you reboot, you are never presented with any such mok screen.
What you are supposed to do to be able to see the mok screen is this:
  • Go to BIOS. 
  • In the security page, select the option to "specify a trusted key".
  • Navigate to "Ubuntu".



  • Select "mmx64.efi", give it a name like "MokManager" or anything you like, save and exit BIOS and come back to BIOS again.


  • This time in the Boot screen you'll see new boot options. Select the "MokManager" option and move it to the top so that it boots first. Save and exit BIOS.


  • Now when you boot you'll see the Mok menu from which you can enroll the mok key that was generated by Virtual Box or the Ubuntu installer.

That's it. That's the secret of how to do MokManagement. There's no need of disabling UEFI. There's no need of disabling secure boot.

I just wish the OEM people and OS manufacturers came up with a standard which wouldn't require such complicated workarounds.



You could always send me a little chocolate from my Amazon wishlist to say thank you.

 

06 July 2019

Using dd instead of disk and partition cloners like CloneZilla or PartImage

The problem with applications like CloneZilla is that although they are excellent for disk imaging, they have very un-intuitive interfaces, the number of steps they make you go through is huge and they suffer from problems with UEFI when creating a USB version.

Linux's dd command on the other hand, is projected as being very dangerous and people say it's better to use something like CloneZilla just to be safe. But from what I've seen, as long as you type the command properly, dd is actually far more convenient than the other applications.

Here are some useful commands:

To compress and clone entire sda onto a folder on sdb or sdc:

*** Caution: Verify all the commands below before executing them ***
*** Caution: The folder paths and partitions will be different for you *** 

When you plugin the pen drive or external hard disk, it'll get mounted as sdb or sdc. Find out where it got mounted. Mine was in /media/ubuntu/Nav/ and it was in sdc, since sdb was the Ubuntu startup USB. Created a folder named "bkp" in Nav and:
sudo dd bs=1M if=/dev/sda | gzip > /media/ubuntu/Nav/bkp/backup.img.gz
Don't worry. Even though sdc and sdb are mounted on /media, which is the root folder (and hence you'd think it's part of sda), Linux knows that these are mounted filesystems, so it won't consider it part of sda.
Instead of using bs=1M, you could speed it up by checking what your disk buffer size is using sudo hdparm -i /dev/sda, and set that as the bs value. So if the buffer size is 8MB, set bs=8M.

If the disk was not automatically mounted, you can mount it yourself using:
cd mnt/
sudo mkdir bkp
mount /dev/sdc1 /mnt/bkp

Now take a backup
sudo -i
dd bs=8M if=/dev/sda | gzip > /mnt/bkp/backup.img.gz

Restoring sda is done via:
sudo -i
gunzip -k /mnt/bkp/backup.img.gz | dd of=/dev/sda


Taking a backup of sda means that even unallocated space gets backed up, and that can take very long (3.6 hours for a 500GB HDD). If you don't need a full disk backup and can manage with just the few numbered sda partitions, then just do a backup and restore of sda1, sda2 etc. To do that you'll have to also backup and restore a copy of the partition table as shown below.

You can take a copy of the partition table info using:
sudo sfdisk -d /dev/sda > my_partitions

Now create backups (these commands are a bit risky because you have to take care to not mess up the "if" and "of". Safer commands are shown below):
sudo -i
dd if=/dev/sda1 of=/media/ubuntu/Nav/bkp/sda1.img bs=8M
dd if=/dev/sda2 of=/media/ubuntu/Nav/bkp/sda2.img bs=8M

Restoring  the partition table info is done via:
sudo sfdisk --force /dev/sda < my_partitions

Restoring backups:
sudo -i
dd if=/media/ubuntu/Nav/bkp/sda1.img of=/dev/sda1 bs=8M
dd if=/media/ubuntu/Nav/bkp/sda2.img of=/dev/sda2 bs=8M


Okay, so the safer commands are:
sudo -i
dd bs=8M if=/dev/sda1 | gzip > /mnt/bkp/sda1.img.gz
dd bs=8M if=/dev/sda2 | gzip > /mnt/bkp/sda2.img.gz

Restoring sda is done via:
sudo -i
gunzip -k /mnt/bkp/sda1.img.gz | dd of=/dev/sda1
gunzip -k /mnt/bkp/sda2.img.gz | dd of=/dev/sda2

The "-k" helps avoid deleting the original gz file after it is extracted. The good part about these safer commands is that they also compress the backup, which saves you a good amount of space. I recommend taking backups of each partition separately instead of taking a full disk backup or directly backing up the entire sda, because having separate partition backups helps restore them separately too.


To wipe the first 1MB of any disk:

dd if=/dev/zero of=/dev/sdb bs=1M count=1

Here, the "b" highlighted in bold red should be changed to "a" or "c" etc., based on which disk's first 1MB you want to wipe. The partition information will disappear, so this command is useful when trying to re-purpose any disk. Once the command is run, just use GParted to create the partitions.


To write zeros onto the entire disk:

dd if=/dev/zero of=/dev/sda bs=4096

This is helpful when you want to experiment with whether dd works well for backups. I used this command to fill the disk with zeros, then installed Windows and tried backing up. The 500GB disk with around 20GB of data on the Windows partition got gzip backed up into 12GB. The high compression was because the rest of the disk was full of zeros.


02 July 2019

Ather. My review and first impressions on my first visit and test ride

I had been hoping to visit the Ather center at Indiranagar for a little more than a year. Was passing by today, so dropped in. I'm not a bike expert or enthusiast, so these are just my first impressions. I've also mentioned a lot of the questions I asked them and what answers I received. I haven't yet verified the veracity of their replies.



Took the bike for a test ride and noticed a lot of heads turning when they heard the unique "whoooieeee" sound of the motor :-) The disc brakes can bring the bike to a halt quite fast, and can make the bike skid a little. When this happened, the noise irritated a dog, and it began barking and chasing me. The acceleration from the bike was so good that the dog couldn't keep up. I would've never escaped this easily on my geared bike :-)

The good
  • The bike looks smart from the front and side.
  • Good acceleration.
  • Good quality rubber belts (they say it's reinforced with carbon-fibre and can last 60K to 90K kilometer).
  • Low center of gravity, so could ride it at even 3 kmph.  
  • A reasonably pleasant experience when riding.
  • Good road grip and balance.
  • Reasonable turning radius.
  • Good control.
  • In general, body parts seem to have a reasonably good quality.
  • Reasonably smooth ride. 
  • Hassle-free test ride process, polite, intelligent, helpful and down-to-earth people.
  • Indicator lights switch off automatically when a turn is detected or after a certain number of seconds.
  • Large boot area to keep the helmet, with extra pockets for keeping documents etc. below the seat.
  • There don't seem to be parts that would need frequent replacement like in petrol bikes. 
  • The dash provides info about tyre pressure (okay, this is super cool!).
  • Headlight seemed bright enough.
  • Alloy wheels and tubeless tyre.
  • The onboard map was a fabulous feature (though I could do without it).
  • The functionality to move in reverse was superb! Not really necessary if you have strong legs, but useful.
  • They show you details of your test ride with some lovely graphics. 

(I'm not entirely sure this was the ride I took, because it certainly didn't feel like I rode for 31 min, and the screen showed that I didn't go on 80 ft road, but I actually did, immediately after the dog-chase).


The bad
  • The back area of the bike is kind-of exposed and high above the wheel, which makes it look ugly.
  • The motor sound is loud and annoying. Some kind of a silencer would be nice.
  • The physical buttons are a bit hard to reach with the thumbs. 
  • When moving on a road hump, the rear suspension clangs, which makes it feel like as though a helmet in the boot is getting jostled around even if there's nothing in the boot.
  • The company knows your exact travel path. Data privacy issue.
  • The handle grip felt too hard and straight. I'm not sure if it was the fact that it was too thin, that made me need to grip it harder or just the hardness, but it felt uncomfortable for long duration use.
  • When the bike is driven with uneven speeds for a while, a fan turns on for cooling. The noise from it can be extremely annoying (As of Oct 2019, I hear they've made it less noisy).
  • Although the bike has an incognito mode, it gets disabled the next day and data about your ride is transmitted to the company server again unless you remember to disable it.
  • When using the key to lock or unlock the bike, the quality of the locking mechanism didn't seem as good as I would've expected from such an expensive bike. There was a certain amount of shakiness or some odd feeling that didn't lend it a perception of excellent quality (although you could say it was good-enough quality). The physical buttons also seemed to be of ordinary quality.
  • Slight chance of the bike being difficult on your back muscles due to the positioning of the handle, and the seat design.
  • At speeds below 20kmph, there can be a bit of a dragging/rough feeling, which is probably because of the rubber belt, but it's tolerable.
  • The headlight is always on. BIS regulation.
  • The seat locking system was unreliable. It should've just been a mechanism where you can push downward and the seat gets locked, but they designed it so that it needs to be dropped from a height of 1 or 2 feet, and I had to drop it multiple times until it got locked. A bit annoying even if practice makes perfect. 
  • I was not informed of what the procedures would be if I encountered an accident during the test ride.
  • If parked under the sun for too long, there's a good chance it could be bad for the battery. Heat is always bad for batteries.
  • The suspension was rather stiff, and they said they couldn't adjust it. It's designed that way to strike a balance between control and comfort.
  • If you aren't covered under insurance, the damage to parts or scratches fixing can cost you a bit more than the average bike.
  • Battery life: Will decrease with time. By the 5th or 6th year it may give only 25km on a single charge (this is what I was told by one person and another person said it'd be more than 25km), but the power of the drive won't be affected.
  • Many parts of the bike were quite pointy. A more curved design would look better (just my opinion).

Questions I asked and responses
  • Units of electricity consumed: Per charge, 3 units. Approx. Rs.20.
  • Charging via solar or inverter: Yes, but only if 1KW and can last for 4.5 hours.
  • Space at footrest for carrying gas cylinder or 20L water: Yes.
  • Doorstep servicing charge if not opting for Rs.8000 or Rs.6000 plan: Rs. 1500 to Rs.1800. 
  • Servicing interval: Every 5000km. Doorstep servicing.
  • Battery cost: Rs.35K to 45K (price is reducing).
  • Battery protection from water: Yes. Can survive complete submerging for 30 min.
  • Riding in water-logged road: Yes. Some dirt may get lodged between wheel area, but will come off after riding a while. Roadside assistance also available.
  • Assistance and servicing radius: Within Bangalore only for now. Plans to setup in Chennai and Hyderabad too.
  • Time for charging: For single phase AC, it takes 4.5hr (at your home) and for 3 phase DC (at Ather charging points), it charges at a rate of giving you 1km range per 1 min of charging.
  • RTO visit when buying bike: No need.
  • Exchange offer for old bike: No. They've considered it, but found it impractical. As of July 2020, Ather is actually offering a bike exchange!!!
  • Charging in apartment basement: Difficult unless you have reserved parking space. Their team can provide a fixed charging point for free for 20m from the electricity meter, but any extra length of wire you'll have to pay.
  • If company closes: Unlikely because they are backed by biggies and the demand for EV's is growing, but if a shutdown happens, they are legally obliged to continue offering servicing for 10 years.
  • Lithium availability: At least 10 years or more.
  • Charging stations: They plan to have one every 1.5km by end of one year.
  • Oiling and greasing requirement: No. Will be done during servicing.
  • Theft: Not easy to remove battery. If bike is stolen, when it's switched on, the location will be transmitted. Some parts like the license plate and mirrors can be removed by mischief-mongers.
  • Max weight: 165kg without loss of efficiency.
  • Insurance provider: Go Digit.
  • Cost of insurance: Rs.6000 for 5 years. First year is comprehensive insurance (bumper to bumper). Second year onward, third party insurance only. If you want comprehensive insurance, you'll have to pay Rs.1500.
  • Wait time after placing order: 3 months. You have the option to postpone the delivery/buy date at no extra charge.
  • Lease option: Bike can be taken on lease and returned after the lease period if not satisfied.
  • Portable charger same as fixed charger: Yes. The fixed charger only provides the convenience of being fixed at the parking spot.
  • Not using bike for some time: Bike has a shutdown mode in which it won't draw power from peripherals, and can safely last for around 2 months in this state.
  • Battery explosion possibility: The person said this is unlikely because of the way in which the charging and discharging is managed, but I wasn't fully convinced. In any case, we have been carrying highly inflammable material in petrol vehicle tanks. Whether batteries are safe or not, time will tell.


My wish-list for electric vehicles
  • Matte finish body and options for grey shades instead of just white (Ather 450X is released in a lovely grey shade).
  • Separation of vehicle performance data sent to the company and vehicle location data. I don't mind sending performance data, but sending location data is a violation of privacy. Some people just don't seem to understand why that's a problem.
  • Physical buttons that are easier to access with the thumbs.
  • Option to sell old bike like at Maruti True Value (As of July 2020, Ather is offering an exchange option).
  • A press-to-lock mechanism for the seat (when closing it after storing something in the under-seat compartment) instead of a drop-to-lock.
  • Switching between eco and sport mode without having to stop the bike.
  • Option to switch off the headlight.
  • Capability to display the driving license, bike registration and insurance certificate on the dash, to show to traffic police when they stop bike for checks.
  • Safety mechanisms to prevent injury in case of battery explosion.
  • A less noisy cooling fan (as of Oct 2019, I hear they've already made it quieter)
  • Drum brakes instead of disc brakes (I don't want to depend on brake fluid).
  • A covered rear wheel area, instead of leaving it so exposed.
  • Rat-proofing: Sometimes rats chew away at wires or rubber tubes etc. Since Ather's drive belt is made of rubber (and expensive), I hope there would be some kind of rat-proofing.  
  • In Bangalore, even the pillion rider needs to wear a helmet, so it'd help if the bike has some kind of a pre-built lock or extra space under the seat to ensure that two helmets could be stored/locked on the bike.
  • Wide-angle camera at the front and back to record the trip (locally; not on the cloud) for safety purposes.
  • Removable batteries that can be exchanged/rented for charged batteries at charging stations, where the batteries can be tracked via blockchain. This would eliminate the need to charge batteries at home (especially helpful if you stay at an apartment complex). The video below shows many such bikes with removable batteries.
  • Fewer (or zero) power-cuts in Bangalore and more solar electricity. Especially on roof-tops and parking spaces (this is of course not a bike feature, but it's part of the wishlist anyway).
This solar parking space was built by Tata Power (as I remember)


Overall, the Ather was a nice bike to ride. Happy that it is designed and manufactured in India. They've got a forum where people share their experiences. Given that there are quite a few points on my wishlist that would remain unfulfilled, the high cost of the vehicle and given the current difficulties in finding charging points and also the person mentioning that they wouldn't be able to make hardware changes (like the handle button position) easily, I'd probably not buy an Ather for a rather long time. If I do decide to buy, the review process is going to be far more detailed than this.


Ather vs. petrol bikes
A somewhat practical analysis of the costs of Ather vs. petrol bikes is done on this website and this website.


Alien and mosquito designs
I had a look at a lot of other electric bikes, and almost all of them have a pointy, mosquito or alien look. It looks like the designers were more interested in impressing their bosses/investors rather than in designing a bike that would actually look streamlined and decent. If any designer is reading this post: Please design a bike that looks like something a common citizen would want to buy.



Have you ever tried an Ather or another electric bike? What was your experience like?