Войдите или зарегистрируйтесь
Вы сможете писать комментарии и посты, ставить лайки и другое
Поиск
Тёмная тема

Misleading naming in JavaScript: atob() and btoa()

недавно
JavaScript has two globally available metods for working with Base64: atob() and btoa(). Their names clearly look like they were borrowed from older languages. In C, for instance, the standard library includes functions like atoi and atof:

#include <stdlib.h>

char str[] = "123";
int num = atoi(str); // 123

atoi means ASCII to integer, and atof means ASCII to float (though in reality it returns a double).

So what do you think the atob function does in JavaScript? ASCII to Base64? In other words, converting a regular string into a Base64 string? Nope! It does the exact opposite: it converts a Base64 string into a "regular" string. And btoa, in turn, converts a regular string into Base64!

console.log(btoa('Famabara')); // 'RmFtYWJhcmE='
console.log(atob('RmFtYWJhcmE')); // 'Famabara'

Who thought it was a good idea to swap the names like that? Love JS.
+1
30

Quentin Tarantino and his foot fetish: a complete list of all his films featuring scenes with feet and legs - photos and videos

10 дн. назад
Fans of Quentin Tarantino know that he has a foot fetish. For those unfamiliar with the term: it's when a man has a particular fascination with women's legs, and even more so with their feet. It's safe to say that Quentin Tarantino is the most famous foot fetishist in the world.

Let's start with Quentin Tarantino's first real film - Reservoir Dogs (1992). I'm skipping "My Best Friend's Birthday", as it was never officially released.
There's nothing related to foot fetishism in Reservoir Dogs: the film features only tough men. Women appear only briefly in a few background scenes. I found just one scene where a woman is shown in the foreground - the carjacking moment.
Показать полностью...
+2
3

How wind turbine power depends on blade length: looking at real data

недавно
Wind turbines keep getting bigger every year. There's one main reason for that: the longer the blades, the more powerful the turbine. But couldn't you just install two smaller turbines instead of one large one? To answer this, let's take a look at real-world data.

Goldwind is a Chinese wind turbine manufacturer. Here are photos of their operating turbines from the company website:
Goldwind GW 82 / 1500 - output: 1500 kW (1.5 MW). Rotor length: 82.3 meters, meaning a blade diameter of roughly 41.15 meters.

Goldwind GW 171 / 6000 - output: 6000 kW (6.0 MW). Rotor length: 171 meters, giving a blade diameter of about 85.5 meters.

Even here you can already see that the relationship between blade length and output is nonlinear. The second turbine's blade is 2.07x longer, but the power is 4x higher!

Vestas is a wind turbine manufacturer from Denmark (their turbines are shown in the next photo):
Показать полностью...
+2
20