Better HN
topnewbestaskshowjobs
Log inSign up

codedokode

9,867 karma · joined Aug 20, 2015 (11y ago) · 5,528 submissions

PHP developer from Russia.
Submissions

comment 8y ago · link · parent

> if you derive city, region or country from that it becomes personal data

I don't think city itself is a personal data. You could use user's IP address to get the city and then discard it and this way you know user's city but don't have to keep their IP address.

Google Analytics can be a problem; Google or someone else should make the analytics that doesn't store IP addresses.

And I think ISPs should randomly rotate IP addresses of their customers so they cannot be used for identification.

comment 8y ago · link · parent

Why is that so? If people in a city move from their house to the downtown or to the nearest subway station, they will return the bicycle on their way back.

comment 8y ago · link · parent

Not only bikepaths but also parking lots for them.

comment 8y ago · link · parent

Shared bicycles have some advantages over own ones:

- if you own a bike, you need a space in your apartment to keep it. Of course, if you have your own house, it is not a problem (but you have lot of other problems like no public transportation around), but in cities like Moscow or Beijing most people live in relatively small apartments and some of them rent only a single room. And usually you cannot park your bicycle outside.

- in many cities you can ride a bicycle only 7-8 months a year because it is cold in winter.

- you don't care if it gets stolen.

- you cannot get on a bus or a subway train with a bicycle. With a shared bicycle you can leave it near the station and take a new one on another station.

- a new bicycle can cost about $100-200, and a shared one can cost around $10-20 per month.

comment 8y ago · link · parent

I don't really understand why. They just should not collect real names or any other personal information and then they would be fine.

comment 8y ago · link · parent

As I understand, the fakes were not copies of an existing picture but rather an independent work by unknown painter.

comment 8y ago · link · parent

The grandparent comment is right. I am not going to mess with default browser settings, and almost nobody is.

comment 8y ago · link · parent

> While the wood is probably at least that old, the carving isn't necessarily quite that old.

The russian article on Wikipedia says that there was a research including examining the surface with a microscope and it shows that the statue is made from a freshly chopped tree with stone tools.

The difference is dates is because the research in 2015 was done using another method [1] . The age of the tree is estimated to be around 160 years old.

[1] https://phys.org/news/2018-04-wooden-shigir-idol-egyptian-py...

comment 8y ago · link · parent

> Seems like it's obsolete.

Then you can write your own Deferred implementation. I didn't even know it was implemented in browsers.

     const run = async () => { ... }
How to read this? run is a constant that equals the result of calling function async() thas maps to something in curly brackets? This is confusing.

> If you want to write async code, use async / await.

That is a good idea, but it has nothing to do with arrow functions.

> It also allows you to do scope binding in a different manor

`this` binding in JS in classic functions is broken by design, so yes, that is the advantage of arrow functions.

comment 8y ago · link · parent

Braces can be used in many cases, but `case` keyword is used only in `switch` and `match` and is not ambigious. You can see what construct it is from the first word.

comment 8y ago · link · parent

I don't think it is a good idea to rely on such subtle differences that are not well known among developers. We want to write code that is easy to maintain, not compete in knowing ECMA specs, right?

comment 8y ago · link · parent

Please also look at my idea how to rewrite the code for readability using `deferred` pattern: https://news.ycombinator.com/item?id=16933983

comment 8y ago · link · parent

Yes, there are cases when arrow functions are useful: when small functions are used inline, like this:

    var numbers = [1, 2, 3, 4].map(x => x * x);
    var bestUsers = users.filter(u => u.getRating() > 100);
But for a case when you have a large non-anonymous function, `function` keyword suits better. You don't need to use `const` keyword just becase it is something trendy now.

In your example, the code with arrow functions is smaller, but it is not more readable. Because there is no indentation, it is difficult to understand how code is nested. I cannot read that.

It can be rewritten using `deferred` pattern:

    var deferred = new Deferred;

    methodOne(data, function (error, response) {
        if (erorr) {
            deferred.reject(error);
        } else {
            deferred.resolve(response);
        }
    });

    return deferred.getPromise();
This way we can get rid of a callback in the Promise constructor. Please note that our code now looks sequential and we clearly see what happens after what. Asynchronous code is difficult to write and read; therefore we must put an extra effort to make it easier.

In my opinion it is generally bad idea to nest more that 1-2 levels of functions inside each other.

comment 8y ago · link · parent

Here you are:

    var x = match (response) {
        case { status:200 }: true;
        case { status: 404 }: new NotFoundError;
        case Number: Math.PI;
        case SomeClass: 1;
        case /^http/: "http error";
        default: -1;
    };

comment 8y ago · link · parent

It could look like this:

    var x = match (response) {
        case { status:200 }: true;
        case { status: 404 }: false;
        case Number: 0;
        case SomeClass: 1;
        default: -1;
    };

comment 8y ago · link · parent

By the way, I don't think it is a good idea to write a function as a constant. Please compare this

    function getDate(date) { .. } 
to this:

    const getDate = (date) => { ... } 
