HNHacker News
TopNewBestAskShowJobs

DCoder

1,260 karma · joined November 2, 2009

not here anymore
submissionscomments
DCoder··on Quill – A cross browser rich text editor with an API
Websites. RTEs are a necessary evil there. If you want to post some text on your website (an announcement, press release, anything), your options are plain text, RTE, or non-WYSIWYG solutions such as Markdown/HTML, which are far outside a non-technical user's comfort zone. Lots of clients (well, their secretaries) copy-paste articles from Word (sent to them by marketing, sales, legal, press teams) into the website, and that requires an RTE with:

* basic HTML markup (headlines, paragraphs, lists...)

* HTML tables

* images (data:// URIs are good for handling pasted images) and an image/file browser, complete with some image processing that rejects or shrinks down giant images without ruining the image quality, because people will upload giant JPEGs straight from their phone if you let them (naturally, file uploads come with their own cans of worms like server security, disk space, file permissions, growing backups, etc.)

* black magic to cope with Word's markup

Don't forget to make sure that the end result looks consistent with the rest of the site without the users having to manually set the font family/size on all their text... and that the editors can't turn off the RTE and post raw HTML with malicious intent... and a million other things.

DCoder··on Goodbye CoffeeScript, Hello TypeScript
But the compiler's output will be polluted with these false positives, making it harder to see actual errors. (Also, there's a compiler flag to prevent codegen on error, which comes in handy sometimes.)
DCoder··on Goodbye CoffeeScript, Hello TypeScript
> Every JS code is a valid TS, since TS is a superset of JS.

There are still cases where you'll need to sprinkle <any>. For example:

    var state = { foo: 1 };
    if(something) {
      state.bar = 2;
    }
is valid JS, but the TS compiler will complain that `state` does not have a member named `bar`.
DCoder··on The viability of JavaScript frameworks on mobile
Google Closure Compiler [1] can also perform dead code removal, but it requires extra work annotating all public APIs and naturally it can't cope with dynamic/indirect calls.

[1]: https://developers.google.com/closure/compiler/

DCoder··on Soviet PCs
Speaking of things that the soviets reverse-engineered, I think the B-29 Superfortress is worth mentioning: https://en.wikipedia.org/wiki/Tupolev_Tu-4
DCoder··on Soviet PCs
Here's a similar joke I found in Viktor Suvorov's faschinating Kuzkina Mat [1] :

A man is walking down the street carrying a 12-roll pack of toilet paper. People surround him, all excited: "Where'd you get that?" The man answers, "I just got it back from the dry cleaner's!"

[1] http://www.andrewnurnberg.com/books/kuzkina-mat/

DCoder··on Ask HN: Resources for learning manual software testing?
> (email is in my profile)

The "Email" field in your profile is private, others can't see it. You need to put your email in the "About" field for it to be publicly visible.

DCoder··on How to Write Unmaintainable Code (1999)
As I see it, the auditor's job is to analyse the system thoroughly, not to skim some areas of it. Looking through 5000 pages worth of code on a computer screen would also be quite a challenge, even with the interactive aids you get from an IDE.

Tangent: speaking from personal experience, sifting through an existing foreign code base is a really exciting task for some people, figuring out what makes it tick and how the pieces fit together can be fun. Granted, I was reverse-engineering a closed-source product, not reading its actual source, but that was even more fun :D Come to think of it, the tool I used for that, IDA Pro, has some interesting features that IDEs don't, such as graphical representations of function call graphs [1] and function basic blocks [2]. It would be interesting to see what a creative person could do by integrating those into a regular IDE.

[1] http://scratchpad.wikia.com/wiki/Reverse_Engineering_Mentori...

[2] https://www.hex-rays.com/products/ida/tech/graphing.shtml

DCoder··on How to Write Unmaintainable Code (1999)
To be fair, an IDE is not geared at auditing and it would be much more painful to do freeform annotations in it. Circling problematic areas, drawing connections between variables/functions, making handwritten notes in the margin... all that is easy on paper and requires workarounds/other programs on a PC.
DCoder··on Bugzilla CVE-2015-4499: All Your Bugs Are Belong to Us
MySQL can turn those warnings to exceptions on its own, via sql_mode [1]. New installations of MySQL 5.6 have this behaviour enabled by default on InnoDB tables.

