11 November 2020

The Real Cure for Eye Strain

When you wear a pair of shoes that’s too tight for you, and each time you walk, it keeps hurting you, would you remove it or would you pour medicines and apply band-aid on your feet and continue walking while the shoe bites into your skin and flesh? The shoes are an analogy to the way we use our eyes without taking rest. The band-aid and medicines are an analogy to how we use spectacles, eye drops, eye exercises, blue light filters etc., hoping that it would cure us (Blue light blocking lenses have shown no evidence of preventing digital eye strain. Ref1, Ref2.).

Sure, some remedies do appear to give a little relief, but they are only treating the symptoms. We should not pretend that it is working. We need to treat the root cause and cure it. I realised after a decade of chronic eye strain, that there's an obvious, common-sense first-step to the healing process: Removing those "shoes".

Discovering the truth

Doctors tend to focus on intraocular muscles. A less considered fact is how extraocular muscles (shown in red) are affected. I’ve felt excruciating pain in those areas for many years.

In my case, it began with a burning feeling at the front of my eyeballs. Then came the occasional sharp pains at the sides of the eyeballs, which became sharp stabbing pains all around and behind my eyeballs. I ignored that too and continued working. Then came severe pain all over the eyes, eye muscles twitching, tightness at the cheek muscles that even spread to the forehead muscles. The sharp stabbing pains continued, and my eyes were paining every waking minute of the day. I found it difficult to even keep my eyes open for too long. This is what chronic eye strain feels like. During the next few years, I consulted plenty of doctors (even at highly recommended eye speciality hospitals). They examined my eyes and found no defect other than myopia. No doctor had even heard of such a severe case of eye strain. They tried their genuine best to help, and I could see they felt bad, because they wanted to help me recover (bless them), but they didn’t know how to cure me. Medical science doesn’t seem to have given enough attention to the root causes of fatigue-related eye strain. Practitioners of ancient traditional medicine couldn’t help either.

My eyes just continued aching and burning every single day, throughout the day for six more years, and I continued using the computer for many hours as usual, despite the pain…because I thought I had no other option. Added to that was the mockery from many who thought I was exaggerating.

The persistent pain finally drove me to note down daily experiences. Over a period of few years, multiple experiments, correlation and keen observation, I finally found the cure and started recovering.


The Cure

It’s necessary to follow these three very strictly. Depending on the level of strain, it can take anything from a few weeks to many months to get cured, but this is the only way to cure fatigue-related eye strain. Nothing else works.

  1. Eight hours of uninterrupted sleep every night: This is the foundation. Without this, nothing else will cure the strain. We assume we are getting enough sleep because we feel refreshed when we wake up…and then don’t notice that we still feel sleepy during the day. Before my eye strain became chronic, I hadn’t noticed I was getting only 4 hours of sleep for many months. During my experiments, I noted that it was only after 8 hours of uninterrupted sleep, that my eyes felt fine. Interruptions in sleep or short duration of sleep do not seem to allow the muscles and tissues to heal. Strain appears to accumulate everyday due to lack of proper sleep. You’ll also notice that you are able to see much clearer than usual, after you get 8 hours of deep sleep. Children need more than 8 hours of sleep, and noise etc. disrupts sleep.
  2. Closing the eyes after 20 minutes of strenuous work: Twenty minutes of work followed by closing the eyes, relaxing the face muscles and neck muscles and waiting until the strain subsides (the way we maintain tension in our muscles is a small part of the problem). Although I don’t recommend longer periods, some people may need 45 minutes to 1 hour of continuous work (provided they get sufficient protein in their diet), but more than an hour is harmful. Even if you don’t feel strained, stop after an hour and close your eyes. It’s very necessary. There is no work that is more important than your eyes. I’ve tried eye drops, an eye gel, anti-reflective coatings, blue-light filters, eye exercises, washing the eyes, the 20–20–20 rule, expensive eye glasses and all the other advice that doctors and common folk think is a cure for eye strain. Nothing worked. At my level of severity, even minor differences were noticeable. The ONLY way to rest the eyes and get relief from fatigue-related strain, is to keep the eyes closed until the strain subsides.
  3. A well balanced diet of properly cooked food: It’s extremely important to realise that when food is not properly cooked or even slightly burnt, it causes discomfort in the digestive system (most of the time you won’t even notice this discomfort) that leads to sleep loss (I’ve mentioned more about this below). Also, ensure you search the internet and understand what a “well balanced diet” means, and why it’s important. Instead of searching only for foods that can help the eyes, make sure your entire body gets the nutrition it needs. Particularly, when muscles go through strenuous activity, they need a proportional amount of protein (there’s a wide variety of proteins, by the way). The body also needs natural foods that help with long duration sleep and deep sleep.

