Categories
Mastering Development

Is there a way to execute strings in a for loop?

I’ve created an array that holds all possible html tag which when run would navigate to the target string or nothing. group = [‘div’,’span’,’a’,’link’,’dl’,’dt’,’dd’,’b’,’p’,’meta’,”] comb = [] for g1 in group: if g1 != ”: for g2 in group: if g2 != ”: for g3 in group: if g3 != ”: res = “tag.”+g1+”.”+g2+”.”+g3+”.string” comb.append(res) […]

Categories
Mastering Development

Sort a list by its respective value in a separate dictionary?

Say I have a dictionary and some of the keys are values in a separate array, how do I sort the values in my array by the values for their respective keys in the dictionary? For example: input: dict = {‘a’: 4, ‘b’: 7, ‘c’: 10, ‘d’: 1} array = [a, b, d] output: array […]

Categories
Mastering Development Software

When to use known languages/libraries vs. investing in learning new ones?

This question is asked in a general way. In case it is hard to understand, I have added a concrete example below. I am interested in the answer to the general question. I have a lot of experience writing programs of type X, but now I need to write a program of type Y. Everybody […]

Categories
Mastering Development

Efficiently aggregate results into a Python Data Structure

I often find myself looping over some long INPUT list (or dataframe, or dictionary). Per iteration I do some calculations on the input data, I then push the results into some OUTPUT data structure. Often the final output is a dataframe (since it is convenient to deal with). Below are two methods that loop over […]

Categories
Mastering Development Software

In a tree, what’s a good term for predicate “ancestor of or identical to”?

In a tree structure, what’s a good term for the predicate f(x, y) defined in human language as “x is an ancestor of or identical to y”? The phrase “ancestor of or identical to” is so wordy. Example Given the tree: A / \ B E / \ C D Then f(x, C) is satisfied […]

Categories
Linux Mastering Development

Unix SORT not respecting its memory limit

I am facing an issue regarding sort being killed due over usage of memory and can not understand why it surpasses the given limit by a significant margin. Context: Available physical RAM: 8GB Memory in use by system: <500MB (FreeBSD 13) Free memory: ~7.5GB Swap: 2G No system hard limit on mem usage ($ ulimit […]

Categories
Mastering Development

how to stop rerendering in react on checkbox check?

I have simple list which is dynamically added on add button click. in my list there is a checkbox is also present .so I have an issue when I toggle the checkbox my whole list is re render why ? let take example I added A,B,C,D in my list when I toggle D checkbox it […]

Categories
Ask Mathematics

what is this question asking for? basic metric concepts

I am studying basic concepts of metrics. and I ve been practicing axioms of metrics to prove some functions can be metrics or not. then this question showed up and I do not understand what am I being asked for. how is related to axioms of metric? am i supposed to find a function? $X=\{a,b,c\}$ […]

Categories
Ask Mathematics

Bound the value of function by integration of derivatives

Given $f(x,y) \in C^2([0,1]^2)$ (by which I mean $C^2$ in some open neighborhood), with $f_x, f_y, f_{xy} \in L^1([0,1]^2, dxdy)$ (which is sure case since they are continuous), does the following hold? $$ \sup |f| \le \iint |f|+|f_x|+|f_y|+|f_{xy}|\, dxdy $$ I think it is safe to discretise this function under the assumptions, divide $f$ into […]

Categories
Ask Mathematics

Is bounded squares on line problem $\mathsf{NP}$-hard?

I know given $a,b,c\in\mathbb Z$ then is there $x,y\in\mathbb N$ with $$ax^2+by+c=0$$ is $\mathsf{NP}$-hard. However if $y\in\mathbb Z$, factorization of $b$ is known and $a=1$ then does the problem remain $\mathsf{NP}$ hard if $|y|<T$ holds (inputs are $b$, prime factors of $b$, $c$ and $T$)? Does it make a difference if factorization of $b$ is […]