Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
2,137,517
2010-01-26T04:26:00.000
0
0
0
0
python,pygtk,gtk
2,137,653
2
false
0
1
It can't be done, in general. If you're talking about a line of your pygtk program, then you would need an API for your IDE (development environment) to find out where a particular source code line is currently displayed on the screen, if anywhere. If by "line number" you mean something else, then as Ignacio says, you'll need to provide a lot more detail.
1
0
0
I have a application written in PyGtk. I need to convert a particular line number into its corresponding window co-ordinates in a GtkTextView. How can this be done?
Convert Line Number Into its corresponding co-ordinates
0
0
0
131
2,138,415
2010-01-26T09:18:00.000
1
0
1
0
python,dll,regfreecom,win32com
13,718,199
1
false
0
0
This kind of information is hard, very very hard to find information about. I am attempting to find the same but for Ruby, however I expect that the same issue will occur. Ultimately, however, a Manifest file is required, and at least during development, it may help to register the .dll anyway, and then work on making it registration free (with a manifest file)
1
3
0
I am currently using the win32com module of CPython to use a DLL. I know some people using IronPython to automagically get the list of functions provided by this DLL. They don't need to register the DLL. I'd like to do the same as them but with CPython. 1) Is it possible to use CPython and win32com to connect to a dll reg-free. How to make it reg-free? 2) How to get the list of functions provided by the DLL? I'd like to create a CPython module providing the whole list of functions. Any idea?
RegFree DLL with CPython using win32com module
0.197375
0
0
350
2,138,868
2010-01-26T10:51:00.000
0
0
0
0
python,django,gwt,extjs,webclient
2,140,012
5
false
1
0
How about Pylons + SQLAlchemy + ExtJS? We use it and it works great!
2
5
0
I've well developed Python Server having workflows, views, object - ORM/OSV, etc... Server/Client communication based on socket protocol, can be done by any of service 1. XMLRPC Service 2. Socket Service now I want to develop a Fully Ajax based GUI web Client.. I've web/socket services to communicate with server. what I need is to select the technology, I've several options like, ExtJS - CherryPy GWT Ext-GWT CheeryPy Django + JQuery Django + Extjs ??? ???...
Which technology is preferable to build a web based GUI Client?
0
0
1
2,943
2,138,868
2010-01-26T10:51:00.000
1
0
0
0
python,django,gwt,extjs,webclient
2,138,949
5
false
1
0
I'm not sure I understood exactly on the server side, but i'm a big fan of Flex as a way to develop proper software for the browser, rather than mess of trying to make HTML do things it was never made for. Partly an idealistic reasoning, but I also am still not impressed by the 'feel' of JS-based GUIs. Flex has good server-communication options... web-services, sockets, remote objects, etc.
2
5
0
I've well developed Python Server having workflows, views, object - ORM/OSV, etc... Server/Client communication based on socket protocol, can be done by any of service 1. XMLRPC Service 2. Socket Service now I want to develop a Fully Ajax based GUI web Client.. I've web/socket services to communicate with server. what I need is to select the technology, I've several options like, ExtJS - CherryPy GWT Ext-GWT CheeryPy Django + JQuery Django + Extjs ??? ???...
Which technology is preferable to build a web based GUI Client?
0.039979
0
1
2,943
2,139,823
2010-01-26T14:02:00.000
0
0
0
1
python,bash,awk
2,139,973
5
false
0
0
Doing this in Python should be pretty trivial. It's probably possible in awk, but sounds a bit too complicated to be fun. It's surely is possible in bash, but programming in bash is for masochists. I'd go with Python, of the given options, although Perl and Ruby are good options too if you know them.
1
1
0
I have a set of 10000 files c1.dat ... c10000.dat. Each of these files contains a line which starts with @ and contains a string with spaces specific for this file, lije c37 7.379 6.23. I have another set of 10000 files kind of determined_cXXX_send.dat (where XXX goes from 1 to 10000). Each of these files has only one line. Each line is of thsis type: _1 1 3456.000000 -21 0 -98.112830 -20.326192 What I would like to do is, for each number XXX (between 1 to 10000), get from the cXXX.dat file the string like c37 7.379 6.23 , and add it in the file determined_cXXX_send.dat to the beginning of the file so I get: c37 7.379 6.23 _1 1 3456.000000 -21 0 -98.112830 -20.326192 I tried with both bash and python but got no good solution. What would be the best approach? thanks
Bash or Python or Awk to match and modify files
0
0
0
592
2,140,142
2010-01-26T14:53:00.000
0
1
0
0
python,facebook,pyfacebook
2,140,233
3
false
1
0
I've never used PyFacebook. Or tried to resume sessions in this manner. But I'd imagine just storing session_key and uid is not enough. There are other params too, and a signature param that's calculated based on all the fb_* params. So you might need to store all of them. But even so, they might only work for 20-30 minutes if you're unlucky.
2
2
0
I am trying to set a cron task to read updates for a Facebook application. I have prompted the user to grant Offline Access permissions and i have store the session_key in the db. I am crearing a new Facebook object and besides api and secret key I also use the session_key (previously stored in db) and the fb uid. When i am trying to create the auth token or do a API call i get a Error 104: Incorrect signature Any ideas, experience, hints ?
PyFacebook Infinite Session
0
0
0
819
2,140,142
2010-01-26T14:53:00.000
1
1
0
0
python,facebook,pyfacebook
11,015,676
3
false
1
0
I faced the same problem where the error displayed was: "facebook.FacebookError: Error 104: Incorrect signature" Just reset your APP Secret_key and make corresponding change in the code and that sgould fix the problem. Cheers!
2
2
0
I am trying to set a cron task to read updates for a Facebook application. I have prompted the user to grant Offline Access permissions and i have store the session_key in the db. I am crearing a new Facebook object and besides api and secret key I also use the session_key (previously stored in db) and the fb uid. When i am trying to create the auth token or do a API call i get a Error 104: Incorrect signature Any ideas, experience, hints ?
PyFacebook Infinite Session
0.066568
0
0
819
2,140,836
2010-01-26T16:33:00.000
1
0
1
0
python,windows,pyqt,importerror
10,279,385
8
false
0
1
PyQt installation also depends on the version of python installed on your platform.Python3.+ is incompatible with Python version < 3.x. I was facing the same problem as I have Python 2.7 installed on my machine but I downloaded the latest binary which was PyQt-Py3.2-x86-gpl-4.9.exe. If you see here the binary has python version also mentioned in name after PyQt which is Py3.2. I uninstalled PyQt and installed PyQt-Py2.7-x86-gpl-4.9.exe which points to Python 2.7 and it fixed the problem. Probably they could have mentioned the naming convention online or in some documentation to be more simpler.
5
11
0
I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. ImportError: DLL load failed: The specified module could not be found. I've checked my System Path, and C:\Python31\Lib\site-packages\PyQt4\bin is on there. I can't run any of the examples, but the Designer, Assistant and Linguist run fine. I am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed. Edit: I've copied the QtCore4 and GtGui4 dlls to C:\Python31\Lib\site-packages\PyQt4. That fixes some of the examples, but I still can't use the example browser.
PyQt 4.7 - ImportError after installing on Windows
0.024995
0
0
24,135
2,140,836
2010-01-26T16:33:00.000
2
0
1
0
python,windows,pyqt,importerror
4,452,810
8
false
0
1
Just wanted to chime in that I had the same problem on a WinXP install of: python 2.7 Qt 4.7.1 (10.05) PyQt 4.8.1 I used the windows installer version of all 3 of those items. Copying the contents of the C:\Python27\Lib\site-packages\PyQt4\bin folder up to the main PyQt folder (C:\Python27\Lib\site-packages\PyQt4) stopped the 'dll not found' errors that python was throwing.
5
11
0
I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. ImportError: DLL load failed: The specified module could not be found. I've checked my System Path, and C:\Python31\Lib\site-packages\PyQt4\bin is on there. I can't run any of the examples, but the Designer, Assistant and Linguist run fine. I am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed. Edit: I've copied the QtCore4 and GtGui4 dlls to C:\Python31\Lib\site-packages\PyQt4. That fixes some of the examples, but I still can't use the example browser.
PyQt 4.7 - ImportError after installing on Windows
0.049958
0
0
24,135
2,140,836
2010-01-26T16:33:00.000
0
0
1
0
python,windows,pyqt,importerror
27,086,381
8
false
0
1
I think there are at least two possible error conditions 1. ImportError: DLL load failed: The specified module could not be found. then you have to check your PyQT version is comptible with your python. In other words, if you use python 3.3, then you can only use PyQT for python3.3 and python 3.3 will not work with PyQT for python3.4 This was the problem I met. I solved it with re-install it 2. Import Error: DLL load failed: %1 then something strange on a different encoding Win32. then it would be a OS problem. If you use 32bit Python then you have to use 32bit PyQt, so do 64bit
5
11
0
I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. ImportError: DLL load failed: The specified module could not be found. I've checked my System Path, and C:\Python31\Lib\site-packages\PyQt4\bin is on there. I can't run any of the examples, but the Designer, Assistant and Linguist run fine. I am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed. Edit: I've copied the QtCore4 and GtGui4 dlls to C:\Python31\Lib\site-packages\PyQt4. That fixes some of the examples, but I still can't use the example browser.
PyQt 4.7 - ImportError after installing on Windows
0
0
0
24,135
2,140,836
2010-01-26T16:33:00.000
1
0
1
0
python,windows,pyqt,importerror
11,774,820
8
false
0
1
I had the same problem. I got my program running from within Eclipse but when I tried running it directly from the command line I still got the same error. I solved it by renaming the C:\Users\Me\AppData\Roaming\Python\Python27\site-packages\PyQt4 directory. (I'm guessing leftovers from a previous PyQt install) I am using ActivePython.
5
11
0
I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. ImportError: DLL load failed: The specified module could not be found. I've checked my System Path, and C:\Python31\Lib\site-packages\PyQt4\bin is on there. I can't run any of the examples, but the Designer, Assistant and Linguist run fine. I am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed. Edit: I've copied the QtCore4 and GtGui4 dlls to C:\Python31\Lib\site-packages\PyQt4. That fixes some of the examples, but I still can't use the example browser.
PyQt 4.7 - ImportError after installing on Windows
0.024995
0
0
24,135
2,140,836
2010-01-26T16:33:00.000
1
0
1
0
python,windows,pyqt,importerror
5,795,870
8
false
0
1
Also chiming in. I installed both python 2.6 and PyQt 4.8.3 on a Windows 7 machine using the windows installers (I did NOT run 'python setup.py install'). I tried to run spyder (which requires PyQt 4.4 or greater) and failed because it couldn't find the PyQt .dlls. I copied all the .dlls from the \Lib\site-packages\PyQt4\bin folder to the \Lib\site-packages\PyQt4 folder, and spyder launches just fine.
5
11
0
I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. ImportError: DLL load failed: The specified module could not be found. I've checked my System Path, and C:\Python31\Lib\site-packages\PyQt4\bin is on there. I can't run any of the examples, but the Designer, Assistant and Linguist run fine. I am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed. Edit: I've copied the QtCore4 and GtGui4 dlls to C:\Python31\Lib\site-packages\PyQt4. That fixes some of the examples, but I still can't use the example browser.
PyQt 4.7 - ImportError after installing on Windows
0.024995
0
0
24,135
2,140,869
2010-01-26T16:38:00.000
3
0
1
0
ironpython,.net-1.1
2,140,900
1
true
1
0
IronPython since version 1.0 is only compatible with .NET 2.0 and higher, it uses Generic and features only available since .NET 2.0.
1
1
0
In IronPython Studio -> Properties -> General Tab i see a Property with Name Target Plataform and found Microsoft Framework 1.0, 1.1 and 2.0, selected 1.1 and next opened my Visual Studio 2003 -> Add Reference and for my surprise this not work. Not compatibility. Why? What i do wrong?
IronPython and Targetting to MS Framework 1.1
1.2
0
0
58
2,141,315
2010-01-26T17:39:00.000
-2
0
1
0
python,pygame
2,141,369
2
false
0
1
Pygame is an SDL wrapper. Not a multimedia framework. Why do you want to do audio format conversions in Pygame? Can't you use something else like maybe the gstreamer bindings for Python?
1
3
0
How can I convert a .wav file to some other format such as .mp3 in pygame? Update: Why not Gstreamer or Pygame: I want to use native Windows environment to install a package that can do this (i.e. don't want to install cygwin). I am searching for a package which has a binary installer available for windows (with Python 2.6) or atleast where I can do "python setup.py install" without a need to install any dependencies.
pygame saving audio files
-0.197375
0
0
410
2,141,589
2010-01-26T18:19:00.000
9
0
0
0
python,postgresql,stored-procedures,plpgsql
2,142,128
1
true
0
0
Depends on what operations you're doing. Well, combine that with a general Python documentation, and that's about what you have. No. Again, depends on what you're doing. If you're only going to run a query once, no point in preparing it separately. If you are using persistent connections, it might. But they get cleared out whenever a connection is closed. Not likely. Sandboxing is broken in Python and AFAIK nobody is really interested in fixing it. I heard someone say that python-on-parrot may be the most viable way, once we have pl/parrot (which we don't yet). Bottom line though - if your stored procedures are going to do database work, use pl/pgsql. Only use pl/python if you are going to do non-database stuff, such as talking to external libraries.
1
11
0
we are still pretty new to Postgres and came from Microsoft Sql Server. We are wanting to write some stored procedures now. Well, after struggling to get something more complicated than a hello world to work in pl/pgsql, we decided it's better if we are going to learn a new language we might as well learn Python because we got the same query working in it in about 15 minutes(note, none of us actually know python). So I have some questions about it in comparison to pl/psql. Is pl/Pythonu slower than pl/pgsql? Is there any kind of "good" reference for how to write good stored procedures using it? Five short pages in the Postgres documentation doesn't really tell us enough. What about query preparation? Should it always be used? If we use the SD and GD arrays for a lot of query plans, will it ever get too full or have a negative impact on the server? Will it automatically delete old values if it gets too full? Is there any hope of it becoming a trusted language? Also, our stored procedure usage is extremely light. Right now we only have 4, but we are still trying to convert little bits of code over from Sql Server specific syntax(such as variables, which can't be used in Postgres outside of stored procedures)
Stored Procedures in Python for PostgreSQL
1.2
1
0
5,869
2,141,769
2010-01-26T18:50:00.000
0
0
0
0
python,database,django,django-queryset
4,230,081
3
false
1
0
Actually, that didn't work out for me. The following did: Entry.objects.all().update(value=(F('value')==False))
1
7
0
I have a queryset with a few million records. I need to update a Boolean Value, fundamentally toggle it, so that in the database table the values are reset. What's the fastest way to do that? I tried traversing the queryset and updating and saving each record, that obviously takes ages? We need to do this very fast, any suggestions?
Fastest Way to Update a bunch of records in queryset in Django
0
1
0
1,711
2,143,463
2010-01-26T23:19:00.000
0
0
0
0
python,random,pygame
64,776,255
4
false
0
1
At the point when you want another level, you should initially create another levelRandom object, and give that object to a level-generator to produce the level (if you are using one)
2
4
0
I'm making a game which uses procedurally generated levels, and when I'm testing I'll often want to reproduce a level. Right now I haven't made any way to save the levels, but I thought a simpler solution would be to just reuse the seed used by Python's random module. However I've tried using both random.seed() and random.setstate() and neither seem to reliably reproduce results. Oddly, I'll sometimes get the same level a few times in a row if I reuse a seed, but it's never completely 100% reliable. Should I just save the level normally (as a file containing its information)? Edit: Thanks for the help everyone. It turns out that my problem came from the fact that I was randomly selecting sprites from groups in Pygame, which are retrieved in unordered dictionary views. I altered my code to avoid using Pygame's sprite groups for that part and it works perfectly now.
What's the easiest way to reproduce a randomly generated level in Python?
0
0
0
2,510
2,143,463
2010-01-26T23:19:00.000
1
0
0
0
python,random,pygame
2,143,490
4
false
0
1
Best would be to create a levelRandom class with a data slot for every randomly produced result when generating a level. Then separate the random-generation code from the level-construction code. When you want a new level, first generate a new levelRandom object, then hand that object to the level-generator to produce your level. Later, to get the same level again, you can just reuse the levelRandom instance.
2
4
0
I'm making a game which uses procedurally generated levels, and when I'm testing I'll often want to reproduce a level. Right now I haven't made any way to save the levels, but I thought a simpler solution would be to just reuse the seed used by Python's random module. However I've tried using both random.seed() and random.setstate() and neither seem to reliably reproduce results. Oddly, I'll sometimes get the same level a few times in a row if I reuse a seed, but it's never completely 100% reliable. Should I just save the level normally (as a file containing its information)? Edit: Thanks for the help everyone. It turns out that my problem came from the fact that I was randomly selecting sprites from groups in Pygame, which are retrieved in unordered dictionary views. I altered my code to avoid using Pygame's sprite groups for that part and it works perfectly now.
What's the easiest way to reproduce a randomly generated level in Python?
0.049958
0
0
2,510
2,144,171
2010-01-27T02:21:00.000
1
0
1
1
python,hadoop
2,149,550
2
false
0
0
If you're using Hadoop Streaming, your input can be in any line-based format; your mapper and reducer input comes from sys.stdin, which you read any way you want. You don't need to use the default tab-deliminated fields (although in my experience, one format should be used among all tasks for consistency when possible). However, with the default splitter and partitioner, you cannot control how your input and output is partitioned or sorted, so you your mappers and reducers must decide whether any particular line is a header line or a data line using only that line - they won't know the original file boundaries. You may be able to specify a partitioner which lets a mapper assume that the first input line is the first line in a file, or even move away from a line-based format. This was hard to do the last time I tried with Streaming, and in my opinion mapper and reducer tasks should be input agnostic for efficiency and reusability - it's best to think of a stream of input records, rather than keeping track of file boundaries. Another option with Streaming is to ship header information in a separate file, which is included with your data. It will be available to your mappers and reducers in their working directories. One idea would be to associate each line with the appropriate header information in an inital task, perhaps by using three fields per line instead of two, rather than associating them by file. In general, try and treat the input as a stream and don't rely on file boundaries, input size, or order. All of these restrictions can be implemented, but at the cost of complexity. If you do need to implement them, do so at the beginning or end of your task chain. If you're using Jython or SWIG, you may have other options, but I found those harder to work with than Streaming.
1
3
0
I'm using Hadoop for data processing with python, what file format should be used? I have project with a substantial amount of text pages. Each text file has some header information that I need to preserve during the processing; however, I don't want the headers to interfere with the clustering algorithms. I'm using python on Hadoop (or is there a sub package better suited?) How should I format my text files, and store those text files in Hadoop for processing?
I'm using Hadoop for data processing with python, what file format should be used?
0.099668
0
0
1,633
2,145,232
2010-01-27T07:45:00.000
1
0
1
1
python,windows
2,145,311
6
false
0
0
You don't say in your question what you are going to use Python for, so most answers above are completely correct in pointing out that you install Python by downloading it from Python.org. But you seem to expect more. Is it correct to assume you are going to use it to do web development? In that case, prepare for a shock, because Python doesn't do things like PHP does at all. You want to use a web framework. There are loads of them for Python. Which on to use depends both on what you are going to do, and your personal taste. The only "Download as one file and install to run" web system I know of that's based on Python is Plone. And Plone is great, but it's not a webframework, it's a content management system. But hey, maybe that's what you want? :-) The other frameworks are usually easy to install as well. (In the long run: If you are going to do web development, you'll be happier with something Unix based. Just saying.)
2
2
0
I am used to using PHP and it is easy to set up, I can just run an exe package like Xampp and have apache and PHP running in 5 minutes on my windows system. Is there something similar to Python?
How can I run Python code on a windows system?
0.033321
0
0
1,021
2,145,232
2010-01-27T07:45:00.000
0
0
1
1
python,windows
2,145,253
6
false
0
0
Download python installer and run python.
2
2
0
I am used to using PHP and it is easy to set up, I can just run an exe package like Xampp and have apache and PHP running in 5 minutes on my windows system. Is there something similar to Python?
How can I run Python code on a windows system?
0
0
0
1,021
2,145,334
2010-01-27T08:16:00.000
0
0
1
0
python,development-environment
2,145,352
1
true
0
0
It does not need to compile them, as it contains a Python interpreter already.
1
1
0
I want to develop an app for Moblin for a competition. The development environment needed by Moblin is too complicated to setup. It uses Anjuta as its IDE, but I could never make sense of the entire compilation toolchain. However, I would like to know if Moblin could compile and run Python scripts. If I could write the app in Python instead of Anjuta, then my work would be a lot easier. Please let me know.. --Rishi.
Can Moblin run (and compile) Python scripts?
1.2
0
0
112
2,145,365
2010-01-27T08:23:00.000
1
1
0
0
php,session,python-idle
2,145,413
4
false
1
0
I assume you mean 'idle' time. There is no need to calculate that, but you have to store the last (authenticated) access made by that user and reset the counter. Typically, one would should issue an authentication cookie with a certain timestamp. Upon authentication of the cookie, you compare the current time with the timestamp. If this difference is larger than some threshold, say 5 minutes, you present an error page. To improve the user experience, you might also want to display a timer to the user so there is no bad surprise.
4
1
0
I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I'd like to present the user with a message stating why they were logged out and redirect them to the login page. What is the best way to handle this? I am running on php and myadmin. Thanks Avinash
How do I detect when a user has been idle for a certain time and destroy their session in PHP?
0.049958
0
0
2,505
2,145,365
2010-01-27T08:23:00.000
1
1
0
0
php,session,python-idle
2,145,866
4
false
1
0
Can you not just use PHP's built-in session functions to set session expiry time to 5 mins. and re-direct if a session no longer exists?
4
1
0
I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I'd like to present the user with a message stating why they were logged out and redirect them to the login page. What is the best way to handle this? I am running on php and myadmin. Thanks Avinash
How do I detect when a user has been idle for a certain time and destroy their session in PHP?
0.049958
0
0
2,505
2,145,365
2010-01-27T08:23:00.000
7
1
0
0
php,session,python-idle
2,145,390
4
true
1
0
Every time you load a page, store a timestamp in a session variable. When the user goes to a page, check to see if $SESSION['lastActivity'] < time() - <your idle time>. If true, then redirect to a 'your session has expired' page or similar. If not, continue loading the page.
4
1
0
I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I'd like to present the user with a message stating why they were logged out and redirect them to the login page. What is the best way to handle this? I am running on php and myadmin. Thanks Avinash
How do I detect when a user has been idle for a certain time and destroy their session in PHP?
1.2
0
0
2,505
2,145,365
2010-01-27T08:23:00.000
0
1
0
0
php,session,python-idle
2,145,652
4
false
1
0
Create a javascript function that has a x minute timeout that pops up and redirects. Also on the server make sure their session expires so that in the case of Javascript not being available, they cannot continue actions after their idle time has passed.
4
1
0
I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I'd like to present the user with a message stating why they were logged out and redirect them to the login page. What is the best way to handle this? I am running on php and myadmin. Thanks Avinash
How do I detect when a user has been idle for a certain time and destroy their session in PHP?
0
0
0
2,505
2,148,493
2010-01-27T16:20:00.000
4
0
0
0
javascript,python,browser,screen-scraping
2,148,595
5
false
1
0
I have had to do this before (in .NET) and you are basically going to have to host a browser, get it to click the button, and then interrogate the DOM (document object model) of the browser to get at the generated HTML. This is definitely one of the downsides to web apps moving towards an Ajax/Javascript approach to generating HTML client-side.
1
18
0
I need to scrape a site with python. I obtain the source html code with the urlib module, but I need to scrape also some html code that is generated by a javascript function (which is included in the html source). What this functions does "in" the site is that when you press a button it outputs some html code. How can I "press" this button with python code? Can scrapy help me? I captured the POST request with firebug but when I try to pass it on the url I get a 403 error. Any suggestions?
scrape html generated by javascript with python
0.158649
0
1
17,188
2,148,994
2010-01-27T17:33:00.000
1
0
1
1
python,command-line-arguments,python-idle
65,991,396
12
false
0
0
IDLE now has a GUI way to add arguments to sys.argv! Under the 'Run' menu header select 'Run... Customized' or just Shift+F5...A dialog will appear and that's it!
3
44
0
I'm testing some python code that parses command line input. Is there a way to pass this input in through IDLE? Currently I'm saving in the IDLE editor and running from a command prompt. I'm running Windows.
When running a python script in IDLE, is there a way to pass in command line arguments (args)?
0.016665
0
0
83,523
2,148,994
2010-01-27T17:33:00.000
1
0
1
1
python,command-line-arguments,python-idle
33,057,011
12
false
0
0
Visual Studio 2015 has an addon for Python. You can supply arguments with that. VS 2015 is now free.
3
44
0
I'm testing some python code that parses command line input. Is there a way to pass this input in through IDLE? Currently I'm saving in the IDLE editor and running from a command prompt. I'm running Windows.
When running a python script in IDLE, is there a way to pass in command line arguments (args)?
0.016665
0
0
83,523
2,148,994
2010-01-27T17:33:00.000
0
0
1
1
python,command-line-arguments,python-idle
54,038,733
12
false
0
0
import sys sys.argv = [sys.argv[0], '-arg1', 'val1', '-arg2', 'val2'] //If you're passing command line for 'help' or 'verbose' you can say as: sys.argv = [sys.argv[0], '-h']
3
44
0
I'm testing some python code that parses command line input. Is there a way to pass this input in through IDLE? Currently I'm saving in the IDLE editor and running from a command prompt. I'm running Windows.
When running a python script in IDLE, is there a way to pass in command line arguments (args)?
0
0
0
83,523
2,149,358
2010-01-27T18:27:00.000
0
0
1
0
python,dbus,asyncore
2,154,293
3
false
0
0
Although you got what is probably a perfectly reasonable answer, there is another approach - you don't need to use asyncore's loop per se. Just call asyncore.loop with a zero timeout and a count of 1, which stops it iterating (and thus makes the function name completely misleading) and polls the sockets just once. Call this as often as you need. I don't know anything about glib's async support but if it requires threads you might still get better performance by using asyncore in this way since it will use select or poll and won't need to spawn additional threads.
2
6
0
Is it possible to integrate asyncore with dbus through the same main loop? Usually, DBus integration is done through glib main loop: is it possible to have either asyncore integrate this main loop or have dbus use asyncore's ?
Python asyncore & dbus
0
0
0
764
2,149,358
2010-01-27T18:27:00.000
7
0
1
0
python,dbus,asyncore
2,149,387
3
true
0
0
asyncore sucks. glib already provides async stuff, so just use glib's mainloop to do everything.
2
6
0
Is it possible to integrate asyncore with dbus through the same main loop? Usually, DBus integration is done through glib main loop: is it possible to have either asyncore integrate this main loop or have dbus use asyncore's ?
Python asyncore & dbus
1.2
0
0
764
2,150,144
2010-01-27T20:49:00.000
2
0
1
0
python,multithreading
18,595,947
7
false
0
0
A very glib one-word response: Golang.
4
6
0
just considering starting to learning python but I have one concern before I invest more time. Let me phrase this as a statement followed by a concern for others to comment on as perhaps the assumptions in the statement are invalid: I have read about GIL and the consensus seems to be if you require concurrent solutions in python your best bet is to fork a new process to avoid GIL. My concern is that if I have a problem I'd like to split into N*2 pieces across N processors (assume for example I have a single server running a *nix o/s with say 8 cores) I will incur context switching penalties between processes rather than between threads, which is more costly, which will limit performance. I ask this because other languages are out there that claim to excel in such a scenario and I wonder is python appropriate for this arena.
Is python a serious option for concurrent programming
0.057081
0
0
5,247
2,150,144
2010-01-27T20:49:00.000
1
0
1
0
python,multithreading
8,353,250
7
false
0
0
writing codes for multiple process is not an easy task. But if you start thinking to this way first, eventually, it is easier to scale if one machine isn't enough...Threads can't be used across machines...
4
6
0
just considering starting to learning python but I have one concern before I invest more time. Let me phrase this as a statement followed by a concern for others to comment on as perhaps the assumptions in the statement are invalid: I have read about GIL and the consensus seems to be if you require concurrent solutions in python your best bet is to fork a new process to avoid GIL. My concern is that if I have a problem I'd like to split into N*2 pieces across N processors (assume for example I have a single server running a *nix o/s with say 8 cores) I will incur context switching penalties between processes rather than between threads, which is more costly, which will limit performance. I ask this because other languages are out there that claim to excel in such a scenario and I wonder is python appropriate for this arena.
Is python a serious option for concurrent programming
0.028564
0
0
5,247
2,150,144
2010-01-27T20:49:00.000
1
0
1
0
python,multithreading
2,150,247
7
false
0
0
If you're considering learning Python for addressing this problem, I might suggest taking a look at Erlang instead. It has excellent support for very lightweight processes, and built-in primitives for IPC. Not to discourage you from learning Python, of course, just suggesting there might be a better tool for this particular task.
4
6
0
just considering starting to learning python but I have one concern before I invest more time. Let me phrase this as a statement followed by a concern for others to comment on as perhaps the assumptions in the statement are invalid: I have read about GIL and the consensus seems to be if you require concurrent solutions in python your best bet is to fork a new process to avoid GIL. My concern is that if I have a problem I'd like to split into N*2 pieces across N processors (assume for example I have a single server running a *nix o/s with say 8 cores) I will incur context switching penalties between processes rather than between threads, which is more costly, which will limit performance. I ask this because other languages are out there that claim to excel in such a scenario and I wonder is python appropriate for this arena.
Is python a serious option for concurrent programming
0.028564
0
0
5,247
2,150,144
2010-01-27T20:49:00.000
3
0
1
0
python,multithreading
2,150,156
7
false
0
0
In my limited experience, the "context switch cost" is overrated as a performance limitation. I/O bandwidth and memory are the most common limiting factors. Python's I/O is comparable to many other languages, since it simply uses the standard C libraries pretty directly. Your actual problem may not be typical. However, many problems work out really well in multi-processing mode because they're actually I/O bound. Often it's filesystem, web page reading or Database operations that limit performance long before context switches.
4
6
0
just considering starting to learning python but I have one concern before I invest more time. Let me phrase this as a statement followed by a concern for others to comment on as perhaps the assumptions in the statement are invalid: I have read about GIL and the consensus seems to be if you require concurrent solutions in python your best bet is to fork a new process to avoid GIL. My concern is that if I have a problem I'd like to split into N*2 pieces across N processors (assume for example I have a single server running a *nix o/s with say 8 cores) I will incur context switching penalties between processes rather than between threads, which is more costly, which will limit performance. I ask this because other languages are out there that claim to excel in such a scenario and I wonder is python appropriate for this arena.
Is python a serious option for concurrent programming
0.085505
0
0
5,247
2,150,899
2010-01-27T22:46:00.000
-1
0
0
0
python,menu,gtk,pygtk
2,152,012
2
false
0
1
Try digging into source and it's documentation. I have found this to be the easiest way and best shortcut.
1
6
0
Using Python and PyGTK I've got a GtkMenu with various GtkCheckMenuItems in it. When the user clicks one of the checkboxes the menu closes. I'd like for the user to be able to check a series of checkboxes without the menu closing each time. I've looked at using the activate callback to show the menu but this doesn't seem to work. Any suggestions?
Making a Python/GTK CheckMenuItem, when clicked, not close the menu
-0.099668
0
0
749
2,150,947
2010-01-27T22:55:00.000
3
1
0
0
php,python,wordpress,deployment,hosting
2,150,982
1
true
1
0
As far as points #1 and #2 go, you are probably right. No other platform is so widely, easily and cheaply available in terms of hosting companies and packages like the LAMP stack. Plus, most incompatibilities that can occur when deploying an application to a completely unknown web space are well documented, their number is limited, and can mostly be checked beforehand (register_globals, safe mode, allocated script memory, etc.) If I were thinking about developing a web application that I want to see spreading as quickly and as far as possible also among non-professionals and end users, PHP would be my platform of choice for these reasons. I must add that I am deeply familiar only with the hosting market in Germany, but I'm quite sure the basic characteristics are the same. As for developer availability: People who claim to be able to speak PHP are easy to find. Those who will actually do a good job for you, less so. Still, I think it is safe to say that PHP developers are easier to find than, say, Pythonists or Ruby developers. I don't expect this to stay this way forever, though. Other languages are gaining popularity, and in the end, developers and which languages they like influences the hosting market massively in the long term.
1
3
0
My own answer to this question is YES, but I'd like to hear from others. Put another way the question could be: Would the success of 1-click-install WordPress (not WordPress.com, which is SaaS) be possible if it weren't written in PHP, all other things being equal? The critical associated requirements I believe support PHP are: hosting/deployment flexibility developer reach flexibility and depth of knowledge around server performance tuning Items #1 and #2 are equally critical, and both are far more important than #3. FWIW, I'm not a particular fan of PHP - can anyone truly be? - but the goals of re-deployment and extensibility point wherever they point. Please, please do not pollute this space if you do not grok the question. This is not about PHP and it's relative merits, or lack of merit, compared to other programming languages out of context. I am looking for insight specifically around language choice as it relates to deployment/uptake/extensibility strategy as outlined. Thanks.
Is PHP the only choice re: massive and rapid uptake of a re-deployable, extensible web application?
1.2
0
0
181
2,152,098
2010-01-28T03:24:00.000
7
0
0
0
python,screen-scraping,mechanize
2,167,177
1
true
1
0
The answer to my immediate question in the headline is yes, with mechanize.Browser.open_novisit(). It works just like open(), but it doesn't change the state of the Browser instance -- that is, it will retrieve the page, and your Browser object will stay where it was.
1
3
0
In Python's mechanize.Browser module, when you submit a form the browser instance goes to that page. For this one request, I don't want that; I want it just to stay on the page it's currently on and give me the response in another object (for looping purposes). Anyone know a quick to do this? EDIT: Hmm, so I have this kind of working with ClientForm.HTMLForm.click(), which returns a urllib2 request, but I need the cookies from mechanize's cookiejar to be used on my urllib2.urlopen request. Is there a method in mechanize that will let me send a request just like urllib2 with the exception that cookies will be imported?
Can I get my instance of mechanize.Browser to stay on the same page after calling b.form.submit()?
1.2
0
1
1,070
2,152,471
2010-01-28T05:19:00.000
4
1
0
0
python,linux,datetime,timezone
2,152,511
3
true
0
0
You can use time.gmtime() to get time GMT (UTC) from any machine no matter the timezone, then you can apply your offset.
1
5
0
I need to know the current time at CDT when my Python script is run. However this script will be run in multiple different timezones so a simple offset won't work. I only need a solution for Linux, but a cross platform solution would be ideal.
how to find time at particular timezone from anywhere
1.2
0
0
1,946
2,154,946
2010-01-28T13:55:00.000
0
0
1
0
python,algorithm,list,linked-list
11,097,246
10
false
0
0
How about using any of data structures which provide sorted data access? Binary (AVL trees, AVL, Red-black), for instance? These guarantee O(log(N)) insertion complexity. Not O(1), but better than what you have.
2
8
0
I am looking for a linked list and related algorithms implementation for Python. Everyone I ask just recommends using built in Python lists, but performance measurements indicate that list insertion and removal is a bottleneck for our application. It's trivial to implement a simple linked list, but I wonder if there is a mature library which includes some operations like sort, merge, splice, search, lower/upper bound, etc... I know this is a dupe, but searching for python list on any search engine gives predictably poor results, with most people just saying that linked lists are unneeded in python (pfft!). PS: I need to insert and remove from anywhere in the list, not just the ends. OK, you asked for it: I need to maintain an ordered list of several hundred thousand entries. I will iterate over the list forwards (one by one), using a visitor on each entry, starting from the beginning or a position found by a binary search. When an entry matching a predicate is found it is removed from the list, and then, another binary search is performed on a subset of the list beginning from the removed entry's previous position, until a position determined statistically beforehand. Ignoring the error condition, the modified entry may be used to create another linked list which is spliced into the new position found through the second binary search. Iteration is continued from the position where the entry was removed. On occasion, several thousand contiguous ordered entries may be added to/removed from any place in the list. Sometimes several thousand non-contiguous entries must be searched for and removed incrementally. python's list is unnacceptable as the cost of insertion/removal is prohibitive, and the minor gains in speed for the binary search are totally irrelevant to the total cost. Our in house tests confirm this. if I have neglected any detail perhaps I can e-mail you a copy of my company's non-disclosure agreement and I can privately correspond with you on the matter. sarcasm.end().
Python linked list O(1) insert/remove
0
0
0
17,260
2,154,946
2010-01-28T13:55:00.000
1
0
1
0
python,algorithm,list,linked-list
4,052,959
10
false
0
0
For large data, keep a sorted list is a trick. Don't insert but append new items at the end and then sort it. Don't delet item but replace with a special value, sort them to the end and then pop out. For finding, a sorted list also has very quick performance with bisection method. As for small data, iterate old list, filter and build a new one, like list comprehensions method, is always the fast way. For me, what is large data? it should be over 1000000 items...
2
8
0
I am looking for a linked list and related algorithms implementation for Python. Everyone I ask just recommends using built in Python lists, but performance measurements indicate that list insertion and removal is a bottleneck for our application. It's trivial to implement a simple linked list, but I wonder if there is a mature library which includes some operations like sort, merge, splice, search, lower/upper bound, etc... I know this is a dupe, but searching for python list on any search engine gives predictably poor results, with most people just saying that linked lists are unneeded in python (pfft!). PS: I need to insert and remove from anywhere in the list, not just the ends. OK, you asked for it: I need to maintain an ordered list of several hundred thousand entries. I will iterate over the list forwards (one by one), using a visitor on each entry, starting from the beginning or a position found by a binary search. When an entry matching a predicate is found it is removed from the list, and then, another binary search is performed on a subset of the list beginning from the removed entry's previous position, until a position determined statistically beforehand. Ignoring the error condition, the modified entry may be used to create another linked list which is spliced into the new position found through the second binary search. Iteration is continued from the position where the entry was removed. On occasion, several thousand contiguous ordered entries may be added to/removed from any place in the list. Sometimes several thousand non-contiguous entries must be searched for and removed incrementally. python's list is unnacceptable as the cost of insertion/removal is prohibitive, and the minor gains in speed for the binary search are totally irrelevant to the total cost. Our in house tests confirm this. if I have neglected any detail perhaps I can e-mail you a copy of my company's non-disclosure agreement and I can privately correspond with you on the matter. sarcasm.end().
Python linked list O(1) insert/remove
0.019997
0
0
17,260
2,155,042
2010-01-28T14:11:00.000
1
0
1
1
python,windows,process
2,155,073
2
false
0
0
You could use py2exe to turn your Python program into a self-contained executable with whatever name that you choose to give it.
1
11
0
Windows Task Manager lists all running processes in the "Processes" tab. The image name of Python scripts is always python.exe, or pythonw.exe, or the name of the Python interpreter. Is there a nice way to change the image name of a Python script, other than changing the name of the Python interpreter?
Change process name of Python script
0.099668
0
0
5,268
2,155,509
2010-01-28T15:14:00.000
6
0
0
0
python,networking,encryption,cryptography,twisted
2,155,905
2
true
0
0
The protocol you described addresses one attack, that is the a replay attack. However, you are very vulnerable to MITM attacks. The TCP connection won't drop when the attacker moves in on the protocol. Further more anything transferred over this system can be sniffed. If you are on the wireless at a cafe everyone in the area will be able to sniff everything that is transmitted and then MITM the authenticated session. Another point is that sha1() is proven to be insecure you should use sha256 for anything security related. NEVER REINVENT THE WHEEL, especially when it comes to security. Use SSL! Everyone uses SSL and it has a LONG history of proven secuirty, and that is something you can't build. SSL Not only solved Man in the Middle Attacks but you can also use Certificates instead of passwords to authenticate both client and server which makes you immune to brute force. The sun will burn out before an attacker can brute force a 2048bit RSA certificate. Father more you don't have to worry about an eve dropper sniffing the transmission. Keep in mind that OpenSSL is FREE, generating certificates is FREE, and the singing of certificates is FREE. Although the only reason why you would want to sign a certificate is if you want to implement a PKI, which is probably not necessary. The client can have the server's public key hard coded to verify the connection. The server could have a database of client public keys. This system would be self contained and not require OCSP or CRL or any other part of a Public Key Infrastructure.
1
5
0
I wasn't sure how to phrase this question, so apologies in advance if it's a duplicate of something else. I wanted to sanity check how I've secured my twisted based application and think I've done a good job at it, but it's been over a decade since I've written anything that uses raw or managed sockets. Authentication transaction: Client connects and immediately a challenge response is sent back with a 16 character hex string. Client side takes user name & password, password is converted sha1( salt + sha1(password)) and credentials are sent back to the server as { username, password }. On the server side, authentication does standard lookup pattern ( if user exists and has password equal to input then grant ). If the connection between user & client is lost, the protocol class marks itself as dirty and disconnects itself from the user object. Any time after this point, to get access to the user object again, the client would have to repeat the authentication process with a new salt. Am I missing something? Is there a better/more secure approach for a character stream based protocol?
Basics of string based protocol security
1.2
0
0
797
2,156,559
2010-01-28T17:35:00.000
0
0
0
0
python,django,xapian,django-haystack
18,338,048
5
false
1
0
For solr backend I need to use _exact (just one underline instead of two).
3
5
0
I have a haystack search which has the following SearchIndex: class GrantIndex(indexes.SearchIndex): """ This provides the search index for the Grant application. """ text = indexes.CharField(document=True, use_template=True) year = indexes.IntegerField(model_attr='year__year') date = indexes.DateField(model_attr='date') program = indexes.CharField(model_attr='program__area') grantee = indexes.CharField(model_attr='grantee') amount = indexes.IntegerField(model_attr='amount') site.register(Grant, GrantIndex) If I want to search filtering out any programs that ARE NOT 'Health', I run the following query: from haystack.query import SearchQuerySet sqs = SearchQuerySet() sqs = sqs.filter(program='Health') Unfortunately, this also produces objects from the program 'Health\Other' and 'Health\Cardiovascular'. How do I stop the search from allowing those other programs in? I run Ubuntu 9.10 with Xapian as my search back-end.
Django Haystack exact filtering
0
0
0
2,527
2,156,559
2010-01-28T17:35:00.000
3
0
0
0
python,django,xapian,django-haystack
2,990,433
5
false
1
0
You've problably solved the problem already, but I just stumbled over the same problem with the Whoosh backend. Maybe the Xapian and Whoosh backends behave the same? Seems Whoosh is stemming all CharFields by default, and searching inside them with some kind of contains-query. Switching to a custom backend, without stemming enabled on CharFields, fixed this issue for me. Hopefully this will push someone else in the right direction.
3
5
0
I have a haystack search which has the following SearchIndex: class GrantIndex(indexes.SearchIndex): """ This provides the search index for the Grant application. """ text = indexes.CharField(document=True, use_template=True) year = indexes.IntegerField(model_attr='year__year') date = indexes.DateField(model_attr='date') program = indexes.CharField(model_attr='program__area') grantee = indexes.CharField(model_attr='grantee') amount = indexes.IntegerField(model_attr='amount') site.register(Grant, GrantIndex) If I want to search filtering out any programs that ARE NOT 'Health', I run the following query: from haystack.query import SearchQuerySet sqs = SearchQuerySet() sqs = sqs.filter(program='Health') Unfortunately, this also produces objects from the program 'Health\Other' and 'Health\Cardiovascular'. How do I stop the search from allowing those other programs in? I run Ubuntu 9.10 with Xapian as my search back-end.
Django Haystack exact filtering
0.119427
0
0
2,527
2,156,559
2010-01-28T17:35:00.000
0
0
0
0
python,django,xapian,django-haystack
8,370,572
5
false
1
0
use "prepare_data" for program field and get rid of health\blabla things
3
5
0
I have a haystack search which has the following SearchIndex: class GrantIndex(indexes.SearchIndex): """ This provides the search index for the Grant application. """ text = indexes.CharField(document=True, use_template=True) year = indexes.IntegerField(model_attr='year__year') date = indexes.DateField(model_attr='date') program = indexes.CharField(model_attr='program__area') grantee = indexes.CharField(model_attr='grantee') amount = indexes.IntegerField(model_attr='amount') site.register(Grant, GrantIndex) If I want to search filtering out any programs that ARE NOT 'Health', I run the following query: from haystack.query import SearchQuerySet sqs = SearchQuerySet() sqs = sqs.filter(program='Health') Unfortunately, this also produces objects from the program 'Health\Other' and 'Health\Cardiovascular'. How do I stop the search from allowing those other programs in? I run Ubuntu 9.10 with Xapian as my search back-end.
Django Haystack exact filtering
0
0
0
2,527
2,157,208
2010-01-28T19:13:00.000
3
0
1
0
python,gil
2,157,256
2
false
0
0
Yes, multithreading without locking almost always causes problems, with or without a GIL.
1
4
0
In python, I have a global variable defined that gets read/incremented by different threads. Because of the GIL, will this ever cause problems without using any kind of locking mechanism?
Python GIL and globals
0.291313
0
0
610
2,159,901
2010-01-29T04:38:00.000
-1
0
0
1
python,ide,editor,autocomplete,wxpython
2,159,924
8
false
0
0
try use brain to autocomplete... :) just joking. when I coding in in PyQt4, I open qt-assistant and search the manual, and wrap myclass like : MyButton = QPusuButton I think it is impossible to use autocomplete in python, because only in runtime the computer know what happens.
4
0
0
What editors or IDEs offer decent autocompletion for wxPython on Windows or Linux? Are there any? I tried several and support is either non-existant or limited.
wxPython autocomplete
-0.024995
0
0
1,719
2,159,901
2010-01-29T04:38:00.000
0
0
0
1
python,ide,editor,autocomplete,wxpython
2,160,186
8
false
0
0
Whatever the default windows IDE for Python is can autocomplete, with code not from the standard library.
4
0
0
What editors or IDEs offer decent autocompletion for wxPython on Windows or Linux? Are there any? I tried several and support is either non-existant or limited.
wxPython autocomplete
0
0
0
1,719
2,159,901
2010-01-29T04:38:00.000
1
0
0
1
python,ide,editor,autocomplete,wxpython
2,160,555
8
false
0
0
I use Eclipse/PyDev for wxPython development. I've been very satisfied with Eclipse for Python development productivity. It does have support for autocompletion for wxPython.
4
0
0
What editors or IDEs offer decent autocompletion for wxPython on Windows or Linux? Are there any? I tried several and support is either non-existant or limited.
wxPython autocomplete
0.024995
0
0
1,719
2,159,901
2010-01-29T04:38:00.000
1
0
0
1
python,ide,editor,autocomplete,wxpython
31,372,616
8
false
0
0
I'm partial to PyCharm. However, most IDEs will auto complete code based on what modules you've imported, so it's not specific to PyCharm.
4
0
0
What editors or IDEs offer decent autocompletion for wxPython on Windows or Linux? Are there any? I tried several and support is either non-existant or limited.
wxPython autocomplete
0.024995
0
0
1,719
2,161,197
2010-01-29T10:13:00.000
2
1
0
0
python,sms,at-command
2,161,275
4
false
0
0
Talking to the phone is easy. You just need to open the appropriate /dev/ttyACM* device and talk to it. Which phone is trickier. Any phone that supports "tethering" and the full AT command set for SMS messages should be fine.
2
13
0
Can anyone help me to send and receive SMS using AT commands in Python? In case it matters, I'm using Fedora 8. Which phone will be better with Linux (Nokia, Sony Ericson, Samsung,.....)? Will all phones support sending and receiving SMS using AT commands?
How to Send/Receive SMS using AT commands?
0.099668
0
0
53,296
2,161,197
2010-01-29T10:13:00.000
1
1
0
0
python,sms,at-command
48,543,135
4
false
0
0
I would suggest replace the time.sleep with condition loop waiting for the response from the modem "OK" before continue next state.
2
13
0
Can anyone help me to send and receive SMS using AT commands in Python? In case it matters, I'm using Fedora 8. Which phone will be better with Linux (Nokia, Sony Ericson, Samsung,.....)? Will all phones support sending and receiving SMS using AT commands?
How to Send/Receive SMS using AT commands?
0.049958
0
0
53,296
2,161,778
2010-01-29T12:13:00.000
1
0
0
0
python,wsgi
2,270,464
7
false
1
0
Also, you missed web.py, which is both small and supports code reload.
4
11
0
From what I can tell wsgiref - no code reload CherryPy - more than just the server mod_wsgi - all the apache overhead paste.httpserver - paste is a huge package with other stuff in it flup - same as paste, too much stuff. Spawning - never used it but seems lightweight enough. Tornado - not really wsgi + full "framework" Werkzeug - runcommand any others out there? which one you prefer?
which is a minimalistic python wsgi development server with support for code reload?
0.028564
0
0
4,339
2,161,778
2010-01-29T12:13:00.000
1
0
0
0
python,wsgi
2,161,869
7
false
1
0
So far I've been using CherryPy, and compared to Django (which, while not in your list, is the only other dev server I used) I like it heaps more. It does what is says: it is only there when you need it, and gets out of the way for the rest of the time. Using Django seemed like I needed to subscribe to the Django way of doing things. Although Django provides heaps more functionality out of the box (default admin interface, widgets on your webpages) , using CherryPy seems like just another import that has very good (often surprising you with extra) functionality.
4
11
0
From what I can tell wsgiref - no code reload CherryPy - more than just the server mod_wsgi - all the apache overhead paste.httpserver - paste is a huge package with other stuff in it flup - same as paste, too much stuff. Spawning - never used it but seems lightweight enough. Tornado - not really wsgi + full "framework" Werkzeug - runcommand any others out there? which one you prefer?
which is a minimalistic python wsgi development server with support for code reload?
0.028564
0
0
4,339
2,161,778
2010-01-29T12:13:00.000
1
0
0
0
python,wsgi
2,161,981
7
false
1
0
I'd recommend paste or CherryPy. They're the easiest to get up and running with.
4
11
0
From what I can tell wsgiref - no code reload CherryPy - more than just the server mod_wsgi - all the apache overhead paste.httpserver - paste is a huge package with other stuff in it flup - same as paste, too much stuff. Spawning - never used it but seems lightweight enough. Tornado - not really wsgi + full "framework" Werkzeug - runcommand any others out there? which one you prefer?
which is a minimalistic python wsgi development server with support for code reload?
0.028564
0
0
4,339
2,161,778
2010-01-29T12:13:00.000
0
0
0
0
python,wsgi
2,270,443
7
false
1
0
You can use paste.reloader with any wsgi-server, aside of other paste modules. # run paste reloader import paste.reloader as reloader reloader.install() # run wsgiref server from wsgiref import simple_server simple_server.make_server('', 8080, main_wsgi_app).serve_forever() Is that minimalistic enough?
4
11
0
From what I can tell wsgiref - no code reload CherryPy - more than just the server mod_wsgi - all the apache overhead paste.httpserver - paste is a huge package with other stuff in it flup - same as paste, too much stuff. Spawning - never used it but seems lightweight enough. Tornado - not really wsgi + full "framework" Werkzeug - runcommand any others out there? which one you prefer?
which is a minimalistic python wsgi development server with support for code reload?
0
0
0
4,339
2,163,765
2010-01-29T17:26:00.000
0
0
1
0
python,probability
2,163,823
2
false
0
0
explain better your problem, what operations and what elements you're focusing? regarding the problem with the elements beeing chosen more often, give each string an "chance multiplier", each comparison you multiply a number between 1 and 10 and the chance multiplyer of the string, if the result is higher than X (say... 5), so it select the string, if not, it searches for another string. this way, strings with higher multipliers will have more chance to be selected
1
2
0
Let's say I have a list in python with several strings in it. I do not know the size. How can I run a loop to do an operation on 2 random elements of this string? What if I wanted to favour a certain subset of the strings in this randomization, to be selected more often, but still make it possible for them to not be chosen?
How can I run a loop against 2 random elements from a list at a time?
0
0
0
147
2,165,172
2010-01-29T21:09:00.000
22
0
1
0
python
2,165,206
6
true
0
0
Python strings are immutable, which means that they do not support item or slice assignment. You'll have to build a new string using i.e. someString[:3] + 'a' + someString[4:] or some other suitable approach.
2
16
0
In python, are strings mutable? The line someString[3] = "a" throws the error TypeError: 'str' object does not support item assignment I can see why (as I could have written someString[3] = "test" and that would obviously be illegal) but is there a method to do this in python?
Replacing one character of a string in python
1.2
0
0
20,916
2,165,172
2010-01-29T21:09:00.000
4
0
1
0
python
2,165,263
6
false
0
0
In new enough pythons you can also use the builtin bytearray type, which is mutable. See the stdlib documentation. But "new enough" here means 2.6 or up, so that's not necessarily an option. In older pythons you have to create a fresh str as mentioned above, since those are immutable. That's usually the most readable approach, but sometimes using a different kind of mutable sequence (like a list of characters, or possibly an array.array) makes sense. array.array is a bit clunky though, and usually avoided.
2
16
0
In python, are strings mutable? The line someString[3] = "a" throws the error TypeError: 'str' object does not support item assignment I can see why (as I could have written someString[3] = "test" and that would obviously be illegal) but is there a method to do this in python?
Replacing one character of a string in python
0.132549
0
0
20,916
2,165,200
2010-01-29T21:13:00.000
1
0
1
0
python,metaclass
2,165,257
4
false
0
0
You can't edit the class directly like you might with javascript's prototype attribute, it's better if you subclass them. This let's you add the functionality you want and not force it to be used everywhere.
2
3
0
I'd like to modify all classes in Python. For example str and int and others like Person(object). I'd like to add an attribute to them and to change the way its methods works. Which is the best approach for this? Metaclasses?
Modifying a Python class
0.049958
0
0
4,189
2,165,200
2010-01-29T21:13:00.000
3
0
1
0
python,metaclass
2,165,399
4
false
0
0
While you can do this for classes defined in python code (it will not work for builtin ones) by reassigning their attributes please do not actually do so. Just subclass and use the subclass, or write functions that take an instance of the class as argument instead of adding your own methods. Doing what you have to mind leads to awkward, fragile code, especially if you end up using multiple libraries simultaneously that try to do this to the same classes. Is there an actual problem you're trying to solve this way?
2
3
0
I'd like to modify all classes in Python. For example str and int and others like Person(object). I'd like to add an attribute to them and to change the way its methods works. Which is the best approach for this? Metaclasses?
Modifying a Python class
0.148885
0
0
4,189
2,165,517
2010-01-29T22:08:00.000
0
1
0
0
python,hotmail
2,458,380
3
false
0
0
use octazen, but you have to pay for it
1
2
0
How can I retrieve contacts from hotmail with python? Is there any example?
How do I retrieve Hotmail contacts with python
0
0
1
1,864
2,168,409
2010-01-30T15:47:00.000
0
0
0
1
python,google-app-engine,facebook,macos
29,235,036
5
false
1
0
In Android Studio with Google App Engine plugin. Just add httpAddress = '0.0.0.0' to app cfg in build.grade file.
1
10
0
Can access AppEngine SDK sites via local ip-address when localhost works just fine and a MacOSX using the GoogleAppEngineLauncher. I'm trying to setup facebook development site (using a dyndns.org hostname pointing at my firewall which redirects the call to my mac book). It seems like GoogleAppEngineLauncher defaults to localhost and blocks access to the ip-address directly. Is there a way to change that behaviour in GoogleAppEngineLauncher? Is this some kind of limitation built in by Google? It doesn't seem to be an issue of configuration, because there isn't any settings for this. So I'm guessing patching the source will be required?
Can access AppEngine SDK sites via local ip-address when localhost works just fine and a MacOSX
0
0
0
6,718
2,168,793
2010-01-30T17:48:00.000
0
0
1
0
python,nlp,nltk
2,226,080
3
false
0
0
Alex is right, start with the docs, and figure out which corpus reader will work for your corpus. The simple instantiate it, given the path to your corpus file(s). As you'll see in the docs, the builtin corpora are simply instances of particular corpus reader classes. Look thru the code in the nltk.corpus package should be helpful as well.
2
4
0
I have recently expanded the names corpus in nltk and would like to know how I can turn the two files I have (male.txt, female.txt) in to a corpus so I can access them using the existing nltk.corpus methods. Does anyone have any suggestions? Many thanks, James.
How can I create my own corpus in the Python Natural Language Toolkit?
0
0
0
6,842
2,168,793
2010-01-30T17:48:00.000
1
0
1
0
python,nlp,nltk
2,355,858
3
false
0
0
Came to understand how corpus reading works by looking at the source code in nltk.corpus and then looking at the corpora (located in /home/[user]/nltk_data/corpora/names - this will probably be in My Documents for XP and somewhere in User for Win7 users). The structure of the corpus and its related function will give a good understanding of how to use the different corpora available in NLTK. In my case I looked at the names variable in nltk.corpus' source code and was interested in the WordListCorpusReader function as the names corpus is simply a list of words.
2
4
0
I have recently expanded the names corpus in nltk and would like to know how I can turn the two files I have (male.txt, female.txt) in to a corpus so I can access them using the existing nltk.corpus methods. Does anyone have any suggestions? Many thanks, James.
How can I create my own corpus in the Python Natural Language Toolkit?
0.066568
0
0
6,842
2,169,449
2010-01-30T21:12:00.000
0
0
0
0
python,mysql,c
2,169,464
2
false
0
0
It's the adaptor that sits between the Python MySQLdb module and the C libmysqlclient library. One of the most common reasons for it not loading is that the appropriate libmysqlclient library is not in place.
1
1
0
Why is _mysql in the MySQLdb module a C file? When the module tries to import it, I get an import error. What should I do?
Importing _mysql in MySQLdb
0
1
0
1,242
2,170,990
2010-01-31T08:01:00.000
0
1
0
0
python,authentication,mediawiki
2,456,365
5
false
1
0
All you need to do is essentially forward the session, cookies and all, to the API as if it's the user querying. How would one go about doing that? I can access the API directly and see my login info, but if I access it via PHP, it shows me as not being logged in (anonymous user id "0"). How do I forward the session, cookies, etc. to the API via PHP to show the user's info?
1
4
0
Here is the situation: I have a Mediawiki installation, and a few additional server-side scripts that require more resources and were already written in a different language (python). The python code will be very loosely coupled with the Mediawiki code (only called by clicking on a link here or there) What I would like is that when a GET or POST command is sent to the server to execute a python script, I would like to check to see if a user is already logged in to Mediawiki. If not, I would like to just redirect them to the Mediawiki login page. Any ideas? There are several articles on integrating Mediawiki with other PHP frameworks like Drupal and forum software, but that is more than I need. What is the best way to do this? -check for cookies somehow (is this secure?) -does the Mediawiki database keep track of who is logged in? Thanks
How to check if a user is logged on in mediawiki in a different app?
0
0
0
4,553
2,171,072
2010-01-31T08:45:00.000
0
0
0
0
python,mysql
2,171,104
2
false
0
0
It looks like query is formed with wrong syntax. Could you display string parameter of cursor.execute?
1
0
0
I am attempting to execute the following query via the mysqldb module in python: for i in self.p.parameter_type: cursor.execute("""UPDATE parameters SET %s = %s WHERE parameter_set_name = %s""" % (i, float(getattr(self.p, i)), self.list_box_parameter.GetStringSelection())) I keep getting the error: "Unknown column 'M1' in 'where clause'". I want to update columns i with the value getattr(self.p, i), but only in rows that have the column parameter_set_name equal to self.list_box_parameter.GetStringSelection(). The error suggests that my query is looking for columns by the name 'M1' in the WHERE clause. Why is the above query incorrect and how can I correct it?
Trouble with MySQL UPDATE syntax with the module mysqldb in Python
0
1
0
375
2,171,746
2010-01-31T13:07:00.000
0
0
0
0
python,module,pygame
2,176,010
2
false
0
1
I assumed that my python C module can access pygame stuff directly in C. Is this the case? No, that stuff is most likely just there because it was necessary to compile the pygame Python extension. I don't understand what you mean when you say you see 2 pygame instances. There are as many instances as you create, no more, no less. If you have script that creates pygame objects, and your extension also creates pygame objects, then of course you will have 2 sets of objects. As the writer of the application you need to decide which part of it will have responsibility for interfacing with pygame. If the other part requires access to those pygame objects, then you pass them in as arguments.
1
1
0
In my Python2_6/include directory is a folder with pygame headers. I assumed that my python C module can access pygame stuff directly in C. Is this the case? How do I integrate a C module that wants to use pygame, with a python script using pygame? Right now my brain sees: pygame <-- MyCModule <-- MyScript --> pygame ie. Two pygame instances. So is it possible to integrate them so that my module and my app use the same instance? Why are there pygame headers in my python include directory, can I use those somehow, for direct access? Thanks for any help.
Integrating pygame with a C module
0
0
0
390
2,171,820
2010-01-31T13:32:00.000
3
0
0
0
python,django,django-admin
2,171,917
2
false
1
0
+1 for custom app, hacking admin can take more time than just putting together your own admin from generic views.
1
4
0
I'm building a simple app, a sort of project/tasks manager where I can have several projects and several tasks that are assigned to one project. I enabled Django admin for all this sort of tasks and it's working like a charm. Also, I have some users that have projects assigned to them. So what I want now is to enable a cut down version of the admin for those users, where: They can only manage/see tasks within their own project. They can only delete their own tasks some other minor restrictions. What would be the best approach to this? Should I create another app with custom views and pages for client editing tasks or should I drop another admin instance and fine-tune it just for them? I hope it was clear and not too subjective. Thanks.
How to implement a client admin in Django?
0.291313
0
0
537
2,171,902
2010-01-31T13:58:00.000
0
0
0
1
python,datetime,time,licensing
2,171,940
3
false
0
0
Nearly every standard function will return the machine time that can be adjusted by the user. One possibility is to call a web service that returns the "correct" time. But this is only possible if you can assume internet access. And may be should ask your self the question if that hassle is really worth the effort?
1
2
0
I'm searching for a way to generate a (limited time license) .so when a user starts the program . it has to check license date first before the program runs. but the problem is : i tried a couple of solutions . one of them is python's time.ctime , (to check time and see if it's realy during the license time) and it returns the time of the machine, so whenever a user want to use software without license he'll just change time of the machine. i hope the idea is clear enough any better ideas? please inform me if you want more explanation
python how to -generate license- using time module
0
0
0
1,108
2,173,212
2010-01-31T20:37:00.000
1
1
0
0
eclipse,unit-testing,pydev,python-unittest
2,220,154
3
false
0
0
Go to the preferences and type in keys to get to the keyboard shortcut definition page (I think it's called keys... sorry not on my dev machine right now). In this dialog you can search for commands. See if there is a run all tests command (it might help to find the run tests you are currently using first). If there is check out the shortcut or define your own.
1
7
0
I know Ctrl + F9 runs a single file. How to run them all? If there is no such thing, how to bind one keyboard shortcut to it?
What is the keyboard shortcut to run all unit tests in the current project in PyDev + Eclipse?
0.066568
0
0
5,179
2,173,985
2010-02-01T00:15:00.000
2
0
1
0
python,windows-7,numpy,windows-7-x64
2,182,498
3
true
0
0
Numpy is not supported on python 2.5 for Windows 64 bits, you need at least python 2.6, and even in that case, you need to build it by yourself, or use something like EPD or the installer given in link given by thor. NumPy cannot be used in Google App Engine, so I am not sure to understand the argument there.
1
4
0
NumPy installer can't find python path in the registry. Cannot install Python version 2.5 required, which was not found in the registry. OK I have to modify the registry? I already modified %PATH% to point to the Python25 installation directory.
How to install NumPy on Windows 64?
1.2
0
0
21,387
2,174,015
2010-02-01T00:27:00.000
2
0
1
0
python,regex,nested,expression
2,174,057
6
false
0
0
Either a table-driven parser as Alex Martelli suggests or a hand-written recursive descent parser. They're not hard and quite rewarding to write.
1
3
0
I am using Python 2.6.4. I have a series of select statements in a text file and I need to extract the field names from each select query. This would be easy if some of the fields didn't use nested functions like to_char() etc. Given select statement fields that could have several nested parenthese like "ltrim(rtrim(to_char(base_field_name, format))) renamed_field_name," or the simple case of just "base_field_name" as a field, is it possible to use Python's re module to write a regex to extract base_field_name? If so, what would the regex look like?
recursive nested expression in Python
0.066568
0
0
2,080
2,174,873
2010-02-01T05:43:00.000
0
0
0
0
python,coding-style,tabs,pygtk
2,786,548
2
false
0
1
Just for the record, if you are going to create something similar to a gtk.Notebook, I'll recomment you to subclass gtk.Notebook to save a lot of work.
2
1
0
I'm writing a program and I need some extra functionality from the gtk.Notebook widget, so I have taken to creating my own. My only problem is styling my tabs so that they look like the tabs in gtk.Notebook and will change according to the user's theme. I really don't know where to start so any advice would be much appreciated, thanks :)
PyGTK: How do I make a custom widget look like a gtk.Notebook tab?
0
0
0
682
2,174,873
2010-02-01T05:43:00.000
0
0
0
0
python,coding-style,tabs,pygtk
2,212,682
2
true
0
1
I solved the problem eventually by getting the colours from gtk.Notebook's style.
2
1
0
I'm writing a program and I need some extra functionality from the gtk.Notebook widget, so I have taken to creating my own. My only problem is styling my tabs so that they look like the tabs in gtk.Notebook and will change according to the user's theme. I really don't know where to start so any advice would be much appreciated, thanks :)
PyGTK: How do I make a custom widget look like a gtk.Notebook tab?
1.2
0
0
682
2,174,904
2010-02-01T05:50:00.000
0
0
0
0
python,eclipse,wxpython
2,182,198
3
false
0
1
The best kludge I found was the Kubuntu global shortcut "Ctrl-Shift-Space". This moves a window to the other screen, mitigating the hassle of dragging with the mouse.
2
0
0
I currently have a dual-monitor setup with Eclipse on monitor 2. When I run the code that launches the wxPython GUI, I would like for this GUI to appear on monitor 1. Currently, the GUI consistently appears on monitor 2, covering Eclipse, and I have to drag it to monitor 1 every time. Is there a solution to this problem -- either a configuration change I can make in Eclipse or some addition I can make to the GUI code?
Making wxPython GUI launch on a different screen from Eclipse
0
0
0
441
2,174,904
2010-02-01T05:50:00.000
0
0
0
0
python,eclipse,wxpython
2,189,730
3
true
0
1
Kludge #2: If I run the code from Eclipse on screen 2 then click someplace on screen 1 before the GUI appears, the GUI will appear on screen 1.
2
0
0
I currently have a dual-monitor setup with Eclipse on monitor 2. When I run the code that launches the wxPython GUI, I would like for this GUI to appear on monitor 1. Currently, the GUI consistently appears on monitor 2, covering Eclipse, and I have to drag it to monitor 1 every time. Is there a solution to this problem -- either a configuration change I can make in Eclipse or some addition I can make to the GUI code?
Making wxPython GUI launch on a different screen from Eclipse
1.2
0
0
441
2,175,377
2010-02-01T08:13:00.000
0
0
0
0
python,django,cherokee,scgi
2,236,822
1
false
1
0
I dropped all tables from the database, upgraded to last version of django-mingus after having deleted some dependencies to get them clean installed and I launched the scgi process using a shell script that activate the virtual environment before. Now everything seems to be stable.
1
1
0
I have a django-mingus blog running perfectly fine with the integrated development web server of django. It's installed in a virtualenv. Once deployed using the django app wizard of cherokee 0.99.42 the admin pannel is displaying a strange behaviour. Sometimes all apps are displayed in the admin pannel sometime only a subset of the apps are displayed. It's always the same apps that disapear from the main admin view. The manage.py runfcgi command is launched through the python interpreter installed in the virtualenv. Do you have a method to track that kind of problem ? Could it be related to environment variable that are not set correctly ? EDIT: Could this be a circular import problem ? 2nd EDIT: The same problem occur with nginx. Adding Debug=True to the ./manage.py runfcgi command make the setup stable.
Problem deploying Django-Mingus with Flup and Cherokee. Strange admin behaviour
0
0
0
298
2,175,573
2010-02-01T09:01:00.000
0
1
1
0
python,cocoa,macos,pyobjc
2,176,578
8
false
0
0
You're going to need Objective-C: that's what all the tutorials, documentation, sample code, and everything is written in. In addition to a wilder variety of people being able to help you. So learn ObjC first. If, on your second or third project, or a year down the road, you start a project that needs a Python module (like, say, Twisted, or SQLAlchemy. But a SERIOUS need like foundation of your app need, where the extra boost your app gets makes everything worth it), then you can write a PyObjC app and get a lot of the speed benefits of that language, with your background in Cocoa.
3
13
0
I know some Python and I'm really impressed by the language's ease of use. From what I've seen of Objective-C it looks a lot less pretty, but it seems to be the lingua franca for Mac OS X development (which means it has better documentation). I'm thinking about starting Mac development - will using PyObjC+Python make me a second class citizen?
What are the downsides of using Python instead of Objective-C?
0
0
0
3,245
2,175,573
2010-02-01T09:01:00.000
2
1
1
0
python,cocoa,macos,pyobjc
2,175,875
8
false
0
0
Second class citizen seems a bit strong. The Objective-C API's are available from Python as well, should you need them, and that's mostly if you want to make Cocoa apps. But then they are restricted to OS X anyway. Personally, I have no interest in building apps that isn't cross-platform, but that's me. That also means I haven't actually done this, so I don't know how tricky it is, but there was an article in the Python Magazine not long ago, and it didn't look that horrible. The major drawback of Python is execution time, and that mainly comes from it being a dynamic language. This can be solved with Cython and C-extensions, etc, but then you get a mix of Python + ObjectiveC API's + Cython which can be daunting. So it depends a lot of what kinds of applications you are going to make. Something uniquely OSX-ish that makes no sense anywhere else? ObjectiveC is probably the ticket. Cross-platform servers, well then Python rocks! Something else? Then it depends.
3
13
0
I know some Python and I'm really impressed by the language's ease of use. From what I've seen of Objective-C it looks a lot less pretty, but it seems to be the lingua franca for Mac OS X development (which means it has better documentation). I'm thinking about starting Mac development - will using PyObjC+Python make me a second class citizen?
What are the downsides of using Python instead of Objective-C?
0.049958
0
0
3,245
2,175,573
2010-02-01T09:01:00.000
3
1
1
0
python,cocoa,macos,pyobjc
2,176,187
8
false
0
0
DO NOT ATTEMPT to avoid learning objective-C if you're going to write apps for the Mac. The purpose of PyObjC and the other language bindings is to let you re-use existing libraries in your apps, not to let you avoid learning the native tools.
3
13
0
I know some Python and I'm really impressed by the language's ease of use. From what I've seen of Objective-C it looks a lot less pretty, but it seems to be the lingua franca for Mac OS X development (which means it has better documentation). I'm thinking about starting Mac development - will using PyObjC+Python make me a second class citizen?
What are the downsides of using Python instead of Objective-C?
0.07486
0
0
3,245
2,176,053
2010-02-01T10:44:00.000
0
0
1
0
python
2,176,058
5
false
0
0
The currently executing interpreter is available in sys.executable. You can just pass that explicitly to subprocess.Popen as the first argument, or pass it as the 'executable' argument.
1
1
0
I have a python script, which is executing again 4-5 python scripts. For performance reasons i want to use same interpreter for executing all the script. How could I handle this issue?
Python: Execute multiple Scripts simultaneously from same Interpreter
0
0
0
5,764
2,179,395
2010-02-01T19:19:00.000
2
0
1
0
python,jython
2,191,492
3
false
1
0
I use Jython in testing and rapid-development. From my point of view it is stable.
2
5
0
I am planning to use Jython with Django. I want to know how stable the Jython project is, how easy to use it is, and how large its developer community is.
Using Jython with Django?
0.132549
0
0
462
2,179,395
2010-02-01T19:19:00.000
3
0
1
0
python,jython
2,181,008
3
false
1
0
I have not used Django with Jython, so I can't speak to that specific issue, but I've used Jython for other things and I've found it quite stable of late, and just as easy as plain Python. I believe the "core committers" in Jython are substantially fewer than in C-Python (maybe 1/3 the number or less), if that's what you mean by "developer community", but I'm not quite sure what's the point in asking about this -- are you considering joining either developer community (Jython or Core Python) and wondering where you could have the best impact? If that's the case, I think the key issue isn't really how many others are already helping out, but, "what do you bring to the party" -- if you're a JVM wizard, or an expert at any important Java framework, you could be a real boon to the Jython community while that same skill would help much less in the C-Python community; vice versa, if you're a wizard, say, with autoconfigure and C-coded system calls, that would be precious for the C-Python community, but not as useful for the Jython community.
2
5
0
I am planning to use Jython with Django. I want to know how stable the Jython project is, how easy to use it is, and how large its developer community is.
Using Jython with Django?
0.197375
0
0
462
2,180,156
2010-02-01T21:17:00.000
0
1
0
1
python,solaris,getrusage
2,193,909
2
false
0
0
Well...you can pull it from the pmap application by calling pmap -x. But I was looking more for a way to access the info directly in /proc from my app. The only way to do it is to access the /proc/<pid>/xmap file. Unfortunately, the data is stored as an array of prxmap structs...so either a Python C-module is in order or using the ctypes module. I'll post an update when I get one of those written.
1
1
0
Calling resource.getrusage() from Python returns a 0 value for resident set size on Solaris and Linux systems. On Linux you can pull the RSS From /proc//status instead. Does anybody have a good way to pull RSS on Solaris, either similar or not to the Linux workaround?
How can I grap resident set size from Python on Solaris?
0
0
0
479
2,180,299
2010-02-01T21:45:00.000
4
0
1
0
python,random
43,429,228
5
false
0
0
From the code in Antimony's answers it is easy to see that random.random() never returns exactly 1.0 on platforms that have at least 53 bit mantissa for calculations involving constants not annotated with 'f' in C. That's the precision IEEE 754 prescribes and is standard today. However, on platforms with lower precision, for example if Python is compiled with -fsingle-precision-constant for use on an embedded platform, adding b to a*67108864.0 can result in rounding up to 2^53 if b is close enough to 2^26 and this would mean that 1.0 is returned. Note that this happens regardless of what precision Python's PyFloat_FromDouble function uses. One way to test for this would be to check a few hundred random numbers whether the 53rd bit is ever 1. If it is 1 at least once this proofs sufficient precision and you are fine. If not, rounding is the most likely explanation meaning that random.random() can return 1.0. It's of course possible that you were just unlucky. You can push the certainty as high as you want by testing more numbers.
1
19
0
Does python's random.random() ever return 1.0 or does it only return up until 0.9999..?
Range of python's random.random() from the standard library
0.158649
0
0
26,013
2,181,209
2010-02-02T00:54:00.000
0
0
1
0
python,multiprocessing
2,181,412
2
false
0
0
Try importing the ctypes module and looking for pthread_schedparam() or SetThreadPriority() (Linux / Windows).
1
13
0
Does anyone know of an easy way to set the niceness value of a Process or Pool when it is created in multiprocessing?
Multiprocessing and niceness value
0
0
0
2,306
2,182,512
2010-02-02T07:42:00.000
0
0
0
0
python,django
2,182,519
2
false
1
0
Not as shown. Use the ifequal and with template tags instead.
1
1
0
All, Can t we do the following in templates {% if subject.id == selected_id %} and also cannot we assign variable like {{selected="selected"}} Thank........
Django templates condition check
0
0
0
3,034
2,183,786
2010-02-02T12:00:00.000
1
0
1
0
python,regex,validation
2,183,799
3
false
0
0
int() and check for exceptions float() - but what do you mean float? int() and then check using if using datetime formatting
1
1
0
I want to do the following with python: Validate if a UTF8 string is an integer. Validate if a UTF8 string is a float. Validate if a UTF8 string is of length(1-255). Validate if a UTF8 string is a valid date. I'm totally new to python and I believe this should be done with regular expression, except maybe for the last one. Your help is appreciated!
python regular expression to validate types of strings
0.066568
0
0
1,739
2,185,177
2010-02-02T15:27:00.000
2
1
0
0
python,algorithm,genetic-algorithm,evolutionary-algorithm,traveling-salesman
2,185,816
3
false
0
0
If your problem is that peaks remain for over one thousand generations, then the problem might not be with the crossover and mutation operators. You might not be introducing or keeping enough variation to your population: I would examine the proportions of crossovers, of mutations, and of survivors from one generation to the next, and possibly raise the proportion of mutations.
1
5
0
I'm building a genetic algorithm to tackle the traveling salesman problem. Unfortunately, I hit peaks that can sustain for over a thousand generations before mutating out of them and getting better results. What crossover and mutation operators generally do well in this case?
Suggested GA operators for a TSP problem?
0.132549
0
0
2,732
2,185,329
2010-02-02T15:45:00.000
0
0
0
1
python,apache-flex,pylons,twisted
2,258,476
1
false
1
0
I'm working on webapp which has client-side UI coded in Flex 3 and backend is Pylons app. Our client communicates with backend using HTTP GET and POST requests, POST request bodies and all response bodies carry data in JSON format. Works well, just few gotchas: Flex apps cannot do PUT and DELETE requests. We work around this by doing POST requests and specifying the "real" intended method in X-HTTP-Method-Override header. Then we have some extra routes in routing configuration that handle these requests and treat them as normal PUTs and GETs. Flex apps can send custom HTTP headers but cannot read custom headers received from server (well they can on IE, but cannot on Firefox and Chrome, IIRC).
1
0
0
Has anyone used Python/Pylons as the server backend for a Flex 3 application? Does anyone have any thoughts on how well this would work? I read Bruce Eckel's article about tying Flex 3 to Twisted, and I've done Twisted programming, but for just a web service I think Pylons is simpler to use. Thanks in advance, Doug
Pylons and Flex 3
0
0
0
251
2,187,115
2010-02-02T19:45:00.000
1
0
0
0
python,ajax,mako,turbogears2
2,187,227
1
true
1
0
jQuery, YUI, Prototype, Dojo, and MooTools all set the header X-Requested-With: XMLHttpRequest. You should be able to check for that header.
1
0
0
How do I go about checking if a request is an ajax request in a controller method in Turbogears? Further, is it possible to return a 'partial' much like in rails or symfony if the request is an ajax request. I know about the json decorator but I need a way to return a partial of a mako template (because I need to format the data and don't want to to do it all in Javascript). For example if I want to return the formatted list for page two of a list of news stories, I do not want to return the entire page (but rather just the formatted list). Thanks
how to check if request is ajax in turbogears
1.2
0
0
1,369
2,187,135
2010-02-02T19:49:00.000
1
0
1
0
python,range,numbers,xrange
2,187,235
9
false
0
0
range(x) returns a list.Python lists cant contain that many elements. You should use xrange() to iterate through those digits if you need to do trillions of cycles.?
2
12
0
range() and xrange() work for 10-digit-numbers. But how about 13-digit-numbers? I didn't find anything in the forum.
range and xrange for 13-digit numbers in Python?
0.022219
0
0
12,305
2,187,135
2010-02-02T19:49:00.000
0
0
1
0
python,range,numbers,xrange
2,187,340
9
false
0
0
The difference between range() and xrange() is that the first returns the entire list, while the second returns a generator that generates each number as it is needed. The second one should work for any number, no matter how large. In Python 3.0, xrange() has disappeared and range() behaves like xrange() did previously.
2
12
0
range() and xrange() work for 10-digit-numbers. But how about 13-digit-numbers? I didn't find anything in the forum.
range and xrange for 13-digit numbers in Python?
0
0
0
12,305
2,187,561
2010-02-02T20:47:00.000
1
0
0
0
python,django,django-templates
2,187,606
2
false
1
0
0x94 is not part of î in UTF-8. The UTF-8 encoding for î is 0xc3 0xae.
2
2
0
I'm trying to send a django email with UTF-8 characters in the template, specifically: S'il vous plaît I get the error: UnicodeDecodeError: 'utf8' codec can't decode byte 0x94 in position 147: unexpected code byte When trying to encode the special "î" character (that is the character at that position.) Here is my code for generating the email body: template = loader.get_template('french_thank_you.html')
How can I render a Django template that has UTF8 characters in it?
0.099668
0
0
4,616
2,187,561
2010-02-02T20:47:00.000
6
0
0
0
python,django,django-templates
2,187,613
2
true
1
0
The editor you're using has saved the file using Mac Roman encoding. Open the template, re-save it as UTF-8, and it should work fine.
2
2
0
I'm trying to send a django email with UTF-8 characters in the template, specifically: S'il vous plaît I get the error: UnicodeDecodeError: 'utf8' codec can't decode byte 0x94 in position 147: unexpected code byte When trying to encode the special "î" character (that is the character at that position.) Here is my code for generating the email body: template = loader.get_template('french_thank_you.html')
How can I render a Django template that has UTF8 characters in it?
1.2
0
0
4,616
2,187,583
2010-02-02T20:50:00.000
51
0
1
0
python,namespaces
2,187,636
3
true
0
0
It has two purposes: Anybody who reads the source will know what the exposed public API is. It doesn't prevent them from poking around in private declarations, but does provide a good warning not to. When using from mod import *, only names listed in __all__ will be imported. This is not as important, in my opinion, because importing everything is a really bad idea.
1
27
0
I've seen it a lot in python/Lib source code but I don't know what it is for. I thought it was used to limit accessible members of of a module. So only the elements at __all__ will show up when dir(module). I did a little example and saw it was not working as I expected. So... What's the python __all__ module level variable for?
What's the python __all__ module level variable for?
1.2
0
0
17,072