27 August 2018

Converting pgm files to jpg or png

Some software do not recognize the pgm image file format, even though it was created in the 1980's.

Luckily, Ubuntu has a pre-installed software named Imagemagick with which you can use this command to batch-convert all pgm files to png or jpg.

mogrify -format png *.pgm
or
mogrify -format jpg *.pgm

Try using it to convert from other formats too.

08 August 2018

Are you data privacy literate

I'm very surprised when I still meet highly educated Engineers and Doctors who still believe that the positions of the planets and stars have some effect on their daily luck and destiny. The result of their childhood curiosity and intelligence being channeled into believing and accepting unscientific information just because many others do so. Likewise, wasn't there a single person who could stand against sati and dowry for all those centuries? "Hey she's part of my family. How dare you suggest burning her!!!".

In today's times it's about standing against data misuse when society mocks you for doing so. Turns out there are still too many people who are insensitive to people's need for privacy.




If you are not paying for a product, YOU are the product
Few people realize the gravity of this.



Being a lifelong learner

A few years ago people were told that if they didn't know how to use a computer, they were as good as being illiterate. That school of thought has been upgraded. Today, you are illiterate if don't care/know how to protect your personal data.

I'm often asked why I don't use a certain messaging app, and get mocked by the "cool-crowd", for whom throwing caution to the wind is ok as long as everyone else is. Just like the enthusiastic users of radioactive toothpaste.  
I recently installed the messaging app, taking care to first deny all un-necessary permissions and then tried sending a message.  Couldn't do so unless I allowed it access to data on my phone. That itself is a huge red-flag. An app doesn't need such details to send a message. By having these details, there are a lot of conclusions that can be made based on the messages and calls you make. Even with encryption, don't forget who has the key to decrypt the message. Apparently a lot can be deduced just from the metadata associated with the messages. Apparently messaging apps compromise privacy and there's a lot the government can do to monitor people, just the way corporations may. (Update: There appear to be security issues even in 2025)
There's also the un-ending stream of notifications. Every Tom, Dick and Harry has created messaging app groups which you are expected to join. Some post pointless messages on those groups and there's no way of filtering out such people either in such groups (despite having requested such a feature).

So what do I do with an intrusive, irritating third-party app that forces me into sharing personal details?
UNINSTALL.

Cartoon from Wumo













Oddly, free messaging apps are still popular in-spite of people telling their friends to stop using it. Free web-based email was invasive enough. Now they have access to even more intimate information about you through your smartphone.

Hope you've heard of how they switch on your phone's microphone without your permission to listen in, or misuse your phone for bitcoin mining. Turns out there are hundreds of such apps.


But my data is already out there...

Sure it is, but remember that data analytics works well only with lots of data. So you can stop putting more data out there right now. In fact, don't start today. Start yesterday!
Everything you type in a chat is potentially being analyzed. NLP can actually understand the grammar and associate it with context. Your contacts from various platforms are being integrated to know more about who you are and whom you interact with. A trainer from a networking company once told me that people's profiles get created by the ISP, based on their internet searches and activities, and any deviation from that pattern gets recorded as an anomaly. The history of your life, locations and activities are being recorded. The content in the files you upload are being analyzed. It's like standing on a rooftop and yelling out your intimate personal details to strangers. You don't have to.

Behind the scenes

You should know what goes on in such corporations. If the recent scandal of misusing data isn't enough, the god mode of app-based taxis is another. Internet searches will show you more. I wouldn't blindly believe privacy policies, since it's historically known that corporations can flout those rules or have cleverly written clauses that help them do whatever they want with your data while you give them your precious trust.

Companies (fraudsters too) can buy your personal data from any of the many data gathering companies and associate various intimate aspects of your personal life. For many of you, that sounds ok until you realize that someone you personally know can be working in such a company and looking at that information.

Don't believe me? Did you hear about Mr.Professional Stalker? Or how app-based taxi employees secretly stalked their ex'es and celebrities?
You only know about these because these made it to the news. There are a zillion other companies (and fraudsters) using your data and there can be people you personally know, who could be looking at a history of your activities you don't even remember, and using analytics to associate that data to make conclusions about you.


Crime

Yesterday I received a call from someone who had some details of my bank account and was asking me about transactions that I had not done. He calmly reassured me he was not asking for my password or pin details. I promptly reported this number to the bank and they confirmed it was a fraud call. For those of you who don't know, this is called Social Engineering. A method of questioning that makes you unsuspectingly give out personal data which you think is safe, but they can associate that data with more data they already gathered about you to commit fraud. If you still think this is too far fetched and will never happen to you, then you are very naive.

