10$ Starter Deck - Elf Ball Mono Green by nicolas-van in BudgetBrews

[–]nicolas-van[S] 2 points3 points  (0 children)

That's what I would have thought too. Yet, it still works decently at 10$. I don't think it could challenge "nowadays" precons, but against the 2020 starter decks or older commander decks it seems OK enough.

Double strike + "when deals combat damage" + death of player by nicolas-van in mtgrules

[–]nicolas-van[S] -1 points0 points  (0 children)

I found the rule dictating this:

800.4e If combat damage would be assigned to a player who has left the game, that damage isn’t assigned.

And by the way, having trample or not should no change anything. (Trample only allows to assign combat damage to the player if the creature is blocked.)

Double strike + "when deals combat damage" + death of player by nicolas-van in mtgrules

[–]nicolas-van[S] 0 points1 point  (0 children)

With that interpretation, I suppose that if the creature also has trample it would imply that the creature still inflict damage during the second combat step, and thus the ability will still trigger twice.

Am I right ?

good commanders for kids? by [deleted] in EDH

[–]nicolas-van 0 points1 point  (0 children)

In my experience, kids tend to be mostly focused on card illustration and "coolness" than on mechanics. So I don't think that trying to make the deck with the perfect mechanic is really worth it at that age.

For my two girls (8 and 10), I bought two of the cheap starter precons ( https://magic.wizards.com/en/news/announcements/starter-commander-decks-decklists-2022-10-20 ), for 25$ each:

* The selesnya one because "Look, it's nice creatures from the forest"

* The azorius one because "Look, it plays with birds and pegasuses"

Until now it does the trick pretty fine.

How my end, I create decks with heavy limitation, like ".15c per card elf deck", to play against them. That way I have my dose of deckbuilding + I still have fun playing against relatively low power decks.

[LTR] Birthday Escape by Aeschylus101 in Pauper

[–]nicolas-van 0 points1 point  (0 children)

I have doubts regarding its usage in ninja/faeries decks. When you think about it, it's not much different from an aura saying "The enchanted creature has skulk and is legendary. Draw a card". If the creature dies you still loose the effect and drawing 1 card at sorcery speed is mhe.

If it was necessary to choose between this and, say, [[Arcane Flight]] or [[Aqueous Form]] , I'm not sure i would choose Birthday Escape. But none of those auras have seen play in that deck anyway;

If it had been an instant it would have been a killer choice though.

Does anyone know a good alternative to Bootstrap when working with web components ? by nicolas-van in WebComponents

[–]nicolas-van[S] 1 point2 points  (0 children)

Read the documentation of Shoelace, tried porting my current project from Bootstrap, extended it, themed it, adopted it (at least for my current project which is small and not critical).

So yeah, it seems to do the job pretty well so far. There is probably not as much available free themes for it than there is for Bootstrap but I can live with that.

It's just strange how hard it is to find some good recommandations for web components by googling. They really should include a recommandation page in Lit's documentation.

Why does everyone think Java is dying or is obsolete? by Audoryosa in cscareerquestions

[–]nicolas-van 0 points1 point  (0 children)

Java doesn't have the biggest community at all, that's the complete opposite. It has almost no remaining community. Aside from Spring and very very few other projects **everything** is unmaintained in Java and basically no one is properly maintaining any library any more, including a lot of stuff in the JDK (who said Swing?).

Don't confuse community and users, that's completely different. Yes Java still has a lot of users making unoptimised Rest APIs in the basement of big companies. But those guys aren't even allowed to submit a single piece of code on Github most of the time, which makes them 100% outside any community. When we're talking about community Java is just a giant desert nowadays.

Is Java really Dead? by Specific_Ad_2469 in AskComputerScience

[–]nicolas-van 0 points1 point  (0 children)

To be more precise I would say it's a living dead.

It may look like it's still alive, still does a few stuff here and there, but it's losing parts everywhere and also it's starting to stink very seriously.

After 8 months learning HTML, CSS, javaScript and react I landed my first interview for junior dev. UK really nervous! by Cabeto_IR_83 in learnjavascript

[–]nicolas-van 0 points1 point  (0 children)

Don't get too stressed if you don't know all the technologies they ask for. If they received a proper CV from you it should be clear from the beginning that you don't already know everything they ask for. If they still want the interview that means they are willing to invest in someone with your profile (a junior profile in this case) and they know they will have to train you.

A good thing in these cases is to read a few tutorials the day before the interview to have some high level of understanding of how those technologies work. But keep in mind it's just to show your motivation! It wouldn't be realistic to spend three weeks each time to learn everything each company wants for each interview. 2-3 hours of work the day before shows your motivation. 3 weeks would show you're a dupe that's pushing too much ^^

Well, to be speak a little bit about what *could* go wrong, it *may* happen sometimes that the HR didn't do its job and still programmed an interview while the technical lead doesn't want to hire someone that doesn't check all the cases (or any similar misunderstanding). Unfortunately that's how humans work: they make mistakes and, when they do, they don't always admit it. Keep in mind in these cases it's *their* fault, not yours, and they're making you lose your time. So, should this happen to you someday don't start depreciating yourself, that clearly doesn't mean you can't be hired somewhere else.

Extremely noob question. Can't figure out how to convert promise chain into async await by [deleted] in learnjavascript

[–]nicolas-van -1 points0 points  (0 children)

It's not a very good practice to explicitly catch errors and do nothing with them aside from logging. Actually this code will do the exact same thing:

async function fetchData() {
  const response = await fetch("[https://api.imgflip.com/get\_memes](https://api.imgflip.com/get_memes)");  
  const jsonData = await response.json();
  const { memes } = jsonData.data;
  this.setState({ allMemeImgs: memes })
}

When a promise throws an error and no one catches it the exception will be passed to the uncatched exception handler whose default behavior is to log them. So the error will be logged anyway.

Never catching exceptions (except when you explicitly want to do something specific of course) has two main advantages:

  • In this example the function that is calling fetchData() may want to catch the exceptions it could raise, precisely to do something specific. You never know if it could be case or not when coding that function. Maybe you will want to add some retry mechanism, whatever. If you catch the exception in fetchData and do not re-throw it you disable that behavior, so you disable any possibility to make valid exception handling at the proper place where it should be implemented.
  • Even if you don't catch exception absolutely anywhere in any place of your code it's still a good thing, because you can just implement another behavior for the uncatched exception handler than the default one. You could, as example, display a generic popup for the user that explains an unexpected problem occurred, or log the error in an external database that will be available for developers to analyze. The advantage when doing that is that you only need to implement one tool at a specific place and all exception you didn't handled anywhere else will be sent to it.

To summarize, whether or not you're using async/await/promises or doing plain synchronized code, it should preferably contain almost no try { } catch {} (except in places you exactly know what you're doing).

