Quantcast
Channel: User David Z - Stack Overflow
Browsing all 48 articles
Browse latest View live
↧

Comment by David Z on Producing all groups of fixed-length combinations

(sorry I just saw this) I don't think that's legally valid; CC-BY-SA requires that any derivative works also be shared under the same license, but I can't contribute the code to more-itertools unless...

View Article


Comment by David Z on For loop in c# vs For loop in python

FWIW here is Python's integer implementation. It essentially stores a length (ob_size, a general-purpose field that's being slightly abused for integers) and a block of uint32_t of that length, whose...

View Article

Comment by David Z on How can I find repeated characters with a regex in Java?

@Eatsamulhaq I'd suggest making that its own separate question, but try searching first, someone may already have asked it.

View Article

Comment by David Z on Update Git submodule to latest commit on origin

@GabrielStaples Can I ask, why did you change the git pull command to include an explicit remote and branch? Does that make a difference in what the command does?

View Article

Comment by David Z on How to map month name to month number and vice versa?

@afshin No, it's not. That is answering a different question from the one that was asked.

View Article


Comment by David Z on Save git output to a variable

Good point, thanks @Kildareflare! I've edited accordingly.

View Article

Comment by David Z on Are PIP packages curated? Is it safe to install them?

@Andrew (1/2) The PyPI administrators will sometimes take down malicious packages when they find out about them, especially if the malicious package seems to be taking advantage of a name similarity....

View Article

Comment by David Z on Testing class methods with pytest - error - fixture...

@Jimmy I know it's been a while, but if you're still around, would you consider posting that as an answer to better help future readers of this question?

View Article


Comment by David Z on Where to place static variables (for type definition)...

@Mattwmaster58 Which version did you get errors with? I did a quick test with every version from 3.5 to 3.11 and they all worked fine for me. (Plus, in the specific case from this answer it'd be import...

View Article


Comment by David Z on Erase whole array Python

@tcglezen That's using a different definition of "work" that was not part of the question.

View Article

Comment by David Z on Sphinx: "WARNING: py:class reference target not found"...

I don't think this is the way to go. a = bar.A and a = bar.A() are both perfectly valid Python statements to include at that point in the code, with different meanings, and you shouldn't have to change...

View Article

Comment by David Z on pip install pyqt5, it cannot go on

I found this not to be the case: I was able to run the command from ninjaphysics' answer on Linux and it completed with no problems. Maybe it depends on the pip version? (Also, I don't think the...

View Article

Comment by David Z on Finding the layers and layer sizes for each Docker image

@SherwinF Alternatively, pipe it to less -S, or save it to a file and open it in a text editor, or any of various other things one can do to work with output that's too wide for the terminal (assuming...

View Article


Comment by David Z on cp command should ignore some files

It's to match the behavior of cp -r as closely as possible. Specifically, cp -r copies regular files, directories, and links (which rsync without -l does not), but does not copy over attributes like...

View Article

Answer by David Z for jq pass argument as a key to new field

As the error message suggests, put parentheses around the key:jq -r --arg k "foo" --arg v "bar" '.newField += {($k):$v}' myfilejq requires keys given by expressions (i.e. not literal strings) to be...

View Article


Answer by David Z for Why does the filepath become invalid when in reality it...

Python interprets \t in a string as an escape code for a tab character. However, \l has no such special interpretation so it gets interpreted as a backslash plus l.To fix this, I suggest using raw...

View Article

Answer by David Z for C++ error question: Expected Unqualified-id

This probably comes from the word String in the arguments to your main() function. There is no class, function, variable, etc. named String known to the compiler, so it gives an error. You'll probably...

View Article


Answer by David Z for How to change an instance variable of all instances of...

No, this is not possible, at least not directly in the way you're talking about it. Each instance has an independent set of instance variables, so there's no central place where you can set or change a...

View Article

Answer by David Z for Bash shortcut for take the variable that exists from many

The most promising thing I can think of is a loop:for f in file1 file2; do if [ -f "$f" ]; then var="$f" break fidoneYou can shorten the code by using && if you like, at the expense of...

View Article

Answer by David Z for Java color opacity

Use the Color constructor that takes a value with an alpha channel. Specifically, first you convert your color coordinates to RGB space:int rgba = Color.HSBtoRGB(H, S, B);and then add the desired...

View Article
Browsing all 48 articles
Browse latest View live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>