Few years back a girl looked at me like I'm an idiot when I casually told her why she shouldn't have posted her vacation details on Facebook. What harm could it do, she thought. https://m.youtube.com/watch?v=e0qrEnCbGIE

Now the rich and powerful are realizing that their own data is being misused, and are formulating laws to restrict it. Don't rejoice yet. These people would only formulate laws that protect themselves. You are still responsible for your own safety.




Yet, many of you still don't care. Just lazy eh? Too busy? Well, can't blame you really...in my phone, I was surprised at the plethora of options to restrict apps from accessing the internet and the huge number of settings I had to visit to turn off features that compromised my security/privacy. It does take a lot of time to do this. It's worth it though. Do it for all accounts, location services...everywhere. Don't give out your number at grocery stores or pizza stores. Don't use public WiFi unless you can ensure safety. Don't use public proxy servers or free VPN's. There's no free lunch.





Sensitivities need to adapt with changing times. You may be ok with your data being misused, but there are an increasing number of people who are not ok with it. Respect their need for privacy and security.


While you are busy telling people that you don't care about privacy, could you prove it by leaving the door of your house unlocked too?



Say thank you or donate

01 August 2018

Causes of phone battery bloating / swelling

Lithium Ion batteries are known to function poorly when subjected to heat. It turns out that it's not just function that declines, but gases formed by electrolyte decomposition can cause the battery to bloat and potentially explode.

Few causes I know of are:

  • Using the phone for a phone-call while the phone is being charged.
  • Using the phone in a hot environment or subjecting it to heavy use (watching videos or gaming) while it is being charged.
  • Using mobile hotspot for long durations (more than half an hour) at a stretch.
  • Continuing to charge the mobile even after it reached 100% charge.


I'm surprised that many phones today have a moulded build with a non-removable battery. Although the battery can be replaced at a service center, the "non-removableness" means that if the battery gets bloated, it won't have any space to expand into, and it'll permanently damage the phone. The better option is to go for phones with removable batteries. Here, when the battery expands, it'll pop off the back cover and at least your phone's components won't get damaged. You just have to replace the battery instead of replacing the entire phone.

17 July 2018

Learning R through tutorials

R can be daunting initially, but you'll become comfortable with it in a month, compared to something like Matlab which takes longer to master. A good tutorial can speed up your comfort-level even more.

One good tutorial I found was this.

08 July 2018

Take a screenshot of a rectangular area of the screen in Ubuntu or Mac without any extra software



This was a niggling problem for so many years, and I didn't know the solution was right under my nose.

In Ubuntu, if you want to take a screenshot of the entire screen, use the PrtScn key on the keyboard. Everyone knows that.

To take a screenshot of the current active window, press Alt key and the PrtScn key together. Most people know that too.

What most people don't know is that you can take a screenshot of a rectangular selection of an area on your screen by pressing Shift and PrtScn together, and then using the mouse pointer to select an area on the screen.

Oh...how much time it'd have saved me if I knew this earlier!!!

On a Mac you can do the same using pressing the keys Command Shift 4 together.

17 June 2018

Privacy in the age of Augmented Reality

It is said that the stone age lasted 2.5 million years.
The agricultural age lasted a few millenia.
The industrial age lasted a few centuries.
The digital age lasted a few decades.

Now we are said to be at the brink of a new age: "The age of Augmented Reality".


We are already there. We have virtual reality headsets. We pick up our phone to internet-search for answers when we have questions.
More importantly, we are at the doorstep of mind-controlled devices. Microsoft has already applied for a patent. You could eventually even communicate with people or animals without having to speak a word.

Privacy
While it's fascinating to see what technology has to offer, there's also the element of loss of privacy. Governments and corporations got access to our homes via the internet. Now they have even more intimate information of us via our smartphones. With brain controlled devices, they are posed to have access to the very depths of our thoughts.

I had an SMS conversation with a friend about a cab service and in a couple of hours and on the next day I received SMS advertisements about that cab service. I have never received ads about that service before in my life. So now the harsh reality is that even if you avoid messaging apps, your mobile phone service providers are monitoring and monetizing on your SMS'es and perhaps your conversations too.


There's plenty more.

In-spite of knowing this, most people happily allow companies and governments to have access to their personal data. Because the services are free!
Given the way my data was used without my consent for sending me an SMS ad, I wonder if we would have privacy even if we paid for using GMail, Facebook, WhatsApp etc.