[1] http://www.tocker.ca/2014/01/14/making-strict-sql_mode-the-d...

DCoder··on 'Hackers' at 20
Antitrust's "I think my girlfriend is trying to poison my food, so I'll cut myself, expose the cut to that food and see if I get sick" scene ruined the movie for me. I know that's basically how allergy testing works, but it was still cringe-worthy.
DCoder··on Lovefield – A relational database for web apps
We have a web app that downloads a large list of simple repetitive maintenance tasks ("check amount of spare printer toner", "water the office plants", and such) with documentation, images, etc. that need to be performed regularly, and then shows the user that list so he can perform the tasks and send back the results. Some companies using this app do not allow internet access in the specific areas where tasks have to be performed, so some parts of the app have to work without it. Business requirement was "store enough info on the device to be able to run without internet access for one month".

Without an in-browser persistent database (we used WebSQL, with all the future risks), it would require some interesting workarounds (can you serialize multiple megabytes to local storage? how long will it take? will it rollback from a fault correctly?) or Phonegap type solutions.

DCoder··on How we ended up with microservices
> the default MySQL datastore quietly drops strings longer than the field [...] I don't know if that's still true. If it is, then I'm glad I no longer have to deal with MySQL.

That's still true, as I recall. To avoid this nonsense, you need to change the sql_mode - either globally in the server config, or only within your session by issuing an SQL query.

Documentation: https://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmod...

DCoder··on Node v4.0.0
> where a new major version number indicates backwards-compatible changes

lucio was probably referring to this part, where "incompatible" is indeed correct.

DCoder··on Windows 10 now wants you to pay for Solitaire
Yes, in Windows 8 / 8.1 Solitaire (as well as other casual games published by Microsoft, such as Minesweeper, Sudoku, etc.) did include ads. They were shown in small boxes on the start screen, if you swipe to the right, and in the end game "you win" screen. In addition to those, I occasionally saw a full-screen ad when starting a session on the PC, but not on the tablet.
DCoder··on Pro-security? Stay away from these hosters
In that case, you will probably need additional budget for a sysadmin to keep it up to date.
DCoder··on Announcing TypeScript 1.5
To add to what everyone else is saying: I started using TS back in the 0.8 days, before generics were a thing. Since then, I have built several projects with TypeScript and migrated one JavaScript project to TS. These projects also involved Knockout, WebSQL, jQuery and other extras. Along the way, I got most of my colleagues hooked as well. When a new project starts up, the question is usually " Is there a compelling reason to use plain JavaScript instead of TypeScript here? ", not the other way around.

The good parts :

* The type system serves as a great safety net and prevents a whole class of bugs.

* Intellisense is far smarter than you would get from JavaScript (no more silly IDEs with both jQuery's .append() and DOM's .appendChild() in the same intellisense suggestion). This enables refactorings and intelligent assistance such as Find All References, which is much more brittle in plain JS.

* Classes are much more convenient and readable than old-school inheritance solutions. Those old solutions were also a huge problem for JS intellisense.

* AMD Modules paired with Require.js are much more centralized than "add these fifty script tags to the HTML document, in the right order". That's more due to AMD, but TypeScript adds some nice syntax sugar on top of that.

* Arrow functions. No more `var that = this` to keep callbacks working.

* Generics, function overloads, etc. - depends on the things you use in your code. If most of your viewmodel properties are Knockout Observables, generics are a life saver. If you're chaining Promises, again, generics can cover their return/param types. Function overloads come in handy if you have factories building objects based on string parameters (example: document.createElement() returns different classes based on the name passed in). And so on.

The bad parts :

* New language to learn. And it keeps evolving.

* Requires an additional build step. There's a large amount of small projects without any build process out there - integrating TS into such a project can be difficult and open a new can of worms related more to the build process than TS (e.g. "do you commit the generated JS and sourcemaps, or provision a build server to package them?"). Of course, if you're already using Grunt/Ant/Phing/whatever else, this is not a big problem. (You should be using a build process at least to aggregate your JS into one blob, if nothing else.)

