9 Dec 2015

LMLE : How I created a compilation of "Invisible Man" notes

LMLE stands for "Linux Makes Life Easy". If you don't understand any of the commands used, please google them.

So today I was going through some websites looking for notes for "The Invisible Man" that I have to study as a part of out 12th standard syllabus. I found a good resource here http://thebestnotes.com/booknotes/Invisible_Man_Wells/The_Invisible_Man_Study_Guide01.html but realized that it had tons of different HTML pages each having distracting ads and stuff. I wanted a neat solution to read this stuff quickly without too much clicking.

Since I had 3 pre-boards left and I'd have to go through these notes at least 3 more times, I though it would be worth investing some time and get it formatted. But obviously, copy pasting 30+ times wasn't an option for me. I needed something much quicker.

So, Here goes.

I booted up Linux (sadly Windows is still my working OS), and opened up the terminal. I remembered Arjun telling me about wget a few weeks back, so I decided to give it a shot.

This is what I tried first

wget http://thebestnotes.com/booknotes/Invisible_Man_Wells/The_Invisible_Man_Study_Guide01.html"

Plain and simple, but it gave me only an offline version of the website itself. Then I tried this

wget -r

It gave me the same thing but inside a folder and it wasn't any use. Being the noob I still am, I tried man wget and tried figuring it out. But I didn't really have the time. So I consulted a programmers best friend - Stack Overflow!

I found this neat combination of options that helped me download all the files into one html file all at once.

wget -r -l1 -H -t1 -nd -N -np -A.html -erobots=off -O file.txt http://thebestnotes.com/booknotes/Invisible_Man_Wells/The_Invisible_Man_Study_Guide01.html

But guess what? It was no use because an extra "0" in "01,02,03" in the naming of the html links on the page ruined the ordering of the content in the output file.

So I just used the messy version of the previous command - download all html files separately and then parse them

wget -r -l1 -H -t1 -nd -N -np -A.html -erobots=off http://thebestnotes.com/booknotes/Invisible_Man_Wells/The_Invisible_Man_Study_Guide01.html

So now I had all the content locally. But they were all individual html files. I researched a little bit and found that there was a 3rd party utility available called "html2text" that did exactly what I wanted.

sudo apt-get install html2text

Boom. Installed. Just like that. Is it that easy on Windows? Definitely not. 

Only one step left.

html2text -utf8 -nobs -style pretty The_Invisible_Man_Study_Guide01.html > file.txt

But this gave me the output only for one file. So I just wrote a small script to automate it for all the files.

for x in 0{1,2,3,4,5,6,7,8,9} 10 11 12 13 14 15 16 17
      do
  html2text -utf8 -nobs -style pretty The_Invisible_Man_Study_Guide$x.html >> file.txt       done

After all this, I had perfectly readable content but the problem of some unnecessary text still remained. So I manually opened up the file and within 2 minutes, removed all the unnecessary stuff and it was finally perfectly formatted to my liking. (file.txt was the final output file.)

When I opened it up using gedit, the scrolling flicker was hurting my eyes, so I used a terminal based alternative.
To read it now, All I have to say is 

vi file.txt

If I'm looking for a particular section, I just use grep and read only that part. 
Works pretty well, worth spending half an hour.

Any questions? Leave a comment.

17 Sept 2015

Touchscreen-Tech

Have you ever wondered why your iPad does not respond to your finger? If you have wondered, then great, but if you have not, then, no problem. Anyways, in either case, it is worth knowing the answer!! To understand the answer to this question, we must first understand what “touchscreen technology” is, and how it works.

Technically ‘touchscreen’ is an input device layered on the visual display unit of an information processing system that enables you to operate the system using your finger, stylus or designed gloves.

In simpler words, it is the technology that helps your finger use your smartphone!

Nowadays, touchscreen technology is not limited to just tablets and smartphones but is instead creatively employed in almost everything from laptops to gaming consoles. It is used in hospitals, heavy machinery and even ATMs.

