I want to extract information from user-inputted text. Imagine I input the following:
SetVariables "a" "b" "c"
How would I extract information between the first set of quotations? Then the second? Then the third?
...
I'm looking to write a few small tools for managing table content for an existing SQL Server 2005 DB. I have a few dozen tables of reference content for an application that is deployed on many client databases (often for different schema versions) and I want to build a few python scripts to export, import, diff, and merge this content ac...
Here's my Python script written using android-scripting:
import android, time
droid = android.Android()
interval = 1 # every 1 minute
while True:
# define your own vibrate pattern here
droid.vibrate(200)
time.sleep(0.3)
droid.vibrate(300)
time.sleep(60*interval)
It basically vibrates every minute (like a motivat...
Here's my problem:
class City(Model):
name = StringProperty()
class Author(Model):
name = StringProperty()
city = ReferenceProperty(City)
class Post(Model):
author = ReferenceProperty(Author)
content = StringProperty()
The code isn't important... its this django template:
{% for post in posts %}
<div>{{post.content}}</di...
I have a huge (5,000+ feeds) OPML file which freezes and crashes my browser when I try uploading it to my Google Reader account using the following instructions:
Login to Google Reader
Click Your Subscription
Click the More Actions dropdown
Select Import
Browse for your OPML file
Click Open
Click Upload
You will see ...
I am already working on some software in Python but I'm having one of those days where I step back and reflect just to make sure I'm not spinning my wheels. I know that Twitter launched with RoR because it was fast to build. Then they almost moved into another language in 2008 because of scalability issues. This has caused me to step bac...
I need to integrate a Django system with a Wordpress site, as in wordpress users should be able to log in the DJnago part and vice versa,
For this I need to understand how the password hashing works in Wordpress. I can see the wp_users table which stores the username and password hashes.
Looking through the wordpress code, I can see th...
I have a script with a main for loop that repeats about 15k times. In this loop it queries a local MySQL database and does a SVN update on a local repository. I placed the SVN repository in a RAMdisk as before most of the time seemed to be spent reading/writing to disk.
Now I have a script that runs at basically the same speed but CPU u...
I'm trying to get some python code I've written earlier on Windows to work on my DS. I'm using (DSPython), and when I tried to import math, it failed with "ImportError: No module named math". I've gotten most all other modules I need that don't rely on math working. But math is normally a builtin module, so I can't just find math.py on m...
I am building an application that will send an API call and save the resulting information after processing the information in a APIRecord(models.Model) class.
1) Should I build a separate class in such a way that the class does the API call, processes the information (including checking against business rules) and then creates an insta...
In my Django application, a user has uploaded a file with a unicode character in the name.
When I'm downloading files, I'm calling :
os.path.exists(media)
to test that the file is there. This, in turn, seems to call
st = os.stat(path)
Which then blows up with the error :
UnicodeEncodeError: 'ascii' codec can't encode character u'...
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell how many have been...
Hi,
I have a productpart database containing a string property named 'type'.
What I'm trying to do is to get all products by a given type (sometimes more then one type).
I've tried to use GAE filter method but can't get it to work properly.
The only solution I've got working is to make a new db.GqlQuery for each type.
The reason I n...
I have a string where special characters like ' or " or & (...) can appear. How can I convert in the string
string = " Hello "XYZ" this 'is' a test & so on "
automatically every special characters with theire html entities, so that I get this:
string = " Hello "XYZ" this 'is' a test & so on "
Thanks!
...
Hey there,
I was playing around with Python's collection.deque and wrote the following benchmark:
#!/usr/bin/python
import timeit
if __name__=='__main__':
number = 1000000
for r in (1,10,100,1000,5000,10000,100000):
print r
print timeit.timeit("while x: x.pop(0);",
"x = list(range("...
I recently joined a new company and the development team was in the progress of a project to rebuild the database categories structure as follows:
if we have category and subcategory for items, like food category and italian food category in food category.
They were building a table for each category, instead of having one table and a l...
I installed gmpy-1.11rc1.win32-py2.6.exe, but can't figure out how to use it, I can see some exported functions like mpz, mpq, mpf, etc., but how do I call a function like mpz_probab_prime_p() in GNU MP C library?
I looked at gmpy on Google Code, but still can't figure out. I couldn't find gmpy's documentation anywhere either. Thanks.
...
I am using StringListProperty to store series of steps/tasks. By default StringListProperty is having Textarea widget. Instead i want to have multiple Text input fields each one for each item in the List.
Is this something that is possible in GAE (or atleast in Django)
Can the same be wrapped into a custom property such as TaskListProp...
Hello,
how can I load a c# dll in python?
Do I have to put some extra code in the c# files? (like export in c++ files)
I don't want to use IronPython. I want to import a module to Python!
...
I have this string:
mystring = 'Here is some text I wrote '
How can I substituate the double, triple (...) whitespaces to just one whitespace so that I get:
mystring = 'Here is some text I wrote'
Thanks.
...