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

JPEG is optimized for compressing photos, not text or high contrast images.

comment 4y ago · link · parent

Also, windows do not make much sense on a small low-resolution display. Windows are made for people with huge expensive high-resolution monitors; for DOS era screens you should use either full-screen or half-screen windows.

comment 4y ago · link · parent

Don't you think that the UI is not very good? First, there is no *quickly* accessible home screen with icons like in Android or iOS. Second, there is no quick search so that you can start any app by typing 3-4 letters like in Gnome. Instead, the UI makes you make lot of unnecessary gestures to perform a task. If you want to copy, copy the latest ideas and not make a clone of Windows 3.1.

comment 4y ago · link · parent

No. This is actually wrong that browser by default doesn't report errors in HTML, CSS or JS - because of this nobody notices them and you cannot understand why the button is not working. Instead, in case of any error a browser should show a big red bar above or below the page. So that the user immediately understands that the page is broken and it makes no sense to try to enter anything.

Hiding errors is always a poor choice. Only if you are low paid developer not interested in making a quality product then probably you like browser's behaviour.

comment 4y ago · link · parent

This vulnerability exists because JS code allows changing object prototypes at runtime (which is pretty unnecessary feature; in most cases we just need Java-like immutable classes). Because of this leaking an empty array into userland code becomes a vulnerability that is very difficult to spot.

comment 4y ago · link · parent

It seems that you are right, the 300Kb number is about an uncompressed version. Still it is very large and includes lot of code I don't need.

comment 4y ago · link · parent

Internet Explorer and older browsers support is important too. You must support browsers released within last 10 years and fetch is too new and experimental for this. I don't want to use something just because it is new and has no clear advantages over older technology.

comment 4y ago · link · parent

jQuery is more convenient to use than vanilla JS. Vanilla JS is too verbose. If only jQuery was modular and didn't require to load 300 or 400 Kb of code.

Also it is difficult to find non-jQuery library of a good quality. For example, I was looking for a small library to send and receive JSON via HTTP, and ended up writing my own wrapper around XMLHttpRequest (fetch() is a poor choice, it is not supported well in older browsers and it has no advantages, and fetch() requests cannot be aborted) because there was no good library for this. Other libraries either do not support all necessary browsers or are overengineered and too large.

comment 4y ago · link · parent

Because you can do a lot with little typing and there are lots of great libraries. Python is probably the best choice when you need to get something done quick or calculate something when performance is not important. It is also not an exotic functional language without loops and filled with linked lists.

Also, in Python integers do not overflow, unlike in Rust, C and other buggy languages.

If you name a language, with high probability Python will be better in something unless it is about performance.

What I don't like: no type hints in many libraries, some libraries are not type-hint friendly, lot of unnecessary dynmamic features (like being able to patch modules in runtime) and absolutely no caring about performance and being able to compile into machine code.

> trying to figure out what some dynamically typed code is doing

There should be type hints.

comment 4y ago · link · parent

SQLite is inefficient. For example: it parses table definitions and SQL queries, builds execution plans at runtime, although this could be done at compile time.

comment 4y ago · link · parent

Researchers try to find complicated and unrealistic scenarios to exploit vulnerabilities, but do not notice an elephant in the room. Auto-update is an equivalent of a backdoor. It allows the company to upload and run any code at any user's computer unnoticed. I won't be surprised if soon governments will demand that every application having more than N users must support auto-update.

comment 4y ago · link · parent

You are suggesting good ideas, but we should go further. Let us write configuration files in Turing-complete exotic programming languages that almost nobody knows! This way malicious programs won't be able to parse them or perform automated edits, and many malicious humans too.

comment 4y ago · link · parent

Why add just a monstrous database engine that will spend time reading and parsing database schema, parsing SQL queries, building execution plans to read several settings? Let's go further and use Elasticsearch (startup time about 1 minute) for this.

comment 4y ago · link · parent

Adding . and .. was a mistake by itself. I never needed them, but always had to write conditions to skip them when traversing the file system.

Also, dotfiles don't work well with masks because `*` doesn't match dot-files, and `.*` match all dotfiles including . and .. which causes many programs to fall into endless recursion (for example, `du -sh .*`).

Everything related to dotfiles in Linux is done wrong.

comment 4y ago · link · parent

GDP is a very weird metric. For example, GDP includes money spent for renting an apartment, although no goods are produced in this case.

So for example, if there is a village with two people, and they rent each other's home then this village has non-zero GDP, although no goods or services are produced.

Inflated education, medical or insurance prices also inflate GDP. So a teacher in one country could produce 2x more GDP per unit time as the same teacher in another country.

Another wrong thing to do is to adjust income or GDP for food prices (purchasing power parity). This is absolutely wrong. The idea of PPP is that if in your country potato is two times cheaper then it makes you two times richer. This is wrong because a MacBook or a car are not two times cheaper. Actually they are more expensive than in the West. And if you go abroad then there will be no cheap potato either. So PPP is a total lie. It can be applied only to poorest people who spend all of their income on potato.

So if you want to adjust the income for PPP, at least use MacBook or car prices instead of potato.

I think that a fair metric would be a percentile distribution of how much money a person has left after renting the cheapest apartment and buying the cheapest food.

comment 4y ago · link · parent

Honestly I don't understand why JSON should be human-readable. It is a data serialization format intended to be read by software.

Just adding comments and multi-line strings doesn't make it human-readable, it is still too bloated and I don't like writing it manually. If you want a human-readable format, try at least to remove unnecessary quotes, brackets and commas and make it look similar to YAML.

