foreach vs someList.ForEach(){}

There are apparently many ways to iterate over a collection. Curious if there are any differences, or why you’d use one way over the other. First type: Other Way: I suppose off the top of my head, that instead of the anonymous delegate I use above, you’d have a reusable delegate you could specify…

How to iterate over a JavaScript object?

For most objects, use for .. in : With ES6, if you need both keys and values simultaneously, do To avoid logging inherited properties, check with hasOwnProperty : You don’t need to check hasOwnProperty when iterating on keys if you’re using a simple object (for example one you made yourself with {}). This MDN documentation explains more generally how to deal with objects … Read more

Good input validation loop using cin – C++

I’m not a huge fan of turning on exceptions for iostreams. I/O errors aren’t exceptional enough, in that errors are often very likely. I prefer only to use exceptions for less frequent error conditions. The code isn’t bad, but skipping 80 characters is a bit arbitrary, and the error variable isn’t necessary if you fiddle … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)