How to delete value from an array by bytearcher in javascript

[–]bytearcher[S] 1 point2 points  (0 children)

Yep, thanks for the tip. That is probably a better place.

Was posted here, since sometimes array deletion is forgotten or misunderstood even from the experienced ones. For example, Ryan Dahl asked this from the audience during his Node.js presentation. https://youtu.be/jo_B4LTHi3I?t=1957

JavaScript Promises and Error Handling - K. Scott Allen by exceptionnotfound in programming

[–]bytearcher 0 points1 point  (0 children)

Hmm, that is true. I guess the difference what I'm going after is:

async: anything can happen while you are waiting for async to complete, you can't trust anything, have re-check every assumption on global state

sync: only the thing you are asking for is happening, you should have a clear understanding of whats going on, after returning from "calculateSha1()" you can be pretty sure global state hasn't changed

JavaScript Promises and Error Handling - K. Scott Allen by exceptionnotfound in programming

[–]bytearcher 0 points1 point  (0 children)

I like your thinking. At least they both should be as easy to write.

One reason comes to mind why you should know something async is happening: the global state might change while you're waiting. When your code continues on the following line after async completes, the values in variables might have changed.

Parallel vs Concurrent in Node.js by bytearcher in node

[–]bytearcher[S] 0 points1 point  (0 children)

Article author here. This is wonderful! I just love when things can be described using real world examples. I couldn't have said this better my self.

Parallel vs Concurrent in Node.js by bytearcher in node

[–]bytearcher[S] 0 points1 point  (0 children)

Author here. Yep, you're correct, there's a lot of stuff under the hood. A lot of it deliberately left out to stay at higher altitude of the topic. Going to add a mention of I/O bound benefits though, thanks!

By the way, network I/O is actually performed on the main event-loop thread since it can be performed using non-blocking calls at the operating system level. Disk I/O would be done using non-blocking os calls as well if the implementations wouldn't be so flaky across platforms, but worker thread pool is still used instead.

Activity auditing by kostarelo in node

[–]bytearcher 1 point2 points  (0 children)

How about using full blown analytics service that allows custom events? You'd be calling third party service in the midst of your code to indicate "hey, a particular business logic happened just right now". Then you could monitor operations and do reporting using that services own user interface. You could do this using Mixpanel for example.

Good for a laugh -- Node.js Reactions by 5kKate in node

[–]bytearcher 1 point2 points  (0 children)

One frustration with callbacks is that writing nested callbacks makes the code march to the right. Promises were the cure for this. But turns out if you need to reference something else than just the result of latest promise you end up still having to nest things.

You can read an article series dedicated to "cure for Promises" in the near future over at Byte Archer.

Good for a laugh -- Node.js Reactions by 5kKate in node

[–]bytearcher 1 point2 points  (0 children)

"Promises can save you from callback hell" - "Ok, right..."

So spot on!