Const vs Let vs Var [JavaScript]

Follow me.

Constant pointers vs pointer to constant vs constant pointer to constant.

Here.

If telling the truth is deception,

then we are gladly guilty. – Megatron

On being the right size – J.B.S. Haldane

Gravity, a mere nuisance to Christian, was a terror to Pope, Pagan, and Despair. To the mouse and any smaller animal it presents practically no dangers. You can drop a mouse down a thousand-yard mine shaft; and, on arriving at the bottom, it gets a slight shock and walks away, provided that the ground is fairly soft. A rat is killed, a man is broken, a horse splashes. For the resistance presented to movement by the air is proportional to the surface of the moving object. Divide an animal’s length, breadth, and height each by ten; its weight is reduced to a thousandth, but its surface only to a hundredth. So the resistance to falling in the case of the small animal is relatively ten times greater than the driving force.

Read the whole thing here.

Contextmenus.js

Purely Javascript based solution allowing for easy creation of right-click context menus. Browse the code on GitHub. Demo

So, Haider posted on his Facebook timeline, a link to his then newly setup github repo which he had named “rightclick.js.” It was pretty clear what it was about so I gave his code a look. He is using JQuery, and (for some reason unclear to me,) NodeJS.

This morning, I decided to make my own in pure Javascript. I started around afternoon and got done with it a couple of hours ago. I wanted to call it contextmenu.js but there already exists a script by that name, and thus, out of respect, I renamed mine to contextmenus.js. The code happens to be a couple of files that together take up a total of 1812 Bytes of disk space. Everything  that you need to know, in order to get it to work for you, is explained in the README.md on the GitHub page.

Progresive Web Apps

You are using a computing device, be it a smartphone, a tablet, a desktop computer. It’s new, shiny, with little or no applications installed, _apart from the bloatware that the manufacturer could have generously shipped with it. _You fire up Facebook in a web browser, like a couple of pictures, post a status, have a small chat with a friend, and then after a while, you close the tab and lock your phone. After a while you do it again, and this time, you spend a whole hour scrolling through the news feed, and then once again you close the tab, and lock your device.

Now while it’s locked, and still connected, your device makes a decision. Assuming that you like Facebook, it adds a Facebook icon to your homescreen, or your app-drawer, for easy access to facebook.com. So the next time you unlock your iPhone, you simply tap on that icon, and it opens facebook.com in your default web browser. You love it.. It’s just a simple link, but it already feels great, and it could be better. Soon enough, after another day’s usage of the site, you notice that tapping the app icon no longer opens a browser window with facebook.com. Instead, you get a window solely running Facebook like it’s a standalone native application for your operating-system.

Read Full Post

Physics 9702 Winter 2015 qp13 Q37

37 A network of resistors, each of resistance 1 Ω, is connected as shown.

1 Ω 1 Ω 1 Ω V 1 Ω 1 Ω 1 Ω 1 A

The current passing through the end resistor is 1 A. What is the potential difference (p.d.) V across the input terminals?
A: 2V
B: 5V
C: 8V
D: 13 V

Read Full Post

From Windows 8 to 10 – The excitements and the disappointments.

tl;dr

I have been a Linux user for the past few years, but I grew up using Windows, and I have always been closely interested in it’s progress and moves.

When Windows 8 came out, I was like the only person I knew who didn’t hate the Metro. All my friends thought it was ridiculous, and truth be told, it was. It seemed as if they had forgotten that people neither have a bunch of huge touchscreens lying around in their place nor do they love the desktop experience in full touch, and Windows 8 was a weird cross between an OS optimized for touchscreen, and an OS that didn’t look like it would ever work well with touchscreens.