Are our thoughts going to remain private?
I'm very sure that companies designing mind control apps and devices will also be devising an elaborate strategy to convince people to happily give them access to their minds and thoughts. In the same care-free way we do with free email and messaging services.


People born before the 1950's used to envy us when they saw how fascinating the digital age was. They weren't able to adapt quickly enough to use it, but they wished they could. They told us how lucky we were to be born into the "jackpot generation" which is witnessing a phenomenal change in technology.
Some people don't envy us though. They envy our grandparents, saying that maybe they lived in a world with lesser access to medical facilities, information, travel and a lot of other things we enjoy. Even then, they lived happier lives where life moved at a more comfortable pace. Food, air and water were purer. Privacy was something they had a lot more control over.

There may come a time though, when people will ask if privacy is really so necessary? A time when information and thought will be so pervasive that it'll become a lot easier to trust someone because you already know everything about them. This would remove barriers of communication and basically the entire world, not just humans, but even animals and perhaps trees and plants would be able to function as a single cooperative entity, sharing knowledge and purpose. Perhaps leading to a time when we finally answer the ultimate question of why we exist in this universe!

22 May 2018

Sick or sleepy? You ruin it for everyone by forcing these kids/employees to push themselves.


Sickness

Put simply, would you prefer that one sick employee or student remains away from everyone else for the duration of their contagious illness or would you prefer that more people to get infected and productivity plummets?

In a competitive world, it's sad how people push themselves (or are pushed) to show up for work even when sick. You don't have to. Even with a chronic illness or a family member's illness, there are ways to manage it. Businesses always have a contingency plan for employee absence. It's their job to arrange for that, and not something that you have to worry about when sick.

What you should do:
Even if your illness is not contagious, stay at home and get rest. A company will never sacrifice their profitability for you, so you have no obligation to sacrifice your health for them either. I've seen this happen with multiple people. Sacrificing health for work or schooling is never worth it.


Sleep

Again, put simply: Would you prefer that people remain productive throughout the day by taking naps in-between or that they remain productive for half a day, making mistakes (which will cost you a lot in re-work) and struggling to remain awake and focus?

When you feel sleepy, you aren't supposed drink tea/coffee to shake off the feeling. You are supposed to sleep.
There's some kind of a 'laziness-related' social stigma attached to sleeping in class or in office. It's high-time we got rid of this sleep depriving culture.
Human beings are not meant to sleep only at night. We naturally have either Biphasic sleep or Polyphasic sleep. This means that when you feel like sleeping, it's perfectly ok to sleep or take a nap. You don't have to apologize to anybody. If you want to be super-human and avoid sleep, you need to take a serious look at how sleep deprivation can wreck havoc on your body.
I had a teacher who scolded students for yawning in her class. I have another teacher who feels insecure when students feel sleepy in his class. Both of them didn't seem to observe that it wasn't the fault of their teaching. All they had to do was allow the students to take a 10 minute nap.

What you should do:
If you are at a school or college, the authorities should either specifically allow for a nap break during afternoon classes, where students can rest their head on the table and take a short nap, or arrange for monitored sleep boxes.
If you work at a company, convince your bosses on how a short nap can help boost productivity without negatively affecting morale. Don't worry. There's plenty of evidence about this already. Companies can definitely introduce sleep boxes.

Sleep deprivation begins early in life and continues unless you stop it:

  • Waking through the night when the kid is born.
  • Kids sleep cycles and duration being ruined when woken up for school.
  • The horrible sleep-depriving culture of "burning the midnight oil" or waking up early during exams.
  • Eating improperly cooked or burnt food, leading to sleep loss
  • Having to wake up early to go to office.
  • Staying up to complete a project (which never gets complete).


In an ideal world, one should be allowed to sleep and wake up as per their natural sleep cycle rather than society's insensitive work cycle. When one is sick, one should be able to take rest instead of worrying about losing out in the rat race. Advice like this can only show you the way. You are the one who decides to walk the path.


You won't believe it until you measure it

If you feel you are getting enough sleep, write down how many hours of sleep you think you are getting. Then, keep a piece of paper and a pen by your bedside. Every night and morning, note down the approximate time you woke and slept.
Have two columns.
  • Column 1: Number of hours of un-interrupted sleep. 
  • Column 2: Total sleep = un-interrupted sleep + remaining sleep duration in hours.
Interrupted sleep happens when you are woken by noise at night, need to go to the toilet at midnight, are woken by discomfort in your stomach after having eaten bad food etc.

Do this experiment at least for a week or two.
I assure you; you'll be startled at how less sleep you are getting. Do let me know what your results were and I'll tell you how to improve.

