Connect with us

Science & Technology

How a Programmer Nearly Broke The Internet by Deleting Just 11 Lines of Code –

You might not be aware, but on 23 March 2016, the internet as we know it almost came crashing down.

A huge amount of the software the Internet is built upon crashed when an angry programmer decided to unpublish all his code from a popular Javascript registry called npm.

That doesn’t sound like a big deal – after all, code is deleted and re-uploaded all the time – but Oakland-based developer Azer Koçulu just happened to be the creator of a simple but frequently-used 11-line package that was relied upon by companies such as Facebook, Netflix, and Airbnb.

The problem was promptly fixed, and for the vast majority of us users, there was no down-time thanks to caching, and we wouldn’t have noticed anything out of the ordinary.

But for web developers, it was a temporary nightmare that resulted in thousands of builds failing each second. One developer wrote on the github forum at the time: “This kind of just broke the Internet”.

So how the hell does such deleting such a small chunk of code pull down the rest of the Internet like a house of cards? First, you need to understand that when it comes to building programs, there are a whole lot of modules and tools available to make the process quicker and simpler.

The biggest registry of these Javascript modules is an open-source platform called npm, which works sort of like an App store for developers. They look up the functionality they want, and hopefully fund a module that does it for them.

One of the most popular of these modules was Koçulu’s 11-line-long ‘left-pad’ module, which was a surprising simple, yet heavily relied upon, piece of code. In fact, the programming community didn’t even realise how relied-upon it was until Koçulu pulled it down.

Basically, left-pad is used as a shortcut by developers, so they didn’t have to write a whole bunch of basic code from scratch each time. “If a developer calls on an npm module, it’s basically shorthand for ‘put this code in later’, and a software compiler will just download the code when the time is right,” Matt Weinberger reports for Business Insider.

And it’s not just kids at home using those modules, we’re talking about high-profile Silicon Valley ventures here. Software that was reliant on left-pad included Babel, which helps Facebook, Netflix, and Spotify run code faster, and React, which helps developers build better interfaces, as Weinberger reports.

And most of the time that works just fine – unless of course the module in question disappears, which is what happened with left-pad after Koçulu unceremoniously unpublished it.

To give credit to the open source community, within 10 minutes, someone else had published a functionally identical version of left-pad, which fixed a few of the problems, but not all of them.

In the face of ongoing build fails, npm decided to take the unprecedented step of re-publishing the original ‘left-pad’ from a back up, which resolved the remaining problems.

But the move caused backlash and debate amongst the programming community, as well as discussions over why companies such as npm are allowing developers to build software on modules that can be unpublished at any time.

So why did Koçulu delete left-pad in the first place? As he explained in a post over on Medium, it all started because of a dispute with messaging company Kik, over a module Koçulu was working on, also called kik.

The company wanted him to change the name of his module so they could roll out their own product, but he declined, leading to some heated emails between the two parties (which you can see here).

Eventually, npm got pulled into the argument, and instead of siding with their long-time developer, they agreed that, for the sake of their users, having Kik the company use the package name kik would make more sense.

“It very quickly became obvious that they were not going to be able to resolve their dispute over the name,” npm CEO, Isaac Schlueter, told Ars Technica. “We made the decision based on what we thought would be in the best interest of the npm community. What it came down to is that a reasonably well-informed user who types ‘npm install kik’ would expect to get something related to Kik. So that’s why we turned (the name) over.”

Koçulu was understandably pretty annoyed by the decision, and sent them an email back saying:

“I know you for years and would never imagine you siding with corporate patent lawyers threatening open source contributors … I want all my modules to be deleted including my account, along with this package. I don’t wanna be a part of npm anymore. If you don’t do it, let me know how do it quickly. I think I have the right of deleting all my stuff from npm.”

A few hours later, npm gave him the command to do just that, and he deleted all 273 modules he’d registered on npm. But with all the focus on kik, no one considered the ramifications of deleting left-pad, and chaos ensued.

Koçulu has since apologised for the unexpected disruption, but stands by his decision. “Feeling very sorry for interrupting people’s work,” he wrote in an email to Ars Technica. “I did it for the benefit of the community in long term. Npm’s monopoly won’t be dictated to the free software community anymore.”

The bigger issue that remains is how to deal with these problems in future, and how to avoid them happening in the first place – and that’s something npm are now looking into.

“We dropped the ball in not protecting you from a disruption caused by unrestricted unpublishing. We’re addressing this with technical and policy changes,” wrote the company in a blog post last week. “We’ll continue to do everything we can to reduce friction in the lives of JavaScript developers.”

In the meantime, be careful with code out there, kids. You never know what could be relying on it.

A version of this article was originally published in March 2016.

Read More On This At ScienceAlert – Latest

Science & Technology

Samsung developing TV controlled by your BRAIN

Samsung is developing a TV system that might one day allow users to flick channels and adjust the volume using their brains.

The so-called Project Ponthius is part of a cooperation between the South Korean electronics giant and the Center of Neuroprosthetics of the Ecole Polytechnique Fédérale de Lausanne (EPFL) in Switzerland.

The aim of the project is to give people with severe physical disabilities, like quadriplegia, a chance to enjoy their favorite shows without the help of others.

Samsung is developing a TV set that might one day allow users to flick channels and adjust the volume using their brains.

The company presented a prototype during its developer conference in San Francisco last week.

‘How can we provide accessibility to people who cannot move or who have extreme limitations on their movements,’ senior scientist at EPFL Ricardo Chavarriaga said during the panel.

‘We’re making tech that is more complex, that is more intelligent, but we should not forget this tech is being made to interface with humans.’

The system uses a Brain Computer Interface (BCI) to connect the viewer with the TV set.

The BCI relies on a headset covered with 64 sensors and an eye-motion tracker.

