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 9y ago · link · parent

> all major ISPs are state owned

That is not important. In Russia even private ISP are required to install a firewall to block access to sites that are spreading illegal information (and they are also required to install a device that is monitoring whether the blocking policies are followed). There is also a law that will oblige ISPs record and keep customers' traffic in the future.

> When you're say Comcast, you only see the connections your customers make and accept, you can't see what VPN servers are doing.

A user of VPN typically has a single outgoing connection to a data center IP and that is easy to detect for an ISP. There is no need to see the VPN server's connections if you see the user's ones.

> where government control is less prevalent and the government is overtly democratic, false positives will result in anger in the populace

In those countries there will be no censorship and no need for a VPN. Also, most people don't use tools like VPNs and use Internet mostly for sites like social networks. Even if there are 1% of annoyed customers that cannot use VPN or SSH, the rest 99% won't notice that.

comment 9y ago · link · parent

Easier than code written in Go for example? And what about handling exceptions in asynchronous code with generators?

comment 9y ago · link · parent

> Because it's hard to distinguish VPN traffic from legitimate traffic

I don't think so. Chinese firewall can block VPN. For example, the easiest way to see if the user is using a VPN is to count a number of IP addresses they connect to.

> and false positives will be extremely bad for the ISP.

How exactly?

comment 9y ago · link · parent

Many users in Russia use russian social network (Vkontakte), russian email services and russian search engine (Yandex). There is also popular dating service (Badoo). So Google and Facebook can be blocked without causing much trouble. But there is no good replacement for Youtube and Android Store (yet).

comment 9y ago · link · parent

China blocks even private VPNs.

comment 9y ago · link · parent

US doesn't need to block anything because many Internet companies' headquarters (domain name registrars, SSL certificate providers, cloud providers, OS developers, messengers, search engines, video publishing platforms) are located in USA and therefore are the subject of US laws.

For example, US doesn't have to block access to online casinos - they just order the banks and financial institutions not to work with such sites.

But Russia doesn't have such authority over Facebook or Skype. It cannot issue a NSL to Google for example. Therefore they are looking for other methods of controlling those companies (such as laws requiring to keep russian users' data in Russia).

China blocks many foreign web services and as a result they have their national messengers, search engine, social networks that will comply with national laws.

I do not approve Russian or China (especially China) policies, I just want to notice that Internet being an international medium without borders and customs creates new problems for applying national legislation (like taxation or spreading information violationg the laws).

comment 9y ago · link · parent

Mesengers are also required to block information that is being spreaded in a violation of russian laws.

comment 9y ago · link · parent

I think it is a bad idea to use generators to emulate threads. Because the code becomes difficult to understand and it is easy to make a mistake (for example forget to put a `yield` operator somewhere). I saw examples of such code.

If you want threads, then make a syntax or API for them rather than implement hacks nobody will want to deal with later.

comment 9y ago · link · parent

Physical keys would solve the problem of redirecting to a fake page (and maybe they would make 3-rd party auth protocols like OAuth or Github login unnecessary).

comment 9y ago · link · parent

The password login system is seriously flawed. I think people and websites should switch to physical keys. They are also easier to use because you don't have to remember complicated passwords.

comment 9y ago · link · parent

> Money laundering is knowingly assisting criminal activities. You're actively hiding where the money comes from, exactly because you know it comes from illegal sources. (If the source were legal but embarrassing, all you'd need is standard bank privacy, not active laundering.)

Building an encrypted messaging app is knowingly assisting crimial activities ... all you'd need is standard communication privacy laws, not actual encryption.

comment 9y ago · link · parent

XP is still more popular than many Linux distributions. Should Youtube stop supporting them too?

comment 9y ago · link · parent

Without Flash live streams on Youtube cannot be played in Firefox 45 on Windows XP. So Flash is still useful.

And by the way videos in Twitter and Vimeo don't work in both Chromium and Firefox on Windows XP. Because HTML5 video cross-platform compatibility is not perfect and developers have chosen not to encode videos in formats supported on this platform.

comment 9y ago · link · parent

Another way is to accept emails only from your contact list.

comment 9y ago · link · parent

Open sourcing the spam filter will only help spammers. It is unlikely that it would work on an individual server with small amount of traffic.

Instead of trying to make a perfect spam filter we should abandon outdated inreliable mail transfer protocol.

comment 9y ago · link · parent

Imagemagick can resize gifs.

comment 9y ago · link · parent

I have worked with code (in PHP) that didn't use "fail fast" approach and didn't even log most warnings and notices. App didn't crash but sometimes randomly returned invalid results. Of course, nobody fixed this because after reloading the page the error could be gone. If you ignore errors or warning you just get low quality code as a result. Maybe this code will corrupt your database content, who knows. It is safer to stop the code if something seems wrong.

