Escaping dot in if-statement with echo in Windows batch

I have a chicken-and-egg issue: I need to echo a dot in an if statement in a batch script, but the command prompt crashes, saying ‘. was unexpected at this time.’ Note that echoing treats everything as literal, but the if statement interprets it as incorrect due to the dot being a special character. Adding… Read More Escaping dot in if-statement with echo in Windows batch

Why does the literal string """"""" (seven quotes) give an error?

Processing clients input we often use the strip() method. If we wanna remove starting-ending symbols from some specific set we just place all it in the parameter. The code ".yes’ ".strip(". ‘") obviously gives ‘yes’ string as a result. When I try to remove set ‘ ". The result depends from this symbols order. Variant… Read More Why does the literal string """"""" (seven quotes) give an error?

Python type hints: How to use Literal with strings to conform with mypy?

I want to restrict the possible input arguments by using typing.Literal. The following code works just fine, however, mypy is complaining. from typing import Literal def literal_func(string_input: Literal["best", "worst"]) -> int: if string_input == "best": return 1 elif string_input == "worst": return 0 literal_func(string_input="best") # works just fine with mypy # The following call leads… Read More Python type hints: How to use Literal with strings to conform with mypy?

TS2322: Type 'string' is not assignable to type '"union" | "of" | "strings"'

TypeScript is complaining TS2322: Type ‘{ clientSecret: string; loader: string; }’ is not assignable to type ‘StripeElementsOptions’.    Types of property ‘loader’ are incompatible.      Type ‘string’ is not assignable to type ‘"always" | "auto" | "never"’. Where the object is defined as const options = { clientSecret: paymentIntent.clientSecret, loader: "always", } The error goes… Read More TS2322: Type 'string' is not assignable to type '"union" | "of" | "strings"'

How to insert name filed in the query, but to the table to pass the corresponding id of that name

I have 2 tables: genres_table: bands_table: genre_id | genre_name band_id | genre_id | band_name 1 | Rock 1 | 8 | Blink 182 3 | Jazz 3 | 1 | Foo Fighters 8 | Punk 4 | 1 | RHCP Genre_id is a foreign key in bands_table taken from genre_id in genres_table. I would like… Read More How to insert name filed in the query, but to the table to pass the corresponding id of that name

Change color of gradient based on user selection

I am trying to change the color of a gradient depending on user selection, I have everything working but I just don’t know how to change the gradient using the format I have. (change.style.background = "linear-gradient(90deg, color1, red)";). const len = document.querySelectorAll(“input”).length; let change = document.querySelector(“.body”); for (let x = 0; x < len; x++)… Read More Change color of gradient based on user selection

Concatenation with variable in function gives an error

So I am trying to run this function. CREATE OR REPLACE FUNCTION TableIteration() RETURNS TABLE(table_schema text, table_name text) LANGUAGE plpgsql AS $$ DECLARE tgt_schema varchar; list text[] := ARRAY[ "text1", "text2", "text3", "text4", "text5", "text6", "text7", "text8", "text9" ]; BEGIN FOREACH tgt_schema IN ARRAY list LOOP RETURN QUERY EXECUTE ‘SELECT t.table_schema :: text, t.table_name::text from… Read More Concatenation with variable in function gives an error

What kinds of expressions are allowed in a `#if` (the conditional inclusion preprocesssor directives)

Many sources online (for example, https://en.cppreference.com/w/cpp/preprocessor/conditional#Condition_evaluation) say that the expression need only be an integer constant expression. The following are all integral constant expressions without any identifiers in them: #include <compare> #if (1 <=> 2) > 0 #error 1 > 2 #endif #if (([]{}()), 0) #error 0 #endif #if 1.2 < 0.0 #error 1.2 <… Read More What kinds of expressions are allowed in a `#if` (the conditional inclusion preprocesssor directives)