Eye strain and myopia can be caused by many other factors too. Those are best diagnosed and treated by a qualified ophthalmologist. Everything I’ve mentioned here, is only for eye strain that’s caused by excess fatigue to the eyes and lack of sleep.

 

Precautions and Observations

  • Eye exercises: Tired muscles need rest. Not exercise. When your eyes are strained, do not do eye exercises. Just close the eyes to rest them.
  • Full body exercises: It was of no use in curing or reducing eye strain, and it resulted in better sleep only during the first week. However, full body exercises are very necessary for general health.
  • The “SCREAMING”: The pain/burning/discomfort is basically your eyes screaming at you, begging for rest. Never ignore or delay it.
  • Digital screen settings: It helped a little bit when I reduced my computer and smartphone brightness to the lowest level I was comfortable with, and used the monitor’s preset “warm” setting. Alternatively, the free night-filter apps are also good. What also helped, was positioning the screens in such a way that reflections on the screen did not cause glare. Anti-glare coatings did not reduce my strain even a little bit because digital screens or blue light was not the reason for strain. Strain was caused by the lack of periodic rest and sleep. Don’t forget to drink sufficient water and blink.
  • Incorrect diagnosis: When eye strain gets bad, the way it affects the eyes can result in doctors assuming you have astigmatism or that your eye power is higher than what it actually is. Strained eyes can result in a power that is -0.25 to even -1.0 higher than what the eye power actually is. My eye power is -4.25, but at the worst stage of strain, after a full day of my office work, the doctor measured it at -5.5. Other doctors even prescribed cylindrical correction which I couldn’t tolerate for more than 10 minutes. Even computerised eye tests and pupil dilation tests showed astigmatism and the wrong power. Oddly, every doctor gave me a slightly different eye power prescription, and each time, the cylindrical correction angle was completely different from the previous reading. I started spending most of my day either not wearing spectacles or using spectacles of a lower power (which didn’t cause any issue, by the way), and when I started getting better sleep and rest, the strain reduced. This time, after getting a good night’s sleep, when I went to the doctor with well-rested eyes, my eye power was diagnosed correctly. Two doctors concluded I don’t have astigmatism.
  • “Is this lens better or this one?”: It is not necessary to be able to clearly see the last line in the Snellen’s chart. As long as the spectacle lenses feel right, that’s the eye power to stop at. When my eye power was -4.25, and the doctor added another lens to make it -4.5 and asked whether the higher power was better, it appeared clearer and sharper to me (I didn’t realize it was too powerful), so I chose -4.5. I shouldn’t have done that. -4.25 was the correct power. When using the computer, I switch to -2.0 power ordinary glass lens spectacles without any coatings, and I’ve had absolutely no problem (spectacles purchased in 1998). Some people recommend wearing spectacles even if it feels uncomfortable or if it gives a headache, saying that the eyes would adjust after a few weeks. That’s very wrong advice. When my eyes felt uncomfortable, I learned not to wear those spectacles. They were the wrong power, and caused a lot more strain.
  • Low power prescriptions: I’m hearing of a lot of people being prescribed -0.25 or -0.5 prescriptions for one eye or both eyes. Please consider that these powers may just be a result of excess strain or lack of sleep. Wearing spectacles could prevent them from recovering to normal sight.
  • Bad habits from childhood: For goodness sake, please don’t mess up children’s sleep cycle. Not even for exams. Hard work is good, but losing sleep repeatedly to do hard work is a foolish thing to do. Right from childhood, we have been taught to ignore discomfort and persevere, but what we should have also been taught, is to recognise when we should stop and give our bodies the rest it needs.
  • Work environments: Even in the most well-meaning work environments, bosses are pushed to deliver results quickly. But that doesn’t mean you need to damage your health in the process. Six hours of computer use a day is what I’d say is the safe-limit (eight hours may work for you, but never skip the rest breaks). No boss or deadline can deny you the rest you need. The entire world is realising this necessary truth, and you shouldn’t be ashamed to take rest. Being a responsible person who gives their body the rest it needs is one thing. Laziness is an entirely different thing. Any sensible boss or colleague will know the difference.
  • Online classes and smartphone/TV use: Teachers and parents need to ensure that students get some necessary breaks during online classes, smartphone use or while watching TV. Kids by nature won’t listen, but please ensure they get their rest, sleep and nutrition. Their disappointment at not being able to play video-games for long, is tiny compared to the disappointment of having to wear spectacles lifelongThe need to wear spectacles itself shows serious damage to the eyes. Don’t make it worse. Better still, don’t even allow it to reach a stage where anyone needs spectacles. Protect the eyes.
  • Rice: Remember this: It is not necessary that rice grains should be separate from each other when cooked. It’s more important that rice is cooked with sufficient water (or even boiled with excess water and then drained). Four glasses of water per cup of short-grained white rice helped avoid discomfort-induced-sleep-loss. This is from multiple experiments, and I know you'd be shocked if you've been taught to use just two cups of water. Long-grained rice might need lesser water, but I haven't experimented with that yet. Do a bit of searching and understand the role of amylose and amylopectin when cooking short-grained, medium-grained, long-grained and broken rice. Even if your rice ends up clumpy or sticky, it is going to be chewed up in your mouth anyway. So why insist on separate grains just because you heard someone else insist on it? Rice cooked with insufficient water causes sleep loss for many.
  • Other problem foods: Burnt particles in food caused digestive discomfort, which led to sleep loss. I now tear off the black, burnt spots from bread toast, barbecued chicken, parathas/rotis (undercooked parathas and rotis also caused issues) etc. Any food that felt like chewing-gum, also resulted in sleep loss (it wasn’t cooked properly). Unripe fruits too caused this problem. Water from certain water filters that left a “layery” feeling in my mouth, coffee and even adulterated consumables caused digestive discomfort that led to sleep loss. Different people respond to various foods differently, so over a period of time, diligently figure out which foods are affecting your sleep. It may be food from a hostel, a restaurant, a stall, a bakery, cafe or a packaged snack or even somebody at home who does not understand the principles of cooking. Make sure you get well-cooked home food. Also be careful of H.Pylori at places where hygiene isn’t maintained (the ulcers cause pain, resulting in sleep loss).
  • Daytime sleep: If you couldn’t get proper sleep at night, you will feel sleepy during daytime. It is extremely important to take those naps. It gives some very essential rest for the eyes that’s even more effective than just keeping the eyes closed.
  • Coffee/tea: When the body badly needs rest and you feel sleepy, you should sleep. Drinking coffee or tea to remain awake is a silly thing to do.
  • The angle: If you extend your hand in front of you and hold a dumbbell for long, your muscles will start aching after a while. When it starts aching, if you raise your hand to hold the dumbbell above your head, some of your arm muscles will be spared of the weight of the dumbell and get a chance to relax. The extraocular muscles holding the eyeball, are like the arms holding the dumbbell. Closing your eyes and lying down facing the ceiling helps those muscles relax a little bit.
  • Spectacles are not a cure: Some people assume that if they constantly wear spectacles or contact lenses for a few years, they will get cured to normal sight. It won’t.
  • Glass lenses were better: I find this strange myself, but during my chronic levels of strain, plastic lenses always caused my eyes to get strained quicker than when I used glass lenses. Now that I’ve recovered a lot, I feel that difference a slight bit lesser, but there seems to be some reality to it. Perhaps glass offers better visual acuity. I hope researchers could look into this. Of course there’s a safety benefit to plastic lenses, but while sitting in front of a computer, I prefer glass lenses. Some opticians may lie, saying that glass lenses are not available. They are available and are cheaper than plastic lenses.

