Hi everyone,
Our website uses a PHP front-end and a PostgreSQL database. We don't have back-end at the moment except a phpPgAdmin. The database admin has to type data into phpPgAmin manually, which is error-prone and tedious. We want to use Django to build a back-end.
The database has few dozens of tables already there. Is it possible ...
root url.py:
(r'^hhhh/',include('hhhh.urls')),
hhhh urls.py:
from django.conf.urls.defaults import *
urlpatterns = patterns('hhhh.views',
url(r'^$', 'h_view', name="hhhh_list"),
url(r'^read/^$', 'read', name="read_name"),
url(r'^write/$', 'write', name="write_name"),
)
view:
def h_view(request):
return render_to...
Downloading logs from App Engine is nontrivial. Requests are batched; appcfg.py does not use normal file IO but rather a temporary file (in reverse chronological order) which it ultimately appends to the local log file; when appending, the need to find the "sentinel" makes log rotation difficult since one must leave enough old logs for a...
Hi, I am trying to understand how and when iterator expressions get evaluated. The following seems to be a lazy expression:
g = (i for i in range(1000) if i % 3 == i % 2)
This one, however fails on construction:
g = (line.strip() for line in open('xxx', 'r') if len(line) > 10)
I do not have the file named 'xxx'. However, since this...
Is there an easy way to "de-instrument" an instantiated class coming from sqlalchemy's ORM, i.e., turn it into a regular object?
I.e., suppose I have a Worker class that's mapped to a worker table:
class Worker(object):
def earnings(self):
return self.wage*self.hours
mapper(Worker,workers)
where workers is a refle...
Hello,
I'm using OpenGL and I need to pass to a function array of bytes.
glCallLists(len('text'), GL_UNSIGNED_BYTES, 'text');
This way it's working fine. But I need to pass unicode text. I think that it should work like this:
text = u'unicode text'
glCallLists(len(text), GL_UNSIGNED_SHORT, convert_to_array_of_words(text));
Here I ...
Hello,
I'm writing a small Bittorrent tracker on top of the Django framework, as part of a larger project. However, I'm having problems with decoding the "info_hash" parameter of the announce request.
Basically, uTorrent takes the SHA1 hash of the torrent in question and URL encodes the hex representation of it, which is then sent to t...
i know using datetime.timedelta i can get the date of some days away form given date
daysafter = datetime.date.today() + datetime.timedelta(days=5)
but seems no datetime.timedelta(months=1)
!Thanks for any help!
...
I am facing problem in retrieving long value from PostgreSQL
I use the following SQL command :
SELECT *, (extract(epoch FROM start_timestamp) * 1000) FROM lot
WHERE EXTRACT(EPOCH FROM lot.start_timestamp) * 1000 >=1265299200000 AND
EXTRACT(EPOCH FROM lot.start_timestamp) * 1000 <=1265990399999
ORDER BY start_timestamp DESC limit 9 o...
Hi,
I am new to Python programming...
I have a .txt file....... It looks like..
0,Salary,14000
0,Bonus,5000
0,gift,6000
I want to to replace the first '0' value to '1' in each line. How can I do this? Any one can help me.... With sample code..
Thanks in advance.
Nimmyliji
...
I have a graph between 2 functions f and g.
I know it follows a power law function with exponential cutoff.
f(x) = x**(-alpha)*e**(-lambda*x)
How do I find the value of exponent alpha?
...
I am trying to obtain the left inverse of a non-square matrix in python using either numpy or scipy.
How can I translate the following Matlab code to Python?
>> A = [0,1; 0,1; 1,0]
A =
0 1
0 1
1 0
>> y = [2;2;1]
y =
2
2
1
>> A\y
ans =
1.0000
2.0000
Is there a numpy or scipy eq...
I've been fiddling for 3 hours and I can't get this F*** parser to work. Sorry for cursing.
I don't understand why I can't find **one decent tutorial that does exactly what I want.
I just want to send the function a String/XML. Then, parse it. it's not that hard. In python, I can do it with my eyes closed. Awesome, freaking documentat...
I'm building a small PyGTK application and I have an text input field (currently a ComboBoxEntry) which is populated with a few values that the user should be able to choose from.
I think what I want to do is to filter out the matching fields and only show those ones so the user using the keyboard arrows can choose one of the matching o...
If I have this:
a='abcdefghij'
b='de'
Then this finds b in a:
b in a => True
Is there a way of doing an similar thing with lists?
Like this:
a=list('abcdefghij')
b=list('de')
b in a => False
The 'False' result is understandable - because its rightly looking for an element 'de', rather than (what I happen to want it to do) 'd' ...
i made a pinax basic_project,and i found this in settings.py:
LANGUAGE_CODE = 'en'
and my pinax is not only en :
why ???
thanks
...
Possible Duplicate:
Python float - str - float weirdness
In python, 2/5.0 or 2/float(5) returns 0.40000000000000002
Why do I get that error at the end and how can I get the right value to use in additional calculations?
...
I'm having trouble in my python script, and I don't understand it :
subprocess.call(['convert', file, '-crop', '80x10+90+980', '+repage', 'test.jpg'])
Returns "invalid argument - -crop"
But if I run this from the command line, it works fine :
convert test.jpg -crop 80x10+90+980 +repage test.jpg
What am I missing here ?
...
Hi,
I use sphinx python documentation generator. Creating pdf documents are very easy and simple but.... i have one problem.
All generated pdf documents have english words like "chapter", "release", "part".
Is it possible change it? How set another words or remove it?
...
could not figure out why it is not working:
i need to send request to server, generate some fragment of html in python with meanCal method, and then want that fragment embedded into submitting html file using calculation method and dynamically shows in dyContent div. all the processes are done by single click on submit button in a form...