How to Execute a Python Script in Notepad++?

First option: (Easiest, recommended) Open Notepad++. On the menu go to: Run -> Run.. (F5). Type in: Now, instead of pressing run, press save to create a shortcut for it. Notes If you have Python 3.1: type in Python31 instead of Python26 Add -i if you want the command line window to stay open after … Read more

How to generate all permutations of a list?

There’s a function in the standard-library for this: itertools.permutations. If for some reason you want to implement it yourself or are just curious to know how it works, here’s one nice approach, taken from http://code.activestate.com/recipes/252178/: A couple of alternative approaches are listed in the documentation of itertools.permutations. Here’s one: And another, based on itertools.product:

Error in if/while (condition) {: missing Value where TRUE/FALSE needed

The evaluation of condition resulted in an NA. The if conditional must have either a TRUE or FALSE result. This can happen accidentally as the results of calculations: To test whether an object is missing use is.na(x) rather than x == NA. See also the related errors: Error in if/while (condition) { : argument is … Read more

Categories R

‘str’ object does not support item assignment

In Python, strings are immutable, so you can’t change their characters in-place. You can, however, do the following: The reasons this works is that it’s a shortcut for: The above creates a new string with each iteration, and stores the reference to that new string in s2.

1 = false and 0 = true?

It is common for comparison functions to return 0 on “equals”, so that they can also return a negative number for “less than” and a positive number for “greater than”. strcmp() and memcmp() work like this. It is, however, idiomatic for zero to be false and nonzero to be true, because this is how the … Read more

“PKIX path building failed” and “unable to find valid certification path to requested target”

Go to URL in your browser: firefox – click on HTTPS certificate chain (the lock icon right next to URL address). Click “more info” > “security” > “show certificate” > “details” > “export..”. Pickup the name and choose file type example.cer chrome – click on site icon left to address in address bar, select “Certificate” … Read more