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,059,337
2010-01-13T18:52:00.000
0
1
0
1
python,ruby,linux,scripting,release
4,454,448
4
false
1
0
One downside of doing an svn update: though you can go back in time, to what revision do you go back to? You have to look it up. svn update pseudo-deployments work much cleaner if you use tags - in that case you'd be doing an svn switch to a different tag, not an svn update on the same branch or the trunk. You want ...
3
1
0
I am purely a windows programmer and spend all my time hacking VC++. Recently I have been heading several web based applications and myself built applications with python (/pylons framework) and doing projects on rails. All the web projects are hosted on ubuntu linux. The RELEASE procedures and check list we followed...
Practices while releasing the python/ruby/script based web applications on production
0
0
0
242
2,059,337
2010-01-13T18:52:00.000
2
1
0
1
python,ruby,linux,scripting,release
2,059,406
4
false
1
0
Is SVN checkout and svn update are the right methods to update the latest build files into the server? Very, very good methods. You know what you got. You can go backwards at any time. Are there any downside in using svn update? None. Any better method to release the script/web based scripts into the production ser...
3
1
0
I am purely a windows programmer and spend all my time hacking VC++. Recently I have been heading several web based applications and myself built applications with python (/pylons framework) and doing projects on rails. All the web projects are hosted on ubuntu linux. The RELEASE procedures and check list we followed...
Practices while releasing the python/ruby/script based web applications on production
0.099668
0
0
242
2,059,455
2010-01-13T19:07:00.000
0
0
0
0
python,xml,sax
2,059,524
1
true
0
0
Expat can be stopped and is resumable. AFAIK Python SAX parser uses Expat. Does the API really not expose the stopping stuff to the Python side?? EDIT: nope, looks like the parser stopping isn't available from Python...
1
1
0
I am pretty sure the answer is no but of course there are cleverer guys than me! Is there a way to construct a lazy SAX based XML parser that can be stopped (e.g. raising an exception is a possible way of doing this) but also resumable ? I am looking for a possible solution for Python >= 2.6 with standard XML libraries...
Lazy SAX XML parser with stop/resume
1.2
0
1
1,020
2,059,685
2010-01-13T19:43:00.000
1
0
1
0
python,c,ipc
2,059,797
2
true
0
0
You can certainly use the C API to do what you want. You'll create a class in C, which can hold onto any memory it wants. That memory doesn't have to be exposed to Python at all if you don't want. If you are comfortable building C DLLs, and don't need to perform Python operations in C, then ctypes might be your best ...
1
2
0
I'm considering integrating some C code into a Python system (Django), and I was considering using the Python / C API. The alternative is two separate processes with IPC, but I'm looking into direct interaction first. I'm new to Python so I'm trying to get a feel for the right direction to take. Is it possible for a ca...
Python C API and data persistent in memory?
1.2
0
0
406
2,060,341
2010-01-13T21:16:00.000
1
0
0
0
python,design-patterns,oop
2,060,509
6
false
1
0
For web applications, understanding at least at a rudimentary level the patterns described in Patterns of Enterprise Application Architecture has proven valuable to me. Gang of Four patterns are worth knowing, too. But I would argue that you simply don't need encyclopedic knowledge of patterns to get started. A cursory...
5
5
0
What are the design patterns that I should be completely familiar with? And what is one easy example that each can be used for? I am a web developer (I use Django, and is familiar with separation of logic), but I work at a Desktop-app company. They are always talking about singletons, and I forget...but it leaves me n...
How important are design patterns in web development?
0.033321
0
0
1,248
2,060,341
2010-01-13T21:16:00.000
1
0
0
0
python,design-patterns,oop
2,060,471
6
false
1
0
Knowing design patterns won't be much use until you know why they are the best strategy for a given problem. Learning design patterns from the very beginning is probably fine, except you've missed all the "wrong" ways to solve that problem, which in turn means you may be missing subtle difference in when to use the giv...
5
5
0
What are the design patterns that I should be completely familiar with? And what is one easy example that each can be used for? I am a web developer (I use Django, and is familiar with separation of logic), but I work at a Desktop-app company. They are always talking about singletons, and I forget...but it leaves me n...
How important are design patterns in web development?
0.033321
0
0
1,248
2,060,341
2010-01-13T21:16:00.000
0
0
0
0
python,design-patterns,oop
2,060,411
6
false
1
0
MVVM is a newer one I have seen used with Silverlight. It's a bit much, but it seems effective.
5
5
0
What are the design patterns that I should be completely familiar with? And what is one easy example that each can be used for? I am a web developer (I use Django, and is familiar with separation of logic), but I work at a Desktop-app company. They are always talking about singletons, and I forget...but it leaves me n...
How important are design patterns in web development?
0
0
0
1,248
2,060,341
2010-01-13T21:16:00.000
2
0
0
0
python,design-patterns,oop
2,060,409
6
false
1
0
Honestly, patterns are important but knowing when to use them is just as important. There is never going to be any set answer it is something you need to feel out for yourself. People that fight about it being an absolute where you should always use them or always not use them are incorrect. Design patterns are a t...
5
5
0
What are the design patterns that I should be completely familiar with? And what is one easy example that each can be used for? I am a web developer (I use Django, and is familiar with separation of logic), but I work at a Desktop-app company. They are always talking about singletons, and I forget...but it leaves me n...
How important are design patterns in web development?
0.066568
0
0
1,248
2,060,341
2010-01-13T21:16:00.000
10
0
0
0
python,design-patterns,oop
2,060,384
6
true
1
0
Forget Singleton. It's confusing and rarely necessary. Learn State, Strategy and Command. They're used all the time. State is for anything that has logic that depends on the state of the object. In short, every if-statement might possibly be better done via State. Seriously. Too many if-statements are a code smell...
5
5
0
What are the design patterns that I should be completely familiar with? And what is one easy example that each can be used for? I am a web developer (I use Django, and is familiar with separation of logic), but I work at a Desktop-app company. They are always talking about singletons, and I forget...but it leaves me n...
How important are design patterns in web development?
1.2
0
0
1,248
2,061,222
2010-01-13T23:53:00.000
1
0
1
0
python,data-structures,hash,dictionary,hashtable
2,061,323
7
false
0
0
A hash table always uses some function operating on a value to determine where a value will be stored. A Dictionary (as I believe you intend it) is a more general term, and simply indicates a lookup mechanism, which might be a hash table or might be implemented by a simpler structure which does not consider the value i...
4
62
0
I've always used dictionaries. I write in Python.
What is the true difference between a dictionary and a hash table?
0.028564
0
0
56,356
2,061,222
2010-01-13T23:53:00.000
12
0
1
0
python,data-structures,hash,dictionary,hashtable
2,061,236
7
false
0
0
A Python dictionary is internally implemented with a hashtable.
4
62
0
I've always used dictionaries. I write in Python.
What is the true difference between a dictionary and a hash table?
1
0
0
56,356
2,061,222
2010-01-13T23:53:00.000
36
0
1
0
python,data-structures,hash,dictionary,hashtable
2,061,248
7
false
0
0
A dictionary is a data structure that maps keys to values. A hash table is a data structure that maps keys to values by taking the hash value of the key (by applying some hash function to it) and mapping that to a bucket where one or more values are stored. IMO this is analogous to asking the difference between a list ...
4
62
0
I've always used dictionaries. I write in Python.
What is the true difference between a dictionary and a hash table?
1
0
0
56,356
2,061,222
2010-01-13T23:53:00.000
0
0
1
0
python,data-structures,hash,dictionary,hashtable
2,061,300
7
false
0
0
Dictionary is implemented using hash tables. In my opinion the difference between the 2 can be thought of as the difference between Stacks and Arrays where we would be using arrays to implement Stacks.
4
62
0
I've always used dictionaries. I write in Python.
What is the true difference between a dictionary and a hash table?
0
0
0
56,356
2,064,202
2010-01-14T13:06:00.000
2
0
1
0
python,class,oop,member-variables
42,183,627
9
false
0
0
This is kinda a l-o-n-g answer but I think it gets to the root of the real problem here -- scope of visibility. Just hang in there while I slog through this! Simply importing a module need not necessarily give the application developer access to all of its classes or methods; if I can't actually SEE the module source ...
1
82
0
How can I make methods and data members private in Python? Or doesn't Python support private members?
Private members in Python
0.044415
0
0
66,228
2,064,673
2010-01-14T14:19:00.000
0
0
0
0
python,django,google-app-engine,facebook
2,681,563
1
false
1
0
Honza: we where looking for something that also does authentication Django style. We ended up doing the login on the client side than sending an AJAX request to Django and wrote our own authenticate/login logic. Once we get the user's credentials, we use PyFacebook for FB connectivity.
1
0
0
We are building a website on Google App Engine, using django patch. We would like to use Facebook connect for two purposes: Authenticate users. Access user's social data. Searching for a solution in the usual places (google, FB, SO) brigs up a lot of noise, many partial solutions and no clear answer. So the question...
Facebook connect on Google App Engine with Django Patch
0
0
0
322
2,065,331
2010-01-14T15:43:00.000
1
0
1
0
python
2,065,418
4
false
0
0
the more secure way is to do everything at the back end. Users just key in the necessary parameters. For example you can prompt them to key in numeric values for foo(), boo() and do(). Then at the back end, pass these values to appropriate functions to do the calculations.
2
4
0
I want to take an input from the user may be like foo() > 90 and boo() == 9 or do() > 100 and use eval on the server side to to evaluate this expression. For security I want to restrict user to add limited functions and operators by keeping a check (against some data-structure) before I pass it to eval function. PS: In...
Parsing, securing python expression before passing it to eval()
0.049958
0
0
379
2,065,331
2010-01-14T15:43:00.000
1
0
1
0
python
2,065,491
4
false
0
0
You need to lock down the input format, or it will be a gaping security hole. Either implement a full blown parser, as lpthnc suggests, with a reasonable set of operations (but no more), or at least use a regular expression (or several regex patterns in a matching hierarchy and/or loop) to strip out recognized pattern...
2
4
0
I want to take an input from the user may be like foo() > 90 and boo() == 9 or do() > 100 and use eval on the server side to to evaluate this expression. For security I want to restrict user to add limited functions and operators by keeping a check (against some data-structure) before I pass it to eval function. PS: In...
Parsing, securing python expression before passing it to eval()
0.049958
0
0
379
2,066,259
2010-01-14T17:49:00.000
0
0
0
0
python,graph,plot,graphviz,complement
2,066,328
2
false
0
0
Compute the complement yourself, then plot it.
1
2
0
Any function in that Graphviz which can do that? If not, any other free software that can do that?
How to draw complement of a network graph?
0
0
1
2,271
2,066,508
2010-01-14T18:26:00.000
15
1
1
0
python,python-unittest
42,430,138
7
false
0
0
Simply placing @unittest.SkipTest decorator above the test is enough.
2
159
0
How can individual unit tests be temporarily disabled when using the unittest module in Python?
Disable individual Python unit tests temporarily
1
0
0
78,791
2,066,508
2010-01-14T18:26:00.000
5
1
1
0
python,python-unittest
2,066,777
7
false
0
0
I just rename a test case method with an underscore: test_myfunc becomes _test_myfunc.
2
159
0
How can individual unit tests be temporarily disabled when using the unittest module in Python?
Disable individual Python unit tests temporarily
0.141893
0
0
78,791
2,066,767
2010-01-14T19:04:00.000
-1
0
0
0
python,multithreading,pygtk
2,069,788
4
false
0
1
the same may be achieved using gobject.idle_add method whose syntax is same as above,you have to import the module gobject
2
8
0
I am using PyGTK to build a GUI application. I want to update the textview widget from another thread but the widget is not getting updated everytime i try an update. What should i do to get a reliable GUI updating?
GUI not updated from another thread when using PyGtk
-0.049958
0
0
3,639
2,066,767
2010-01-14T19:04:00.000
-1
0
0
0
python,multithreading,pygtk
3,030,804
4
false
0
1
What Johannes said is correct, however since GTK is a wrapper for the glib and gobject things, you would actually want to use gtk.idle_add(). No need for the unnecessary imports.
2
8
0
I am using PyGTK to build a GUI application. I want to update the textview widget from another thread but the widget is not getting updated everytime i try an update. What should i do to get a reliable GUI updating?
GUI not updated from another thread when using PyGtk
-0.049958
0
0
3,639
2,066,810
2010-01-14T19:09:00.000
0
0
0
0
python,sockets
2,066,907
4
false
0
0
You sure the client is not hanging up on the server? This is a bit too vague to really tell what is up, but generally a server that is accepting data from a client will quit the connection of the read returns no data.
2
10
0
I'm writing a client/server application in Python and I'm finding it necessary to get a new connection to the server for each request from the client. My server is just inheriting from TCPServer and I'm inheriting from BaseRequestHandler to do my processing. I'm not calling self.request.close() anywhere in the handler,...
Does the TCPServer + BaseRequestHandler in Python's SocketServer close the socket after each call to handle()?
0
0
1
9,010
2,066,810
2010-01-14T19:09:00.000
9
0
0
0
python,sockets
2,072,002
4
true
0
0
Okay, I read the code (on my Mac, SocketServer.py is at /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/). Indeed, TCPServer is closing the connection. In BaseServer.handle_request, process_request is called, which calls close_request. In the TCPServer class, close_request calls self.request.clo...
2
10
0
I'm writing a client/server application in Python and I'm finding it necessary to get a new connection to the server for each request from the client. My server is just inheriting from TCPServer and I'm inheriting from BaseRequestHandler to do my processing. I'm not calling self.request.close() anywhere in the handler,...
Does the TCPServer + BaseRequestHandler in Python's SocketServer close the socket after each call to handle()?
1.2
0
1
9,010
2,067,185
2010-01-14T20:00:00.000
2
0
0
0
python,django,logging
2,067,231
1
true
1
0
Yes, the last_login column of the user's record in table auth_user is updated with the date/time of the successful login.
1
1
0
All.. I have a Django site and to access it all the users have to go through the login page. My question is when a user is given a access through the login page to enter the site.Does Django logs the username in any of the Django internal tables.... Thanks.......
Does Django logs usernames internally
1.2
0
0
66
2,067,637
2010-01-14T21:17:00.000
3
0
1
0
python,dll,stack
2,067,700
4
false
0
0
The functions in a dll can have no control over the stack size available when they are executed (unless you spawn new threads under the control of your library). If the dll is custom, then can't you allocate on the heap rather than stack (or statically allocate, if appropriate), and stop the problem that way?
1
10
0
I have a python program that uses a custom-built DLL. This DLL crashes due to a stack overflow. This overflow is not due to a recursive function gone bad, but to large allocations on the stack using alloca(). I want to increase stack size to get rid of this error. Is there any way to do this?
How do I increase the stack size in python
0.148885
0
0
12,672
2,067,749
2010-01-14T21:35:00.000
2
1
1
0
python,dictionary,disk,pickle
2,068,000
2
false
0
0
JSON and YAML work well, also. Depends on what you mean by "efficient"? Size of file? Time required? Amount of code you need to write? You have the timeit module available to determine what meets your specific criteria for "efficient".
1
5
0
What is the most efficient method to store a Python dictionary on the disk? The only methods I know of right now are plain-text and the pickle module. Edit: Sorry for not being very clear. By efficient I meant fastest execution speed. The dictionary will contain mutable objects that will hold information to be parsed a...
Efficient method to store Python dictionary on disk?
0.197375
0
0
5,666
2,067,907
2010-01-14T22:03:00.000
3
1
0
1
python,ruby,perl,scripting
2,067,929
7
true
0
0
Python (combined with PyQt) is a very solid combination for GUI desktop applications (note that while QT is LGPL, PyQt (the Python bindings) is dual licensed: GPL or commercial). It offers the same (GUI library-wise) as Qt on C++ but with Python's specific strenghts. I'll list some of the more obvious ones: rapid prot...
4
3
0
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too. I think my question can be answered clearly Are there actually companies using a special scripting language only to create their a...
"Real" and non-embedded use of Ruby, Python and their friends
1.2
0
0
464
2,067,907
2010-01-14T22:03:00.000
6
1
0
1
python,ruby,perl,scripting
2,068,161
7
false
0
0
The company I work for uses Perl and Tk with PerlApp to build executable packages to produce or major software application. Perl beats C and C++ for simplicity of code. You can do things in one line of Perl that take 20 lines of C. We've used WxPerl for a few smaller projects. We'd like to move fully to WxPerl, but e...
4
3
0
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too. I think my question can be answered clearly Are there actually companies using a special scripting language only to create their a...
"Real" and non-embedded use of Ruby, Python and their friends
1
0
0
464
2,067,907
2010-01-14T22:03:00.000
2
1
0
1
python,ruby,perl,scripting
2,072,473
7
false
0
0
I would recommend you not try to look for a language that is best for GUI apps but instead look for the language that you like the most and then use that to write your app. Ruby, Python, Perl all have GUI tool kits available to them. Most of them have access to the same often used tool kits like TK, GTK, and Wx. The lo...
4
3
0
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too. I think my question can be answered clearly Are there actually companies using a special scripting language only to create their a...
"Real" and non-embedded use of Ruby, Python and their friends
0.057081
0
0
464
2,067,907
2010-01-14T22:03:00.000
1
1
0
1
python,ruby,perl,scripting
2,068,564
7
false
0
0
I have used a number of programs that were developed using scripted languages. Several embedded device vendors ship my group Windows-based configuration and debugging utilities written in TCL. Google's drawing program SketchUp has a lot of Ruby inside it (and users can create add-ons using Ruby). I have seen many Li...
4
3
0
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too. I think my question can be answered clearly Are there actually companies using a special scripting language only to create their a...
"Real" and non-embedded use of Ruby, Python and their friends
0.028564
0
0
464
2,068,473
2010-01-15T00:04:00.000
1
0
0
0
python,tokyo-cabinet
2,384,015
2
true
0
0
This depend on no-sql implementation. Cassandra, for example, allows range queries, so you could model data to do queries on last name, or with full name (starting with last name, then first name). Beyond this, many simpler key-value stores would indeed require you to store a list structure (or such) for multi-valued e...
1
1
0
i have been in the RDBMS world for many years now but wish to explore the whole nosql movement. so here's my first question: is it bad practice to have the possibility of duplicate keys? for example, an address book keyed off of last name (most probably search item?) could have multiple entities. is it bad practice ...
key/value (general) and tokyo cabinet (python tc-specific) question
1.2
1
0
597
2,068,486
2010-01-15T00:06:00.000
1
1
1
0
python,macos,documentation,reference,widget
2,068,830
4
true
0
0
Python libraries have (or should have) built in documentation through docstrings. Also, python code is (mostly) very readable, and reading the source (.py or even .c) is actually the preferred way for many developers to get the information they're looking for, especially since some corner cases may not even be document...
2
3
0
There're tons of apps/widgets for PHP function reference and even for Ruby but I'm shocked to find there is nothing available for a popular language like Python (besides the official online documentation ofcourse). Is there really not a single handy reference widget/app available for Python? I have 'Pocket Reference' ...
Python Function Reference
1.2
0
0
657
2,068,486
2010-01-15T00:06:00.000
0
1
1
0
python,macos,documentation,reference,widget
2,069,084
4
false
0
0
The interactive interpreter is a fantastic reference tool. dir(<identifier) lists all the attributes of a module, class, or function help(<identifier>) gives you help about same. pydoc at the command line is another great tool. It does for Python what man gives you for commands, plus it even includes a web server you c...
2
3
0
There're tons of apps/widgets for PHP function reference and even for Ruby but I'm shocked to find there is nothing available for a popular language like Python (besides the official online documentation ofcourse). Is there really not a single handy reference widget/app available for Python? I have 'Pocket Reference' ...
Python Function Reference
0
0
0
657
2,069,739
2010-01-15T05:46:00.000
0
0
0
0
wxpython,focus
2,135,083
2
false
0
1
You could also give the focus to another control in your event handler for the buttons. Just call the SetFocus() method on any other control. This might make your application more usable as a side effect if you for example return focus to a text field that is likely to be typed in next.
1
0
0
I don't know if this is a stupid question, but is there any way to not show focus in wxPython? For example, I built a simple GUI with a few buttons and I don't want the dotted rectangle to show up on the button I have just clicked. If I remember correctly in Excel VBA you could just set TakeFocusOnClick tag to False. ...
Not showing focus in wxPython?
0
0
0
197
2,070,643
2010-01-15T09:53:00.000
6
0
1
0
python,list,collections
2,070,700
13
false
0
0
I'm not sure what the objection to a for loop is: there is no multiset in Python so you can't use a builtin container to help you out. Seems to me anything on one line (if possible) will probably be helishly complex to understand. Go for readability and KISS. Python is not C :)
1
52
0
In Python, How can one subtract two non-unique, unordered lists? Say we have a = [0,1,2,1,0] and b = [0, 1, 1] I'd like to do something like c = a - b and have c be [2, 0] or [0, 2] order doesn't matter to me. This should throw an exception if a does not contain all elements in b. Note this is different from sets! I'm ...
Subtracting two lists in Python
1
0
0
141,082
2,074,071
2010-01-15T19:07:00.000
2
1
1
0
python,import
2,074,086
2
true
0
0
You can include the path of foo.py in the PYTHONPATH environment variable. The interpreter will look also the directories contained there, so you can make the import just like it was on the same directory.
1
0
0
I have a third-party Python script (foo.py) in a folder that is in my system path (but not the Python sys.path). foo.py is not part of any Python module. I am writing another script (bar.py) in which I'd like to call a function located in foo.py. Is this possible? Can it be done without explicitly naming the folder of ...
Use function from Python script in OS path
1.2
0
0
197
2,074,074
2010-01-15T19:08:00.000
0
1
1
0
python,multithreading,unit-testing,performance,multicore
35,182,727
4
false
0
0
As the @vinay-sajip suggested, a few non-core python packages like py.test and nose provided parallel execution of unit tests via multiprocessing lib right out of the box. However, one thing to consider is that if you are testing a web app with database backend and majority of your test cases are relying on connecting...
1
13
0
I'm using python unittest in order to test some other external application but it takes too much time to run the test one by one. I would like to know how can I speedup this process by using the power of multi-cores. Can I tweak unittest to execute tests in parallel? How? This question is not able python GIL limitatio...
How to speedup python unittest on muticore machines?
0
0
0
9,389
2,076,582
2010-01-16T07:40:00.000
1
0
0
0
python,mysql,performance,svn
2,077,129
3
false
0
0
It is "well known", so to speak, that svn update waits up to a whole second after it has finished running, so that file modification timestamps get "in the past" (since many filesystems don't have a timestamp granularity finer than one second). You can find more information about it by Googling for "svn sleep_for_times...
3
2
0
I have a script with a main for loop that repeats about 15k times. In this loop it queries a local MySQL database and does a SVN update on a local repository. I placed the SVN repository in a RAMdisk as before most of the time seemed to be spent reading/writing to disk. Now I have a script that runs at basically the sa...
Finding the performance bottleneck in a Python and MySQL script
0.066568
1
0
917
2,076,582
2010-01-16T07:40:00.000
4
0
0
0
python,mysql,performance,svn
2,076,639
3
true
0
0
Doing SQL queries in a for loop 15k times is a bottleneck in every language.. Is there any reason you query every time again ? If you do a single query before the for loop and then loop over the resultset and the SVN part, you will see a dramatic increase in speed. But I doubt that you will get a higher CPU usage. The...
3
2
0
I have a script with a main for loop that repeats about 15k times. In this loop it queries a local MySQL database and does a SVN update on a local repository. I placed the SVN repository in a RAMdisk as before most of the time seemed to be spent reading/writing to disk. Now I have a script that runs at basically the sa...
Finding the performance bottleneck in a Python and MySQL script
1.2
1
0
917
2,076,582
2010-01-16T07:40:00.000
1
0
0
0
python,mysql,performance,svn
2,076,590
3
false
0
0
Profile your Python code. That will show you how long each function/method call takes. If that's the method call querying the MySQL database, you'll have a clue where to look. But it also may be something else. In any case, profiling is the usual approach to solve such problems.
3
2
0
I have a script with a main for loop that repeats about 15k times. In this loop it queries a local MySQL database and does a SVN update on a local repository. I placed the SVN repository in a RAMdisk as before most of the time seemed to be spent reading/writing to disk. Now I have a script that runs at basically the sa...
Finding the performance bottleneck in a Python and MySQL script
0.066568
1
0
917
2,076,678
2010-01-16T08:19:00.000
1
0
0
0
python,django,design-patterns,application-design
2,078,384
1
true
1
0
it is design decision. it depends to your design and programming interests. i used the combination of three methods you said. if i need to some informations that can be build from other fields then i will create an internal function in model class. if i need other records of database to do something i will create an fu...
1
3
0
I am building an application that will send an API call and save the resulting information after processing the information in a APIRecord(models.Model) class. 1) Should I build a separate class in such a way that the class does the API call, processes the information (including checking against business rules) and the...
Django: Chicken or Egg question
1.2
0
0
297
2,076,838
2010-01-16T09:27:00.000
5
0
1
0
python,random,numbers
2,077,313
17
false
0
0
I think you are overestimating the problems with approach 1). Unless you have hard-realtime requirements just checking by random choice terminates rather fast. The probability of needing more than a number of iterations decays exponentially. With 100M numbers outputted (10% fillfactor) you'll have one in billion chance...
5
38
0
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
Generating non-repeating random numbers in Python
0.058756
0
0
30,464
2,076,838
2010-01-16T09:27:00.000
1
0
1
0
python,random,numbers
2,083,392
17
false
0
0
You can run 1) without running into the problem of too many wrong random numbers if you just decrease the random interval by one each time. For this method to work, you will need to save the numbers already given (which you want to do anyway) and also save the quantity of numbers taken. It is pretty obvious that, after...
5
38
0
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
Generating non-repeating random numbers in Python
0.011764
0
0
30,464
2,076,838
2010-01-16T09:27:00.000
4
0
1
0
python,random,numbers
2,077,409
17
false
0
0
The standard Linear Congruential random number generator's seed sequence CANNOT repeat until the full set of numbers from the starting seed value have been generated. Then it MUST repeat precisely. The internal seed is often large (48 or 64 bits). The generated numbers are smaller (32 bits usually) because the enti...
5
38
0
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
Generating non-repeating random numbers in Python
0.047024
0
0
30,464
2,076,838
2010-01-16T09:27:00.000
0
0
1
0
python,random,numbers
2,076,898
17
false
0
0
I'd rethink the problem itself... You don't seem to be doing anything sequential with the numbers... and you've got an index on the column which has them. Do they actually need to be numbers? Consider a sha hash... you don't actually need the entire thing. Do what git or other url shortening services do, and take first...
5
38
0
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
Generating non-repeating random numbers in Python
0
0
0
30,464
2,076,838
2010-01-16T09:27:00.000
0
0
1
0
python,random,numbers
2,077,000
17
false
0
0
Do you need this to be cryptographically secure or just hard to guess? How bad are collisions? Because if it needs to be cryptographically strong and have zero collisions, it is, sadly, impossible.
5
38
0
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
Generating non-repeating random numbers in Python
0
0
0
30,464
2,077,522
2010-01-16T13:58:00.000
2
0
0
0
python,mysql,database,django,performance
2,077,536
2
false
0
0
First, the most obvious answer is that you should ask them, not us, since I can tell you this, that design seems bogus deluxe. The only reason I can come up with is that you have inexperienced DBA's that does not know how to performance-tune a database, and seems to think that a table with less rows will always vastly ...
1
2
0
I recently joined a new company and the development team was in the progress of a project to rebuild the database categories structure as follows: if we have category and subcategory for items, like food category and italian food category in food category. They were building a table for each category, instead of having...
DB a table for the category and another table for the subcategory with similar fields, why?
0.197375
1
0
155
2,079,898
2010-01-17T03:56:00.000
4
0
0
0
python,django
2,080,483
2
true
1
0
Nothing particular happens when you add an app to INSTALLED_APPS, but the main thing that affects you is that its views are checked when you call reverse(). The way reverse works is to import all the views in the project, and see which ones match the URL name you have given. However, it is quite fragile, and if any of...
1
3
0
Here is the situation. I have a django project with two installed apps. Both apps appear to function properly if they are installed independently of each other. However if I list both apps in the settings.INSTALLED_APPS the reverse() function seems to break for urls in the first app. So this leads me to believe that...
What happen when I add a Django app to INSTALLED_APPS?
1.2
0
0
2,706
2,081,586
2010-01-17T16:06:00.000
63
0
0
0
python,web-scraping,screen-scraping
8,603,040
10
false
1
0
I'd really recommend Scrapy. Quote from a deleted answer: Scrapy crawling is fastest than mechanize because uses asynchronous operations (on top of Twisted). Scrapy has better and fastest support for parsing (x)html on top of libxml2. Scrapy is a mature framework with full unicode, handles redirections, gzipped respo...
1
188
0
I'd like to grab daily sunrise/sunset times from a web site. Is it possible to scrape web content with Python? what are the modules used? Is there any tutorial available?
Web scraping with Python
1
0
1
208,635
2,081,836
2010-01-17T17:14:00.000
0
0
1
0
python,file,line
58,380,322
30
false
0
0
If you want to read specific lines, such as line starting after some threshold line then you can use the following codes, file = open("files.txt","r") lines = file.readlines() ## convert to list of lines datas = lines[11:] ## raed the specific lines
2
271
0
I'm using a for loop to read a file, but I only want to read specific lines, say line #26 and #30. Is there any built-in feature to achieve this?
How to read specific lines from a file (by line number)?
0
0
0
709,686
2,081,836
2010-01-17T17:14:00.000
14
0
1
0
python,file,line
3,990,042
30
false
0
0
if you want line 7 line = open("file.txt", "r").readlines()[7]
2
271
0
I'm using a for loop to read a file, but I only want to read specific lines, say line #26 and #30. Is there any built-in feature to achieve this?
How to read specific lines from a file (by line number)?
1
0
0
709,686
2,082,159
2010-01-17T18:49:00.000
1
1
1
0
c#,python,methods,export,python.net
2,082,198
4
false
0
0
(This may no longer be relevant since SLaks has found that ingenious link, but I'll leave an edited version for reference...) The "normal" way of exposing .NET/C# objects to unmanaged code (like Python) is to create a COM-callable wrapper for the C# DLL (.NET assembly), and call that using Python's COM/OLE support. To...
1
15
0
How can we export C# methods? I have a dll and I want to use its methods in the Python language with the ctypes module. Because I need to use the ctypes module, I need to export the C# methods for them to be visible in Python. So, how can I export the C# methods (like they do in C++)?
How to export C# methods?
0.049958
0
0
8,012
2,083,987
2010-01-18T05:00:00.000
-11
0
1
0
python,loops,exception,try-except
2,085,009
25
false
0
0
increment your loop variable only when the try clause succeeds
1
355
0
I have a loop starting with for i in range(0, 100). Normally it runs correctly, but sometimes it fails due to network conditions. Currently I have it set so that on failure, it will continue in the except clause (continue on to the next number for i). Is it possible for me to reassign the same number to i and run throu...
How to retry after exception?
-1
0
0
414,290
2,084,063
2010-01-18T05:30:00.000
0
0
0
1
python,memory-management,windows-7,squish
2,175,363
3
false
0
0
Remember that Squish allows remote testing of the application. A system parameter queried via Python directly will only apply to the case of local testing. An approach that works in either case is to call the currentApplicationContext() function that will give you a handle to the Application Under Test. It has a usedMe...
2
1
0
Recently I've found myself testing an aplication in Froglogic's Squish, using Python to create test scripts. Just the other day, the question of how much memory the program is using has come up, and I've found myself unable to answer it. It seems reasonable to assume that there's a way to query the os (windows 7) API f...
How would I discover the memory used by an application through a python script?
0
0
0
241
2,084,063
2010-01-18T05:30:00.000
-1
0
0
1
python,memory-management,windows-7,squish
2,084,070
3
false
0
0
In command line: tasklist /FO LIST and parse the results? Sorry, I don't know a Pythonic way. =P
2
1
0
Recently I've found myself testing an aplication in Froglogic's Squish, using Python to create test scripts. Just the other day, the question of how much memory the program is using has come up, and I've found myself unable to answer it. It seems reasonable to assume that there's a way to query the os (windows 7) API f...
How would I discover the memory used by an application through a python script?
-0.066568
0
0
241
2,084,508
2010-01-18T07:34:00.000
2
1
0
1
python,terminal
2,084,517
27
false
0
0
You could tear through the terminfo database, but the functions for doing so are in curses anyway.
4
241
0
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?
Clear terminal in Python
0.014814
0
0
516,293
2,084,508
2010-01-18T07:34:00.000
0
1
0
1
python,terminal
4,808,001
27
false
0
0
If all you need is to clear the screen, this is probably good enough. The problem is there's not even a 100% cross platform way of doing this across linux versions. The problem is the implementations of the terminal all support slightly different things. I'm fairly sure that "clear" will work everywhere. But the more "...
4
241
0
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?
Clear terminal in Python
0
0
0
516,293
2,084,508
2010-01-18T07:34:00.000
2
1
0
1
python,terminal
2,084,525
27
false
0
0
python -c "from os import system; system('clear')"
4
241
0
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?
Clear terminal in Python
0.014814
0
0
516,293
2,084,508
2010-01-18T07:34:00.000
108
1
0
1
python,terminal
26,639,250
27
false
0
0
Why hasn't anyone talked about just simply doing Ctrl+L in Windows or Cmd+L in Mac. Surely the simplest way of clearing screen.
4
241
0
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?
Clear terminal in Python
1
0
0
516,293
2,084,969
2010-01-18T09:25:00.000
1
1
0
1
python,macos,deployment,ubuntu,rsync
2,085,042
2
false
0
0
to avoid su www I see two easy choices. make a folder writable to you and readable by www's group in some path that the web-server will be able to serve, then you can rsync to that folder from somewhere on your local machine. put your public ssh key in www's authorized_keys and rsync to the www user (a bit less securi...
1
0
0
I have a set of binary assets (swf files) each about 150Kb in size. I am developing them locally on my home computer and I want to periodically deploy them for review. My current strategy is: Copy the .swf's into a transfer directory that is also a hg (mercurial) repo. hg push the changes to my slicehost VPN ssh onto ...
How to deploy highly iterative updates
0.099668
0
0
349
2,085,430
2010-01-18T10:55:00.000
1
0
0
0
python,xml,database,sqlite,parsing
2,085,657
4
false
1
0
If you are accustomed to DOM (tree) access to xml from other language, you may find useful these standard library modules (and their respective docs): xml.dom xml.dom.minidom To save tha data to DB, you can use standard module sqlite3 or look for binding to mysql. Or you may wish to use something more abstract, like...
1
7
0
I have a question related to some guidances to solve a problem. I have with me an xml file, I have to populate it into a database system (whatever, it might be sqlite, mysql) using scripting language: Python. Does anyone have any idea on how to proceed? Which technologies I need to read further? Which environments I h...
populating data from xml file to a sqlite database using python
0.049958
1
0
15,042
2,086,016
2010-01-18T12:36:00.000
0
0
0
0
python,django,admin
2,094,101
2
true
1
0
It turns out it was a rather simple thing, I am just not experienced enough with Python and I was calling on my .NET experience. Bad mistake. I called project.settings.SETTING where I should have imported project.settings and then accessed settings.SETTING. In .NET the imports act just shortcuts so you don't have to ...
2
0
0
I have an issue where, when I log in to the Django admin site, I get a template syntax error in /Library/Python/2.6/site-packages/django/template/debug.py in render_node, line 81. I can't find out how to solve this as it is part of Django, I didn't write the code and I have no idea how it works. This did work fine up u...
Django Admin site TemplateSyntaxError at /admin/: name not defined
1.2
0
0
4,323
2,086,016
2010-01-18T12:36:00.000
1
0
0
0
python,django,admin
2,086,034
2
false
1
0
It seems like an error in the admin.py file for your app. It may be a missing import, or even a typo, but it's hard to tell without any code. It would be great if you could post your admin.py file so we can take a look. TemplateSyntaxErrors in Django are terrible, they almost never tell you what the real problem is. In...
2
0
0
I have an issue where, when I log in to the Django admin site, I get a template syntax error in /Library/Python/2.6/site-packages/django/template/debug.py in render_node, line 81. I can't find out how to solve this as it is part of Django, I didn't write the code and I have no idea how it works. This did work fine up u...
Django Admin site TemplateSyntaxError at /admin/: name not defined
0.099668
0
0
4,323
2,086,961
2010-01-18T15:17:00.000
1
1
0
1
python,unix,terminal,cron
2,087,056
6
false
0
0
An easier workaround would be to pass a flag to the script only from the crontab, like --crontab, and then just check for that flag.
4
5
0
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
How can I determine if a python script is executed from crontab?
0.033321
0
0
4,167
2,086,961
2010-01-18T15:17:00.000
0
1
0
1
python,unix,terminal,cron
2,087,816
6
false
0
0
If you want to detect this from an imported module, I would have the main program set a global variable in the module, which would output different things depending on the value of this global variable (and have the main program decide how to set the variable through a flag that you would use in your crontab). This is...
4
5
0
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
How can I determine if a python script is executed from crontab?
0
0
0
4,167
2,086,961
2010-01-18T15:17:00.000
21
1
0
1
python,unix,terminal,cron
2,087,031
6
true
0
0
Not quite what you asked, but maybe what you want is os.isatty(sys.stdout.fileno()), which tells if stdout is connected to (roughly speaking) a terminal. It will be false if you pipe the output to a file or another process, or if the process is run from cron.
4
5
0
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
How can I determine if a python script is executed from crontab?
1.2
0
0
4,167
2,086,961
2010-01-18T15:17:00.000
5
1
0
1
python,unix,terminal,cron
2,087,053
6
false
0
0
Set an environment variable at the cron command invocation. That works even within a module, as you can just check os.getenv().
4
5
0
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
How can I determine if a python script is executed from crontab?
0.16514
0
0
4,167
2,087,148
2010-01-18T15:40:00.000
114
0
1
0
python,easy-install,pip
2,090,124
3
false
0
0
You can pip install a file perhaps by python setup.py sdist first. You can also pip install -e . which is like python setup.py develop.
1
153
0
python setup.py install will automatically install packages listed in requires=[] using easy_install. How do I get it to use pip instead?
Can I use `pip` instead of `easy_install` for `python setup.py install` dependency resolution?
1
0
0
113,410
2,087,492
2010-01-18T16:25:00.000
2
0
1
0
python,setuptools,distutils,easy-install,pip
2,087,761
4
false
0
0
If you really require an obscure version of another package, and there's no way to make do with other versions, you might want to simply distribute that version of the package with your own. If necessary put it in your own namespace to ensure that your version is the one that is used.
1
11
0
Some useful Python packages are broken on pypi, and the only acceptable version is a particular revision in a revision control system. Can that be expressed in setup.py e.g requires = 'svn://example.org/useful.package/trunk@1234' ?
Can a Python package depend on a specific version control revision of another Python package?
0.099668
0
0
3,935
2,087,920
2010-01-18T17:30:00.000
4
0
0
0
python,security
2,088,188
2
true
0
0
Your constraints set a very difficult problem: every user on the system must be able to access that password (since that's the only way for users to access that database)... yet they must not (except when running that script, and presumably only when running it without e.g. a python -i session that would let them set a...
1
0
0
I have a written a Python module which due to its specifics needs to have a MySQL database connection. Right now, details of this connection (host, database, username and password to connect with) are stored in /etc/mymodule.conf in plaintext, which is obviously not a good idea. Supposedly, the /etc/mymodule.conf file ...
Storing system-wide DB connection password for a Python module
1.2
1
0
1,241
2,088,175
2010-01-18T18:13:00.000
1
0
0
0
event-handling,wxpython,wxwidgets
2,097,941
1
true
0
1
Even though you got your answer from the mailing list, we may as well replicate the answer here: Robin Dunn wrote: There isn't a way to access the event table currently, although I've often thought that it would be a good idea. Shame.
1
1
0
I have a wxPython window. How can I check its event handler table? (i.e. which handler is handling each event.)
Listing the event handlers for a wxPython window
1.2
0
0
230
2,089,635
2010-01-18T22:18:00.000
0
0
0
1
python,html,google-app-engine,mime-types
2,089,653
2
false
1
0
Setting a content-disposition: attachment header will cause most browsers to download whatever you send them as a file. Safari sometimes ignores it.
1
1
0
I have a python web-application running inside the Google App Engine. The application creates on user-demand a string and I want the string to be send to the browser client (application/octet-stream?) as a file. How can i realize this?
How to send a string from a python script at Google App Engine to the browser client as a file
0
0
0
180
2,089,998
2010-01-18T23:31:00.000
6
1
0
0
ironpython
2,090,745
3
false
1
1
You can provide a custom Stream or TextWriter which will be used for all output. You can provide those by using one of the ScriptRuntime.IO.SetOutput overloads. Your implementation of Stream or TextWriter should receive the strings and then output them to your editor window (potentially marshalling back onto the UI t...
1
4
0
We embed ironpython in our app sob that scripts can be executed in the context of our application. I use Python.CreateEngine() and ScriptScope.Execute() to execute python scripts. We have out own editor(written in C#) that can load ironpython scripts and run it. There are 2 problems I need to solve. If I have a print ...
Streaming Ironpython output to my editor
1
0
0
4,586
2,090,464
2010-01-19T01:25:00.000
1
0
0
0
python,windows
66,700,192
5
false
0
0
Pip install keyboard. Before you set foreground window, simulate a keyboard to esc that is keyboard.send('esc') You may want to do it three times for either of the following: Sidebar Windows key overlay Task manager which is always on top
1
28
0
How would I programmatically activate a window in Windows using Python? I'm sending keystrokes to it and at the moment I'm just making sure it's the last application used then sending the keystroke Alt+Tab to switch over to it from the DOS console. Is there a better way (since I've learned by experience that this way i...
Python Window Activation
0.039979
0
0
82,921
2,090,820
2010-01-19T03:15:00.000
7
0
1
0
python
2,090,825
8
false
0
0
The latest 2.6. Don't worry about 3.x; there isn't that much to learn.
5
21
0
If I'm absolutely new to Python and am literally reading about printing statements to console, variable types, collections, etc: What version of Python should I use? I'm aware that there is an abundance of 3rd party libraries for Python 2.6.x, but I'm scared I'll learn some things that won't carry over well into Pyth...
What version of Python should I use if I'm a new to Python?
1
0
0
8,193
2,090,820
2010-01-19T03:15:00.000
1
0
1
0
python
2,091,413
8
false
0
0
#python IRC Channel says: It's too early to use Python 3.x If you are a beginner I would suggest start learning with Python 2.6
5
21
0
If I'm absolutely new to Python and am literally reading about printing statements to console, variable types, collections, etc: What version of Python should I use? I'm aware that there is an abundance of 3rd party libraries for Python 2.6.x, but I'm scared I'll learn some things that won't carry over well into Pyth...
What version of Python should I use if I'm a new to Python?
0.024995
0
0
8,193
2,090,820
2010-01-19T03:15:00.000
1
0
1
0
python
2,098,857
8
false
0
0
Directly from python.org: If you don't know which version to use, start with Python 2.6.4; more existing third party software is compatible with Python 2 than Python 3 right now. If Guido is recommending it, I'd follow him :)
5
21
0
If I'm absolutely new to Python and am literally reading about printing statements to console, variable types, collections, etc: What version of Python should I use? I'm aware that there is an abundance of 3rd party libraries for Python 2.6.x, but I'm scared I'll learn some things that won't carry over well into Pyth...
What version of Python should I use if I'm a new to Python?
0.024995
0
0
8,193
2,090,820
2010-01-19T03:15:00.000
17
0
1
0
python
2,090,843
8
true
0
0
Python 2.6 (and 2.5, 2.4) are what you will find installed on most machines (Linux) and what you will find most code written in. Therefore I'd start with Python 2.6.
5
21
0
If I'm absolutely new to Python and am literally reading about printing statements to console, variable types, collections, etc: What version of Python should I use? I'm aware that there is an abundance of 3rd party libraries for Python 2.6.x, but I'm scared I'll learn some things that won't carry over well into Pyth...
What version of Python should I use if I'm a new to Python?
1.2
0
0
8,193
2,090,820
2010-01-19T03:15:00.000
13
0
1
0
python
2,090,836
8
false
0
0
It's really going to depend on what you want to do. Generally speaking Python 3 "isn't ready yet", in the sense that few libraries support Python 3. This will end up greatly limiting what you can accomplish with the language as a beginner. On the other hand, if you think you'll be spending your time on more "pure pro...
5
21
0
If I'm absolutely new to Python and am literally reading about printing statements to console, variable types, collections, etc: What version of Python should I use? I'm aware that there is an abundance of 3rd party libraries for Python 2.6.x, but I'm scared I'll learn some things that won't carry over well into Pyth...
What version of Python should I use if I'm a new to Python?
1
0
0
8,193
2,090,950
2010-01-19T03:56:00.000
0
1
0
0
python,com
2,091,963
2
false
0
0
When doing python COM programming, I sometimes use VBA (in Excel) to test code that gives errors. That way, I can see if the problem is in the Python-COM layer, or if I get the same error when using VBA. I have sometimes seen that the error messages in VBA have descriptions that the Python exception lacks. VBA is quit...
1
1
0
I've encountered the following error while scripting in Python. ERROR Tue 19. Jan 14:51:21 2010 C:\Python24\Lib\site-packages\win32com\client\util.py:0: Script Error com_error: (-2147217385, 'OLE error 0x80041017', None, None) Unfortunately, I don't know what it means, or even what other information I might need t...
unidentified com_error in python
0
0
0
1,265
2,091,097
2010-01-19T04:35:00.000
1
0
0
0
python,sockets,network-programming
2,091,157
3
false
0
0
I don't think there's any Python-specific limits. UDP packets have a theoretical limit of circa 65kb and TCP no upper limit, but you'll have flow control problems if you use packets much more than a few kilobytes.
1
6
0
i am new to network programming in python. I wanted to know that what is the maximum size packet we can transmit or receive on python socket? and how to find out it?
What is the maximum packet size a python socket can handle?
0.066568
0
1
7,528
2,091,294
2010-01-19T05:27:00.000
1
0
0
0
c++,python,django
2,091,309
4
false
1
0
You can use swig to create a C++ module that can be imported in python. An alternative is boost::python (but personnaly, I prefer swig).
1
4
0
I need to run a C++ Program from Django Framework. In a sense, I get inputs from UI in views.py . Once I have these inputs, I need to process the input using my C++ program and use those results. Is it possible ?
Run a C++ Program from Django Framework
0.049958
0
0
4,911
2,091,508
2010-01-19T06:17:00.000
2
0
1
0
python,performance
2,091,858
3
false
0
0
PyStone is not a good or reliable benchmark, so you should probably not interpret them at all. But, no, higher is better, not the other way around. Also be sure to run it multiple times after each other, many CPU's slow down when idle today.
2
4
0
I have three different laptops with Python2.5 on it. If I run Pystone I get essentially the same values. Intel Pentium M @1.80GHz - 1.5GB RAM Intel T2300 @1.66GHz - 1GB RAM Intel Pentium Dual T2370 @1.73Ghz - 2GB RAM These are their respective Pystone values: 45787 pystones/second 44377 pystones/second 43861 pystone...
How should you interpret the PyStone value across machines?
0.132549
0
0
7,959
2,091,508
2010-01-19T06:17:00.000
1
0
1
0
python,performance
22,354,756
3
false
0
0
pystones is a benchmark, but it's not a benchmark of the underlying hardware, is meant more as a benchmark to compare python implementations. That being so, comparing pystones on different hardware makes not much sense.
2
4
0
I have three different laptops with Python2.5 on it. If I run Pystone I get essentially the same values. Intel Pentium M @1.80GHz - 1.5GB RAM Intel T2300 @1.66GHz - 1GB RAM Intel Pentium Dual T2370 @1.73Ghz - 2GB RAM These are their respective Pystone values: 45787 pystones/second 44377 pystones/second 43861 pystone...
How should you interpret the PyStone value across machines?
0.066568
0
0
7,959
2,093,411
2010-01-19T12:28:00.000
2
0
1
1
c++,python
2,093,422
4
false
0
0
one dirty method: You can use Python to read (raw_input) from stdin (if there is not input, it will wait). the C++ program writes to stdout.
2
1
0
I am writing a module in Python which runs a C++ Program using subprocess module. Once I get the output from C++, I need to store the that in Python List . How do I do that ?
C++ I/O with Python
0.099668
0
0
1,539
2,093,411
2010-01-19T12:28:00.000
0
0
1
1
c++,python
2,093,491
4
false
0
0
In the command for the process you could do a redirect to a temporary file. Then read that file when the process returns.
2
1
0
I am writing a module in Python which runs a C++ Program using subprocess module. Once I get the output from C++, I need to store the that in Python List . How do I do that ?
C++ I/O with Python
0
0
0
1,539
2,093,822
2010-01-19T13:37:00.000
1
0
0
0
python,django,performance,chat,private-messaging
2,094,368
6
false
1
0
I think for a chat application you can use other technologies, such as AMQP(RabbitMQ, etc), Comet, etc. But, for develop user profile, PMs, and other you can use Django. Do not forget that performance still depends on server configuration (web server software, cache, db)
1
10
0
If i devlop a chat application using django will it have some performance problem? Can i do server push in django? I want to have PM and room discussions as well.
Chat application using django
0.033321
0
0
12,068
2,093,837
2010-01-19T13:40:00.000
0
1
1
1
python,automator
2,094,638
2
false
0
0
When you install modules, you typically install them per Python instance. So in this case you have installed them for the Python in /Library/Frameworks/Python.framework/Versions/Current/bin/python, and it will then be available only for that Python. /usr/bin/python is then apparently another Python installation (I'm no...
1
2
0
I have installed Py-Appscript on my machine and it can be used with the Python installation at /Library/Frameworks/Python.framework/Versions/Current/bin/python. I am trying to use this installation of Py-Appscript with an Automator service. To do this, I use the Run Shell Script action and then set the Shell to usr/bin...
Using Third-Party Modules with Python in an Automator Service
0
0
0
2,403
2,095,505
2010-01-19T17:28:00.000
-1
0
1
0
python,import
2,097,024
6
false
1
0
Might not be relevant, but have you considered using imdbpy? Last time I used it it worked pretty well...
1
2
0
I just downloaded Beautiful Soup and I've decided I'll make a small library (is that what they call them in Python?) that will return results of a movie given and IMDB movie search. My question is, how exactly does this import thing work? For example, I downloaded BeautifulSoup and all it is, is a .py file. Does that f...
A few questions regarding Pythons 'import' feature
-0.033321
0
1
217
2,096,000
2010-01-19T18:31:00.000
7
0
0
0
python,ide,intellisense,geany
2,096,071
2
true
0
0
No, because is Python is dynamically typed language and quite hard to achieve that. Python plugins for netbeans do that partially, but I believe such plugin is not in geany developers plans. There are different things to be done ;-) However, geany provides some completions support. First, it analyzes your imports in a ...
1
10
0
In visual studio, I could just press ctrl+spacekey and the methods appeared. In Geany is there a way for me to get this functionality?
How can I get Geany to show me the methods a library has when I press the '.' key?
1.2
0
0
8,191
2,096,334
2010-01-19T19:19:00.000
9
1
1
0
python,c,optimization
2,096,358
5
false
0
1
First measure then optimize
1
4
0
In a game that I am writing, I use a 2D vector class which I have written to handle the speeds of the objects. This is called a large number of times every frame as there are a lot of objects on the screen, so any increase I can make in its speed will be useful. It is pretty simple, consisting mostly of wrappers to the...
When Does It Make Sense To Rewrite A Python Module in C?
1
0
0
429
2,097,134
2010-01-19T21:13:00.000
1
0
1
1
python,ide
2,111,703
6
false
0
0
I am also working with mod_wsgi, python, apache software stack. I am using WingIDE as my environment, which gives you debugging capabilities. If you are vi person it has a VI/VIM personality which coupled with auto-completion makes for a very productive work environment.
4
2
0
Would like to know what is the best F/OSS IDE for Python Web development. I've always used vim myself, but I'm increasingly interested in having a tool that integrates syntax checking/highlighting, source control, debugging, and other IDE goodies. I use both Windows and Linux as desktops, so recommendations for either...
Best F/OSS IDE for Python Web Development (Windows or Linux)?
0.033321
0
0
1,183
2,097,134
2010-01-19T21:13:00.000
0
0
1
1
python,ide
2,120,061
6
false
0
0
What about IDLE? It's bundled with Python distributions.
4
2
0
Would like to know what is the best F/OSS IDE for Python Web development. I've always used vim myself, but I'm increasingly interested in having a tool that integrates syntax checking/highlighting, source control, debugging, and other IDE goodies. I use both Windows and Linux as desktops, so recommendations for either...
Best F/OSS IDE for Python Web Development (Windows or Linux)?
0
0
0
1,183
2,097,134
2010-01-19T21:13:00.000
0
0
1
1
python,ide
2,120,241
6
false
0
0
"syntax checking/highlighting, source control, debugging, and other IDE goodies" Emacs fits this criteria, if you use the right extensions. Though it does have a much steeper learning curve than any IDE I know of.
4
2
0
Would like to know what is the best F/OSS IDE for Python Web development. I've always used vim myself, but I'm increasingly interested in having a tool that integrates syntax checking/highlighting, source control, debugging, and other IDE goodies. I use both Windows and Linux as desktops, so recommendations for either...
Best F/OSS IDE for Python Web Development (Windows or Linux)?
0
0
0
1,183
2,097,134
2010-01-19T21:13:00.000
0
0
1
1
python,ide
2,120,215
6
false
0
0
I've been using Komodo Edit for a while now and it's quite good for Python development. It's free and I think it's also open-source now, though it wasn't always so.
4
2
0
Would like to know what is the best F/OSS IDE for Python Web development. I've always used vim myself, but I'm increasingly interested in having a tool that integrates syntax checking/highlighting, source control, debugging, and other IDE goodies. I use both Windows and Linux as desktops, so recommendations for either...
Best F/OSS IDE for Python Web Development (Windows or Linux)?
0
0
0
1,183
2,097,556
2010-01-19T22:12:00.000
0
0
0
0
python,html,forms,pylons
2,500,262
2
false
1
0
Yes (to iterate Tom's answer), HTML is designed to explicitly only allow a single form to be submitted at a time. Plus, forms may not be nested, so no confusion possible there. However, a single form may contain multiple submit buttons. So, you may if you really want to organize your page as one big single form, and s...
2
1
0
I've got a web page I'm generating with Pylons and the evoque templating tool. I'm trying to generate a page with multiple forms per page (one form is part of a base template that becomes part of every page). I'm having a problem as I seemingly can only get the form element values for one form; whenever I try to get th...
Pylons and multiple forms per page
0
0
0
255
2,097,556
2010-01-19T22:12:00.000
1
0
0
0
python,html,forms,pylons
2,104,760
2
false
1
0
You will only get the form values for the form that was posted in the request(ie: whichever submit button the user clicked), that's how html works.
2
1
0
I've got a web page I'm generating with Pylons and the evoque templating tool. I'm trying to generate a page with multiple forms per page (one form is part of a base template that becomes part of every page). I'm having a problem as I seemingly can only get the form element values for one form; whenever I try to get th...
Pylons and multiple forms per page
0.099668
0
0
255
2,098,088
2010-01-19T23:49:00.000
33
0
1
0
python
2,098,096
6
true
0
0
No. Typical Python style is to put related classes in the same module. It may be that a class ends up in a module of its own (especially if it's a large class), but it should not be a goal in its own right. And when you do, please do not name the module after the class -- you'll just end up confusing yourself and other...
4
40
0
I'm quite new to Python in general. I'm aware that I can create multiple classes in the same .py file, but I'm wondering if I should create each class in its own .py file. In C# for instance, I would have a class that handles all Database interactions. Then another class that had the business rules. Is this the case in...
Should I create each class in its own .py file?
1.2
0
0
22,009
2,098,088
2010-01-19T23:49:00.000
7
0
1
0
python
4,672,452
6
false
0
0
I'll disagree with the others and say yes. For me, I have had better success putting each class in its own file (module). But there are exceptions so let me explain with an example. If you have a class Foo, then put it in a file called Foo.py, with the following sections: Imports This is where you pull in dependencie...
4
40
0
I'm quite new to Python in general. I'm aware that I can create multiple classes in the same .py file, but I'm wondering if I should create each class in its own .py file. In C# for instance, I would have a class that handles all Database interactions. Then another class that had the business rules. Is this the case in...
Should I create each class in its own .py file?
1
0
0
22,009