My website already runs PHP for it's UI. I now need to code some scripts which will fetch data from certain URL's on a daily basis and populate the database.
If PHP 5, with its enhanced object oriented features and rich libraries is on par with Python on the command line, then wouldn't it make better sense for me to use PHP for both web...
I've been working on a statistical translation system for haiti (code.google.com/p/ccmts) that uses a C++ backend (http://www.statmt.org/moses/?n=Development.GetStarted) and Python drives the C++ engine/backend.
I've passed a UTF-8 Python string into a C++ std::string, done some processing, gotten a result back into Python and here is t...
When I do a select statement for varbinary field in microsoft enterprise manger i get the field on readabel hex format like ab2c2f2d... but when i do the same statment with pymssql i get a gibrish
the select statment is : select x from table --where x the varbinary field
could someone help with this issue ?
...
Hi!
I get the infamous "MERGE of 'whatever': 200 OK" whenever I try to commit using a post-commit hook on Windows (running the repository and Trac locally), and I'm going crazy. I've been looking all over for a day now, without finding any solutions.
So here's how it's set up and what I've tried so far:
Settings:
Windows 7 (64-bit)
Vi...
I'm working on a django project with a few other developers and we have recently realized that all the .pwc files in our app cause the commits and repository to be cluttered.
Is there any way I can remove all .pwc files from all child directories in my git repository and then ignore them for any future commit?
...
I find it very useful to be able to create new variables during runtime and create a dictionary of the results for processing later, i.e. writing to a file:
myDict = {}
for i in range (1,10):
temp = "variable"+str(i)
vars()[temp] = myFunctionThatReturnsData() # variable1= data1, variable2 = data2,etc.
myDict[temp] = vars(te...
Hello good people! :)
I want to render parts of a svg file by name but for the life of me I cannot figure out how to do so (using python + gtk).
Here's the svg file in question: http://david.bellot.free.fr/svg-cards/files/SVG-cards-2.0.1.tar.gz (Update: this file no longer exists, but you can track it down at http://svg-cards.sourcefor...
Hello there,
I have a web application written in Django that has one specific page I'd like to implement a mobile version of the template (and slightly different logic) for. I'd like to be able to implement it ala this sudo code:
def(myView)
do some stuff
if user-is-on-a-mobile-device:
do some stuff
return (my mobile te...
I want to schedule a task to run in the next iteration of the reactor loop. What's the best way to do it?
reactor.callLater(0, ...)?
...
Hey there,
I use the twisted.words.protocols.jabber.client.XMPPClientFactory . Do you know how I can callback a function when the connection gets lost (for example WiFi-connection is down)?
thank you for your help!
...
I am selecting the maximum date value from a MySQL database table in python using the MySQLdb module. If the result comes back as null, I want to override it with a default value. I could do this in the MySQL using a sub-query, but would prefer to do it in python.
Any recommendations on a simple way to do this? I figure this is an easy ...
Hi all,
After a break from Python(and I knew very little then!) I'm coming back to it for a project(hopefully!). I want to do some parsing using Feedparser & need a few hints to start. Before anyone shouts, I have searched Google and read the docs, but I'm a bit too rusty unfortunately!(So please don't lmgtfy me!)
If I have a rss fee...
d = Deferred()
d.callback(Deferred()) # Assertion error saying that a Deferred shouldn't be passed
Why is this? I looked through the code and commit messages / Trac and see no reason why this should be the case. The most obvious way to bypass this is to put the Deferred in a tuple, but why is this restriction here in the first place?
...
Regarding Django Sites module and manage.py syncdb
The Auth module can prompt to ask for default superuser for the admin site, during .\manage.py syncdb. I would like to see similar things happen for the default site domain name. Currently it is example.com, hardcoded unless I use admin web site to change it. I want to change it during ...
Setuptools lets you list requirements for optional features
# mypackage
'extras_require' : { 'PDF' : ['reportlab'], 'DOCX' : ['docxlib'] }
and another package can specify 'requires' : [ 'mypackage[PDF]' ].
If another package wants to require more than one extra from the first package, can it ask for 'requires' : [ 'mypackage[PDF, DOC...
I know that with the SimpleHTTPServer I can make my directories accessible by web-browsers via Internet. So, I run just one line of the code and, as a result, another person working on another computer can use his/her browser to see content of my directories.
But I wander if I can make more complicated things. For example, somebody uses...
I've written a simple program that captures and executes command line Python scripts, but there is a problem. The text passed to a Python input function isn't written to my program despite my program capturing stdout.
For example:
The Python script:
import sys
print("Hello, World!")
x = input("Please enter a number: ")
print(x)
prin...
Hi,
I have just now installed Python 2.6 on my Windows 7 (64 bit) Lenovo t61p laptop.
I have downloaded Sphinx and nose and apparently installed them correctly using
python setup.py install
(at least no errors were reported during the installation).
Now I am trying to install pymongo using easy_install but I am not having much su...
i want to know how to assign the output of print to a variable.
so if
mystring = "a=\'12\'"
then
print mystring
a=12
and i want to pass this like **kwargs,
test(mystring)
how can i do this?
for more of an explanation: i have a list of strings i got from a a comment line of a data file. it looks like this:
"a='0.015in' l...
If i were to run this code:
def function(y):
y.append('yes')
return y
example = list()
function(example)
print(example)
Why would it return ['yes'] even though i am not directly changing the variable 'example', and how could I modify the code so that 'example' is not effected by the function?
...