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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,353,715 | 2009-08-30T11:49:00.000 | 14 | 1 | 1 | 0 | python,performance | 1,353,722 | 10 | true | 0 | 0 | My answer to that would be :
We should forget about small
efficiencies, say about 97% of the
time: premature optimization is the
root of all evil.
(Quoting Knuth, Donald. Structured Programming with go to Statements, ACM Journal Computing Surveys, Vol 6, No. 4, Dec. 1974. p.268)
If your application is doing an... | 7 | 5 | 0 | I had an argument with a colleague about writing python efficiently. He claimed that though you are programming python you still have to optimise the little bits of your software as much as possible, as if you are writing an efficient algorithm in C++.
Things like:
In an if statement with an or always put the conditio... | Should I optimise my python code like C++? Does it matter? | 1.2 | 0 | 0 | 805 |
1,354,204 | 2009-08-30T16:17:00.000 | 0 | 0 | 1 | 0 | python,multiprocessing,priority-queue | 1,359,108 | 6 | false | 0 | 0 | Depending on your requirements you could use the operating system and the file system in a number of ways. How large will the queue grow and how fast does it have to be? If the queue may be big but you are willing to open a couple files for every queue access you could use a BTree implementation to store the queue an... | 2 | 6 | 0 | Anybody familiar with how I can implement a multiprocessing priority queue in python? | How to implement a multiprocessing priority queue in Python? | 0 | 0 | 0 | 5,791 |
1,354,204 | 2009-08-30T16:17:00.000 | 1 | 0 | 1 | 0 | python,multiprocessing,priority-queue | 1,750,166 | 6 | false | 0 | 0 | I had the same use case. But with a finite number of priorities.
What I am ending up doing is creating one Queue per priority, and my Process workers will try to get the items from those queues, starting with the most important queue to the less important one (moving from one queue to the other is done when the queue i... | 2 | 6 | 0 | Anybody familiar with how I can implement a multiprocessing priority queue in python? | How to implement a multiprocessing priority queue in Python? | 0.033321 | 0 | 0 | 5,791 |
1,354,520 | 2009-08-30T18:24:00.000 | 0 | 0 | 1 | 0 | python,file,hashtable | 1,354,632 | 7 | false | 0 | 0 | Let's see where the bottleneck is. When you're going to read a file, the hard drive has to turn enough to be able to read from it; then it reads a big block and caches the results.
So you want some method that will guess exactly what position in file you're going to read from and then do it exactly once. I'm pretty muc... | 1 | 4 | 0 | Hey. I have a function I want to memoize, however, it has too many possible values. Is there any convenient way to store the values in a text file and make it read from them? For example, something like storing a pre-computed list of primes up to 10^9 in a text file? I know it's slow to read from a text file but there'... | Storing huge hash table in a file in Python | 0 | 0 | 0 | 5,436 |
1,355,285 | 2009-08-31T00:11:00.000 | 5 | 0 | 0 | 0 | python,django,utf-8,character-encoding | 1,355,303 | 1 | true | 1 | 0 | Judging from the \xf3 code for 'ó', it does look like the data is encoded in ISO-8859-1 (or some close relative). So body.decode('iso-8859-1') should be a valid Unicode string (you don't specify what "without solution" means -- what error message do you get, and where?); if what you need is a utf-8 encoded bytestring ... | 1 | 1 | 0 | I have a problem reading a txt file to insert in the mysql db table, te sniped of this code:
file contains the in first line: "aclaración"
archivo = open('file.txt',"r")
for line in archivo.readlines():
....body = body + line
model = MyModel(body=body)
model.save()
i get a DjangoUnicodeDecodeError:
'utf8' co... | Latin letters with acute : DjangoUnicodeDecodeError | 1.2 | 1 | 0 | 3,312 |
1,355,918 | 2009-08-31T05:25:00.000 | 2 | 0 | 1 | 0 | python,linux,user-interface,gtk,pygtk | 1,355,948 | 5 | false | 0 | 1 | Each desktop environment uses a specific toolkit to build it's components. For example, KDE uses Qt and GNOME uses Gtk.
Your use of a toolkit will be dependent upon what type of desktop environment you're targeting at, and if you want to target a wide range of desktops then use a toolkit which will work on many deskto... | 1 | 14 | 0 | Quick question.
I'm using Linux and I want to try making a GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.
Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is there any IDE that all... | Creating GUI with Python in Linux | 0.07983 | 0 | 0 | 48,034 |
1,356,240 | 2009-08-31T07:29:00.000 | 0 | 1 | 0 | 1 | python,filesystems,performance-testing | 1,356,966 | 4 | false | 0 | 0 | You might be inetersting in looking at tools like caollectd and iotop. Then again, yopu mightalso by interested in just using them instead of reinventing the wheel - as far as I see, such performance analysis is not learned in a day, and these guys invested significant amounts of time and knowledge in building these t... | 1 | 1 | 0 | I am writing a python script that will perform performance test in linux file system. so besides deadlocks, race conditions and time takes to perform an action (delete, read, write and create) what other variables/parameters should the test contain? | file system performance testing | 0 | 0 | 0 | 1,679 |
1,356,255 | 2009-08-31T07:32:00.000 | -1 | 0 | 0 | 0 | python,tkinter | 1,356,882 | 2 | false | 0 | 1 | For displaying jpgs in Python check out PIL | 1 | 5 | 0 | I am creating a simple tool to add album cover images to mp3 files in python. So far I am just working on sending a request to amazon with artist and album title, and get the resulting list, as well as finding the actual images for each result. What I want to do is to display a simple frame with a button/link for each ... | Display jpg images in python | -0.099668 | 0 | 0 | 7,084 |
1,358,084 | 2009-08-31T15:47:00.000 | 6 | 1 | 0 | 0 | python,enterprise,banking,onlinebanking | 1,358,743 | 10 | false | 0 | 0 | Of course you can implement mission-critical software (whatever that is in your case) using Python. At the end of the day the success of your application is going to weigh more on its capabilities than whether it is written in Python. Some all .NET companies will even bring in Python applications provided that there is... | 3 | 22 | 0 | I have been exploring and developing an application in Python for mission critical work in the commercial banking arena.
Banks are way conservative in selecting new applications.
I need real proof of stability and others using.
Have looked at the Python site but now I'm hoping this crowd can tell me more.
So far I do... | Python in the enterprise: Pros and cons | 1 | 0 | 0 | 16,188 |
1,358,084 | 2009-08-31T15:47:00.000 | -5 | 1 | 0 | 0 | python,enterprise,banking,onlinebanking | 1,358,385 | 10 | false | 0 | 0 | Python doesn't have anywhere close to as much money backing it as MSFT or Redhat etc. If Guido gets hit by a bus, Python is in trouble.
I <3 python for a lot of things, but a financial transaction system probably wants a real, trusted, stable company backing it.
Edit: this isn't flame bait; this is a major lesson lear... | 3 | 22 | 0 | I have been exploring and developing an application in Python for mission critical work in the commercial banking arena.
Banks are way conservative in selecting new applications.
I need real proof of stability and others using.
Have looked at the Python site but now I'm hoping this crowd can tell me more.
So far I do... | Python in the enterprise: Pros and cons | -1 | 0 | 0 | 16,188 |
1,358,084 | 2009-08-31T15:47:00.000 | 0 | 1 | 0 | 0 | python,enterprise,banking,onlinebanking | 7,913,484 | 10 | false | 0 | 0 | i know topic is rather old, but anyway.
if we talk about mission critical.
Python is widly used in Thales software provided with is hardware encryption solutions.
and in PayShield application for example, which i believe really mission critical.
Although Java is being used there more than Python. | 3 | 22 | 0 | I have been exploring and developing an application in Python for mission critical work in the commercial banking arena.
Banks are way conservative in selecting new applications.
I need real proof of stability and others using.
Have looked at the Python site but now I'm hoping this crowd can tell me more.
So far I do... | Python in the enterprise: Pros and cons | 0 | 0 | 0 | 16,188 |
1,359,090 | 2009-08-31T19:46:00.000 | 7 | 0 | 1 | 0 | python | 1,359,101 | 2 | false | 0 | 0 | If the filename changes, there must still be a link to the file somewhere (otherwise nobody would ever guess the filename). A typical approach is to get the HTML page that contains a link to the file, search through that looking for the link target, and then send a second request to get the actual file you're after.
We... | 1 | 1 | 0 | How can I download files from a website using wildacrds in Python? I have a site that I need to download file from periodically. The problem is the filenames change each time. A portion of the file stays the same though. How can I use a wildcard to specify the unknown portion of the file in a URL? | Wildcard Downloads with Python | 1 | 0 | 1 | 1,403 |
1,359,227 | 2009-08-31T20:19:00.000 | 18 | 0 | 1 | 0 | python,cocoa,xcode,osx-snow-leopard,pyobjc | 1,359,605 | 6 | true | 0 | 1 | Allow me to echo what has already been said. I too am a student who just started a Cocoa development project, and at the beginning I thought "Well, I already know Python, I'll just use PyObjC and save myself from having to learn Objective-C, which looks beyond my grasp." I learned quickly that it can't be done. You can... | 4 | 12 | 0 | I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course an... | PyObjc and Cocoa on Snow Leopard | 1.2 | 0 | 0 | 4,914 |
1,359,227 | 2009-08-31T20:19:00.000 | 4 | 0 | 1 | 0 | python,cocoa,xcode,osx-snow-leopard,pyobjc | 1,359,575 | 6 | false | 0 | 1 | And as one of the Checkout developers I'll weigh in too (hi Quinn!). From what we've seen PyObjC runs fairly well on Snow Leopard. We've built one of the latest SVN revisions 2.2b with some customizations on Leopard and just moved over the site-packages folder.
Theoretically you should be able to use the built in Pytho... | 4 | 12 | 0 | I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course an... | PyObjc and Cocoa on Snow Leopard | 0.132549 | 0 | 0 | 4,914 |
1,359,227 | 2009-08-31T20:19:00.000 | 3 | 0 | 1 | 0 | python,cocoa,xcode,osx-snow-leopard,pyobjc | 1,905,283 | 6 | false | 0 | 1 | I'm a long time python developer who's been doing iPhone apps for awhile now (and only using my python knowledge to package up build files for the apps in run scripts), then who started making some PyObjC apps.
I'd have to say, PyObjC is pretty much STILL having to learn objective C (which I already know via iPhone dev... | 4 | 12 | 0 | I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course an... | PyObjc and Cocoa on Snow Leopard | 0.099668 | 0 | 0 | 4,914 |
1,359,227 | 2009-08-31T20:19:00.000 | 3 | 0 | 1 | 0 | python,cocoa,xcode,osx-snow-leopard,pyobjc | 1,359,428 | 6 | false | 0 | 1 | I hardly use PyObjC myself, but I believe you need to run the Xcode installer on the Snow Leopard DVD in order to use PyObjC.
Also, as Quinn said, you will need to understand at least some Objective-C in order to use a Cocoa bridge like PyObjC without tearing your hair out. It just doesn't insulate you that completely. | 4 | 12 | 0 | I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course an... | PyObjc and Cocoa on Snow Leopard | 0.099668 | 0 | 0 | 4,914 |
1,359,449 | 2009-08-31T21:10:00.000 | 4 | 0 | 0 | 0 | python,django,mod-wsgi | 2,978,457 | 4 | false | 1 | 0 | I just had this problem. It went away when I added sys.path.append('/path/to/project') to my .wsgi file. | 4 | 3 | 0 | I have fecora 11, set django with mod_wsgi2.5 and apache2.2. And I can run "python manage.py runserver" at local. It works fine. I got error when i test from remote browser.
Thanks for any suggestion and help! | django : ImportError No module named myapp.views.hometest | 0.197375 | 0 | 0 | 7,581 |
1,359,449 | 2009-08-31T21:10:00.000 | 1 | 0 | 0 | 0 | python,django,mod-wsgi | 1,360,370 | 4 | false | 1 | 0 | All required env variables should be set in django.wsgi. You could compare the env declared in django.wsgi and the env of executing ./manage runserver and make sure they are same.
Furthermore, if there is another myapp package which could be found through PYTHONPATH before /usr/local/django/myapp, ImportError may be ra... | 4 | 3 | 0 | I have fecora 11, set django with mod_wsgi2.5 and apache2.2. And I can run "python manage.py runserver" at local. It works fine. I got error when i test from remote browser.
Thanks for any suggestion and help! | django : ImportError No module named myapp.views.hometest | 0.049958 | 0 | 0 | 7,581 |
1,359,449 | 2009-08-31T21:10:00.000 | 2 | 0 | 0 | 0 | python,django,mod-wsgi | 1,359,482 | 4 | false | 1 | 0 | Is the application containing your Django project in your $PYTHONPATH (when Python is invoked in a server context)? For example, if your Django project is at /home/wwwuser/web/myproj, then /home/wwwuser/web should be in your $PYTHONPATH. You should set this in the script that loads the project when invoked from the web... | 4 | 3 | 0 | I have fecora 11, set django with mod_wsgi2.5 and apache2.2. And I can run "python manage.py runserver" at local. It works fine. I got error when i test from remote browser.
Thanks for any suggestion and help! | django : ImportError No module named myapp.views.hometest | 0.099668 | 0 | 0 | 7,581 |
1,359,449 | 2009-08-31T21:10:00.000 | 1 | 0 | 0 | 0 | python,django,mod-wsgi | 1,359,494 | 4 | false | 1 | 0 | Just a guess, but unless you've explicitly made sure that your app is on PYTHONPATH, you should be specifying views in urls.py as myproject.myapp.views.functionname.
Otherwise:
check if you're setting PYTHONPATH, or what to. Your project directory should be in there.
if you enable the django admin (by uncommenting the... | 4 | 3 | 0 | I have fecora 11, set django with mod_wsgi2.5 and apache2.2. And I can run "python manage.py runserver" at local. It works fine. I got error when i test from remote browser.
Thanks for any suggestion and help! | django : ImportError No module named myapp.views.hometest | 0.049958 | 0 | 0 | 7,581 |
1,360,507 | 2009-09-01T04:17:00.000 | 0 | 0 | 1 | 0 | python-3.x,python | 1,360,566 | 3 | false | 0 | 0 | a list out of the second element of
each inner list
that sounds like [sl[1] for sl in dict1['a']] -- so what's the QUESTION?!-) | 1 | 2 | 0 | I have a dictionary dict1['a'] = [ [1,2], [3,4] ] and need to generate a list out of it as l1 = [2, 4]. That is, a list out of the second element of each inner list. It can be a separate list or even the dictionary can be modified as dict1['a'] = [2,4]. | Generating a list from complex dictionary | 0 | 0 | 0 | 261 |
1,363,413 | 2009-09-01T16:27:00.000 | 2 | 0 | 1 | 0 | python,performance,list,lambda,map-function | 1,363,489 | 9 | false | 0 | 0 | Several of the other respondents have reasonable implementations of the algorithm you asked for, but I'm unclear on exactly what problem it is you're really trying to solve.
Unless the numbers being stored are very large (i.e., overflow an integer and require bignums), your list of diffs won't gain you any efficiency -... | 1 | 3 | 0 | I need to store a big list of integers in Bigtable(db). For efficiency I am storing them as diff between 2 consecutive items.
for eg:
original_list = [1005, 1004, 1003, 1004, 1006]
Storing the above list(which actually contains more than 1000k items) as
start = 1005
diff = [-1, -1, 1, 2]
The closest I could manage i... | Efficient way to use python's lambda, map | 0.044415 | 0 | 0 | 7,607 |
1,364,173 | 2009-09-01T19:17:00.000 | 10 | 0 | 0 | 0 | python | 48,303,184 | 12 | false | 0 | 0 | On Mac press Ctrl+\ to quit a python process attached to a terminal. | 7 | 142 | 0 | I have a python script that uses threads and makes lots of HTTP requests. I think what's happening is that while a HTTP request (using urllib2) is reading, it's blocking and not responding to CtrlC to stop the program. Is there any way around this? | Stopping python using ctrl+c | 1 | 0 | 1 | 234,195 |
1,364,173 | 2009-09-01T19:17:00.000 | 24 | 0 | 0 | 0 | python | 40,704,008 | 12 | false | 0 | 0 | This post is old but I recently ran into the same problem of Ctrl+C not terminating Python scripts on Linux. I used Ctrl+\ (SIGQUIT). | 7 | 142 | 0 | I have a python script that uses threads and makes lots of HTTP requests. I think what's happening is that while a HTTP request (using urllib2) is reading, it's blocking and not responding to CtrlC to stop the program. Is there any way around this? | Stopping python using ctrl+c | 1 | 0 | 1 | 234,195 |
1,364,173 | 2009-09-01T19:17:00.000 | 3 | 0 | 0 | 0 | python | 42,792,308 | 12 | false | 0 | 0 | On a mac / in Terminal:
Show Inspector (right click within the terminal window or Shell >Show Inspector)
click the Settings icon above "running processes"
choose from the list of options under "Signal Process Group" (Kill, terminate, interrupt, etc). | 7 | 142 | 0 | I have a python script that uses threads and makes lots of HTTP requests. I think what's happening is that while a HTTP request (using urllib2) is reading, it's blocking and not responding to CtrlC to stop the program. Is there any way around this? | Stopping python using ctrl+c | 0.049958 | 0 | 1 | 234,195 |
1,364,173 | 2009-09-01T19:17:00.000 | 1 | 0 | 0 | 0 | python | 52,672,359 | 12 | false | 0 | 0 | Forcing the program to close using Alt+F4 (shuts down current program)
Spamming the X button on CMD for e.x.
Taskmanager (first Windows+R and then "taskmgr") and then end the task.
Those may help. | 7 | 142 | 0 | I have a python script that uses threads and makes lots of HTTP requests. I think what's happening is that while a HTTP request (using urllib2) is reading, it's blocking and not responding to CtrlC to stop the program. Is there any way around this? | Stopping python using ctrl+c | 0.016665 | 0 | 1 | 234,195 |
1,364,173 | 2009-09-01T19:17:00.000 | 57 | 0 | 0 | 0 | python | 1,364,179 | 12 | false | 0 | 0 | If it is running in the Python shell use Ctrl + Z, otherwise locate the python process and kill it. | 7 | 142 | 0 | I have a python script that uses threads and makes lots of HTTP requests. I think what's happening is that while a HTTP request (using urllib2) is reading, it's blocking and not responding to CtrlC to stop the program. Is there any way around this? | Stopping python using ctrl+c | 1 | 0 | 1 | 234,195 |
1,364,173 | 2009-09-01T19:17:00.000 | 1 | 0 | 0 | 0 | python | 54,316,333 | 12 | false | 0 | 0 | For the record, what killed the process on my Raspberry 3B+ (running raspbian) was Ctrl+'. On my French AZERTY keyboard, the touch ' is also number 4. | 7 | 142 | 0 | I have a python script that uses threads and makes lots of HTTP requests. I think what's happening is that while a HTTP request (using urllib2) is reading, it's blocking and not responding to CtrlC to stop the program. Is there any way around this? | Stopping python using ctrl+c | 0.016665 | 0 | 1 | 234,195 |
1,364,173 | 2009-09-01T19:17:00.000 | 206 | 0 | 0 | 0 | python | 1,364,199 | 12 | true | 0 | 0 | On Windows, the only sure way is to use CtrlBreak. Stops every python script instantly!
(Note that on some keyboards, "Break" is labeled as "Pause".) | 7 | 142 | 0 | I have a python script that uses threads and makes lots of HTTP requests. I think what's happening is that while a HTTP request (using urllib2) is reading, it's blocking and not responding to CtrlC to stop the program. Is there any way around this? | Stopping python using ctrl+c | 1.2 | 0 | 1 | 234,195 |
1,364,733 | 2009-09-01T21:26:00.000 | 17 | 0 | 0 | 1 | python,google-app-engine,redirect | 1,364,875 | 5 | true | 1 | 0 | You can check if os.environ['HTTP_HOST'].endswith('.appspot.com') -- if so, then you're serving from something.appspot.com and can send a redirect, or otherwise alter your behavior as desired.
You could deploy this check-and-redirect-if-needed (or other behavior alteration of your choice) in any of various ways (decora... | 1 | 14 | 0 | How can I prevent a user from accessing my app at example.appspot.com and force them to access it at example.com? I already have example.com working, but I don't want users to be able to access the appspot domain. I'm using python. | Block requests from *.appspot.com and force custom domain in Google App Engine | 1.2 | 0 | 0 | 5,133 |
1,365,164 | 2009-09-01T23:32:00.000 | 5 | 0 | 0 | 0 | python,database,settings | 1,365,175 | 4 | false | 0 | 0 | One caveat might depend on where the user is using the application from. For example, if they use two computers with different screen resolutions, and 'selected zoom/text size' is one of the things you associate with the user, it might not always be suitable. It depends what kind of settings you intend to allow the use... | 4 | 2 | 0 | I'm building a fairly large enterprise application made in python that on its first version will require network connection.
I've been thinking in keeping some user settings stored on the database, instead of a file in the users home folder.
Some of the advantages I've thought of are:
the user can change computers kee... | Is storing user configuration settings on database OK? | 0.244919 | 1 | 0 | 650 |
1,365,164 | 2009-09-01T23:32:00.000 | 3 | 0 | 0 | 0 | python,database,settings | 1,365,176 | 4 | false | 0 | 0 | Do you need the database to run any part of the application? If that's the case there are no reasons not to store the config inside the DB. You already mentioned the benefits and there are no downsides. | 4 | 2 | 0 | I'm building a fairly large enterprise application made in python that on its first version will require network connection.
I've been thinking in keeping some user settings stored on the database, instead of a file in the users home folder.
Some of the advantages I've thought of are:
the user can change computers kee... | Is storing user configuration settings on database OK? | 0.148885 | 1 | 0 | 650 |
1,365,164 | 2009-09-01T23:32:00.000 | 3 | 0 | 0 | 0 | python,database,settings | 1,365,183 | 4 | false | 0 | 0 | It's perfectly reasonable to keep user settings in the database, as long as the settings pertain to the application independent of user location. One possible advantage of a file in the user's home folder is that users can send settings to one another. You may of course regard this as an advantage or a disadvantage :-) | 4 | 2 | 0 | I'm building a fairly large enterprise application made in python that on its first version will require network connection.
I've been thinking in keeping some user settings stored on the database, instead of a file in the users home folder.
Some of the advantages I've thought of are:
the user can change computers kee... | Is storing user configuration settings on database OK? | 0.148885 | 1 | 0 | 650 |
1,365,164 | 2009-09-01T23:32:00.000 | 8 | 0 | 0 | 0 | python,database,settings | 1,365,178 | 4 | true | 0 | 0 | This is pretty standard. Go for it.
The caveat is that when you take the database down for maintenance, no one can use the app because their profile is inaccessible. You can either solve that by making a 100%-on db solution, or, more easily, through some form of caching of profiles locally (an "offline" mode of operati... | 4 | 2 | 0 | I'm building a fairly large enterprise application made in python that on its first version will require network connection.
I've been thinking in keeping some user settings stored on the database, instead of a file in the users home folder.
Some of the advantages I've thought of are:
the user can change computers kee... | Is storing user configuration settings on database OK? | 1.2 | 1 | 0 | 650 |
1,365,254 | 2009-09-02T00:03:00.000 | 1 | 1 | 0 | 1 | python,security,design-patterns,authentication,cracking | 1,365,394 | 2 | false | 0 | 0 | Possibly:
The user enters their credentials into the desktop client.
The client says to the server: "Hi, my name username and my password is password".
The server checks these.
The server says to the client: "Hi, username. Here is your secret token: ..."
Subsequently the client uses the secret token together with the... | 2 | 2 | 0 | I'm building a centralized desktop application using Python/wxPython. One of the requirements is User authentication, which I'm trying to implement using LDAP (although this is not mandatory).
Users of the system will be mechanical and electrical engineers making budgets, and the biggest problem would be industrial esp... | How to deal with user authentication and wrongful modification in scripting languages? | 0.099668 | 0 | 0 | 272 |
1,365,254 | 2009-09-02T00:03:00.000 | 3 | 1 | 0 | 1 | python,security,design-patterns,authentication,cracking | 1,365,422 | 2 | true | 0 | 0 | How malicious are your users? Really.
Exactly how malicious?
If your users are evil sociopaths and can't be trusted with a desktop solution, then don't build a desktop solution. Build a web site.
If your users are ordinary users, they'll screw the environment up by installing viruses, malware and keyloggers from porn... | 2 | 2 | 0 | I'm building a centralized desktop application using Python/wxPython. One of the requirements is User authentication, which I'm trying to implement using LDAP (although this is not mandatory).
Users of the system will be mechanical and electrical engineers making budgets, and the biggest problem would be industrial esp... | How to deal with user authentication and wrongful modification in scripting languages? | 1.2 | 0 | 0 | 272 |
1,365,265 | 2009-09-02T00:07:00.000 | 47 | 0 | 0 | 1 | python,sockets,ipc,port | 1,365,281 | 5 | false | 0 | 0 | Bind the socket to port 0. A random free port from 1024 to 65535 will be selected. You may retrieve the selected port with getsockname() right after bind(). | 2 | 189 | 0 | I'm trying to play with inter-process communication and since I could not figure out how to use named pipes under Windows I thought I'll use network sockets. Everything happens locally. The server is able to launch slaves in a separate process and listens on some port. The slaves do their work and submit the result to ... | On localhost, how do I pick a free port number? | 1 | 0 | 1 | 154,753 |
1,365,265 | 2009-09-02T00:07:00.000 | 4 | 0 | 0 | 1 | python,sockets,ipc,port | 1,365,283 | 5 | false | 0 | 0 | You can listen on whatever port you want; generally, user applications should listen to ports 1024 and above (through 65535). The main thing if you have a variable number of listeners is to allocate a range to your app - say 20000-21000, and CATCH EXCEPTIONS. That is how you will know if a port is unusable (used by a... | 2 | 189 | 0 | I'm trying to play with inter-process communication and since I could not figure out how to use named pipes under Windows I thought I'll use network sockets. Everything happens locally. The server is able to launch slaves in a separate process and listens on some port. The slaves do their work and submit the result to ... | On localhost, how do I pick a free port number? | 0.158649 | 0 | 1 | 154,753 |
1,365,737 | 2009-09-02T03:45:00.000 | 4 | 0 | 0 | 1 | python,twisted | 1,408,498 | 3 | true | 0 | 0 | The best option is really just to do the obvious thing here. Don't have a loop, or a repeating timed call; just have handlers that do the right thing.
Keep a central connection-management object around, and make event-handling methods feed it the information it needs to keep going. When it starts, make 5 outgoing con... | 1 | 6 | 0 | I'm trying to use Twisted in a sort of spidering program that manages multiple client connections. I'd like to maintain of a pool of about 5 clients working at one time. The functionality of each client is to connect to a specified IRC server that it gets from a list, enter a specific channel, and then save the list ... | Managing multiple Twisted client connections | 1.2 | 0 | 1 | 4,725 |
1,365,797 | 2009-09-02T04:15:00.000 | 9 | 0 | 0 | 1 | python,windows,python-2.x | 1,365,827 | 6 | false | 0 | 0 | In order to use the \\?\ prefix (as already proposed), you also need to make sure you use Unicode strings as filenames, not regular (byte) strings. | 1 | 13 | 0 | I write Python script to copy files; unfortunately it keeps failing because filename is too long(>256). Is there anyway to deal with that problem?
I'm using Python 2.5.4 and Windows XP.
Cheers, | Python long filename support broken in Windows | 1 | 0 | 0 | 8,165 |
1,367,189 | 2009-09-02T11:39:00.000 | 5 | 0 | 0 | 0 | python,download,webpage,wget,web-crawler | 1,367,209 | 2 | true | 1 | 0 | Write a bash script that uses wget and put it in your crontab to run every 5 minutes. (*/5 * * * *)
If you need to keep a history of all these web pages, set a variable at the beginning of your script with the current unixtime and append it to the output filenames. | 1 | 1 | 0 | I want to download a list of web pages. I know wget can do this. However downloading every URL in every five minutes and save them to a folder seems beyond the capability of wget.
Does anyone knows some tools either in java or python or Perl which accomplishes the task?
Thanks in advance. | How to download a webpage in every five minutes? | 1.2 | 0 | 1 | 2,545 |
1,367,453 | 2009-09-02T12:39:00.000 | 1 | 0 | 0 | 0 | python,web-services,sockets | 1,372,289 | 4 | false | 0 | 0 | The furthest I came was using modified asynchttp, that codeape suggested. I have tried to use both asyncore/asynchat and asynchttp, with lots of pain. It took me far too long to try to fix all the bugs in it (there's a method handle_read, nearly copied from asyncore, only badly indented and was giving me headaches with... | 1 | 7 | 0 | I would like to read a website asynchronously, which isnt possible with urllib as far as I know. Now I tried reading with with plain sockets, but HTTP is giving me hell.
I run into all kind of funky encodings, for example transfer-encoding: chunked, have to parse all that stuff manually, and I feel like coding C, not p... | Reading a website with asyncore | 0.049958 | 0 | 1 | 2,352 |
1,368,261 | 2009-09-02T15:03:00.000 | 6 | 0 | 1 | 0 | python,io,buffer | 1,368,274 | 2 | false | 0 | 0 | I think you might be looking for StringIO. | 1 | 17 | 0 | I've written a buffer class that provides a File-like interface with read, write, seek, tell, flush methods to a simple string in memory. Of course it is incomplete (e.g. I didn't write readline). It's purpose is to be filled by a background thread from some external data source, but let a user treat it like a file. I'... | python file-like buffer object | 1 | 0 | 0 | 14,219 |
1,369,086 | 2009-09-02T17:27:00.000 | 5 | 0 | 0 | 0 | wxpython,textctrl | 1,370,281 | 7 | true | 0 | 1 | IntCtrl, Masked Edit Control, and NumCtrl are all designed to do just this, with different levels of control. Checkout the wx demo under "More Windows/Controls" to see how they work.
(Or, if you're instead really looking forward to doing this directly with a raw TextCtrl, I think you'd want to catch EVT_CHAR events, t... | 2 | 10 | 0 | I want to have a text control that only accepts numbers. (Just integer values like 45 or 366)
What is the best way to do this? | Is it possible to limit TextCtrl to accept numbers only in wxPython? | 1.2 | 0 | 0 | 11,475 |
1,369,086 | 2009-09-02T17:27:00.000 | -1 | 0 | 0 | 0 | wxpython,textctrl | 23,052,986 | 7 | false | 0 | 1 | Please check "Validator.py" script in wxpython demo. it is exactly what you need | 2 | 10 | 0 | I want to have a text control that only accepts numbers. (Just integer values like 45 or 366)
What is the best way to do this? | Is it possible to limit TextCtrl to accept numbers only in wxPython? | -0.028564 | 0 | 0 | 11,475 |
1,369,167 | 2009-09-02T17:47:00.000 | 2 | 0 | 1 | 0 | python,open-source,platform | 1,371,057 | 3 | false | 0 | 0 | I already set up my own server. Solace seems great. | 2 | 6 | 0 | Has anyone tried Solace yet?
"Solace is a fully open-sourced multilingual support and knowledge exchange platform written in Python."
Just wanted to know your experience. Are there any other such platforms available in open source? | Anyone tried Solace? Solace - a multilingual support platform | 0.132549 | 0 | 0 | 1,060 |
1,369,167 | 2009-09-02T17:47:00.000 | 2 | 0 | 1 | 0 | python,open-source,platform | 2,694,946 | 3 | false | 0 | 0 | We just started using it at our company. You get what you pay for. Feels like a weekender project. Gets the job done, but lacks the polish of Stack Overflow. The documentation is weak. I find it ironic that Plurk doesn't run an instance of Solace to field support questions for Solace. If they do they don't advertise it... | 2 | 6 | 0 | Has anyone tried Solace yet?
"Solace is a fully open-sourced multilingual support and knowledge exchange platform written in Python."
Just wanted to know your experience. Are there any other such platforms available in open source? | Anyone tried Solace? Solace - a multilingual support platform | 0.132549 | 0 | 0 | 1,060 |
1,369,861 | 2009-09-02T20:10:00.000 | 2 | 0 | 0 | 1 | python,api,google-app-engine,picasa,urlfetch | 1,369,908 | 1 | true | 1 | 0 | Your question is a little off, since the Data API is exposed through RESTful URLs, so both methods are ultimately a "URL Fetch".
The Data API works quite well, though. It gives you access to nearly all the functionality of Picasa, and responses are sent back and forth in well-formed, well-documented XML. Google's docum... | 1 | 0 | 0 | How would you query Picasa from a Google App Engine app? Data API or Url Fetch? What are the pros and cons of using either method?
[Edit]
I would like to be able to query a specific album in Picasa and list all the photos in it.
Code examples to do this in python are much appreciated. | How would you query Picasa from a Google App Engine app? Data API or Url Fetch? | 1.2 | 0 | 0 | 1,248 |
1,371,994 | 2009-09-03T07:50:00.000 | 3 | 1 | 1 | 0 | python,import,ironpython | 67,905,932 | 3 | false | 0 | 1 | If you have installed IronPython from NuGet packages and you want modules from the CPython Standard Library then the best way to do it is by installing the IronPython.StdLib NuGet package which is from the same authors of IronPython. | 1 | 20 | 0 | I'm currently working on an application written in C#, which I'm embedding IronPython in. I generally have no problems about it, but there's one thing that I don't know how to deal with.
I want to import an external module into the script. How can I do that? Simple import ext_lib doesn't work. Should I add a path to t... | Importing external module in IronPython | 0.197375 | 0 | 0 | 34,961 |
1,372,531 | 2009-09-03T10:02:00.000 | 1 | 0 | 1 | 0 | c#,java,c++,python,algorithm | 1,372,627 | 4 | false | 0 | 0 | You could build an index which maps words to phrases and do something like:
let matched = set of all phrases
for each word in the searched phrase
let wordMatch = all phrases containing the current word
let matched = intersection of matched and wordMatch
After this, matched would contain all phrases matching a... | 2 | 1 | 1 | Given a set of phrases, i would like to filter the set of all phrases that contain any of the other phrases. Contained here means that if a phrase contains all the words of another phrase it should be filtered out. Order of the words within the phrase does not matter.
What i have so far is this:
Sort the set by the nu... | Algorithm to filter a set of all phrases containing in other phrase | 0.049958 | 0 | 0 | 709 |
1,372,531 | 2009-09-03T10:02:00.000 | 0 | 0 | 1 | 0 | c#,java,c++,python,algorithm | 1,372,585 | 4 | false | 0 | 0 | sort phrases by their contents, i.e., 'Z A' -> 'A Z', then eliminating phrases is easy going from shortest to longer ones. | 2 | 1 | 1 | Given a set of phrases, i would like to filter the set of all phrases that contain any of the other phrases. Contained here means that if a phrase contains all the words of another phrase it should be filtered out. Order of the words within the phrase does not matter.
What i have so far is this:
Sort the set by the nu... | Algorithm to filter a set of all phrases containing in other phrase | 0 | 0 | 0 | 709 |
1,376,835 | 2009-09-04T01:40:00.000 | 0 | 0 | 1 | 0 | python,regex | 1,376,880 | 5 | false | 0 | 0 | First of all, you'll need some conventions. Is 3.55 five minutes to four hours, five milliseconds to four seconds, or 3 and 55/100 of a minute/hour/second? The same applies to 3:55. At least have a distinction between dot and colon, specifying that a dot means a fraction and a colon, a separator of hour/minute/second.
... | 3 | 0 | 0 | I need to calculate (using python) how much time a user has inputed, whether they input something like 3:30 or 3.5. I'm not really sure what the best way to go about this is and I thought I'd ask for advice from the experts.
=== Edit ==================
To specify more clearly, I want the user to input hours and minu... | calculate user inputed time with Python | 0 | 0 | 0 | 2,254 |
1,376,835 | 2009-09-04T01:40:00.000 | 0 | 0 | 1 | 0 | python,regex | 1,376,843 | 5 | false | 0 | 0 | There are a few possible solutions, but at some point you're gonna run into ambiguous cases that will result in arbitrary conversions.
Overall I'd suggest taking any input and parsing the separators (whether : or . or something else) and then converting to seconds based on some schema of units you've defined.
Alternati... | 3 | 0 | 0 | I need to calculate (using python) how much time a user has inputed, whether they input something like 3:30 or 3.5. I'm not really sure what the best way to go about this is and I thought I'd ask for advice from the experts.
=== Edit ==================
To specify more clearly, I want the user to input hours and minu... | calculate user inputed time with Python | 0 | 0 | 0 | 2,254 |
1,376,835 | 2009-09-04T01:40:00.000 | 0 | 0 | 1 | 0 | python,regex | 1,377,036 | 5 | false | 0 | 0 | Can you do this with a GUI and restrict the user input? Processing the text seems super error prone otherwise (on the part of the user, not to mention the programmer), and for hours worked... you sort-of want to get that right. | 3 | 0 | 0 | I need to calculate (using python) how much time a user has inputed, whether they input something like 3:30 or 3.5. I'm not really sure what the best way to go about this is and I thought I'd ask for advice from the experts.
=== Edit ==================
To specify more clearly, I want the user to input hours and minu... | calculate user inputed time with Python | 0 | 0 | 0 | 2,254 |
1,377,130 | 2009-09-04T03:44:00.000 | 4 | 0 | 0 | 0 | python,numpy,data-analysis | 11,086,822 | 4 | false | 0 | 0 | If you are willing to consider a library, pandas (http://pandas.pydata.org/) is a library built on top of numpy which amongst many other things provides:
Intelligent data alignment and integrated handling of missing data: gain automatic label-based alignment in computations and easily manipulate messy data into an ord... | 1 | 11 | 1 | One of the things I deal with most in data cleaning is missing values. R deals with this well using its "NA" missing data label. In python, it appears that I'll have to deal with masked arrays which seem to be a major pain to set up and don't seem to be well documented. Any suggestions on making this process easier in ... | How do you deal with missing data using numpy/scipy? | 0.197375 | 0 | 0 | 10,010 |
1,377,548 | 2009-09-04T06:28:00.000 | 0 | 1 | 1 | 0 | .net,python,ironpython | 1,383,258 | 5 | false | 0 | 0 | You can also consider using Eclipse with PyDev which has support for IronPython | 3 | 0 | 0 | I'm attempting to learn IronPython, to broaden my .NET horizons. I want to be able to use Python to write the unit-tests for my next personal project. So being able to access C#.NET assemblies from my Python code is necessary. I also wanted an IDE with auto-complete and smart indenting. PyScripter seemed like a good o... | What kind of setup (IDE et al) do I need to run IronPython unit tests of C#.NET developed assemblies? | 0 | 0 | 0 | 210 |
1,377,548 | 2009-09-04T06:28:00.000 | 0 | 1 | 1 | 0 | .net,python,ironpython | 1,378,519 | 5 | false | 0 | 0 | FWIW, Frood himself uses Wing IDE.
But, if its on Windows, why not VS? | 3 | 0 | 0 | I'm attempting to learn IronPython, to broaden my .NET horizons. I want to be able to use Python to write the unit-tests for my next personal project. So being able to access C#.NET assemblies from my Python code is necessary. I also wanted an IDE with auto-complete and smart indenting. PyScripter seemed like a good o... | What kind of setup (IDE et al) do I need to run IronPython unit tests of C#.NET developed assemblies? | 0 | 0 | 0 | 210 |
1,377,548 | 2009-09-04T06:28:00.000 | 0 | 1 | 1 | 0 | .net,python,ironpython | 1,389,592 | 5 | false | 0 | 0 | You can use Visual Studio. I use IronPython Studio integrated with VS2008. But I feel that it has very poor intellisense for Python. | 3 | 0 | 0 | I'm attempting to learn IronPython, to broaden my .NET horizons. I want to be able to use Python to write the unit-tests for my next personal project. So being able to access C#.NET assemblies from my Python code is necessary. I also wanted an IDE with auto-complete and smart indenting. PyScripter seemed like a good o... | What kind of setup (IDE et al) do I need to run IronPython unit tests of C#.NET developed assemblies? | 0 | 0 | 0 | 210 |
1,380,079 | 2009-09-04T15:52:00.000 | 7 | 0 | 0 | 0 | python,ruby-on-rails,django,web2py | 1,380,536 | 10 | false | 1 | 0 | Web2py is a good one to learn. If this is going to be deployed to a server, double check it supports wsgi. Sometimes php is the way to go because you know it's supported almost anywhere. | 5 | 15 | 0 | Given the size of web2py and the lack of resources and corporate support, do you think it would be advisable to learn web2py as the only web development framework I know. I'm considersing learning Ruby on Rails or web2py for a website I need to create for as a school project. | web2py in the future? | 1 | 0 | 0 | 9,030 |
1,380,079 | 2009-09-04T15:52:00.000 | 1 | 0 | 0 | 0 | python,ruby-on-rails,django,web2py | 10,003,970 | 10 | false | 1 | 0 | I've already used Java EE and Django. The web2py learning curve is so fast! It's incredible! Things that I was getting a time to develop in three days using java, I can do fastly using web2py. Of course, Web2py has not the same ready plugins that RoR, but, doubtless, we can do these things fastly using web2py. Therefor... | 5 | 15 | 0 | Given the size of web2py and the lack of resources and corporate support, do you think it would be advisable to learn web2py as the only web development framework I know. I'm considersing learning Ruby on Rails or web2py for a website I need to create for as a school project. | web2py in the future? | 0.019997 | 0 | 0 | 9,030 |
1,380,079 | 2009-09-04T15:52:00.000 | 1 | 0 | 0 | 0 | python,ruby-on-rails,django,web2py | 3,646,728 | 10 | false | 1 | 0 | Glad I found this thread! Cause some outdated pages and broken external links on Web2Py's website almost scared me off. But at least now I know there's a pretty good community around Web2Py.
I've just been looking through a load of Python web frameworks, and Web2Py's description sounded enticing and managed to make Dj... | 5 | 15 | 0 | Given the size of web2py and the lack of resources and corporate support, do you think it would be advisable to learn web2py as the only web development framework I know. I'm considersing learning Ruby on Rails or web2py for a website I need to create for as a school project. | web2py in the future? | 0.019997 | 0 | 0 | 9,030 |
1,380,079 | 2009-09-04T15:52:00.000 | 3 | 0 | 0 | 0 | python,ruby-on-rails,django,web2py | 1,381,094 | 10 | false | 1 | 0 | Ask yourself what you are looking to gain from the experience. Ie, is it more important to just get the application built and running with a minimum of time and effort, or are you trying to learn about web stack architecture?
If you're just looking for results, obviously you'll have more code and documentation to borr... | 5 | 15 | 0 | Given the size of web2py and the lack of resources and corporate support, do you think it would be advisable to learn web2py as the only web development framework I know. I'm considersing learning Ruby on Rails or web2py for a website I need to create for as a school project. | web2py in the future? | 0.059928 | 0 | 0 | 9,030 |
1,380,079 | 2009-09-04T15:52:00.000 | 12 | 0 | 0 | 0 | python,ruby-on-rails,django,web2py | 1,380,121 | 10 | false | 1 | 0 | Learning is good.
Learning something (that eventually goes away) is no loss at all. The basic skills of web development (HTML, CSS, URL-parsing, GET vs. POST) don't ever change.
Frameworks come and go. Learn as many as you can. Learn how to manage your learning so that you (a) get to the important stuff first and (b... | 5 | 15 | 0 | Given the size of web2py and the lack of resources and corporate support, do you think it would be advisable to learn web2py as the only web development framework I know. I'm considersing learning Ruby on Rails or web2py for a website I need to create for as a school project. | web2py in the future? | 1 | 0 | 0 | 9,030 |
1,380,592 | 2009-09-04T17:35:00.000 | 4 | 1 | 1 | 0 | python,matlab,console | 1,380,716 | 4 | true | 0 | 0 | I really like Safari's Web Inspector Javascript console. Specifically:
Collapsible interactive object hierarchies
sprintf-style logging
Pretty-printing of closures, allowing you to peer into the internals of anonymous functions
Auto-complete / hinting of object properties on the command-line | 2 | 3 | 0 | Many languages of REPL consoles with additional features like autocomplete and intellisense. For instance, iPython, Mathematica, and PyCrust all make some effort to go beyond a basic read eval loop. REPLs are particularly useful in languages where interactive exploration is very important, such as Matlab or R.
I'm lo... | Slickest REPL console in any language | 1.2 | 0 | 0 | 352 |
1,380,592 | 2009-09-04T17:35:00.000 | 5 | 1 | 1 | 0 | python,matlab,console | 1,380,870 | 4 | false | 0 | 0 | Common Lisp and emacs with SLIME. All you could really want, think of, dream of, and then some. | 2 | 3 | 0 | Many languages of REPL consoles with additional features like autocomplete and intellisense. For instance, iPython, Mathematica, and PyCrust all make some effort to go beyond a basic read eval loop. REPLs are particularly useful in languages where interactive exploration is very important, such as Matlab or R.
I'm lo... | Slickest REPL console in any language | 0.244919 | 0 | 0 | 352 |
1,380,784 | 2009-09-04T18:18:00.000 | 2 | 0 | 0 | 1 | python,ubuntu,gtk,pygtk,window-management | 1,380,909 | 6 | false | 0 | 0 | I really don't know how to check if a window is a GTK one. But if you want to check how many windows are currently open try "wmctrl -l". Install it first of course. | 1 | 10 | 0 | How to get list opened windows in PyGTK or GTK or other programming language? in Ubuntu?
edit:
i want get list paths opened directories on desktop! | How to get list opened windows in PyGTK or GTK in Ubuntu? | 0.066568 | 0 | 0 | 9,460 |
1,380,852 | 2009-09-04T18:34:00.000 | 2 | 0 | 1 | 1 | python,ruby,executable | 1,381,231 | 4 | false | 0 | 0 | py2exe is great, I've used it before and it works just fine for encapsulating a program so it can run on other computers, even those lacking python. Like Alex said, it can be disassembled, but then so can C++ binaries. It's just a question of how much work the person is has to put into it. If someone has physical acces... | 2 | 0 | 0 | What happens when you package a script as an executable? Is this a good way to distribute commercial applications? I remember I read something a long time ago that when you package scripts as executables, at runtime the exe decompresses the scripts to a temporary directory where they get ran.
If it's like that, than I ... | Is packaging scripts as executables a solution for comercial applications? | 0.099668 | 0 | 0 | 260 |
1,380,852 | 2009-09-04T18:34:00.000 | 3 | 0 | 1 | 1 | python,ruby,executable | 1,381,289 | 4 | false | 0 | 0 | Creating an application and creating a commercial software business are two distinct things.
At my job we have a commercial application developed in Ruby on Rails that is installed at client sites; no obfuscation or encryption applied.
There is just so much more going on at a business level: support, customization, t... | 2 | 0 | 0 | What happens when you package a script as an executable? Is this a good way to distribute commercial applications? I remember I read something a long time ago that when you package scripts as executables, at runtime the exe decompresses the scripts to a temporary directory where they get ran.
If it's like that, than I ... | Is packaging scripts as executables a solution for comercial applications? | 0.148885 | 0 | 0 | 260 |
1,380,860 | 2009-09-04T18:36:00.000 | 9 | 0 | 1 | 0 | python,tuples | 1,381,304 | 8 | false | 0 | 0 | " once the info is added to the DB, should I delete the tuple? i mean i dont need the tuple anymore."
No.
Generally, there's no reason to delete anything. There are some special cases for deleting, but they're very, very rare.
Simply define a narrow scope (i.e., a function definition or a method function in a class) a... | 1 | 353 | 0 | I am learning Python and creating a database connection.
While trying to add to the DB, I am thinking of creating tuples out of information and then add them to the DB.
What I am Doing:
I am taking information from the user and store it in variables.
Can I add these variables into a tuple? Can you please help me wit... | Add Variables to Tuple | 1 | 1 | 0 | 728,594 |
1,380,985 | 2009-09-04T19:01:00.000 | 7 | 0 | 1 | 0 | python,multithreading,logging | 1,381,468 | 1 | false | 0 | 0 | Not entirely sure what you mean by "one thread fails", but if by "fail" you mean that an exception propagates all the way up to the top function of the thread, then you can wrap every thread's top function (e.g. in a decorator) to catch any exception, log whatever you wish, and re-raise. The logging module should ensu... | 1 | 3 | 0 | I was thinking of using the logging module to log all events to one file. The number of threads should be constant from start to finish, but if one thread fails, I'd like to just log that and continue on. What's a simple way of accomplishing this? Thanks! | Logging multithreaded processes in python | 1 | 0 | 0 | 1,671 |
1,381,346 | 2009-09-04T20:16:00.000 | 0 | 0 | 0 | 0 | python,django,django-models,django-orm | 1,381,517 | 5 | false | 1 | 0 | I'd like to have a Python program
which is run using a cronjob instead
of manually visiting the correct URL
to update the information.
A simplistic alternative: write a cronjob to automatically "visit the correct URL to update the information" -- could be as simple as a curl or wget, after all. This doesn't ans... | 1 | 3 | 0 | I have a website which fetches information from RSS feeds periodically (well, currently manually, and this is my problem). This is currently implemented as a normal Django view, which isn't very nice in my opinion. I'd like to have a Python program which is run using a cronjob instead of manually visiting the correct... | Easiest way to write a Python program with access to Django database functionality | 0 | 0 | 0 | 3,911 |
1,381,741 | 2009-09-04T22:04:00.000 | 0 | 0 | 1 | 1 | python,latex | 1,381,791 | 7 | false | 0 | 0 | You're going to need to use LaTeX to process to string. The process of rendering LaTex/TeX is very involved (it generally takes a 100+MB package to do the work), you're just not going to be able toss in a little python module to get the work done. | 1 | 26 | 0 | I have a function I am consuming that returns a string of latex code. I need to generate an image from this. Most of the methods I have seen for doing so suggest calling an external application via say the subprocess module which will generate the image for me.
However, management is not keen on this as it will req... | Converting latex code to Images (or other displayble format) with Python | 0 | 0 | 0 | 19,039 |
1,382,252 | 2009-09-05T02:14:00.000 | 0 | 0 | 1 | 0 | python,ruby,cocoa,xcode,pyobjc | 1,448,482 | 5 | false | 1 | 0 | The above coments were all good and helpful but didn't really help. Easiest thing I could find is to create an empty python/ruby project in xcode 3.1, then make copies of this project folder for every new project you work on.
When you open the new/blank project, 3.2 has a new feature that lets you rename the project so... | 1 | 6 | 0 | Under xcode 3.2 my ObjectiveC + Python/Ruby projects can still be opened updated and compiled, but you cannot create new projects.
Given that all traces of ruby and python are missing from xcode 3.2 (ie create project and add new ruby/python file), is there an easy way to get the templates installed again?
I found som... | XCode 3.2 Ruby and Python templates | 0 | 0 | 0 | 11,625 |
1,382,648 | 2009-09-05T06:43:00.000 | 1 | 1 | 1 | 0 | python,pep | 21,502,630 | 7 | false | 0 | 0 | I'd also recommend PEPs 8 and 257. I know this deviates slightly from the original question, but I'd like to point out that PyCharm (probably the best Python IDE around in my opinion) automatically checks if you're following some of the most important PEP 8 guidelines, just in case anyone's interested... | 2 | 70 | 0 | I'm a fairly strong Python coder, but too much of my style is a little haphazard, and I'm sure there are more Pythonic solutions to many problems than the ones I come up with. Which PEPs are essential for any well versed Pythonista to read? | Which PEP's are must reads? | 0.028564 | 0 | 0 | 7,197 |
1,382,648 | 2009-09-05T06:43:00.000 | 8 | 1 | 1 | 0 | python,pep | 1,382,662 | 7 | false | 0 | 0 | I found that reading the declined ones can give some good insights into what's Pythonic and what isn't.
This was a while ago so I don't have any specific examples. | 2 | 70 | 0 | I'm a fairly strong Python coder, but too much of my style is a little haphazard, and I'm sure there are more Pythonic solutions to many problems than the ones I come up with. Which PEPs are essential for any well versed Pythonista to read? | Which PEP's are must reads? | 1 | 0 | 0 | 7,197 |
1,383,239 | 2009-09-05T12:33:00.000 | 2 | 0 | 1 | 0 | python,global-variables,module,packages,init | 1,383,549 | 4 | false | 0 | 0 | You can define global variables from anywhere, but it is a really bad idea. import the __builtin__ module and modify or add attributes to this modules, and suddenly you have new builtin constants or functions. In fact, when my application installs gettext, I get the _() function in all my modules, without importing any... | 1 | 165 | 0 | I want to define a constant that should be available in all of the submodules of a package. I've thought that the best place would be in in the __init__.py file of the root package. But I don't know how to do this. Suppose I have a few subpackages and each with several modules. How can I access that variable from these... | Can I use __init__.py to define global variables? | 0.099668 | 0 | 0 | 111,923 |
1,383,590 | 2009-09-05T15:25:00.000 | 0 | 1 | 1 | 0 | python,code-organization | 1,383,613 | 6 | false | 0 | 0 | Put them in the Path class, and document that they are "obscure" either with comments or docstrings. Separate them at the end if you like. | 6 | 2 | 0 | I have a class called Path for which there are defined about 10 methods, in a dedicated module Path.py. Recently I had a need to write 5 more methods for Path, however these new methods are quite obscure and technical and 90% of the time they are irrelevant.
Where would be a good place to put them so their context is c... | Code organization in Python: Where is a good place to put obscure methods? | 0 | 0 | 0 | 328 |
1,383,590 | 2009-09-05T15:25:00.000 | 4 | 1 | 1 | 0 | python,code-organization | 1,383,607 | 6 | false | 0 | 0 | If the method is relevant to the Path - no matter how obscure - I think it should reside within the class itself.
If you have multiple places where you have path-related functionality, it leads to problems. For example, if you want to check if some functionality already exists, how will a new programmer know to check t... | 6 | 2 | 0 | I have a class called Path for which there are defined about 10 methods, in a dedicated module Path.py. Recently I had a need to write 5 more methods for Path, however these new methods are quite obscure and technical and 90% of the time they are irrelevant.
Where would be a good place to put them so their context is c... | Code organization in Python: Where is a good place to put obscure methods? | 0.132549 | 0 | 0 | 328 |
1,383,590 | 2009-09-05T15:25:00.000 | 0 | 1 | 1 | 0 | python,code-organization | 1,383,601 | 6 | false | 0 | 0 | I would just prepend the names with an underscore _, to show that the reader shouldn't bother about them.
It's conventionally the same thing as private members in other languages. | 6 | 2 | 0 | I have a class called Path for which there are defined about 10 methods, in a dedicated module Path.py. Recently I had a need to write 5 more methods for Path, however these new methods are quite obscure and technical and 90% of the time they are irrelevant.
Where would be a good place to put them so their context is c... | Code organization in Python: Where is a good place to put obscure methods? | 0 | 0 | 0 | 328 |
1,383,590 | 2009-09-05T15:25:00.000 | 0 | 1 | 1 | 0 | python,code-organization | 1,383,639 | 6 | false | 0 | 0 | Oh wait, I thought of something -- I can just define them in the Path.py module, where every obscure method will be a one-liner that will call the function from the separate module that currently exists. With this compromise, the obscure methods will comprise of maybe 10 lines in the end of the file instead of 50% of i... | 6 | 2 | 0 | I have a class called Path for which there are defined about 10 methods, in a dedicated module Path.py. Recently I had a need to write 5 more methods for Path, however these new methods are quite obscure and technical and 90% of the time they are irrelevant.
Where would be a good place to put them so their context is c... | Code organization in Python: Where is a good place to put obscure methods? | 0 | 0 | 0 | 328 |
1,383,590 | 2009-09-05T15:25:00.000 | 2 | 1 | 1 | 0 | python,code-organization | 1,383,623 | 6 | true | 0 | 0 | If you're keen to put those methods in a different source file at any cost, AND keen to have them at methods at any cost, you can achieve both goals by using the different source file to define a mixin class and having your Path class import that method and multiply-inherit from that mixin. So, technically, it's quite ... | 6 | 2 | 0 | I have a class called Path for which there are defined about 10 methods, in a dedicated module Path.py. Recently I had a need to write 5 more methods for Path, however these new methods are quite obscure and technical and 90% of the time they are irrelevant.
Where would be a good place to put them so their context is c... | Code organization in Python: Where is a good place to put obscure methods? | 1.2 | 0 | 0 | 328 |
1,383,590 | 2009-09-05T15:25:00.000 | 0 | 1 | 1 | 0 | python,code-organization | 8,028,755 | 6 | false | 0 | 0 | I suggest making them accessible from a property of the Path class called something like "Utilties". For example: Path.Utilities.RazzleDazzle. This will help with auto-completion tools and general maintenance. | 6 | 2 | 0 | I have a class called Path for which there are defined about 10 methods, in a dedicated module Path.py. Recently I had a need to write 5 more methods for Path, however these new methods are quite obscure and technical and 90% of the time they are irrelevant.
Where would be a good place to put them so their context is c... | Code organization in Python: Where is a good place to put obscure methods? | 0 | 0 | 0 | 328 |
1,383,663 | 2009-09-05T16:01:00.000 | -1 | 0 | 0 | 0 | python,gtk,pygtk | 1,507,847 | 2 | false | 0 | 1 | I don't think the EventBox can send button events like "activated" and "clicked". | 1 | 0 | 0 | I would like to remove border on a gtk.Button and also set its size fixed. How can I accomplish that?
My button looks like that:
b = gtk.Button()
b.set_relief(gtk.RELIEF_NONE)
Thanks!
p.d: I'm using pygtk | remove inner border on gtk.Button | -0.099668 | 0 | 0 | 2,081 |
1,383,863 | 2009-09-05T17:40:00.000 | 0 | 0 | 1 | 1 | python,macos,path,multiple-versions | 1,384,223 | 2 | false | 0 | 0 | I just noticed/encountered this issue on my Mac. I have Python 2.5.4, 2.6.2, and 3.1.1 on my machine, and was looking for a way to easily change between them at will. That is when I noticed all the symlinks for the executables, which I found in both '/usr/bin' and '/usr/local/bin'. I ripped all the non-version specific... | 2 | 5 | 0 | If you install multiple versions of python (I currently have the default 2.5, installed 3.0.1 and now installed 2.6.2), it automatically puts stuff in /usr/local, and it also adjusts the path to include the /Library/Frameworks/Python/Versions/theVersion/bin, but whats the point of that when /usr/local is already on the... | OS X - multiple python versions, PATH and /usr/local | 0 | 0 | 0 | 4,778 |
1,383,863 | 2009-09-05T17:40:00.000 | 5 | 0 | 1 | 1 | python,macos,path,multiple-versions | 1,383,891 | 2 | true | 0 | 0 | There's no a priori guarantee that /usr/local/bin will stay on the PATH (especially it will not necessarily stay "in front of" /usr/bin!-), so it's perfectly reasonable for an installer to ensure the specifically needed /Library/.../bin directory does get on the PATH. Plus, it may be the case that the /Library/.../bin... | 2 | 5 | 0 | If you install multiple versions of python (I currently have the default 2.5, installed 3.0.1 and now installed 2.6.2), it automatically puts stuff in /usr/local, and it also adjusts the path to include the /Library/Frameworks/Python/Versions/theVersion/bin, but whats the point of that when /usr/local is already on the... | OS X - multiple python versions, PATH and /usr/local | 1.2 | 0 | 0 | 4,778 |
1,384,634 | 2009-09-06T01:11:00.000 | 0 | 1 | 0 | 0 | python,template-engine,mako,genshi | 1,384,847 | 5 | false | 0 | 0 | You could discipline yourself to not inject any Python code within the template unless it's really the last resort to get the job done. I have faced a similar issue with Django's template where I have to do some serious CSS gymnastics to display my content. If I could have used some Python code in the template, it wou... | 3 | 7 | 0 | I've been considering a templating solution, although my choices are between Mako and Genshi. I find templating in Genshi a bit ugly, so I'm shifting more towards Mako.
I've gone to wonder: what is so good about the fact that Mako allows embedded Python code? How is it convenient for the average joe?
Wouldn't templatin... | Should I use Mako for Templating? | 0 | 0 | 0 | 6,454 |
1,384,634 | 2009-09-06T01:11:00.000 | 2 | 1 | 0 | 0 | python,template-engine,mako,genshi | 1,384,671 | 5 | false | 0 | 0 | This seems to be a bit of a religious issue. Django templates take a hard line: no code in templates. They do this because of their history as a system used in shops where there's a clear separation between those who write code and those who create pages. Others (perhaps you) don't make such a clear distinction, and... | 3 | 7 | 0 | I've been considering a templating solution, although my choices are between Mako and Genshi. I find templating in Genshi a bit ugly, so I'm shifting more towards Mako.
I've gone to wonder: what is so good about the fact that Mako allows embedded Python code? How is it convenient for the average joe?
Wouldn't templatin... | Should I use Mako for Templating? | 0.07983 | 0 | 0 | 6,454 |
1,384,634 | 2009-09-06T01:11:00.000 | 16 | 1 | 0 | 0 | python,template-engine,mako,genshi | 1,391,510 | 5 | false | 0 | 0 | Wouldn't templating JUST suffice without having embedded Python code?
Only if your templating language has enough logical functionality that it is essentially a scripting language in itself. At which point, you might just as well have used Python.
More involved sites often need complex presentation logic and non-trivi... | 3 | 7 | 0 | I've been considering a templating solution, although my choices are between Mako and Genshi. I find templating in Genshi a bit ugly, so I'm shifting more towards Mako.
I've gone to wonder: what is so good about the fact that Mako allows embedded Python code? How is it convenient for the average joe?
Wouldn't templatin... | Should I use Mako for Templating? | 1 | 0 | 0 | 6,454 |
1,385,722 | 2009-09-06T13:51:00.000 | 8 | 0 | 0 | 0 | python,rich-internet-application | 1,385,927 | 2 | true | 0 | 0 | Inventing our own language was a miniscule part of the problem. What was important was developing the right framework, which is now available as Cappuccino (cappuccino.org).
You ask what platform/language you could use to develop something similar? I assume you already know that the answer to what platform is the web.... | 1 | 3 | 0 | I have seen 280slides.com and it is really impresive. But its developers had to create their own language.
Which platform or language would you use to have an as similar as possible functionality?
Is it possible to do something similar in python?
Could you give any working examples? | How to get 280slides.com functionality? | 1.2 | 0 | 0 | 335 |
1,386,093 | 2009-09-06T16:43:00.000 | 6 | 0 | 0 | 0 | python,datetime,sqlite,sqlalchemy,pysqlite | 1,386,154 | 4 | false | 0 | 0 | Julian Day is handy for all sorts of date calculations, but it can's store the time part decently (with precise hours, minutes, and seconds). In the past I've used both Julian Day fields (for dates), and seconds-from-the-Epoch (for datetime instances), but only when I had specific needs for computation (of dates and re... | 2 | 8 | 0 | SQLite docs specifies that the preferred format for storing datetime values in the DB is to use Julian Day (using built-in functions).
However, all frameworks I saw in python (pysqlite, SQLAlchemy) store the datetime.datetime values as ISO formatted strings. Why are they doing so?
I'm usually trying to adapt the framew... | Shall I bother with storing DateTime data as julianday in SQLite? | 1 | 1 | 0 | 1,707 |
1,386,093 | 2009-09-06T16:43:00.000 | 0 | 0 | 0 | 0 | python,datetime,sqlite,sqlalchemy,pysqlite | 3,089,486 | 4 | false | 0 | 0 | Because 2010-06-22 00:45:56 is far easier for a human to read than 2455369.5318981484. Text dates are great for doing ad-hoc queries in SQLiteSpy or SQLite Manager.
The main drawback, of course, is that text dates require 19 bytes instead of 8. | 2 | 8 | 0 | SQLite docs specifies that the preferred format for storing datetime values in the DB is to use Julian Day (using built-in functions).
However, all frameworks I saw in python (pysqlite, SQLAlchemy) store the datetime.datetime values as ISO formatted strings. Why are they doing so?
I'm usually trying to adapt the framew... | Shall I bother with storing DateTime data as julianday in SQLite? | 0 | 1 | 0 | 1,707 |
1,386,210 | 2009-09-06T17:35:00.000 | 2 | 0 | 0 | 0 | python,properties,initialization | 1,386,258 | 3 | false | 0 | 0 | I agree that attribute access and everything that looks like it (i.e. properties in the Python context) should be fairly trivial. If a property is going to perform a potentially costly operation, use a method to make this explicit. I recommend a name like "fetch_XYZ" or "retrieve_XYZ", since "get_XYZ" is used in some l... | 2 | 2 | 0 | I have an object that is basically a Python implementation of an Oracle sequence. For a variety of reasons, we have to get the nextval of an Oracle sequence, count up manually when determining primary keys, then update the sequence once the records have been inserted.
So here's the steps my object does:
Construct an ... | Should properties do nontrivial initialization? | 0.132549 | 1 | 0 | 190 |
1,386,210 | 2009-09-06T17:35:00.000 | 0 | 0 | 0 | 0 | python,properties,initialization | 1,389,673 | 3 | false | 0 | 0 | I've decided that the key smell in the solution I'm proposing is that the property I was creating contained the word "next" in it. Thus, instead of making a next_key property, I've decided to turn my DatabaseIntrospector class into a KeyCounter class and implemented the iterator protocol (ie making a plain old next me... | 2 | 2 | 0 | I have an object that is basically a Python implementation of an Oracle sequence. For a variety of reasons, we have to get the nextval of an Oracle sequence, count up manually when determining primary keys, then update the sequence once the records have been inserted.
So here's the steps my object does:
Construct an ... | Should properties do nontrivial initialization? | 0 | 1 | 0 | 190 |
1,386,604 | 2009-09-06T20:13:00.000 | 3 | 0 | 1 | 0 | python,algorithm | 1,398,808 | 5 | false | 0 | 0 | As already pointed out, Python can handle numbers as big as your memory will allow. I would just like to add that as the numbers grow bigger, the cost of all operations on them increases. This is not just for printing/converting to string (although that's the slowest), adding two large numbers (larger that what your ha... | 2 | 9 | 0 | I'm working on a programming problem where I need to handle a number involving 100000 digits. Can python handle numbers like this? | Handling big numbers in code | 0.119427 | 0 | 0 | 30,496 |
1,386,604 | 2009-09-06T20:13:00.000 | 7 | 0 | 1 | 0 | python,algorithm | 1,386,629 | 5 | false | 0 | 0 | Yes; Python 2.x has two types of integers, int of limited size and long of unlimited size. However all calculations will automatically convert to long if needed. Handling big numbers works fine, but one of the slower things will be if you try to print the 100000 digits to output, or even try to create a string from it.... | 2 | 9 | 0 | I'm working on a programming problem where I need to handle a number involving 100000 digits. Can python handle numbers like this? | Handling big numbers in code | 1 | 0 | 0 | 30,496 |
1,387,222 | 2009-09-07T01:29:00.000 | 16 | 0 | 1 | 1 | python,windows,platform-detection | 1,387,226 | 6 | false | 0 | 0 | On my Windows box, platform.system() returns 'Windows'.
However, I'm not sure why you'd bother. If you want to limit the platform it runs on technologically, I'd use a white-list rather than a black-list.
In fact, I wouldn't do it technologically at all since perhaps the next release of Python may have Win32/Win64 inst... | 1 | 64 | 0 | I'm working on a couple of Linux tools and need to prevent installation on Windows, since it depends on FHS and is thus rendered useless on that platform. The platform.platform function comes close but only returns a string.
Unfortunately I don't know what to search for in that string for it to yield a reliable result.... | Reliably detect Windows in Python | 1 | 0 | 0 | 34,871 |
1,387,906 | 2009-09-07T06:56:00.000 | 24 | 0 | 1 | 0 | python,c++,dll,embed | 1,387,977 | 4 | true | 0 | 1 | In addition to pythonxy.dll, you also need the entire Python library, i.e. the contents of the lib folder, plus the extension modules, i.e. the contents of the DLLs folder. Without the standard library, Python won't even start, since it tries to find os.py (in 3.x; string.py in 2.x). On startup, it imports a number of ... | 2 | 23 | 0 | I'm developing on Windows, and I've searched everywhere without finding anyone talking about this kind of thing.
I made a C++ app on my desktop that embedded Python 3.1 using MSVC. I linked python31.lib and included python31.dll in the app's run folder alongside the executable. It works great. My extension and embeddin... | C++ with Python embedding: crash if Python not installed | 1.2 | 0 | 0 | 11,259 |
1,387,906 | 2009-09-07T06:56:00.000 | 6 | 0 | 1 | 0 | python,c++,dll,embed | 9,115,925 | 4 | false | 0 | 1 | A zip of the Python standard library worked for me with Python27.
I zipped the contents of Lib and dll, and made sure there was no additional python27-subfolder or Lib or dll subfolder. i.e. just a zip named python27.zip containing all the files.
I copied that zip and the python27.dll alongside the executable. | 2 | 23 | 0 | I'm developing on Windows, and I've searched everywhere without finding anyone talking about this kind of thing.
I made a C++ app on my desktop that embedded Python 3.1 using MSVC. I linked python31.lib and included python31.dll in the app's run folder alongside the executable. It works great. My extension and embeddin... | C++ with Python embedding: crash if Python not installed | 1 | 0 | 0 | 11,259 |
1,387,937 | 2009-09-07T07:08:00.000 | 1 | 0 | 0 | 0 | python,django,caching,mutex,semaphore | 1,388,111 | 2 | false | 1 | 0 | What about using a different process to handle scraping, and a queue for the communication between it and Django?
This way you would be able to easily change the number of concurrent requests, and it would also automatically keep track of the requests, without blocking the caller.
Most of all, I think it would help low... | 1 | 4 | 0 | Many of my views fetch external resources. I want to make sure that under heavy load I don't blow up the remote sites (and/or get banned).
I only have 1 crawler so having a central lock will work fine.
So the details: I want to allow at most 3 queries to a host per second, and have the rest block for a maximum of 15 se... | Django: Simple rate limiting | 0.099668 | 0 | 0 | 1,777 |
1,388,464 | 2009-09-07T09:36:00.000 | 6 | 0 | 1 | 1 | python,linux | 1,388,552 | 3 | false | 0 | 0 | The safest way to upgrading Python is to install it to a different location (away from the default system path).
To do this, download the source of python and do a
./configure --prefix=/opt
(Assuming you want to install it to /opt which is where most install non system dependant stuff to)
The reason why I say this is ... | 2 | 2 | 0 | I have a linux VPS that uses an older version of python (2.4.3). This version doesn't include the UUID module, but I need it for a project. My options are to upgrade to python2.6 or find a way to make uuid work with the older version. I am a complete linux newbie. I don't know how to upgrade python safely or how I coul... | Upgrade python in linux | 1 | 0 | 0 | 25,211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.