Started playing with the tornado library released by facebook recently and it seems you cannot run tornado on windows. The framework seems to use fcntl which only works on Unix platforms.
Friday, September 11, 2009
Thursday, September 11, 2008
Saturday, September 06, 2008
Sunday, May 11, 2008
Python and Unicode
The most important slide for me says:
s.decode(encoding)
* <type 'str'> to <type 'unicode'>
u.encode(encoding)
* <type 'unicode'> to <type 'str'>
Tuesday, February 27, 2007
Python 3000 - Google Video
Python 3000 road map, status, and what this means for the average Python user.
Source: Python 3000 - Google Video
Guido, creator of Python talks about what is going to be included in Python 3000. For instance, right now in Python 2.4 if you have a list such as:
>>> a_list = [2, 1, ""]
>>> a_list.sort()
You get back a sorted list:>>> a_list
[1, 2, '']
In Python 3000 you should get a TypeError.
One of the many items that might be useful to Python programmers coding future proof code, is covered by this talk.
Sunday, February 25, 2007
django stuff
I was working on an app of mine on a new machine, and installed django-0.95.1. Pulling my code of subversion, I ran into a problem. In urls.py, I would do something like this:
from myapp.views import some_func Within urlpatterns I'd have something like this:
urlpatterns = patterns('',
(r'^$', some_func)
)Which worked fine, until today. Now I'd get:
'function' object has no attribute 'rindex'
I finally figured out the problem was in the way I was calling some_func.
The way I fixed it was removing the line that imported some_func, and reworking the urlpatterns entry to read:
urlpatterns = patterns('',
(r'^$', 'myapp.views.some_func')
)
Thursday, January 04, 2007
WSGI and Python
I found this video which helps clear things up a lot.
Sunday, December 24, 2006
some simple XML (opml) parsing in Python
from xml.dom import minidom
xmldoc = minidom.parse(filename)
"""
Print all the feed urls in the file
"""
for x in xmldoc.getElementsByTagName('outline'):
if x.attribute.has_key('xmlUrl'):
print(x.attributes["xmlUrl"].value)
Where your opml doc probably looks like:
<opml>
<head>
<title>Title for document</title>
</head>
<body>
<outline text="somerssfeedtext" title="somerssfeedtitle" htmlUrl="urltofeedssite" xmlUrl="urltofeed">
...
... (more outline elements)
</body>
</opml>
For more xml/python goodness look here.
If you want to use xpath/xml/python, look here.
Thursday, December 21, 2006
Python-mode
I came across this guide today on how to install python-mode, which is very similar to the steps I was taking. I was interested in the byte-compile section which was the only thing different. Since my installation steps are without byte compilation, I was just curious to see if it would add anything significant other than a speed increase via compiled code. Didn't get too far though because it wouldn't byte-compile for me giving me an error. An included library (are they called something else in elisp or is library good enough?) ansi-color was missing. Commenting the offending line:
require 'ansi-color
seemed to fix the problem. And I didn't notice any real difference after the byte-compilation, as expected.
Mozilla and hypocrisy
Right, but what about the experiences that Mozilla chooses to default for users like switching to Yahoo and making that the default upon ...
-
via VMware blog
-
Intrusion Detection with Tripwire : "Do this by adding a comma after the severity= line and putting emailto= on the next line, followed...
-
Right, but what about the experiences that Mozilla chooses to default for users like switching to Yahoo and making that the default upon ...