19 May 2018

How to install R and R Studio on Ubuntu 16.04

The desktop installation of R is very simple if you are ok with Ubuntu's apt version.

Firstly:
You will need to have libcurl, libxml2, gtk2 and openssl installed on Ubuntu if you want to install certain packages, so also run these commands:
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev
sudo apt-get install libxml2-dev
sudo apt-get install libgtk2.0-dev


Method 1 (recommended):
One way that worked for me is to add the repository:
sudo add-apt-repository 'deb https://ftp.ussg.iu.edu/CRAN/bin/linux/ubuntu xenial/'
sudo apt-get update

Now you might get an error like this:
W: GPG error: https://ftp.ussg.iu.edu/CRAN/bin/linux/ubuntu xenial/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
W: The repository 'https://ftp.ussg.iu.edu/CRAN/bin/linux/ubuntu xenial/ InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: There is no public key available for the following key IDs:
51716619E084DAB9  

The solution is to add the key:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYID
where you have to replace KEYID with the key ID shown in the error. Marked in bold three lines above this line.
Now update and install.
sudo apt-get update
sudo apt-get install r-base 
sudo apt-get install r-base-dev


Method 2: 
sudo apt-get update
sudo apt-get install r-base

Download the jpeg62 dependency from here and run dpkg to install it.
sudo dpkg -i libjpeg62_6b2-2_amd64.deb

Download R Studio from here and run dpkg to install it.
sudo dpkg -i rstudio-xenial-1.1.453-amd64.deb


Method 3:
However, if you want the latest version (advisable if you plan to install packages like arules) or you want to upgrade the version installed above, follow this:
sudo gedit /etc/apt/sources.list
Enter this line in the sources.list file (substitute the right Ubuntu version. Xenial is for Ubuntu 16.04): deb http://cran.rstudio.com/bin/linux/ubuntu xenial/
sudo apt-get update
sudo apt-get install r-base



16 May 2018

Using email like chat

Many people prefer using a messaging app for chats and email for a formal, letter-like communication. Certain people insist on always starting an email with a greeting like "Dear x", "Hi" or "Hello". It doesn't necessarily have to be that way.

If we rigorously stuck to tradition, we would be writing on cave walls and living in the jungle. There's nothing wrong with introducing change. There's nothing wrong in reducing the degree of formality to make someone feel comfortable or to make technology more cordial and usable.



If you are someone who does not like using invasive smartphone apps and are in a bit of a hurry to start/continue a conversation in a chat messenger, feel free to use email. Many modern email clients support the "email conversation" format, so it's easy to follow the conversation even if multiple people are in the conversation. It's easy to add attachments, include/exclude people, use highlighting and make use of all the other functionalities that an email offers.
Given that there are smartphone apps for email, you can even get your updates in the same way you'd get it from a messaging app.

When you are having a conversation with someone in the same way that you'd want to converse on a messaging app, go ahead and skip the formalities of email. Use email like a messaging app.
When using email for formal communication, use the standard letter-writing style and use all necessary formalities.

Let's keep technology flexible and make it comfortable for everyone. It's like how the heads of Google spoke about their choice to wear t-shirts instead of suits; they said "You don't have to wear a suit to be serious".

13 May 2018

Bitplane slicing

I was quite impressed with the person who thought of this technique. Slicing bits into planes to be able to use them to compress an image. The concept is so simple that not much explanation is needed. You'll see how it works directly from the code. Two techniques are presented here. One from Rashi Agarwal's use of mod and Angel Johnsy's use of bitget and bitset.


Once the image is sliced into bit planes, this is what you'll get:


MSB is the Most Significant Bit. LSB is the Least Significant Bit. You can choose to reconstruct the image with any of the planes which have sufficient information to represent the image. In this case I'm taking planes 7 and 6, although you could even take plane 6 and 8 or even 5 and 7.



Method 1: Using mod

clear all; close all; clc;
I = imread('moon.tif'); figure,imshow(I); title('original'); impixelinfo;
II = double(I);

%---Slice into bit planes
c0 = mod(II, 2);
c1 = mod(floor(II/2), 2);
c2 = mod(floor(II/4), 2);
c3 = mod(floor(II/8), 2);
c4 = mod(floor(II/16), 2);
c5 = mod(floor(II/32), 2);
c6 = mod(floor(II/64), 2);
c7 = mod(floor(II/128), 2);

