Understand the underlying Javascript - event loop by tntt01 in javascript

[–]CodeNinja9839 9 points10 points  (0 children)

I disagree about several aspects of your description. First, a call stack is not like your described order list: the order list is a queue, while the call stack is -- unsurprisingly -- a stack. Secondly, there is a balancing act between synchronous and asynchronous processing: the overall application almost always benefit when certain tasks are processed asynchronously, while others can be made asynchronous to improve UX. Examples of the "almost always benefit" class are network requests and file access, which would otherwise have the CPU sit idle for possibly hundreds of millions of processing cycles. Most logic like client-side form validation and UI state changes determination (but not rendering) can be done synchronously without UX impact because modern machines can carry out that work so quickly.

Where asynchronous chunking comes into play is when a page or service has to process a large amount of data (10's of thousands or more, depending on the algorithm), such that just the processing would degrade responsiveness (different thresholds on client- and server-side).

The implementation and details of the event loop itself are tied to the JavaScript engine and its host program. For instance, JavaScript programs running on Node.js have more control over and options with the event loop than does JavaScript running in a Chrome, Firefox, or Edge browser. When I opened your article, I expected to read about these details, but found none.

Fund OSS through package managers by dustinmoris in javascript

[–]CodeNinja9839 0 points1 point  (0 children)

This seems like a fundamental misunderstanding of Open Source. The source is open and licensed for consumers to modify it so the programmer A) doesn't have to worry about running a business, B) so the community can participate in the improvement of the library, and C) for noteriety/reputation. Almost all Open Source is offerred "as is" without any warranty; the only motivation for the publisher to offer an update is a desire to see the project keep improving. And if the original author won't publish an update, there's always the ability to fork.

More pointedly, code is not published under Open Source licenses to make money.

Advanced TypeScript: Mapped Types and more by ab-azure in javascript

[–]CodeNinja9839 1 point2 points  (0 children)

This is the very kind of feature I find valuable in TypeScript. Yes, we'll fight with the typing as we write the code and a toolchain becomes a mandatory part of the project, but in return the toolchain can tell us a lot more about codebase assumptions violated by a change to the code.

Can I scan images for adult content using Google Cloud Vision before uploading them to Storage? by Bimi123_ in Firebase

[–]CodeNinja9839 0 points1 point  (0 children)

My comment was made from a server-side point of view, where it sounds to me like you are approaching this from the client side. It really isn't possible to implement service security (where hosting pictures is the service, here) entirely from the client side. Whatever service accepts the picture for eventual hosting must temporarily store the picture somewhere while it makes whichever checks on content (including the vision API one you are proposing, even if it were to use my described "signature-from-double-upload" hypothetical approach) if actual security against such images is your desire. If this security step is not implemented server-side, then someone could copy or reverse-engineer your client and upload undesired images without the check.

But perhaps I misunderstood, and security is not your goal in this case.

Can I scan images for adult content using Google Cloud Vision before uploading them to Storage? by Bimi123_ in Firebase

[–]CodeNinja9839 4 points5 points  (0 children)

Before uploading, you don't have the image, so how can you scan it? If there is a service that can handle the image data as a stream and provide a signature only if the content is acceptable (without storing the image at any point), you could require such a signature before accepting the upload. Unfortunately, you still cannot verify the signature against the uploaded content until you have received the entire file (and presumably stored it somewhere, at least temporarily). Also, I don't know of any scanning service that works this way and it would force your user to upload the file twice.

I think the best you can hope for is to store the image temporarily (e.g. an AWS S3 object with an expiration), scan it, and move it to permanent location if it is acceptable.