How do I merge dictionaries together in Python?

You can use the .update() method if you don’t need the original d2 any more: Update the dictionary with the key/value pairs from other, overwriting existing keys. Return None. E.g.: Update: Of course you can copy the dictionary first in order to create a new merged one. This might or might not be necessary. In … Read more

How to fix “SSL certificate problem: self signed certificate in certificate chain” error?

Probably you don’t have correct CA certificates available in the container, so TLS connections can’t be verified. Try to install ca-certificates package (package may have a different name, it depends on the used distribution). UPDATE: Your company inspects TLS connections in the corporate network, so original certificates are replaced by your company certificates. You need … Read more

Node.js getaddrinfo ENOTFOUND

In Node.js HTTP module’s documentation: http://nodejs.org/api/http.html#http_http_request_options_callback You can either call http.get(‘http://eternagame.wikia.com/wiki/EteRNA_Dictionary’, callback), the URL is then parsed with url.parse(); or call http.get(options, callback), where options is Update As stated in the comment by @EnchanterIO, the port field is also a separate option; and the protocol http:// shouldn’t be included in the host field. Other answers … Read more

What does if __name__ == “__main__”: do?

Short Answer It’s boilerplate code that protects users from accidentally invoking the script when they didn’t intend to. Here are some common problems when the guard is omitted from a script: If you import the guardless script in another script (e.g. import my_script_without_a_name_eq_main_guard), then the second script will trigger the first to run at import … Read more

Set NA to 0 in R

You can just use the output of is.na to replace directly with subsetting: Or with a reproducible example: However, be careful using this method on a data frame containing factors that also have missing values: It “works”: …but you likely will want to specifically alter only the numeric columns in this case, rather than the … Read more

Categories R

Chrome returns “Bad Request – Request Too Long” when navigating to local IIS Express

I get this all the time ONLY in Chrome and I have to clear browsing data to fix it. Wrench > Tools > Clear Browsing Data Check the following: Clear browsing history Clear download history Empty the cache Delete cookies and other site data Then click “Clear Browsing Data” button and refresh your page. UPDATE:I … Read more

ImportError: No module named matplotlib.pyplot

You have two pythons installed on your machine, one is the standard python that comes with Mac OSX and the second is the one you installed with ports (this is the one that has matplotlib installed in its library, the one that comes with macosx does not). Is the standard mac python and since it … Read more

Can I force a page break in HTML printing?

Add a CSS class called “pagebreak” (or “pb”), like so: Then add an empty DIV tag (or any block element that generates a box) where you want the page break. It won’t show up on the page, but will break up the page when printing. P.S. Perhaps this only applies when using -after (and also … Read more