%---display planes
figure;
sr = 2; sc = 4; si = 1;
subplot(sr, sc, si);si=si+1; imshow(c0); title('plane1. LSB');
subplot(sr, sc, si);si=si+1; imshow(c1); title('plane2');
subplot(sr, sc, si);si=si+1; imshow(c2); title('plane3');
subplot(sr, sc, si);si=si+1; imshow(c3); title('plane4');
subplot(sr, sc, si);si=si+1; imshow(c4); title('plane5');
subplot(sr, sc, si);si=si+1; imshow(c5); title('plane6');
subplot(sr, sc, si);si=si+1; imshow(c6); title('plane7');
subplot(sr, sc, si);si=si+1; imshow(c7); title('plane8. MSB');

%---restore from bit planes
figure,imshow(uint8(c7*128 + c6*64));title('restored with plane 7 and 6');
figure,imshow(uint8(c7*128 + c6*64 + c5*32 + c4*16 + c3*8 + c2*4 + c1*2 + c0));title('Fully restored');
% ri=2*(2*(2*(2*(2*(2*(2*c7+c6)+c5)+c4)+c3)+c2)+c1)+c0;%shortcut technique
% figure,imshow(uint8(ri)); title('Restored image');



Method 2: Using bitget and bitset

clear all; close all; clc;

I = imread('moon.tif'); figure, imshow(I); title('Original');
sr = 2; sc = 4; si = 1;

%---slice into planes
b1 = bitget(I,1);
b2 = bitget(I,2);
b3 = bitget(I,3);
b4 = bitget(I,4);
b5 = bitget(I,5);
b6 = bitget(I,6);
b7 = bitget(I,7);
b8 = bitget(I,8);

%---display planes
figure;
subplot(sr,sc,si);imshow(logical(b1));title('Plane1 LSB');si=si+1;
subplot(sr,sc,si);imshow(logical(b2));title('Plane2');si=si+1;
subplot(sr,sc,si);imshow(logical(b3));title('Plane3');si=si+1;
subplot(sr,sc,si);imshow(logical(b4));title('Plane4');si=si+1;
subplot(sr,sc,si);imshow(logical(b5));title('Plane5');si=si+1;
subplot(sr,sc,si);imshow(logical(b6));title('Plane6');si=si+1;
subplot(sr,sc,si);imshow(logical(b7));title('Plane7');si=si+1;
subplot(sr,sc,si);imshow(logical(b8));title('Plane8 MSB');si=si+1;

%---reconstruct using plane 7 and 8
IR = zeros(size(I));
IR = bitset(IR,7, b7);
IR = bitset(IR,8, b8);
figure, imshow(uint8(IR)); title('reconstructed with plane 7+8');

Once the planes are sliced, you can choose to take just plane 7 + plane 8 and rearrange the bits of each plane in bunches of 8 bits. Then you can convert each bunch of 8 bits to a decimal number. This is called bit plane compression

12 May 2018

Getting LaTeX working on Ubuntu 16.04

As of today, if you download the LaTeX template for IEEE conferences, you'll have to place any image named "fig1.png" in the same folder as your tex file, to be able to build the template.
You'll also have to ensure you have a few necessary packages installed on your Ubuntu OS before you can start working with the template.

To install, use the following commands:

sudo apt-get update
sudo apt-get install -y texmaker texlive-publishers texlive-science


Of course, instead of installing the texlive packages separately you could've also installed it all in one shot with the command sudo apt-get install texlive-full, but it installs a whole lot of packages, some of which you wouldn't even dream of using.

That's it. With TexMaker installed, just double click the tex file template you got, and click the "quick build" option on the TexMaker toolbar. You'll be shown a preview of the PDF.



It's not necessary to save or export the PDF, because the PDF is already created and available on the same folder that you have your TexMaker template on.

For all of you pronouncing it as Lay-Tex, the right pronunciation is shown here: https://en.wikipedia.org/wiki/LaTeX#Pronouncing_and_writing_"LaTeX".

UPDATE 2020: I've found that using LYX is far better than using TexMaker. Use LYX in tandem with JabRef.

09 May 2018

Dear Data Analytics companies. Seems like you've met your match

I came across ThoughtSpot on LinkedIn. While I felt it was silly of them to request users to sign up to see their video on how they add value, it was easy enough to find it on YouTube. If you are a Data Analytics company that's into Business Intelligence, do watch this. It'll give you a run for your money!


I've helped build a high volume cloud computing program for a company that needed to crunch Gigabytes of data at high speed. So I'm quite surprised that ThoughtSpot uses a relational database for data. Relational databases end up requiring quite a rigid schema, as compared to graph databases.
While the video does not explain how they do the data cleaning and segregation...which requires a huge amount of manual labour and no state-of-the-art AI can automatically do as of today...the video does introduce us to a very thoughtful search interface that allows the user to just type what they are searching for, and custom dashboards get created dynamically. That's where the money is!

