Q_Id int64 2.93k 49.7M | CreationDate stringlengths 23 23 | Users Score int64 -10 437 | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | DISCREPANCY int64 0 1 | Tags stringlengths 6 90 | ERRORS int64 0 1 | A_Id int64 2.98k 72.5M | API_CHANGE int64 0 1 | AnswerCount int64 1 42 | REVIEW int64 0 1 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 15 5.1k | Available Count int64 1 17 | Q_Score int64 0 3.67k | Data Science and Machine Learning int64 0 1 | DOCUMENTATION int64 0 1 | Question stringlengths 25 6.53k | Title stringlengths 11 148 | CONCEPTUAL int64 0 1 | Score float64 -1 1.2 | API_USAGE int64 1 1 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 15 3.72M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,605,243 | 2011-01-05T14:37:00.000 | 2 | 1 | 0 | 0 | 0 | python,web,yahoo | 0 | 4,605,394 | 0 | 6 | 0 | true | 1 | 0 | Phisical architecture of web application can be different from the logical one visible through browser. Basically it is achieved by putting front web server (think of apache with mod_proxy, but it can be any other moder web server supporting reverse proxying) and mounting web application servers (java/python/whatever) ... | 4 | 0 | 0 | 0 | I was watching the tutorials for python and the guy told that he coded the Address books and spell checker for yahoo mail in python.
Now initially i was thinking that if i build the website then i have to use one language either php or java or asp or anything.
But i am confused how can we make make separate modules in ... | Is it possible to use different technologies in one website | 1 | 1.2 | 1 | 0 | 0 | 99 |
4,605,243 | 2011-01-05T14:37:00.000 | 0 | 1 | 0 | 0 | 0 | python,web,yahoo | 0 | 4,605,290 | 0 | 6 | 0 | false | 1 | 0 | I know in Ruby on Rails, you can execute bash commands.
Example: puts ls | 4 | 0 | 0 | 0 | I was watching the tutorials for python and the guy told that he coded the Address books and spell checker for yahoo mail in python.
Now initially i was thinking that if i build the website then i have to use one language either php or java or asp or anything.
But i am confused how can we make make separate modules in ... | Is it possible to use different technologies in one website | 1 | 0 | 1 | 0 | 0 | 99 |
4,605,243 | 2011-01-05T14:37:00.000 | 1 | 1 | 0 | 0 | 0 | python,web,yahoo | 0 | 4,605,266 | 0 | 6 | 0 | false | 1 | 0 | You can use any language to provide a web service, so you can for example provide a REST/SOAP web service that returns JSON or XML. The web service can be written in any language, and the language used to interact with the web service can be any language, as all languages nowadays have JSON and XML parsers.
You can set... | 4 | 0 | 0 | 0 | I was watching the tutorials for python and the guy told that he coded the Address books and spell checker for yahoo mail in python.
Now initially i was thinking that if i build the website then i have to use one language either php or java or asp or anything.
But i am confused how can we make make separate modules in ... | Is it possible to use different technologies in one website | 1 | 0.033321 | 1 | 0 | 0 | 99 |
4,613,251 | 2011-01-06T09:02:00.000 | 3 | 0 | 0 | 0 | 0 | python,django,data-structures | 0 | 4,613,300 | 0 | 2 | 0 | true | 1 | 0 | You don't need a table per stock symbol, you just need one of the fields in the table to be the stock symbol. The table might be called StockPrices and its fields might be
ticker_symbol - the stock ticker symbol
time - the time of the stock quote
price - the price of the stock at that time
As long as ticker_symbol is... | 1 | 0 | 0 | 0 | I'm developing a web app that uses stock data. The stock data can be stored in:
Files
DB
The structure of the data is simple: there's a daily set and a weekly set. If files are used, then I can store a file per symbol/set, such as GOOGLE_DAILY and GOOGLE_WEEKLY. Each set includes a simple list of (Date, open/hight/l... | Help needed with db structure | 0 | 1.2 | 1 | 1 | 0 | 81 |
4,619,392 | 2011-01-06T20:15:00.000 | 0 | 0 | 0 | 0 | 0 | python,mysql,virtual-machine | 0 | 4,621,472 | 0 | 3 | 0 | false | 0 | 0 | Do you want it synced in realtime?
Why not just connect the guest's mysql process to the host? | 2 | 1 | 0 | 0 | Im setting a VM.
Both host and VM machine have Mysql.
How do keep the VM Mysql sync'd to to the host Mysql.
Host is using MYsql 5.5 on XP.
VM is Mysql 5.1 on Fedora 14.
1) I could DUMP to "shared," Restore. Not sure if this will work.
2) I could network Mysql Host to Mysql VM. Not how to do this
How would I do thi... | How to Sync MySQL with python? | 0 | 0 | 1 | 1 | 0 | 2,319 |
4,619,392 | 2011-01-06T20:15:00.000 | 1 | 0 | 0 | 0 | 0 | python,mysql,virtual-machine | 0 | 4,619,503 | 0 | 3 | 0 | true | 0 | 0 | You can use mysqldump to make snapshots of the database, and to restore it to known states after tests.
But instead or going into the complication of synchronizing different database instances, it would be best to open the host machine's instance to local network access, and have the applications in the virtual machin... | 2 | 1 | 0 | 0 | Im setting a VM.
Both host and VM machine have Mysql.
How do keep the VM Mysql sync'd to to the host Mysql.
Host is using MYsql 5.5 on XP.
VM is Mysql 5.1 on Fedora 14.
1) I could DUMP to "shared," Restore. Not sure if this will work.
2) I could network Mysql Host to Mysql VM. Not how to do this
How would I do thi... | How to Sync MySQL with python? | 0 | 1.2 | 1 | 1 | 0 | 2,319 |
4,621,447 | 2011-01-07T00:28:00.000 | 3 | 0 | 1 | 0 | 1 | python,string,mkdir | 0 | 4,621,460 | 0 | 3 | 0 | false | 0 | 0 | construct your paths with os.path, then it's platform agnostic and you'll avoid these issues.
For example, mkdir(os.path.join(r"C:\", "6"))
or os.path.join(r"D:\", "main", "folder", "red", "34") | 1 | 1 | 0 | 0 | I had a bad problem with these two: "\" and "/" in Windows, obviously :\
I need to replace all \ occurrence in /, so I can use replace() because doesn't work with this "\6" for example.
What I have to do? I want "only" use mkdir() to replicate a structure of folders (without files) from one location to another. So I u... | From backslash to slash (to create folders named with number) | 0 | 0.197375 | 1 | 0 | 0 | 5,295 |
4,622,988 | 2011-01-07T06:18:00.000 | 2 | 0 | 0 | 0 | 0 | python,algorithm | 0 | 4,623,782 | 0 | 4 | 0 | false | 0 | 0 | Make a dict {graticule: [users]} (a "graticule" is a block of 1 degree latitude x 1 degree longitude; so you can basically just round the values). To find nearby users, first get users from the same and adjacent graticules (since the target could be near an edge), then filter them with a basic bounding-box test (i.e. w... | 1 | 4 | 0 | 0 | I have a python program sitting in server side managing user location informations, each friend has a pair of (longtitude, latitude), given a (longtitude, latitude) point, how I can find the nearby(say within 5KM) friends efficiently?
I have 10K users online...
Thanks.
Bin | algorithm to find the nearby friends? | 0 | 0.099668 | 1 | 0 | 1 | 2,000 |
4,625,835 | 2011-01-07T13:18:00.000 | 2 | 0 | 0 | 0 | 0 | python,django,oracle,django-models,model | 0 | 6,583,775 | 0 | 1 | 1 | true | 1 | 0 | The solution was to add an index. | 1 | 2 | 0 | 0 | I work with Oracle Database and lastest Django but when i use the default user model is the query very slow
what can i do? | how can i optimize a django oracle connection? | 0 | 1.2 | 1 | 1 | 0 | 305 |
4,625,844 | 2011-01-07T13:19:00.000 | -3 | 0 | 1 | 0 | 0 | python,google-app-engine,jquery | 0 | 4,625,942 | 0 | 3 | 0 | false | 0 | 0 | I believe you need to create a route for the app engine, and call that route with jQuery.
--EDIT-- The below turns out to be really really untrue, so don't mind it!!! I'm not going to remove it 'cause that would be lame. I have done some work with the Python SDK and tiny bit with the Java SDK, and doing so I felt the P... | 1 | 1 | 0 | 0 | i am learning python with GAE and for interface use jquery so i want to know calling python function using jquery. | how to call python function using jquery? | 0 | -0.197375 | 1 | 0 | 0 | 1,919 |
4,630,723 | 2011-01-07T22:07:00.000 | 4 | 0 | 1 | 0 | 0 | python,random | 0 | 4,630,743 | 0 | 5 | 0 | false | 0 | 0 | To guarantee that there will be the same number of zeros and ones you can generate a list containing n/2 zeros and n/2 ones and shuffle it with random.shuffle.
For small n, if you aren't happy that the result passes your acceptance criteria (e.g. not too many consecutive equal numbers), shuffle again. Be aware that doi... | 2 | 1 | 1 | 0 | Here's the problem: I try to randomize n times a choice between two elements (let's say [0,1] -> 0 or 1), and my final list will have n/2 [0] + n/2 [1]. I tend to have this kind of result: [0 1 0 0 0 1 0 1 1 1 1 1 1 0 0, until n]: the problem is that I don't want to have serially 4 or 5 times the same number so often. ... | Using Python for quasi randomization | 0 | 0.158649 | 1 | 0 | 0 | 588 |
4,630,723 | 2011-01-07T22:07:00.000 | 1 | 0 | 1 | 0 | 0 | python,random | 0 | 4,630,745 | 0 | 5 | 0 | false | 0 | 0 | Having 6 1's in a row isn't particularly improbable -- are you sure you're not getting what you want?
There's a simple Python interface for a uniformly distributed random number, is that what you're looking for? | 2 | 1 | 1 | 0 | Here's the problem: I try to randomize n times a choice between two elements (let's say [0,1] -> 0 or 1), and my final list will have n/2 [0] + n/2 [1]. I tend to have this kind of result: [0 1 0 0 0 1 0 1 1 1 1 1 1 0 0, until n]: the problem is that I don't want to have serially 4 or 5 times the same number so often. ... | Using Python for quasi randomization | 0 | 0.039979 | 1 | 0 | 0 | 588 |
4,638,806 | 2011-01-09T11:07:00.000 | 0 | 0 | 0 | 0 | 1 | python,pydot | 0 | 4,844,143 | 0 | 1 | 0 | true | 0 | 1 | I found out that writing the string in unicode representation shows mathematical symbols as edges...
For example you can write node = pydot.Node("ε",shape = "ellipse", style="filled", fillcolor="turquoise")
Using this we get epsilon as label of the node....
Similarly we can get rest of the mathematical symbols.... | 1 | 1 | 0 | 0 | I am having problem with drawing in pydot.
The problem lies in defining the layout of the nodes created. Currently everything is drawn vertically and is not spread. This gives me the problem of going down to see the nodes created.
Is there any way I can define the nodes to be created horizontally whenever they are ver... | changing layout and inserting mathematical symbols with pydot | 0 | 1.2 | 1 | 0 | 0 | 419 |
4,643,247 | 2011-01-10T02:33:00.000 | 1 | 0 | 0 | 1 | 0 | python,wxpython | 0 | 4,643,279 | 0 | 3 | 1 | false | 0 | 1 | I suggest both, script for all platforms and frozen binary for lazy windows users.
To answer your latest question, you don't compile python. Python is an interpreted language, it gets compiled on the fly when run. A python frozen binary is actually the python interpreter with your script hardcoded in it. And frozen bin... | 1 | 3 | 0 | 0 | I have a wxPython application that is almost done & I would like to place it in my portfolio. I have to consider when someone attempts to run my app that they may not have Python, or wxPython, so if they just click the main script/python file its not going to run, right?
How should I distribute my app (how do you distr... | Releasing a wxPython App: Give out scripts or compile in Exe, etc? | 0 | 0.066568 | 1 | 0 | 0 | 1,685 |
4,651,172 | 2011-01-10T20:27:00.000 | 24 | 0 | 0 | 0 | 0 | python,django,django-templates | 0 | 4,651,237 | 0 | 4 | 0 | false | 1 | 0 | {{ data.0 }} should work.
Let's say you wrote data.obj django tries data.obj and data.obj(). If they don't work it tries data["obj"]. In your case data[0] can be written as {{ data.0 }}. But I recommend you to pull data[0] in the view and send it as separate variable. | 1 | 137 | 0 | 0 | This may be simple, but I looked around and couldn't find an answer. What's the best way to reference a single item in a list from a Django template?
In other words, how do I do the equivalent of {{ data[0] }} within the template language? | Reference list item by index within Django template? | 1 | 1 | 1 | 0 | 0 | 132,262 |
4,651,239 | 2011-01-10T20:33:00.000 | 2 | 0 | 1 | 0 | 0 | python,scheduler | 0 | 4,651,287 | 0 | 2 | 0 | false | 0 | 0 | That's not the best solution. It's no guarantee you are locked out for more than one second.
You should stick to 0.5 second resolution (or worse if no lives depend on it) and fire the event whenever it is at or past the due time, and keep a flag per event if it has been fired. Then it will always be fired at exactly o... | 1 | 1 | 0 | 0 | I'm creating an alarm clock in python and have a simple question:
My alarm clock's resolution needs to be down to the second. Currently I have a thread that wakes every 0.5 seconds, and checks whether its time to start making noise.
My only concern is that somehow the system gets completely overloaded at some point and... | Simple alarm clock and checking time every second | 1 | 0.197375 | 1 | 0 | 0 | 1,365 |
4,652,472 | 2011-01-10T22:56:00.000 | 28 | 0 | 1 | 0 | 0 | python,vim | 0 | 4,661,417 | 0 | 3 | 0 | true | 0 | 0 | To best answer your initial question: "How to install python syntax support in Vim":
There is no need to install anything! If you have not made any modifications (e.g. no configuration changes for vim in ~/.vimrc) try the following:
Open a Python file with vim
type the following command :syntax on
You should now hav... | 2 | 14 | 0 | 0 | I recently started programming in python and have fallen in love with Vim over the past few weeks. I know want to use Vim as my primary editor for python files. I know there are python plugins for Vim, but I am very confused as to where/how I can install these. I don't really understand where Vim is installed. I'm runn... | How to install python syntax support for Vim on Mac OSX? | 1 | 1.2 | 1 | 0 | 0 | 21,812 |
4,652,472 | 2011-01-10T22:56:00.000 | 0 | 0 | 1 | 0 | 0 | python,vim | 0 | 36,414,972 | 0 | 3 | 0 | false | 0 | 0 | for mac os x, the vimrc file is located in /usr/share/vim directory
edit the vimdc file with any text editor. Add the syntax on to the last line of the file. Then next time you start a file you can see color. This is a system wide setting. In other linux flavor it may be located in /etc/ you can find this file by find... | 2 | 14 | 0 | 0 | I recently started programming in python and have fallen in love with Vim over the past few weeks. I know want to use Vim as my primary editor for python files. I know there are python plugins for Vim, but I am very confused as to where/how I can install these. I don't really understand where Vim is installed. I'm runn... | How to install python syntax support for Vim on Mac OSX? | 1 | 0 | 1 | 0 | 0 | 21,812 |
4,656,923 | 2011-01-11T11:06:00.000 | 0 | 0 | 0 | 1 | 0 | python,events,google-app-engine,login,hook | 0 | 4,663,607 | 0 | 2 | 0 | false | 1 | 0 | I'm using Python on GAE (so it may be different for Java) but have seen no documentation about such a hook for a user logging in. If you used one of the session management frameworks you'd probably get some indication for that, but otherwise I do this kind of house keeping on my opening page itself which requires login... | 1 | 7 | 0 | 0 | Every time a user logs in to the application, I want to perform a certain task, say, record the time of login. So I wanted to know if a hook is fired on login by default? If yes, how can I make my module respond to it.
Edit - Assume there are multiple entry points in the application to login. | Login hook on Google Appengine | 0 | 0 | 1 | 0 | 0 | 345 |
4,680,693 | 2011-01-13T13:44:00.000 | 0 | 0 | 0 | 1 | 1 | python,security,apache,root,privileges | 0 | 4,710,807 | 0 | 2 | 0 | true | 1 | 0 | Hello
You can easily create web applications in Python using WSGI-compliant web frameworks such as CherryPy2 and templating engines such as Genshi. You can use the 'subprocess' module to manadge external commands... | 2 | 3 | 0 | 0 | I received a project recently and I am wondering how to do something in a correct and secure manner.
The situation is the following:
There are classes to manage linux users, mysql users and databases and apache virtual hosts. They're used to automate the addition of users in a small shared-hosting environnement. These ... | Modify system configuration files and use system commands through web interface | 0 | 1.2 | 1 | 0 | 0 | 474 |
4,680,693 | 2011-01-13T13:44:00.000 | 0 | 0 | 0 | 1 | 1 | python,security,apache,root,privileges | 0 | 4,684,335 | 0 | 2 | 0 | false | 1 | 0 | You can use sudo to give the apache user root permission for only the commands/scripts you need for your web app. | 2 | 3 | 0 | 0 | I received a project recently and I am wondering how to do something in a correct and secure manner.
The situation is the following:
There are classes to manage linux users, mysql users and databases and apache virtual hosts. They're used to automate the addition of users in a small shared-hosting environnement. These ... | Modify system configuration files and use system commands through web interface | 0 | 0 | 1 | 0 | 0 | 474 |
4,683,639 | 2011-01-13T18:17:00.000 | 2 | 0 | 1 | 1 | 0 | python,ocaml | 0 | 4,684,135 | 0 | 6 | 0 | false | 0 | 0 | You can execute commands using Sys.command, so you can just do Sys.command "python foo.py", assuming python is in your path and foo.py is in the current directory. | 2 | 3 | 0 | 0 | I wanted to ask if you could call in a program written in Ocaml a program written in python , and if the answer is yes how do I do? | Call a program written in python in a program written in Ocaml | 0 | 0.066568 | 1 | 0 | 0 | 849 |
4,683,639 | 2011-01-13T18:17:00.000 | -1 | 0 | 1 | 1 | 0 | python,ocaml | 0 | 4,683,673 | 0 | 6 | 0 | false | 0 | 0 | It depends on your exact requirements, but you can use pythons os.system() to execute an program in the same way you would call it from the command line. That should be a good starting point. | 2 | 3 | 0 | 0 | I wanted to ask if you could call in a program written in Ocaml a program written in python , and if the answer is yes how do I do? | Call a program written in python in a program written in Ocaml | 0 | -0.033321 | 1 | 0 | 0 | 849 |
4,690,890 | 2011-01-14T12:10:00.000 | 0 | 0 | 0 | 0 | 1 | python,multithreading,network-programming,urllib2,mechanize | 1 | 4,691,668 | 0 | 2 | 0 | false | 0 | 0 | You could possibly be creating more threads than you expect - monitor the result of threading.active_count() to test this.
If possible try to rule out the VPN at your end (or post the relevant guts of the code so we can test it).
(Nettiquete) If you're not doing so already, only use network.http.max-connections-per-ser... | 1 | 2 | 0 | 0 | I'm writing a python script checking/monitoring several server/websites status(response time and similar stuff), it's a GUI program and I use separate thread to check different server/website, and the basic structure of each thread is using an infinite while loop to request that site every random time period(15 to 30 s... | My python program always brings down my internet connection after several hours running, how do I debug and fix this problem? | 0 | 0 | 1 | 0 | 1 | 643 |
4,694,706 | 2011-01-14T18:45:00.000 | 3 | 0 | 0 | 1 | 0 | python,pygtk,twisted,amqp,deferred | 0 | 4,695,170 | 0 | 1 | 0 | true | 0 | 0 | On the server side, how do I defer the response inside one of the servers pb methods?
Easy. Return the Deferred from the remote_ method. Done. | 1 | 2 | 0 | 0 | Background:
I have a gtk client that uses twisted and perspective broker to perform remote object execution and server/client communication. This works great for me and was a breeze to start working with.
I have amqp (Message Queue/MQ) services that I also need to communicate from the client.
I have a security model i... | Python Twisted - Prospective Broker and Server-Side Deffereds | 0 | 1.2 | 1 | 0 | 0 | 323 |
4,697,623 | 2011-01-15T01:55:00.000 | 3 | 0 | 0 | 0 | 1 | python,multithreading,network-programming,urllib2,python-multithreading | 1 | 4,697,664 | 0 | 1 | 0 | true | 1 | 0 | Are you sure you are closing TCP sessions after each request? Try to check netstat information from time to time and if you'll see that the number of active/established sessions is rising it means that you have some problems in your script.
Yes, usually you can ping even if you are out of free TCP sockets. | 1 | 0 | 0 | 0 | It's a GUI program I wrote in python checking website/server status running on my XP SP3, multi threads are used to check different site/server. After several hours running, the program starts to get urlopen error timed out all the time, and this always happens right after a POST request from a server(not a certain one... | Able to ping but cannot browse after several hours running of my python program | 0 | 1.2 | 1 | 0 | 1 | 204 |
4,707,192 | 2011-01-16T18:27:00.000 | 7 | 0 | 0 | 0 | 0 | python,django,forms | 0 | 11,547,550 | 0 | 5 | 0 | false | 1 | 0 | NOTE: There are three questions here. For the first two questions, see the fuller answer by AndiDog. I'm only answering the third question here:
Q. What widget method is responsible for going from the user's input back to the data model?
A. The value_from_datadict method -- it's sort of the inverse of a widget's render... | 1 | 63 | 0 | 1 | I am having a difficult time finding documentation on how to write a custom widget.
My questions are:
If I build a custom widget, can it be used equivalently for the admin interface or for normal forms?
If I want to allow the user to edit a list of items, what widget should I subclass? What methods of the widget do I ... | Django: How to build a custom form widget? | 0 | 1 | 1 | 0 | 0 | 51,410 |
4,709,968 | 2011-01-17T04:07:00.000 | 3 | 0 | 0 | 1 | 1 | python,c,unix | 0 | 4,709,984 | 0 | 4 | 0 | false | 0 | 0 | No portable API exists to do this in Unix. Most filesystems don't index files inside directories by their mtime (or ctime), so even if it did it probably wouldn't be any faster than doing it yourself. | 1 | 4 | 0 | 0 | I'm trying to find out the latest file in a huge filesystem. One way to do this is to go through all directories - one at a time, read its contents, select the latest file etc.
The obvious drawback is I have to get all the files in a specific directory. I was wondering whether there was a 'magic' call in Python [1] whi... | Find the most recent file in a directory without reading all the contents of it | 0 | 0.148885 | 1 | 0 | 0 | 1,636 |
4,718,588 | 2011-01-17T22:23:00.000 | 0 | 1 | 0 | 1 | 0 | python,progress-bar,tar | 0 | 4,718,870 | 0 | 5 | 0 | false | 0 | 0 | How are you adding files to the tar file? Is is through "add" with recursive=True? You could build the list of files yourself and call "add" one-by-one, showing the progress as you go. If you're building from a stream/file then it looks like you could wrap that fileobj to see the read status and pass that into addfile.... | 1 | 4 | 0 | 0 | Is there any library to show progress when adding files to a tar archive in python or alternativly would be be possible to extend the functionality of the tarfile module to do this?
In an ideal world I would like to show the overall progress of the tar creation as well as an ETA as to when it will be complete.
Any hel... | Python tarfile progress | 0 | 0 | 1 | 0 | 0 | 3,242 |
4,719,836 | 2011-01-18T02:01:00.000 | 1 | 0 | 0 | 0 | 1 | python,sql,django,sqlite | 0 | 4,724,461 | 0 | 4 | 0 | false | 0 | 0 | Use a parameterized query
and
Use a transaction. | 2 | 6 | 0 | 0 | I have a .sql file containing thousands of individual insert statements. It takes forever to do them all. I am trying to figure out a way to do this more efficiently. In python the sqlite3 library can't do things like ".read" or ".import" but executescript is too slow for that many inserts.
I installed the sqlite3... | Python and sqlite3 - adding thousands of rows | 0 | 0.049958 | 1 | 1 | 0 | 1,859 |
4,719,836 | 2011-01-18T02:01:00.000 | 2 | 0 | 0 | 0 | 1 | python,sql,django,sqlite | 0 | 13,787,939 | 0 | 4 | 0 | false | 0 | 0 | In addition to running the queries in bulk inside a single transaction, also try VACUUM and ANALYZEing the database file. It helped a similar problem of mine. | 2 | 6 | 0 | 0 | I have a .sql file containing thousands of individual insert statements. It takes forever to do them all. I am trying to figure out a way to do this more efficiently. In python the sqlite3 library can't do things like ".read" or ".import" but executescript is too slow for that many inserts.
I installed the sqlite3... | Python and sqlite3 - adding thousands of rows | 0 | 0.099668 | 1 | 1 | 0 | 1,859 |
4,720,073 | 2011-01-18T02:52:00.000 | 1 | 0 | 1 | 0 | 0 | python,loops,time,permutation,while-loop | 0 | 4,720,112 | 0 | 3 | 0 | false | 0 | 0 | There's a very hacky way to do this by using time.asctime(). You store the asctime before entering the while loop and somewhere in the loop itself. Calculate the time difference between the stored time and the current time and if that difference is 10 seconds, then update the stored time to the current time and print t... | 1 | 7 | 0 | 0 | i have a loop that runs for up to a few hours at a time. how could I have it tell me how long it has been at a set interval?
just a generic...question
EDIT: it's a while loop that runs permutations, so can i have it print the time running every 10 seconds? | python -> time a while loop has been running | 0 | 0.066568 | 1 | 0 | 0 | 9,699 |
4,720,363 | 2011-01-18T04:00:00.000 | 0 | 0 | 1 | 0 | 0 | python,time,brute-force,combinations | 0 | 4,720,383 | 0 | 3 | 0 | false | 0 | 0 | How long as in time?
from time import time on top, at the start of the program do start = time(). at the nameerror part do print time() - start
please be a bit more specific | 1 | 1 | 0 | 0 | i decided to write a brute force function to show people how vulnerable a password is. right now, i can show them the list it goes through to find the password, but how do i tell them how long it took?
here's the code:
#!/usr/bin/python
import itertools
lower_a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k... | python -> password safety program | 0 | 0 | 1 | 0 | 0 | 521 |
4,731,352 | 2011-01-19T03:00:00.000 | 0 | 0 | 0 | 0 | 0 | python,django,django-models,django-settings,django-fixtures | 0 | 4,731,825 | 0 | 2 | 0 | false | 1 | 0 | The easiest way is to use manage.py testserver [fixture ...]
If this is a staging (rather than dev) deployment, though, you may not want to use django's builtin server. In that case, a quick (if hacky) way of doing what you're after is to have the fixtures in an app (called, for example, "undeployed") that is only inst... | 1 | 2 | 0 | 0 | I have an initial_data fixture that I want to load everytime except for production. I already have different settings file for production and non-production deployments.
Any suggestions on how to accomplish this?
Clarification: I do not want test fixtures. Basically, I just need the fixture to be loaded based on a sett... | Have different initial_data fixtures for different stages (testing v. production) | 0 | 0 | 1 | 0 | 0 | 490 |
4,737,814 | 2011-01-19T16:24:00.000 | 0 | 0 | 1 | 0 | 0 | python,string | 0 | 4,738,130 | 0 | 3 | 0 | false | 0 | 0 | No 3:
If your string is s:
max((j-i,s[i:j]) for i in range(len(s)-1) for j in range(i+2,len(s)+1) if s[i:j]==s[j-1:i-1:-1])[1]
will return the answer. | 1 | 2 | 0 | 0 | I'm new to Python and am currently reading a chapter on String manipulation in "Dive into Python."
I was wondering what are some of the best (or most clever/creative) ways to do the following:
1) Extract from this string: "stackoverflow.com/questions/ask" the word 'questions.' I did string.split(/)[0]-- but that isn... | Python: Clever ways at string manipulation | 0 | 0 | 1 | 0 | 0 | 975 |
4,743,497 | 2011-01-20T04:40:00.000 | 0 | 0 | 1 | 0 | 1 | python,coding-style,conventions | 0 | 4,743,712 | 0 | 4 | 0 | false | 0 | 0 | Python actually gives you the choice to package your code in the way you see fit.
The analogy between Python and Java is that a file i.e., the .py file in Python is
equivalent to a package in Java as in it can contain many related classes and functions.
For good examples, have a look in the Python built-in modules.
Ju... | 3 | 30 | 0 | 0 | In Java, this question is easy (if a little tedious) - every class requires its own file. So the number of .java files in a project is the number of classes (not counting anonymous/nested classes).
In Python, though, I can define multiple classes in the same file, and I'm not quite sure how to find the point at which I... | When should a Python script be split into multiple files/modules? | 0 | 0 | 1 | 0 | 0 | 8,928 |
4,743,497 | 2011-01-20T04:40:00.000 | 3 | 0 | 1 | 0 | 1 | python,coding-style,conventions | 0 | 4,744,148 | 0 | 4 | 0 | false | 0 | 0 | As I see it, this is really a question about reuse and abstraction. If you have a problem that you can solve in a very general way, so that the resulting code would be useful in many other programs, put it in its own module.
For example: a while ago I wrote a (bad) mpd client. I wanted to make configuration file and o... | 3 | 30 | 0 | 0 | In Java, this question is easy (if a little tedious) - every class requires its own file. So the number of .java files in a project is the number of classes (not counting anonymous/nested classes).
In Python, though, I can define multiple classes in the same file, and I'm not quite sure how to find the point at which I... | When should a Python script be split into multiple files/modules? | 0 | 0.148885 | 1 | 0 | 0 | 8,928 |
4,743,497 | 2011-01-20T04:40:00.000 | 2 | 0 | 1 | 0 | 1 | python,coding-style,conventions | 0 | 4,743,655 | 0 | 4 | 0 | false | 0 | 0 | In Java ... every class requires its own file.
On the flipside, sometimes a Java file, also, will include enums or subclasses or interfaces, within the main class because they are "closely related."
not counting anonymous/nested classes
Anonymous classes shouldn't be counted, but I think tasteful use of nested clas... | 3 | 30 | 0 | 0 | In Java, this question is easy (if a little tedious) - every class requires its own file. So the number of .java files in a project is the number of classes (not counting anonymous/nested classes).
In Python, though, I can define multiple classes in the same file, and I'm not quite sure how to find the point at which I... | When should a Python script be split into multiple files/modules? | 0 | 0.099668 | 1 | 0 | 0 | 8,928 |
4,752,451 | 2011-01-20T20:52:00.000 | 1 | 1 | 1 | 0 | 0 | python,string,content-type | 0 | 4,752,526 | 0 | 4 | 0 | false | 0 | 0 | If the file is downloaded from a webserver, you should have a content-type to look at, however you are at the mercy of the webserver whether or not it truly describes the type of the file.
Another alternative would be to use a heuristic to guess the file type. This can often be done by looking at the first few bytes of... | 2 | 2 | 0 | 0 | I receive some data as a string. I need to write the data to a file, but the problem is that sometimes the data is compressed/zipped and sometimes it's just plain text. I need to determine the content-type so I know whether to write it to a .txt file or a .tgz file. Any ideas on how to accomplish this? Can I use mi... | How to determine content type of a string | 0 | 0.049958 | 1 | 0 | 0 | 2,383 |
4,752,451 | 2011-01-20T20:52:00.000 | 1 | 1 | 1 | 0 | 0 | python,string,content-type | 0 | 4,752,565 | 0 | 4 | 0 | true | 0 | 0 | Both gzip and zip use distinct headers before compressed data, rather unlikely for human-readable strings. If the choice is only between these, you can make a faster check than mimetypes would provide. | 2 | 2 | 0 | 0 | I receive some data as a string. I need to write the data to a file, but the problem is that sometimes the data is compressed/zipped and sometimes it's just plain text. I need to determine the content-type so I know whether to write it to a .txt file or a .tgz file. Any ideas on how to accomplish this? Can I use mi... | How to determine content type of a string | 0 | 1.2 | 1 | 0 | 0 | 2,383 |
4,758,855 | 2011-01-21T12:36:00.000 | 3 | 0 | 1 | 1 | 0 | python,path,working-directory | 0 | 4,758,914 | 0 | 3 | 0 | false | 0 | 0 | You'd typically use os.listdir('.') for this purpose. If you need a standard module, the variable os.curdir is available. | 1 | 0 | 0 | 0 | I want to use the function os.listdir(path) to get a list of files from the directory I'm running the script in, but how do I say the current directory in the "path" argument? | How do I refer to the current directory in functions from the Python 'os' module? | 0 | 0.197375 | 1 | 0 | 0 | 6,837 |
4,763,965 | 2011-01-21T21:27:00.000 | 3 | 0 | 1 | 0 | 0 | python,scope | 0 | 4,764,004 | 0 | 6 | 0 | true | 0 | 0 | This is not how nonlocal works. It doesn't provide dynamic scoping (which is just a huge PITA waiting to happen and even more rarely useful than your average "evil" feature). It just fixes up lexical scoping.
Anyway, you can't do what you have in mind (and I would say that this is a good thing). There's not even a dirt... | 1 | 8 | 0 | 0 | Say, I have some scope with variables, and a function called in this scope wants to change some immutable variables:
def outer():
s = 'qwerty'
n = 123
modify()
def modify():
s = 'abcd'
n = 456
Is it possible somehow to access the outer scope? Something like nonlocal variables from Py3k.
Sure I ca... | Accessing the outer scope in Python 2.6 | 1 | 1.2 | 1 | 0 | 0 | 11,146 |
4,777,262 | 2011-01-23T23:25:00.000 | 1 | 0 | 0 | 1 | 0 | python,django,installation | 0 | 4,777,646 | 0 | 3 | 0 | false | 1 | 0 | Get him to set up a virtual machine on his Mac, using VMWare Fusion or Parallels, running the same operating system that you currently use for your back end. If he prefers developing using Mac tools he can do still that by sharing his local changes to the virtual machine via a shared directory. | 2 | 1 | 0 | 0 | Hey everyone,
I am expanding my team and I have recently added an additional front end engineer on my site. I am currently using django to run my site but my site is using a lot of plugins, namely: django-celery, django-mailer, django-notification, and django-socialregistration.
Let me describe my situation:
He is us... | Easiest way to share work between backend and front end | 0 | 0.066568 | 1 | 0 | 0 | 181 |
4,777,262 | 2011-01-23T23:25:00.000 | 0 | 0 | 0 | 1 | 0 | python,django,installation | 0 | 4,777,381 | 0 | 3 | 0 | false | 1 | 0 | An alternative, if that's possible, would be to set up a testing/development environment on a machine with an OS you're familiar with, then install something like Dropbox on his local machine where he can develop the frontend code, and install Dropbox on that other environment with the backend components. Dropbox would... | 2 | 1 | 0 | 0 | Hey everyone,
I am expanding my team and I have recently added an additional front end engineer on my site. I am currently using django to run my site but my site is using a lot of plugins, namely: django-celery, django-mailer, django-notification, and django-socialregistration.
Let me describe my situation:
He is us... | Easiest way to share work between backend and front end | 0 | 0 | 1 | 0 | 0 | 181 |
4,789,021 | 2011-01-25T01:09:00.000 | 0 | 0 | 0 | 0 | 0 | python,django,django-authentication | 0 | 50,211,377 | 0 | 13 | 0 | false | 1 | 0 | User.objects.filter(username='tom', groups__name='admin').exists()
That query will inform you user : "tom" whether belong to group "admin " or not | 2 | 179 | 0 | 0 | I created a custom group in Django's admin site.
In my code, I want to check if a user is in this group. How do I do that? | In Django, how do I check if a user is in a certain group? | 0 | 0 | 1 | 0 | 0 | 149,841 |
4,789,021 | 2011-01-25T01:09:00.000 | 11 | 0 | 0 | 0 | 0 | python,django,django-authentication | 0 | 32,197,405 | 0 | 13 | 0 | false | 1 | 0 | If a user belongs to a certain group or not, can be checked in django templates using:
{% if group in request.user.groups.all %}
"some action"
{% endif %} | 2 | 179 | 0 | 0 | I created a custom group in Django's admin site.
In my code, I want to check if a user is in this group. How do I do that? | In Django, how do I check if a user is in a certain group? | 0 | 1 | 1 | 0 | 0 | 149,841 |
4,791,815 | 2011-01-25T09:35:00.000 | 5 | 0 | 1 | 0 | 0 | python,multithreading,ubuntu-9.10 | 0 | 4,794,288 | 0 | 1 | 0 | false | 0 | 0 | Short answer: Just make the def run() end.
So, if you are waiting for data from a socket, do it with timeout, then if timeout occur just break the while that you should have, and the thread will be killed.
You can check from main thread if a thread is alive with isAlive() method. | 1 | 7 | 0 | 0 | I'm writing a multi threaded Python app that makes many TCP connections to servers. Each connection is done on a separate thread. Sometimes the thread hangs for a long time which I don't want. How can I get the thread to kill itself after some given time period? From the main thread how can I determine that the child t... | Python: how can I get a thread to kill itself after a timeout? | 0 | 0.761594 | 1 | 0 | 0 | 8,125 |
4,793,250 | 2011-01-25T12:03:00.000 | -2 | 0 | 1 | 0 | 1 | python,pyqt4,xmpppy | 1 | 50,261,727 | 0 | 2 | 0 | false | 0 | 1 | when a python script .py has any error it shows in console but when you run python .exe file it genrates .exe.log file when error accured.so go to your folder and see that there is a .exe.log file is there showing errors. | 1 | 0 | 0 | 0 | I have made an application using Python and recently i found that i can use py2exe to make executables for windows.
The problem is that a library i am using (xmpppy) produces this error
DeprecationWarning: the md5 module is deprecated; use hashlib instead
and when i try to run the executable a dialog appears saying t... | PyQt4 - "See the log file for details" error | 1 | -0.197375 | 1 | 0 | 0 | 974 |
4,800,858 | 2011-01-26T02:16:00.000 | 4 | 0 | 1 | 0 | 0 | python,data-structures | 0 | 4,800,884 | 0 | 3 | 0 | false | 0 | 0 | If you have uniform types of numbers & if speed is your primary goal (and you want to use python), use a Numpy array. | 1 | 4 | 0 | 0 | If I have a list with say 10 million objects, how do I filter the list quickly. It takes about 4-5 seconds for a complete iteration thru a list comprehension. Are there any efficient data structures or libraries for this in python? Or is python not suited for large sets of data? | Filtering / iterating through very large lists in python | 0 | 0.26052 | 1 | 0 | 0 | 6,918 |
4,801,216 | 2011-01-26T03:40:00.000 | 2 | 0 | 0 | 0 | 0 | iphone,python,cocoa,restful-authentication,web2py | 0 | 4,809,129 | 0 | 2 | 0 | true | 1 | 0 | I think you should post it to web2py group on google groups.
web2py@googlegroups.com | 1 | 2 | 0 | 0 | I want to configure a simple webapplication to support an iphone app to connect with it in RESTFUL ways. Initially have a user login session enabled from the iphone to the web app. I'd like the iphone app to send a NSURL call to the webapp, with user and password and have the webapp respond if the suer exists or not. P... | can web2py support RESTful api calls? if so any pointers on how to build one?I | 1 | 1.2 | 1 | 0 | 0 | 990 |
4,802,134 | 2011-01-26T07:10:00.000 | 0 | 0 | 0 | 0 | 0 | wxpython,textctrl | 0 | 4,807,514 | 0 | 1 | 0 | false | 0 | 1 | If all you're doing is showing one file, then all you need is one TextCtrl. I would give the widget the wx.TE_MULTILINE style and add it to a sizer with an EXPAND flag:
sizer.Add(myTxtCtrl, 0, wx.EXPAND)
Then the user can see the file and you can save the data with a Save button or menu item. The handler for that would... | 1 | 0 | 0 | 0 | I am trying to build my first wx application
I have a browse button in my panel, the user adds his file. i do some processing on the file.
Now i want to show the information in a TextCtrl so that the user may modify it. Then i need to write it in a file.
But I dont know how many TextCtrl box is needed before processing... | wxPython: TextCtrl problem | 0 | 0 | 1 | 0 | 0 | 439 |
4,806,911 | 2011-01-26T16:17:00.000 | 8 | 0 | 1 | 0 | 0 | python,string,comparison | 0 | 4,809,303 | 0 | 8 | 0 | false | 0 | 0 | Python and just about every other computer language use the same principles as (I hope) you would use when finding a word in a printed dictionary:
(1) Depending on the human language involved, you have a notion of character ordering: 'a' < 'b' < 'c' etc
(2) First character has more weight than second character: 'az'... | 2 | 82 | 0 | 0 | I'm wondering how Python does string comparison, more specifically how it determines the outcome when a less than < or greater than > operator is used.
For instance if I put print('abc' < 'bac') I get True. I understand that it compares corresponding characters in the string, however its unclear as to why there is more... | How are strings compared? | 0 | 1 | 1 | 0 | 0 | 132,841 |
4,806,911 | 2011-01-26T16:17:00.000 | 0 | 0 | 1 | 0 | 0 | python,string,comparison | 0 | 69,465,704 | 0 | 8 | 0 | false | 0 | 0 | The comparison uses lexicographical ordering
For Python 3: Convert it into Unicode to get its order or number that is being used as "weightage" here
For Python 2: Use ASCII to get its order or number that is being used as "weightage" here
People already answered it in detail, I am leaving it here for anyone who is in a... | 2 | 82 | 0 | 0 | I'm wondering how Python does string comparison, more specifically how it determines the outcome when a less than < or greater than > operator is used.
For instance if I put print('abc' < 'bac') I get True. I understand that it compares corresponding characters in the string, however its unclear as to why there is more... | How are strings compared? | 0 | 0 | 1 | 0 | 0 | 132,841 |
4,807,957 | 2011-01-26T17:46:00.000 | 4 | 0 | 0 | 1 | 0 | python,google-app-engine,expando | 0 | 4,812,503 | 0 | 1 | 0 | true | 1 | 0 | All properties are automatically indexed for simple queries. Simple queries, in this case, are those that either:
Use only equality filters, with no sort orders or inequality filters.
Have an inequality filter or sort order on a single field, with no other filters.
If you want to do more complex queries - such as one... | 1 | 3 | 0 | 0 | The google app engine python sdk offers an Expando type object which can be used for adding dynamic properties to an object that can be persisted to the datastore.
The app engine also requires that for any property on which the objects need to be searched or sorted, an index must be created before uploading the app to ... | Automatic indexes for expando properties in the google app engine for python | 1 | 1.2 | 1 | 0 | 0 | 663 |
4,818,342 | 2011-01-27T15:33:00.000 | 2 | 0 | 1 | 0 | 0 | python,pdf,ms-word | 0 | 4,819,159 | 0 | 3 | 0 | false | 0 | 0 | Install a PDF printer driver like CutePDF.
Use COM automation to run MS Word; open the file, fill in the data, print the file as a PDF.
Alternatively: convert the Word file into a PDF form; use ReportLab to fill in the form.
Alternatively: print the Word file to a PDF file; use ReportLab to overlay text on the file. | 1 | 4 | 0 | 0 | I need to fill in a document and then try and convert it into a PDF.
Any idea how I can do this? | Convert Word doc to PDF - Python | 0 | 0.132549 | 1 | 0 | 0 | 13,293 |
4,822,860 | 2011-01-27T22:48:00.000 | -1 | 0 | 0 | 0 | 0 | python,proxy,urllib2 | 0 | 4,823,009 | 0 | 1 | 0 | true | 0 | 0 | ProxyHandler can use a different proxy for different protocols (HTTP, etc.) but I don't think it will help you. You should be able to write your own class for your needs without much difficulty. | 1 | 0 | 0 | 0 | Hello
I'm have a task - create script, what will walk in internet and change proxy from list.
I'm see in module urllib2: ProxyHandler and HTTPPasswordMgr, but manual is poor.
1. In documentation ProxyHandler get dict with many proxy-server, how to I'm can select from list and use for url_open?
2. HTTPPasswordMgr have m... | How to use multiple proxy in urllib2? | 0 | 1.2 | 1 | 0 | 1 | 1,084 |
4,826,686 | 2011-01-28T09:36:00.000 | 1 | 1 | 1 | 1 | 0 | python,bash,shell | 0 | 4,826,733 | 0 | 3 | 0 | false | 0 | 0 | You can use os.system or subprocess.Popen or subprocess.call but when using subprocess methods make sure you use shell=True. And executing it via system call in all these methods is blocking. The python script will complete and then go the next step. | 1 | 5 | 0 | 0 | Will it continue the code after it's run? Or will it stop at that line until the script is done? | Inside python code, how do I run a .sh script? | 0 | 0.066568 | 1 | 0 | 0 | 32,061 |
4,826,896 | 2011-01-28T09:59:00.000 | 1 | 1 | 0 | 0 | 0 | c++,python,optimization,interaction | 0 | 4,827,083 | 0 | 5 | 0 | false | 0 | 1 | Firstly, just to be pedantic, there are no C++ scripts in normal use. C++ compiles, ultimately, to machine code, and the C++ program is properly referred to as a "program" and not a "script".
But to answer your question, you could indeed set up the C++ program to stay in memory, where it listens for connections and sen... | 1 | 1 | 0 | 0 | I am trying to optimize the interaction between two scripts I have.
Two things I thought of are the c++ program not terminating unless you manually kill it, or generating all info in python before feeding it to c++.
Explanation of the problem:
What the scripts do:
C++ program (not made by me, and I can't program in c++... | Python and C++ script interaction | 0 | 0.039979 | 1 | 0 | 0 | 2,200 |
4,834,533 | 2011-01-29T01:33:00.000 | 1 | 0 | 1 | 0 | 0 | python,module,egg | 0 | 6,228,872 | 0 | 1 | 1 | false | 0 | 0 | Note that you have 2 different site-packages locations; one is /usr/lib/python2.5/site-packages and the other is /usr/local/FOLDER/lib/python2.5/site-packages.
The egg in the latter location is being preferred over the egg in the first location when the latter location comes first in your PYTHON_PATH. In iPython, you c... | 1 | 0 | 0 | 0 | I've updated a Python egg that is only being used locally. The update proceeded correctly and installed into /usr/lib/python2.5/site-packages/eggName-UpdatedVersionNumber-py2.5.egg
However, when I open iPython and try to import the egg, I still get the old version.
Running egg_name.__file__ gives me:
/usr/local/FOLDE... | How to get iPython to use Updated Egg/Module | 0 | 0.197375 | 1 | 0 | 0 | 593 |
4,836,450 | 2011-01-29T10:49:00.000 | 1 | 1 | 0 | 1 | 1 | python | 1 | 4,851,152 | 0 | 1 | 0 | false | 0 | 0 | Hi I dnt know y the error occurs but when i directed the print statements from my script to another file this error did not come and my script ran successfully
Example: Myscript.py > test.log | 1 | 2 | 0 | 0 | I am running a Python script which downloads PDF files from the FTP. The script when run manually works perfectly but when i put it in crontab in my ubuntu machine and execute it i get a an error [Errno 32] Broken pipe. Any idea why this happens and how do i handle this? | [Errno 32]Broken pipe in Python Script in Crontab | 0 | 0.197375 | 1 | 0 | 0 | 1,316 |
4,838,504 | 2011-01-29T18:04:00.000 | 7 | 0 | 1 | 0 | 0 | python,list | 0 | 4,838,530 | 0 | 6 | 0 | false | 0 | 0 | The items[:100] other mentioned gives you a new list which contains the first 100 items of items. If you want to modify the list in-place, either use items[:] = items[:100] (slice assignment) or while len(items) > 100: items.pop()use del items[100:] as proposed by Ned Batchelder. | 1 | 47 | 0 | 0 | If I have a list and want to truncate it so it is no more than 100 items, how do I do this? | How do I truncate a list? | 0 | 1 | 1 | 0 | 0 | 58,602 |
4,840,182 | 2011-01-29T23:41:00.000 | 15 | 0 | 1 | 1 | 0 | python | 0 | 9,478,011 | 0 | 4 | 0 | false | 0 | 0 | If you're willing to build and install the entire python package, this is how I would go about it:
Edit the setup() function in setup.py to contain a parameter named scripts and set its argument as the location of the file(s) you wish to run from anywhere. e.g.
setup(name='myproject',author='',author_email='',script... | 1 | 81 | 0 | 0 | I can't figure out how to make setup.py add a scrip to the the user's /bin or /usr/bin or whatever.
E.g., I'd like to add a myscript.py to /usr/bin so that the user can call myscript.py from any directory. | setup.py and adding file to /bin/ | 0 | 1 | 1 | 0 | 0 | 48,656 |
4,841,732 | 2011-01-30T07:33:00.000 | 3 | 0 | 1 | 0 | 1 | python,python-2.x | 0 | 4,842,269 | 0 | 5 | 0 | false | 0 | 0 | There is no quantity 1/2 anywhere. Python does not represent rational numbers with a built-in type - just integers and floating-point numbers. 1 is divided by 2 - following the integer division rules - resulting in 0. float(0) is 0. | 1 | 14 | 0 | 0 | I want to convert 1/2 in python so that when i say print x (where x = 1/2) it returns 0.5
I am looking for the most basic way of doing this, without using any split functions, loops or maps
I have tried float(1/2) but I get 0...
can someone explain me why and how to fix it?
Is it possible to do this without modifying t... | Convert fraction to decimal in Python | 1 | 0.119427 | 1 | 0 | 0 | 52,481 |
4,854,486 | 2011-01-31T18:18:00.000 | 2 | 0 | 0 | 0 | 0 | user-interface,redirect,event-handling,wxpython,stdin | 0 | 4,854,744 | 0 | 1 | 1 | true | 0 | 1 | When you type, the input comes from the GUI event mechanism, not from stdin. You asked how to get the "keyboard stdin", and the answer to that is the same as for any other type of program: you read it (but it will almost certainly be empty). It's important to realize that the GUI probably doesn't have a stdin if it was... | 1 | 0 | 0 | 0 | I am quite confused about the stdin and the key_events of GUI widget.
Usually in my mind, I thought stdin is the ordinary way to get the keyboard input for a process. E.g., If I have a process, then I could use stdin to have the keyboard inputs. And this is usually used to make I/O direction for the subprocess to get k... | key_events of GUI widget and stdin | 0 | 1.2 | 1 | 0 | 0 | 405 |
4,862,346 | 2011-02-01T12:08:00.000 | 1 | 1 | 0 | 1 | 0 | python,shell,latex | 0 | 4,862,410 | 0 | 7 | 0 | false | 0 | 0 | Not much of a python man myself. But in a pinch, assuming you're on linux, you could periodically shell out and "ls -lrt /path/to/directory" (get the directory contents and sort by last modified), and compare the results of the last two calls for a difference. If so, then there was a change. Not very detailed, but gets... | 1 | 6 | 0 | 0 | I have a program that create files in a specific directory.
When those files are ready, I run Latex to produce a .pdf file.
So, my question is, how can I use this directory change as a trigger
to call Latex, using a shell script or a python script?
Best Regards | Check if the directory content has changed with shell script or python | 0 | 0.028564 | 1 | 0 | 0 | 4,757 |
4,869,315 | 2011-02-01T23:46:00.000 | 3 | 0 | 0 | 1 | 0 | python,bash,osx-snow-leopard,twisted,.bash-profile | 0 | 4,869,690 | 0 | 4 | 0 | true | 0 | 0 | You'll need to install Twisted into your Python 2.7 installation somehow. The "2.6" in that path should be a hint that you shouldn't be trying to tell Python 2.7 about it. Among other things:
Extension modules are not compatible between python versions. You may get a segfault if you try to use them.
Bytecode forma... | 3 | 1 | 0 | 0 | I have a new MacBook Pro running OS X 10.6.6 / Snow Leopard -- which ships with Python 2.6, although I have installed 2.7.1
Unfortunately, this doesn't seem to see the Twisted install in the 2.6/Extras/lib/python/twisted directory, as I find I'm unable to import modules that I can see are present in that directory.
"wh... | Python 2.7.1 can't see Twisted | 0 | 1.2 | 1 | 0 | 0 | 2,965 |
4,869,315 | 2011-02-01T23:46:00.000 | 2 | 0 | 0 | 1 | 0 | python,bash,osx-snow-leopard,twisted,.bash-profile | 0 | 4,869,359 | 0 | 4 | 0 | false | 0 | 0 | Create an environment using virtualenv.
Install Twisted in your newly created environment using pip. | 3 | 1 | 0 | 0 | I have a new MacBook Pro running OS X 10.6.6 / Snow Leopard -- which ships with Python 2.6, although I have installed 2.7.1
Unfortunately, this doesn't seem to see the Twisted install in the 2.6/Extras/lib/python/twisted directory, as I find I'm unable to import modules that I can see are present in that directory.
"wh... | Python 2.7.1 can't see Twisted | 0 | 0.099668 | 1 | 0 | 0 | 2,965 |
4,869,315 | 2011-02-01T23:46:00.000 | 3 | 0 | 0 | 1 | 0 | python,bash,osx-snow-leopard,twisted,.bash-profile | 0 | 4,869,332 | 0 | 4 | 0 | false | 0 | 0 | You'll have to install twisted using python 2.7.
Also, python doesn't look up what's in the PATH variable for imports, it looks in PYTHONPATH. But just putting your python 2.6 folder in your pythonpath isn't a very good solution. | 3 | 1 | 0 | 0 | I have a new MacBook Pro running OS X 10.6.6 / Snow Leopard -- which ships with Python 2.6, although I have installed 2.7.1
Unfortunately, this doesn't seem to see the Twisted install in the 2.6/Extras/lib/python/twisted directory, as I find I'm unable to import modules that I can see are present in that directory.
"wh... | Python 2.7.1 can't see Twisted | 0 | 0.148885 | 1 | 0 | 0 | 2,965 |
4,876,799 | 2011-02-02T16:08:00.000 | 0 | 0 | 0 | 0 | 0 | python,web-scraping,scrapy | 0 | 4,889,635 | 0 | 2 | 0 | false | 1 | 0 | Why don't you want to add all the links to 50 pages? Are the URLs of the pages consecutive like www.site.com/page=1, www.site.com/page=2 or are they all distinct? Can you show me the code that you have now? | 2 | 1 | 0 | 0 | I have recently started to work with Scrapy. I am trying to gather some info from a large list which is divided into several pages(about 50). I can easily extract what I want from the first page including the first page in the start_urls list. However I don't want to add all the links to these 50 pages to this list. I ... | Recursive use of Scrapy to scrape webpages from a website | 1 | 0 | 1 | 0 | 1 | 1,171 |
4,876,799 | 2011-02-02T16:08:00.000 | 1 | 0 | 0 | 0 | 0 | python,web-scraping,scrapy | 0 | 4,940,212 | 0 | 2 | 0 | false | 1 | 0 | use urllib2 to download a page. Then use either re (regular expressions) or BeautifulSoup (an HTML parser) to find the link to the next page you need. Download that with urllib2. Rinse and repeat.
Scapy is great, but you dont need it to do what you're trying to do | 2 | 1 | 0 | 0 | I have recently started to work with Scrapy. I am trying to gather some info from a large list which is divided into several pages(about 50). I can easily extract what I want from the first page including the first page in the start_urls list. However I don't want to add all the links to these 50 pages to this list. I ... | Recursive use of Scrapy to scrape webpages from a website | 1 | 0.099668 | 1 | 0 | 1 | 1,171 |
4,877,959 | 2011-02-02T17:53:00.000 | 2 | 0 | 1 | 0 | 0 | python,linux,pyqt4 | 0 | 4,878,854 | 0 | 1 | 0 | false | 0 | 1 | PyQt4 and Qt are cross-platform. If you write cross-platform code, you don't need to develop on any specific OS. Testing on different platforms from time to time is a good idea, but good cross-platform code will usually just work.
Don't use any Windows-specific features, Windows-specific code. In particular, don't use ... | 1 | 1 | 0 | 0 | I am trying to use PyQt4. I have downloaded its LINUX version and trying to install it with Cygwin(because I have windows on my PC and I want to use linux, therefore I am using Cygwin). I don't know how to install it ? please guide me . There is no such file like setup.py, install....what should I do?? | pyqt4 on Linux environment | 0 | 0.379949 | 1 | 0 | 0 | 526 |
4,880,818 | 2011-02-02T22:45:00.000 | 0 | 1 | 1 | 1 | 0 | python,rpm,rhel5 | 0 | 4,935,001 | 0 | 3 | 0 | false | 0 | 0 | If you are on RHEL then you could seriously consider using the yum APIs instead of rpm-python directly ... the API is much easier to use. | 1 | 1 | 0 | 1 | Trying to learn how to use the rpm-python module (i.e. "import rpm" on RHEL5). I can't find any tutorials that are complete or recent. Specifically regarding how to install and manage rpm's on a system. Anyone? | Where is the most authoritative/complete source of documentation on rpm-python module? | 0 | 0 | 1 | 0 | 0 | 658 |
4,883,541 | 2011-02-03T07:41:00.000 | 1 | 0 | 0 | 1 | 1 | python | 0 | 4,883,551 | 0 | 2 | 0 | false | 0 | 0 | you have to start the process as root. You can run "sudo yourscript.py" as your normal user account or log in as root or run "su -" to become root and then run your script.
Your script cannot obtain root privileges after it starts running. That's just not how unix/linux systems work. | 1 | 1 | 0 | 0 | hi everybody
i wanna take a dir from one directory and os doesn't allow me to do this work(for example /etc/openvpn in linux) and i know i should be root but i don't know how can i do this with python. | access denied in python | 0 | 0.099668 | 1 | 0 | 0 | 757 |
4,898,066 | 2011-02-04T12:39:00.000 | 0 | 0 | 0 | 0 | 0 | python,http,xmlhttprequest | 0 | 4,898,364 | 0 | 3 | 0 | false | 1 | 0 | There's absolutely no need to write your own web server. Plenty of options exist, including lightweight ones like nginx.
You should use one of those, and either your own custom WSGI code to receive the request, or (better) one of the microframeworks like Flask or Bottle. | 1 | 1 | 0 | 0 | I am currently working on a project to create simple file uploader site that will update the user of the progress of an upload.
I've been attempting this in pure python (with CGI) on the server side but to get the progress of the file I obviously need send requests to the server continually. I was looking to use AJAX ... | Creating a python web server to recieve XML HTTP Requests | 0 | 0 | 1 | 0 | 1 | 1,735 |
4,909,306 | 2011-02-05T19:57:00.000 | 2 | 1 | 0 | 0 | 0 | java,python,templates,web-frameworks | 0 | 4,909,342 | 0 | 4 | 0 | false | 1 | 0 | It may sound strange, but there's no need to know "how web development is performed in Python" to start doing it.
In fact, working with language/framework/etc is a single most reliable way to get understanding of it. You won't gain a lot from one-page summaries.
Also, comparing it with Java isn't likely to help. There'... | 2 | 6 | 0 | 0 | I am thinking in starting a personal pet web project to experiment with different things and extend my knowledge.
I use Java a lot at work (for web applications :D) and was thinking in making my own in Python since I kinda like this language but never passed the simple scripts stages.
I want to step up a gear regardi... | Python web frameworks vs Java web frameworks (how is web development in Python done?) | 0 | 0.099668 | 1 | 0 | 0 | 5,940 |
4,909,306 | 2011-02-05T19:57:00.000 | 3 | 1 | 0 | 0 | 0 | java,python,templates,web-frameworks | 0 | 6,586,407 | 0 | 4 | 0 | false | 1 | 0 | hi try bottle python framework (bottle.paws.de / bottlepy.org) its really nice to use blistering fast and gets out of your way + the best thing about it is that its one single file to import, i recently migrated from PHP and i have to tell you am so ... loving it! | 2 | 6 | 0 | 0 | I am thinking in starting a personal pet web project to experiment with different things and extend my knowledge.
I use Java a lot at work (for web applications :D) and was thinking in making my own in Python since I kinda like this language but never passed the simple scripts stages.
I want to step up a gear regardi... | Python web frameworks vs Java web frameworks (how is web development in Python done?) | 0 | 0.148885 | 1 | 0 | 0 | 5,940 |
4,910,510 | 2011-02-05T23:48:00.000 | 1 | 0 | 0 | 0 | 0 | python,algorithm,gps,gis,data-mining | 0 | 4,919,289 | 0 | 2 | 0 | false | 0 | 0 | 1) Extracting trajectories
I think you are in right direction. There are probably will be some noise in gps data, and random walking, you should do some smooth like splines to overcome it.
2) Mining the trajectories
Is there are any business sense in similar trajectories? (This will help build distance metric and th... | 1 | 10 | 1 | 0 | I've got 2 questions on analyzing a GPS dataset.
1) Extracting trajectories I have a huge database of recorded GPS coordinates of the form (latitude, longitude, date-time). According to date-time values of consecutive records, I'm trying to extract all trajectories/paths followed by the person. For instance; say from t... | Comparing/Clustering Trajectories (GPS data of (x,y) points) and Mining the data | 0 | 0.099668 | 1 | 0 | 0 | 6,451 |
4,910,541 | 2011-02-05T23:54:00.000 | 1 | 1 | 0 | 0 | 0 | php,python,eclipse,configuration | 0 | 4,910,592 | 0 | 1 | 0 | true | 0 | 0 | you shouldn't have to do anything to eclipse, or any editor, if php\python is installed you can call them from the command line. | 1 | 1 | 0 | 0 | I want to run php or python scripts from eclipse that will create folders and files and give them content. I think I know what to write for the php or python code but I am having trouble on what I need to do in eclipse to run my script. I would also like to provide my script with arguments such as folder names through ... | configurations eclipse | 0 | 1.2 | 1 | 0 | 0 | 132 |
4,931,244 | 2011-02-08T09:10:00.000 | 1 | 1 | 0 | 1 | 0 | python,bluetooth,ubuntu-10.10 | 0 | 4,931,264 | 0 | 1 | 0 | true | 0 | 0 | Invoke org.bluez.Adapter.SetProperty(u'Name', u'New name here') in the /org/bluez/<pid>/<device> object path on the org.bluez D-Bus bus. | 1 | 0 | 0 | 0 | I'm using PyBluez on Ubuntu 10.10. I would like to know how is possible to change the bluetooth name of the local device in software. I couldn't find any command related.. | Change Bluetooth name Python | 0 | 1.2 | 1 | 0 | 0 | 1,096 |
4,935,257 | 2011-02-08T15:56:00.000 | 1 | 0 | 0 | 1 | 0 | python,http,windows-services,scheduled-tasks | 0 | 4,955,373 | 0 | 3 | 0 | false | 0 | 0 | This is trivially easy with a scheduled task which is the native Windows way to schedule tasks! There's no need for cygwin or Python or anything like that.
I have such a task running on my machine which pokes my Wordpress blog every few hours. The script is just a .bat file which calls wget. The task is configured to "... | 2 | 1 | 0 | 0 | I need to install on one of my Windows PC's some software that will periodically send a short HTTP POST request to my remote development server. The request is always the same and should get sent every minute.
What would you recommend as the best approach for that?
The things I considered are:
1. Creating a Windows ser... | How to periodically create an HTTP POST request from windows | 0 | 0.066568 | 1 | 0 | 1 | 2,416 |
4,935,257 | 2011-02-08T15:56:00.000 | 2 | 0 | 0 | 1 | 0 | python,http,windows-services,scheduled-tasks | 0 | 4,935,443 | 0 | 3 | 0 | false | 0 | 0 | If you have cygwin, you probably have cron - run a python script from your crontab. | 2 | 1 | 0 | 0 | I need to install on one of my Windows PC's some software that will periodically send a short HTTP POST request to my remote development server. The request is always the same and should get sent every minute.
What would you recommend as the best approach for that?
The things I considered are:
1. Creating a Windows ser... | How to periodically create an HTTP POST request from windows | 0 | 0.132549 | 1 | 0 | 1 | 2,416 |
4,935,387 | 2011-02-08T16:08:00.000 | 1 | 0 | 0 | 1 | 0 | python,bash,streaming,video-streaming,multimedia | 0 | 4,935,406 | 0 | 1 | 0 | true | 0 | 0 | what about trying pyffmpeg out. you should be able to get the container info from that. | 1 | 0 | 0 | 0 | I have 2 video streams
(1) VLC Generated Compressed MP4 UDP stream
(2) DV Uncompressed UDP Stream
Both are destined to a host. At this Unix receiving host, I would like to detect type of stream coming using Bash or Python Scripting (without tcpdump, I do not have root priv.)
ANY idea guys how to implement ?
Thank you. | Detecting Type of Video Stream | 0 | 1.2 | 1 | 0 | 0 | 281 |
4,937,817 | 2011-02-08T20:08:00.000 | 0 | 0 | 0 | 0 | 0 | python,mongodb,pymongo | 0 | 4,941,686 | 0 | 2 | 0 | false | 0 | 0 | Does make any sense. The object id is core part of each document. Convert the BSON/JSON document to a native datastructure (depending on your implementation language) and remove _id on this level. Apart from that it does not make much sense what you are trying to accomplish. | 1 | 1 | 0 | 0 | I am having problem when I do a query to mongodb using pymongo.
I do not know how to avoid getting the _id for each record.
I am doing something like this,
result = db.meta.find(filters, [
'model',
'fields.parent',
'field... | PYMongo: Keep returning _id in every record after quering, How can I exclude this record? | 0 | 0 | 1 | 1 | 0 | 803 |
4,938,556 | 2011-02-08T21:17:00.000 | 5 | 0 | 0 | 0 | 0 | python,r,plot,rpy2 | 0 | 4,938,599 | 0 | 2 | 1 | true | 0 | 1 | Plot to a graphics file using jpeg(), png() or another device, then display that file on your wxWidget. | 1 | 3 | 1 | 0 | I'm writing a program in Python. The first thing that happens is a window is displayed (I'm using wxPython) that has some buttons and text. When the user performs some actions, a plot is displayed in its own window. This plot is made with R, using rpy2. The problem is that the plot usually pops up on top of the mai... | How do I control where an R plot is displayed, using python and rpy2? | 0 | 1.2 | 1 | 0 | 0 | 757 |
4,941,125 | 2011-02-09T03:50:00.000 | 0 | 0 | 0 | 0 | 0 | python,django,django-models | 0 | 4,966,022 | 0 | 2 | 0 | false | 1 | 0 | It may be more hassle to try to use multiple profiles with the simplistic configuration of UserProfile.
I would suggest using UserProfile with generic foreign key, or completely ditch UserProfile and create separate models with a User foreign key.
If you are going to have a lot of data attached to these extra user pr... | 1 | 2 | 0 | 0 | Assuming I have different profiles for different user types - staff, teacher,students:
How do I specify AUTH_PROFILE_MODULE in order to get back the appropriate profile with get_profile? | django how to use AUTH_PROFILE_MODULE with multiple profiles? | 0 | 0 | 1 | 0 | 0 | 1,474 |
4,941,162 | 2011-02-09T03:56:00.000 | 1 | 0 | 0 | 0 | 0 | python,eclipse,matplotlib | 0 | 5,640,511 | 0 | 1 | 0 | true | 0 | 0 | import matplotlib.pyplot as mp
mp.ion()
mp.plot(x,y)
mp.show() | 1 | 1 | 1 | 0 | I can draw matplotlib graph in command line(shell) environment, but I find that I could not draw the same graph inside the eclipse IDE. such as plot([1,2,3]) not show in eclipse, I writed show() in the end but still not show anything
my matplotlib use GTKAgg as backend, I use Pydev as plugin of eclipse to develop pyth... | How to draw matplotlib graph in eclipse? | 0 | 1.2 | 1 | 0 | 0 | 3,911 |
4,946,837 | 2011-02-09T15:21:00.000 | 0 | 0 | 1 | 0 | 0 | c++,python,boost-python | 0 | 4,959,254 | 0 | 2 | 0 | true | 0 | 0 | Unfortunately, the standard indexing_suite from Boost.Python does not support std::set. There is a indexing_suite v2, that works on all stl containers. (http://mail.python.org/pipermail/cplusplus-sig/2009-July/014704.html)
It may not have made it to the official distribution, but you can find it by asking around.
(htt... | 2 | 5 | 0 | 0 | I have some C++ methods that have std::set<std::string> as argument or return value.
I would like to map this to a Python frozenset (or regular set) but there does not seem to be a straightforward way to do this.
Does anyone know how one may accomplish this task. | Create and access frozenset with Boost Python | 0 | 1.2 | 1 | 0 | 0 | 741 |
4,946,837 | 2011-02-09T15:21:00.000 | 1 | 0 | 1 | 0 | 0 | c++,python,boost-python | 0 | 13,380,546 | 0 | 2 | 0 | false | 0 | 0 | Or you can use std::map<YourType, int> instead of std::set<YourType>, the value can be for example 0. std::map has the same insert/search time complexity as std::set, it also keeps the keys ordered, it will only bloat the memory a little. Then you can use map indexing suite and in python you can hide the difference in ... | 2 | 5 | 0 | 0 | I have some C++ methods that have std::set<std::string> as argument or return value.
I would like to map this to a Python frozenset (or regular set) but there does not seem to be a straightforward way to do this.
Does anyone know how one may accomplish this task. | Create and access frozenset with Boost Python | 0 | 0.099668 | 1 | 0 | 0 | 741 |
4,962,022 | 2011-02-10T20:02:00.000 | 0 | 0 | 1 | 0 | 0 | python,multithreading | 0 | 4,962,704 | 0 | 2 | 0 | false | 1 | 0 | You can do this using any of:
the thread module (if your task is a function)
the threading module (if you want to write your task as a subclass of threading.Thread)
the multiprocessing module (which uses a similar interface to threading)
All of these are available in the Python standard library (2.6 and later), and y... | 1 | 2 | 0 | 0 | Say I have a simple function, it connects to a database (or a queue), gets a url that hasn't been visited, and then fetches the HTML at the given URL.
Now this process is serial, i.e. it will only fetch the html from a given url one at a time, how can I make this faster by doing this in a group of threads? | In python, is it easy to call a function multiple times using threads? | 0 | 0 | 1 | 0 | 0 | 1,238 |
4,962,202 | 2011-02-10T20:21:00.000 | 1 | 0 | 1 | 0 | 0 | python,dijkstra | 0 | 4,962,223 | 0 | 5 | 0 | false | 0 | 0 | Encapsulate that information in a Python object and you should be fine. | 2 | 0 | 1 | 0 | I need to implement Dijkstra's Algorithm in Python. However, I have to use a 2D array to hold three pieces of information - predecessor, length and unvisited/visited.
I know in C a Struct can be used, though I am stuck on how I can do a similar thing in Python, I am told it's possible but I have no idea to be honest | Python - Dijkstra's Algorithm | 0 | 0.039979 | 1 | 0 | 0 | 5,571 |
4,962,202 | 2011-02-10T20:21:00.000 | 0 | 0 | 1 | 0 | 0 | python,dijkstra | 0 | 4,962,291 | 0 | 5 | 0 | false | 0 | 0 | Python is object oriented language. So think of it like moving from Structs in C to Classes of C++. You can use the same class structure in Python as well. | 2 | 0 | 1 | 0 | I need to implement Dijkstra's Algorithm in Python. However, I have to use a 2D array to hold three pieces of information - predecessor, length and unvisited/visited.
I know in C a Struct can be used, though I am stuck on how I can do a similar thing in Python, I am told it's possible but I have no idea to be honest | Python - Dijkstra's Algorithm | 0 | 0 | 1 | 0 | 0 | 5,571 |
4,966,509 | 2011-02-11T07:16:00.000 | 0 | 1 | 1 | 0 | 1 | python,attributes,introspection,metaclass | 0 | 4,967,128 | 0 | 4 | 0 | false | 0 | 0 | To create attributes during runtime, just add them in self.__dict__['foo'] = 'I'm foo' in the class code. | 1 | 0 | 0 | 0 | I apologize for not giving this question a better title; the reason that I am posting it is that I don't even have the correct terminology to know what I am looking for.
I have defined a class with an attribute 'spam':
def SpamClass(object):
def __init__(self, arg):
self.spam = arg
def __str__(self):
... | creating Python classes with arbitrarily substituted attribute name | 1 | 0 | 1 | 0 | 0 | 722 |
4,967,179 | 2011-02-11T09:01:00.000 | 0 | 0 | 1 | 0 | 0 | python,pyqt | 1 | 4,968,555 | 0 | 2 | 0 | false | 0 | 1 | If the field's an ordinary attribute called text and your Design instance is called design, you can access (read/write) it from anywhere as design.text. | 2 | 0 | 0 | 0 | I want to read data from a text field. The name of the text field is not defined of found in the other class with methods of reading the text field. The textfield is defined in the Design class. now how do I access this field from another class, so I can read data from it. Thanks!!
Edit:
I have 2 Classes: FeatureImport... | Python Referencing | 0 | 0 | 1 | 0 | 0 | 179 |
4,967,179 | 2011-02-11T09:01:00.000 | 0 | 0 | 1 | 0 | 0 | python,pyqt | 1 | 17,676,533 | 0 | 2 | 0 | false | 0 | 1 | 1. if object of FeatureImportCommonWidget class is created inside of MetaDataBrowser class, you can access your text field anywhere inside MetaDataBrowser class like this: FeatureImportCommonWidgetObjectName.placesGroupBox.text()
2 if object of FeatureImportCommonWidget class is created before MetaDataBrowser class,... | 2 | 0 | 0 | 0 | I want to read data from a text field. The name of the text field is not defined of found in the other class with methods of reading the text field. The textfield is defined in the Design class. now how do I access this field from another class, so I can read data from it. Thanks!!
Edit:
I have 2 Classes: FeatureImport... | Python Referencing | 0 | 0 | 1 | 0 | 0 | 179 |
4,980,756 | 2011-02-12T21:30:00.000 | 2 | 1 | 0 | 0 | 1 | python,web,web-frameworks,web-scripting | 0 | 4,980,831 | 0 | 4 | 0 | true | 1 | 0 | The Python web frameworks have nothing to do with GUIs, and can all be used via the terminal.
The benefits of a framework, as you say, are all to do with making your life easier by supplying the components you need to build a website: the main ones are database interaction through an ORM, a templating system, and URL ... | 2 | 1 | 0 | 0 | I've been learning python for use in ArcGIS and some other non-web applications. However, now that I've taken on building a personal website I am interested in using it for web development (as it is the only scripting language I currently know).
I've noticed that there are a lot of these things called "frameworks", suc... | I'm learning python and am interested in using it for web-scripting. What frameworkes are out there and do I need one? | 0 | 1.2 | 1 | 0 | 0 | 553 |
4,980,756 | 2011-02-12T21:30:00.000 | 0 | 1 | 0 | 0 | 1 | python,web,web-frameworks,web-scripting | 0 | 4,981,185 | 0 | 4 | 0 | false | 1 | 0 | Personnally, I don't use any framework, I write either from scratch on BaseHTTPServer, or using WSGI (with mod_wsgi).
It is a bit long to write the skeleton, but I think it is faster (I mean at runtime), there is less constraints, and there is lesser to learn. | 2 | 1 | 0 | 0 | I've been learning python for use in ArcGIS and some other non-web applications. However, now that I've taken on building a personal website I am interested in using it for web development (as it is the only scripting language I currently know).
I've noticed that there are a lot of these things called "frameworks", suc... | I'm learning python and am interested in using it for web-scripting. What frameworkes are out there and do I need one? | 0 | 0 | 1 | 0 | 0 | 553 |
4,986,467 | 2011-02-13T19:50:00.000 | 1 | 0 | 1 | 1 | 0 | python,transactions,pickle,undo | 0 | 4,986,678 | 0 | 2 | 0 | true | 0 | 0 | Well, as you mentioned the data design is loosely coupled, so you I don't think you need to pickle it if it's in memory. Just take a copy of all the relevant variables, and the transaction.abort() would just copy them back, and transaction.commit() would then just remove the copy of the data.
There are issues, but none... | 2 | 1 | 0 | 0 | A user can perform an action, which may trigger dependent actions (which themselves may have dependent actions) and I want to be able to cancel the whole thing if the user cancels a dependent action.
The typical way I've seen this done is some variant of an undo stack and each action will need to know how to undo itsel... | Using pickle for in-memory "transaction"? | 0 | 1.2 | 1 | 0 | 0 | 310 |
4,986,467 | 2011-02-13T19:50:00.000 | 1 | 0 | 1 | 1 | 0 | python,transactions,pickle,undo | 0 | 4,986,707 | 0 | 2 | 0 | false | 0 | 0 | You can use pickle to store your state if all elements of state are serializable (usually they are). The only reasons for not doing so:
if you have to store pointers to any objects that are not saved in state, you will have problems with these pointers after performing undo operation.
this method could be expens... | 2 | 1 | 0 | 0 | A user can perform an action, which may trigger dependent actions (which themselves may have dependent actions) and I want to be able to cancel the whole thing if the user cancels a dependent action.
The typical way I've seen this done is some variant of an undo stack and each action will need to know how to undo itsel... | Using pickle for in-memory "transaction"? | 0 | 0.099668 | 1 | 0 | 0 | 310 |
4,994,058 | 2011-02-14T15:39:00.000 | 0 | 0 | 1 | 0 | 0 | python,macos,wxpython,pyobjc | 0 | 5,071,853 | 0 | 2 | 0 | false | 0 | 1 | What do you need Xcode for? If you need it for the windows/gui (*.nib, *.xib files), then you should perhaps search for 'creating *.nib, *xib without Xcode'.
That's only a search hint and no satisfying answer. | 1 | 6 | 0 | 1 | I'm writing a small cross-platform wxPython app, however on every platform I need to use some platform-specific API. On Mac OS it can be done using PyObjC.
I'm searching for tutorial on how to use PyObjC. However, all I found so far were tutorials with Xcode. I want my app to be able to run on mac/win/lin, without cha... | PyObjC tutorial without Xcode | 0 | 0 | 1 | 0 | 0 | 3,791 |
4,994,838 | 2011-02-14T16:55:00.000 | 1 | 0 | 0 | 0 | 1 | python,web-applications,turbogears2 | 1 | 5,003,413 | 0 | 2 | 0 | false | 0 | 0 | Hey, I got it right somehow.
The problem seems to be version mismatch between SA 0.6 & sqlautocode 0.6
Seems that they don't work in tandom.
So I removed those & installed SA 0.5
Now it's working.
Thanks,
Vineet Deodhar. | 1 | 2 | 0 | 0 | I am using TG2.1 on WinXP.
Python ver is 2.6.
Trying to use sqlautocode (0.5.2) for working with my existing MySQL schema.
SQLAlchemy ver is 0.6.6
import sqlautocode # works OK
While trying to reflect the schema ----
sqlautocode mysql:\\username:pswd@hostname:3306\schema_name -o tables.py
SyntaxError: invalid ... | sqlautocode for mysql giving syntax error | 0 | 0.099668 | 1 | 1 | 0 | 659 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.