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

There are more popular and worse languages, for example Javascript:

- no classes (so people end up emulating them: Backbone has methods to emulate class declaration and class inheritance)

- no type hinting. You cannot specify function argument type or return type. It makes code harder to read and to maintain.

- too forgiving. You can divide by zero or mistype a property name and get no error. You can add arrays to strings. It makes bugs harder to find.

- no coding standard. Everyone uses whatever style they like

- no single modules standard

- no syntax for asynchronous operations

- difficult to install XML library on Windows (you need to setup a Visual Studio to compile binary modules)

> Heroku + Ruby on Rails gets close[1], but it took them nearly 10 years to catch up.

You have to learn Linux and command line to use Ruby. No wonder it is more difficult for a newbie. Deploying and running an application is more complicated in Ruby. Also with long-living applications it is easy to get a memory leak.

But recently PHP started to depend more on CLI tools too (installing and using composer might be not easy for people who got used to GUI and don't understand concepts like "working directory").

comment 10y ago · link · parent

The code that uses arrays instead of objects is worse to support because you don't know what those arrays contain and cannot type-hint them. Functions that return arrays usually don't document their structure. And even if they do, the documentation might be outdated. So you either have to spend a lot of time tracing where do those arrays come from and where they go to or risk breaking something.

This approach works well only with tiny applications written by a single person. Once the app grows larger it will get hard to support.

ORM have their disadvantages but you have to learn them thoroughly including how they are made internally. They are not some magic tools that "just work". But in a large application you have to use objects and therefore ORM.

ORMs usually have some form of SQL-like syntax, for example Doctrine has DQL.

comment 10y ago · link · parent

That is a MVP.

comment 10y ago · link · parent

And why is this scheme illegal? Isn't it Short Sellers' fault that they have borrowed shares without reading the conditions properly? They could just buy them.

It looks like a casino where you are allowed only to lose, not a free market where you can trade however you like. Once you find a profitable scheme you go to jail.

comment 10y ago · link · parent

> This may be true, but the MySQL model of using primary keys from secondary indexes will mean that reads are inherently expensive.

With MySQL the indexes are usually kept in memory so there should not be noticeable overhead.

comment 10y ago · link · parent

I used both Postgres and MySQL and in my opinion encodings are more difficult to setup with Postgres. You need to change some "template" when creating a database to use unicode. Otherwise it will use latin1. I do not even understand what a database "template" is, how it is related to encodings, and why it is so overcomplicated.

In MySQL there is no templates and you can change the encoding of a table at any time using ALTER TABLE statement.

And in cloud IDEs like c9.io you cannot use unicode collations in Postgres because they need to be installed separately and they are not installed.

comment 10y ago · link · parent

> you should NEVER TRUST USER INPUT

That is not clear at all and pretty useless. What does it mean? I should not accept any user input at all?

> strip everything that is not needed

That does not always work. What if I have a comment form that should accept any characters?

comment 10y ago · link · parent

Viewed with JS disabled, no video, no pop ups.

comment 10y ago · link · parent

Facebook is also a "legal" spammer and it spams a lot. Had once registered with a fake account just to test some application and since then every day or so facebook sends me messages like "You might know these people" with some random guys or "You have received a notification". I haven't visited facebook maybe for a year but is still sends me messages daily.

Luckily I used a separate email account for registration so I just redirected all emails from facebook to a spam folder.

comment 10y ago · link · parent

If your and your driver's phone have sent GPS coordinates to facebook it is pretty easy to link you together.

Or you can be linked by the recorded sound.

comment 10y ago · link · parent

Scripted migrations have their advantages too:

- they can be stored in a version control system

- your coworkers can run them at their dev environment

- they can be used for automatic deployment

- you can test it in a dev environment before running at a production server. With GUI tools you have to remember and repeat exact steps you did before

- You can review the script or ask someone to look at it

I think GUI tools might be good for browsing and exploring database but not for making changes.

comment 10y ago · link · parent

Another option is to install these tools at a separate domain and setup HTTP authorization on a webserver. So automated bots scanning for vulnerable apps will not get even to the login page.

comment 10y ago · link · parent

People on twitter suggest the reason could be a feature of a Python library: https://twitter.com/TvdW/status/741481798014664704

Assignment is interpreted as add-to-the-list operator.

comment 10y ago · link · parent

I read somewhere ME (or other similar Intel technology) uses another MAC (it is off by one) not to interfere with main OS traffic. If it is really so you can setup MAC filtering on your router to block ME traffic.

But I might be wrong. For example this 2008 year document [1] says it uses same IP and MAC address as OS and filters packets by port number.

[1] http://web.archive.org/web/20080219044745/http://softwarecom...

comment 10y ago · link · parent

Viewed with JS disabled, dind't notice any lags.

comment 10y ago · link · parent

What about Android apps (like Facebook) that collect phone numbers, contact lists, geolocation data, record sound without any user authorization?

comment 10y ago · link · parent

I think better idea would be four tall legs (like a table legs) so it can move around the field. It doesn't need to move fast. You also need something to detect its position (laser beacons? radio beacons?) and some place to hide from rain. And a hand with a camera for harvesting crops into a basket.

comment 10y ago · link · parent

Bad parts of javascript:

- many mistakes are silently ignored. If you mistype object field name, divide a number by zero, add number to a string, access missing array element, no error is raised

- no proper OOP and classes

- no type hints for variables, function arguments or return values (well, there is TypeScript but it is another language)

- package manager (npm) loves to create deep hierarchies of folders

comment 10y ago · link · parent

Here are the problems I had when tried to write a simple CLI utility (tool to run any program in seccomp-bpf based sandbox) in Go:

- using case of a first letter of identifier as a public/private flag. You end up with half names starting in a lowercase letter, half in an uppercase (the code looks inconsistent) and forgetting how to spell them. And having to rename the function everywhere when you decide to change it from private to public.

- no official package manager. Unclear how to add external libraries to your project and how to set specific version you need. I ended up adding necessary files into a separate folder in my project.

- Go manual suggests you have single directory for all projects and libraries. That was inconvinient because I develop on Windows and use Linux only to test and run code in /tmp directory, I do not keep the code there. And why would I want to keep unrelated projects inside the same directory anyway?

- no rules how to split contants, types and functions into files and folders. For example in PHP there are certain rules: each class goes to its own file and you always know that class Some\Name is stored at src/Some/Name.php. Easy to remember. And in Go you never know what goes where. Large projects probably look like a mess of functions scattered around randomly

- no default values for struct members, no constructors

- no proper OOP with classes

- standard library is poor

- open source libraries you can find on github are not always good. I looked for library to handle config files and command line arguments and didn't like any.

- standard testing library doesn't have asserts

- easy to forget that you need to pass structures by pointer (in OOP objects are passed by reference by default). And generally use of pointers makes the code harder to read and to write.

- weird syntax for structure methods. They are declared separately from the structure.

- go has 2 assignment operators (= and :=) and it is easy to use the wrong one

- having to check and pass error value through function calls instead of using an exception. So most of functions in your code will have two return values - result and error

- no collections library

- simple things like reading a file by lines are not so simple to implement without mistakes

- static typing is good but sometimes you cannot use it. For example I wanted to have the options in a configuration file mapped to the fields of a structure. I had to use reflection and every mistake lead to runtime panic. And you cannot use complex types like "pointer to any structure" or "pointer to a reflect.Value containg structure" or "list of anything" or "bool, string or int".

Of course Go has also many good parts that might outweight its disadvantages but I am not writing about them. For example I have not used goroutines but they look like a simple solution for processing async tasks or writing servers.

I think Go is not ready yet for writing large applications. It might be ok if you write a small utility but I cannot imagine ORM like Hibernate or web application written in Go.

Also I took a look at the code in the presentation. I wouldn't want to write such code. For example, here https://talks.golang.org/2016/applicative.slide#20 they use static methods (http.HandleFunc(), log.Fatal()) instead of instance methods. So you cannot have two logs or two servers. Using static methods everywhere is bad especially in large applications. Google itself uses Go only for small utilities like simple proxy servers.

comment 10y ago · link · parent

It depends on how this is implemented. Is it enforced on a kernel level? What if some application, like browser or email client still allows starting an unsigned .exe file? Is Windows Store protected from publishing malware? Is there real privilege and access separation for different apps?

comment 10y ago · link · parent

I have a "dumb" phone but I don't expect it to be able to run a XMPP client. Even if it could, it's screen is too small and there are only numeric keys.

comment 10y ago · link · parent

No, I was not sarcastic. Many users are happy with being unable to run unsigned apps or listen to pirated music if it makes their devices secure.

comment 10y ago · link · parent

> I can fetch a previous version of the program and use it that way forever

Unless it is a web browser because modern frontend developers tend to make their web apps compatible only with the latest version of a browser they use on their Mac.

comment 10y ago · link · parent

> Windows 10 represents a significant increase in security

Is that really so? It seems that last 20 years Microsoft just plays whack-a-mole game closing endless vulnerabilities instead of designing a better architecture that would not allow such things.

For example in Windows any app has full access to a device. The user can run any app written by anyone just by clicking a link on a web page or mail message. In Android these problems are partially fixed and in iOS the user is unable to run malicious applications at all.

comment 10y ago · link · parent

The user did not request an upgrade. Microsoft uses dark patterns because in fact it is only Microsoft who needs upgrades to protect their future profits.

comment 10y ago · link · parent

Linux might be great if you have enough free time for learning how to set it up, experimenting and fixing bugs. Also you'll need time to optimize it. For example out-of-the-box Debian boots slower that Windows. And latest Ununtu is maybe 2 or 3 times slower than Debian, I don't remember when I saw such a long operating system bootup. Maybe it needs SSD but I don't want to buy it.

comment 10y ago · link · parent

Using dark UI patterns (like dialogs without cancel button) is disrespectful to users. They bought Windows to get stable and reliable operationg system. The system that updates at night and gets drivers or software broken is nowhere near stable. Even linux (which is awful as desktop system) doesn't autoupdate.

It might be acceptable if Microsoft gave their product away for free: many free products (e.g. Sublime or Skype) include annoying autoupdate popups for non-paying users. But Windows is quite expensive software.

Microsoft's motives are just getting more paid services, getting more telemetry (for free! they do not pay for it) and maybe adding some kind of subscription in future. Recent Windows versions like 7 or 8 seem to be 'good enough' for most customers so they do not want to upgrade for free let alone buy newer versions.

And subscription is as bad as DRM.

comment 10y ago · link · parent

And there should be a responsibility for not applying proper measures to protect personal information.

comment 10y ago · link · parent

It is actually interesting to see a patent troll suing patent troll.

comment 10y ago · link · parent

Some methods of fingerprinting are probably used to distinct between real users and bots. Bots can use patched headless browsers that are masquaraded as desktop browsers (for example as latest Firefox or Chrome running on Windows). Subtle differences in font rendering or missing audio support can be useful to detect underlying libraries and platform. Hashing is used to hide exact matching algorithm from scammers.

There is a lot of people trying to earn on clicking ads with bots.

Edit: and by the way disabling JS is an effective method against most of the fingerprinting techniques.

1
181182183184185