As of today, data analytics companies spend months at a time, just to get the data organized and dashboards up and running. That incurs a very high opportunity cost for the client. Add to that an obvious high purchase cost for the analytics software, due to the highly skilled knowledge-workers that build it. Then comes the maintenance costs over the years for every little change and customization request.

The value-add that ThoughtSpot provides here, is just like what Google had provided to the world, when Yahoo Search was at it's primitive worst of requiring users to click through categories of data to find a web-page they were looking for.
It's not just clever, it's a huge money-saver and time-saver in the long-run for companies wanting to analyze their business data...which is what any company that is serious about business should be doing, pronto.

The only part I'm not yet convinced about is the amount of time that's lost in data cleaning and segregation. That's not something that can scale so easily. As for the UI and search capability ideas... brilliant!!!

27 April 2018

The spectacle experiment: Why spectacles are likely to be bad for the eyes

Disclaimer: These are my personal observations. This is not medical advice.

You start noticing the various body positions that put maximum weight on your foot, only when your foot is injured and the pain keeps reminding you to be careful. 
Same way, I started noticing a lot of tiny details about eye strain which people normally ignore or aren't able to notice. My eye strain became so severe that twelve ophthalmologists in two cities were not even able to diagnose the problem because they never encountered such a case.
These are what I learnt about fatigue related eye strain:
  • The root cause is a lack of 7 to 8 hours of uninterrupted sleep.
  • Plastic spectacle lenses strained my eyes faster than glass lenses. Even the top three world-class plastic lenses were nowhere close to the visual acuity provided by an ordinary glass lens that had no extra coatings.
  • Anti-reflective coatings did not help me. Aspherical lenses do not help. Eye exercises did not help (when muscles are tired, you should rest; not exercise them more). Eating carrots does not help (it's muscle strain; not a vitamin deficiency). Astigmatism lenses did not help (because I didn't have astigmatism). Dry eye remedies did not help (I didn't have dry eyes). Washing the eyes did not help. Looking at far-away objects did not help. Whole body exercise did not help. Eye drops did help a little, but it was only to give initial relief. Eye drops won't cure the problem and aren't meant to be used forever. The only thing that helped was getting 7 to 8 hours of uninterrupted sleep, taking rest periodically and having a well-balanced diet of properly cooked food.

With insufficient sleep, strain builds up and manifests as headaches, burning feeling in the front of the eyeballs, sharp stabbing pains behind the eyeballs, at the sides of the eye balls, muscles all around the eye feeling sore and at the most chronic stages, even the cheek muscles and muscles near the eyebrows feel strained and sore. Muscles around the eye also start twitching sometimes. When any of these happen, immediately stop straining your eyes and keep your eyes closed until the strain subsides, while also relaxing your face muscles and neck muscles. Do not aggravate the problem by trying to be a hero and straining your eyes even more. No career, job, boss or money is worth more than health.


Losing sleep is a silly thing to do.



A little experiment I tried
The blue shapes in the image below, are spectacle lenses viewed from the top, and this is about trying to read some words with the right eye. The left eye is closed or covered with one hand. When the lens was perpendicular to the words, the words were clear. But when the head was turned even slightly (not even as much as shown in the image), the word got distorted a bit. With some plastic lenses it's a blur. With some, it's a slight distortion. With glass lenses, it's far lesser. This blurring/distortion didn't happen when not wearing spectacles.


Something the industry does not seem to have considered is that our vision from both eyes is not always parallel. 


I am 100% sure of the difference between glass and plastic lenses because I've got repeatable results during a three year period of checking. Scientists would of course call this a subjective result (and I agree), so I hope there would be someone who could verify it objectively. Sadly, the industry doesn't seem to have developed methods to measure extraocular muscle strain.

Keeping eyes fixed in one direction tires your muscles. That's a given. But I have a strong belief (this needs to be impartially and objectively verified) that the distortion created by spectacle lenses are the other major unexplored cause for eye strain and headaches. I don't know if wearing contact lenses would help (didn't try them because of the risk, and lasik doesn't work out for certain people. There is this study and this study that say contact lenses are less problematic than spectacles), but my opinion is that at least when working at a computer, it helps to wear spectacles with a glass lens instead of plastic lenses (it has to be on a frame that gives the same focal point position in front of your eye as the earlier spectacles, to avoid strain from eye accommodation). Keeping a diary/spreadsheet helps record how much uninterrupted sleep one has got everyday versus how bad the eye strain was when wearing spectacles with glass lenses versus plastic lenses. After not wearing spectacles and getting deep sleep, many nights, for two months, my eyesight actually improved.

Plastic lenses obviously have a safety benefit, but for me that's a lot less important than being able to avoid the horrible eye strain. For just sitting in front of the computer, I don't see any safety problems when using glass lenses.

This person Ben, also speaks of why glass lenses are better than plastic or polycarbonate.



More info that could help the eyes:

Remember: The focus should be on getting sufficient sleep, periodic rest and proper nutrition, rather than on lenses or surgery.


27 March 2018

Alternative to f.lux for Ubuntu is Redshift

Update 2022: At least from Ubuntu 22.04 and Windows 10 onward, there's no need of installing redshift or similar apps, since the OS comes pre-installed with a NightLight app. Even Android has it.
 
Important: Blue light blocking lenses have been proven to have shown no evidence of preventing digital eye strain. Ref1, Ref2.
 
When using the computer in dimly lit surroundings, it helps to lower the brightness of the screen. One popular application for Windows was f.lux, and although they appear to have created a version for Linux, Ubuntu users don't need to install f.lux. We have Redshift.


Redshift can be installed hassle-free directly from the Ubuntu software center. Better still, don't even bother installing the GUI. Just install using
sudo apt-get install -y redshift

I was initially disappointed when Redshift didn't start because the computer wasn't connected to the internet and Redshift didn't start because it couldn't estimate my location (and hence the time of the day)...which made me wonder why it's programmed in such a dumb way.

Then I discovered that it's just a matter of using:
redshift -O 3000

You can change that 3000 to any other value, depending on your comfort.

Some laptops don't allow the brightness to go below a certain level (in which case you can also use xrandr), and the blue light from the screen is quite bright. Redshift creates an apparent reddish colour on the screen which is actually a bit comfortable.
Still better, you can even change the gamma with Redshift:
redshift -O 3000 -g .5

To remove the effect of redshift, simply type:
redshift -x

Inspite of this, I'd still recommend having ambient lighting, and not working in the dark. Even with Redshift, the monitor is bright and the surroundings are dark.

Alternative to Redshift and f.lux:
Every monitor has buttons for adjusting brightness and contrast. First, reduce the brightness and contrast to a level you are comfortable with. Then explore more of the monitor's menu options, and you'll see some color schemes. One of these will be a "warm" color. That's basically a color scheme that reduces the blue light. Just use that instead of installing redshift or flux or unnecessarily purchasing blue light spectacles that lie about reducing eye strain (because the real cure for eye strain is to stop overworking the eyes).


ps: Reports of digital screens making us lose sleep is a myth. We lose sleep because we force ourselves to stay awake. Not because of the digital screen's blue light. When you feel sleepy, just go to sleep instead of forcing yourself to stay awake longer.

11 March 2018

Eye strain is not entirely due to digital screens

Disclaimer: I'm not a doctor. To get medical advice, please consult a doctor.



My eye strain had become chronic in 2011 and I haven't fully recovered yet. During these years of crippling strain, I've been able to note subtle details which people ignore because their strain hasn't yet become serious. Also follow the links in "Other medical conditions" below.
Some facts:

Fact 1: Yes; reading text causes more strain to the eye compared to tasks that don't require extreme analysis on tiny areas. This doesn't mean that digital screens are the root cause of strain. Excess brightness of digital screens can slightly increase strain, but that's not the root cause of strain. (Important: Blue light blocking lenses have been proven to have shown no evidence of preventing digital eye strain. Ref1, Ref2)

Fact 2: The strain by itself is not an issue. It happening on a daily basis is not the real issue either. The real issue is that (assuming you don't have other medical problems) no matter how much you think that you are getting enough sleep, you actually aren't. If you get sleep your eye muscles will recover while sleeping and your strain is unlikely to build up to a stage where it hampers you.

Fact 3: When your eyes are strained, washing your eyes or wearing special spectacles or having coatings on spectacle lenses or looking at far away objects or exercising your eye muscles do not help. What helps is keeping your eyes closed until the strain subsides, and relaxing your neck and face muscles.


What to check for:

  • Sleep: If you are confident that you are getting enough sleep, that's your biggest mistake. Very seriously and thoroughly evaluate yourself on whether you are getting a minimum of 7 to 8 hours of continuous, deep sleep every night. I stress on "continuous, deep". Waking up at night to urinate or being woken up by noise (even if you go back to sleep immediately) or sleep apnea or waking up due to stomach discomfort or waking up after 4 hours of sleep and being unable to go back to sleep etc. are signs that you aren't getting enough sleep. Keep a diary where you write the approximate time you slept and woke. You'll be surprised. Feeling sleepy many times during daytime is a clear indication that you lost sleep at night. Lying in bed awake with your eyes closed does not count as sleep.
  • Other medical conditions: Astigmatism or deficiencies leading to dry eye (the beginning stages of eye strain can make you feel like your eyes are dry. It does not necessarily mean you have dry eye) or other medical conditions might be a problem, but verify your sleep sufficiency before blindly accepting what the doctor says. Getting second opinions is not guaranteed to give you the right diagnosis. I met twelve ophthalmologists who didn't have a clue of what caused my eye strain and how to cure it. I have been shocked and disappointed at this (also reported by another person, though I don't agree with his diagnosis). There are some doctors though, who actually are experienced enough to identify the problem and carefully examine your medical history and symptoms before they come to a conclusion. Find these doctors. The general physician or ophthalmologist may not always be knowledgeable enough to identify certain highly specific conditions certain people go through. Some examples are hereherehereherehereherehereherehere and here.
  • Food and water: It's medically known that stomach problems cause sleep problems and sleep problems cause stomach problems. Both of these wreck havoc on the rest of the body. I've listed what precautions to take with food in this post.
  • Spectacle lenses: Glass lenses were much less strenuous for me. I believe it has to do with the better visual acuity it provides. Having special coatings on the lens didn't help reduce my eye strain. Using cheap, ordinary glass lenses without any special coatings gave me the most relief and I eventually started using the computer without wearing spectacles for a while. Haven't tried contact lenses and am definitely not going for Lasik inspite of the rebuttal because the focus should be on proper food, rest and sleep.


How to fix fatigue-induced eye strain
  • Step 1: My doctor prescribed eye drops and Lacrigel to give some initial relief. These were only for a few weeks of use just to give some initial relief. They won't solve the problem and are not meant to be used forever. Make sure you close your eyes for a while everytime your eye feel strained. 
  • Step 2: Rule out medical conditions sensibly. A dry eye specialist tried convincing me I had dry eyes and recommended a vitamin B12 test at an affiliate lab and a followup consultation, but a Schirmer's test at another hospital ruled out dry eyes. Computerized eye tests at two hospitals and three ophthalmologists said I had astigmatism because I mentioned eye strain, but those glasses caused unbearable strain and two other ophthalmologists later ruled out astigmatism. Basically, get opinions from multiple doctors to ensure that you have been diagnosed correctly and ensure you verify if you really have a medical problem or if it's just plain fatigue-related strain. Ophthalmologists themselves have told me that vision correction is not an exact science and that mistakes are possible.
  • Step 3: Examine what food you eat. If you eat from an office/college canteen, bakery, stall or a restaurant (or even if your cook at home doesn't cook properly), chances are very high that you are eating food that is either not fully cooked or has burnt particles in it or is of poor quality or is adulterated. Trust me, a majority of people in this world (including you) are very very poor judges of food quality. Drinking curd after dinner helps give some relief and your sleep should improve with time (probably because curd has Tryptophan) as you change your food habits to eating properly cooked food. More here.
  • Step 4: Make sure you get 8 hours continuous sleep every night. Don't let people or a phone wake you unnecessarily. Don't let your job make you lose sleep. Make sure you have a quiet, warm, dark, comfortable environment for sleeping. And please take Step 3 very seriously.
  • Step 5: Make it a point to close your eyes and relax your face muscles everytime you feel even a slight bit of strain. Don't push yourself to work harder unless you have got your rest first. No job, boss, career, pay or recognition is worth as much as health. I learnt that the hard way.
  • Step 6: Get a good amount of full-body exercise. Exercising does not help reduce eye strain at all. It however does help in maintaining good health which could give you slightly improved sleep and general body function. Oh by the way, when your muscles are aching from exercise at the gym, are you supposed to take rest or fix the ache by exercising more? Take rest obviously! Same way, when your eyes are strained, just close your eyes and rest them.


All you really have to know is that unless you have some underlying medical condition, simple fatigue-induced eye strain can be cured just by getting your eight hours of sleep and some rest when your eyes are tired.  It can take a few months/years to recover (and nothing other than rest+sleep can help speed up the recovery), but that's all there is to it. You don't have to spend a fortune on special spectacles or medication. Take care.



Remember: The primary focus should be on getting well cooked food, rest and sleep.





Say thank you or donate