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

This is absolutely unclear. If the user enters HTML and that HTML never gets to the server then why sanitize it? To protect user from hacking themselves?

comment 5y ago · link · parent

There are other browsers except for Chrome. For example there are built-in browsers in smartphones that will never be updated.

It is wrong to rely on everyone using a latest version of a browser. Every site should support at least 5 years old browsers and a good site will be usable in 10 years old browser including builtin browser of Windows.

Sadly, in reality most sites are made so poorly that they don't open on 5-years old smartphone. It shows how low qualified became modern web developers.

comment 5y ago · link · parent

There is something wrong with this idea. Sanitizing HTML should be done on the server, not on the client side.

Looks like absolutely useless feature that will just make bloated browsers more bloated.

comment 5y ago · link · parent

You don't need to delete the rows from the database. Just replace user's name, address and phone with random data.

comment 5y ago · link · parent

Here is what I thought after reading an article: Linux should provide an API for drivers. So that the drivers can be reused by other OS like FreeBSD or Plan9. If you are making a new OS, it is prohibitively expensive to reinvent the USB stack, write your own ACPI interpreter or port millions of lines of code. There should be an API, otherwise these drivers don't differ much from proprietary drivers.

Other OS like Windows, Android or MacOS implement such an API. Therefore it is possible. I think that truly open source drivers should be available for everyone, not only to the users of one specific kernel.

comment 5y ago · link · parent

But if you don't do anything illegal and don't kill innocent civilians then there will not be any embarrassing secrets to leak.

comment 5y ago · link · parent

> Some senior officials inside the CIA and the Trump administration even discussed killing Assange, going so far as to request “sketches” or “options” for how to assassinate him.

> One of those officials said he was briefed on a spring 2017 meeting in which the president asked whether the CIA could assassinate Assange and provide him “options” for how to do so.

I don't understand how this can be legal. Cannot such a request be considered a conspiracy to commit a murder? Or some people are "more equal" and the law doesn't apply to them?

comment 5y ago · link · parent

Sadly, the described scheme doesn't protect from hardware backdoors. Let's say someone confiscates your laptop, installs a backdoor that sends all keypresses using GSM, and returns it to you. Now the attacker has all your passwords.

comment 5y ago · link · parent

> Google's SafetyNet will prevent you from using many crucial applications, like your bank's Android app

I don't think that installing your bank's app is a good idea. First, banks are interested in collecting as much data about their customers as possible so the app will be used as a spyware. Second, installing an app eliminates second factor for authorization - now if your phone gets hacked, the criminals will be able to steal all your savings.

It is better to use only bank's website from desktop computer and use a phone only as a second factor to confirm transactions.

comment 5y ago · link · parent

I am not sure if it is a good idea to compile code targeted to modern processors to 8-bit CPUs like 6502. For example:

Languages like C (or Rust) allocate variables on the stack because it is cheap with modern CPUs, but 8-bit CPUs don't have addressing modes to access them easily. (by the way, some modern CPUs like ARM also cannot add a register to a variable on the stack).

The solution is not to use the stack for variables and instead use zero-page locations. As there are only 256 zero-page bytes, same locations should be reused for variables in different functions. This cannot be used with recursive functions, but such code is ineffecient anyway so it is better not to use them at all and use loops instead.

Another thing is heap and closures (that allocate variables on the heap). Instead of heap the code for 8-bit CPUs should use static allocation.

The article contains an example of 6502 code compiled from Rust and this code is inefficient. It uses too much locations for variables (rc6-rc39) and it wastes time saving and restoring those locations in prologue/epilogue.

No wonder that programs run slowly. It would be much better to compile CHIP-8 directly to 6502 assembly.

comment 5y ago · link · parent

The app in question ("Navalny app") has a blog and voting recommendations. You can distribute information with app updates or use push notifications to transmit data (for example, new API server IP address and public key).

For example, when government tried to block Telegram, it used push notifications to send addresses of new (not yet blocked) servers to the app (of course, you can send different addresses to different devices). It helped Telegram to evade blocking and it worked.

As I understand, you cannot do it with PWA, especially if the browser doesn't encrypt DNS requests.

So with native apps the only way to block them is either block App Store completely or push on Apple to remove the app.

If the browser supports encrypted DNS and hiding SNI (which needs TLS >= 1.3) then there are chances to evade blocking with PWA. But as I understand, Safari doesn't use encrypted DNS by default (I wonder why).

comment 5y ago · link · parent

Sometimes they are, but (mostly in large cities) people sign up as election monitors to prevent it. Sadly, most of 90 000 polling stations are not monitored by independent observers.

The main way to control elections now is not letting opposition candidates to get into the ballot. For example, on this elections many candidates were rejected because they are "linked" to Navalny's organisation that was admitted as an extremist organization by the court. Some people are rejected because the signatures they have collected are deemed invalid. Obviously you cannot win if you cannot get into the ballot.