Accessing the desktop by clicking on a tile at the bottom left corner of the screen was oddly disturbing.. it felt like the desktop had lost it’s old integrity.. Like it was only a tile among many, like it was just another app like the ones accessed by clicking the other tiles. Furthermore, at times, it was hard to decide which world to live in: the metro, that had a really long way to go, and was far from mature, or the desktop that we’d both loved and hated for ages. For Developers, it both sucked and was an opportunity at the same time. They had a new platform to master; some would go on to proudly declare themselves to be of the first 100 developers for Windows apps. Some developers saw it as mere clutter. Another language and platform to come across and not-read articles of.

The question was: “Why?”

Read Full Post

Can machines think?

Back in 1950, Turing’s paper, titled “Computer machinery and Intelligence,” was published in journal called “Mind,” and it was one of the things that can be credited for changing the way people thought about machines. Some readers were awestruck, while others only saw gibberish.

The paper, in a fair-amount of detail, spoke of computers, and the possibility of them being indistinguishable from a human in the future. The present day, may or may not be the future in question, but we have most definitely made a fine dent. Turing spoke of storage, and memory and processing and instructions, and of word, _in the second part of his article titled “_Digital Computers.” The model of computing defined in his article is what we know today as the Turing Machine.

The part on digital computers was preceded by “The Imitation Game.” You might be familiar with the 2014 movie of the same name, starring Benedict Cumberbatch as a young Alan Turing who builds an intelligent-machine so as to be able to decrypt the messages encrypted by the german Enigma machine. The Imitation Game, which is defined finely in his article, is what could be used as a Turing Test, so as to determine how close a machine is to imitating the behavior and thinking capability of a human being, and whether or not it could possibly hoodwink a human into mistaking itself for a human. The Turing Test is a popular topic for discussion among enthusiasts, and developers perform different forms of it on their AI creations to this day.

I could go on for a while, but there’s honestly no point to it, and your time could be better spent reading the original article.

Fixing the brightness issue on Ubuntu 16.04

  • The issue: Random flickering when changing the brightness using the function key, while the change wasn’t steady. The slider in system settings allowed me to change the brightness normally.
  • The machine: Dell Inspiron N5110

The first solution I tried was creating the /usr/share/X11/xorg.conf.d/20-intel.conf file with the following lines:
Section "Device"<br /> Identifier "card0"<br /> Driver "intel"<br /> Option "Backlight" intel_backlight"<br /> BusID "PCI:0:2:0"<br /> EndSection

This didn’t change anything. So I tried following “dushnabe’s” suggestion on this thread. Which too didn’t make any difference really. The problem, as I saw it was that I appeared to be using both intel_backlight and acpi_video0. Both use different ranges of values to change the brightness. Hence the flickering. It became clear that I had to force the usage of just one, and that’s exactly what the fix in that answer was supposed to do. Except that for some reason it wasn’t working.

After googling further on this, I landed on this page and I saw the list of kernel parameters that had to do with the backlight. I rebooted a couple of times, each time trying a different parameter, and finally,
acpi_backlight=native is what did the trick. I noticed that it doesn’t allow me to change brightness on login screen, but after login, there was no flickering, and when I ran ls /sys/class/backlight/, I saw that it no longer returned acpi_video0. The only issue I have right now is that there is no fixed minimum. Sometimes, it decreases to a reasonable minimum, while at other times, it results in a blackout, and I have to manually adjust it using the slider in system settings or using xbrightness..

To replicate this process, all you need to do:

  • Fire  up a terminal
  • sudo nano /etc/default/grub
  • At the very end of the string GRUB\_CMDLINE\_LINUX_DEFAULT, (which in my case was “quiet splash,”) add acpi_backlight=native.
    The final string, in my case, looks like “quiet splash acpi_backlight=native
  • Close and save the file, and run sudo update-grub and then reboot.

In the event that this doesn’t work, it’d be worth your time to try out the rest of the kernel parameters. You don’t have to modify the grub file every time. Instead you can choose to modify kernel parameters before boot. This you can do by pressing “c” on the grub screen and typing the desired parameter, in the correct place, right after “splash.”