After working with horrible php but the awesome xdebug+geben for emacs, I finally found an equivalent for python: winpdb and rpdb2.
In your code all you need is
import rpdb2; rpdb2.start_embedded_debugger('asdf',fAllowRemote=True)
where 'asdf' is just some password you come up with so that other users can't start debugging on your code.
Then start winpdb, navigate to file->attach, enter the password you chose, point it at your host and then debug away.
Great!
Wednesday, August 7, 2013
Tuesday, August 6, 2013
White text on black background or black text on white background?
Need to try changing terminals etc to white text on black background and see how it works out...
http://www.transio.com/content/why-you-shouldnt-use-white-text-black-background
http://uxmovement.com/content/when-to-use-white-text-on-a-dark-background/
http://www.transio.com/content/why-you-shouldnt-use-white-text-black-background
http://uxmovement.com/content/when-to-use-white-text-on-a-dark-background/
Wednesday, June 26, 2013
How to get better at software stuff in less than one yesterday..
Some guy's stuff on what he wishes he learned (TODO: Paraphrase here.. or copy and paste in case it goes away..)
Formal education plan
How to get better at anything in 10,000 hours
Formal education plan
How to get better at anything in 10,000 hours
Tuesday, June 25, 2013
Why use Python Properties?
The reasoning is here, but in short "...[t]he answer is, that in [a simple] use case we would not. In fact, we would
write thus:
'But!', I can hear you scream, 'there's no encapsulation!'. What will we do if we need to control access to x, make it read-only or do something else to it? Won't we have to refactor everything to the getters and setters that we avoided?
No - we just switch to the property version, add whatever we want, and have not changed the interface one iota! The great thing about properties is not that they replace getters and setters, its that you don't have to write them to future-proof your code. You can start out by writing the simplest implementation imaginable, and if you later need to change the implementation you can still do so without changing the interface. Neat, huh?"
>>> class MyClass(object): ... x = 0 ... >>> my = MyClass() >>> my.x = 4 >>> my.x 4
'But!', I can hear you scream, 'there's no encapsulation!'. What will we do if we need to control access to x, make it read-only or do something else to it? Won't we have to refactor everything to the getters and setters that we avoided?
No - we just switch to the property version, add whatever we want, and have not changed the interface one iota! The great thing about properties is not that they replace getters and setters, its that you don't have to write them to future-proof your code. You can start out by writing the simplest implementation imaginable, and if you later need to change the implementation you can still do so without changing the interface. Neat, huh?"
Wednesday, May 29, 2013
Python2's urllib2 is a miserable libary
Python2's urllib2 is a miserable piece of shit of a library. Use requests instead.
Labels:
python,
requests,
rumbling-ramblings,
urllib2
Friday, May 10, 2013
Install firefox 20 addons offline (via the command line)
So much misinformation out there, that it took a while to figure this out. And seeing that the documentation for mozilla firefox is an out-of-date mess, this will probably be out of date in a few versions as well.
Currently the only way I've gotten an add-on to install automatically is as follows:
Currently the only way I've gotten an add-on to install automatically is as follows:
- Download the add-on. You can simply go to the page for the add-on at https://addons.mozilla.org/en-US/firefox/ and right click on the 'Add to Firefox' button and select 'Save Link As...'
- Get the application id of the add-on and rename the .xpi file you downloaded to
.xpi. Typically the id is a uuid like {D4DD63FA-01E4-46a7-B6B1-EDAB7D6AD389}, but sometimes it's a string such as an email address or webaddress. NOTE that if you have an id of {ec8030f7-c20a-464f-9b0e-13a3a9e97384}, you have the WRONG id. That is the id for the firefox application itself (this value might change with different versions of firefox). - Move the renamed xpi file to either your local mozilla profile directory at ~/.mozilla/firefox/
-profile_id-/extensions/ or to the global directory at /usr/lib/firefox-addons/extensions/. The -profile_id- can be found in ~/.mozilla/firefox/profiles.ini. You'll have to find the correct Profile section and then the 'Path' for that profile (usually there's just one profile section, Profile0 with 'Name' = default). - Restart firefox. You'll be prompted to install the add-ons you've added to the extensions directory once firefox starts up.
Monday, April 29, 2013
Using the multi command in zookeeper to store objects larger than 1MB
Quoting the third answer to the questions asked here.
The idea would be that you would upload multiple pieces of the large object separately into different znodes (without using multi)
Then you would update a pointer node that has references to the pieces while controlling for the version of the pieces (using a multi).
Subscribe to:
Posts (Atom)