As for everyone who knowingly or un-knowingly deprive people of sleep and rest right from childhood, please realise the seriousness of the matter and establish processes that help create a nation of healthy people.

I’m shocked that people are not taking the fundamental requirement of sleep and rest seriously. I’ve been spreading awareness about this since 2017, and finally, doctors have started recommending rest and sleep. Please spread this message. The human eye was not evolved to handle this kind of strain. Too many people are getting incorrect advice and hurting their eyes.


CAUTION:

In the same way that antibiotics should not be discontinued before the full course is completed, even the procedure for rest, sleep and proper nutrition should not be discontinued when you have acute or chronic strain. It can take several weeks to recover from acute strain, and it takes several months to recover from chronic strain. I initially took a 15 day vacation to check if it would cure the strain. When it didn’t, I assumed that taking rest was of no use. I didn’t realize that my strain was chronic and I had severe sleep loss. The strain had built up to such a severe stage that longer periods of rest and sleep were required. The right thing to have done would have been to take a sabbatical for a year to ensure I got rest. Due to ignorance and bad advice, I continued working and the problem persisted for several years. This applies even to conditions like back pain etc. When the body needs rest, give it rest. Any other work can wait. Else, you’ll end up with a severe burnout that will prevent you from working anyway.

Like someone once said: “If you do not give time for wellness, you will be forced to make time for illness”.


 

