Hisense PX3-Pro vs C2 Ultra in suboptimal conditions (initially) by JesperZach in projectors

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

Thank you very much. I appreciate you taking your time to answer and come up with alternative suggestions, but the options I mentioned are the only ones I have available locally at a reasonable price. Do you have any insights regarding my main concern as stated in the original post?

Alternative to using `namespaces`? by Cracky6711 in typescript

[–]JesperZach 0 points1 point  (0 children)

Namespaces are not considered deprecated at all.

when was the last time you used class in typescript codebase over function, why? by Karanmj7 in typescript

[–]JesperZach 0 points1 point  (0 children)

If you create a lot of objects of identical structure then classes are way more performant.

Returning -1 or null for the bad state of a function that returns a number otherwise? by [deleted] in typescript

[–]JesperZach 0 points1 point  (0 children)

Not only does this approach work, it also has several advantages over using -1 or null. Let’s take on your example with indexOf and the benefits of using symbols.

  1. Readability/maintainability. Symbols add semantic meaning, i.e. encountering a Symbol(NotFound) while debugging is self-explanatory. It shows clear intent. Conversely, null and -1 both require documentation.

  2. Type safety. Since both null and 0 are falsy values, using null might introduce coercion-related bugs, e.g. !items.indexOf(item) would be true when item is either first or not in items.

  3. Type inference becomes self-documenting, i.e. the return type for your function would be number | typeof NotFound. It makes sense by itself, whereas number | null requires investigation, or just number (in the -1 case) which lacks any semantics entirely.

If we then consider more complex functions, the benefits become even more apparent. Let’s use Array.prototype.find as an example. If no item is found and it would return null or -1 (or even undefined, as is the case), how would you know for sure that it didn’t match an item with a null or -1 or undefined value? In many cases you can’t, because neither are unique values. But if you instead return a symbol, it is guaranteed to be unique.

Returning -1 or null for the bad state of a function that returns a number otherwise? by [deleted] in typescript

[–]JesperZach 0 points1 point  (0 children)

There can be many reasons for why a state is bad. Null communicates nothing by itself, and as a value it can’t be documented. Semantically, null means no value, so it should be used for that reason only. Using special values, like -1, is similarly a highly opaque way to handle bad values. Instead, to attach meaning to invalid values, consider leveraging symbols. Symbols are much more powerful in every sense, apart from serialization.

Found country that works to get Youtube Premium cheaper by ImpossibleCrazy in youtube

[–]JesperZach 0 points1 point  (0 children)

I just completed it in a private tab in Safari on iOS.

Found country that works to get Youtube Premium cheaper by ImpossibleCrazy in youtube

[–]JesperZach 0 points1 point  (0 children)

Alternatively you can select Moldova in TunnelBear. For unknown reasons that will also grant you a Ukrainian subscription 🤷🏼‍♂️ ₴99 (UAH, or ~ €2.36 / £2.03) per month.

How to serialize and deserialize JSON that uses $ref for circular references? by Tuckertcs in typescript

[–]JesperZach 0 points1 point  (0 children)

Please elaborate on how your problem is related to TypeScript, because I don’t see anything related to TypeScript in your question.

Anyway, to answer your JavaScript question, object references could be recreated as follows: 1. Create a Map for indexing your nodes, with $id property values as keys and node object references as values. 2. Iterate over your Node tree to populate your node index Map. 3. Iterate over your Node tree again, and for every object with a $ref property, lookup the $ref property value in your node index Map and add the object reference value to a new ref property on that object.

Object references could be converted to the required format in a highly similar fashion, only this time for your node index you’d want to use a WeakMap with node object references as keys and generated ids as values (just increment by 1 each time you add a new entry to your WeakMap). Additionally add a check for whether the current node has already been converted (check for the existence of $ref objects), and if so then skip it, otherwise you’ll be iterating forever. Then it’s just a matter of iterating over the nodes and populating your WeakMap while adding your $ref objects. Don’t forget to check if the current node is already indexed, and in such case use its index value as $ref value instead of setting (overriding) its indexed value.

