Quantcast
Channel: User Mark - Stack Overflow
Browsing all 43 articles
Browse latest View live

Comment by Mark on How do I require one field or another or (one of two...

@Tomeamis "not required" means "may or may not be present", while "inclusion forbidden" means "must not be present", that's not the same

View Article


Comment by Mark on How does Go compile so quickly?

"the optimizer works on the assembly code" Assembly code sounds platform dependent, do they really have a separate optimizer for each supported platform?

View Article

Comment by Mark on Django call_command no-initial-data option

@pymen Good to know it's deprecated, thanks. I don't see the danger of using initial_data though if you're flushing the database anyway.

View Article

Comment by Mark on Java Array HashCode implementation

@Torque It only doesn't hurt if equals() is crappy in the same way. Normally a hashCode that is 'basically random' would be a serious problem, because if equals is true then hashCode must be same. A...

View Article

Comment by Mark on How to have one colorbar for all subplots

@gboffi Oh that's good to know, it seems to be experimental for now and didn't exist back in 2016, but seems like a good improvement.

View Article


Comment by Mark on best way to preserve numpy arrays on disk

@argentum2f Fortran unformatted, a binary format used by Fortran with decades of history but I think not a lot of users today. See the repo for more details.

View Article

Comment by Mark on How can I overcome "datetime.datetime not JSON serializable"?

@SmitJohnth I'm glad you ask, because this is why I made json-tricks: github.com/mverleg/pyjson_tricks

View Article

Comment by Mark on Let's Encrypt kubernetes Ingress Controller issuing Fake...

This is useful advice for others, but from the screenshot in the question it doesn't look like the OP has a staging certificate. It'll show organization as (STAGING) Let's Encrypt if it is.

View Article


Comment by Mark on cert-manager: no configured challenge solvers can be used...

* was the problem for me too, according to an article I found, wildcards are only possible with dns challenge instead of http (and only cover one dot-level).

View Article


Comment by Mark on nginx : rewrite rule to remove /index.html from the...

^(.*)/index\.html$ for the (very unlikely) case you have index/html or index2html or something

View Article

Comment by Mark on How can I get the return value of a function passed to...

@EricH. Alternative solutions are valid answer on stackoverflow. The fact that Pool is easier doesn't make it bad, rather it might be considered an advantage to many users.

View Article

Comment by Mark on How do I sort a map by order of insertion?

Extra context: the slower lookups are still O(1) average, but worse memory locality.

View Article

Comment by Mark on systemd apparently not finding .service file

@PierredeLESPINAY As of v248 it's still in the manual, but if you find the cause / workaround please edit it into the answer!

View Article


Measure which Java code is taking long to compile

There is a large Java project that takes long to compile, both through Maven and through IntelliJ IDEA.I want to try to improve that, but you know what they say about optimization without measurement,...

View Article

Answer by Mark for How can I escape LaTeX special characters inside django...

Alex's answer including suggestions in code, if you want to copy-paste:import redef tex_escape(text):""" :param text: a plain text message :return: the message escaped to appear correctly in LaTeX"""...

View Article


Gzip output different after Python restart

I'm trying to gzip a numpy array in Python 3.6.8.If I run this snippet twice (different interpreter sessions), I get different output:import gzipimport numpyimport base64data = numpy.array([[1.0, 2.0,...

View Article

Answer by Mark for What is the most efficient way to split a list evenly in half

This works and seems like a simple way:def splitList(array): n = len(array) half = int(n/2) # py3 return array[:half], array[n-half:]

View Article


Delete field from standard Django model

NOTE: this was asked before AbstractUser existed, which is probably what you'd want to use these days.Basically I would like to delete the default email field from the default Django User class...class...

View Article

Answer by Mark for Etags used in RESTful APIs are still susceptible to race...

You are right that you can still get race conditions if the 'check last etag' and 'make the change' aren't in one atomic operation.In essence, if your server itself has a race condition, sending etags...

View Article

Image may be NSFW.
Clik here to view.

Answer by Mark for Finding unused methods in IntelliJ (excluding tests)

This feature works only for batch inspection and disabled in the editor.¹According to the JetBrains IntelliJ IDEA 2016.3 EAP Makes Unused Code Detection More Flexible blog, it's now possible.You can...

View Article
Browsing all 43 articles
Browse latest View live