The first version is more readable. We instantly see that it is a function and in a second case it looks like a constant at first. Also without the equal and arrow sign it looks simpler.

comment 8y ago · link · parent

Is not `switch` enough for this?

comment 8y ago · link · parent

What an ugly syntax. They should follow switch/case syntax for consistency.

comment 8y ago · link · parent

Well, you could send a gay person to play games and do massage to programmers who are least productive. I'm sure they will become enough motivated not to fail the next deadline.

comment 8y ago · link · parent

Yes, under that assumption. But even if nothing bad happens, you will retire sooner or later and your income will drop.

comment 8y ago · link · parent

> You hold a 5 percent fixed-rate 30-year mortgage.

Is that really so? I've read that the mortgage interest rates are around 2-3% in Europe (by the way, in Russia they start from 9%-11% and can be as high as 15%).

> A house in 1897 cost the same as a house in 1997, adjusted for inflation.

It is hard to believe, given new technologies that are supposed to make it cheaper.

Also what the author didn't take into account - she assumes that she will be able to work forever. But what if you get too old and won't be able to do your job well? What if you get sick? What if you get fired? What if there is a financial crisis? What if the company you work at shuts down?

In all of these cases, a renter will be kicked out on the street (I know in some countries like Finland the government provides free apartment for people who don't have money, but I assume in US you'll have to live in the street). But if you own a house then you can live there even if your income drops. You can live without renovations, you can consume less electricity, you can ask for a tax deduction, you can rent out a room.

Also, an owner can leave a house or an apartment to his children.

The author writes about opportunity cost, that you can invest your money. But it is very high risk. If you invest into a private fund, it can become a bankrupt any time, if you invest into something government-related, tough luck if the national currency crashes. Investing into a house looks like a more safe option.

Of course, there are downsides to the mortgage. If you buy a house or an apartment, it will be probably not in the best location, far away from the center of the city in an undeveloped area, no good transportation around. Because the good ones are too expensive.

comment 8y ago · link · parent

This is the same thing that happens in Russia. Recently it banned Telegram, so if you want to advertise VPN in Russian social networks, your ad gets rejected. There is no law forbidding to advertise VPNs but social networks do not want problems with the government. Or if you try to put an ad for anti-government rally, it will also get rejected.

As I understand there is no law or court decision banning Kaspersky from advertising.

comment 8y ago · link · parent

Telegram has no authority to ban anything so it cannot be at fault. Trying to make your service work cannot be called "malicious activity".

> That should bother Google and Amazon, who should guarantee the connectivity of their law-abiding customers by kicking out Telegram so the IP range bans are lifted.

This might increase an influx of complaints from other governments. If they kicked out Telegram, why not kick out someone else?

comment 8y ago · link · parent

> In the end Google and Amazon will kick out Telegram,

Telegram invented a nice trick. Durov wants to reward people hosting proxies so Google and Amazon will have to identify them and kick them out too.

comment 8y ago · link · parent

No, they should not. They are not under russian jurisdiction and are not obliged to comply with russian laws. Or should they comply with laws of Thailand, Iran, China and North Korea too? Kick out sites that criticise communist party?

comment 8y ago · link · parent

Viber currently has problems with connectivity in Russia. They have been complying with russian laws, but they made an unwise decision to use servers in Amazon network that are being blocked now because of Telegram. So the messenger that complies with the law now has problems and Telegram just works.

comment 8y ago · link · parent

Actually there are interesting legal details in the story.

Telegram should be blocked under the Russian court order for not providing decryption keys, but that order doesn't contain ruling to block entire Amazon or Google network - only IP addresses used by Telegram. Whole networks are being blocked under the order by Prosecutor General from 2015 (yes, from 2015, and recently they started to use new order from 2018). But the problem is that Prosecutor's Office doesn't have authority to block messengers, so the order is about discovering illegal content (extremist content or appeals for organizing unapproved rally - not sure if I translated correctly) located on all of those IP addresses which obviously is a lie.

So this is dubious even under russian laws.

Why are they blocking entire networks? Well, the problem is that there are limits in ACL size so if Telegram starts using thousands of IP addresses the tables can become too big. So they chose to block entire networks instead. Also, finding out which IP addresses they are using takes time, distributing and updating blocking rules by ISP takes time (on order of hours, up to a day), so without this Telegram could change IPs faster than they are blocked.

There already are russian businesses that were using IP addresses from those networks, that are suffering damages because of blocking. They are moving to other datacenters in a rush. It is unlikely that they will try to recover damages from the government.

comment 8y ago · link · parent

The contrast between payout to engineers and unqualified workers is impressive. Especially if those workers live in a place like California with high living costs.

I think growing housing costs are much more scarier for a worker than an idea that some engineer gets 200-300k less.

comment 8y ago · link · parent

Why did they design a custom chip? To make it harder to run non-Microsoft versions of Linux?

comment 8y ago · link · parent

As I understand what Microsoft provides is only CLI tools so that you can compile your favourite Node.JS extension. Not more than that. No GUI.
1
155156157
185