Also I remember reading somewhere that the earlier you find the error the cheaper it is to fix it.

> why did my app just disappear, did I do something wrong?

Usually operating system reports that there was an error in the application. If the application crashes often, the users will complain to developers and they will fix it.

> Debuggers are a terrible user experience, we don't need to force every user to live in a debugger

You should test your app properly before releasing it.

> There are disastrous consequences to bad multi-threaded code during "fail fast" teardowns of threads not privy/cause to the error.

I cannot agree with this. Usually the OS releases all locks, closes all files, frees memory when the process terminates. I don't see what can go wrong here and how you can get a deadlock because some process has terminated. Also if you use locking you should add some kind of timeout. For example, MySQL has lock timeouts and can even detect and fix deadlocks.

> "Fail fast" in day-to-day operation isn't the right solution, at the very least for making users possibly hate you because you'll never properly handle 100% of exceptions

The users will probably hate you more if the app will silently hang or show incorrect data.

comment 9y ago · link · parent

> Some do.

How can they check future versions of libraries that will match the range?

comment 9y ago · link · parent

I never install browser extensions because it is difficult to check what they are doing and many of them require access to all sites. Users should check who wrote the extension and whether they trust the author.

comment 9y ago · link · parent

The problem is that nobody really tests all the versions they specify in a dependency list. They just install the dependencies, and if everything works, commit the file.

In PHP we usually have a version range in libraries' dependencies and lock file that specifies exact dependency versions for the entire application. So you can be sure that you get tested combinantion of libraries.

comment 9y ago · link · parent

PHP's package manager (composer) has a lock file that contains exact versions of packages and can be commited to the filesystem. So we don't have problems with version ranges.

comment 9y ago · link · parent

If there is a need to distinguish between different kind of errors then it can be done by checking error prototype (if (error instanceof AsyncError) { ... }). There was no need to introduce a new event.

I think the reason is because some developers have a kind of exception-phobia and they prefer to hide errors (make developer check for them explicitly) rather than let them bubble up.

I see this in other platforms too. For example, in .NET if a background thread crashes because of unhandled exception then nothing happens to the main thread, no error is reported. The developer must check for an error and of course most developers won't care about this.

Another example is how error reporting is done in a browser. JS errors are never shown to the user so if a rich JS app has an error the user won't know about it, the app will just stop working or show invalid data.

comment 9y ago · link · parent

What you are suggesting (preventing errors from crashing application) only makes discovering errors more difficult. For example, application might look like it is working ok, but some of requests do not return any response or return invalid data - because an exception was ignored.

Try googling "fail fast" if you want to see more reasons to use this principle.

> Tearing down an entire application immediately due to an asynchronous exception has the possibility to leave the system in a deadlock or worse.

It should not. Because application can crash anyway - for example, if there is memory access violation or out-of-memory error. And synchronous applications crash on uncaught exception, I don't see why asynchronous applications should not.

comment 9y ago · link · parent

I think that it would be better to remove popups and only show an icon in the address bar so the user can click it and grant necessary permissions. My version of Chromium shows an icon when a site wants to install a service worker.

comment 9y ago · link · parent

By the way I have tried to use promises in PHP (they are almost the same as JS promises) and had the same problem with promises catching all exceptions and reporting nothing. I am thinking now about writing my own version of promises because nobody seems to understand how to handle exceptions and unhandled rejections correctly.

> Catching unhandled errors is by design and it works great.

I don't think that it's great because by default I would prefer to terminate the application if there is an unhandled error or rejection. This is called "fail fast" principle. What promises developers suggest is to continue running the application even if it's broken.

comment 9y ago · link · parent

> And, as the SO post you've linked to points out, you can catch unhandled promise errors using window.onunhandledrejection. It's not like it's that dramatically different to window.onerror.

Why make a new non-standart event instead of just throwing an error and handling it with default error handler? That is poor design - because initially there was no reporting of unhandled errors at all and only later a workaround was added.

comment 9y ago · link · parent

There is still a problem that some sites will have a service worker and some will not. Maybe it would make more sense to allow the user to pick what they want to cache for offline reading.

> The service worker fetch event is a promise,

By the way promises is another poorly designed technology: they catch unhandled errors and do not report them in any standard way [1].

[1] https://stackoverflow.com/questions/28001722/how-to-catch-un...

comment 9y ago · link · parent

I think "progressive" is just a new meaningless buzzword.

comment 9y ago · link · parent

This is clearly overengineering if one has to write and maintain a service worker just to be able to display a static site offline. How to debug it? How to see if any of your visitors cannot load site because of error in a service worker? How to decide which pages to preload for offline reading?

Also a service worker would add additional process in Chrome and require 30-40 Mb of RAM. I don't want service workers in my browser.

Well, web standards have always been this broken and illogical as long as I rememeber.

1
167168169
185