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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
875,228 | 2009-05-17T19:00:00.000 | 2 | 0 | 1 | 0 | python,file-io,csv,multidimensional-array,fileparsing | 875,525 | 5 | false | 0 | 0 | I'm looking for a simple solution using Python to store data as a flat file, such that each line is a string representation of an array that can be easily parsed.
Is the data only ever going to be parsed by Python programs? If not, then I'd avoid pickle et al (shelve and marshal) since they're very Python specific. JS... | 1 | 3 | 1 | I'm looking for a simple solution using Python to store data as a flat file, such that each line is a string representation of an array that can be easily parsed.
I'm sure python has library for doing such a task easily but so far all the approaches I have found seemed like it would have been sloppy to get it to work a... | Simple data storing in Python | 0.07983 | 0 | 0 | 5,460 |
875,476 | 2009-05-17T20:54:00.000 | 1 | 0 | 1 | 0 | python,audio | 877,551 | 6 | false | 1 | 0 | You will need to come up with some threshold value of a minimum number of consecutive zeros before you cut them. Otherwise you'll be removing perfectly valid zeros from the middle of normal audio data. You can iterate through the wave file, copying any non-zero values, and buffering up zero values. When you're bufferin... | 1 | 4 | 0 | Between each word in the wav file I have full silence (I checked with Hex workshop and silence is represented with 0's).
How can I cut the non-silence sound?
I'm programming using python.
Thanks! | editing a wav files using python | 0.033321 | 0 | 0 | 25,153 |
876,107 | 2009-05-18T03:15:00.000 | 3 | 0 | 0 | 0 | python,performance,matplotlib,pyqt | 876,151 | 1 | true | 0 | 1 | Yes, loading the module takes place at the line where the import statement is. If you create your QApplication and show your splash screen before that, you should be able to do what you want -- also you need to call QApplication.processEvents() whenever you need the splash screen to update with a new message. | 1 | 4 | 0 | My PyQt application that uses matplotlib takes several seconds to load for the first time, even on a fast machine (the second load time is much shorter as the DLLs are kept in memory by Windows).
I'm wondering whether it's feasible to show a splash screen while the matplotlib library is being loaded. Where does the act... | PyQt: splash screen while loading "heavy" libraries | 1.2 | 0 | 0 | 3,080 |
876,258 | 2009-05-18T04:34:00.000 | 0 | 0 | 1 | 0 | python,encryption,aes | 876,304 | 2 | false | 0 | 0 | To properly encrypt data, you need more than just an encryption algorithm. It's probably best you find a complete library with documentation showing how to do things properly, if you absolutely must do it yourself.
Encryption alone is not sufficient. How are you generating keys? What mode of operation are you using? A... | 1 | 0 | 0 | I want to know is there any python 3.0 supported library for encryption. To encrypt files of 128 bits of data?? | is there any AES encryption python library that will work well with python 3.0? | 0 | 0 | 0 | 1,070 |
877,033 | 2009-05-18T10:13:00.000 | 2 | 0 | 0 | 1 | python,webserver,simplehttpserver | 22,310,248 | 3 | false | 0 | 0 | Best way is to make your own local server by using command prompt.
Make a new folder say Project
Make a new folder inside project & name it as "cgi-bin"(without quotes)
Paste your .py file inside the cgi-bin folder
Open cmd and change to the directory from which you want to run the server and type "python -m CGIHTTPSe... | 1 | 18 | 0 | I'm looking to use a local webserver to run a series of python scripts for the user. For various unavoidable reasons, the python script must run locally, not on a server. As a result, I'll be using HTML+browser as the UI, which I'm comfortable with, for the front end.
I've been looking, therefore, for a lightweight web... | How can I create an local webserver for my python scripts? | 0.132549 | 0 | 0 | 25,839 |
878,143 | 2009-05-18T14:56:00.000 | 4 | 0 | 0 | 0 | c#,java,python | 878,154 | 6 | false | 0 | 0 | What's wrong with FTP? The protocol supports reusability and there are lots and lots of clients. | 3 | 6 | 0 | I am in the design phase of a file upload service that allows users to upload very large zip files to our server as well as updates our database with the data. Since the files are large (About 300mb) we want to allow the user to limit the amount of bandwidth they want to use for uploading. They should also be able to... | Resumable File Upload | 0.132549 | 1 | 0 | 3,014 |
878,143 | 2009-05-18T14:56:00.000 | 0 | 0 | 0 | 0 | c#,java,python | 878,160 | 6 | false | 0 | 0 | On client side, flash; On server side, whatever (it wouldn't make any difference).
No existing technologies (except for using FTP or something). | 3 | 6 | 0 | I am in the design phase of a file upload service that allows users to upload very large zip files to our server as well as updates our database with the data. Since the files are large (About 300mb) we want to allow the user to limit the amount of bandwidth they want to use for uploading. They should also be able to... | Resumable File Upload | 0 | 1 | 0 | 3,014 |
878,143 | 2009-05-18T14:56:00.000 | 0 | 0 | 0 | 0 | c#,java,python | 30,990,243 | 6 | false | 0 | 0 | I'm surprised no one has mentioned torrent files. They can also be packaged into a script that then triggers something to execute. | 3 | 6 | 0 | I am in the design phase of a file upload service that allows users to upload very large zip files to our server as well as updates our database with the data. Since the files are large (About 300mb) we want to allow the user to limit the amount of bandwidth they want to use for uploading. They should also be able to... | Resumable File Upload | 0 | 1 | 0 | 3,014 |
879,218 | 2009-05-18T18:53:00.000 | 2 | 0 | 1 | 0 | python | 879,227 | 5 | false | 1 | 0 | Not sure what you mean.
For development
First choice: idle -- you already have it.
Second choice: Komodo Edit -- very easy to use, but not as directly interactive as idle.
For deploying applications, that depends on your application. If you're building desktop applications or web applications, you still use similar to... | 2 | 3 | 0 | I'm looking to get up to speed on Python, is it worth working locally via the ActivePython interface, then progressing to a website that supports one of the standard frameworks (Django or Pylons) OR utilize the Google Apps environment? I want to stay as interactive as possible - making feedback/learning easier. | Python learning environment | 0.07983 | 0 | 0 | 536 |
879,218 | 2009-05-18T18:53:00.000 | 2 | 0 | 1 | 0 | python | 879,231 | 5 | false | 1 | 0 | I would just start locally. Django and Pylons add another layer of complexity to the edit/feedback loop.
Unless your primary focus is to make python websites, just stick with an editor and the console. | 2 | 3 | 0 | I'm looking to get up to speed on Python, is it worth working locally via the ActivePython interface, then progressing to a website that supports one of the standard frameworks (Django or Pylons) OR utilize the Google Apps environment? I want to stay as interactive as possible - making feedback/learning easier. | Python learning environment | 0.07983 | 0 | 0 | 536 |
880,917 | 2009-05-19T04:03:00.000 | 15 | 0 | 0 | 0 | python | 880,940 | 8 | true | 0 | 0 | Google App Engine has excellent support for developing -- and especially for deploying -- web applications in Python (with several possible frameworks, of which Django may be the most suitable one for "relative amateurs"). Apart from web apps, Blender lets you use Python for 3D graphics, Poser for apps involving movin... | 4 | 2 | 0 | What are some applications for Python that relative amateur programmers can get into?
For example, Ruby has Rails for building web applications. What are some cool applications of Python?
Thanks. | Applications of Python | 1.2 | 0 | 0 | 1,769 |
880,917 | 2009-05-19T04:03:00.000 | 5 | 0 | 0 | 0 | python | 880,935 | 8 | false | 0 | 0 | "cool" is a state of mind. Hence cool applications depends on your definition of cool. A Ant colony simulation is cool, if you want to implement the theory.
Python, with its own and 3rd party libraries (batteries) has been applied in possibly all domains of day to day programming. My advise is, decide on the cool app ... | 4 | 2 | 0 | What are some applications for Python that relative amateur programmers can get into?
For example, Ruby has Rails for building web applications. What are some cool applications of Python?
Thanks. | Applications of Python | 0.124353 | 0 | 0 | 1,769 |
880,917 | 2009-05-19T04:03:00.000 | 0 | 0 | 0 | 0 | python | 880,938 | 8 | false | 0 | 0 | Python is a general purpose programming language much like Ruby. It can be used for systems programming, embedded programming, desktop programming, and web programming. In short, it has about as much potential for "cool" projects as any other general purpose language. | 4 | 2 | 0 | What are some applications for Python that relative amateur programmers can get into?
For example, Ruby has Rails for building web applications. What are some cool applications of Python?
Thanks. | Applications of Python | 0 | 0 | 0 | 1,769 |
880,917 | 2009-05-19T04:03:00.000 | 0 | 0 | 0 | 0 | python | 881,038 | 8 | false | 0 | 0 | Probably not the most general purpose example, but I learned Python when AutoDesk Maya adopted it as a secondary programming language to complement MEL (Maya Expression Language). By comparison, it was a god-sent. | 4 | 2 | 0 | What are some applications for Python that relative amateur programmers can get into?
For example, Ruby has Rails for building web applications. What are some cool applications of Python?
Thanks. | Applications of Python | 0 | 0 | 0 | 1,769 |
880,918 | 2009-05-19T04:03:00.000 | 10 | 0 | 1 | 1 | python,redirect,io | 880,929 | 5 | false | 0 | 0 | Easiest is os.system("the.exe -a >thefile.txt"), but there are many other ways, for example with the subprocess module in the standard library. | 1 | 18 | 0 | In a script , I want to run a .exe with some command line parameters as "-a",and then
redirect the standard output of the program to a file?
How can I implement that? | How to redirect the output of .exe to a file in python? | 1 | 0 | 0 | 15,233 |
881,332 | 2009-05-19T07:00:00.000 | 2 | 0 | 0 | 0 | python,sockets | 881,349 | 1 | false | 0 | 0 | 111 means the listener is down/not accepting connections - restart the Windows app that should be listening for connections, or disconnect any already-bound clients. | 1 | 0 | 0 | Nice to meet you.
A socket makes a program in Python by Linux (the transmission of a message) ⇒ Windows (the reception), b
ut the following errors occur and cannot connect now.
Linux, Windows are network connection together, and there is the authority to cut.
socket.error: (111, 'Connection refused')
Could you help me!... | Error occurs when I connect with socket in Python | 0.379949 | 0 | 1 | 619 |
881,517 | 2009-05-19T08:11:00.000 | 3 | 0 | 0 | 0 | python,sqlalchemy | 890,202 | 4 | false | 1 | 0 | For a user login and basic permission tokens in a simple web application I will definitely store that in a cookie-based session. It's true that a few SELECTs per request is not a big deal at all, but then again if you can get some/all of your web requests to execute from cached data with no DB hits at all, that just ... | 4 | 0 | 0 | I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to ... | SQLAlchemy - Database hits on every request? | 0.148885 | 1 | 0 | 967 |
881,517 | 2009-05-19T08:11:00.000 | 1 | 0 | 0 | 0 | python,sqlalchemy | 881,535 | 4 | false | 1 | 0 | It's a Database, so often it's fairly common to "hit" the Database to pull the required data. You can reduce single queries if you build up Joins or Stored Procedures. | 4 | 0 | 0 | I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to ... | SQLAlchemy - Database hits on every request? | 0.049958 | 1 | 0 | 967 |
881,517 | 2009-05-19T08:11:00.000 | 3 | 0 | 0 | 0 | python,sqlalchemy | 882,021 | 4 | false | 1 | 0 | "hitting the database for something like this on every request isn't efficient."
False. And, you've assumed that there's no caching, which is also false.
Most ORM layers are perfectly capable of caching rows, saving some DB queries.
Most RDBMS's have extensive caching, resulting in remarkably fast responses to common ... | 4 | 0 | 0 | I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to ... | SQLAlchemy - Database hits on every request? | 0.148885 | 1 | 0 | 967 |
881,517 | 2009-05-19T08:11:00.000 | 2 | 0 | 0 | 0 | python,sqlalchemy | 882,171 | 4 | false | 1 | 0 | You are basically talking about caching data as a performance optimization. As always, premature optimization is a bad idea. It's hard to know where the bottlenecks are beforehand, even more so if the application domain is new to you. Optimization adds complexity and if you optimize the wrong things, you not only have ... | 4 | 0 | 0 | I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to ... | SQLAlchemy - Database hits on every request? | 0.099668 | 1 | 0 | 967 |
881,536 | 2009-05-19T08:17:00.000 | 1 | 0 | 0 | 0 | python,django,django-admin,field | 881,692 | 2 | false | 1 | 0 | Sure it's possible, but it will need some javascript. You'd want to bind an event to the keypress event on each field, and when it fires test the length of the text entered so far - if it matches, move the focus onto the next field. | 1 | 0 | 0 | I have an inline on a model with data with a fixed length, that has to be entered very fast, so I was thinking about a way of "tabbing" through fields automatically when the field is filled...
Could that be possible? | Auto-tab between fields on Django admin site | 0.099668 | 0 | 0 | 435 |
882,430 | 2009-05-19T12:24:00.000 | 3 | 1 | 0 | 1 | python,cgi | 882,444 | 6 | false | 0 | 0 | Just use some good web framework e.g. django and you can have such URLs
more than URLs you will have a better infrastructure, templates, db orm etc | 1 | 13 | 0 | Brand new to web design, using python. Got Apache up and running, test python script working in cgi-bin directory. Get valid results when I type in the URL explicitly: ".../cgi-bin/showenv.py"
But I don't want the URL to look that way. Here at stackoverflow, for example, the URLs that display in my address bar neve... | How to hide "cgi-bin", ".py", etc from my URLs? | 0.099668 | 0 | 0 | 10,240 |
883,348 | 2009-05-19T15:09:00.000 | 1 | 0 | 1 | 0 | python,wxpython,multiprocessing | 883,451 | 1 | false | 0 | 1 | You could make two Queues between the two processes and have the second one delegate wx-related functionality to the first one (by pushing on the first queue the parameters of the task to perform, and waiting for the result on the second one). | 1 | 0 | 0 | I have a wxPython program with two processes: A primary and a secondary one (I'm using the multiprocessing module.) The primary one runs the wxPython GUI, the secondary one does not. However, there is something I would like to do from the secondary process: Given a string that describes a color, to check whether this w... | wxPython + multiprocessing: Checking if a color string is legitimate | 0.197375 | 0 | 0 | 670 |
883,575 | 2009-05-19T15:49:00.000 | 0 | 0 | 0 | 0 | python,django,django-models | 883,645 | 4 | false | 1 | 0 | It depends on where you want to use it.
If you want to use it in your own templates, I would suggest to write a template-tag, that will do the ordering for you
In it, you could use any sorting algorithm you want to use.
In admin I do custom sorting by extending the templates to my needs and loading a template-tag as d... | 2 | 39 | 0 | How do you define a specific ordering in Django QuerySets?
Specifically, if I have a QuerySet like so: ['a10', 'a1', 'a2'].
Regular order (using Whatever.objects.order_by('someField')) will give me ['a1', 'a10', 'a2'], while I am looking for: ['a1', 'a2', 'a10'].
What is the proper way to define my own ordering techniq... | Custom ordering in Django | 0 | 0 | 0 | 29,554 |
883,575 | 2009-05-19T15:49:00.000 | 37 | 0 | 0 | 0 | python,django,django-models | 889,445 | 4 | false | 1 | 0 | @Jarret's answer (do the sort in Python) works great for simple cases. As soon as you have a large table and want to, say, pull only the first page of results sorted in a certain way, this approach breaks (you have to pull every single row from the database before you can do the sort). At that point I would look into... | 2 | 39 | 0 | How do you define a specific ordering in Django QuerySets?
Specifically, if I have a QuerySet like so: ['a10', 'a1', 'a2'].
Regular order (using Whatever.objects.order_by('someField')) will give me ['a1', 'a10', 'a2'], while I am looking for: ['a1', 'a2', 'a10'].
What is the proper way to define my own ordering techniq... | Custom ordering in Django | 1 | 0 | 0 | 29,554 |
885,294 | 2009-05-19T22:13:00.000 | 5 | 0 | 0 | 0 | python,keyboard,wxpython | 885,307 | 1 | true | 0 | 1 | That should happen automatically if the button has the wx.ID_OK id. If that's impossible then the wx.StdDialogButtonSizer.SetAffirmativeButton() method could be a solution (using the StdDialogButtonSizer class will help with correct button placement and positioning on the different platforms), and there is also wx.Butt... | 1 | 3 | 0 | I am creating a custom wxPython dialog by subclassing wx.Dialog. When I press Enter while using it, (and while being focused on one of the form elements,) it just takes the focus to the next form element, while I want it to press the ok button.
How do I solve this? | wxPython dialogs: "Enter" keyboard button would not "ok" the dialog | 1.2 | 0 | 0 | 1,846 |
885,625 | 2009-05-20T00:03:00.000 | 0 | 0 | 1 | 0 | python,database,dictionary | 885,643 | 5 | false | 0 | 0 | Here are three things you can try:
Compress the pickled dictionary with zlib. pickle.dumps(dict).encode("zlib")
Make your own serializing format (shouldn't be too hard).
Load the data in a sqlite database. | 2 | 0 | 0 | I am building an application to distribute to fellow academics. The application will take three parameters that the user submits and output a list of dates and codes related to those events. I have been building this using a dictionary and intended to build the application so that the dictionary loaded from a pickle ... | What is the least resource intense data structure to distribute with a Python Application | 0 | 0 | 0 | 312 |
885,625 | 2009-05-20T00:03:00.000 | 2 | 0 | 1 | 0 | python,database,dictionary | 885,813 | 5 | false | 0 | 0 | How much memory can your application reasonably use? Is this going to be running on each user's desktop, or will there just be one deployment somewhere?
A python dictionary in memory can certainly cope with two million keys. You say that you've got a subset of the data; do you have the whole lot? Maybe you should th... | 2 | 0 | 0 | I am building an application to distribute to fellow academics. The application will take three parameters that the user submits and output a list of dates and codes related to those events. I have been building this using a dictionary and intended to build the application so that the dictionary loaded from a pickle ... | What is the least resource intense data structure to distribute with a Python Application | 0.07983 | 0 | 0 | 312 |
885,771 | 2009-05-20T01:22:00.000 | 5 | 0 | 0 | 0 | php,python,mysql,ruby,migration | 885,783 | 2 | true | 0 | 0 | I believe MySQL only needs to alter metadata and references to the table's old name in stored procedures -- the number of records in the table should be irrelevant. | 1 | 3 | 0 | MySQL has a RENAME TABLE statemnt that will allow you to change the name of a table.
The manual mentions
The rename operation is done atomically, which means that no other session can
access any of the tables while the rename is running
The manual does not (to my knowedge) state how this renaming is accomplishe... | How does MySQL's RENAME TABLE statment work/perform? | 1.2 | 1 | 0 | 2,472 |
886,221 | 2009-05-20T05:07:00.000 | 6 | 0 | 0 | 0 | python,django,web-applications,scalability | 886,309 | 29 | false | 1 | 0 | Note that if you're expecting 100K users per day, that are active for hours at a time (meaning max of 20K+ concurrent users), you're going to need A LOT of servers. SO has ~15,000 registered users, and most of them are probably not active daily. While the bulk of traffic comes from unregistered users, I'm guessing th... | 8 | 1,204 | 0 | I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn.
I'm building a prototype for an idea and wasn't thinking too muc... | Does Django scale? | 1 | 0 | 0 | 203,038 |
886,221 | 2009-05-20T05:07:00.000 | 6 | 0 | 0 | 0 | python,django,web-applications,scalability | 33,579,299 | 29 | false | 1 | 0 | I don't think the issue is really about Django scaling.
I really suggest you look into your architecture that's what will help you with your scaling needs.If you get that wrong there is no point on how well Django performs. Performance != Scale. You can have a system that has amazing performance but does not scale and... | 8 | 1,204 | 0 | I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn.
I'm building a prototype for an idea and wasn't thinking too muc... | Does Django scale? | 1 | 0 | 0 | 203,038 |
886,221 | 2009-05-20T05:07:00.000 | 4 | 0 | 0 | 0 | python,django,web-applications,scalability | 35,997,907 | 29 | false | 1 | 0 | Even-though there have been a lot of great answers here, I just feel like pointing out, that nobody have put emphasis on..
It depends on the application
If you application is light on writes, as in you are reading a lot more data from the DB than you are writing. Then scaling django should be fairly trivial, heck, it ... | 8 | 1,204 | 0 | I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn.
I'm building a prototype for an idea and wasn't thinking too muc... | Does Django scale? | 0.027579 | 0 | 0 | 203,038 |
886,221 | 2009-05-20T05:07:00.000 | 283 | 0 | 0 | 0 | python,django,web-applications,scalability | 887,363 | 29 | false | 1 | 0 | We're doing load testing now. We think we can support 240 concurrent requests (a sustained rate of 120 hits per second 24x7) without any significant degradation in the server performance. That would be 432,000 hits per hour. Response times aren't small (our transactions are large) but there's no degradation from our... | 8 | 1,204 | 0 | I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn.
I'm building a prototype for an idea and wasn't thinking too muc... | Does Django scale? | 1 | 0 | 0 | 203,038 |
886,221 | 2009-05-20T05:07:00.000 | 2 | 0 | 0 | 0 | python,django,web-applications,scalability | 4,272,991 | 29 | false | 1 | 0 | Spreading the tasks evenly, in short optimizing each and every aspect including DBs, Files, Images, CSS etc. and balancing the load with several other resources is necessary once your site/application starts growing. OR you make some more space for it to grow. Implementation of latest technologies like CDN, Cloud are m... | 8 | 1,204 | 0 | I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn.
I'm building a prototype for an idea and wasn't thinking too muc... | Does Django scale? | 0.013792 | 0 | 0 | 203,038 |
886,221 | 2009-05-20T05:07:00.000 | 5 | 0 | 0 | 0 | python,django,web-applications,scalability | 887,463 | 29 | false | 1 | 0 | Another example is rasp.yandex.ru, Russian transport timetable service. Its attendance satisfies your requirements. | 8 | 1,204 | 0 | I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn.
I'm building a prototype for an idea and wasn't thinking too muc... | Does Django scale? | 0.034469 | 0 | 0 | 203,038 |
886,221 | 2009-05-20T05:07:00.000 | 5 | 0 | 0 | 0 | python,django,web-applications,scalability | 25,727,705 | 29 | false | 1 | 0 | I develop high traffic sites using Django for the national broadcaster in Ireland. It works well for us. Developing a high performance site is more than about just choosing a framework. A framework will only be one part of a system that is as strong as it's weakest link. Using the latest framework 'X' won't solve your ... | 8 | 1,204 | 0 | I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn.
I'm building a prototype for an idea and wasn't thinking too muc... | Does Django scale? | 0.034469 | 0 | 0 | 203,038 |
886,221 | 2009-05-20T05:07:00.000 | 4 | 0 | 0 | 0 | python,django,web-applications,scalability | 26,828,032 | 29 | false | 1 | 0 | The problem is not to know if django can scale or not.
The right way is to understand and know which are the network design patterns and tools to put under your django/symfony/rails project to scale well.
Some ideas can be :
Multiplexing.
Inversed proxy. Ex : Nginx, Varnish
Memcache Session. Ex : Redis
Clusterization... | 8 | 1,204 | 0 | I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn.
I'm building a prototype for an idea and wasn't thinking too muc... | Does Django scale? | 0.027579 | 0 | 0 | 203,038 |
886,526 | 2009-05-20T07:07:00.000 | 1 | 0 | 0 | 1 | python,django,shell | 886,561 | 2 | false | 1 | 0 | It is possible.
Usually you will develop your application locally (where shell access is nice to have) and publish your work to your server. All you need for this is FTP access and some way to import a database dump from your development database (often hosters provide an installation of phpMyAdmin for this).
python (... | 1 | 0 | 0 | Is it possible to run django without shell access? My hoster supports the following for 5€/month:
python (I assume via mod_python)
mysql
There is no shell nor cronjob support, which costs additional 10€/month, so I'm trying to avoid it.
I know that Google Apps also work without shell access, but I assume that is pos... | Django without shell access | 0.099668 | 0 | 0 | 702 |
886,653 | 2009-05-20T07:44:00.000 | 1 | 1 | 0 | 0 | python,cgi | 886,956 | 3 | false | 0 | 0 | The script is probably not killed silently; you just don't see the exception which python throws. I suggest to wrap the whole script in try-except and write any exception to a log file.
This way, you can see what really happens. The logging module is your friend. | 1 | 2 | 0 | I have a python cgi script that accepts user uploads (via sys.stdin.read).
After receiving the file (whether successfully or unsuccessfully), the script needs to do some cleanup. This works fine when upload finishes correctly, however if the user closes the client, the cgi script is silently killed on the server, and a... | Making a python cgi script to finish gracefully | 0.066568 | 0 | 0 | 1,833 |
886,895 | 2009-05-20T08:50:00.000 | 1 | 0 | 1 | 1 | python,linux,runtime,sandbox,restriction | 5,289,924 | 5 | false | 0 | 0 | could you not just run as a user which has no access to anything but the scripts in that directory? | 4 | 2 | 0 | Is it possible to create an environment to safely run arbitrary Python scripts under Linux? Those scripts are supposed to be received from untrusted people and may be too large to check them manually.
A very brute-force solution is to create a virtual machine and restore its initial state after every launch of an untru... | Safe Python Environment in Linux | 0.039979 | 0 | 0 | 920 |
886,895 | 2009-05-20T08:50:00.000 | 2 | 0 | 1 | 1 | python,linux,runtime,sandbox,restriction | 887,091 | 5 | false | 0 | 0 | You could run jython and use the sandboxing mechanism from the JVM. The sandboxing in the JVM is very strong very well understood and more or less well documented. It will take some time to define exactly what you want to allow and what you dnt want to allow, but you should be able to get a very strong security from th... | 4 | 2 | 0 | Is it possible to create an environment to safely run arbitrary Python scripts under Linux? Those scripts are supposed to be received from untrusted people and may be too large to check them manually.
A very brute-force solution is to create a virtual machine and restore its initial state after every launch of an untru... | Safe Python Environment in Linux | 0.07983 | 0 | 0 | 920 |
886,895 | 2009-05-20T08:50:00.000 | 4 | 0 | 1 | 1 | python,linux,runtime,sandbox,restriction | 887,104 | 5 | false | 0 | 0 | There are 4 things you may try:
As you already mentioned, using a virtual machine or some other form of virtualisation (perhaps solaris zones are lightweight enough?). If the script breaks the OS there then you don't care.
Using chroot, which puts a shell session into a virtual root directory, separate from the main O... | 4 | 2 | 0 | Is it possible to create an environment to safely run arbitrary Python scripts under Linux? Those scripts are supposed to be received from untrusted people and may be too large to check them manually.
A very brute-force solution is to create a virtual machine and restore its initial state after every launch of an untru... | Safe Python Environment in Linux | 0.158649 | 0 | 0 | 920 |
886,895 | 2009-05-20T08:50:00.000 | 4 | 0 | 1 | 1 | python,linux,runtime,sandbox,restriction | 886,945 | 5 | true | 0 | 0 | Consider using a chroot jail. Not only is this very secure, well-supported and tested but it also applies to external applications you run from python. | 4 | 2 | 0 | Is it possible to create an environment to safely run arbitrary Python scripts under Linux? Those scripts are supposed to be received from untrusted people and may be too large to check them manually.
A very brute-force solution is to create a virtual machine and restore its initial state after every launch of an untru... | Safe Python Environment in Linux | 1.2 | 0 | 0 | 920 |
887,557 | 2009-05-20T12:12:00.000 | 2 | 0 | 0 | 1 | python,linux,file,date | 887,652 | 5 | false | 0 | 0 | I am not a UNIX expert, so maybe I'm wrong, but I think that UNIX (or Linux) don't store file creation time. | 1 | 15 | 0 | Can I change creation date of some file using Python in Linux? | Change file creation date | 0.07983 | 0 | 0 | 23,873 |
888,100 | 2009-05-20T14:04:00.000 | 3 | 0 | 1 | 0 | python,compiler-construction,interpreter,bytecode | 1,189,344 | 6 | false | 0 | 0 | Although there is a small efficiency aspect to it (you can store the bytecode on disk or in memory), its mostly engineering: it allows you separate parsing from interpreting. Parsers can often be nasty creatures, full of edge-cases and having to conform to esoteric rules like using just the right amount of lookahead an... | 5 | 15 | 0 | Why python compile the source to bytecode before interpreting?
Why not interpret from the source directly? | Why python compile the source to bytecode before interpreting? | 0.099668 | 0 | 0 | 4,515 |
888,100 | 2009-05-20T14:04:00.000 | 7 | 0 | 1 | 0 | python,compiler-construction,interpreter,bytecode | 888,116 | 6 | false | 0 | 0 | Because interpretting from bytecode directly is faster. It avoids the need to do lexing, for one thing. | 5 | 15 | 0 | Why python compile the source to bytecode before interpreting?
Why not interpret from the source directly? | Why python compile the source to bytecode before interpreting? | 1 | 0 | 0 | 4,515 |
888,100 | 2009-05-20T14:04:00.000 | 8 | 0 | 1 | 0 | python,compiler-construction,interpreter,bytecode | 888,117 | 6 | false | 0 | 0 | Because you can compile to a .pyc once and interpret from it many times.
So if you're running a script many times you only have the overhead of parsing the source code once. | 5 | 15 | 0 | Why python compile the source to bytecode before interpreting?
Why not interpret from the source directly? | Why python compile the source to bytecode before interpreting? | 1 | 0 | 0 | 4,515 |
888,100 | 2009-05-20T14:04:00.000 | 38 | 0 | 1 | 0 | python,compiler-construction,interpreter,bytecode | 888,119 | 6 | true | 0 | 0 | Nearly no interpreter really interprets code directly, line by line – it's simply too inefficient. Almost all interpreters use some intermediate representation which can be executed easily. Also, small optimizations can be performed on this intermediate code.
Python furthermore stores this code which has a huge advanta... | 5 | 15 | 0 | Why python compile the source to bytecode before interpreting?
Why not interpret from the source directly? | Why python compile the source to bytecode before interpreting? | 1.2 | 0 | 0 | 4,515 |
888,100 | 2009-05-20T14:04:00.000 | 6 | 0 | 1 | 0 | python,compiler-construction,interpreter,bytecode | 888,159 | 6 | false | 0 | 0 | Re-lexing and parsing the source code over and over, rather than doing it just once (most often on the first import), would obviously be a silly and pointless waste of effort. | 5 | 15 | 0 | Why python compile the source to bytecode before interpreting?
Why not interpret from the source directly? | Why python compile the source to bytecode before interpreting? | 1 | 0 | 0 | 4,515 |
889,045 | 2009-05-20T16:45:00.000 | 1 | 0 | 1 | 0 | python,regex | 889,083 | 4 | false | 0 | 0 | You could replace all the {} instances with your replacement string (which would include the {{}} ones), and then replace the {{}} ones with a back-reference to itself (overwriting the first replace with the original data) -- then only the {} instances would have changed. | 1 | 5 | 0 | Long story short, I have two regex patterns. One pattern matches things that I want to replace, and the other pattern matches a special case of those patterns that should not be replace. For a simple example, imagine that the first one is "\{.*\}" and the second one is "\{\{.*\}\}". Then "{this}" should be replaced, bu... | Substituting a regex only when it doesn't match another regex (Python) | 0.049958 | 0 | 0 | 1,924 |
889,143 | 2009-05-20T17:12:00.000 | 1 | 0 | 1 | 0 | python,regex | 889,170 | 5 | false | 0 | 0 | The regular expression should be like ^#[0-7]##$ | 2 | 2 | 0 | I would like to intercept string starting with \*#\*
followed by a number between 0 and 7
and ending with: ##
so something like \*#\*0##
but I could not find a regex for this | Python regular expression to match # followed by 0-7 followed by ## | 0.039979 | 0 | 0 | 453 |
889,143 | 2009-05-20T17:12:00.000 | 1 | 0 | 1 | 0 | python,regex | 889,154 | 5 | false | 0 | 0 | r'\#[0-7]\#\#' | 2 | 2 | 0 | I would like to intercept string starting with \*#\*
followed by a number between 0 and 7
and ending with: ##
so something like \*#\*0##
but I could not find a regex for this | Python regular expression to match # followed by 0-7 followed by ## | 0.039979 | 0 | 0 | 453 |
889,974 | 2009-05-20T20:08:00.000 | 1 | 0 | 0 | 0 | python,sqlite,date | 890,025 | 3 | false | 0 | 0 | Even though the ".schema" indicates that the field is a date or timestamp field... the field is actually a string. You can format the string anyway you want. If memory serves... their is no validation at all. | 1 | 0 | 0 | At start you have a string 'DDMMYYYY HHMMSS' and I want at the end to insert the string in a date field in sqlite3 database. The program is made in python. How can I do that ? | Is it possible to format a date with sqlite3? | 0.066568 | 1 | 0 | 359 |
890,128 | 2009-05-20T20:40:00.000 | 8 | 1 | 1 | 0 | python,function,lambda,closures | 890,156 | 26 | false | 0 | 0 | Lambdas are deeply linked to functional programming style in general. The idea that you can solve problems by applying a function to some data, and merging the results, is what google uses to implement most of its algorithms.
Programs written in functional programming style, are easily parallelized and hence are bec... | 6 | 971 | 0 | I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten?
I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various defin... | How are lambdas useful? | 1 | 0 | 0 | 576,496 |
890,128 | 2009-05-20T20:40:00.000 | 6 | 1 | 1 | 0 | python,function,lambda,closures | 890,217 | 26 | false | 0 | 0 | I'm just beginning Python and ran head first into Lambda- which took me a while to figure out.
Note that this isn't a condemnation of anything. Everybody has a different set of things that don't come easily.
Is lambda one of those 'interesting' language items that in real life should be forgotten?
No.
I'm sure the... | 6 | 971 | 0 | I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten?
I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various defin... | How are lambdas useful? | 1 | 0 | 0 | 576,496 |
890,128 | 2009-05-20T20:40:00.000 | 26 | 1 | 1 | 0 | python,function,lambda,closures | 890,151 | 26 | false | 0 | 0 | Pretty much anything you can do with lambda you can do better with either named functions or list and generator expressions.
Consequently, for the most part you should just one of those in basically any situation (except maybe for scratch code written in the interactive interpreter). | 6 | 971 | 0 | I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten?
I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various defin... | How are lambdas useful? | 1 | 0 | 0 | 576,496 |
890,128 | 2009-05-20T20:40:00.000 | 2 | 1 | 1 | 0 | python,function,lambda,closures | 890,192 | 26 | false | 0 | 0 | Lambda is a procedure constructor. You can synthesize programs at run-time, although Python's lambda is not very powerful. Note that few people understand that kind of programming. | 6 | 971 | 0 | I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten?
I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various defin... | How are lambdas useful? | 0.015383 | 0 | 0 | 576,496 |
890,128 | 2009-05-20T20:40:00.000 | 5 | 1 | 1 | 0 | python,function,lambda,closures | 890,997 | 26 | false | 0 | 0 | I started reading David Mertz's book today 'Text Processing in Python.' While he has a fairly terse description of Lambda's the examples in the first chapter combined with the explanation in Appendix A made them jump off the page for me (finally) and all of a sudden I understood their value. That is not to say his exp... | 6 | 971 | 0 | I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten?
I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various defin... | How are lambdas useful? | 0.038443 | 0 | 0 | 576,496 |
890,128 | 2009-05-20T20:40:00.000 | 11 | 1 | 1 | 0 | python,function,lambda,closures | 3,961,969 | 26 | false | 0 | 0 | As stated above, the lambda operator in Python defines an anonymous function, and in Python functions are closures. It is important not to confuse the concept of closures with the operator lambda, which is merely syntactic methadone for them.
When I started in Python a few years ago, I used lambdas a lot, thinking they... | 6 | 971 | 0 | I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten?
I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various defin... | How are lambdas useful? | 1 | 0 | 0 | 576,496 |
890,827 | 2009-05-21T00:00:00.000 | 0 | 0 | 1 | 1 | python,version,installation | 891,966 | 4 | false | 0 | 0 | You can also use the Fink package manager and simply to "fink install python2.3".
If you need Python 2.3 to be your default, you can simply change /sw/bin/python and /sw/bin/pydoc to point to the version you want (they sit in /sw/bin/). | 2 | 2 | 0 | I have Mac OS X 10.5.7 with Python 2.5. I need to test a package I am working on with Python 2.3 for compatibility. I don't want to downgrade my whole system so is there a way to do an install of Python 2.3 that does not change the system python? | Install older versions of Python for testing on Mac OS X | 0 | 0 | 0 | 5,880 |
890,827 | 2009-05-21T00:00:00.000 | 0 | 0 | 1 | 1 | python,version,installation | 892,087 | 4 | false | 0 | 0 | One alternative is to use a virtual machine.
With something like VMWare Fusion or Virtualbox you could install a complete Linux system with Python2.3, and do your testing there. The advantage is that it would be completely sand-boxed, so wouldn't affect your main system at all. | 2 | 2 | 0 | I have Mac OS X 10.5.7 with Python 2.5. I need to test a package I am working on with Python 2.3 for compatibility. I don't want to downgrade my whole system so is there a way to do an install of Python 2.3 that does not change the system python? | Install older versions of Python for testing on Mac OS X | 0 | 0 | 0 | 5,880 |
891,934 | 2009-05-21T08:46:00.000 | 3 | 1 | 0 | 0 | python,django,e-commerce,satchmo | 901,050 | 1 | true | 1 | 0 | It looks like the satchmo_cart_details_query signal is the way to go about doing this. It allows you to add a price change value (in my case, donation amount) to a cart item
I'll post the full solution if anyone is interested | 1 | 2 | 0 | Can anyone share some pointers on building a Donations module for Satchmo? I'm comfortable customizing Satchmo's product models etc but unable to find anything related to Donations
I realize it's possible to create a Donations virtual product but as far as I can tell this still requires setting the amount beforehand ($... | Satchmo donations | 1.2 | 0 | 0 | 253 |
892,196 | 2009-05-21T10:04:00.000 | 0 | 1 | 0 | 0 | python,smtp | 892,264 | 3 | false | 0 | 0 | Depends what you mean by "received". It's possible to verify "delivery" of a message to a server but there is no 100% reliable guarantee it actually ended up in a mailbox. smtplib will throw an exception on certain conditions (like the remote end reporting user not found) but just as often the remote end will accept th... | 1 | 0 | 0 | buildin an smtp client in python . which can send mail , and also show that mail has been received through any mail service for example gmail !! | How would one build an smtp client in python? | 0 | 0 | 1 | 769 |
892,266 | 2009-05-21T10:31:00.000 | 2 | 0 | 0 | 1 | python,django,google-app-engine,mail-server | 892,427 | 2 | false | 1 | 0 | The example code for the remote APi gives you an interactive console from which you can access any of the modules in your application. I see no requirement that they be only datastore operations. | 1 | 0 | 0 | I have a web server with Django, hosted with Apache server. I would like to configure Google App Engine for the email server. My web server should be able to use Google App Engine, when it makes any email send using EmailMessage or sendmail infrastructure of Google Mail API.
I learnt that by using Remote API, I can ac... | Send emails from Google App Engine | 0.197375 | 0 | 0 | 1,502 |
893,162 | 2009-05-21T14:20:00.000 | 30 | 0 | 1 | 0 | python,macos,ide | 901,101 | 22 | true | 0 | 0 | Have tried many different (Kate, Eclipse, Scite, Vim, Komodo): each one have some glitches, either limited functions, or slow and unresponsive. Final choice after many years: Emacs + ropemacs + flymake. Rope project file open dialog is extremely quick. Rope refactoring and code assist functions are super helpful. Flyma... | 7 | 135 | 0 | I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Pyth... | What's a good IDE for Python on Mac OS X? | 1.2 | 0 | 0 | 344,918 |
893,162 | 2009-05-21T14:20:00.000 | 3 | 0 | 1 | 0 | python,macos,ide | 893,215 | 22 | false | 0 | 0 | If you have a budget for your IDE, you should give Wingware Professional a try, see wingware.com . | 7 | 135 | 0 | I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Pyth... | What's a good IDE for Python on Mac OS X? | 0.027266 | 0 | 0 | 344,918 |
893,162 | 2009-05-21T14:20:00.000 | 1 | 0 | 1 | 0 | python,macos,ide | 893,233 | 22 | false | 0 | 0 | Python support on netbeans is surprisingly good, and comes with most of the features you're looking for. | 7 | 135 | 0 | I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Pyth... | What's a good IDE for Python on Mac OS X? | 0.009091 | 0 | 0 | 344,918 |
893,162 | 2009-05-21T14:20:00.000 | 1 | 0 | 1 | 0 | python,macos,ide | 893,407 | 22 | false | 0 | 0 | TextMate or Panic's Coda. NetBeans works very well, if you want a full-blown kitchen sink IDE. | 7 | 135 | 0 | I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Pyth... | What's a good IDE for Python on Mac OS X? | 0.009091 | 0 | 0 | 344,918 |
893,162 | 2009-05-21T14:20:00.000 | 1 | 0 | 1 | 0 | python,macos,ide | 8,821,307 | 22 | false | 0 | 0 | "Which editor/IDE for ...?" is a longstanding way to start a "My dog is too prettier than yours!" slapfest. Nowadays most editors from vim upwards can be used, there are multiple good alternatives, and even IDEs that started as C or Java tools work pretty well with Python and other dynamic languages.
That said, having ... | 7 | 135 | 0 | I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Pyth... | What's a good IDE for Python on Mac OS X? | 0.009091 | 0 | 0 | 344,918 |
893,162 | 2009-05-21T14:20:00.000 | 0 | 0 | 1 | 0 | python,macos,ide | 15,312,606 | 22 | false | 0 | 0 | I may be a little late for this, but I would recommend Aptana Studio 3.x . Its a based on eclipse and has everything ready-to-go for python. It has very good support for DJango, HTML5 and JQuery. For me its a perfect web-development tool. I do HTML5 and Android development too, this way I do not need to keep switching ... | 7 | 135 | 0 | I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Pyth... | What's a good IDE for Python on Mac OS X? | 0 | 0 | 0 | 344,918 |
893,162 | 2009-05-21T14:20:00.000 | 5 | 0 | 1 | 0 | python,macos,ide | 893,240 | 22 | false | 0 | 0 | macvim + pyflakes.vim | 7 | 135 | 0 | I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Pyth... | What's a good IDE for Python on Mac OS X? | 0.045423 | 0 | 0 | 344,918 |
894,845 | 2009-05-21T20:05:00.000 | 5 | 0 | 0 | 1 | python | 894,869 | 2 | true | 0 | 0 | If you're looking to do recurring scheduled tasks, then the Task Scheduler (Vista) or Scheduled Tasks (XP and, I think, earlier) is the appropriate method on Windows. | 1 | 1 | 0 | I have run a few using batch jobs, but, I am wondering what would be the most appropriate? Maybe using time.strftime? | How can I launch a python script on windows? | 1.2 | 0 | 0 | 196 |
895,163 | 2009-05-21T21:06:00.000 | 0 | 1 | 0 | 0 | python | 895,181 | 3 | false | 0 | 0 | Since the RDBMS and the network are the bottlenecks, I see no value in fussing around creating an EXE.
On average, most of a web site's transfers are static content (images, .CSS, .JS, etc.) which is best handled by Apache without any Python in the loop. This has huge impact.
Reserve Python for the "interesting" and... | 2 | 0 | 0 | Assuming the webserver is configured to handle .exe, Can i compile a python CGI file into an exe for speed. What would some pros and cons be to such a desession? | Compiled Python CGI | 0 | 0 | 0 | 712 |
895,163 | 2009-05-21T21:06:00.000 | 1 | 1 | 0 | 0 | python | 895,211 | 3 | false | 0 | 0 | You probably don't want to run Python as a CGI if you want it fast. Look at proxies, mod_python, WSGI or FastCGI, as those techinques avoid re-loading python runtime and your app on each request. | 2 | 0 | 0 | Assuming the webserver is configured to handle .exe, Can i compile a python CGI file into an exe for speed. What would some pros and cons be to such a desession? | Compiled Python CGI | 0.066568 | 0 | 0 | 712 |
895,420 | 2009-05-21T21:58:00.000 | 0 | 0 | 0 | 0 | python | 895,439 | 9 | false | 1 | 0 | Lookup Django. | 1 | 17 | 0 | I have been doing some work in python, but that was all for stand alone applications. I'm curious to know whether any offshoot of python supports web development?
Would some one also suggest a good tutorial or a website from where I can pick up some of the basics of web development using python? | Using python to develop web application | 0 | 0 | 0 | 23,044 |
895,454 | 2009-05-21T22:05:00.000 | 2 | 0 | 0 | 0 | python,django,dependencies | 895,984 | 4 | false | 1 | 0 | Normally I advocate for splitting functionality into smaller apps, but a circular dependence between models reflects such a tight integration that you're probably not gaining much from the split and might just consider merging the apps. If that results in an app that feels too large, there may be a way to make the spl... | 2 | 26 | 0 | I am in the middle of developing a Django application, which has quite complicated models (it models a university - courses, modules, lectures, students etc.)
I have separated the project into apps, to make the whole thing more organised (apps are courses, schools, people, modules and timeperiods). I am having a proble... | Django App Dependency Cycle | 0.099668 | 0 | 0 | 7,969 |
895,454 | 2009-05-21T22:05:00.000 | 3 | 0 | 0 | 0 | python,django,dependencies | 896,090 | 4 | false | 1 | 0 | If you're seeing circular model dependency I'm guessing that one of three things is happening:
You've defined an inverse relationship to one that's already defined (for instance both course has many lectures and lecture has one course) which is redundant in django
You have a model method in the wrong app
You're provid... | 2 | 26 | 0 | I am in the middle of developing a Django application, which has quite complicated models (it models a university - courses, modules, lectures, students etc.)
I have separated the project into apps, to make the whole thing more organised (apps are courses, schools, people, modules and timeperiods). I am having a proble... | Django App Dependency Cycle | 0.148885 | 0 | 0 | 7,969 |
896,112 | 2009-05-22T02:09:00.000 | 3 | 1 | 1 | 0 | python,python-import | 896,128 | 4 | false | 0 | 0 | You won't get recursion on imports because Python caches each module and won't reload one it already has. | 3 | 11 | 0 | How do I set up module imports so that each module can access the objects of all the others?
I have a medium size Python application with modules files in various subdirectories. I have created modules that append these subdirectories to sys.path and imports a group of modules, using import thisModule as tm. Module o... | Properly importing modules in Python | 0.148885 | 0 | 0 | 16,427 |
896,112 | 2009-05-22T02:09:00.000 | 6 | 1 | 1 | 0 | python,python-import | 896,137 | 4 | false | 0 | 0 | Few pointers
You may have already split
functionality in various module. If
correctly done most of the time you
will not fall into circular import
problems (e.g. if module a depends
on b and b on a you can make a third
module c to remove such circular
dependency). As last resort, in a
import b but in b import a at th... | 3 | 11 | 0 | How do I set up module imports so that each module can access the objects of all the others?
I have a medium size Python application with modules files in various subdirectories. I have created modules that append these subdirectories to sys.path and imports a group of modules, using import thisModule as tm. Module o... | Properly importing modules in Python | 1 | 0 | 0 | 16,427 |
896,112 | 2009-05-22T02:09:00.000 | 4 | 1 | 1 | 0 | python,python-import | 897,001 | 4 | false | 0 | 0 | The way to do this is to avoid magic. In other words, if your module requires something from another module, it should import it explicitly. You shouldn't rely on things being imported automatically.
As the Zen of Python (import this) has it, explicit is better than implicit. | 3 | 11 | 0 | How do I set up module imports so that each module can access the objects of all the others?
I have a medium size Python application with modules files in various subdirectories. I have created modules that append these subdirectories to sys.path and imports a group of modules, using import thisModule as tm. Module o... | Properly importing modules in Python | 0.197375 | 0 | 0 | 16,427 |
896,421 | 2009-05-22T05:01:00.000 | 0 | 0 | 0 | 0 | python,django,django-models | 3,902,915 | 5 | false | 1 | 0 | There are anumber of ways to do this, but here's what I'd do: I'd allow a user to enter an email, username (which must contain at least one letter and no @ symbols) or mobile number. Then, when I validate it:
Check for the presence of @. If so, set it as the user's email, hash it appropriately and set it as their user... | 3 | 14 | 0 | The default Django's User model has some fields, and validation rules, that I don't really need. I want to make registration as simple as possible, i.e. require either email or username, or phone number - all those being unique, hence good as user identifiers.
I also don't like default character set for user name that... | How to change default django User model to fit my needs? | 0 | 0 | 0 | 12,241 |
896,421 | 2009-05-22T05:01:00.000 | 0 | 0 | 0 | 0 | python,django,django-models | 898,052 | 5 | false | 1 | 0 | You face a bit of a dilemma which really has two solutions if you're committed to avoiding the profile-based customization already pointed out.
Change the User model itself, per Daniel's suggestions
Write a CustomUser class, subclassing User or copying its functionality.
The latter suggestion means that you would hav... | 3 | 14 | 0 | The default Django's User model has some fields, and validation rules, that I don't really need. I want to make registration as simple as possible, i.e. require either email or username, or phone number - all those being unique, hence good as user identifiers.
I also don't like default character set for user name that... | How to change default django User model to fit my needs? | 0 | 0 | 0 | 12,241 |
896,421 | 2009-05-22T05:01:00.000 | 10 | 0 | 0 | 0 | python,django,django-models | 898,313 | 5 | true | 1 | 0 | Rather than modify the User class directly or do subclassing, you can also just repurpose the existing fields.
For one site I used the "first_name" field as the "publicly displayed name" of a user and stuff a slugified version of that into the "username" field (for use in URLs). I wrote a custom auth backend to allo... | 3 | 14 | 0 | The default Django's User model has some fields, and validation rules, that I don't really need. I want to make registration as simple as possible, i.e. require either email or username, or phone number - all those being unique, hence good as user identifiers.
I also don't like default character set for user name that... | How to change default django User model to fit my needs? | 1.2 | 0 | 0 | 12,241 |
897,020 | 2009-05-22T09:16:00.000 | 0 | 0 | 1 | 0 | python,database,escaping,sql-injection | 2,429,209 | 9 | false | 0 | 0 | For a solution to a more generic problem, I have a program where I needed to store any set of characters in a flat file, tab delimited. Obviously, having tabs in the 'set' was causing problems.
Instead of output_f.write(str), I used output_f.write(repr(str)), which solved my problem.
It is slower to read, as I need to ... | 2 | 42 | 0 | I've tried all manner of Python modules and they either escape too much or in the wrong way.
What's the best way you've found to escape quotes (", ') in Python? | A good way to escape quotes in a database query string? | 0 | 0 | 0 | 110,878 |
897,020 | 2009-05-22T09:16:00.000 | 1 | 0 | 1 | 0 | python,database,escaping,sql-injection | 9,028,006 | 9 | false | 0 | 0 | Triple-double quotes are best for escaping:
string = """This will span across 'single quotes', "double quotes",
and literal EOLs all in the same string.""" | 2 | 42 | 0 | I've tried all manner of Python modules and they either escape too much or in the wrong way.
What's the best way you've found to escape quotes (", ') in Python? | A good way to escape quotes in a database query string? | 0.022219 | 0 | 0 | 110,878 |
898,426 | 2009-05-22T15:19:00.000 | 3 | 0 | 0 | 0 | python,django,e-commerce,shopping-cart | 899,393 | 2 | true | 1 | 0 | Since you asked: if your needs are that limited, it does sound like a DIY situation to me. I don't see what's so fiddly about it; what complexity there is is all in the pricing formula, and you're planning to supply that either way. Add in Django's built-in session support and you're most of the way there. | 1 | 1 | 0 | I'm about to build a site that has about half a dozen fairly similar products. They're all DVDs so they fit into a very "fixed" database very well. I was going to make a DVD model. Tag them up. All very simple. All very easy.
But we need to be able to sell them. The current site outsources the whole purchasing system b... | Django shopping cart/basket solution (or should I DIM)? | 1.2 | 0 | 0 | 3,617 |
898,669 | 2009-05-22T16:09:00.000 | 4 | 0 | 1 | 0 | python,file,binary | 898,691 | 21 | false | 0 | 0 | Usually you have to guess.
You can look at the extensions as one clue, if the files have them.
You can also recognise know binary formats, and ignore those.
Otherwise see what proportion of non-printable ASCII bytes you have and take a guess from that.
You can also try decoding from UTF-8 and see if that produces sensi... | 1 | 118 | 0 | How can I tell if a file is binary (non-text) in Python?
I am searching through a large set of files in Python, and keep getting matches in binary files. This makes the output look incredibly messy.
I know I could use grep -I, but I am doing more with the data than what grep allows for.
In the past, I would have just s... | How can I detect if a file is binary (non-text) in Python? | 0.038077 | 0 | 0 | 86,979 |
898,993 | 2009-05-22T17:25:00.000 | 0 | 1 | 0 | 0 | ironpython | 924,632 | 4 | true | 0 | 0 | Does your timings include startup time?
IronPython 2.6 Beta has radical improvements to startup time and code compilation/execution. Suggest you try that release if you can.
Cheers,
Davy | 1 | 0 | 0 | It seems that IronPython 2.0.1 executes a script file about 3x slower than IronPython 1.x.
I'm not convinced that it isn't something I'm doing so I'm wondering if others have had a similar experience.
I have a 200k python script that takes 5 seconds to execute from a file on IP 1.x and nearly 18 seconds in IP 2.0.1! | IronPython 2.0 executes code slowly | 1.2 | 0 | 0 | 441 |
900,929 | 2009-05-23T05:32:00.000 | 0 | 0 | 1 | 0 | python | 900,943 | 5 | false | 0 | 0 | In part it is confusing due to the dynamically typed nature of Python, which allows you to operate on a class and an instance in essentially the same way. In other languages, the difference is more concrete in that a class provides a template by which to create an object (instance) and cannot be as directly manipulated... | 2 | 2 | 0 | I have read several documentation already but the definition of "class" and "instance" didnt get really clear for me yet.
Looks like that "class" is like a combination of functions or methods that return some result is that correct? And how about the instance? I read that you work with the class you creat trough the in... | Need help with the class and instance concept in Python | 0 | 0 | 0 | 555 |
900,929 | 2009-05-23T05:32:00.000 | 3 | 0 | 1 | 0 | python | 900,953 | 5 | false | 0 | 0 | I am not sure of what level of knowledge you have, so I apologize if this answer is too simplified (then just ignore it).
A class is a template for an object. Like a blueprint for a car. The instance of a class is like an actual car. So you have one blueprint, but you can have several different instances of cars. The b... | 2 | 2 | 0 | I have read several documentation already but the definition of "class" and "instance" didnt get really clear for me yet.
Looks like that "class" is like a combination of functions or methods that return some result is that correct? And how about the instance? I read that you work with the class you creat trough the in... | Need help with the class and instance concept in Python | 0.119427 | 0 | 0 | 555 |
901,704 | 2009-05-23T15:13:00.000 | 3 | 0 | 0 | 0 | python,wxpython,wxwidgets | 901,806 | 2 | false | 0 | 1 | What I did when I encountered such a case was to create a column for IDs and set its width to 0. | 1 | 2 | 0 | I posted this in the mailing list, but the reply I got wasn't too clear, so maybe I'll have better luck here.
I currently have a grid with data in it.
I would like to know if there is a way to give each generated row an
ID, or at least, associate each row with an object.
It may make it more clear if I clarify what i'm ... | Give Wxwidget Grid rows an ID | 0.291313 | 1 | 0 | 1,026 |
902,761 | 2009-05-24T00:08:00.000 | 0 | 0 | 0 | 0 | python,image,numpy | 72,331,083 | 21 | false | 0 | 0 | I attach an simple routine to convert a npy to an image. Works 100% and it is a piece of cake!
from PIL import Image
import matplotlib
img = np.load('flair1_slice75.npy')
matplotlib.image.imsave("G1_flair_75.jpeg", img) | 1 | 370 | 1 | I have a matrix in the type of a Numpy array. How would I write it to disk it as an image? Any format works (png, jpeg, bmp...). One important constraint is that PIL is not present. | Saving a Numpy array as an image | 0 | 0 | 0 | 767,103 |
903,104 | 2009-05-24T04:53:00.000 | 1 | 0 | 0 | 0 | javascript,python,cross-domain | 903,112 | 2 | false | 1 | 0 | Make your app into a Google Gadget, Open Social gadget, or other kind of gadgets -- these are all designed to be embeddable into third-party pages with as little fuss as possible. | 1 | 1 | 0 | I want to create a simple online poll application. I have created a backend in python that handles vote tracking, poll display, results display and admin setup. However, if I wanted a third party to be able to embed the poll in their website, what would be the recommended way of doing so? I would love to be able to ... | How to embed a Poll in a Web Page | 0.099668 | 0 | 1 | 552 |
903,818 | 2009-05-24T14:03:00.000 | 1 | 0 | 1 | 0 | python,class | 904,482 | 6 | false | 0 | 0 | Not knowing what is you are trying to achieve, i would suggest taking a look at pydispatcher.
It allows you to implement the Observer pattern
Basically, you register F2 with the dispatcher so that it will be called when a specific 'signal' is emitted. Your F1 'emits a signal' that says "I've been called". The dispat... | 1 | 2 | 0 | I have two Python classes, call them "C1" and "C2". Inside C1 is a function named "F1" and inside C2 is a function named "F2". Is there a way to execute F2 each time F1 is run without making a direct call to F2 from within F1? Is there some other mechanism by which to know when a function from inside another class has ... | How to tell when a function in another class has been called | 0.033321 | 0 | 0 | 343 |
904,042 | 2009-05-24T15:56:00.000 | 2 | 0 | 0 | 0 | python,mysql | 904,077 | 2 | false | 0 | 0 | Use mysql's own ability to log the queries and watch for them. | 1 | 2 | 0 | In diagnosing SQL query problems, it would sometimes be useful to be able to see the query string after parameters are interpolated into it, using MySQLdb's safe interpolation.
Is there a way to get that information from either a MySQL exception object or from the connection object itself? | python-mysql : How to get interpolated query string? | 0.197375 | 1 | 0 | 817 |
904,746 | 2009-05-24T21:56:00.000 | 27 | 0 | 1 | 0 | python,replace | 32,574,818 | 10 | false | 0 | 0 | If you want to remove everything after the last occurrence of separator in a string I find this works well:
<separator>.join(string_to_split.split(<separator>)[:-1])
For example, if string_to_split is a path like root/location/child/too_far.exe and you only want the folder path, you can split by "/".join(string_to_spl... | 2 | 209 | 0 | I have a string. How do I remove all text after a certain character? (In this case ...)
The text after will ... change so I that's why I want to remove all characters after a certain one. | How to remove all characters after a specific character in python? | 1 | 0 | 0 | 383,369 |
904,746 | 2009-05-24T21:56:00.000 | 0 | 0 | 1 | 0 | python,replace | 66,455,567 | 10 | false | 0 | 0 | This is in python 3.7 working to me
In my case I need to remove after dot in my string variable fees
fees = 45.05
split_string = fees.split(".", 1)
substring = split_string[0]
print(substring) | 2 | 209 | 0 | I have a string. How do I remove all text after a certain character? (In this case ...)
The text after will ... change so I that's why I want to remove all characters after a certain one. | How to remove all characters after a specific character in python? | 0 | 0 | 0 | 383,369 |
904,928 | 2009-05-25T00:11:00.000 | 720 | 0 | 1 | 0 | python,padding,strftime | 2,073,189 | 21 | false | 0 | 0 | Actually I had the same problem and I realized that, if you add a hyphen between the % and the letter, you can remove the leading zero.
For example %Y/%-m/%-d.
This only works on Unix (Linux, OS X), not Windows (including Cygwin). On Windows, you would use #, e.g. %Y/%#m/%#d. | 5 | 369 | 0 | When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01 is 1? Can't find a %thingy for that?
Thanks! | Python strftime - date without leading 0? | 1 | 0 | 0 | 188,421 |
904,928 | 2009-05-25T00:11:00.000 | 23 | 0 | 1 | 0 | python,padding,strftime | 27,125,022 | 21 | false | 0 | 0 | quite late to the party but %-d works on my end.
datetime.now().strftime('%B %-d, %Y') produces something like "November 5, 2014"
cheers :) | 5 | 369 | 0 | When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01 is 1? Can't find a %thingy for that?
Thanks! | Python strftime - date without leading 0? | 1 | 0 | 0 | 188,421 |
904,928 | 2009-05-25T00:11:00.000 | 5 | 0 | 1 | 0 | python,padding,strftime | 3,285,938 | 21 | false | 0 | 0 | For %d you can convert to integer using int() then it'll automatically remove leading 0 and becomes integer. You can then convert back to string using str(). | 5 | 369 | 0 | When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01 is 1? Can't find a %thingy for that?
Thanks! | Python strftime - date without leading 0? | 0.047583 | 0 | 0 | 188,421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.