Apr
30
comment parsing .properties file in Python
This is a nice quick solution, but note that a Java properties file could use features that could break a ConfigParser, e.g., ! as comment or \ (backslash) for line continuation and escapes (among others). More details of such features can be found here: docs.oracle.com/javase/7/docs/api/java/util/Properties.html.
Apr
26
comment Is there a 'contiguous' option for the magic wand in Gimp?
Unfortunately, I think neither can be restricted to select only contiguous areas (unlike the "Foreground Select Tool").
Apr
26
awarded Nice Answer
Apr
24
awarded Yearling
Apr
24
awarded Yearling
Apr
17
awarded Supporter
Apr
2
comment Remove key from dictionary in Python returning new dictionary
dict((i,d[i]) for i in d if i!='c') -- Brownie points for you for not creating another intermediate list/tuple :)
Apr
2
comment python mock Requests and the response
And in Python 2.x, just replace from unittest import mock with import mock and the rest works as is. You do need to install the mock package separately.
Mar
30
comment Creating a simple XML file using python
If the name of the tag doesn't conform to the Python identifier rules, then you could use getattr, e.g., getattr(E, "some-tag").
Mar
20
comment Getting HADOOP_HOME not found when running spark application in yarn cluster mode
I too have the same issue and can't find a solution. Like you, I added HADOOP_HOME to the spark-env.sh and verified that it is being sourced at the time of running SparkLauncher, but the containers don't see this value and log the error. I tried setting hadoop.home.dir as a system property using the -D option in SPAR_SUBMIT_OPTS and that too doesn't get passed to the submitted job, so the containers don't see it.
Feb
25
comment Showing the stack trace from a running Python application
@Peque oh yes, didn't think of that possibility :)
Feb
24
answered list google drive files with curl
Feb
22
answered How does IPython's magic %paste work?
Feb
17
comment How to evaluate a spreadsheet formula within a custom function?
The cell shows the value, but if you edit it you see the formula, so it behaves exactly like a regular formula cell. I worked around by copying the cells to themselves (source and destination same range) using Range.copyTo with {contentsOnly:true} option. I found the solution in one of the other SO threads, not sure which so don't have a link handy now.
Feb
15
comment How do you replace a formula with its result?
This is not an answer to OP's question.
Feb
15
comment How do you replace a formula with its result?
Strange... it didn't work at first, but it is working fine now.
Feb
15
comment How do you replace a formula with its result?
I can't get this to work. I first set formulas and it worked fine. Then I tried the above technique to replace them with their values, but I ended up with blank cells. I also tried to copy them to the next row, but I still ended up with blank cells while the source cells were left with the formulas (as expected). What could I be doing wrong?
Feb
15
comment How to evaluate a spreadsheet formula within a custom function?
Actually, I was too quick to conclude... but the above doesn't evaluate the function and set its value, but rather sets the formula itself... not what I was looking for :(
Feb
15
comment How to evaluate a spreadsheet formula within a custom function?
Exactly what I was looking for, thanks a lot!
Feb
6
comment What are the dark corners of Vim your mom never told you about?
I have used macros for over 20 years and never knew this time saving festure. I wonder if it is supported in the original SysV version itself or an extension of Vim.
1 2 3 4 5