Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Search
You can use existsSync: import { existsSync } from 'node:fs'; if (existsSync('/path/to/file')) { console.log('Found'); } else { console.log('Not found'); } If you want to avoid block...
How to check in Node.js if a file exists?
Is there a standard way to add an IDistributedCached in front of a database using EntityFramework? Something that handles checking the cache for reads, updating the cache on writes, and uses distri...
As mentioned in another answer, when you have code such as if (someVar), you're subject to truthiness. To be more precise, this code will run under the rules of Boolean coercion. In JavaScript, wh...
r~~'s answer is good, and I absolutely agree that the condition provided in the question is ridiculous and I've never seen anyone suggest it as a generic replacement for if(var). But I think the ac...
if(typeof(var) !== 'undefined' || typeof(var) !== null || var !== ''){}else{} is a wild thing to write for anything other than a variable that takes either undefined, null, or a string as possib...
I am fairly certain this isn't a duplicate so please bear with me. I check for boolean true||false using if() as a matter of course in my programming. I've programmed extensively in PHP, some in C...
This is long, I apologize, but I hope someone finds my treatise valuable.[1] StackExchange, while a great improvement is not the end all be all of QA... (and not just because they recently announc...
I'm trying to write a Node module that extends the functionality of another module (a peer dependency which I do not control) using a register function exposed by the other module. This adds additi...
I'd propose (and have generally used, back when I worked on C projects) a fourth option that I don't think gets too far out of line. If I understand the situation correctly, that you want to test ...
There are many reasons why this error may occur. In my case, my new token had the read_registry scope but not the write_registry scope. I created a new token that had the read_registry and write_...
Recently I had to push a new Docker image to our GitLab registry. I have the Maintainer role on that project. I had created a new token and used it to log in to Docker. However, when trying ...
If your Python Interpreter is choosen inside of Vscode, you can normally find it on the bottom right of your screen. This is the same Interpreter that the Terminal inside VSCode is using. When yo...
"Black box testing" makes sense when dealing with opaque types so that's the first thing you should be doing and probably the most meaningful test too, so that's where you should put most of yo...
First: What is an opaque pointer in C? Now when it comes to testing such a type, I know of 3 ways: Include the source file (the one containing the definition of the type and the functions tha...
It's been a while, but the answer is "yes and no," I believe. No: The describe-schema command doesn't (last I heard) allow any modification. Yes: The describe-schema command also doesn't do any...
There are RSS feeds for tags already, linked at the bottom of the tag page. (Yeah, I missed it too; I'll see if we can make that more obvious.) For example, here's the RSS feed for the feature-re...
For example, how to sort the output below by the values in "Column" in the psql shell itself? my_db=> \d auth_user Table "public.auth_user" Column ...
You can use imagemagick. Suppose you have the files a.gif and b.gif and want to play a and then b. Then use the command: convert a.gif b.gif out.gif And your results will be written to out.gif....
How do I concatenate two animated gifs together? The gifs are identical in dimensions and I would like to stitch them together so they play one after the other.
To start with, it's worth noting that the Zen of Python is more about development of Python, rather than development with Python. That may mean that some bits of its wisdom are more applicable to q...
The first line of a file is head -1. But you probably also want the file name. So something like: for file in glob do first_line="$(head -1 "$file")" printf "%s: %s\n" "$file" "$first_l...
How can i get a per-tag RSS feed? I only see the general feed at the main pages and i don't want to subscribe to tags via email.
My use case is a collection of CSV files, each with header row. What I want to know is what subset(s) of them are "union compatible", although I also want matching column names before stacking thes...
The existing answer is fine, but you can achieve similar results in many ways using some of TypeScript's utility types. Required<T> While you cannot use (only) Partial to do this, TypeScrip...