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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,068,843 | 2010-06-18T10:30:00.000 | 2 | 0 | 0 | 0 | python,django,django-admin | 3,180,399 | 12 | false | 1 | 0 | You can do this by following way:
1)You can make the fields read only if the object has been created.But doing this noone will be able to change the fields
2)You can use databrowse
3)You can use form validation ,if user is not in the selected list throw validation error if any field is changed
4)you can create a view ,if user is in your list then redirect it to normal flow or else redirect him to simple html readonly page
5)Use jquery to make the fields readonly is user is not in the list and override the save method to check any smartness.In your save method you throw error any form has changed and user is not in your list.username=request.user.username | 3 | 27 | 0 | is it possible to give users the permission to view, but not to change or delete.
currently in the only permissions I see are "add", "change" and "delete"... but there is no "read/view" in there.
I really need this as some users will only be able to consult the admin panel, in order to see what has been added in. | Permission to view, but not to change! - Django | 0.033321 | 0 | 0 | 25,793 |
3,068,843 | 2010-06-18T10:30:00.000 | 0 | 0 | 0 | 0 | python,django,django-admin | 5,363,776 | 12 | false | 1 | 0 | You may also override ModelAdmin.change_view (as stated in the Django docs). Just make sure you also override save_model to make sure the user can't update the data | 3 | 27 | 0 | is it possible to give users the permission to view, but not to change or delete.
currently in the only permissions I see are "add", "change" and "delete"... but there is no "read/view" in there.
I really need this as some users will only be able to consult the admin panel, in order to see what has been added in. | Permission to view, but not to change! - Django | 0 | 0 | 0 | 25,793 |
3,069,583 | 2010-06-18T12:34:00.000 | 0 | 0 | 0 | 0 | python,django | 3,069,642 | 2 | true | 1 | 0 | Personnaly, I use the exception mechanism for this kind of stuff and I don't really see why I shouldn't | 2 | 0 | 0 | I have a view my Django application which when invoked calls my backend. My backend logic sometimes reaches a point when it needs user input to continue. When this happens, I pickle dump my backend data into the session so that i can resume it later on.
Currently i have defined the scenario when user input is required as a custom exception which i raise. This exception bubbles up all the way to the view where I trap it and do the needful. This works but it isn't really an exception. Is there some kind of event functionality in Django that I could use? Is there a better way to accomplish this? | Some kind of event functionality in Django? | 1.2 | 0 | 0 | 79 |
3,069,583 | 2010-06-18T12:34:00.000 | 0 | 0 | 0 | 0 | python,django | 3,070,920 | 2 | false | 1 | 0 | I'd say there are two ways: You assume that data should be present and if they are not, custom exception should be raised as mentioned.
However, if it's part of expected workflow and it may just be present in a state, I'd handle it accordingly, i.e. by checking results from view calls.
(And I'd say that continuations from Seaside are best solution for this, as far as I understand them)
Definitely, signals are not for this; they are designed to "hook" on specific events, which is not what You want. | 2 | 0 | 0 | I have a view my Django application which when invoked calls my backend. My backend logic sometimes reaches a point when it needs user input to continue. When this happens, I pickle dump my backend data into the session so that i can resume it later on.
Currently i have defined the scenario when user input is required as a custom exception which i raise. This exception bubbles up all the way to the view where I trap it and do the needful. This works but it isn't really an exception. Is there some kind of event functionality in Django that I could use? Is there a better way to accomplish this? | Some kind of event functionality in Django? | 0 | 0 | 0 | 79 |
3,070,094 | 2010-06-18T13:40:00.000 | 1 | 0 | 0 | 0 | python,mysql,excel,csv,import-from-excel | 3,072,109 | 5 | false | 0 | 0 | As far as I know, there is no tool that can automate this process (I would love for someone to prove me wrong as I've had this exact problem before).
When I did this, I came up with two options:
(1) Manually create the columns in the db with the appropriate types and then import, or
(2) Write some kind of filter that could "figure out" what data types the columns should be.
I went with the first option mainly because I didn't think I could actually write a program to do the type inference.
If you do decide to write a type inference tool/conversion, here are a couple of issues you may have to deal with:
(1) Excel dates are actually stored as the number of days since December 31st, 1899; how does one infer then that a column is dates as opposed to some piece of numerical data (population for example)?
(2) For text fields, do you just make the columns of type varchar(n) where n is the longest entry in that column, or do you make it an unbounded char field if one of the entries is longer than some upper limit? If so, what's a good upper limit?
(3) How do you automatically convert a float to a decimal with the correct precision and without loosing any places?
Obviously, this doesn't mean that you won't be able to (I'm a pretty bad programmer). I hope you do, because it'd be a really useful tool to have. | 3 | 6 | 0 | How would I go around creating a MYSQL table schema inspecting an Excel(or CSV) file.
Are there any ready Python libraries for the task?
Column headers would be sanitized to column names. Datatype would be estimated based on the contents of the spreadsheet column. When done, data would be loaded to the table.
I have an Excel file of ~200 columns that I want to start normalizing. | Generate table schema inspecting Excel(CSV) and import data | 0.039979 | 1 | 0 | 7,011 |
3,070,094 | 2010-06-18T13:40:00.000 | 1 | 0 | 0 | 0 | python,mysql,excel,csv,import-from-excel | 3,071,074 | 5 | false | 0 | 0 | Quick and dirty workaround with phpmyadmin:
Create a table with the right amount of columns. Make sure the data fits the columns.
Import the CSV into the table.
Use the propose table structure. | 3 | 6 | 0 | How would I go around creating a MYSQL table schema inspecting an Excel(or CSV) file.
Are there any ready Python libraries for the task?
Column headers would be sanitized to column names. Datatype would be estimated based on the contents of the spreadsheet column. When done, data would be loaded to the table.
I have an Excel file of ~200 columns that I want to start normalizing. | Generate table schema inspecting Excel(CSV) and import data | 0.039979 | 1 | 0 | 7,011 |
3,070,094 | 2010-06-18T13:40:00.000 | 1 | 0 | 0 | 0 | python,mysql,excel,csv,import-from-excel | 3,169,710 | 5 | true | 0 | 0 | Just for (my) reference, I documented below what I did:
XLRD is practical, however I've just saved the Excel data as CSV, so I can use LOAD DATA INFILE
I've copied the header row and started writing the import and normalization script
Script does: CREATE TABLE with all columns as TEXT, except for Primary key
query mysql: LOAD DATA LOCAL INFILE loading all CSV data into TEXT fields.
based on the output of PROCEDURE ANALYSE, I was able to ALTER TABLE to give columns the right types and lengths. PROCEDURE ANALYSE returns ENUM for any column with few distinct values, which is not what I needed, but I found that useful later for normalization. Eye-balling 200 columns was a breeze with PROCEDURE ANALYSE. Output from PhpMyAdmin propose table structure was junk.
I wrote some normalization mostly using SELECT DISTINCT on columns and INSERTing results to separate tables. I have added to the old table a column for FK first. Just after the INSERT, I've got its ID and UPDATEed the FK column. When loop finished I've dropped old column leaving only FK column. Similarly with multiple dependent columns. It was much faster than I expected.
I ran (django) python manage.py inspctdb, copied output to models.py and added all those ForeignkeyFields as FKs do not exist on MyISAM. Wrote a little python views.py, urls.py, few templates...TADA | 3 | 6 | 0 | How would I go around creating a MYSQL table schema inspecting an Excel(or CSV) file.
Are there any ready Python libraries for the task?
Column headers would be sanitized to column names. Datatype would be estimated based on the contents of the spreadsheet column. When done, data would be loaded to the table.
I have an Excel file of ~200 columns that I want to start normalizing. | Generate table schema inspecting Excel(CSV) and import data | 1.2 | 1 | 0 | 7,011 |
3,070,210 | 2010-06-18T13:59:00.000 | 1 | 0 | 0 | 1 | python,windows,linux,pdf,file-io | 3,073,958 | 2 | true | 0 | 0 | I ended up resolving it for our situation. As it turns out the process that was writing the files out had them opened exclusively so all we had to do was try opening them for read access - when denied they were in use. | 2 | 8 | 0 | The situation I'm in is this - there's a process that's writing to a file, sometimes the file is rather large say 400 - 500MB. I need to know when it's done writing. How can I determine this? If I look in the directory I'll see it there but it might not be done being written. Plus this needs to be done remotely - as in on the same internal LAN but not on the same computer and typically the process that wants to know when the file writing is done is running on a Linux box with a the process that's writing the file and the file itself on a windows box. No samba isn't an option. xmlrpc communication to a service on that windows box is an option as well as using snmp to check if that's viable.
Ideally
Works on either Linux or Windows - meaning the solution is OS independent.
Works for any type of file.
Good enough:
Works just on windows but can be done through some library or whatever that can be accessed with Python.
Works only for PDF files.
Current best idea is to periodically open the file in question from some process on the windows box and look at the last bytes checking for the PDF end tag and accounting for the eol differences because the file may have been created on Linux or Windows. | Need a way to determine if a file is done being written to | 1.2 | 0 | 1 | 8,480 |
3,070,210 | 2010-06-18T13:59:00.000 | 8 | 0 | 0 | 1 | python,windows,linux,pdf,file-io | 3,070,749 | 2 | false | 0 | 0 | There are probably many approaches you can take. I would try to open the file with write access. If that succeeds then no-one else is writing to that file.
Build a web service around this concept if you don't have direct access to the file between machines. | 2 | 8 | 0 | The situation I'm in is this - there's a process that's writing to a file, sometimes the file is rather large say 400 - 500MB. I need to know when it's done writing. How can I determine this? If I look in the directory I'll see it there but it might not be done being written. Plus this needs to be done remotely - as in on the same internal LAN but not on the same computer and typically the process that wants to know when the file writing is done is running on a Linux box with a the process that's writing the file and the file itself on a windows box. No samba isn't an option. xmlrpc communication to a service on that windows box is an option as well as using snmp to check if that's viable.
Ideally
Works on either Linux or Windows - meaning the solution is OS independent.
Works for any type of file.
Good enough:
Works just on windows but can be done through some library or whatever that can be accessed with Python.
Works only for PDF files.
Current best idea is to periodically open the file in question from some process on the windows box and look at the last bytes checking for the PDF end tag and accounting for the eol differences because the file may have been created on Linux or Windows. | Need a way to determine if a file is done being written to | 1 | 0 | 1 | 8,480 |
3,072,934 | 2010-06-18T20:43:00.000 | 0 | 0 | 0 | 1 | python,linux,bonjour,zeroconf,chatbot | 3,072,977 | 2 | false | 0 | 0 | The easiest thing to do is to use Telepathy Salut or Pidgin/libpurple, and talk with it over D-Bus. | 1 | 0 | 0 | I am trying to set up a Bonjour (or Ahavi) chatbot for our helpdesk system that would answer basic questions based on a menu system. The basis of my question is how do I get python to create the bot so that it connects to the network as a chat client.
Basically, anyone on my network with iChat or Empathy (or any chat program able to view users over the local network) should see the bot just as they see another user. The actual bot part would be quite simple to program, but I have no idea how to get it on the network.
I have looked into ZeroConf, but I'm not exactly sure how it works, or how to get a chat service running with python. I have seen references to pybonjour, python bindings for avahi, and pyzeroconf, but again, I have no idea how to set them up.
If anyone could give an example, or reference, or even a good article to read on the subject, it would be much appreciated. Thanks!
Kory | ZeroConf Chat with Python | 0 | 0 | 0 | 1,923 |
3,073,151 | 2010-06-18T21:17:00.000 | 0 | 1 | 0 | 0 | python,pamie | 3,098,190 | 1 | true | 0 | 0 | Browsing the CPamie.py file did the trick. Turns out, I didn't even need the page content - PAMIE's findText method lets you match any string on the page. Works great! | 1 | 0 | 0 | I'm using PAMIE to control IE to automatically browse to a list of URLs. I want to find which URLs return IE's malware warning and which ones don't. I'm new to PAMIE, and PAMIE's documentation is non-existent or cryptic at best. How can I get a page's content from PAMIE so I can work with it in Python? | How do I get the page content from PAMIE? | 1.2 | 0 | 1 | 256 |
3,073,429 | 2010-06-18T22:22:00.000 | 0 | 0 | 1 | 0 | python,software-distribution | 4,171,309 | 3 | false | 0 | 0 | While I also use version control to do this, another approach you might consider is to package up the source using whatever package management your host systems use (for example RPMs or dpkgs), and set up the systems to use a custom repository Then an "apt-get upgrade" or "yum update" will update the software on the systems. Then you could use something like "mussh" to run the stop/update/start commands on all the tools.
Ideally, you'd push it to a "testing" repository first, have your staging systems install it, and once the testing of that was signed off on you could move it to the production repository.
It's very similar to the recommendations of using fabric or version control in general, just another alternative which may suit some people better.
The downside to using packages is that you're probably using version control anyway, and you do have to manage version numbers of these packages. I do this using revision tags within my version control, so I could just as easily do an "svn update" or similar on the destination systems.
In either case, you may need to consider the migration from one version to the next. If a user loads a page that contains references to other elements, you do the update and those elements go away, what do you do? You may wish to do something either within your deployment scripting, or within your code where you first push out a version with the new page, but keep the old referenced elements, deploy that, and then remove the referenced elements and deploy that later.
In this way users won't see broken elements within the page. | 1 | 4 | 0 | I have a directory of python programs, classes and packages that I currently distribute to 5 servers. It seems I'm continually going to be adding more servers and right now I'm just doing a basic rsync over from my local box to the servers.
What would a better approach be for distributing code across n servers?
thanks | What is the best way to distribute code across servers? | 0 | 0 | 0 | 486 |
3,073,572 | 2010-06-18T23:02:00.000 | 0 | 0 | 0 | 0 | python,file-upload,pylons | 3,198,887 | 2 | false | 0 | 0 | It's not the file name that's used as a key in request.params, it's the field name that was used in the HTML: <input type="file" name="fieldname"> | 1 | 0 | 0 | Currently, I'm using request.params["filename"] to access uploaded files.
In Pylons, what is the syntax to access a file if you don't know the filename, something like request.files[0]? | pylons file uploading - access 1st file | 0 | 0 | 0 | 596 |
3,074,103 | 2010-06-19T02:38:00.000 | 0 | 1 | 0 | 0 | php,javascript,python | 3,074,113 | 6 | false | 1 | 0 | Looking at your tags, web games are mostly client side, and since you aren't going to use flash, i would say JavaScript would work for 2D. With all the libraries and plug-ins out there, JavaScript can actually handle it. | 4 | 6 | 0 | I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases.
Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I already have some games ideas. It would be simple 2d plataform games, and I would like to know what is the best way to start.
I don't want to start with Flash. I'm looking for working with other stuff. I already started to look around for the Unity 3D framework and UDK, but I just don't know how to get started.
So, any hints, tips or sugestions to make? | From the web to games | 0 | 0 | 0 | 471 |
3,074,103 | 2010-06-19T02:38:00.000 | 0 | 1 | 0 | 0 | php,javascript,python | 3,074,138 | 6 | false | 1 | 0 | Taking a look at OpenGL may not be a terrible idea. You can use the library in many languages, and is supported with in HTML5 (WebGL). There are several excellent tutorials out there. | 4 | 6 | 0 | I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases.
Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I already have some games ideas. It would be simple 2d plataform games, and I would like to know what is the best way to start.
I don't want to start with Flash. I'm looking for working with other stuff. I already started to look around for the Unity 3D framework and UDK, but I just don't know how to get started.
So, any hints, tips or sugestions to make? | From the web to games | 0 | 0 | 0 | 471 |
3,074,103 | 2010-06-19T02:38:00.000 | 0 | 1 | 0 | 0 | php,javascript,python | 3,074,736 | 6 | false | 1 | 0 | If you want to learn more Python while doing so, you may want to take PyGame or an equivalent program. PHP, Ruby and JavaScript aren't going to help you in the video game section, though. They're all related to the internet.
If you want to start of real easy, try out Genesis3D. you can make awesome 3D FPS games, and its quite easy to get the hang of too. Took me only 5 days :D
Unity made me sick to my stomach, and so did Blender3D's game engine, so I personally say not to use those. It intimidated me. | 4 | 6 | 0 | I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases.
Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I already have some games ideas. It would be simple 2d plataform games, and I would like to know what is the best way to start.
I don't want to start with Flash. I'm looking for working with other stuff. I already started to look around for the Unity 3D framework and UDK, but I just don't know how to get started.
So, any hints, tips or sugestions to make? | From the web to games | 0 | 0 | 0 | 471 |
3,074,103 | 2010-06-19T02:38:00.000 | 3 | 1 | 0 | 0 | php,javascript,python | 3,075,334 | 6 | false | 1 | 0 | Python's Pygame is certainly a good choice as others have said. If you want to get in to deep video game programming though.. move on to something like C++ or another lower level language.. from experience, most higher level languages tend to put artificial hurdles up in regards to decent video games. Though for a simple 2d game you cant go wrong with python.
another decent environment to use is Ogre3d, but you would need C++ or the PyOgre bindings (which are not up to date, but I hear they do work okay).
Going from web to game design really is a decent step, as long as you have a good sense of design. the physics and game logic can be learned, but ive yet to see anyone who could properly learn how to write a decent GUI.. as is seen in most cases these days, the final GUI lay out tends to be a process of elimination or beta with trial and error.
Only suggestion i have left is keep your game logic as far away as possible from your graphics. Be Modular.
-edit-
oh and a note.. stay away from Tkinter in python for anything more than a simple tool.. I have found it most frustrating to use. there is wxPython, GTK, pygame, and PyQT.. and all of them (in my opinion) are far better graphic frameworks. | 4 | 6 | 0 | I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases.
Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I already have some games ideas. It would be simple 2d plataform games, and I would like to know what is the best way to start.
I don't want to start with Flash. I'm looking for working with other stuff. I already started to look around for the Unity 3D framework and UDK, but I just don't know how to get started.
So, any hints, tips or sugestions to make? | From the web to games | 0.099668 | 0 | 0 | 471 |
3,074,175 | 2010-06-19T03:15:00.000 | 0 | 0 | 0 | 0 | python,wxpython,virtual,listctrl,treecontrol | 3,074,866 | 3 | false | 0 | 1 | One thing you might do is leave the sub-nodes empty, and catch the expand-node event. Then you check to see if the node's sub-nodes are populated. If they aren't, you add them before expanding the node. If they are populated, you simply ignore the event. | 3 | 0 | 0 | I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it "virtual", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance. | wxPython: VirtualTreeListCtrl with millions of items | 0 | 0 | 0 | 762 |
3,074,175 | 2010-06-19T03:15:00.000 | 0 | 0 | 0 | 0 | python,wxpython,virtual,listctrl,treecontrol | 3,074,875 | 3 | false | 0 | 1 | You're right that the treemixin doesn't make the TreeListCtrl really virtual. I thought about that when I was developing treemixin, but the one thing I didn't know how to solve was how to know which lines to draw to the left of items when the user is looking at items deep down the tree, e.g. 10000 to 10030. If you know of a solution for that I'll gladly adapt treemixin.
Frank
Author treemixin | 3 | 0 | 0 | I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it "virtual", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance. | wxPython: VirtualTreeListCtrl with millions of items | 0 | 0 | 0 | 762 |
3,074,175 | 2010-06-19T03:15:00.000 | 0 | 0 | 0 | 0 | python,wxpython,virtual,listctrl,treecontrol | 3,087,197 | 3 | false | 0 | 1 | I think what I'll do is use a virtual ListCtrl along with a skip-list for the data model. Initially, the data model will contain the 1 million top-layer nodes. When a node is expanded, I can insert its children into the skip-list in log time (much better than the linear time for an array). I will indent the names of the children in the ListCtrl so that you can visually tell who their parent is. I think the log search time for the skip-list (as opposed to instant random-access time for an array) will be fast enough to handle the user's scrolling. If someone has a better suggestion, please let me know. I will provide an update in the future as to whether my idea worked or not. | 3 | 0 | 0 | I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it "virtual", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance. | wxPython: VirtualTreeListCtrl with millions of items | 0 | 0 | 0 | 762 |
3,076,263 | 2010-06-19T16:27:00.000 | 2 | 0 | 0 | 0 | python,netcat | 3,076,282 | 2 | false | 0 | 0 | Are you sending a "\r\n\r\n" to indicate the end of the request? If you're not, the server's still waiting for the rest of the request. | 1 | 1 | 0 | I am interested in making an HTTP Banner Grabber, but when i connect to a server on port 80 and i send something (e.g. "HEAD / HTTP/1.1") recv doesn't return anything to me like when i do it in let's say netcat..
How would i go about this?
Thanks! | HTTP Banner Grabbing with Python | 0.197375 | 0 | 1 | 2,102 |
3,076,348 | 2010-06-19T16:47:00.000 | 1 | 0 | 1 | 0 | python,pylons | 3,076,407 | 1 | true | 0 | 0 | Do the connections have to belong to a single thread for their lifetime?
If not, you could consider implementing your own connection pool for this resource. The pool would be responsible for initializing connections and each thread would acquire and release the connections as they are needed.
If you want to limit the number of available connections, you just block during the acquire phase until a connection is released or some timeout is reached.
The code to implement such a pool is going to be very dependent on the resource you are talking about, so it would be difficult to give you anything other than a suggested API. | 1 | 1 | 0 | I have a connection to an external resource that I need to make for my Pylons app (think along the lines of a database connection.) There is a modest amount of overhead involved in establishing the connection.
I could setup a piece of middleware that opens and closes the connection with every request but that seems wasteful. I'd like to establish a connection for each new thread that starts up and save myself the overhead. How do I hook into thread startup in Pylons? | Pylons: Proper Way to Establish Per-Thread/Per-Request Resource? | 1.2 | 0 | 0 | 192 |
3,076,365 | 2010-06-19T16:52:00.000 | 2 | 0 | 0 | 0 | python,ajax,django,django-users | 3,076,590 | 4 | false | 1 | 0 | Django messages might seem like a good starting point, but require contortions to get to where you want to go, and I wouldn't trust that future release of Django wouldn't break your hacks.
Implementing your own UserMessage model will probably serve you better in the long run. That gives you complete, unambiguous control over the message lifecycle. It might make a nice reusable app, too. | 2 | 11 | 0 | I'd like to use Django's Messages module, however, I would like my messages to persist until the user clicks an X next to the message as opposed to having messages disappear as soon as the user reloads the page.
I am stumped with two issues:
How do I make the messages' context processor not delete the messages once they are accessed?
How do I later on delete the message from the DB explicitly once the user clicks on the "remove" button (which invokes an ajax call)?
Thanks! | How to make django messages StackOverflow style? | 0.099668 | 0 | 0 | 4,960 |
3,076,365 | 2010-06-19T16:52:00.000 | 8 | 0 | 0 | 0 | python,ajax,django,django-users | 3,084,273 | 4 | true | 1 | 0 | In your case django.contrib.messages won't bring you anywhere good. It's a message system inspired by RoR flash system, where messages aren't supposed to stay around
You should create your own messaging system (django-persistent-messages maybe?) that would save messages for registered users in database.
It's a fairly trivial task to implement
a model with a foreign key on User
a context processor to have the messages available in the templates
a view to consume a message
maybe a helper function to create the messages
Don't forget to make it available to others if you do so =) | 2 | 11 | 0 | I'd like to use Django's Messages module, however, I would like my messages to persist until the user clicks an X next to the message as opposed to having messages disappear as soon as the user reloads the page.
I am stumped with two issues:
How do I make the messages' context processor not delete the messages once they are accessed?
How do I later on delete the message from the DB explicitly once the user clicks on the "remove" button (which invokes an ajax call)?
Thanks! | How to make django messages StackOverflow style? | 1.2 | 0 | 0 | 4,960 |
3,077,010 | 2010-06-19T19:53:00.000 | 0 | 0 | 1 | 0 | python,lxml | 3,077,047 | 2 | true | 0 | 0 | getiterator is the ElementTree standard spelling for this method; iter is an equivalent lxml-only method that will stop your code from working in ElementTree if you need it, and appears to have no redeeming qualities whatsoever except saving you from typing 7 more characters for the method name;-). | 1 | 5 | 0 | As the question says, what would be the difference between:
x.getiterator() and x.iter(), where x is an ElementTree or an Element? Cause it seems to work for both, I have tried it.
If I am wrong somewhere, correct me please. | What is the difference between getiterator() and iter() wrt to lxml | 1.2 | 0 | 1 | 1,970 |
3,077,156 | 2010-06-19T20:38:00.000 | 4 | 0 | 0 | 1 | python,google-app-engine,gql | 3,078,018 | 3 | false | 1 | 0 | An object has a Key, part of which is either an automatically-generated numeric ID, or an assigned key name. IDs are not guaranteed to be increasing, and they're almost never going to be consecutive because they're allocated to an instance in big chunks, and IDs unused by the instance to which they're allocated will never be used by another instance (at least, not currently). They're also only unique within the same entity group for a kind; they're not unique to the entire kind if you have parent relationships. | 2 | 1 | 0 | I currently work with Google's AppEngine and I could not find out, whether a Google DataStorage Object Entry has an ID by default, and if not, how I add such a field and let it increase automatically?
regards, | Does GQL automatically add an "ID" Property | 0.26052 | 1 | 0 | 282 |
3,077,156 | 2010-06-19T20:38:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,gql | 3,077,170 | 3 | true | 1 | 0 | Yes, they have id's by default, and it is named ID as you mentioned. | 2 | 1 | 0 | I currently work with Google's AppEngine and I could not find out, whether a Google DataStorage Object Entry has an ID by default, and if not, how I add such a field and let it increase automatically?
regards, | Does GQL automatically add an "ID" Property | 1.2 | 1 | 0 | 282 |
3,078,189 | 2010-06-20T04:15:00.000 | 2 | 1 | 0 | 0 | java,php,python,email,parsing | 3,078,197 | 3 | false | 0 | 0 | Yes... For each language you pointed out, I've used the one in Python myself. Try perusing the library documentation for your chosen library.
(Note: You may be expecting a "nice", high-level library for this parsing... That's a tricky area, email has evolved and grown without much design, there are a lot of dark corners, and API's reflect that). | 1 | 2 | 0 | Is there a free open-source solution taking raw e-mail message (as a piece of text) and returning each header field, each attachment and the message body as separate fields? | Is there an open-source eMail message (headers, attachments, etc.) parser? | 0.132549 | 0 | 1 | 873 |
3,078,364 | 2010-06-20T05:58:00.000 | 1 | 1 | 0 | 0 | python,lamp | 3,078,415 | 2 | false | 0 | 0 | Language choice is important as you must choose language that you and your team feel the most comfortable with as you must develop mid-large size application. Of course use framework with Python it must be Django, with ASP.NET .NET or MVC.NET whatever you feel better with with Ruby ROR and with PHP there are too large amount of frameworks.
1000 concurrent users is not that much, especially it depends what users will do. Places where users will get large amount of data are better to Cache with with any caching engine you want. You need to design application this what so you can easily swap between real DB calls and calls to cache. For that use Data Objects like for Logins create an Object array of course if you need it. Save some information in cookies when user logins for example his last login, password in case he wants to change it, email and such so you will make less calls to DB in read mode ( select queries ).
use cookie less domain for static content like images, js and css files. setup on this domain the fastest system you can with simplest server you can, probably something based on Linux.
For servers, best advice is to either get large machine and set Virtual Boxes on it with vmware or other Linux based solution or to get few servers which is better because if on big server down you lost everything if one of 1 is down you still can do some stuff. Especially if you set railroad mode. Railroad mode is simple you set up Application server (IIS or Apache) on one server and make it master while you set up SQL on the same server and make it slave. On other server you set up SQL as master and Application server as slave. So server one serves IIS/Apache and Other one SQL, if one down you just need to change line in host.etc in order to set something somewhere else ( i don't know how to do that in Linux ).
last server for static content.
Cloud Computing, you will use if you want it or not. You will share resources with some applications as Google API for jquery and jqueryUI for instance but you create unique application and i don't believe making core of application based on cloud computing will do any good. Use large site's CDNs for good. | 2 | 3 | 0 | Portal Technology Assessment in which we will be creating a placement portal for the campuses and industry to help place students. The portal will handle large volumes of data and people logging in, approximately 1000 users/day in a concurrent mode.
What technology should i use? PHP with CakePHP as a framework, Ruby on Rails, ASP.NET, Python, or should I opt for cloud computing? Which of those are the most cost beneficial? | How to make a cost effective but scalable site? | 0.099668 | 0 | 0 | 182 |
3,078,364 | 2010-06-20T05:58:00.000 | 2 | 1 | 0 | 0 | python,lamp | 3,078,371 | 2 | true | 0 | 0 | Any of those will do, it really depends on what you know. If you're comfortable with Python, use Django. If you like Ruby go with ROR. These modern frameworks are built to scale, assuming you're not going to be developing something on the scale of facebook then they should suffice.
I personally recommend nginx as your main server to host static content and possibly reverse-proxy to Django/mod_wsgi/Apache2.
Another important aspect is caching, make sure to use something like memcached and make sure the framework has some sort of plugin or it's easily attachable. | 2 | 3 | 0 | Portal Technology Assessment in which we will be creating a placement portal for the campuses and industry to help place students. The portal will handle large volumes of data and people logging in, approximately 1000 users/day in a concurrent mode.
What technology should i use? PHP with CakePHP as a framework, Ruby on Rails, ASP.NET, Python, or should I opt for cloud computing? Which of those are the most cost beneficial? | How to make a cost effective but scalable site? | 1.2 | 0 | 0 | 182 |
3,078,487 | 2010-06-20T07:17:00.000 | 2 | 0 | 0 | 0 | python,ssl,openssl,m2crypto | 3,078,518 | 2 | false | 1 | 0 | You will need a SSL cert, and let the web server handle the HTTPS. | 1 | 1 | 0 | I'm looking to create an application in Django which will allow for each client to point their domain to my server. At this point, I would want their domain to be accessed via https protocol and have a valid SSL connection. With OpenSSL, more specifically M2Crypto, can I do this right out the gate? Or, do I still need to purchase an SSL cert? Also, if the former is true (can do without purchase), does this mean I need to have a Python-based web server listening on 443 or does this all somehow still work with NGINX, et al?
Any help is appreciated. | OpenSSL for HTTPS without a certificate | 0.197375 | 0 | 1 | 703 |
3,078,680 | 2010-06-20T08:47:00.000 | 24 | 0 | 1 | 1 | python,c,perl | 3,078,693 | 2 | false | 0 | 0 | Just pass -finstrument-functions to gcc when compiling. See the gcc(1) man page for details. | 1 | 9 | 0 | I have some very large C files, having lots of functions. I need to trace the execution path at run time. There is no way I can trace it through debugging as its a hypervisor code currently running over qemu and doing a lot of binary translations.
Can anyone point me to some script in Perl or Python which can add a printf at the starting of all functions and the text could be something like "I am in < function name >"? | Adding printf to the starting of all functions in a file | 1 | 0 | 0 | 937 |
3,078,704 | 2010-06-20T09:03:00.000 | 0 | 1 | 0 | 0 | python,sockets,proxy | 3,078,730 | 3 | false | 0 | 0 | An IP address corresponds to a device. You can't "connect" to a device in the general sense. You can connect to services on the device identified by ports. So, you find the ip address and port of the proxy server you're interested in and then try connecting to it using a simple socket.connect. If it connects fine, you can alteast be sure that something is running on that port of that ip address. Then you go ahead and use it and if things are not as you expect, you can make further decisions. | 2 | 2 | 0 | How can I check if a specific ip address or proxy is alive or dead | how to check if an ip address or proxy is working or not | 0 | 0 | 1 | 4,148 |
3,078,704 | 2010-06-20T09:03:00.000 | 3 | 1 | 0 | 0 | python,sockets,proxy | 3,078,719 | 3 | true | 0 | 0 | Because there may be any level of filtering or translation between you and the remote host, the only way to determine whether you can connect to a specific host is to actually try to connect. If the connection succeeds, then you can, else you can't.
Pinging isn't sufficient because ICMP ECHO requests may be blocked yet TCP connections might go through fine. | 2 | 2 | 0 | How can I check if a specific ip address or proxy is alive or dead | how to check if an ip address or proxy is working or not | 1.2 | 0 | 1 | 4,148 |
3,079,344 | 2010-06-20T13:16:00.000 | 17 | 1 | 1 | 0 | python,scons | 3,083,882 | 2 | true | 0 | 0 | You can modify the scons Environment() by just choosing
the version you want:
env = Environment(MSVC_VERSION=<someversion>)
From the scons manpage:
MSVC_VERSION Sets the preferred
version of Microsoft Visual C/C++ to
use.
If $MSVC_VERSION is not set, SCons
will (by default) select the latest
version of Visual C/C++ installed on
your system. If the specified version
isn't installed, tool initialization
will fail. This variable must be
passed as an argument to the
Environment() constructor; setting it
later has no effect. Set it to an
unexpected value (e.g. "XXX") to see
the valid values on your system. | 1 | 9 | 0 | I have a C++ project which is using boost. The whole project is built using scons + Visual Studio 2008. We've installed Visual Studio 2010 and it turned out scons was attempting to use the later compiler instead of the old one - and failed to build the project as boost and visual studio 2010 don't like each other very much - yet. We'd like to suppress this and force scons to use the 2008 version. Is this possible? How do we do this? | Forcing scons to use older compiler? | 1.2 | 0 | 0 | 2,641 |
3,079,368 | 2010-06-20T13:24:00.000 | 0 | 0 | 0 | 0 | python,ruby,django,haml | 3,144,408 | 4 | false | 1 | 0 | While this could end up being more trouble than it is worth, it is PROBABLY possible to leverage the Java or .NET platform and still run your Django application in Jython or IronPython (with some minor adjustments I'm sure) and also be able to leverage Ruby's HAML gem via jRuby or IronRuby.
I'm sure there will be some quirks in getting this to work, but I'm sure it would be possible.
Again, this is probably a lot more trouble than it's worth (considering that you'd have to move your application to a completely new platform), but it would be a pretty fun project to work on. | 2 | 19 | 0 | Ok, so I really love HAML. Particularly, I love the integration with RedCloth and BlueCloth, so I can use Markdown and Textile intermixed with my HAML.
I also love Python and Django.
So, I would like to use HAML with Django. Now, I already understand that there are some attempts at cloning HAML-like syntax in Python (SHPAML and others). I've tried these, and while they aren't bad, I've found that I really just want the real HAML. Partially for its syntax, but also for things like RedCloth and BlueCloth.
So, my question is, how to make HAML and Django work together?
One solution, I think, would be to create HAML templates, and then compile them into HTML using the command line tool every time they're updated.
Quesiton 1: Will I run into any problems here?
I also wonder if there's a way to get Python and Ruby to play together a little more. One idea I had was actually forking out Ruby processes. This is probably a bad idea, but anyone have any thoughts about this?
Question 2: What about using Python to call the real Ruby HAML?
Finally, if anyone knows of a Python implementation of HAML that is complete, and that supports either Textile or Markdown, as well as plaintext passthru, then let me know.
Question 3: Is there a full translation of HAML to Python including Markdown or Textile support?
Thanks! | Ruby HAML with Django? | 0 | 0 | 0 | 3,831 |
3,079,368 | 2010-06-20T13:24:00.000 | 1 | 0 | 0 | 0 | python,ruby,django,haml | 7,147,104 | 4 | false | 1 | 0 | I strongly recommend that you do not fork any processes out of your django views, because the overhead is significant.
You should have a persistent ruby process to serve your templates for you, and invoke it from your django code. I leave the IPC technology to you, but the obvious choices would either be some kind of message queuing technology, or speaking HTTP over a socket to the ruby process. | 2 | 19 | 0 | Ok, so I really love HAML. Particularly, I love the integration with RedCloth and BlueCloth, so I can use Markdown and Textile intermixed with my HAML.
I also love Python and Django.
So, I would like to use HAML with Django. Now, I already understand that there are some attempts at cloning HAML-like syntax in Python (SHPAML and others). I've tried these, and while they aren't bad, I've found that I really just want the real HAML. Partially for its syntax, but also for things like RedCloth and BlueCloth.
So, my question is, how to make HAML and Django work together?
One solution, I think, would be to create HAML templates, and then compile them into HTML using the command line tool every time they're updated.
Quesiton 1: Will I run into any problems here?
I also wonder if there's a way to get Python and Ruby to play together a little more. One idea I had was actually forking out Ruby processes. This is probably a bad idea, but anyone have any thoughts about this?
Question 2: What about using Python to call the real Ruby HAML?
Finally, if anyone knows of a Python implementation of HAML that is complete, and that supports either Textile or Markdown, as well as plaintext passthru, then let me know.
Question 3: Is there a full translation of HAML to Python including Markdown or Textile support?
Thanks! | Ruby HAML with Django? | 0.049958 | 0 | 0 | 3,831 |
3,079,409 | 2010-06-20T13:36:00.000 | 0 | 0 | 0 | 0 | python,image,wxpython,image-manipulation | 11,616,749 | 2 | false | 0 | 1 | You could always use PIL, it has a function to do this. Save the image in memory and convert it into an wx.Bitmap. | 1 | 1 | 0 | I have one wx.emptybitmap (1) and one wx.bitmap (2). I want to merge(join) them..
I want to create a single wx.bitmap that consists on the wx.emptybitmap (1) on the top and wx.bitmap (2) on the bottom.
How can I do that?
Thanks in advance! :D | How to merge (join) two wx.bitmap using wxpython? | 0 | 0 | 0 | 1,043 |
3,079,531 | 2010-06-20T14:15:00.000 | 8 | 1 | 0 | 0 | python,ruby | 3,079,547 | 4 | true | 1 | 0 | If you develop for the .NET Framework Version 4.0, you can write code in IronRuby that calls methods that were written in IronPython and vice versa. | 1 | 8 | 0 | Is there something like JRuby but for Ruby and Python?
Not that it would actually be useful to me, but just wondering. | Can I use Ruby and Python together? | 1.2 | 0 | 0 | 662 |
3,080,019 | 2010-06-20T16:40:00.000 | 0 | 0 | 1 | 1 | python,macos | 3,081,478 | 4 | false | 0 | 0 | FWIW, mod_wsgi is developed on MacOS X. My experience in supporting users of mod_wsgi is however that MacPorts and fink are an absolute PITA. Specifically, trying to use Python and Apache from those third party systems usually causes nothing but hurt. This is based on problems encountered over the last couple of years. I haven't heard much lately though, so it may be the case that those systems have finally fixed up their 32/64 bit issues and Python build problems. | 3 | 3 | 0 | I am programming a django based website. I actually use a small computer under Ubuntu 10.04.
I would like to buy something more professional, so I am wondering whether an iMac is good for that, because :
Is there a free IDE as good as eclipse on MacOS ?
Is there a remote python debugger like pydev for eclipse ?
Is there some typical issues with python on MacOS ?
does apache+mod_wsgi works well on MacOS ? | is mac good for python programming? | 0 | 0 | 0 | 3,465 |
3,080,019 | 2010-06-20T16:40:00.000 | 5 | 0 | 1 | 1 | python,macos | 3,080,040 | 4 | false | 0 | 0 | All of the things you mentioned (Eclipse+plugins, Python, Apache, mod_wsgi) can run fine on OS X. | 3 | 3 | 0 | I am programming a django based website. I actually use a small computer under Ubuntu 10.04.
I would like to buy something more professional, so I am wondering whether an iMac is good for that, because :
Is there a free IDE as good as eclipse on MacOS ?
Is there a remote python debugger like pydev for eclipse ?
Is there some typical issues with python on MacOS ?
does apache+mod_wsgi works well on MacOS ? | is mac good for python programming? | 0.244919 | 0 | 0 | 3,465 |
3,080,019 | 2010-06-20T16:40:00.000 | 6 | 0 | 1 | 1 | python,macos | 3,080,121 | 4 | true | 0 | 0 | Why do you consider iMac to be more or less professional than anything else? Hardware? System?
Note: I'm myself a MacOSX and Linux user.
Unless it's a requisite, most times I'd say it's only a matter of personal taste.
As said by others earlier, everything you cited works fine on MacOSX.
However, you should consider the 3rd party libraries you're going to use with Python.
I would cite a problem I had with MySQLdb (MySQL-python) on MacOSX, but it has been solved. You might face other problems in the way, but nothing that could stop you from using Django, Eclipse, etc. | 3 | 3 | 0 | I am programming a django based website. I actually use a small computer under Ubuntu 10.04.
I would like to buy something more professional, so I am wondering whether an iMac is good for that, because :
Is there a free IDE as good as eclipse on MacOS ?
Is there a remote python debugger like pydev for eclipse ?
Is there some typical issues with python on MacOS ?
does apache+mod_wsgi works well on MacOS ? | is mac good for python programming? | 1.2 | 0 | 0 | 3,465 |
3,080,185 | 2010-06-20T17:19:00.000 | 0 | 1 | 1 | 0 | c++,boost,boost-python | 3,139,385 | 2 | false | 0 | 0 | I don't know well shared library, but what works for me is to import all my modules, which can reference with each others, within python: import libA; import libB.
It is of course possible to put these imports in an __init__.py file, so that whitin python you just have to do: import myLib. | 1 | 5 | 0 | I have wondered about this on and off but I never really got a definite answer. Is it possible within the boost.python framework to link against another boost.python module.
For example I have exported class A within boost_python_module(libA) and function B(A a) within boost_python_module(libB). Is it possible to specify in libB to link to A of libA.
The other way of looking at this problem would be that right now I have to generate all my bindings in one shot within one module. Is it possible to generate bindings incrementally over several boost_python_module. | How to link to existing boost python module | 0 | 0 | 0 | 1,552 |
3,080,563 | 2010-06-20T19:05:00.000 | 2 | 0 | 0 | 1 | python | 38,031,055 | 2 | false | 0 | 0 | Other options to exit the help screen would be to type any one of the following(as described in the help section)
q,:q,Q,:Q and ZZ
.These can be seen when you press 'h' once you are on the help screen | 1 | 44 | 0 | when the help window pops up, what are the basic commands (mac os) to page up/down, end of document and exiting the help screen?
I just had to close my terminal as I couldn't figure it out! | How to exit when viewing python help like help(os.listdir) | 0.197375 | 0 | 0 | 40,312 |
3,080,918 | 2010-06-20T20:58:00.000 | 12 | 0 | 1 | 0 | python,python-3.x,tkinter | 3,081,089 | 4 | false | 0 | 1 | Tkinter in python 2.6 is capitalized, in python 3 it is lowercase, tkinter | 1 | 18 | 0 | When I type from Tkinter import ttk it says that there is no module named ttk, and also on many websites online the t in tkinter is always lowercase, but when I type tkinter in Python it throws an error. Why is that? | Why can't I use ttk in Python? | 1 | 0 | 0 | 54,493 |
3,081,412 | 2010-06-20T23:58:00.000 | 1 | 0 | 0 | 0 | python | 3,081,567 | 3 | false | 1 | 0 | +1 for a good question.
Web development is not much different to any other development.
P.20 of that venerable classic breaks a typical project down into 1/3 planning, 1/6 coding, 1/4 component test and 1/4 system test. I might catch some flak for that, YMMV and all, but that looks about right to me.
Whether or not you agree with the proportions, the message is "don't jump right in and code; think about it first (measure twice, cut once). How often have you jumped in and coded only to get near to "then end" and discover that you have a fundamental design flaw and have to through away much of your code & rewrite chunks more?
You need methodologies (Processes) and Tools, and each can necessitate the other.
Methodologies
Design it first! Gather requirements, make a system level design document then detailed design. If you are more than one, have these reviewed by someone (client can maybe review the high level docs?). If if you are alone, the simple act of writing it down forces you to slow down and think and will uncover problems. A good idea is to have a requirements traceability matrix to ensure that each requirement gets designed, implemented and tested somewhere.
After you review the high level design, you can being the detailed design, and after you review that, you can begin to implement. When the high level design is reviewed you can, in parallel, or later, produce a high level test spec. When the detailed level design is reviewed you can, in parallel, or later, produce unit test specs.
Note that test cases should be automated and should require no human interaction. Get into the habit of running regression tests after every code change - automate this if you can, with nightly build and or coupled with check-in to your version control system.
When everything is thoroughly unit tested, you can begin your system level testing.
Tools
At the very least you ought to be considering these:
A good IDE (WYSIWYG for web design), preferably with debugging capabilities, and it would be nice if it interfaced with your version control system, bug tracker, etc. A spill chuker is useful for websites ;-)
A project management tool to plan the project (Open Workbench does some nice Gantt charts)
A version control system.
A change request and bug tracker.
An automated test system.
An automated build system like Hudson (it may not seem relevant if you don't compile and link, but at least it can verify that all files exist and can schedule regression testing for you)
A backup system in case of disk crash, laptop loss, etc.
And if all that seems like too much "extra" to do, I was sceptical too once, until I saw that it actually saves time because you discover problems earlier when they cost less to fix. In fact, I am so sure of this that I do all of my personal one-man hobby projects this way. All of them. | 2 | 5 | 0 | Note: I use TRAC integrated with SVN, framework testing tools, an excellent mixture of staging servers, development servers, and other tools to speed development and keep track of tasks.
I am asking about the specific process of design, and even more specifically, the design of functionality and flow in a web application.
--- Original question ---
So far I spend a lot of time with my text editor open basically talking to myself, then coding for a while, then talking to myself again. When there is more than just me we do some whiteboarding, but that's about it.
What do you find works well, specifically for projects for very small teams or one-developer shows.
BTW I usually develop with Django, this last project also involves RabbitMQ and Orbited, plus a fair chunk of jquery-assisted JavaScript. | What methods and tools do you use to design and analyze the workflow in a web application (for a tiny team) | 0.066568 | 0 | 0 | 141 |
3,081,412 | 2010-06-20T23:58:00.000 | 1 | 0 | 0 | 0 | python | 3,097,921 | 3 | true | 1 | 0 | Pencils!
Seriously, we use JIRA to track work/issue, Confluence to track requirements before they're baked enough to put in JIRA.. Anything to scratch together wire-frames, etc. (Including OmniGraffle, and Pencils).
I find the combination of JIRA and Confluence for tracking chunks of work and longer-lived concepts and standards pretty darned effective. | 2 | 5 | 0 | Note: I use TRAC integrated with SVN, framework testing tools, an excellent mixture of staging servers, development servers, and other tools to speed development and keep track of tasks.
I am asking about the specific process of design, and even more specifically, the design of functionality and flow in a web application.
--- Original question ---
So far I spend a lot of time with my text editor open basically talking to myself, then coding for a while, then talking to myself again. When there is more than just me we do some whiteboarding, but that's about it.
What do you find works well, specifically for projects for very small teams or one-developer shows.
BTW I usually develop with Django, this last project also involves RabbitMQ and Orbited, plus a fair chunk of jquery-assisted JavaScript. | What methods and tools do you use to design and analyze the workflow in a web application (for a tiny team) | 1.2 | 0 | 0 | 141 |
3,081,500 | 2010-06-21T00:25:00.000 | 0 | 0 | 1 | 0 | python | 3,081,579 | 4 | false | 0 | 0 | I'm a bit late to the party, but also check out the namedtuple function in the collections module. It lets you access fields of a tuple as if they were named members of a class, and it's nice when all you want is a C-style "structure". Of course, tuples are immutable so you'd probably have to rearrange your existing code quite a bit; perhaps not the best thing for this example, but maybe keep it in mind in the future. | 1 | 2 | 0 | This is a silly question, but I can't figure it out so I had to ask.
I'm editing some Python code and to avoid getting too complicated, I need to be able to define a new variable along the lines of : Car.store = False.
Variable Car has not been defined in this situation. I know I can do dicts (Car['store'] = False) etc... but it has to be in the format above.
Appreciate any help
Thanks. | using 'variable.xyz' format in Python | 0 | 0 | 0 | 372 |
3,081,661 | 2010-06-21T01:27:00.000 | -2 | 1 | 1 | 0 | ironpython | 3,082,237 | 4 | false | 0 | 1 | Based on my understanding both languages will be compiled into MSIL so theoretically the performance of the application should be identical or very close, but there is a lot more to it, the human factor.
I can assure you that a program I write in C# could be a lot faster that the same program in iron-python not because C# is faster but because I'm more familiar with C# and I know what choices to make, so if your team is more familiar with C# your application has a better chance at performance if it is written in C# or the other way around.
This is just a personal theory so take it with a grain of salt. | 1 | 7 | 0 | Am trying to provide a response from a Managers perspective to the question: What overall performance penalty will we incur if we write the application in IronPython instead of C#?
This question is directed at those who might have already undertaken some testing, benchmarking or have completed a migration from C# to IronPython, in order to quantify the penalty. | Speed of code execution: IronPython vs C#? | -0.099668 | 0 | 0 | 8,794 |
3,081,749 | 2010-06-21T02:05:00.000 | 0 | 0 | 0 | 0 | python,tkinter | 3,084,235 | 1 | false | 0 | 0 | Every object in a canvas has an id. You can reference that object by that id to delete it, modify it, move it, etc.
Objects can also have one or more tags. A tag can be associated with a single object, in which case it is just another name for that object. For example, if you draw a red rectangle and a blue rectangle, you can give the first one the tag "red_rect" and the second "blue_rect". Then, anywhere you might need the id you could instead use the tag.
One tag can be associated with more than a single item. So, for example, in addition to the "red_rect" and "blue_rect" tags, you could also give each item a "rect" tag. Then, when you use "rect" where you might use an id (such as to move the object), this will affect all objects with the tag. In this way you can move, configure or delete whole groups of items at a time.
You can use tags to implement such common features as letting the user name objects that they draw interactively, or to logically group multiple objects into a single composite object. | 1 | 1 | 0 | i tried to figure out what tags were in canvas however i am having a hard time understanding it. can someone explain what tags do and how to use them in canvas when using python. | can someone help me with tags in canvas? | 0 | 0 | 0 | 186 |
3,082,107 | 2010-06-21T04:25:00.000 | 1 | 1 | 0 | 0 | python,mercurial,bitbucket | 3,082,132 | 3 | false | 0 | 0 | If you don't have mercurial available locally then you may as well pull the tarball instead, available behind the "get source" option towards the top-right corner of various pages, underneath "Forks/Queues". | 1 | 3 | 0 | I was wondering if it was possible to pull a private mercurial repo to a server without access to hg. I have SSH access, but do not have the ability to install HG. I was thinking some kind of Python script that used http access or something, but I wasn't sure. I was also thinking this might only be possible with public repos. I am currently hosting the projet on BitBucket. Thanks for any input! | How to pull a BitBucket repository without access to hg | 0.066568 | 0 | 0 | 3,457 |
3,082,502 | 2010-06-21T06:25:00.000 | 0 | 0 | 0 | 0 | python,pyqt,document | 3,082,556 | 5 | false | 1 | 0 | Creating XML documents, transforming them to XSL/fo and rendering with Fop or RenderX. If you use docbook as the primary input, there are toolchains freely available for converting that to PDF, RTF, HTML and so forth.
It is rather quirky to use and not my idea of fun, but is does deliver and can be embedded in an application, AFAICT.
Creating docbook is very straightforward as it has a wide range of semantic tags, table support etc to give a "meaningful" markup which can be reliably formatted. The XSL stylesheets are modular and allow parts to be customized or replaced to generate your own look and feel.
It works well for relatively free flow documents with lots of text.
For filling in the blanks kind of documents, a regular reporting engine may be a better fit, or some straighforward XSL stylesheets spitting out the XSL-fo directly. | 1 | 3 | 0 | I'm writing a program that requires input in the form of a document, it needs to replace a few values, insert a table, and convert it to PDF. It's written in Python + Qt (PyQt). Is there any well known document standard which can be easily used programmatically? It must be cross platform, and preferably open.
I have looked into Microsoft Doc and Docx, which are binary formats and I can't edit them. Python has bindings for it, but they're only on Windows.
Open Office's ODT/ODF is zipped in an xml file, so I can edit that one but there's no command line utilities or any way to programmatically convert the file to a PDF. Open Office provides bindings, but you need to run Open Office from the command line, start a server, etc. And my clients may not have Open Office installed.
RTF is readable from Python, but I couldn't find any way/libraries to convert RTF documents to PDF.
At the moment I'm exporting from Microsoft Word to HTML, replacing the values and using PyQt to convert it to a PDF. However it loses formatting features and looks awful. I'm surprised there isn't a well known library which lets you edit a variety of document formats and convert them into other formats, am I missing something?
Update: Thanks for the advice, I'll have a look at using Latex.
Thanks,
Jackson | What's a good document standard to use programmatically? | 0 | 0 | 0 | 581 |
3,083,167 | 2010-06-21T08:47:00.000 | 0 | 1 | 1 | 0 | c#,python,cpython | 3,083,261 | 1 | true | 0 | 1 | If you need strict CPython behavior and do not want to change Python program I am afraid that in this case you should spawn separate CPython process and interact with it via some RPC protocol (there are plenty to choose from) via pipe or network connection to localhost.
As alternative to "serialized" RPC you might use system's facilities e.g. COM if you're on Windows or D-Bus on Linux - but this would make code platform dependent and not necessarily simpler. | 1 | 0 | 0 | If it doesn't use ironpython, how C# use cpython program(py file)?
Because there are some bugs that ironpython load cpython code. | How C# use python program? | 1.2 | 0 | 0 | 189 |
3,083,366 | 2010-06-21T09:16:00.000 | 1 | 0 | 0 | 0 | python,django,aes,pycrypto | 3,085,685 | 1 | false | 1 | 0 | You'll need to build pycrypto before you upload it. This will need to be done on a machine with as similar an environment to your server as possible.
To build, run python setup.py build from inside the pycrypto-2.1.0 directory. This will create build\lib.win32-2.6\Crypto (the name of the libxxx directory might be a little different).
FTP the Crypto folder to somewhere on your server's python path. Inside the Django project folder may or may not work. A safe bet is to put it right in your site-packages folder, if you have access to it.
I don't know much about deploying on Windows, but usually you need to restart the server to reload the application whenever you make any changes. Hopefully that's what you meant by 'code refresh' | 1 | 0 | 0 | I'm using Django in order to serve a web service. I have only access to FTP and code refresh at the moment. No access to command-line or executing any kind of executable.
I am using a Windows Server 2005 machine.
Would I be able to use Crypto just by placing the folder within my Django project?
Are there any good alternatives if not?
Help would be amazing guys!!! | Using Crypto by placing folder in python path? - Python | 0.197375 | 0 | 0 | 317 |
3,083,784 | 2010-06-21T10:17:00.000 | 0 | 0 | 0 | 0 | python,tags,visualization,keyword | 3,250,807 | 1 | false | 1 | 0 | What you have is a rough 1st order approximation. I think if you then go back through the data and search for frequency of 2-word phrases, then 3 word phrases, up till the total number of words that can be considered a tag, you'll get a better representation of keyword frequency.
You can refine this rough search pattern by specifying certain words that can be contained as part of a phrase (pronouns ect). | 1 | 1 | 0 | I have to build a tag cloud out of a webpage/feed. Once you get the word frequency table of tags, it's easy to build the tagcloud. But my doubt is how do I retrieve the tags/keywords from the webpage/feed?
This is what I'm doing now:
Get the content -> strip HTML -> split them with \s\n\t(space,newline,tab) -> Keyword list
But this does not work great.
Is there a better way? | How do I get tags/keywords from a webpage/feed? | 0 | 0 | 1 | 226 |
3,084,303 | 2010-06-21T11:41:00.000 | -1 | 1 | 0 | 0 | php,python | 69,296,576 | 5 | false | 0 | 0 | Better you have to do, use api, different application like one application on python server having python application and one server having php application with api. Like you store or delete data by using api in android or ios. | 1 | 14 | 0 | I have a VPS Linux webserver with PHP installed.
I want to code some search engine or data mining stuff in one application which I am thinking of building in python.
I want to know if it is possible to use python and php together like calling functions of python in php and vice versa.
As it is my VPS server, I can install anything on that.
Has anyone tried using python in php? Are there any performance issues in real time?? | Is it possible to use Python with php | -0.039979 | 0 | 0 | 31,647 |
3,084,627 | 2010-06-21T12:34:00.000 | 1 | 0 | 0 | 0 | python,lxml | 3,084,858 | 1 | true | 0 | 0 | XPath is usually preferable to an explicit iteration over elements. XPath is more succinct, and will likely be faster since it is implemented inside the XML engine.
You'd want to use an explicit iteration if there were complex criteria that couldn't be expressed easily (or at all) in XPath, or if you needed to visit all the nodes for some other processing anyway, or if you wanted to get rich debugging output. | 1 | 1 | 0 | This follows my previous questions on using lxml and Python.
I have a question, as to when I have a choice between using the methods provided by the lxml.etree and where I can make use of XPath, what should I use?
For example, to get a list of all the X tags in a XML document, I could either iterate through it using the getiterator() of lxml.etree, or I could write the XPath expression: //x.
There may be many more examples, this is just one. Question is, which should when I have a choose and why? | Confused about using XPath or not | 1.2 | 0 | 1 | 96 |
3,084,850 | 2010-06-21T13:01:00.000 | 1 | 0 | 0 | 0 | python,selenium | 3,103,295 | 3 | false | 1 | 0 | as far as I know you have to use always in alerts
selenium.get_confirmation()
from python doc:
If an confirmation is generated but you do not consume it with getConfirmation, the next Selenium action will fail. | 1 | 2 | 0 | I'm working with selenium.
while trying to click a button it creates a pop up (alert) and doesn’t return a page object.
Because of that I can’t use “click” alone as this method expects a page object and eventually fails because of a timeout.
I can use the “chooseOkOnNextConfirmation()” but this will click the pop up and i also want to verify that the pop up actually appeared.
Is there any method that will click and verify this alert? | How to click and verify the existence of a pop up (alert) | 0.066568 | 0 | 1 | 3,169 |
3,085,029 | 2010-06-21T13:26:00.000 | 6 | 0 | 0 | 0 | python,json,xml,google-app-engine,configuration-files | 3,086,515 | 4 | false | 1 | 0 | Note, this is pure opinion and speculation on my part but I suspect that the single biggest reason for the plethora of formats is likely due to the lack of a readily available, omnipresent configuration file parsing library. Lacking that, most programs have to write their own parsers so it would often come down to balance between how complex the configuration structure needs to be (hierarchical vs flat, purely data vs embedded logic like if statements, etc), how much effort the developers were willing to spend on writing a configuration file parser, and how much of a pain it should be for the end user. However, probably every reason you've listed and could think has likely been the motivation for a project or two in choosing their format.
For my own projects I tend to use .ini simply because there's an excellent parser already built in to Python and it's been "good enough" for most of my use cases. In the couple of cases it's been insufficient, I've used an XML based configuration file due, again, to the relative simplicity of implementation. | 4 | 52 | 0 | I've seen people using *.cfg (Python Buildout), *.xml (Gnome), *.json (Chrome extension), *.yaml (Google App Engine), *.ini and even *.py for app configuration files (like Django).
My question is: why there are so many different configuration file formats? I can see an advantage from a xml vs json approach (much less verbose) or a Python one (sometimes you have a Python app and don't want to use a specific module just to parse a config file), but what about the other approaches?
I know there are even more formats than those configuration files I exemplified. What are really their advantages in comparison to each other? Historical reasons? Compatibility with different systems?
If you would start an application to read some kind of configuration files (with a plugin ecosystem), which one would you use?
Which ones that I gave as example are the oldest ones? Do you know it's history? | Pros and cons for different configuration formats? | 1 | 0 | 0 | 21,947 |
3,085,029 | 2010-06-21T13:26:00.000 | 32 | 0 | 0 | 0 | python,json,xml,google-app-engine,configuration-files | 3,086,617 | 4 | true | 1 | 0 | It's mostly personal preference, purpose, and available libraries. Personally I think xml is way too verbose for config files, but it is popular and has great libraries.
.cfg, .ini are legacy formats that work well and many languages have an included library that reads them. I've used it in Java, Python, C++ without issues. It doesn't really work as a data interchange format and if I am passing data I will probably use the same format for config and data interchange.
yaml, and json are between xml and cfg/ini. You can define many data structures in both, or it can be a simple key-value like with cfg. Both of these formats have great libraries in python and I'm assuming many other languages have libraries as well. I believe json is subset of yaml.
I've never used a python file as config, but it does seem to work well for django. It does allow you to have some code in the config which might be useful.
Last time I was choosing a format I chose yaml. It's simple but has some nice features, and the python library was easy to install and really good. Json was a close second and since the yaml library parsed json I chose yaml over it. | 4 | 52 | 0 | I've seen people using *.cfg (Python Buildout), *.xml (Gnome), *.json (Chrome extension), *.yaml (Google App Engine), *.ini and even *.py for app configuration files (like Django).
My question is: why there are so many different configuration file formats? I can see an advantage from a xml vs json approach (much less verbose) or a Python one (sometimes you have a Python app and don't want to use a specific module just to parse a config file), but what about the other approaches?
I know there are even more formats than those configuration files I exemplified. What are really their advantages in comparison to each other? Historical reasons? Compatibility with different systems?
If you would start an application to read some kind of configuration files (with a plugin ecosystem), which one would you use?
Which ones that I gave as example are the oldest ones? Do you know it's history? | Pros and cons for different configuration formats? | 1.2 | 0 | 0 | 21,947 |
3,085,029 | 2010-06-21T13:26:00.000 | 1 | 0 | 0 | 0 | python,json,xml,google-app-engine,configuration-files | 59,535,927 | 4 | false | 1 | 0 | It really depends on whether the reader/writer of the configuration file is, or can be, a non-programmer human or if it has strictly programmatic access.
XML, JSON, etc., are totally unsuitable for human consumption, while the INI format is half-way reasonable for humans.
If the configuration file has only programmatic access (with occasional editing by a programmer), then any of the supported formats (XML, JSON, or INI) are suitable. The INI file is not suitable for structured parameters, where XML and JSON can support arrays, structs/objects, etc. | 4 | 52 | 0 | I've seen people using *.cfg (Python Buildout), *.xml (Gnome), *.json (Chrome extension), *.yaml (Google App Engine), *.ini and even *.py for app configuration files (like Django).
My question is: why there are so many different configuration file formats? I can see an advantage from a xml vs json approach (much less verbose) or a Python one (sometimes you have a Python app and don't want to use a specific module just to parse a config file), but what about the other approaches?
I know there are even more formats than those configuration files I exemplified. What are really their advantages in comparison to each other? Historical reasons? Compatibility with different systems?
If you would start an application to read some kind of configuration files (with a plugin ecosystem), which one would you use?
Which ones that I gave as example are the oldest ones? Do you know it's history? | Pros and cons for different configuration formats? | 0.049958 | 0 | 0 | 21,947 |
3,085,029 | 2010-06-21T13:26:00.000 | 0 | 0 | 0 | 0 | python,json,xml,google-app-engine,configuration-files | 62,036,718 | 4 | false | 1 | 0 | According to Python official docs, 'future enhancements to configuration functionality will
be added to dictConfig()'.
So any config file which can be used with dictconfig() should be fine. | 4 | 52 | 0 | I've seen people using *.cfg (Python Buildout), *.xml (Gnome), *.json (Chrome extension), *.yaml (Google App Engine), *.ini and even *.py for app configuration files (like Django).
My question is: why there are so many different configuration file formats? I can see an advantage from a xml vs json approach (much less verbose) or a Python one (sometimes you have a Python app and don't want to use a specific module just to parse a config file), but what about the other approaches?
I know there are even more formats than those configuration files I exemplified. What are really their advantages in comparison to each other? Historical reasons? Compatibility with different systems?
If you would start an application to read some kind of configuration files (with a plugin ecosystem), which one would you use?
Which ones that I gave as example are the oldest ones? Do you know it's history? | Pros and cons for different configuration formats? | 0 | 0 | 0 | 21,947 |
3,086,467 | 2010-06-21T16:29:00.000 | 17 | 0 | 1 | 0 | java,python,ruby,multithreading | 3,088,843 | 13 | false | 1 | 0 | A confused question with a lot of confused answers...
First, threading and concurrent execution are different things. Python supports threads just fine; it doesn't support concurrent execution in any real-world implementation. (In all serious implementations, only one VM thread can execute at a time; the many attempts to decouple VM threads have all failed.)
Second, this is irrelevant for web apps. You don't need Python backends to execute concurrently in the same process. You spawn separate processes for each backend, which can then each handle requests in parallel because they're not tied together at all.
Using threads for web backends is a bad idea. Why introduce the perils of threading--locking, race conditions, deadlocks--to something inherently embarrassingly parallel? It's much safer to tuck each backend away in its own isolated process, avoiding the potential for all of these problems.
(There are advantages to sharing memory space--it saves memory, by sharing static code--but that can be solved without threads.) | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 1 | 0 | 0 | 37,252 |
3,086,467 | 2010-06-21T16:29:00.000 | 6 | 0 | 1 | 0 | java,python,ruby,multithreading | 3,086,520 | 13 | false | 1 | 0 | Certainly the webserver will have a pool of threads. That's only outside the control of your program. Those threads are used to handle HTTP requests. Each HTTP request is handled in a separate thread and the thread is released back to pool when the associated HTTP response is finished. If the webserver doesn't have such a pool, it would have been extremely slow in serving.
Whether a programming language is singlethreaded or multithreaded dependens on the possibility to programmatically spawn new threads using the language in question. If that isn't possible, then the language is singlethreaded, for example PHP. As far as I can see, both Ruby and Python supports multithreading. | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 1 | 0 | 0 | 37,252 |
3,086,467 | 2010-06-21T16:29:00.000 | 60 | 0 | 1 | 0 | java,python,ruby,multithreading | 3,086,582 | 13 | true | 1 | 0 | Both Python and Ruby have full support for multi-threading. There are some implementations (e.g. CPython, MRI, YARV) which cannot actually run threads in parallel, but that's a limitation of those specific implementations, not the language. This is similar to Java, where there are also some implementations which cannot run threads in parallel, but that doesn't mean that Java is single-threaded.
Note that in both cases there are lots of implementations which can run threads in parallel: PyPy, IronPython, Jython, IronRuby and JRuby are only few of the examples.
The main difference between Clojure on the one side and Python, Ruby, Java, C#, C++, C, PHP and pretty much every other mainstream and not-so-mainstream language on the other side is that Clojure has a sane concurrency model. All the other languages use threads, which we have known to be a bad concurrency model for at least 40 years. Clojure OTOH has a sane update model which allows it to not only present one but actually multiple sane concurrency models to the programmer: atomic updates, software transactional memory, asynchronous agents, concurrency-aware thread-local global variables, futures, promises, dataflow concurrency and in the future possibly even more. | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 1.2 | 0 | 0 | 37,252 |
3,086,467 | 2010-06-21T16:29:00.000 | 4 | 0 | 1 | 0 | java,python,ruby,multithreading | 3,086,550 | 13 | false | 1 | 0 | Most languages don't define single or multithreading. Usually, that is left up to the libraries to implement.
That being said, some languages are better at it than others. CPython, for instance, has issues with interpreter locking during multithreading, Jython (python running on the JVM) does not.
Some of the real power of Clojure (IMO) is that it runs on the JVM. You get multithreading and tons of libraries for free. | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 0.061461 | 0 | 0 | 37,252 |
3,086,467 | 2010-06-21T16:29:00.000 | 0 | 0 | 1 | 0 | java,python,ruby,multithreading | 3,086,571 | 13 | false | 1 | 0 | How to untangle the knots in al those threads...
Clojure did not invent threading, however it has particularly strong support for it with Software Transactional Memory, Atoms, Agents, parallel map operations, ...
All other have accumulated threading support. Ruby is a special case as it has green threads in some implementations which are a kind of software emulated threads and do not use all the cores. 1.9 will put this to rest.
Regarding web servers, no they do not always work multithreaded, apache has traditionally ran as a flock of daemons which are a pool of separate single threaded processes. Now currently there are more options to run apache servers.
To summarize all modern languages support threading in one form or another.
The newer languages like scala and clojure are adding specific support to improve working with multiple threads without explicit locking as this has traditionally be the great pitfall of multithreading. | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 0 | 0 | 0 | 37,252 |
3,086,467 | 2010-06-21T16:29:00.000 | 5 | 0 | 1 | 0 | java,python,ruby,multithreading | 3,086,584 | 13 | false | 1 | 0 | The short answer is yes, they are single threaded.
The long answer is it depends.
JRuby is multithreaded and can be run in tomcat like other java code. MRI (default ruby) and Python both have a GIL (Global Interpreter Lock) and are thus single threaded.
The way it works for web servers is further complicated by the number of available server configurations. For most ruby applications there are (at least) two levels of servers, a proxy/static file server like nginx and then the ruby app server.
Nginx does not use threads like apache or tomcat, it uses non-blocking events (and I think forked worker processes). This allows it to deal with higher levels of concurrency than would be allowed with the overhead and scheduling inefficiencies of native threads.
The various ruby apps servers also work in different ways to get high throughput and concurrency without threads. Thin uses libev and the asynchronous evented model like Nginx. Mongrel uses a round-robin pool of worker processes. Unicorn uses native Unix IPC (select on a socket) to load balance to a pool of forked processes through one master proxy socket.
Threads are only one way to address concurrency. Multiple processes and evented models are a different approach that ties in well with the Unix base. This is fundamentally different from the way Java treats the world. | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 0.076772 | 0 | 0 | 37,252 |
3,086,467 | 2010-06-21T16:29:00.000 | 0 | 0 | 1 | 0 | java,python,ruby,multithreading | 3,086,920 | 13 | false | 1 | 0 | Reading these answers here... A lot of them try to sound smarter than they really are imho (im mostly talking about Ruby related stuff as thats the one i'm most familiar with).
In fact, JRuby is currently the only Ruby implementation that supports true concurrency. On JVM Ruby threads are mapped to OS native threads, without GIL interfering. So its totally correct to say that Ruby is not multithreaded.
In 1.8.x Ruby is actually run inside one OS thread, and while you do have the fake feeling of concurrency with green threads, then in reality GIL will pretty much prevent you from having true concurrency.
In Ruby 1.9 this changed a bit, as now a Ruby process can have many OS threads attached to it (plus the green threads), but again GIL will totally destroy the point and become the bottleneck.
In practice, from a regular webapp standpoint, it should not matter much if its single or multithreaded. The problem mostly arises on the server side anyhow and it mostly is a matter of scaling technique difference. | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 0 | 0 | 0 | 37,252 |
3,086,467 | 2010-06-21T16:29:00.000 | 0 | 0 | 1 | 0 | java,python,ruby,multithreading | 3,087,997 | 13 | false | 1 | 0 | Yes Ruby and Python can handle multi-threading, but for many cases (web) is better to rely on the threads generated by the http requests from the client to the server. Even if you generate many threads on a same application to low the runtime cost or to handle many task at time, in a web application case that's usually too much time, no one will wait happily more than some fractions of a second for the response of your application in a single page, it's more wise to use AJAX (Asynchronous JavaScript And XML) techniques: make sure the design of your web shows up rapidly, and make an asynchronous insertion of those hard-coding things later.
That does not mean that multi-threading is useless for web! It's highly recommended to low the charge of your server if you want to run recursive-complicated-hardcore-applications (not for a website, I mean), but what that thing return must end in files or in databases, so then could be softly served by a http response. | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 0 | 0 | 0 | 37,252 |
3,086,467 | 2010-06-21T16:29:00.000 | 1 | 0 | 1 | 0 | java,python,ruby,multithreading | 60,181,609 | 13 | false | 1 | 0 | keeping this very short..
Python supports Multi Threading.
Python does NOT support parallel execution of its Threads.
Exception:
Above statement may vary with implementations of Python not using GIL (Global Interpreter Locking).
If a particular implementation is not using GIL, then, that would be Multi Threaded as well as support Parallel Execution | 9 | 61 | 0 | I was reading how Clojure is 'cool' because of its syntax + it runs on the JVM so it is multithreaded etc. etc.
Are languages like ruby and python single threaded in nature then? (when running as a web app).
What are the underlying differences between python/ruby and say java running on tomcat?
Doesn't the web server have a pool of threads to work with in all cases? | Confused, are languages like python, ruby single threaded? unlike say java? (for web apps) | 0.015383 | 0 | 0 | 37,252 |
3,088,449 | 2010-06-21T20:55:00.000 | 1 | 0 | 1 | 0 | multithreading,background,python | 3,089,339 | 1 | true | 0 | 0 | You don't have to explicitly join threads -- just make sure they're not "daemonized" (leave their daemon attribute to the default, False) so they'll keep the process alive until they're all done (if you make your threads daemons, then you must make sure the main thread does not terminate until all relevant threads are done, or else the threads will be killed by the OS).
I think the right thing is the simplest one: forget about your "background threads", just make them non-daemons (which is after all their default state). | 1 | 2 | 0 | I need to start some threads in a python program. The threads perform a background task which might take a long time, so I don't want to block the main thread waiting on the task to happen.
Python provides the ability to 'reap' threads using Thread.join() and Thread.isAlive(). But I don't actually care about finding out when the thread has finished. I'm content to start up the thread, let it do it's thing and never worry about it again.
The question is, do I need to keep references around to the Thread objects that I start so that I can later join() them? Or can I just let the reference to the Thread object go out of scope and not worry about it? Is there a 'right' thing to do in this case? | explicit joining of python threads? | 1.2 | 0 | 0 | 341 |
3,088,493 | 2010-06-21T21:01:00.000 | 8 | 0 | 1 | 1 | python,arguments | 3,088,518 | 2 | true | 0 | 0 | It takes any options for python.exe itself, then the name of the file (or command or module), then any arguments to be passed to your program.
If no file is specified, it puts you in interactive mode.
As indicated in the comments by Adam, type python -h to see the full list. | 1 | 7 | 0 | does it take the filename of the .py and then what? | what does python.exe take as arguments? | 1.2 | 0 | 0 | 12,210 |
3,089,450 | 2010-06-22T00:41:00.000 | 0 | 1 | 0 | 0 | python | 3,089,472 | 6 | false | 0 | 0 | You could also use Google App Engine with Python and Django | 1 | 2 | 0 | I have read in the documentation that there are 4 or 5 ways in which i can python for web pages. Like
With CGI
Mod_python : mod_python does have some problems. Unlike the PHP interpreter, the Python interpreter uses caching when executing files, so changes to a file will require the web server to be restarted
FastCGI and SCGI
mod_wsgi
SO which way should i go . does it means that python is not for webistes if there are too many problems while using it
I have to build the live business website with thousands of users so i should not use it if that has many probelms | How to use python on webserver for web pages | 0 | 0 | 0 | 825 |
3,091,166 | 2010-06-22T07:39:00.000 | 0 | 0 | 0 | 1 | python,fuse | 7,040,661 | 3 | false | 0 | 0 | Copy is as Weholt said: difficult to trap because it is basically the same as creating a new file and writing to it.
Move is the same operation as a rename. | 2 | 2 | 0 | I`m implementing a custom filesystem on Ubuntu using Fuse, but I need to trap when a copy or move operation occur. Right now all I see are when some file are opened for writing or reading, but I need to see these operations in context so I can see what file are being copied or moved.
Any hints? | How to trap a copy/move-file operation in a custom filesystem based on Fuse? | 0 | 0 | 0 | 1,016 |
3,091,166 | 2010-06-22T07:39:00.000 | 0 | 0 | 0 | 1 | python,fuse | 3,091,286 | 3 | false | 0 | 0 | What you want to do is probably not easily done, considering that a "copy" or "move" program could do just what you see - open a file and write to it. That's a perfectly good way of copying a file.
Even if you can see what actual binary is doing it, that wouldn't give you enough information to know if this was a copy, a move or simply a program writing data to a file.
If you tell us why you need to do this, then maybe someone can suggest another solution, that fulfills your needs. | 2 | 2 | 0 | I`m implementing a custom filesystem on Ubuntu using Fuse, but I need to trap when a copy or move operation occur. Right now all I see are when some file are opened for writing or reading, but I need to see these operations in context so I can see what file are being copied or moved.
Any hints? | How to trap a copy/move-file operation in a custom filesystem based on Fuse? | 0 | 0 | 0 | 1,016 |
3,093,598 | 2010-06-22T13:36:00.000 | 1 | 1 | 0 | 0 | python,continuous-integration,build-automation,buildbot,nightly-build | 12,307,055 | 2 | true | 0 | 0 | If you use Nightly, then you can specify that the scheduler only trigger if there are interesting changes to build. Presumably, you won't have commits during that period either, so it will not trigger builds then. | 2 | 0 | 0 | Buildbots Periodic scheduler triggers builds at fixed intervals (e.g. every 30 minutes). But there are certain times (e.g. at night, during the weekend or while regular maintenance is performed) where I'd like it to relax.
Is there a way to have a more fine-grained description for the Periodic scheduler? Or should I rather use the Nightly scheduler and explicitly list all build trigger times I need for the whole week? | Exceptions from Buildbots PeriodicScheduler intervals? | 1.2 | 0 | 0 | 56 |
3,093,598 | 2010-06-22T13:36:00.000 | 0 | 1 | 0 | 0 | python,continuous-integration,build-automation,buildbot,nightly-build | 6,169,869 | 2 | false | 0 | 0 | One way to solve this would of course be to write a piece of python code that generates the build times for up the nightly scheduler according to some rules. | 2 | 0 | 0 | Buildbots Periodic scheduler triggers builds at fixed intervals (e.g. every 30 minutes). But there are certain times (e.g. at night, during the weekend or while regular maintenance is performed) where I'd like it to relax.
Is there a way to have a more fine-grained description for the Periodic scheduler? Or should I rather use the Nightly scheduler and explicitly list all build trigger times I need for the whole week? | Exceptions from Buildbots PeriodicScheduler intervals? | 0 | 0 | 0 | 56 |
3,094,331 | 2010-06-22T14:51:00.000 | 9 | 0 | 1 | 0 | python,vim | 3,098,250 | 7 | true | 0 | 0 | This is a bit of a dirty hack, but you can go through the python syntax file (:sp $VIMRUNTIME/syntax/python.vim) and find all the syntax regions for triple-quoted strings (search for ''' and """) and add the fold keyword to the end of those statements. Then just set foldmethod=syntax for python files and the comments should be folded. | 2 | 9 | 0 | Does anybody know of a method, or perhaps a plugin, that will
automatically fold long docstrings in Python? I have docstrings in my
code that span several pages, so it is troublesome to keep paging
through them. The other tricky part is that there is embedded python
testing code in the docstrings, so that might make parsing them
difficult. Note that I only need to automatically fold the entire
docstring, regardless of what is in it. | How to fold long docstrings in python source code in VIM? | 1.2 | 0 | 0 | 2,528 |
3,094,331 | 2010-06-22T14:51:00.000 | 0 | 0 | 1 | 0 | python,vim | 3,098,317 | 7 | false | 0 | 0 | You can do this with :set foldmethod=marker foldmarker=""",""", I think. I haven't tested it, but that should do the trick. The arguments to foldmarker are start and end markers. | 2 | 9 | 0 | Does anybody know of a method, or perhaps a plugin, that will
automatically fold long docstrings in Python? I have docstrings in my
code that span several pages, so it is troublesome to keep paging
through them. The other tricky part is that there is embedded python
testing code in the docstrings, so that might make parsing them
difficult. Note that I only need to automatically fold the entire
docstring, regardless of what is in it. | How to fold long docstrings in python source code in VIM? | 0 | 0 | 0 | 2,528 |
3,094,618 | 2010-06-22T15:29:00.000 | 1 | 0 | 1 | 0 | python,file | 3,094,661 | 3 | false | 0 | 0 | A 4MB file is very small, it fits in memory for sure. The fastest approach would be to read it all and then iterate over each line searching for the pattern, writing out the line to the appropriate file depending on the pattern (your approach for small files.) | 1 | 1 | 0 | I have file about 4MB (which i called as big one)...this file has about 160000 lines..in a specific format...and i need to cut them at regular interval(not at equal intervals) i.e at the end of a certain format and write the part into another file..
Basically,what i wanted is to copy the information for the big file into the many smaller files ...as i read the big file keep writing the information into one file and after the a certain pattern occurs then end this and starting writing for that line into another file...
Normally, if it is a small file i guess it can be done dont know if i can perform file.readline() to read each line check if pattern end if not then write it to a file if patter end then change the file name open new file..so on but how to do it for this big file..
thanks in advance..
didnt mention the file format as i felt it is not neccesary will mention if required.. | how to load a big file and cut it into smaller files? | 0.066568 | 0 | 0 | 246 |
3,094,693 | 2010-06-22T15:37:00.000 | 0 | 1 | 1 | 0 | visual-studio-2010,ironpython | 3,094,718 | 2 | false | 0 | 0 | You should be able to just right click the folder, choose "Exclude from Project"
Then, make sure "Show all files" is NOT on at the top, by the solution. | 2 | 2 | 0 | I'm working on an IronPython project on VS2010 and I've notice that for the python project (which is setup as a Console project, but really just contains a number of scripts that are hosted in a C# app), everything that is in the project directory will show up in the VS solution explorer under that project. So, for example, the .svn folder shows up. Which I obviously don't want or need to be there.
Is there any way to tell it to hide specific items? I sure can't find one. | Hide .svn folders in a VS2010 IronPython project | 0 | 0 | 0 | 284 |
3,094,693 | 2010-06-22T15:37:00.000 | 2 | 1 | 1 | 0 | visual-studio-2010,ironpython | 3,098,784 | 2 | true | 0 | 0 | Currently we have a directory based project system - which as you have seen includes all of the files in the project dir. We were planning on having an exclude option but the feedback we've been hearing so far is that we should move to a normal VS project model where you need to explicitly add the files. The next CTP release (which should be out in a week or so) will change to a normal project model.
There does still seem to be some interest in the directory based model so we may bring it back via an option in a future version. | 2 | 2 | 0 | I'm working on an IronPython project on VS2010 and I've notice that for the python project (which is setup as a Console project, but really just contains a number of scripts that are hosted in a C# app), everything that is in the project directory will show up in the VS solution explorer under that project. So, for example, the .svn folder shows up. Which I obviously don't want or need to be there.
Is there any way to tell it to hide specific items? I sure can't find one. | Hide .svn folders in a VS2010 IronPython project | 1.2 | 0 | 0 | 284 |
3,095,057 | 2010-06-22T16:23:00.000 | 0 | 1 | 0 | 0 | php,python,sql,regex,perl | 3,209,792 | 5 | false | 0 | 0 | If you wanted to do this a lot and with some reliability, you might want to use a semi-advanced approach like a "bag of words" technique. I actually sat down and wrote a sketch of a more-or-less working (if horribly unoptimized) algorithm to do it, but I'm not sure if it would really be appropriate to include here. There are pre-made libraries that you can use for text classification instead. | 2 | 4 | 0 | somewhat open ended question here as I am mostly looking for opinions. I am grabbing some data from craigslist for apt ads in my area since I am looking to move. My goal is to be able to compare items to see when something is a duplicate so that I don't spend all day looking at the same 3 ads. The problem is that they change things around a little to get past CL's filters.
I already have some regex to look for address and phone numbers to compare, but that isn't the most reliable. Is anyone familiar with an easy-ish method to compare the whole document and maybe show something simple like "80% similar"? I can't think of anything offhand, so I suspect I'll have to start from scratch on my own solution, but figured it would be worth asking the collective genius of stackoverflow :)
Preferred languages/methods would be python/php/perl, but if it's a great solution I'm pretty open.
Update: one thing worth noting is that since I will be storing the scraped data of the rss feed for apts in my area (los angeles) in a local DB, the preferred method would include a way to compare it to everything I currently know. This could be a bit of a showstopper since that could become a very long process as the post counts grow. | What is the easiest method to compare large amounts of similar text? | 0 | 0 | 0 | 387 |
3,095,057 | 2010-06-22T16:23:00.000 | 2 | 1 | 0 | 0 | php,python,sql,regex,perl | 3,209,571 | 5 | true | 0 | 0 | You could calculate the Levenshtein difference between both strings - after some sane normalizing like minimizing duplicate whitespace and what not. After you run through enough "duplicates" you should get an idea of what your threshold is - then you can run Levenshtein on all new incoming data and if its less-than-equal to your threshold than you can consider it a duplicate. | 2 | 4 | 0 | somewhat open ended question here as I am mostly looking for opinions. I am grabbing some data from craigslist for apt ads in my area since I am looking to move. My goal is to be able to compare items to see when something is a duplicate so that I don't spend all day looking at the same 3 ads. The problem is that they change things around a little to get past CL's filters.
I already have some regex to look for address and phone numbers to compare, but that isn't the most reliable. Is anyone familiar with an easy-ish method to compare the whole document and maybe show something simple like "80% similar"? I can't think of anything offhand, so I suspect I'll have to start from scratch on my own solution, but figured it would be worth asking the collective genius of stackoverflow :)
Preferred languages/methods would be python/php/perl, but if it's a great solution I'm pretty open.
Update: one thing worth noting is that since I will be storing the scraped data of the rss feed for apts in my area (los angeles) in a local DB, the preferred method would include a way to compare it to everything I currently know. This could be a bit of a showstopper since that could become a very long process as the post counts grow. | What is the easiest method to compare large amounts of similar text? | 1.2 | 0 | 0 | 387 |
3,095,071 | 2010-06-22T16:24:00.000 | 7 | 1 | 1 | 0 | python,python-import | 3,095,108 | 6 | false | 0 | 0 | Importing inside a function will effectively import the module once.. the first time the function is run.
It ought to import just as fast whether you import it at the top, or when the function is run. This isn't generally a good reason to import in a def. Pros? It won't be imported if the function isn't called.. This is actually a reasonable reason if your module only requires the user to have a certain module installed if they use specific functions of yours...
If that's not he reason you're doing this, it's almost certainly a yucky idea. | 5 | 222 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | In Python, what happens when you import inside of a function? | 1 | 0 | 0 | 145,145 |
3,095,071 | 2010-06-22T16:24:00.000 | 8 | 1 | 1 | 0 | python,python-import | 3,096,179 | 6 | false | 0 | 0 | Might I suggest in general that instead of asking, "Will X improve my performance?" you use profiling to determine where your program is actually spending its time and then apply optimizations according to where you'll get the most benefit?
And then you can use profiling to assure that your optimizations have actually benefited you, too. | 5 | 222 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | In Python, what happens when you import inside of a function? | 1 | 0 | 0 | 145,145 |
3,095,071 | 2010-06-22T16:24:00.000 | 3 | 1 | 1 | 0 | python,python-import | 3,095,106 | 6 | false | 0 | 0 | It imports once when the function is called for the first time.
I could imagine doing it this way if I had a function in an imported module that is used very seldomly and is the only one requiring the import. Looks rather far-fetched, though... | 5 | 222 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | In Python, what happens when you import inside of a function? | 0.099668 | 0 | 0 | 145,145 |
3,095,071 | 2010-06-22T16:24:00.000 | 20 | 1 | 1 | 0 | python,python-import | 3,095,095 | 6 | false | 0 | 0 | It imports once when the function executes first time.
Pros:
imports related to the function they're used in
easy to move functions around the package
Cons:
couldn't see what modules this module might depend on | 5 | 222 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | In Python, what happens when you import inside of a function? | 1 | 0 | 0 | 145,145 |
3,095,071 | 2010-06-22T16:24:00.000 | 55 | 1 | 1 | 0 | python,python-import | 3,095,167 | 6 | false | 0 | 0 | The very first time you import goo from anywhere (inside or outside a function), goo.py (or other importable form) is loaded and sys.modules['goo'] is set to the module object thus built. Any future import within the same run of the program (again, whether inside or outside a function) just look up sys.modules['goo'] and bind it to barename goo in the appropriate scope. The dict lookup and name binding are very fast operations.
Assuming the very first import gets totally amortized over the program's run anyway, having the "appropriate scope" be module-level means each use of goo.this, goo.that, etc, is two dict lookups -- one for goo and one for the attribute name. Having it be "function level" pays one extra local-variable setting per run of the function (even faster than the dictionary lookup part!) but saves one dict lookup (exchanging it for a local-variable lookup, blazingly fast) for each goo.this (etc) access, basically halving the time such lookups take.
We're talking about a few nanoseconds one way or another, so it's hardly a worthwhile optimization. The one potentially substantial advantage of having the import within a function is when that function may well not be needed at all in a given run of the program, e.g., that function deals with errors, anomalies, and rare situations in general; if that's the case, any run that does not need the functionality will not even perform the import (and that's a saving of microseconds, not just nanoseconds), only runs that do need the functionality will pay the (modest but measurable) price.
It's still an optimization that's only worthwhile in pretty extreme situations, and there are many others I would consider before trying to squeeze out microseconds in this way. | 5 | 222 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | In Python, what happens when you import inside of a function? | 1 | 0 | 0 | 145,145 |
3,096,953 | 2010-06-22T20:38:00.000 | 0 | 0 | 1 | 0 | python,time,python-datetime | 72,463,310 | 16 | false | 0 | 0 | you could try this:
from datetime import datetime
start = datetime.now()
print(start)
#some code here
end = datetime.now()
print(end)
print(end - start) | 2 | 224 | 0 | I have two times, a start and a stop time, in the format of 10:33:26 (HH:MM:SS). I need the difference between the two times. I've been looking through documentation for Python and searching online and I would imagine it would have something to do with the datetime and/or time modules. I can't get it to work properly and keep finding only how to do this when a date is involved.
Ultimately, I need to calculate the averages of multiple time durations. I got the time differences to work and I'm storing them in a list. I now need to calculate the average. I'm using regular expressions to parse out the original times and then doing the differences.
For the averaging, should I convert to seconds and then average? | How to calculate the time interval between two time strings | 0 | 0 | 0 | 542,575 |
3,096,953 | 2010-06-22T20:38:00.000 | 2 | 0 | 1 | 0 | python,time,python-datetime | 3,096,997 | 16 | false | 0 | 0 | Take a look at the datetime module and the timedelta objects. You should end up constructing a datetime object for the start and stop times, and when you subtract them, you get a timedelta. | 2 | 224 | 0 | I have two times, a start and a stop time, in the format of 10:33:26 (HH:MM:SS). I need the difference between the two times. I've been looking through documentation for Python and searching online and I would imagine it would have something to do with the datetime and/or time modules. I can't get it to work properly and keep finding only how to do this when a date is involved.
Ultimately, I need to calculate the averages of multiple time durations. I got the time differences to work and I'm storing them in a list. I now need to calculate the average. I'm using regular expressions to parse out the original times and then doing the differences.
For the averaging, should I convert to seconds and then average? | How to calculate the time interval between two time strings | 0.024995 | 0 | 0 | 542,575 |
3,097,236 | 2010-06-22T21:21:00.000 | 0 | 0 | 1 | 0 | python,memory-management | 3,097,266 | 2 | false | 0 | 0 | How big are we talking? Python itself takes up some amount of memory.. up to maybe 30 or 40 MB I believe. If it is bigger than that and not getting collected, you have a memory leak. Only garbage with no references can be collected, somehow your extra stuff is still referenced. Do a memory profile and see what is going on. | 1 | 9 | 0 | My python code process memory increases dynamically as it stores dynamic data in list, dictionary and tuples wherever necessary. Though all those dynamic data is cleared physically in their variables after then, the memory is not shooting down.
Hence i felt like there is a memory leak and i used gc.collect() method to collect all the unfreed memory. But i could not make the memory to minimum when there is no data in the variables. | growing python process memory over time | 0 | 0 | 0 | 3,815 |
3,098,337 | 2010-06-23T01:31:00.000 | 4 | 0 | 1 | 0 | python,parsing,csv,input,types | 3,098,439 | 5 | false | 0 | 0 | ast.literal_eval() can get the easy ones. | 1 | 2 | 1 | I'm currently parsing CSV tables and need to discover the "data types" of the columns. I don't know the exact format of the values. Obviously, everything that the CSV parser outputs is a string. The data types I am currently interested in are:
integer
floating point
date
boolean
string
My current thoughts are to test a sample of rows (maybe several hundred?) in order to determine the types of data present through pattern matching.
I am particularly concerned about the date data type - is their a python module for parsing common date idioms (obviously I will not be able to detect them all)?
What about integers and floats? | Method for guessing type of data represented currently represented as strings | 0.158649 | 0 | 0 | 4,235 |
3,098,485 | 2010-06-23T02:12:00.000 | 0 | 0 | 1 | 0 | python,django | 3,098,528 | 3 | false | 0 | 0 | Put it into a dictionary, then use l=list(dictionary.iteritems()) to get the list and l.sort() to sort it | 1 | 0 | 0 | I have an unsorted list of objects that each have a end_date attribute.
The list just looks like [obj1, obj2, obj3, <...>] in no specific order.
I want to end up with a list that looks like this:
[["Saturday, May 5", [obj3, obj5]], ["Monday, May 7", [obj1, obj8, obj9]] ... etc ]
Basically just a list of lists, where the "key" is the date from the objects and the value for that key is a list of objects that have that date. Don't worry about the date formatting, that's just an easy datetime manipulation. I know it's relatively easy to do with a dictionary, but I need to end up with a list sorted by the keys, and you can't do this with dictionaries (at least not with Python 2.6 IIRC)
What is the most efficient way to do this? I've been muddling through some solutions with a bunch of for loops, but it seems like I'm going about it wrong. | Most efficient way to sort/categories objects in list based on object attribute | 0 | 0 | 0 | 572 |
3,098,980 | 2010-06-23T04:43:00.000 | 0 | 0 | 1 | 0 | python,frame-rate | 3,099,000 | 3 | false | 0 | 0 | Short answer: No.
Long answer: Not without knowing the internals of the application, and without the application having the appropriate hooks to perform such a measurement. | 1 | 2 | 0 | I was wondering...
It's possible to do it?
A simple console command based program that shows how are your FPS, for your currently running game/program? | It's possible to make a program that shows FPS (frame per second) in Python? | 0 | 0 | 0 | 1,099 |
3,099,244 | 2010-06-23T05:58:00.000 | 0 | 0 | 0 | 0 | python,user-interface,gtk,pygtk,gtktreeview | 60,073,336 | 5 | false | 0 | 1 | Calling both ModifyBase and ModifyText worked for me. Calling just ModifyBase changes the text color to White
Example in GTK C#:
treeViewList.ModifyBase(StateType.Selected, treeViewList.Style.Base(StateType.Normal));
treeViewList.ModifyText(StateType.Selected, treeViewList.Style.Text(StateType.Normal)); | 2 | 9 | 0 | I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background.
The row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, "#C4C4C4"), but no colours work well with the colours used to enhance the concept of priority.
I had the idea to change the selection colour to be a slightly darker version of the colour used as the normal row background, so in the example above, that would be a darker red. I tried calling the function above in response to the treeselection's changed signal, and it works, but with heavy flickering.
Another idea was to change the selection to transparent and put a border around it instead, but as far as I can tell, this isn't possible.
How can I change the selection colour in the way described above without the flickering?
Can I change show the selection by having only a border around the row?
Note: I'm aware that this violates the theme selected by the user. I feel I have a good reason for it. Having the priority indicated by colour makes it instantly recognisable. The selection colour hides this. If you have alternative suggestions, I am open to them, but it needs to retain the ease at which a user can identify the priority. | Changing the selected item colour in a GtkTreeview using python | 0 | 0 | 0 | 3,920 |
3,099,244 | 2010-06-23T05:58:00.000 | 0 | 0 | 0 | 0 | python,user-interface,gtk,pygtk,gtktreeview | 3,099,780 | 5 | false | 0 | 1 | Not sure what you mean by flickering. A border would require subclassing TreeView.
I'd make the STATE_SELECTED color identical to STATE_NORMAL to disable the built-in highlighting. Then set a data_func on each column and change some color on the cell renderer depending on whether it's in the selection or not.
You're probably already doing this for your priority, so just multiply the color with something to highlight a row. | 2 | 9 | 0 | I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background.
The row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, "#C4C4C4"), but no colours work well with the colours used to enhance the concept of priority.
I had the idea to change the selection colour to be a slightly darker version of the colour used as the normal row background, so in the example above, that would be a darker red. I tried calling the function above in response to the treeselection's changed signal, and it works, but with heavy flickering.
Another idea was to change the selection to transparent and put a border around it instead, but as far as I can tell, this isn't possible.
How can I change the selection colour in the way described above without the flickering?
Can I change show the selection by having only a border around the row?
Note: I'm aware that this violates the theme selected by the user. I feel I have a good reason for it. Having the priority indicated by colour makes it instantly recognisable. The selection colour hides this. If you have alternative suggestions, I am open to them, but it needs to retain the ease at which a user can identify the priority. | Changing the selected item colour in a GtkTreeview using python | 0 | 0 | 0 | 3,920 |
3,101,160 | 2010-06-23T11:30:00.000 | 0 | 0 | 0 | 0 | c++,python,c,ide,code-completion | 3,102,007 | 2 | false | 0 | 1 | I use notepad++ and am vary happy with it. | 1 | 5 | 0 | I've been annoyed lately by the fact that PyDev doesn't information about classes and function when it code completes wxPython code.
Can anybody tell me FOSS IDE's or extensions that offer code information (function params, returns etc.) when it code completes for C/C++ and Python.
I am a fan of CodeLite, Eclipse CDT and CodeBlocks in that order for C/C++ (excepting non-FOSS)
and PyScripter, PyDev for Python in that order. | ide code information | 0 | 0 | 0 | 144 |
3,102,098 | 2010-06-23T13:36:00.000 | 0 | 0 | 0 | 1 | python,ssh,twisted | 3,102,192 | 2 | false | 0 | 0 | You're trying to put a square peg in a round hole. Everything in Twisted is asynchronous, so you have to think about the sequence of events differently. You can't say "here are 10 operations to be run one after the other" that's serial thinking.
In Twisted you issue the first command and register a callback that will be triggered when it completes. When that callback occurs you issue the 2nd command and register a callback that will be triggered when that completes. And so on and so on. | 1 | 3 | 0 | Guys this is a question about python twisted ssh lib.
All sample code even production code I saw acting as a ssh client based on twisted.conch.ssh are all interacting with server in such a mode:
prepare some commands to run remotely;
define call backs;
kick off reactor then suspend for new feedback;
After the reactor.run(), I never found people tried to deliver commands to sshd, the script just sit their waiting. I think it'll be possible to fork or spawn stuffs to send commands. However since one of twisted's strengths is its de-multiplexing mechanism so it doesn't have to fork to process incoming requests when running as a server. May I say it is a reasonable requirement not to fork (as a client script) to continuously send requests to server?
Any thought on this ?
TIA. | sound way to feed commands to twisted ssh after reactor.run() | 0 | 0 | 0 | 1,007 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.