But, in order to be able to employ touchscreen technology as well as we do in the present, a lot of research and work has been done over the last five decades. And this work, can be traced down to scientist E.A. Johnson who first published his work on touchscreen technology in 1965. A decade later, at CERN the first transparent touchscreen was developed by Frank Beck and Bent Stumpe. In 1972, the University of Illinois filed a patent for the invention of an optical touchscreen, and consequently, further discoveries in the field led to what we possess today in our smartphones, tablets etc.

Now with this much of a background, we can now explore HOW touchscreen works.

There are essentially two main types of touchscreen technologies:

1.      Resistive Touchscreen Technology.
2.      Capacitive Touchscreen Technology

Resistive Touchscreen Technology:



In this technology, there are two layers separated by a very thin space. The front layer has an external hard plastic covering facing outside, and an inside conductive coating.

The layer behind, has a glass covering facing the outside, and a conductive coating on the inside of this layer.

When the front hard plastic coating is touched, the little pressure applied, causes the two internal conductive layers to touch. The device then recognizes which part of the screen the finger/stylus has touched, and accordingly performs its function. 

Capacitive Touchscreen Technology:

Here, unlike before, the pressure applied is not the determinant. Rather, it is the material with which the screen is handled with. 


There is an ITO (Indium Tin Oxide) conducting layer which is horizontally lined with electrodes and has electricity flowing through it. There is another ITO conducting layer beneath. This is vertically lined with sensing wires that monitors the flow of electric current in the first ITO layer.

The wires of these two ITO layer are now perpendicular to one another. These layers are separated only by a thin optical adhesive that helps them remain together intact.

So essentially when we touch the screen of the device with our finger, the electric field is distorted or altered from the first ITO conducting layer due to the conductivity of our finger. This alteration is sensed by the second ITO layer and then the point on the screen that our finger has touched, is identified. Accordingly the device performs its function.

So now the answer to our question is almost self-explanatory. Human nails are a poor conductor of electricity and iPads use capacitive touchscreen technology. So by nature, the nails do not alter the electric field, and so the iPad does not sense it!

I hope this article helps you understand how your tablet or phone responds to your touch!

Some of the references I have provided below can help you understand more about this subject. If you find anything interesting in the field and would like to share it, please post a comment.

References:

1. http://scienceline.org/2012/01/okay-but-how-do-touch-screens-actually-work/
2. https://www.youtube.com/watch?v=SzLoWDkBKXk
3. http://capacitive-resistive-touchscreens.articles.r-tt.com/

11 Sept 2015

International Linguistics Olympiad


Have you heard about the International Linguistics Olympiad (IOL)? If not, you’re not alone. A lot of students haven’t heard about this Olympiad, and that’s a pity — they’re missing out on an exciting opportunity.

Most people have heard about the International Olympiads in Physics, Chemistry and even Informatics (a.k.a. Programming). These are some of the the “International Science Olympiads”, and are recognized by colleges and teachers across the globe as the penultimate academic high school competitions. If you win a medal in one of these competitions, you’re considered the cream — the very highest outstanding achievement you could get.

[By the way, the olympiads that you write in school — NCO, NSO, IMO and IEO — are not truly international olympiads. They are actually competitive exams that are mostly restricted to India.]

The Linguistics Olympiad is one of the “International Science Olympiads”. Over 30 countries from across the globe send teams of their brightest high school students to solve challenging puzzles in Linguistics.

I’ve been to the Linguistics Olympiad. I went to Bulgaria in July 2015 as part of Team India. I forged new friendships, experienced new cultures, won an Honorable Mention and generally had a great time.

When I tell people about my experience, the first question I’m asked is, “How many languages do you know?”
That’s the thing: You don’t need to know multiple languages. ALL YOU NEED IS LOGIC!

That’s right. If you liked the logic puzzles posted on the Google+ site, then you’ll definitely enjoy solving Linguistics puzzles.

