04 December 2021

Opening up a trimmer

The Panasonic ER206 trimmer has a rechargeable battery in it. If the life of the battery reduces, you'd want to replace it, but on calling up the service center,  I was shocked to hear that it'd cost me around Rs.1000 or more (I don't remember the exact amount mentioned, but it was just a few hundred rupees lesser than the cost of the trimmer).

This, this and this video however, showed me that replacing the battery was actually quite simple. The comments in the video mention the specifications of what battery could be purchased (don't ask me. I don't know). I didn't have to replace mine. One battery should cost only around Rs.150 or less, so the service center's charges were truly blown out of proportion. I don't know if this was their way of making us just buy a new trimmer or if they were charging us for not having a star screwdriver.

Gap along which it can be opened after removing the screws

 So you'll find two screws that you can open on the main body. Then, after removing the blade portion of the trimmer, you'll find two more screws. Once you remove those, you can insert something like a debit card in the gap shown with the red arrow in the above picture. Move it along the green arrow's direction all along the body of the trimmer carefully on both sides, and you'll be able to open it.

What it looks like on opening it up

The positive terminal has a white gasket

The plastic that holds the battery

 

The battery is lodged a bit tightly in the plastic, but it isn't too hard to pull it upward to get it out.


Negative contact point after removing battery

Negative terminal

Positive terminal

Side view

If you ever wondered whether hair gets inside, yes it does. Didn't cause any problems though

 

Does it work without the battery?

Yes it does. Even if you remove the battery and connect the trimmer to the power adapter and plug it into the AC power socket, the trimmer will work. However, if there are voltage fluctuations, it could damage the motor. So if there's that danger, you can use it with a voltage stabilizer.

So you see, it's that simple to open it up and replace the battery (or use it even without replacing the battery). Saves money and saves the time and cost of going to the service center. Overall, this trimmer is quite good in quality and long lasting. They also provide a brush and oil to lubricate the blade. That's an important part of maintaining the trimmer and extending the life of the blade. After using it, don't forget to charge the battery immediately. If I remember right, an 8 or 16 hour charging is required.



05 November 2021

Coding as the first interview round? Try thinking differently

On the first of November, when I was doing a Google search, the search page animated suspiciously to reveal a hidden challenge.

Click image to view larger

After verifying that this was not some malware, I proceeded to find out what this was all about.

Click image to view larger

So it turns out, this is Google's secret way of gamifying the process of recruiting people. It has been around for a couple of years at least. Various articles speak of getting the invitation, and there are mentions on the internet about how to get the invitation by performing a pattern of Google searches. Google's foobar website says it's only by invitation. So congratulations if you received an invite!

You get the following options to navigate the shell.

There are five challenges to solve, and by the time people finished the third challenge, I hear they are offered a chance to submit their details to a Google recruiter, who then decides whether to invite the person for an interview or not.

The challenges are like the Machine Graded Programming Tests I passed at C-DAC. So since it was a holiday, I decided to try the first challenge.

Re-ID
=====

There's some unrest in the minion ranks: minions with ID numbers like "1", "42", and other "good" numbers have been lording it over the poor minions who are stuck with more boring IDs. To quell the unrest, Commander Lambda has tasked you with reassigning everyone new random IDs based on a Completely Foolproof Scheme.

Commander Lambda has concatenated the prime numbers in a single long string: "2357111317192329...". Now every minion must draw a number from a hat. That number is the starting index in that string of primes, and the minion's new ID number will be the next five digits in the string. So if a minion draws "3", their ID number will be "71113".

Help the Commander assign these IDs by writing a function solution(n) which takes in the starting index n of Lambda's string of all primes, and returns the next five digits in the string. Commander Lambda has a lot of minions, so the value of n will always be between 0 and 10000.

Languages
=========

To provide a Java solution, edit Solution.java
To provide a Python solution, edit solution.py

Test cases
==========
Your code should pass the following test cases.
Note that it may also be run against hidden test cases not shown here.

-- Java cases --
Input:
Solution.solution(0)
Output:
    23571

Input:
Solution.solution(3)
Output:
    71113

-- Python cases --
Input:
solution.solution(0)
Output:
    23571

Input:
solution.solution(3)

This was a simple one. I solved it in the very first attempt. An animated bunny was shown hopping around the screen.


The second challenge was a bit trickier.

Gearing Up for Destruction
==========================

As Commander Lambda's personal assistant, you've been assigned the task of configuring the LAMBCHOP doomsday device's axial orientation gears. It should be pretty simple -- just add gears to create the appropriate rotation ratio. But the problem is, due to the layout of the LAMBCHOP and the complicated system of beams and pipes supporting it, the pegs that will support the gears are fixed in place.

The LAMBCHOP's engineers have given you lists identifying the placement of groups of pegs along various support beams. You need to place a gear on each peg (otherwise the gears will collide with unoccupied pegs). The engineers have plenty of gears in all different sizes stocked up, so you can choose gears of any size, from a radius of 1 on up. Your goal is to build a system where the last gear rotates at twice the rate (in revolutions per minute, or rpm) of the first gear, no matter the direction. Each gear (except the last) touches and turns the gear on the next peg to the right.

Given a list of distinct positive integers named pegs representing the location of each peg along the support beam, write a function solution(pegs) which, if there is a solution, returns a list of two positive integers a and b representing the numerator and denominator of the first gear's radius in its simplest form in order to achieve the goal above, such that radius = a/b. The ratio a/b should be greater than or equal to 1. Not all support configurations will necessarily be capable of creating the proper rotation ratio, so if the task is impossible, the function solution(pegs) should return the list [-1, -1].

For example, if the pegs are placed at [4, 30, 50], then the first gear could have a radius of 12, the second gear could have a radius of 14, and the last one a radius of 6. Thus, the last gear would rotate twice as fast as the first one. In this case, pegs would be [4, 30, 50] and solution(pegs) should return [12, 1].

The list pegs will be given sorted in ascending order and will contain at least 2 and no more than 20 distinct positive integers, all between 1 and 10000 inclusive.

I requested the Google team to provide a clearer explanation of why the radius was a/b, but they didn't reply. There were many solutions and explanations listed on the internet. I'll be honest. This is the kind of problem I'd typically take some time to research, deduce and solve. I just didn't want to put in more time to solve this. Solving it just for the sake of solving it, and solving math problems in school just for the sake of solving them, always reminded me of this amusing story by Mr. R K Narayan. Here's an excerpt:

"...Rama has ten mangoes with which he wants to earn fifteen annas. Krishna wants only four mangoes. How much will Krishna have to pay?"... Swaminathan felt an unaccountable sympathy for Krishna. 

'Have you done the sum?' father asked, looking over the newspaper he was reading.
'Father, will you tell me if the mangoes were ripe?'
Father regarded him for a while and smothering a smile remarked: 'Do the sum first. I will tell you whether the fruits were ripe or not, afterwards.'
Swaminathan felt utterly helpless. If only father would tell him whether
Rama was trying to sell ripe fruits or unripe ones! Of what avail would it be to tell him afterwards? He felt strongly that the answer to this question contained the key to the whole problem. It would be scandalous to expect fifteen annas for ten unripe mangoes...What was the matter with father? Swaminathan kept blinking. Where was the urgency to know its price? Anyway, if father wanted so badly to know, instead of harassing him, let him go to the market and find it out.

If Swaminathan was first given some pocket-money and introduced to a situation where he actually had to buy something and figure out the best way to spend his money, he'd have appreciated and solved the math problem more willingly. Instead, what our school books and these coding interviews do, is present a problem to us which we know is pointless to solve. There are better ways of evaluating skill.

Dr. Stuart Woolley wrote a nice article on "Why You Should Never Consent to a Coding Test in an Interview". He observes similar points that I've noted about conducting such tests as a monkey-see-monkey-do of what some other company does for its interviews.

Some things that should be changed

  • Interruption: I was busy with some work. Why not contact me formally and schedule a time for the interview? 
  • Time limits: The foobar challenge needs you to login when they present the challenge. Even after logging in, there's a time limit. If you exceed it, you forfeit your chance. A friend received the invite while he was at work. Even he told me he didn't like the interruption and the fact that he was expected to login to his personal Google account while he was using his employer's computer. People may have various emergencies or problems in life they are going through. The time limit is unhelpful.
  • Lack of clarity: When presenting this kind of a challenge, it's necessary to look it at from the point of view of the reader, and ensure that the question is explained well. Level 2's question was neither explained properly, nor did they explain it when I requested. Yes, I know that people solved it anyway. Even I eventually figured out on my own, what the a/b was. My point is, that it's the recruiter's responsibility to put in some effort to explain it well (or at least respond when the candidate asks questions).
  • Solutions available: Various people have publicly posted answers to the foobar challenges. Solving it does not really evaluate a candidate's critical thinking and problem solving capability.
  • Time wasted: This process wastes time. Even if one spends many hours solving these problems, there's no guarantee of getting interviewed, or of getting the job. Think of how much time is lost in doing coding challenges of multiple companies.

The amount of time candidates lose when the time-consuming coding round is conducted as one of the later rounds, versus when it is conducted as the very first round

I know the recruitment process is complex. I know this is Google's way of finding candidates who like solving challenges in this way and want to join the company. I know that candidates should be grateful for being given a chance. However, in my humble opinion, this is a poor way of evaluating people. It follows a similar metric that schools and colleges use, where fishes are evaluated based on how quickly they can climb a tree.

Understand talent

An old management book I once read, had a page where the experienced author noted that even a mediocre but well-coordinated team can beat a highly skilled team. This is something that many companies need to understand. There are plenty of  intelligent people out there who have varied skillsets which may not be math-specific. They may take time to understand concepts. They may not be able to memorize a lot of information. But when they are given the necessary time, support, trust, respect and encouragement, they can use their creativity and skills to deliver better results than anyone else.

So companies, try this:

  • Candidate strengths: Re-design the hiring process to understand what people's interests and strengths are. Understand how individuals function and in what kind of environments they thrive. 
  • Submission simplicity: Re-design the application submission process to be simpler. Don't make candidates fill in long forms, where they basically type out the same things that are already there on their CV. Make use of the "Easy Apply" options on job sites, to allow them to submit their CV in one click.
  • Software design maturity: Don't conduct coding tests in the first few rounds. Doing it in the later rounds is ok, but still, making experienced candidates do coding tests is silly. Evaluate candidates on their ability to design de-coupled software components. Evaluate them on how well they create maintainable software. Evaluate them on how they design usable software. Check how they refer various sources or reach out for help when stuck with problems. See how they write test cases and how they design their software to allow for dependency injection, which makes it easier to create test cases. Look at their past work for sparks of creativity and innovation.

Remember: A 10X programmer is not someone who churns out code 10 times faster than peers. A programmer who plans and designs code well, is the real 10X programmer.

As for work environments:

  • Build a warm, cooperative and supportive work culture. Plan work well so that you don't have to overwork people.
  • It isn't enough to tell someone they are valued. They have to feel it. You'll notice that what employees really want from their boss, is knowing that their boss respects them. So select your managers even more carefully than you select your programmers.
  • Don't build an emotionally cold workplace. Frequent interaction and feedback are necessary. Especially in the first few years of employment. See the still-face experiment. The need for validation and encouragement applies just the same for adults too.
Despite various opinions, coding tests might just work when it is designed with a very specific objective or metric, and when the candidate is informed about that objective. I know at least one company that does this. Hoping that more recruiters plan interviews well.

05 October 2021

How to renew your RC at a Karnataka RTO

Note: This was written in October 2021. Please check if the procedures have changed, by the time you are reading this. The floors and counter numbers are specific to Yeshwanthpur RTO, but I assume the procedures should be pretty-much the same everywhere else. I didn't have to do any hypothecation, so there is no info about that in this blog post. 

When I went to the Yeshwanthpur RTO on a Monday, I found that everyone was very helpful and efficient. Right from the helpdesk person (who went out of his way to help me), to the mid-level and high-level officers. Everyone was getting work done quickly, and I could feel the atmosphere at the RTO was pleasant everywhere. It was surprisingly good to experience this.

Checklist:

  • RC (Registration Certificate) book or RC smart-card. Original.
  • Vehicle insurance paper photocopy.
  • Aadhaar card photocopy. I tried giving my PAN card photocopy, but they insisted on Aadhaar card.
  • Vehicle's emission test certificate photocopy.
  • Pencil, eraser and sharpener (for taking the pencil print of the chassis number). Pen (these are available in the xerox shops in the RTO building itself).
  •  Umbrella/rain-coat (if it starts raining at the place where the fitness check is done).
  • Water and some snacks or lunch.
  • Change (ten/twenty rupee notes and one or two rupee coins).
  • Be well-dressed and well-groomed. It creates a good impression.

For the above checklist, it's perhaps better to take not just the necessary photocopies, but also the originals, just in case.

I had to renew my bike's RC, so as per the instructions online, I visited the RTO website. In the main menu, hovered the mouse over the word "Parivahan", and clicked "Vehicle related services" in the sub-menu that opened up. In the next page that opened, I selected "Karnataka" as the state. 

Although there's a field for "Enter registration number", I didn't have to enter anything there. Just selected the RTO and clicked "Proceed".

RC menu

Various menu options opened up. Selected the one for "Renewal of registration". 

Online services menu

Then I was asked to enter the vehicle number and the last five digits of the chassis number. An OTP got generated and sent to my mobile phone. Once that was entered, I was shown a page with the latest tax details, insurance details and the fees. I verified that the details were correct. There was a green tax of Rs.250, a smart card fee of Rs. 137, renewal fees of Rs.300 and road safety tax of Rs.500. Total: Rs.1187.

Payment 1

Selected the option to pay online and was redirected to the payment page. Here, I selected the option to pay via SBI e-pay (which does not mean that I'll be paying via my SBI account. It just means that the payment from my bank goes to their SBI account). 

Here a little problem happened. I first selected the option to pay via netbanking. Then I thought I'd pay via debit card, and clicked on "Cancel". I canceled it even before I started the payment process. When I went through all the menu options above and tried making the payment again, I was shown a message that my earlier transaction was still pending, and I was not allowed to start a new transaction. So I clicked the green "Contact us" button on the top right of the screen, and registered a complaint, requesting them to cancel the transaction. I also sent them an email.

The complaint was registered, but three days elapsed, and there was no progress (on the eleventh day I got a response though, but by then I had already gone to the RTO and solved the issue). So when I went to the RTO, I was told to go to a counter where the tech person would cancel the transaction. At Yeshwanthpur RTO, the counter is at the 3rd floor. On reaching the 3rd floor, on the left side there's "Block A". I entered there, and the tech person was at counter T17 (the counter number is not visible directly. There was a narrow passage to reach the counter, and it's via this narrow passage that I could see the counter number). This person took a look at my RC and cancelled the transaction in less than a minute. 

Update: Ten days after I had sent the email complaint, they responded that the transaction is already cancelled. Two more days later, they responded to the complaint I had registered. So rather than wait for their response, it is better to got the RTO or maybe call up and get things done quickly.

Then I used my mobile phone to start the transaction afresh, and on reaching the payments page, I was shown a message that debit cards which used Visa, were not accepted. Thankfully, the same page had an option to switch to use netbanking. I selected that and made the payment online. 

After making the payment, when I re-visited the online services menu page, I was shown a pop up that listed out all the details I'd have to take care of, so that my vehicle passes the fitness test. I forgot to take a screenshot, so if anyone could share it, please do. Basically it's about all the electricals of the bike working well, the bike starting easily and being in a well-maintained condition.

Printing the receipt

After making the payment, it's possible to go to the online services menu again and in the horizontal menu on the top, click "Status", and select "Reprint receipt/form". I believe this is what displays the filled form 25. Unfortunately, this option was not showing up for me since I was accessing the website from my mobile phone. It didn't show the option even in the desktop mode of the mobile browser. So I went to the first floor where there were some Xerox shops. They told me exactly what I needed to submit. They opened up the website on their computer, found my filled form 25 and fee receipt, got the necessary printouts, gave me a brown paper file and a green postal envelope. Even the RC card needed to be put into a little plastic pouch in order to attach it to the brown file. Getting most of these things from the RTO itself is probably the safest option. Totally, it cost me Rs.56, because they took colour printouts. Later I found out that black-and-white printouts were enough. You have the option of taking the printouts of the fee receipt and form 25 at home itself. 

If you have trouble with the menu's always redirecting you to some specific page, you can always clear the browser cookies and start afresh.

All these documents; the form 25, the e-fee receipt, the RC in a plastic pouch, the green envelope, the photocopies of the insurance, emission test certificate and Aadhaar card, have to be threaded with the little red thread they give you along with the brown paper file.

Filling details in the form

  • On the green postal envelope, I had to write my name, house address, phone number and vehicle license plate number.
  • On the form 25, I had to enter the date, sign thrice in the area for specimen signatures and sign as the applicant and sign as the owner. So the form 25 ended up having my signature in five places (and that's normal). Since the payment was done online, the form 25 contained all other necessary details of my vehicle. I didn't have to write any of it. There was a space for what seemed like it was meant for sticking a stamp-sized photo, but the official said that sticking a photo was not necessary.

Payment 2

On the third floor, block B, counter 7, the person checked the forms and told me to go to block A to pay Rs.74 more. So at block A, counter T18 (note that this is not the cash counter NT8), I paid the extra Rs.74 in cash, which was for the smart-card. The actual smart-card cost is Rs.137+74, but the additional amount didn't get updated on the website, which is why it didn't get included in the online payment. They give a receipt for this Rs.74, and I had to write my vehicle number on it. The receipt had to be added to the bunch of documents contained in the brown paper file.

Verification

The person at the third floor, block B, counter 7 then verified everything in the brown file and asked me to proceed with the vehicle fitness test.

Vehicle fitness check

When leaving the RTO for the fitness test, I had to pay the parking fee. For the fitness check location, almost everyone talks about going near Mysore Lamps Factory. But when driving toward the place, I didn't see that landmark. After driving for a while along the road shown in the map below, I noticed a small pit-stop that deviated toward the left from the main road. Similar to how there's a small pit-stop at some bus stops, so that the bus does not obstruct traffic. That "pit-stop" is where the fitness check is done.

Fitness check location
 

I was told that the inspector would arrive by 12:30pm, and he did (which is an important point to note. If you go there much earlier than 12:30pm, you'd end up waiting for a long time). The inspector asked to see my form 25, he verified it with my bike's chassis number. Then he asked me to start the vehicle, checked if the lights were working and did a bit more inspection (tyres and general condition of the vehicle). They seem to have a knack of knowing which vehicles are serviced well and in good condition. I think his colleague kept track of which vehicles passed the fitness test. All this lasted only around two or three minutes. For everyone whose vehicles passed the fitness test, he told us to meet him at the RTO at his office at 3:30pm.

One person who came to get his vehicle inspected, had got his bike cleaned and polished so well that it actually looked like a brand new bike. I, on the other hand, had got my bike serviced a few months prior, and just used water and a cloth to clean my bike myself. That was enough for my bike, since it had no rust and was regularly serviced. I had also replaced both the worn out tyres with new ones. Basically, the inspector checks if the vehicle is road-worthy and whether it complies with the rules. Servicing the vehicle via an experienced, knowledgeable mechanic or authorized service center is more than enough. You don't have to go overboard with repairs. A routine servicing to ensure that the vehicle complies with motor vehicle rules is sufficient.

Pencil print

It was not necessary to take the pencil print of the chassis at the place of inspection itself (in-fact, they asked us to move on quickly). So I went back to the RTO, parked the bike there and took the pencil print. On form 25, there's plenty of space at the bottom of the page and at the right side of the page, where the pencil print can be taken. The inspector's assistant had told me to do it at the bottom of the page. I noticed that pressing the pencil tip too hard didn't create a good chassis number impression. Doing it a bit lightly, gave a good result. Some online posts spoke of how difficult it was to get this pencil print, and how they had to use a drop of petrol or oil to get it done. I didn't face any such trouble. 

Taking a pencil print of the engine number was not necessary.

Facilities

  • There is a tiny stall at the ground floor, where one can get biscuits, some other little snacks, tea, soft-drinks and bottled water. If you want a proper meal, there's a restaurant near the flyover named New Sagar.
  • On the ground floor, at the back side of the compound, there's a clean pay-and use toilet. On the third floor, there's a toilet a little away from the B block entrance.
  • There's a reasonable amount of parking space. You can park all around the compound of the RTO. Visiting on a weekday is best, since one can avoid parking congestion and avoid long queues.
  • There's an elevator you can use to visit various floors.
  • There are various shops for notaries, stationery and insurance.

Inspector's office

At 3:30pm, the inspector was at his office. This was at the third floor, office i2. The office of the inspector of motor vehicles. He signed on the form 25 and handed my file to his clerk. The clerk entered my vehicle number into his computer and said that I had to obtain a release from another counter. So I went to counter T14 in block A, and the person did the necessary release in the computer and put a seal on my form (if you did your road tax payment online, you'd have to ask the person at counter T14 to update the info in their computer too. Else you'll encounter an issue I faced as mentioned below under the "Receiving the RC" section). I brought the form back to the inspector's office, and the clerk completed the remaining formalities in his computer. Then he put a seal on my form and asked me to submit it.

Submission

At the third floor, block B, counter 6, the person accepted my file, checked it and gave me a pink receipt as acknowledgement. I was told that the renewed RC would be sent to me by post.

While leaving the compound, I had to pay the parking fee again.

Viewing the status of the application later

Viewing status

In the Status menu, select the "Know your application status" option, enter your vehicle registration number and captcha and you can see the status of your online payments, the status of the fitness check, the RC renewal approval status and even when the smartcard was printed and dispatched for delivery.

Receiving the RC

Even a month after I submitted my file, there was no progress, so I visited the RTO, showed the acknowledgement slip, and the officer asked a person to find my file. He found it after quite a bit of searching, and I noticed that the file was the one I submitted 15 years ago when registering the bike. The officer checked the details in the file and the file went ahead for further processing.

Within a week, I saw the status as approved. Another week later, the status was that the RC was printed. But even a week after that, it wasn't dispatched. So I went to the RTO again, showed the acknowledgement slip and the officer located my self-addressed envelope, asked me to sign in a register and handed me my RC. Due to a chip shortage in the semiconductor industry, they couldn't print a smartcard, so I received the RC as a paper printout with a QR code. If I had waited longer, the RC would have reached me by post. Instead of depending on the RC reaching you, by the time the RC is printed, it should be available on DigiLocker. Legally, the RC on DigiLocker is as valid as the original document.

When I looked at the "tax paid" section of the RC, I noticed that they didn't update the date. So I had to go to the technical assistant, who redirected me to counter T14, where the info about the road tax payment got updated. Apparently, when the transaction is done online, the road tax payment info does not get updated automatically at the RTO's computers. You have to tell them to do it. Once done, it's just a matter of downloading an RC extract online. I believe this can be done on Karnataka One.


Additional note

Since my license plate was old, I was considering replacing it. Near my house, the people who made license plates, were making it using Aluminium, and they were adding a blue logo with a circular pattern of stars and an IND written on it. But I had found out that such a logo was not the actual HSRP license plate that the government mandated. I asked the assistant public information officer at the RTO, and he confirmed that those blue logo license plates were not what we had to use. I also met the head of the RTO who said that the RTO can tell us what the rules are, and the rules are what is specified in the motor vehicles act. 

Vehicles manufactured after 2019, are equipped with proper HSRP license plates. Such license plates have a special laser etched number below the IND mark. As of October 2021, Karnataka does not yet have a provision to issue HSRP license plates for older vehicles. So for now, older vehicles just need to follow rules 50 and 51 of the motor vehicles act 1989. Rules and HSRP details are also mentioned on this website. Places like Delhi have an online method of applying for HSRP plates. The officer at the RTO didn't reply to my query of when HSRP would be rolled out for older vehicles in Karnataka. I was however told that the RTO does not issue replacement license plates. I'd have to get it done outside. Some shops that make license plates, are currently refusing to give anything other than the IND plates. Some are also overcharging, at around Rs.550 (for 2 wheeler front and back plates), for what should cost Rs.300. Try finding a shop that complies with the rules in the motor vehicles act (see this and this).


Hope the details helped. I've noticed that there's a lot of confusion that people go through when following these procedures. There's a lot of doubt about many details too. This article was meant to clarify those. There's nothing to worry about. It's a simple and efficient procedure. The people at the RTO are a friendly and helpful group of people. It was a simple process that can of course be automated a lot more, but I was happy about the hassle-free experience.

Update: I also created a guide for how to renew a DL here.


Say thank you or donate

09 September 2021

Capturing the screenshot of a menu

 Sometimes, when making a tutorial or when wanting to send feedback to a company, you may need to take a screenshot of a dropdown menu. But when you press the PrtScn key, the menu disappears. Fortunately, there are some ways to take the screenshot. The trick is simply to invoke the screenshot application by setting an interval of a few seconds during which you open the menu and keep it ready to be "screenshotted".

Shutter:

Shutter used to be available on Ubuntu via apt, but from Ubuntu 20 onward, it's available via snap. So to install it, use either:

sudo apt-get install shutter

or 

snap install shutter


Once you install and start Shutter, just open up the preferences and select the option to capture the screenshot after a delay of x seconds.


Once you capture a screenshot, Shutter also allows you to edit the image within Shutter itself. You can crop it, add arrows and do a lot more. So there's no need of opening a separate application like Gimp. 

Shutter also offers options to automatically upload images to various servers you choose. Truly a versatile tool!

09 August 2021

Understanding and helping people who have eye strain

People experiencing severe eye strain often find themselves grappling for help in a world that does not even begin understanding what they are going through. Moreover, some inexperienced doctors end up thinking that the person is exaggerating, when certain methods aren’t able to cure the person.

The need to protect the eyes does not depend on the severity of eye strain. Everyone needs to be protected. Here’s how:

Think of the eye strain like a fractured leg

Do you motivate people with a fractured leg to run a little everyday to recover? Unfortunately, that’s what well-wishers do, when they tell eye strain patients to “do eye exercises everyday”. It’s what employers do when they think that all the employee needs is a little nudge and motivation to “just try working a little longer and get the work completed”. It’s what institutions do when they give short deadlines for assignments. It’s what family members and neighbors do, when they (often unknowingly) create situations that disallow people from getting eight hours of uninterrupted sleep each night.

Strained eyes need sleep and rest for recovery. A lot of rest.

Don’t ask for medical proof

Even during my chronic stages of strain, my eyes were not red. There were no physical manifestations of the severity of the strain (well, perhaps dark circles under the eye would count). Those were years when my extraocular muscles were sore and paining everyday, throughout the day. Doctors couldn’t quantify the strain or even identify the cause, and there’s insufficient research on how sleep and rest can cure fatigue-related strain (probably because it’s hard to measure strain of the extraocular muscles and probably because people don’t see the point of researching something so obvious as rest being the cure for fatigue). Everyone who uses the computer excessively faces eye strain. You don’t need medical proof that sleep and rest are necessary.

Be kind

All of us have been entertained with stories of heroic deeds of people who overcame adversity, people who went through sleep loss and pain and emerged victorious. All of us have had someone lecture us on how important it is to work hard. Often, these words reach us as uncompromising, patronizing, sharp criticism and sarcasm. This mode of speech gets passed on from person to person. Not surprisingly, when someone with eye strain asks for proper sleep and rest, the harsh response gets auto-activated and pours out…in an effort to quell what is perceived as laziness. Be kind to people who are suffering. Allow them to get the rest they need. If there’s urgent work to be done, assign the work to someone else and allow the person suffering from eye strain to switch over to tasks that do not involve too much strain on their eyes. Eye strain does not affect people’s intellect. There are a lot of other skilled tasks they can do.

It’s important to create a culture that allows people to heal.

Rest has to make up for sleep loss

Eye muscles get strained faster when a person has not got sufficient uninterrupted sleep (see the table below to know how much sleep one needs at various age groups). So when a person hasn’t had enough sleep, they should be allowed to take a short nap when sleepy or take more frequent breaks by closing their eyes to rest. It also helps lower their workload for the day.

Don’t force people to eat bad food

If someone wishes to avoid food at an office party or celebratory sweets or cakes and snacks at a birthday celebration or even at a canteen or restaurant or nearby bakery, don’t nudge or force the person to eat the food. The food from many sources are not fully cooked or poorly baked/fried. It results in digestive problems that result in sleep loss and cascades into eye strain.

Avoid unnecessary nudging

When I told an engineering director that I could use the computer only for a certain number of hours everyday, his conclusion was that I could be persuaded to do so for two extra hours. An ex-employer told me they’d do everything they could to accommodate my eye strain, and ended up giving me enough work that it’d take three people to do it. Many companies that claim to have work-life balance, don’t have it. Good companies will have managers who are competent enough to plan proper timelines, ask for the right budget, assess skills, manpower requirements, create buffers and manage client expectations. When projects get messy, they know to allow for time to pause and make fixes so that errors and stop-gap solutions don’t add up to eventually become the last straw on a camel’s back. This is the value that managers add, and this is why they are paid well. Good managers don’t need to overwork people.

Create a healthy work culture

“Please, sir, I want some more”. The master was a fat, healthy man; but he turned very pale. He gazed in stupefied astonishment on the small rebel for some seconds, and then clung for support to the copper. The assistants were paralyzed with wonder; the boys with fear. — an excerpt from Oliver Twist’s story, where he “dares” to ask for more gruel.

The astonishment of the “master” mentioned in the quote above, is what I saw on the face of an interviewer when I “dared” to tell her that I would not be able to work for longer than the stipulated time even if there’s a deadline. Somehow, most companies take it for granted that they can just make people work long hours. On top of that, there’s the bell curve that’s designed to motivate people, but ends up pitting team members against each other and ruining camaraderie. It’s time we acknowledged the pointlessness of such a work culture. It’s time we said no to overtime. There’s more to life than this. Work can be done with goodwill and greater efficiency in a healthy, sensible work culture.

Officially recognize RSI as a health hazard

Repetitive Stress/Strain Injury (RSI) is an injury that can have temporary or permanent effect on the body. In the same way that companies draw yellow safety lines on the floor, have “hard hat” areas and create various policies for safety, it’s necessary to create safety policies to protect people from eye strain, back pain, wrist pain, sleep-loss and any other such RSI’s. Without an official policy, the managers and employees won’t really be able to do much to protect themselves when deadlines approach. Policies also need to be created for schools. Unhealthy practices begin at school and home, eventually cascading into workplaces.

Start early

The problem begins from childhood, when children go to sleep late and are woken early for school. This continues with late-night study during exams, excessive computer use, lack of a well-balanced diet and other dietary problems that result in sleep loss.

Hours of sleep required, as discovered by the National Sleep Foundation. Image attribution: Wikipedia.


 

It would help to create a culture where right from childhood, the need for sleep, periodic rest and proper nutrition is emphasized and followed. At workplaces, ergonomics, periodic rest, proper planning, avoiding overwork and hiring people with an inclination to do the job well, would help.

It’s possible to have a sensible, kind, caring, healthy world. We just aren’t cooperating hard enough to create a heaven on Earth. Some countries are creating such a culture and it’s working well. Let us try too.

04 August 2021

Sharing a folder between users on the same Linux machine

This method creates a group named sharedFolder, and a folder on root, which can be used by user1 and user2, for sharing files.

First create the group and folder:

sudo groupadd sharedFolder
sudo mkdir /sharedFolder

 

Now set permissions:

sudo chgrp sharedFolder /sharedFolder
sudo chmod 770 /sharedFolder

Ensure that even subdirectories will have the permissions.
sudo chmod +s /sharedFolder

Add the users to the group:
sudo usermod -a -G sharedFolder user1
sudo usermod -a -G sharedFolder user2


This is especially useful after you've got rid of Windows (really, I've given up on Windows now) and need a way to share files without creating a separate NTFS partition which needs to be mounted to be used.

14 July 2021

What to do when Ubuntu's boot time is higher than it should be?

 I've always liked watching the Linux boot messages. So first, we can get rid of the "curtain" or the splash screen that hides those messages.

Execute:

sudo apt install -y gksu

gksudo gedit /etc/default/grub

In this file, remove the words "quiet splash", but leave the quotes intact.

 

From this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

To this:

GRUB_CMDLINE_LINUX_DEFAULT=""

Save and exit.

 

While you are at it, you could also remove the distasteful pink background:

sudo -H gedit /usr/share/plymouth/themes/default.grub

 

Change the color to something like 10,10,10,0.

Save and exit.


sudo update-grub


Now restart the system. In my case, there was a delay of one minute and thirty seconds. I noticed a message "A start job is running for dev-disk-by". 

 


This happens because one of the partitions on the disk has a unique id that does not match the unique id stored in fstab.


On opening fstab (sudo -H gedit /etc/fstab), I noticed that it mentioned a certain UUID for the swap partition. I ran sudo blkid and noticed that the actual UUID mentioned here for the swap partition was different.

So it was a simple matter of taking the UUID from blkid and replacing the UUID mentioned in fstab

Once this was done, the system booted without the long delay.

29 June 2021

Fixing pyaudio installation errors in Ubuntu and Raspberry Pi

I don't understand why developers can't just write a script to automatically detect the OS and install dependencies automatically. When installing pyaudio, there's this error that shows up on Ubuntu:

ERROR: Command errored out with exit status 1:

...blah blah...

src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1

The solution is to install the dependencies. Not all of the below dependencies are required, but it's safe to just copy-paste these one by one to get them installed...just to be sure.

sudo apt-get install -y libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
sudo apt-get install -y ffmpeg libav-tools

And finally...

sudo apt-get install -y python-pyaudio python3-pyaudio

or
sudo pip install pyaudio 

or 

sudo apt-get install -y python3-pyaudio 

or 

sudo apt-get install -y python-pyaudio

or
sudo -s
pip install pyaudio

Sources: source1, source2.

If the problem happens in Raspberry Pi, these are the steps:
Remove the directory PyAudio which is already present in /home/pi and then try these steps:
sudo apt-get install git
sudo git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
sudo apt-get install -y libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
sudo apt-get install -y python-dev
cd pyaudio
sudo python setup.py install

Thats it! Have fun.

24 June 2021

How to use Jupyter notebook locally (and an intro to Fast AI)

When refreshing my knowledge about which Deep Learning library is currently most popular, I came across a blog which listed PyTorch at the top. Theano was apparently on its way to oblivion, and libraries like Neural Magic and Caffe claimed to offer better performance than TensorFlow. However, Fast AI was a library which had an accompanying course that was gaining popularity quite fast. Their book is available as a free Jupyter notebook, but I wanted to try it offline. Here's how:

You don't need to install Anaconda. Just do:

pip install jupyter

To get Fast AI's book, do:

git clone https://github.com/fastai/fastbook.git

Open a terminal in the cloned folder and type:

jupyter notebook


Your default web browser will open up and the Jupyter environment will be available on localhost as http://localhost:8888/tree.

 

It's that simple. Now just click on the hyperlinks on the page, and the ipynb notebook will be visible. You'll have to wait a few seconds for the notebook to load though. 

Do have a look at Fast AI's course too. Quite good. Although I prefer watching it directly on YouTube, since there are additional video controls there. Lesson 0, lesson1, lesson 2, lesson 3, lesson 4, lesson 5, lesson 6 and lesson 7.


01 June 2021

Using DosBox in Ubuntu

When an Australian who goes by the internet name "Sparcie" decided to review some of my games (I guess he found it via a GitHub search), I noticed he did it on an MS-DOS emulator named DosBox. 

(Sparcie has a treasure of awesome videos on various BASIC programs, games and legacy hardware. Check out his channel and blog)


I thought I'd give it a try too, and although it was a bit hard to understand at first, it's easy once you understand why it was created as such. 

Installing dosbox

To run it on Ubuntu, first install it using:

sudo apt-get install -y dosbox

Then start it by typing "dosbox" (without the quotes) in a terminal. That'll create a config file that you can find in a hidden folder in your home folder, named ".dosbox". 

ls -altrh will show you the folder. In Nautilus (the graphical file manager that's the equivalent of Windows Explorer), you can press Ctrl+H to see the file, since it's a hidden file.

Initial configuration

To be able to access files from Ubuntu on dosbox, you can create a shared folder named DOS. I'll assume you've created the folder in the home folder ~/DOS. The tilde (~) is a shortcut for the home folder in Ubuntu.

The hidden folder is in Ubuntu's home folder, and contains a configuration file named dosbox-<version>.conf.

Similar to the autoexec.bat file in MS-DOS which used to be run on startup (same as startup scripts for Ubuntu), the dosbox conf file has an autoexec section where you can type DOS commands to execute when dosbox starts. So search at the bottom of the conf file to find "[autoexec]", and below it you can type your commands. I typed the following:

[autoexec]

mount C ~/DOS

echo "~/DOS is mounted onto the C drive"

C:


Remember that the folder names are case sensitive. This ensured that the DOS folder was mounted onto the C drive and the current drive was automatically shifted from the default dosbox Z drive to the C drive. 

Now, once you start dosbox from the Ubuntu terminal, you'll see an emulated MS-DOS command prompt from where you can run "dir" and you'll see the files you've placed in the ~/DOS folder. 

Adjusting program execution speed:

If your plan was to run DOS games, you can do so. However, you'll notice that some games run slower than they are supposed to, and some run too fast. To adjust this, you can search the conf file for the line containing "cycles=auto", and do some trial and error with various values like:

cycles=normal 1000

or 

cycles=normal 5000

For a more specific value, see these tables which show which CPU type the values represent.

 

The conf file shows there are a lot of other settings that can be emulated. See the FAQ for more info on dosbox. Wish you a happy trip down the memory lane.


Update:

As Sparcie mentioned in the comments, you can use Ctrl+F11 to reduce the cycles while dosbox is running (the cycle value will be shown at the top of the window. Ctrl+F12 speeds it up). However, if dosbox is using just one core, taking the cycle count too high will simply put one CPU core at 100% and slow down the program in dosbox. Adjusting the core's setting might help, but I haven't tried that yet. Perhaps a simpler option would be to just use a virtualbox with an older version of Windows installed. Or, use one of the modern QBasic interpreters.

Turns out there's an official QBasic for Windows 10, from Microsoft, there's a QBasic64 for Windows, Linux and Mac! (with source code). Nice to see people maintaing QBasic even after all these decades. Similarly, there's even a modern Logo.




13 May 2021

The real cure for eye strain: More experiences

 

The Real Cure for Eye Strain : More Experiences from People Around the World

This article lists experiences of other people with severe eye pain. This is a followup on my earlier article about the cure for eye strain (including the need to check with a capable ophthalmologist, since myopia and eye strain can have various other causes).

Note: Many people earn money via the number of claps they receive on their Medium posts. My Medium account has not, is not and will never be monetized.
A healthy break by closing the eyes, taking a nap when sleepy, ensuring 8 hours of uninterrupted sleep each night and getting a well balanced diet of properly cooked food, can do wonders. [Image attribution: Pexels.com]

1. Sanjeev’s experience

[Clicking the rectangle above, will take you to the website]

Sanjeev’s doctors were unable to figure out the cause of his eye pain. He theorizes that his problem arose from poor posture, and he developed a set of exercises to overcome the problem. Without knowing more about his condition and his lack of response to my communication, I’m not quite sure if his assumptions were accurate. I would assume he may have automatically reduced his computer use, which may have been the real reason for recovery.

2. Dmitriy’s experience

His experience seemed similar to mine, where he lost sleep and used the computer too much. The doctor had no clue about how to solve it (as he mentions in the end). He found my article useful. Hoping to hear from him once he gets cured.

3. Jack’s experience

Same problem. No doctor could help. Sadly, he suffered much longer than me. He mentions the strain began after he got a programming job, but he also believes that a neck injury may be another reason. I’d vouch for the excess hours of programming being the reason. The comments on his blog show a sad pattern of severe eye pain being faced by many…and inexperienced doctors sometimes thinking that the patient is lying.

4. Neil and Perry’s experience

These highlight other causes of excruciating eye pain and the danger of constantly using some kinds of eye drops. It also hints at severely affected nerves being a cause of the pain. What’s heart-wrenching here, is the same problem I’ve been through: dismissive doctors thinking that the patient is lying.

5. My experience

My experiments and process of getting cured led me to the commonsense solution of obtaining proper uninterrupted sleep for 8 hours, taking breaks by closing my eyes after 20 minutes of strenuous eye involvement and obtaining a well balanced diet of properly cooked food (proteins in particular). So far, this has been the only solution that worked. The fact that my eye power reduced a little, gave me more assurance of its efficacy.

Note to Employers

Some employers create an illusion by telling people that “the workload you take on is completely dependent on you”. Then they proceed to dole out work that ends up in a lot of overtime.

Dear employers, please make sure employees get the rest they need. Burnt out employees are only going to inadvertently reduce productivity and end up causing more errors. Every experienced manager knows that overworking people is not always going to guarantee project success. Rather than use tactics of nudging people to work longer, improve the way you plan timelines and buffers. No matter how urgent work is, let employees take periodic rest by allowing them to close their eyes or take a nap to rest. Shun overtime. There’s already decades of research on productivity, which shows that long working hours are neither helpful for the employee nor the organization.

We have a short life…a mere blink in the annals of time…on a planet that’s less than a speck of dust in the expanse of the universe.

The gift of normal vision

The number of people facing eye strain appears to be increasing. However, certain solutions/cures being provided to them and the constant pressure of school/college/work and digital-screens/sleep-loss/bad-food does not seem to allow them to heal. We need come together to do more to build a healthy planet with healthy people. The gift of normal vision is especially too precious to ruin. It’s sad that people are being prescribed spectacles and eye drops and are made to work longer instead of being advised and allowed to get rest and recover. How many people’s eyesight needs to be ruined to make a living?

All this being said, one shouldn’t rely solely on self-diagnosis. Periodic checks by a capable doctor is necessary. If the strain is being caused by some other reason, even if the doctor couldn’t figure out the problem immediately, the diagnostic procedures may help eventually figure it out. But no matter what the doctor prescribes, never forget to do the three fundamental things:
1. Eight hours of uninterrupted sleep every night.
2. Closing the eyes after 20 minutes of strenuous eye involvement (also relax the face & neck muscles), and waiting till the strain subsides.
3. Getting a well balanced diet of properly cooked food.
Any responsible, sensible, competent doctor will prescribe these three things too.

I’d love to hear your opinions and experiences in the comments. Also, please tell more people about the cure. Not enough doctors are telling eye strain patients to get proper rest and sleep.

A case for the single password field

We often spend our lives accepting the status quo. There are times however, when it helps to ask what can be done differently. For example, whenever we are asked to create a new password, we are asked to type the password into two fields.

When joining the snapcraft forum however, I noticed that they asked for entering the password only once.

 

Then it struck me...it makes perfect sense! Even if there's a typo in my password, this is a platform that allows sending an email to reset the password. 

If it was a desktop application or an OS login, it'd make sense to request entering the password twice. Web apps like these can do just fine with a single password field.

Good to see the Snap team being thoughtful and unafraid of creating a new path instead of following convention.


12 May 2021

Pushing to GitHub without needing to type the username and password each time

I've already written about doing this on Windows. Here's the Ubuntu version.

In a terminal, type:
ssh-keygen -t rsa (this is no longer accepted by GitHub)
ssh-keygen -t ed25519 -C "your_email@example.com" (also see this if ED25519 is not supported on your system)

When it asks "Enter file in which to save the key ", just press Enter and type a password. You'll be asked for this password later, so don't forget it.

Go to the ~/.ssh folder and open the id_rsa.pub id_ed25519.pub file with a text editor.
Select the entire contents of the file to copy the key.

In your GitHub account, go to the GitHub profile settings (your account's profile setting page. Not a specific project's settings page; go to the GitHub account's settings page).
Select SSH and GPG keys option in the menu on the left.
Click the green "New SSH key" button and paste the key that you copied.

On your local system, type:
git clone git@github.com:yourUserName/yourRepositoryName.git

You may be asked for entering the private key. Type the password you had recently created.

Add these commands to your ~/.bash_aliases file.
alias pushall="git push --all origin"
alias pullall="git pull --all"
alias commit='git add -A && git commit -m '

Save and exit the bash_aliases file.

Type:
source ~/.bash_aliases
to enable the commands you just entered.

Now simply go to the repository you cloned, make some changes to the files, do a commit with:
commit "a small change was made"

and push:
pushall

Tadaaah! Pushing and pulling becomes so much simpler.

23 April 2021

The open sourcing continues...

When most people talk about "contributions to open source", what they mean is that you join an open source project and contribute code to it. However, that's not the only way to contribute to open source.

In 2014, I had written about seven other ways in which you can contribute to open source...to which Noah Slater replied, encouraging people to also promote the spirit of contributing to open source.

Each time you report bugs, help people on the internet and create your own open sourced software, you are indeed an open source contributor. 

Yesterday, I noticed that some of my repositories were being forked. Happy that the programs I developed are of use to the community. 


The file duplicate finder is a program I'd encourage people to use (and from the fact that an issue was reported, it looks like people are finding the project and hopefully finding it useful). Sometimes we have a lot of duplicate files and images lying around in various devices. This program helps identify and consolidate them. 

 

When looking at how often people contribute code:

I just noticed, that my public view of GitHub commits, does not show what is going on in the private repositories (which show a lot more commits). This is something recruiters would benefit from keeping in mind.

Public View

Private View (the actual number of commits)