- Completely agree with @mipsytipsy here:
I am an extremely literal person, and literally speaking, nobody can be a “full stack” engineer. The idea is a ridiculous one. There’s too much stack! But that’s not what people mean when they say it. They mean, “I’m not just a frontend or backend engineer. I span boundaries.” - Yeah, this blog is for bragging.
- What is it with fillable PDFs on some gov’t websites (I know, I know; that’s a post for a different day) — but they can be sometimes saved but not printable?
- TFW about 16 years later after your colleague writes an impassioned call to “Tear down that GIL!” (take that, Mr. Gorbachev!), the GIL is finally torn down.
- I was wondering what the Go team was smoking when they came up with the reference date concept and can I have some of that?
- What is it that causes Medium to suck so much? Is it all the useless “content creators” writing things pre-GPT that just rephrase stuff from the Internet with nary a value added (“Here’s 10 reasons to learn Python”, and here’s how to write “Hello, world” in C, did you know?)? Is it that now probably thousands more are using generative AI — kinda indistinguishable? Or is it their idiotic subscription model which cannot deal with some logins? (I should really devote time to figure out that one but why — is that platform really worth anything at all?)
python
Of course you have an API!
The following is a dramatization of actual events.
“I need access to these reports.”
“Well, here they are, in the UI.”
“But I need programmatic access.”
“We don’t have an API yet.”
“Fine, I’ll scrape this… Wait… This is Flex. Wait, let me just run Charles… Flex is talking to the back-end using AMF. So what do you mean you don’t have an API? Of course you do — it is AMF. A little PyAMF script will do the trick.”
“Please don’t show it to anyone!”
P. S. That little script was still running (in “stealth production”) months, if not years, later.
Java-to-Python converter
“Anything that can be done, could be done ‘meta'” (© Charles Simonyi) is right up there with “Laziness, impatience and hubris” (© Larry Wall) as pithy description of my development philosophy. Also, unfortunately, there’s another one: “Once it’s clear how toproceed, why bother to proceed” (or something like that). So, with that in mind…
I wanted a Python client library for GData (thankfully, they released
one last week, so this is moot — good!), so I thought of automagically converting the Java library to Python. I tried Java2Python, but it’s based on ANTLR grammar for Java 1.4, and the library, of course, is in Java 5. As I was relearning ANTLR and writing all these actions by hand (the pain!), I took a break and found
Java 1.5 parser with AST generation and visitor suport by Julio Gesser (no relation,
I presume?) and Sreenivasa Viswanadha, based on JavaCC. Aha! Much easier… But then, of course, Google releases the Python version of the library I needed in the first place, so I don’t bother wrapping this project up… Here it is for whoever wants it: http://code.google.com/p/j2p/.
py-cover task is now in the main pyAntTasks project
The py-cover
task is now integrated into the project tree.
Continuous integration with code coverage in Python
Update
This code has been integrated into the main tree.
I decided it would be good to have a coverage report of our Python code,
with nice visualization like Clover.
So I took Ron Smith’s PyAntTasks, and added py-cover
task to them. This will run coverage for every test, and a cumulative one. In other words, you can see what code a particular test exercises, and what code all the tests in your tree exercise.
This also modifies py-test
task to include packagedtests
attribute – see below.
The newly added py-cover
task runs Ned Batchelder’s coverage.py (download it separately), and is specified as follows in your build.xml
:
Here, is a FileSet specifying tests to run, is a FileSet
specifying source code to cover.
The attributes are:
reportsDir
– where the coverage reports gopackagedtests
– this idiosyncrasy is prompted by our tree setup. If this attribute istrue
it means that the test files reside in Python packages,false
otherwise. (In our case, they do not; they are in the tree but are not packages. Note that the originalpy-test
task assumed they are in packages, I have changed this too).coverage
– path tocoverage.py
on your system (which you downloaded separately, right?)
P.S. I know about the colorize.py thingie, but I rolled my own (uglier, of course) for this one.
It’s Friday…
- (*) to .
- FP!
- The endsingularity is near.
Hear, hear!
IFOWONGO!!!. - No kidding… I’ve been wondering about this myself:
> where can I find the correct capitalization for the xmlrpcfilter setting ? - Really, Sherlock? It looks like
xmlrpc_filter
from where I’m sitting (CherryPy 2.2.1). How many different misleading combinations of capitalizations and underscore placements can you find in online “docs”? This is one of those really annoying things about this stuff… (And don’t tell me to RTFC, though that’s the only thing that resolved it for me…) - Most excellent all things GWT resource
- Sorokin ported to Java
- What’s up with the snide attitudes? This is
not even worth commenting, so I won’t… But a propos: what is wrong with “want[ing] everything done through [the] IDE“? This desire could be due to “Laziness, Impatience and Hubris“. Computers are good at repetitive tasks and I hate wasting keystrokes… - A propos of nothing (I think this is my motto), it’s so nice that
com.google.gwt.user.client.ui.MouseListener extends java.util.EventListener
, having nothing to do withcom.google.gwt.user.client.ui.EventListener
… Not!
Evaluating expressions in PyDev (Eclipse plug-in for Python)
I use PyDev because, probably like many, I am used to Eclipse for Java development. What I found useful is highlighting a snippet (expression) in a debug session and doing Ctrl+Shift+D to evaluate it, and I miss this in PyDev. A crude workaround is to add this expression to Watch list, but that grows the Watch list and is not convenient: I not only have to do right-click Watch and then look in the Watch list, but also may need to scroll that list, and remove things, etc. That’s not what I am used to. So I threw together a crude implementation of it.
The change is in the org.python.pydev.debug
project:
- Added
EvalExpressionAction
class toorg.python.pydev.debug.ui.actions
package. - Changed the
plugin.xml
- The
MANIFEST.MF
thus includes two additional bundles inRequire-Bundle:
field:org.eclipse.core.expressions
andorg.eclipse.jdt.debug.ui
. (Well, the second one is only for the second keystroke – “persisting” the value in the Display view, and only because I was lazy at this point. But also, since this thing relies on otherorg.eclipse.jdt
stuff, I figured it’s not a big deal).Another problem here is that I couldn’t figure out how to do Ctrl+Shift+D the second time for persisting; so Ctrl+Shift+D works to display in a popup, and Ctrl+Shift+S does the persisting. (The choice of “S” is since when I press Ctrl+Shift+D my index finger is on D and so it’s easy and fast to use the middle finger to press S immediately :). But that still is close to what I am used to blindly press. People get used to all sorts of weird keystrokes and go out of their way to reproduce them in their new environment, just witness viPlugin for Eclipse.
Of course, as I went to announce this on the list, I saw that PyDev already has a slightly different mechanism for that. O well, at least this way still saves me some keystrokes and I learned that the Console view is also a Python shell. (That’s cause I never RTFM)… But at least I was not the only one…
So anyway, this seems to work in my environment; just unzip into the Eclipse folder – and do so at your own risk…