Here’s a sample.
And don’t be lazy. Spend some time on this and give it a try! (In fact, if you can, print this image out. At the very least, grab some rough sheets and write down your thoughts!)

Click the image to enlarge.

First off: Most of you don’t know Swahili. And that’s the point — no one’s supposed to be at an advantage here.

Let’s look at this problem analytically. If you haven’t printed it out, make sure you keep looking back at the question while reading my answer. You won’t understand it otherwise!
  • tarehe is repeating in every single Swahili date. It probably means “date” in English.

  • Disemba”, “Oktoba” and “Aprili” sound suspiciously like English months. In this case, they definitely are. You can check by counting the number of times each Swahili month appears, and comparing that with the number of times each English month appear.

  • Look at the English dates (B) and (D). They’re exactly the same, except for the number (2nd and 4th). The two Swahili translations should also be exactly identical except for those two numbers. Look at Swahili dates (3) and (5). They are identical except for the second words (“pili” and “nne”). Now we know that “Jumanne” means “Tuesday”. We also now know that the format for writing Swahili dates is:

tarehe” <number> <month> <day>


  • With this new information, compare (1) and (F). “tatu” is the number ‘3’. Make a list of all the Swahili number names, and try to find other correspondences. For instance, from (2), (4), (6) and (A), (C), (E), you can translate “tano” as the number ‘5’.

  • Did you notice that the day names in Swahili also appear to have the names for numbers? “Jumatatu”, “Jumatano”, “Jumapili”, “Jumanne”.
    We can guess that in Swahili, the days of the week are numbered (Day 1, Day 2… etc).

  • We know “tatu” means ‘3’. That means “Jumatatu” is “Day 3”. Look at sentence (4). “Day 3” could be either “Monday”, “Wednesday” or “Sunday”. (Those are the days in the English dates containing “October”.)
    Let’s assume that “Day 3” in (4) is “Wednesday”. Then, from sentence (6), “Jumatano” means “Day 5”, which should be “Friday”. However, none of (A), (C) and (E) contain the day “Friday”. That means the assumption is wrong.
    Try assuming “Sunday” as “Day 3”. Can you find out where this assumption goes wrong?
    Now try assuming “Monday” as “Day 3”. Does it work?

  •  If “Day 3” is “Monday”, then “Day 1” is “Saturday”. This means that the Swahili week begins on Saturday. (In contrast, we generally think of Sunday as the beginning of the week.)

  • From the translations of days and numbers you can work out all the other translations, match the dates, and complete the question.

To be fair, these problems aren’t exactly easy to solve. This problem, for example, would take anywhere between 10 minutes and an hour to solve.

However, no one said an International Olympiad was going to be easy. The actual IOL consists of 5 questions to be solved in 6 hours. Yes, 6 hours.

Interested in giving it a try? I strongly recommend that you do. To get selected, here’s what you have to do.
  • Write the Panini Linguistics Olympiad. It’s the national round of the Olympiad.
  • Be one of the 30 or so students from all over the country selected from that exam to attend a Training Camp. It’s sponsored by Microsoft and Xerox!
  • Be one of the top 8 (or 12) students in the camp!
For information about the IOL and past contests, visit: http://ioling.org/

The only way to get better at this is with some practice. If you’d like to solve some more questions on your own, start here: https://sites.google.com/site/paninilinguisticsolympiad/Resources/the-panini-junior-linguistics-olympiad

Do you dare to try some of the most challenging Linguistics puzzles ever designed? Choose from the past IOL problems over here: http://www.ioling.org/problems/

If you ever have any questions, or would like me to explain how to go about solving some question, feel free to email me, or post on Google+. I’ll make sure that all my answers are made available to everyone.

Finally, whether you plan to pursue this Olympiad or not, don’t keep this post to yourself. At the very least, let your friends know that something called the “Linguistics Olympiad” really exists, and send them the link to this blog post.