I was curious about the performance of insert-sort using C and python but the results I've got just make me think if I've done something wrong. I suspected that C would be faster, but not that much.
I've profiled both codes and the insert-sort function is the place where the time is most spent.
Here is the C function:
void
insert_sort...
I've been working on my first robot for google wave recently, a vital part of what it does is to insert inline replies into a blip. I can't for the life of me figure out how to do this!
The API docs have a function InsertInlineBlip which sounded promising, however calling that doesn't appear to do anything!
EDIT::
It seems that this is...
I am writing a script to email the owner of a file when a separate process has finished. I have tried:
import os
FileInfo = os.stat("test.txt")
print (FileInfo.st_uid)
The output of this is the owner ID number. What I need is the Windows user name.
...
Basically I have been having real fun with this today. I have this data file called test.csv which is encoded as UTF-8:
"Nguyễn", 0.500
"Trần", 0.250
"Lê", 0.250
Now I am attempting to read it with this code and it displays all funny like this: Trần
Now I have gone through all the Python docs for 2.6 which is the one I use and I can...
Is there any way to decrypt the encrypted MD5 string, given the key?
...
Original Design
Here's how I originally had my Models set up:
class UserData(db.Model):
user = db.UserProperty()
favorites = db.ListProperty(db.Key) # list of story keys
# ...
class Story(db.Model):
title = db.StringProperty()
# ...
On every page that displayed a story I would query UserData for the current user:...
When trying to install MySQL's python bindings, MySQLdb, I followed the instructions to build and install on my MacBook running Mac OS X 10.6 i386, and after entering the following line into the terminal:
user-152-3-158-79:MySQL-python-1.2.3c1 jianweigan$ sudo python setup.py build
I get the following errors:
running build
running bu...
The US census bureau uses a special encoding called “soundex” to locate information about a person. The soundex is an encoding of surnames (last names) based on the way a surname sounds rather than the way it is spelled. Surnames that sound the same, but are spelled differently, like SMITH and SMYTH, have the same code and are filed toge...
Hi!
I was wondering how can someone use python to encrypt text into an image.
...
In JavaScript, one can print out the definition of a function. Is there a way to accomplish this in Python?
(Just playing around in interactive mode, and I wanted to read a module without open(). I was just curious).
...
After playing around with NSIS (Nullsoft Scriptable Installation System) for a few days, I really feel the pain it's use brings me. No wonder, the authors claim it's scripting implementation is a "mixture of PHP and Assembly".
So, I hope there is something better to write installation procedures to get Windows programs installed, while ...
In Python it's possible to create a procedure that has no explicit return. i.e.:
def test(val):
if 0 == val:
return 8
Further, it's possible to assign the results of that function to a variable:
>>> a = test(7)
>>> print `a`
'None'
Why the heck is that? What language logic is behind that baffling design decision? Why ...
Hi guys,
I've produced a few Django sites but up until now I have been mapping individual views and URLs in urls.py.
Now I've tried to create a small custom CMS but I'm having trouble with the URLs. I have a database table (SQLite3) which contains code for the pages like a column for header, one for right menu, one for content.... so o...
I currently have some Ruby code used to scrape some websites. I was using Ruby because at the time I was using Ruby on Rails for a site, and it just made sense.
Now I'm trying to port this over to Google App Engine, and keep getting stuck.
I've ported Python Mechanize to work with Google App Engine, but it doesn't support DOM inspecti...
I'm trying to write a very simple, tree-walking template in jinja2, using some custom objects with overloaded special methods (getattr, getitem, etc) It seems straightforward, and the equivalent python walk of the tree works fine, but there's something about the way that Jinja's recursion works that I don't understand. The code is show...
According to the documentation:
An app is a Web application that does
something -- e.g., a weblog system, a
database of public records or a simple
poll app. A project is a collection of
configuration and apps for a
particular Web site. A project can
contain multiple apps. An app can be
in multiple projects.
However, w...
I am considering to write an application that would covert the comments in reddit threads (example) to emails. The idea is to parse the reddit json data (example) and send new comments as plain EMails to subscribed users. One of the users can be gmane, so you can also read the comments over there. The motivation for writing this tool is ...
How to send a file using OBEX push to a device, which has an open OBEX port in Python? In my case it is a Bluetooth device.
...
I’m looking for a better way to name everything in Python. Yes, I’ve read PEP8, Spolsky’s wonderful rant, and various other articles. But I’m looking for more guidance in choosing the actual words.
And yes I know
A Foolish Consistency is the Hobgoblin
of Little Minds.
But, you can keep consistent with PEP8 etc, and still not h...
I have a python script that calls out to two Sysinternals tools (sigcheck and accesschk). Is there a way I can bundle these executables into a py2exe so that subprocess.Popen can see it when it runs?
Full explanation: My script is made to execute over a network share (S:\share\my_script.exe) and it makes hundreds of calls to sigcheck ...