HNHacker News
TopNewBestAskShowJobs

DCoder

1,260 karma · joined November 2, 2009

not here anymore
submissionscomments
DCoder··on Akamai takes Brian Krebs’ site off its servers after ‘record’ cyberattack
> PING krebsonsecurity.com (127.0.0.1): 56 data bytes

Reminds me of: https://twitter.com/troyhunt/status/716408697266679808

DCoder··on React Router v4 FAQ
Yeah, instead of this problem Ember will give you other problems:

https://www.google.com/search?q=site:https%3A%2F%2Fwhat.thed...

DCoder··on React Router v4 FAQ
Magpie-Driven Development at its finest!
DCoder··on Angular 2 Final Released
The same could be said about the "JavaScript vs TypeScript" argument. I can see that argument, but in my opinion, the safety nets provided by TypeScript and TSX are well worth the initial learning curve.
DCoder··on Angular 2 Final Released
You don't choose between those two routers, they are not replacements for each other.

At the risk of stating the obvious, the Angular router handles routing for the Angular frontend, the Go router handles routing for the Go backend (the initial page load, the AJAX calls made from Angular to get data...).

DCoder··on Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
We had to integrate a webshop with the customer's existing SAP installation. The consultants in charge of SAP gave us a SOAP webservice that, among other things, had a command called ExecuteSQL - we could pass a raw SQL string and the SAP server would execute it. They "protected" it by blacklisting common naughty words like DROP, ALTER, etc., as well as semicolons and CAST (I don't really know why). When we needed to actually include a semicolon in the query as part of a string literal, I had to work around their filter by replacing the string literal with CONVERT(VARCHAR(MAX), 0x.......) .
DCoder··on How to make an efficient payment system in Erlang
DK might also be Dunning-Kruger.
DCoder··on Fixing JSON
Counter-point: you can tell if the JSON you received is intact or was cut off, because it won't parse properly without the closing braces. You don't have that safety net with YAML or TOML.
DCoder··on Fixing JSON
Regarding timestamps, the at-sign is already used by GNU tools, as a prefix to indicate actual UNIX timestamps (seconds since epoch): https://www.gnu.org/software/coreutils/manual/html_node/Seco...
DCoder··on Hololens Commercial Suite
> If you have to ask...

FWIW, the Development Edition alone, without the enterprise additions, costs 3k$.

DCoder··on Huge no. of files for Angular 2
npm v3 tries to dedupe packages during installation to reduce this problem. However, it still does not install packages in a deterministic way...

[0]: https://docs.npmjs.com/how-npm-works/npm3-dupe

[1]: https://docs.npmjs.com/how-npm-works/npm3-nondet

DCoder··on Why we lost Uber as a user
> When running a 32-bit build of MongoDB, the total storage size for the server, including data and indexes, is 2 gigabytes. For this reason, do not deploy MongoDB to production on 32-bit machines.

From https://docs.mongodb.com/manual/installation/#faq-32-bit-lim...

There was also the issue where errors were either logged or not, based on the result of Math.random(): http://stackoverflow.com/q/16833100/1233508

DCoder··on Ruining the Magic of Magento's Encryption Library
> The use case for Magento is (apparently deliberately) confused. It's an unholy melange of a CMS and a shopping basket. There is no good out-of-the-box experience; in practice it's a job creation scheme for consultants.

The CMS capabilities of Magento are quite limited, as the Community Edition does not even include a "menu" module or a hierarchy for your static pages. My opinion is similar to yours, it is a powerful shopping basket that will require lots of custom development or third-party module juggling to get a decent result.

I have been working with Magento 1.x CE for a few years now, and I wanted to add a few more factoids from a developer perspective:

* The database API has an "you want it, you got it!" mentality - if you tell it to add a unique index and MySQL refuses to because existing data is not unique, the API will parse the MySQL error message to identify the duplicated fields/values and delete them silently. You will get your index, but you might no longer have all your data. [0]

* The model classes store nearly all the in-memory data in an untyped dictionary. You can call $model->setFoobar('12345') and later $model->getFoobar() to get it back - all unknown method calls get forwarded to a "catch-all" method which treats the method name as a key into this dictionary, and gets/sets a value of that key [1]. Most of the time, these calls are unannotated, so IDEs can't make any sense of them (see the "Undefined method" part in [2]). This unknown method forwarding is also a performance issue, so they make optimizations like [3] by inlining pieces of the catch-all handler code for commonly-used data.

* The JavaScript is based on Prototype.js, not jQuery, so half the modules and themes bundle their own copies and drop them in different locations. Some of them provide a configuration setting so you can disable their jQuery and use your own, some don't.

* It includes a "Developer Mode" where php notices and warnings are turned into exceptions like in sane languages. But plenty of modules and themes have never been tested with this setting on and they cause faults on every page load - either you have to disable the Developer Mode, or fix this third-party code.

[0]: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/...

[1]: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/...

[2]: https://imgur.com/RMxWEgR

[3]: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/...

> I don't have a good answer on the shopping basket, but Magento was bad enough at that too that we went back to our in-house homerolled system.

Our clients were originally in love with Magento because "we can just add all these existing modules and get all sorts of awesome functionality without having to pay you for it!" We warned them that that was a pipe dream, but they didn't listen. Now they have several thousands of hours worth of custom development on top of Magento 1.x (95% of it written solely by me, no bus factor problems with that) and it's not even finished yet. Last I checked, the end-of-life for M1.x is planned in December 2018, and the client has no plan for what to do then.