JSON is not intended to be used in configs and other user-editable files.

comment 4y ago · link · parent

> at which point many too-trusting people have lost their lifes' savings

People should be a little smarter and not fall for Ponzi schemes. Furthermore, many people who invest in such schemes, understand how they work but hope to get profit before it collapses.

comment 4y ago · link · parent

Financial crimes are not violent and therefore should be punished lightly.

comment 4y ago · link · parent

> These people who claim they have golden ears and can hear the difference between analog and digital, well, it turns out you couldn’t.

That's not fair because they didn't have both analog and digital records to compare.

comment 4y ago · link · parent

I don't like the architecture because it looks like a set of ugly hacks. You don't need virtual machines to isolate applications because CPU already has a sandbox provided by protected mode. The problem is that legacy OS like Linux/Mac/Windows are unable to use this sandbox effectively.

For example, here [1] they show a separate VM for the USB stack. But why do you need it if you can simply run USB stack in protected mode?

Also, I assume that running so many VMs requires a lot of drive space and hurts performance.

[1] https://www.qubes-os.org/intro/

comment 4y ago · link · parent

Found an interesting part:

> Otonomo is one example of the dozens of companies that market their attempts at keeping information anonymous. Otonomo describes its platform as having “privacy and security by design” and notes the use of patented “data blurring” technology to protect user privacy.

> It also has an “Otonomo Driver Pledge” page promising drivers the ability to easily grant or revoke access to personal data,

This doesn't add up. If they collect only anonymized data, then they won't be able to find that customer's data and do anything with it.

comment 4y ago · link · parent

Wouldn't this be illegal under GDPR? A license plate number can be linked to the owner and therefore can be a PII, as well as car serial number or other identifier.

Also, this shows that no matter if you pay for the product or not, you become the product for squeezing the data anyway.

Also, this could be a national security issue everywhere except US if US government would be able to track the cars all around the world. For example, what if they will track the cars used by defence industry employees or military personnel?

Such tracking equipment should be banned for import, but it is more likely that local government will just ask to provide the data to them too.

comment 4y ago · link · parent

> macOS has a wonderful input mechanism where you press and hold a key on your keyboard to display the accent menu.

Is it really convenient? I don't like to wait and would rather prefer to press a sequence of "Compose", "a", "1", (or, which is faster, "a" and "1" simultaneously). And make a popup appear when "Compose" + "a" is pressed.

Linux has Compose key, but it is implemented poorly, it doesn't provide an UI for selecting character and discovery of combinations, and in Gnome it has very small choice of characters.

Another alternative would be to insert accented characters automatically.

comment 4y ago · link · parent

For me the animation also looks choppy, as if a ball was jumping instead of moving, and it doesn't look smooth, however this just could be a problem with LCD matrix response time.

comment 4y ago · link · parent

Actually, 50 fps is not going to be "buttery smooth" as well, because with a framerate of 60 fps you cannot update display image 50 times per second, so some frames will be doubled.

I have another hypothesis on "smoothness" of animated images. Most of computer-generated animations are unnatural and not cinematic because the objects jump between frames instantly while in real life and on a camera film they move smoothly. The hypothesis is that if the animation was closer to real life, then it would look really smooth even with lower fps, for example, 24 fps or 30 fps.

For example, when moving a mouse cursor, it jumps between points every 16 ms instead of moving smoothly. You could argue that a human is unable to notice such tiny details, but here is a simple test to find out: take a mouse and move it in a circle, so that it makes 2-3 turns per second. If a real object would move with such speed, all you would see would be a blurred circle (you can take any real object and see for yourself), however with a mouse I can clearly see a circle made of about 10-15 mouse cursors. So the animation of mouse cursor is unrealistic, computer-like and it can be easily seen (I noticed this effect long time ago but initially thought that it is a problem with Linux or slow graphics card).

So to make a smooth animation you could use oversampling: generate an animation at say 6000 fps, and blend every 200 frames together (remember about non-linearity of RGB values when mixing colors). If by chance anyone has some free time and curiosity, could you test it?

comment 4y ago · link · parent

Today I learned that there are bacteria that have a protein helping to form ice on plants [1] to destroy them and extract nutrients (however I didn't understand how bacteria themselves survive this).

Machine learning typically uses existing data to predict new data. Please explain: Does it mean that AlphaFold can only use known types of interactions between atoms and will mispredict the structure of proteins that use not yet known interactions?

And why we cannot just simulate protein behaviour and interactions using quantum mechanics?

[1] https://pubs.acs.org/doi/10.1021/acs.jpcb.1c09342

comment 4y ago · link · parent

Maybe the locked mode for children should be required by the law because many parents are too lazy or not competent enough to setup a phone properly for their kids.

comment 4y ago · link · parent

This is not enough because in reality (I guess) most parents do not bother with setting this up (or don't know how to do it) and as a result kids stay unprotected. Maybe there should be a law requiring to setup such settings and a one-click option to switch to restricted mode without having to toggle every checkbox.

comment 4y ago · link · parent

It is not OK that children have access to adult phones and adult Internet.

Apple should fix this by creating a kid mode, where the user can only contact people approved by parents and visit sites approved by parents or conforming to kid safety requirements. In this case the children will be perfectly safe.

Why Apple doesn't do it? I guess because it is unprofitable, it requires major investments and doesn't promise any returns.

Kids must be banned from the Internet completely instead of trying to patch different issues here and there.

1
106107108
185