Better HN
topnewbestaskshowjobs
Log inSign up

DCoder

1,260 karma · joined Nov 2, 2009 (17y ago) · 479 submissions

not here anymore
Submissions

comment 10y ago · link · parent

Yes, it is, but that doesn't excuse doing it here.

comment 10y ago · link · parent

Note that this approach can expose the user entered password in application debug logs, MySQL's slow queries log (if you're not using bind variables), etc.

comment 10y ago · link · parent

There was also https://lwn.net/Articles/57135/

comment 10y ago · link · parent

The short lived "Team Knight Rider" series had a somewhat similar moment - the mechanic was working on the team's AI-equipped cars and talking to them, when the cars stopped talking back. [1]

Mechanic: "Why won't you answer me?"

Terrorist appears next to him: "Because it's just a car, you freak."

[1]: https://youtu.be/xOv1-GiWSh0?t=7m15s

comment 10y ago · link · parent

Interesting, I honestly don't know if that makes a difference.

comment 10y ago · link · parent

There are some subtle behavioural differences between the Language Service and the regular compiler, for example: https://github.com/Microsoft/TypeScript/issues/5243

comment 10y ago · link · parent

swax is probably referring to the compiler option "noImplicitAny", which can literally turn variables whose type is not explicitly specified and cannot be inferred from their declaration as errors, instead of assuming they have the transparent `any` type.

comment 10y ago · link · parent

The code insight is one of the many reasons I switched from plain JavaScript to TypeScript and will not go back.

comment 11y ago · link · parent

Would that make https://www.flightradar24.com/ a much bigger concern?

comment 11y ago · link · parent

Vilnius, Lithuania: http://stops.lt/vilnius/#vilnius/map/en (click "Show vehicles").

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

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.)

comment 11y ago · link · parent

> 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`.

comment 11y ago · link · parent

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/

comment 11y ago · link · parent

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

comment 11y ago · link · parent

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/

comment 11y ago · link · parent

> (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.

comment 11y ago · link · parent

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

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

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...

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

> 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...

comment 11y ago · link · parent

> where a new major version number indicates backwards-compatible changes

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

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

In that case, you will probably need additional budget for a sysadmin to keep it up to date.

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

> 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

comment 11y ago · link · parent

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.
1
91011
16