> I understand some work has gone into Magento 2.0 to make it less mind-bogglingly horrible.

When I looked at Magento2, they had an amazing solution to PHP's lack of generics: they bundle multiple "template" classes and during system installation, you're supposed to run a CLI script that goes through those classes with a list of wanted concrete classes and generates specialized class files for all of them. If you fail to run this script, don't worry - their custom autoloader will detect this and generate those classes at runtime, when they are needed.

DCoder··on Shipping Rust code in Firefox
If you click on the image to see the interactive graph, under "Advanced settings" there's a switch "Date range variable: filter submissions by build date range or submission date range", which is set to "build date range". So those "3 dates" correspond to three different build dates.
DCoder··on Pokemon Go is a huge security risk
See also: https://twitter.com/boonerang/status/751849519407595520
DCoder··on Symantec's Bad Week
From SecurityWeek's writeup on the same topic [1]:

No interaction is required to trigger the exploit. In fact, when Ormandy sent his PoC to Symantec, the security firm’s mail server crashed after its product unpacked the file.

[1]: http://www.securityweek.com/critical-vulnerability-symantec-...

DCoder··on Critical Update on DAO Vulnerability
That's Slack, not IRC. Slack uses the term "Direct Messages" for private conversations.
DCoder··on Migrating a 10,000-line legacy JavaScript codebase to TypeScript
To do things like that in a dynamic language, you need to either infer types somehow, or rely on metadata like JSDoc, beyond the language itself, and that sucks – if another developer works on the project with a dumber IDE, their code will probably lack such metadata or it will not be entirely correct.

I have been using IntelliJ daily for the last five years for PHP, JS and TS development. For PHP, I write typehints and PHPDoc wherever possible to help the IDE make sense of things. For JS, I tried doing the same with jsdoc but it didn't work out, and I have decided to avoid any automated refactoring or even autocomplete, it's far too fragile. For TS, using the types in my code makes the IDE smart and reliable, although IntelliJ's support for type inference in TS is still far behind VSCode.

Special mention here goes to Magento developers, whose PHPDoc, 98% of the time, is either lacking or outright incorrect (referencing classes that don't exist – incredibly frustrating).

DCoder··on Drop jQuery as a dependency from Rails
Too bad Magento devs missed that newsflash. Nowadays it still bundles Prototype.js, and every theme and 50% third-party modules you install carry their own copies of jQuery, all at different versions, placed in random locations, and embedded into the page differently.
DCoder··on jQuery 3.0 Release Candidate
In addition to handling well-known browser inconsistencies, it also covers obscure edge cases such as these: https://docs.google.com/document/d/1LPaPA30bLUB_publLIMF0Rlh...
DCoder··on Chrome removes Backspace to go back
It does not, but the page author can use javascript to generate a confirmation dialog when you're leaving the page: https://developer.mozilla.org/en-US/docs/Web/API/WindowEvent...
DCoder··on Language complexity, measured by how many rules GitHub's .gitignore has
Magento 2 fixes the "no namespace" issue. Everything else is still there, and some parts are taken to eleven.

A while ago, I ran PHPStorm's code inspections against Magento 1.x core code, and the result wasn't very encouraging: https://imgur.com/RMxWEgR

DCoder··on The Linux Scheduler: A Decade of Wasted Cores [pdf]
You might be thinking of LWN. They covered the scheduler multiple times over the years: https://lwn.net/Kernel/Index/#Scheduler
DCoder··on Grunt 1.0.0 released
The "file name too long" was an issue in npm v2, where each module installed its dependencies inside itself, recursively, leading to enormous node_modules/foo/node_modules/bar/node_modules/baz/node_modules/quux/node_modules/... chains.

npm v3 was an attempt to fix this so it now tries to install all modules and their dependencies in the top level directory, unless there's a version conflict, in which case it falls back to the old behaviour. npm v3 also got slower, because to fix the folder chains it changed how the packages are downloaded and installed.

It sounds like your node_modules were installed by npm v2 – you can try nuking your entire node_modules folder, ensuring you have npm v3, and letting it install your dependencies again. If your guess about grunt's performance problems is correct, this might improve your build experience.

DCoder··on NPM Package Hijacking From the Hijacker's Perspective
See also: https://github.com/joaojeronimo/rimrafall
DCoder··on Learning from Tay’s introduction
You're probably right, even though I want to believe it wasn't.
DCoder··on Learning from Tay’s introduction
https://www.reddit.com/r/tay_tweets has lots of examples, most of them 4chan-level.

These few are completely different and certainly interesting: https://i.imgur.com/iVof3D4.jpg https://i.imgur.com/YwlfwyL.png https://i.imgur.com/IlpFUiZ.png (though it's hard to confirm they're legit, as Retr0spectrum points out).

DCoder··on Left-pad as a service
Exactly, just like a monad is just a monoid in the category of endofunctors!
DCoder··on NetHack: The Greatest Game You Will Ever Play
I like the approach used in community updates to Worms:Armageddon – newer versions can emulate the behaviour of older versions when running a saved replay or when playing a match with multiple conflicting versions.
DCoder··on What's New in Webpack 2
Have you looked into TypeScript? Type system helps you catch even more errors.
← PreviousPage 8 of 16Next →