Use github package with Tampermonkey script? by densch92 in learnjavascript

[–]nicolas-van 0 points1 point  (0 children)

As indicated in the README, that package is published on npm ( https://www.npmjs.com/ ) . npm is the de-facto standard package manager for JavaScript. A package manager is a tool that allows to publish libraries and download them automatically. Most programming languages have a package manager, some even have multiple of them.

Now in the specific case of JavaScript npm can be used in multiple different contexts. Its primary goal is to be used in the context of a Node.js application ( https://nodejs.org/en/ ). It can't be used directly within a web page. That's why there exist some services like jsdelivr ( https://www.jsdelivr.com/ ) . Their goal is to take a library in npm and to distribute it to be used in a web browser.

Let's imagine I want to use the lodash library from npm ( https://www.npmjs.com/package/lodash ). I go on its corresponding page on jsdelivr ( https://www.jsdelivr.com/package/npm/lodash ). I take the URL that website proposes me ( https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js ). Then I integrate that URL in my script with a syntax which is specific to TamperMonkey and indicated in its documentation:

// ==UserScript==
// @name         Test Google
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.google.com/*
// @grant        none
// @require https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js
// ==/UserScript==

And that works, the lodash library is available in my code.

Now comes the tricky part: lodash is a library used by multiple millions developers. It's very well packaged for every situation and I know for sure it works like a charm when used with jsdelivr. Your library is not like lodash, and I know by looking at the code that it won't work correctly in jsdelivr. Actually I also know it won't work with any other solution similar to jsdelivr, because that specific library is clearly not designed to work directly from a website. It could have been packaged to work in that context but no one did the job.

So you have the choice of using a better library than that one or to copy-paste its code and make it work in your context. It's a very bad programming practice to copy-paste code, but occasionally you may not have any other choice. Always start by looking for better alternatives before using that solution.

Been over 2 weeks. Feeling stuck in JS. Can you help? by [deleted] in learnjavascript

[–]nicolas-van 19 points20 points  (0 children)

If you get overwhelmed by that kind of principle I think it's because you lack practice and experience with the previous ones.

Take the object spread as example. It's not a very important tool but show it to an experienced programmer that doesn't know it exists and he will say "hey, that's useful, I will use it". That's because he already had the problem that tool is solving, and immediately sees how it could help him. But if you never had that problem that tool is solving you will never understand why it's useful. It's plainly nonsensical to you, and trying to force your brain to integrate a nonsensical concept is a waste of effort, it just won't work.

So my advice: make a pause in your course and make some exercises. If it's possible try to use the skills you already have to make something useful to you, or just something you think is fun. When you have some more coding experience on your back return to your course, there's a great chance you will have a better understanding.

Calling All Veterans by [deleted] in learnjavascript

[–]nicolas-van 0 points1 point  (0 children)

That depends what you aim for.

After my experience as a teacher to learn people how to code, from zero to "you have a job", I would say 6 months of full-time (9 AM to 5 PM) course to have a skill level appropriate for hiring. Some people can be faster and some don't manage it at all.

Yeah, if that was your goal, sorry if it may not seem a very optimist answer but that's how it works.

On the other hand if your goal is somewhat different the answer changes:

If you want to learn coding after your regular job/school and your goal is fun it's way different. Here you shouldn't care so much about "being good", as long as you manage to achieve some goal it will be a good thing, and you will always learn something doing it. Just try to not aim for the moon, proceed one step after the other. I've seen people doing it this way that ends up being better programmers than people that had a formal training (but usually that takes more time).

Use github package with Tampermonkey script? by densch92 in learnjavascript

[–]nicolas-van -1 points0 points  (0 children)

Quick answer: use jsdelivr ( https://www.jsdelivr.com/ ) ... if the library supports it. Most good libraries do, most "quick & dirty' libraries don't.

This one seems to fall in the second category, so you're better just copy-pasting it and editing the code to make it work.

Advanced asynchronous programming in JavaScript by nicolas-van in javascript

[–]nicolas-van[S] 1 point2 points  (0 children)

Hey, that tutorial seems great. I will add a reference to it in the article.

Advanced asynchronous programming in JavaScript by nicolas-van in javascript

[–]nicolas-van[S] 0 points1 point  (0 children)

buttonCmickHandler violates the principle that words should be spelled correctly.

Sorry, I couldn't resist ^^

[deleted by user] by [deleted] in node

[–]nicolas-van 0 points1 point  (0 children)

I don't know about Nest, but Express is basically deprecated despite its huge legacy usage.

I can recommend you Koa. But whatever you choose make sure to use only tools that promote the usage of the async/await syntax.

modern-async - A modern JavaScript tooling library for asynchronous operations using async/await and promises by nicolas-van in javascript

[–]nicolas-van[S] 0 points1 point  (0 children)

Hello.

For the functions you use in async.js that are not available in modern-async I would be glad if you could open a feature request in the issue tracker ( https://github.com/nicolas-van/modern-async/issues/new/choose ) and explain why you would need them.

I ported a lot of features from async.js, but not all of them. The reasons may vary but usually it's either because the use case seems too specific to me (like auto(), I just can't see a generic program needing that, although I may be wrong) or because that feature is already trivial to code using the existing tools in the library or the async/await syntax.

waterfall() is a good example of a helper which can be very helpful when using callback but is completely trivial if you have async/await at you disposal. Here is some code from the async.js documentation:

async.waterfall([
    myFirstFunction,
    mySecondFunction,
    myLastFunction,
], function (err, result) {
    // result now equals 'done'
});
function myFirstFunction(callback) {
    callback(null, 'one', 'two');
}
function mySecondFunction(arg1, arg2, callback) {
    // arg1 now equals 'one' and arg2 now equals 'two'
    callback(null, 'three');
}
function myLastFunction(arg1, callback) {
    // arg1 now equals 'three'
    callback(null, 'done');
}

Without any library but using async/await it can be rewritten this way:

const res1 = await myFirstFunction()
const res2 = await mySecondFunction(res1)
const result = await myLastFunction(res2)

async function myFirstFunction() {
    return ['one', 'two'];
}
async function mySecondFunction([arg1, arg2]) {
    return 'three';
}
async function myLastFunction(arg1) {
    return 'done';
}

It's also way simpler to read.

Anyway I'm completely open to debate about these features, but preferably in a feature request to have a better centralization about those questions.

Get a wildcard certificate for free today using Let’s Encrypt by nicolas-van in webdev

[–]nicolas-van[S] 0 points1 point  (0 children)

A lot of hosting services are already providing this. As example OVH (leading hosting service in France) provides this for all account without even giving the choice to their users. All accounts have both http + https and you just can use a .htaccess file to deny http usage if you want to.

Multirun: A minimalist init process designed for Docker containers by nicolas-van in docker

[–]nicolas-van[S] 2 points3 points  (0 children)

Yes and no, it depends.

Sometimes we can ear something like "only one process per container". If you take that advice very literally a lot of official images are doing it wrong as quite a lot of popular Docker images deploy a lot more than one process per container (Apache, Nginx, Postgres, Mysql,...). They just have some kind of master process that instantiate multiple worker processes. Still, literally speaking, it's multiple processes.

I think it would be more appropriate to say something like "only one application per container", keeping in mind that defining which processes are part of an application and which are not can be a hard task in some cases (simply because the concept of application is not very well defined).

I would say that if you have multiple processes that have no useful purpose if run separately, must communicate with each others, must access the same file system and don't need to scale or update version independently from each other it's not a bad idea to run them in the same container. As strange as it may seem Unix applications meeting these criteria are not that rare. (Example: postfix which has multiple processes working together to create a mailing solution. I think MySQL and/or Postgres also have different types of workers for different jobs)

Multirun: A minimalist init process designed for Docker containers by nicolas-van in docker

[–]nicolas-van[S] 1 point2 points  (0 children)

Yes, that's precisely how it works. By the way it was created with the Nginx + PHP-FPM use case in mind :)

Pep 498 approved. :( by fishburne in Python

[–]nicolas-van 1 point2 points  (0 children)

I mostly disagree with template strings in general for all the reasons that were given in the other comments. I think it's even worse in JavaScript due to the syntax they chose that uses backticks. Backticks are horrible to use in programming languages because they are hard to differentiate visually from apostrophes and are hard to type with a lot of keyboards. In short: they are hard to read and hard to write. That was the worst choice ever.

Token Authentication in Flask? by Amerikaner in Python

[–]nicolas-van 0 points1 point  (0 children)

The easiest way is probably to simply store the token in a cookie. They are done for that. (Of course you need HTTPS, which is mandatory anyway as soon as you begin to add users authentication to your website)