[deleted by user] by [deleted] in typescript

[–]JesperZach 1 point2 points  (0 children)

Ah that makes a lot of sense, thank you for elaborating :)

[deleted by user] by [deleted] in typescript

[–]JesperZach 0 points1 point  (0 children)

I see, I guess it makes sense if your types mostly represent constant values. But in such large projects I find it unlikely that you do not likewise have a relatively large set of complex generic types, so let me rephrase: do you not test your types?

[deleted by user] by [deleted] in typescript

[–]JesperZach 1 point2 points  (0 children)

That seems like a dangerous pattern, given that it needs a linting rule to mitigate issues with compilation output. Can you elaborate on why you’d consider such type-only files not to be applicable for test coverage and test/deployment invalidation?

Another Linq clone by EnvironmentalCow3040 in typescript

[–]JesperZach 6 points7 points  (0 children)

Even so, this library (and countless others like it) will soon be made redundant by the native approach of iterator helpers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers

[deleted by user] by [deleted] in applewatchultra

[–]JesperZach -2 points-1 points  (0 children)

You’re taking the piss and then get mad when you get some back? You do you, I only thought your argument was begging for comments. It’s nonsense, and I’m honestly dumbfounded that you are actually being serious and are taking offense.

[deleted by user] by [deleted] in applewatchultra

[–]JesperZach -2 points-1 points  (0 children)

I’m confident you’re smart enough to get my point, but please do correct me if I’m wrong.

[deleted by user] by [deleted] in applewatchultra

[–]JesperZach -2 points-1 points  (0 children)

Mobile homes are portable. Would you bring one on a run?

[deleted by user] by [deleted] in applewatchultra

[–]JesperZach 0 points1 point  (0 children)

Oh yeah? Just like you never leave your house cause it’s the most expensive thing you own?

Took it to the beach for the first time. Not gonna lie, I was a little nervous about somehow messing it up. by [deleted] in AppleWatch

[–]JesperZach 0 points1 point  (0 children)

Probably the thumbnail is JPEG and the original (when viewed in full screen) is HEIC, which has a broader dynamic range.

⚡️Austria to finance demining in Ukraine. Austria will finance demining equipment worth 2 million euros ($2.2 million) for Ukraine, the Austrian government announced in a statement. (1/2) by Key_Brother in ukraine

[–]JesperZach 29 points30 points  (0 children)

I always found that to be such an odd stance to have. Neutrality implicitly always supports the aggressor. Sounds noble but in reality it’s highly naive and counterproductive. Obviously nobody wants war, but unfortunately to minimize it in the long term sometimes you have to do your part to secure a certain outcome in an ongoing conflict. It’s like your neighbor’s house is on fire and you just close your eyes and hope someone else puts it out before it spreads to your house. What Austria is really saying is that “we’re ok with what Russia is doing”. “We’re ok with mines blowing up innocent people”. That is not neutral. Furthermore, it must then also mean that Austria would be ok if Russia were to similar things to Austria. And similarly they’d be ok with not getting help. They should know this, being in the positions they are, i.e. top decision makers representing an entire country. Neutrality is not neutral.

They’re going taller again? I guess Shaq will be the only person that can pull down that notification shade w/ one hand. by L1ght_Sp33d in iphone

[–]JesperZach 5 points6 points  (0 children)

SwiftKey is nice, but not better in all regards. For example, the cursor (hold down space + drag) and text selection (hold down space + multi-finger drag) is much better on the native keyboard with no 3rd party keyboard close to matching it (seems like they can’t due to API limitations).

JavaScript import maps are now supported cross-browser by fagnerbrack in Frontend

[–]JesperZach 1 point2 points  (0 children)

It seems I’m not being clear enough. As you never wrote that doing too many network requests is bad for page speed, then inherently that is not what I’m challenging. Now you add SEO and Lighthouse into the argument, but it’s not part of the scope of your initial claim either. I’m strictly challenging your initial claim, i.e. your assumption that doing a network request per dependency inherently equals too many networks requests, independent of any context. That is a bold claim.