There also is electronic voting (voting over Internet) which is difficult to monitor. It is also worth noting that while you can vote over Internet, you cannot collect more than 50% of required signatures for being added to a ballot this way.

comment 5y ago · link · parent

Such PWA is easy to block because the government can block a website with it.

A native app can use push notifications (which are encrypted) to receive data and the only way to block such an app would be to block access to Apple's servers completely.

comment 5y ago · link · parent

As I understand, PWAs are easy to block - you just need to block access to a web server. And native apps have more possibilities to evade blocking: they can use non-standard protocols, P2P protocols, receive data via pushes. So to block a native app one would have to block access to App Store.

comment 5y ago · link · parent

Thank you for the link, very interesting. Now I see there's another problem: the colors on the hue bar (especially with OKLrCH model) look too blurred and mixed with each other. And there's almost no green, but mostly reddish and blueish tones.

comment 5y ago · link · parent

I am not sure if ALSA playback should go through an audio daemon. Some audio applications (for example audio workstations that you have mentioned) want to have exclusive access to an audio card with minimum latency, without any sample conversions, any volume adjustment and ALSA (as I understand) was supposed to provide such access. Audio daemon prevents them from getting it. Passing data through a daemon adds latency.

Wouldn't it be better if daemons like PulseAudio or PipeWire gave control of an audio card to an application that wants exclusive access?

For example, Windows API can provide exclusive access to an audio card.

comment 5y ago · link · parent

What I don't like in standard HSV color picker [1] is that the colors are distributed non-uniformly. For example, there is a wide area of same looking green color, but just a thin line of yellow and orange. I didn't understand if new models solve this issue.

[1] https://bottosson.github.io/img/colorpicker/hsv-picker.png

comment 5y ago · link · parent

Another bad thing (in my opinion) is "useless" rules. There are at least two kinds of useless rules:

1) rule that does not apply to any element on the page. Such rules only inflate CSS file and waste traffic and CPU cycles to process them

2) rule that is overriden by another rule. Again, it doesn't have any effect on the page and only wastes CPU cycles.

The case 1 happens when styles for all pages are merged into a single file instead of making different bundles for different pages. Both cases happen when using bloated CSS frameworks.

comment 5y ago · link · parent

This means that it won't work in a builtin browser of a smartphone made 5 years ago.

I think that average quality websites made for public Internet should use only features that have been supported at least for 5 years in major browsers including mobile. And a high quality site must be usable in 10-years old browser.

comment 5y ago · link · parent

I don't like text UIs. They try to emulate GUI but do it poorly. You should either make a classic console program, that can be scripted, piped, etc., or a real GUI.

comment 5y ago · link · parent

What are the advantages of having unencrypted cloud backups? The only advantage is that authoritarian governments can better control their citizens. Apple is playing on the side of dictators instead of protecting their users.

comment 5y ago · link · parent

What I don't like is that audio systems on Linux are too complicated. For example, all that ALSA needs to do is to provide exclusive access to a device (only one program at a time) and send samples into it unmodified (no bit depth change, no resampling, no mixing, no volume adjustment etc). But open source developers cannot do such a simple thing. They added thousands of unnesessary features, hundreds config options and turned ALSA into a monster. When it should be just a dumb backend for PulseAudio.

comment 5y ago · link · parent

The difference is that US is strong and powerful and can arrest its enemies across the world, but Europe is weak and pathetic and cannot even defend itself.

comment 5y ago · link · parent

Internet voting that cannot be independently verified and monitored is just a fraud.

comment 5y ago · link · parent

Does truly democratic society need identity card and databases? Do people need to be tracked since their birth as if they were someone's property?

Also, such leaks can be dangerous. If someone is hiding from authoritarian government then the stolen data can be used to track and assasinate them.

comment 5y ago · link · parent

Ruby and Rails tutorial is not a Ruby tutorial. The ancestor comment talked about language tutorials, not framework tutorials.

comment 5y ago · link · parent

Typing in hiragana directly in theory would allow to double the typing speed because one hiragana character is equivalent to 2-3 latin charcters.

comment 5y ago · link · parent

Keyboard with kana is inconvenient because it is just latin 26-keys keyboard and Japanese has about 40 kana characters. If they have added an additional row then it would allow typing twice faster than on a latin keyboard (because one kana character is equivalent to 2-3 latin characters).

But keyboard manufacturers do not want to make better keyboards for non-latin countries, they just overlay foreign characters on standard 26-key keyboard because it is cheaper.

comment 5y ago · link · parent

I don't think Japanese IME is difficult. You just type the word as it is pronounced.

Typing on a smartphone is more difficult because the keyboard has only 10 keys for characters and you have to tap a key and slide up/down/left/right to chose one of 4 characters.

comment 5y ago · link · parent

Also even when RAM was replaceable, many manufacturers put low limits on its size, I guess for the same purpose.
1
117118119
185