* Definitions for third-party libraries. DefinitelyTyped helps a lot here, but there are still things that it doesn't cover, and it can be time-consuming to keep a definition file in sync with a library as the library updates.

* IDE support. After using PHPStorm/IntelliJ and Visual Studio Express/Community, Visual Studio wins hands down. IntelliJ's support was quite disappointing and glitchy, especially its lack of intellisense. Visual Studio Code, Community and Express are all free, but the latter two are quite bulky and running them alongside a different IDE can be slow.

* Debugging can be a bit challenging due to sourcemaps, depending on the target browser. I prefer to disable sourcemaps and debug the generated JS directly, but that requires some mental juggling and is not everyone's cup of tea.

DCoder··on The boring front-end developer
> Does there not come a point where cutting support for a class of platforms is a good thing?

For example: An article was linked on the HN frontpage a couple days ago about how CP/M reserved names (COM1, etc) still live on in ASP.NET MVC these days. https://news.ycombinator.com/item?id=9871014

DCoder··on StackOverflow modding itself out of existence
Link-only answers are discouraged on StackOverflow - the mods will ask you to copy the relevant information into the answer so that it can be useful even without following the external link. The justification about "the sites change" goes both ways.
DCoder··on StackOverflow modding itself out of existence
It does happen, but you picked a bad example. Read the close reason: " Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. "

StackOverflow is for programming questions. That question, as it was formulated, is not about programming. It belongs on either Unix&Linux or Super User instead.

DCoder··on The military tested bacterial weapons in San Francisco in 1950
See also: http://www.johnstonsarchive.net/nuclear/radevents/1954USSR1....
DCoder··on Hacking Team hacked, attackers claim 400GB in dumped data
It seems like that code just builds random-ish data that conforms to the wanted file format and then gives it incriminating names. For example:

[1] https://github.com/hackedteam/rcs-common/blob/38290d4eab2b2c...

[2] https://github.com/hackedteam/rcs-common/blob/38290d4eab2b2c...

DCoder··on ES6: The features I'm most excited about
Yes, you're right. My bad.
DCoder··on ES6: The features I'm most excited about
The idea isn't "don't use promises", it's more "use/chain the promises you already got from libraries (e.g. AJAX calls), don't construct new promises yourself". See the StackOverflow question inglor linked to: https://stackoverflow.com/questions/23803743/what-is-the-exp...
DCoder··on ES6: The features I'm most excited about
No, it returns a new Promise that's already been resolved to the value you returned previously.
DCoder··on Firefox 39.0 released
Chrome dev tools also support node drag-and-drop as well as ctrl-x/c/v in the Elements panel.
DCoder··on How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on the PS1
Command&Conquer: Red Alert 2 and its expansion pack also received community patches (I contributed to them a lot) to its binary. When EA later released The First Decade bundle with all the old games in it, they removed the old copy-protection. Most games in the bundle were simply recompiled to remove it, but for the expansion pack they hex-edited the copy-protection to keep it community patch compatible.
DCoder··on Why did Borland fail?
> It's weird thinking we used to pay for compilers

People still do. For example, Intel sells several compilers: https://software.intel.com/en-us/intel-compilers

DCoder··on Why did Borland fail?
I'll second all those points, especially the first one, but I'll add a word of caution. All of the points you mentioned require the IDE to parse all the code, not just the code you are writing at this moment. If it doesn't know the type of $foo, it can't tell what $foo->getModel() calls and therefore it can't rename that getModel(), for example. This means you have to be careful in projects using older frameworks or CMS. From recent experience, a great example of such an atrocious codebase is Magento:

- their method calls are excessively chained, which means a failure to analyse step 2 of the chain blocks analysis of all further chained calls

- their phpDoc either doesn't exist or is actively misleading at times

- they rely on magic methods all throughout the codebase without properly annotating them

- https://imgur.com/RMxWEgR

DCoder··on Your cyberpunk games are dangerous
> J. Eric Townsend reviewed a copy [of GURPS] for the early computer security zine RISKS

This looks like the review in question: http://catless.ncl.ac.uk/Risks/10.03.html#subj10.1

← PreviousPage 10 of 16Next →