p.s.: Do read through the article a few more times to understand all points, and when you get cured, do return to leave a comment.

 

 

Keywords: computer eye strain, eye strain glasses, eye strain headache, reduce eye strain, eye strain causes, digital eye strain, eye strain from computer, glasses for eye strain, eye strain relief, eye strain in one eye, what causes eye strain, eye muscle strain, how long does eye strain last, why do my eyes hurt, eye drops for eye strain, glasses for computer eye strain, how to get rid of eye strain, burning eyes, eye drops for burning eyes, pain in eye, pain behind eye, right eye pain, left eye pain, headache eye pain, sharp eye pain, eye pain causes, sharp pain behind right eye, pain relieving eye drops, home remedies for eye pain, eyes hurt, pain above right eye, pain in eyeball, pain over left eye, how to relieve eye pain, how to stop eye pain, reason for eye pain, medicine for eye pain, eye pain home remedies, eye strain symptoms, headache and eye pain, eye socket pain, stabbing pain in eye.


02 October 2020

Install PyEnv if you want various Python versions on Ubuntu

One of the major issues with installing new versions of Python is that if you try removing it or try removing the existing version, it'll cause problems with the working of the operating system, because Ubuntu uses Python for many of its system functions.

As an alternative, people suggest using Anaconda or Miniconda. When I tried it, I ran into errors where the package versions installed with Anaconda conflicted with the system Python versions. At my wit's end, I finally gave PyEnv a try and it worked beautifully.

  1. sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
  2. curl https://pyenv.run | bash
  3. Follow the instructions shown on the terminal to add commands to bashrc. Close terminal. Open a new one.
  4. pyenv install --list | grep " 3\.[678]"
  5. pyenv install -v 3.8.3
  6. pyenv global 3.8.3
  7. To see which versions of pyEnv are installed: ls ~/.pyenv/versions/ or pyenv versions
  8. To remove any version: pyenv uninstall 2.7.15 or rm -rf ~/.pyenv/versions/2.7.15
  9. Check which is the system default version: python -V
  10. To revert back to the default system python: pyenv global system
  11. Commands available with pyenv: pyenv commands
  12. Getting help for any of those commands: pyenv shims --help
  13. Check if pip is installed: pyenv which pip
  14. Set a global version: pyenv global 3.6.8
  15. Set a local version for a specific application's directory: pyenv local 2.7.15
The most impressive parts of PyEnv are the ability to switch between Python versions and have separate local and global versions.
Although the next step would be to install a virtual environment using pipEnv, I didn't like it because the updates portion is poorly implemented.

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?

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 tended 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 that aren't reliable.

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. If you want a safer GUI version, there's GDiskDump and KinDD.

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.