The scientists are currently taking brainwave samples to determine how the mind behaves when we have a desire to watch movies.

This could one day lead to a system that uses cues from the brainwaves to make predictions, and then eye movements to confirm.

Once selections have been made, the software will be able to build up a viewer profile and inform future suggestions, streamlining the content selection process.

Although the technology might one day help people who have been paralyzed, it is unlikely to become mainstream anytime soon.

That’s because to use the current prototype users will need to apply gel to their heads before wearing a sensor helmet, something that may be more cumbersome than spending a few minutes looking for the remote control that you lost in the sofa cushions.

Samsung and EPFL are also working on another system that will allow viewers to interact with TV sets with their brainwaves alone.

This system could be particularly useful for people who suffer from disabilities such as locked-in syndrome, the highest form of paraplegia.

Other companies are also working on BCIs that might one day allow humans to interact with machines.

They include Elon Musk’s Neuralink, which is developing ‘ultra high bandwidth brain-machine interfaces to connect humans and computers’.

Source: https://www.dailymail.co.uk/

Continue Reading

Science & Technology

Headmaster Fired for Stealing School’s Electricity to Mine Crypto

Pink Slip

A headmaster’s side hustle just cost him his job.

On Friday, the South China Morning Post (SCMP) reported that Lei Hua lost his job as headmaster of a high school in China’s Hunan province because he was stealing electricity from the school — to power his cryptocurrency mining operation.

Sound Mined

According to the SCMP report, Lei began mining the cryptocurrency ether from his home in June 2017. After he discovered how much electricity his mining computer was consuming, he decided to move it to the school. He later added another seven machines, with the school’s deputy headmaster getting in on the action with a computer of his own.

Lei got caught after teachers noticed the whirring noise of the machines. The government reportedly seized his earnings, but it’s hard to estimate how much Lei earned given the volatility of the crypto market. The school no doubt hopes it was at least enough to cover the $2,120 energy bill his computers racked up during their year of operation.

Whole World Problem

This could be read as a cautionary tale against mining crypto on the company dime. But it should also serve as a warning that the energy consumption of crypto mining is out of control globally.

These school employees would rather risk their jobs than pay the electricity bill that comes along with a mining operation — it’s that energy intensive — but other miners across the globe remain undeterred. They’re firing up their systems and collectively using enough energy to push the globe to the brink of a climate catastrophe.

And unlike Lei’s school, we can’t do anything to stop them.

READ MORE: Chinese Headmaster Fired After Stealing School’s Electricity to Mine Cryptocurrencies [South China Morning Post]

Source link

Continue Reading

Science & Technology

Neuroscientists Have Finally Tracked Down The Bilingual Language Switch in The Brain –

Breaking from a conversation in Spanish and turning it into a discussion in German is a two-step process that requires a degree of cognitive effort.

Until now, researchers have never been sure which part required more work: ending the first language or starting with the second. A new study reveals just what’s going on upstairs when we make a switch between languages.

“A remarkable feature of multilingual individuals is their ability to quickly and accurately switch back and forth between their different languages,” says study lead author Esti Blanco-Elorrieta from New York University.

This isn’t limited to Spanish and German, or even verbal languages. People who flip from sign languages to spoken word also appear to seamlessly blend one stream of thought into another.

But just how seamless is this process?

Previous studies have shown our anterior cingulate and prefrontal cortices activate when we jump from one language to another.

The anterior cingulate cortex helps us pay attention, while the pre-frontal cortex is the ‘thinking’ part of the brain, what we generally associate with decision making and other executive functions.

So it probably comes as no surprise that when we decide to switch between two languages, we might involve parts of the brain that look at what’s happening around us and evaluate outcomes before flipping the switch.

This jump in neural activity suggests the brain needs to work harder to move from one language to another. Far from a smooth transition, it’s clear there’s some hard peddling going on.

What hasn’t been clear is precisely what drives this change. Are we peddling to shut one mental language book, or open another? The two actions are virtually simultaneous, which makes them hard to tease apart.

One way to pinpoint the ultimate cause of this neural activity would be to look at the brain as it starts one language without stopping the first.

Breaking into English without pausing your Spanish monologue would require a second mouth, so we can forget two spoken languages. Instead, the research team turned to individuals who could English and American Sign Language, or ASL.

“The fact that they can do both at the same time offers a unique opportunity to disentangle engagement and disengagement processes – that is, how they turn languages ‘on’ and ‘off’,” says Blanco-Elorrieta.

The experiment itself involved naming images shown on flash cards, while having the magnetic fields of their brains mapped in a procedure called magnetoencephalography.

Repeating the process with 21 native ASL-English speaking volunteers – all children of deaf parents – provided the team with enough data in detailed resolution to identify the exact moment key areas of the brain kicked it up a notch.

It turns out we need to work at putting the brakes on one language, but don’t really need to do much to get our fingers and tongues wagging on the second.

“In all, these results suggest that the burden of language-switching lies in disengagement from the previous language as opposed to engaging a new language,” says Blanco-Elorrieta.

Surprisingly, this meant that it didn’t really take any more effort to name an image in ASL and English at the same time than it did to name it in just ASL. Naming it in English alone, however, was relatively easy compared to both.

Learning more about the neurology of bilingualism is an important field. Brains that can jump between different languages often have a slight cognitive edge on those that can’t. Having a second language on call might even help you recover faster from a stroke.

Of course it helps to start out young. But even those of us well past our linguist prime can still gain benefits from learning how to say “Pass the salt” in a few different languages.

If this study shows us anything, it’s that our brains find it relatively easy slipping from one language to the next. Just as long as you can put the brakes on your babble first.

This research was published in PNAS.

Read More On This At ScienceAlert – Latest

Continue Reading

Trending