Determine font color based on background color

Given a system (a website for instance) that lets a user customize the background color for some section but not the font color (to keep number of options to a minimum), is there a way to...

PHP-friendly NoSQL solutions

I'm looking to use a NoSQL solution for my next project, which will be written in PHP. What choices do I have in terms of NoSQL solutions that can easily interfaced via PHP? I haven't done much...

Using Gradle to build a jar with dependencies

I have a multiproject build and I put a task to build a fat jar in one of the subprojects. I created the task similar to the one described in the cookbook. jar { from...

Replace string with wildcard in a .txt file with Python

I'm still new to scripting and am not sure the best method to accomplish what I am trying to do. This will be the first python script I am trying to write. Please note, I am using Python2.7 for...

Implement an Observer pattern in Dart

I would like to implement an observer pattern in Dart but I'm not sure how to go about it. Let's say I have a class: class MyClass { String observed_field; } Now, whenever I change the...

Permission Denied Error when downloading a file

I am trying to download an excel zip file into a R Project folder that I have started. I'm new to R so I'm a little puzzled at the error message that I'm receiving. The file is an excel file and...

SQL Server - ALTER TABLE ALTER COLUMN giving SET option error

I am trying to change datatype of a column in SQL Server from INT to BIGINT. ALTER TABLE Table1 ALTER COLUMN ID BIGINT However, it is giving me below error: ALTER TABLE failed because the...

Firebase Auth ID token has incorrect "aud" claim

I'm trying to verify an idToken backend. The user has successfully logged in to firebase client side but when I try to verify the idToken on my backend I get this not very helpful error...

Configure ngrok's CORS headers

I am running a local webserver, which runs an XHR request to an ngrok server, also run from my PC. I'm getting XMLHttpRequest cannot load http://foo.ngrok.io/. No 'Access-Control-Allow-Origin'...

Why interfaces for message contracts are strongly recommended in MassTransit?

MassTransit states that we should use interfaces for message contracts : It is strongly suggested to use interfaces for message contracts, based on experience over several years with varying...

Compute a confidence interval from sample data assuming unknown distribution

I have sample data which I would like to compute a confidence interval for, assuming a distribution is not normal and is unknown. Basically, it looks like distribution is Pareto but I don't know...

How to make sure the query run with read-only action on MySQL/PostgreSQL database?

Precondition: The database is running at somewhere without of my control, but I have the authorization account to connect the database. I need to make sure all queries running through my...

Unit Testing with Moq sometimes fails on ToListAsync()

I'm fairly new to testing with moq and I'm having a strange issue (at least it seems strange to me), but I'm probably just not setting up the mock object correctly. I have a repository layer that...

Qt open dialog from main window

So I'm a newbie to Qt and I'm trying to create a simple project. I've got a MainWindow with some buttons and stuff that I created using the Qt Designer, and once I click one of these buttons (it's...

Allow Athena query to S3 bucket

I have this bucket policy and it works correctly. The only problem is that it does not allow athena query. How do I modify this to all athena? { "Version": "2008-10-17", "Statement": [ ...

How to ensure that page has finished loading on a React site

Is there a way to make sure that a web page, coded in React, has finished loading? The usual javascript tricks, don't seem to work for React, meaning that you cannot use safely...

SonarQube rule: "Using command line arguments is security-sensitive" in Spring Boot application

SonarQube is just showing a Critical security issue in the very basic Spring Boot application. In the main method. @SpringBootApplication public class Application { public static void...

Extract Acrobat Document Object from a table in .docx file in Python

I have a .docx file with a table in it. There are cells which contain an embedded Acrobat Document Object. I'm using python-docx module to read and extract data from the .docx file, but it doesn't...

Checking if v is a leaf in MST

I have this question: Given undirected graph G = (V,E), V ∋ v and non-negative weights W find if there is a minimum spanning tree (MST) where v is a leaf and if there is, return it. I thought...

How to find the cause of the Warning: Each child in a list should have a unique "key" prop

I often run into the error Warning: Each child in a list should have a unique "key" prop. Check the render method of `MyComponent`. in React. The error message always tells you the offending...

SonarQube Regex vulnerability issue in JavaScript

Wherever i use Regex in JavaScript code, SonarQube shows vulnerability issue. Is there any alternate for Regex in JavaScript? Error : Make sure that using a regular expression is safe here. Sample...

Python - modifying variable passed to function

If I have a function f(x) and variable var of any type and scope is there any way to modify var inside call to f(var)? Meaning that function f does some magic stuff to get reference to original...

How to rewrite URLs from UPPERCASE to lowercase in .htaccess

I'm trying to assemble a regular expression to rewrite a URL containing uppercase characters to the same URL but in all lowercase. Example: example.com/foO-BAR-bAz rewrite to...

How can I select multiple files in a CLI interface (PowerShell)

I am trying to batch convert some gif files to animated png files, however, my question is quite clear. How can I input multiple files in a directory to a CLI terminal (I'm using PowerShell)? I am...

Can't run docker on windows 10 - Ports are not available

I'm trying to run a docker image on my windows 10 pro workstation and I'm getting this error: docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind: An attempt...

Pug doesn't show local image

i have a problem rendering images with pug this my app structure app /mail /assets /img /logo.png /templates mailTemplate.pug and here's the static route in my...

React Microfronends: How do I pass authentication and other information from one Front end app to another Front end app?

I am working on a system that consists of different backend microservices and a few inter-linked micro-frontend apps (all of them built with ReactJS). Below is my use case (for brevity, I'm just...

TypeError: __init__() got an unexpected keyword argument 'service' error using Python Selenium ChromeDriver with company pac file

I've been struggling with this problem for sometime, but now I'm coming back around to it. I'm attempting to use selenium to scrape data from a URL behind a company proxy using a pac file. I'm...

What problems cause Visual Studio to say "Source information is missing from the debug information for this module"?

I'm working on a compiler for the CLR, and I mostly have it working. I'm trying to generate debug information, and I can get it to create an embedded PDB in the generated assembly where all the...

How to force the C++ compiler to warn when a specific std class function is called?

I'm trying to use UTF-8 std::string and std::filesystem::path in a fool-proof way on Windows 10+ where Beta: Use Unicode UTF-8 for worldwide language support is likely off. C++17 or above. To go...