Q_Id
int64 337
49.3M
| CreationDate
stringlengths 23
23
| Users Score
int64 -42
1.15k
| Other
int64 0
1
| Python Basics and Environment
int64 0
1
| System Administration and DevOps
int64 0
1
| Tags
stringlengths 6
105
| A_Id
int64 518
72.5M
| AnswerCount
int64 1
64
| is_accepted
bool 2
classes | Web Development
int64 0
1
| GUI and Desktop Applications
int64 0
1
| Answer
stringlengths 6
11.6k
| Available Count
int64 1
31
| Q_Score
int64 0
6.79k
| Data Science and Machine Learning
int64 0
1
| Question
stringlengths 15
29k
| Title
stringlengths 11
150
| Score
float64 -1
1.2
| Database and SQL
int64 0
1
| Networking and APIs
int64 0
1
| ViewCount
int64 8
6.81M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,037,673 | 2009-06-24T10:58:00.000 | 4 | 0 | 0 | 0 | python,tkinter,pyqt,pygtk,pyobjc | 1,037,810 | 9 | false | 0 | 1 | Not really sure what you mean by "heavyweight."
wx uses native controls on each platform, and is about as easy to use in Python as I can imagine; after all, GUI APIs are complex because GUIs can get complex.
I think wx, for the effort required to build a window and the quality of what shows up on screen, is great. I don't think you're likely to roll something better on your own. | 6 | 9 | 0 | Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.
Recently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK / pyQt on gnome / kde. Does such a library exist? If not, what do you think is wrong with this idea? | Pure python gui library? | 0.088656 | 0 | 0 | 5,803 |
1,037,673 | 2009-06-24T10:58:00.000 | 2 | 0 | 0 | 0 | python,tkinter,pyqt,pygtk,pyobjc | 1,037,705 | 9 | false | 0 | 1 | I think it's about not inventig the wheel. It would work, but why should you do that? All the GUI libraries you mentioned are stable and more or less bullet proofen.
I could imagine that there are some experiments implementing a pure python library. But I never saw one. Everything about GUIs is hard work and a pure python library wouldn't have such a big audience. | 6 | 9 | 0 | Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.
Recently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK / pyQt on gnome / kde. Does such a library exist? If not, what do you think is wrong with this idea? | Pure python gui library? | 0.044415 | 0 | 0 | 5,803 |
1,037,673 | 2009-06-24T10:58:00.000 | 10 | 0 | 0 | 0 | python,tkinter,pyqt,pygtk,pyobjc | 1,037,722 | 9 | true | 0 | 1 | The path of least effort and best results would be to learn what it takes to deploy an app using those existing GUI libraries. | 6 | 9 | 0 | Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.
Recently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK / pyQt on gnome / kde. Does such a library exist? If not, what do you think is wrong with this idea? | Pure python gui library? | 1.2 | 0 | 0 | 5,803 |
1,038,182 | 2009-06-24T12:54:00.000 | 0 | 0 | 0 | 0 | wxpython | 14,180,592 | 3 | false | 1 | 1 | stylesheet, not slidesheet.
f = open('NAMEOFSTYLESHEET.css','w')
f.write('#ID{}\n.class{}') | 1 | 0 | 0 | How to convert HTML CSS file to wxPython files? That is, how to create slidsheet in wxPython like HTML CSS files? | HTML conversion | 0 | 0 | 0 | 677 |
1,040,135 | 2009-06-24T18:36:00.000 | 2 | 0 | 1 | 0 | python,oop | 1,040,169 | 2 | false | 0 | 0 | I would try assigning the configuration to a variable.
configVariable = config.get(parameters)
Then you can pass the configuration variable to other modules as necessary. | 2 | 2 | 0 | I'm using the ConfigParser to read the configuration information stored in a file. I'm able to read the content and use it across other modules in the project. I'm not sure if the configuration file is read every time I call config.get(parameters). How can I make sure that the configuration information is read only once and rest of the time its read from the cache. | reading a configuration information only once in Python | 0.197375 | 0 | 0 | 601 |
1,040,135 | 2009-06-24T18:36:00.000 | 1 | 0 | 1 | 0 | python,oop | 1,040,220 | 2 | false | 0 | 0 | The default implementation of the ConfigParser class reads its data only once. | 2 | 2 | 0 | I'm using the ConfigParser to read the configuration information stored in a file. I'm able to read the content and use it across other modules in the project. I'm not sure if the configuration file is read every time I call config.get(parameters). How can I make sure that the configuration information is read only once and rest of the time its read from the cache. | reading a configuration information only once in Python | 0.099668 | 0 | 0 | 601 |
1,043,382 | 2009-06-25T11:19:00.000 | 2 | 0 | 1 | 0 | python,encryption | 1,051,793 | 4 | false | 0 | 0 | I looked at the ezPyCrypto library that was recommended in another answer.
Please don't use this library. It is very incomplete and in some cases incorrect and highly insecure. Public key algorithms have many pitfalls and need to be implemented carefully.
For example, RSA message should use a padding scheme such as PKCS #1, OAEP etc to be secure. This library doesn't pad. DSA signatures should use the SHA1 hash function. This library uses the broken MD5 hash and there is even a bigger bug in the random number generation. Hence the DSA implementation is neither standards conform nor secure. ElGamal is also implemented incorrectly.
Following standards does make implementations somewhat more complex. But not following any is not an option. At least not if you care about security. | 1 | 2 | 0 | I need to take a string in Python and encrypt it using a public key.
Can anyone give me an example or recommendation about how to go about doing this? | Encrypt a string using a public key | 0.099668 | 0 | 0 | 2,977 |
1,043,528 | 2009-06-25T11:59:00.000 | 2 | 0 | 0 | 0 | python,web-services,database-design | 1,043,653 | 5 | true | 0 | 0 | Server 1: Convert rows to JSON, call the RESTful api of second with JSON data
Server 2: listens on a URI e.g. POST /data , get json data convert back to dictionary or ORM objects, insert into db
sqlalchemy/sqlobject and simplejson is what you need. | 2 | 2 | 0 | I have a system sitting on a "Master Server", that is periodically transferring quite a few chunks of information from a MySQL DB to another server in the web.
Both servers have a MySQL Server and an Apache running. I would like an easy-to-use solution for this.
Currently I'm looking into:
XMLRPC
RestFul Services
a simple POST to a processing script
socket transfers
The app on my master is a TurboGears app, so I would prefer "pythonic" aka less ugly solutions. Copying a dumped table to another server via FTP / SCP or something like that might be quick, but in my eyes it is also very (quick and) dirty, and I'd love to have a nicer solution.
Can anyone describe shortly how you would do this the "best-practise" way?
This doesn't necessarily have to involve Databases. Dumping the table on Server1 and transferring the raw data in a structured way so server2 can process it without parsing too much is just as good. One requirement though: As soon as the data arrives on server2, I want it to be processed, so there has to be a notification of some sort when the transfer is done. Of course I could just write my whole own server sitting on a socket on the second machine and accepting the file with own code and processing it and so forth, but this is just a very very small piece of a very big system, so I dont want to spend half a day implementing this.
Thanks,
Tom | Best Practise for transferring a MySQL table to another server? | 1.2 | 1 | 0 | 810 |
1,043,528 | 2009-06-25T11:59:00.000 | 0 | 0 | 0 | 0 | python,web-services,database-design | 1,043,595 | 5 | false | 0 | 0 | Assuming your situation allows this security-wise, you forgot one transport mechanism: simply opening a mysql connection from one server to another.
Me, I would start by thinking about one script that ran regularly on the write server and opens a read only db connection to the read server (A bit of added security) and a full connection to it's own data base server.
How you then proceed depends on the data (is it just inserts to deal with? do you have to mirror deletes? how many inserts vs updates? etc) but basically you could write a script that pulled data from the read server and processed it immediately into the write server.
Also, would mysql server replication work or would it be to over-blown as a solution? | 2 | 2 | 0 | I have a system sitting on a "Master Server", that is periodically transferring quite a few chunks of information from a MySQL DB to another server in the web.
Both servers have a MySQL Server and an Apache running. I would like an easy-to-use solution for this.
Currently I'm looking into:
XMLRPC
RestFul Services
a simple POST to a processing script
socket transfers
The app on my master is a TurboGears app, so I would prefer "pythonic" aka less ugly solutions. Copying a dumped table to another server via FTP / SCP or something like that might be quick, but in my eyes it is also very (quick and) dirty, and I'd love to have a nicer solution.
Can anyone describe shortly how you would do this the "best-practise" way?
This doesn't necessarily have to involve Databases. Dumping the table on Server1 and transferring the raw data in a structured way so server2 can process it without parsing too much is just as good. One requirement though: As soon as the data arrives on server2, I want it to be processed, so there has to be a notification of some sort when the transfer is done. Of course I could just write my whole own server sitting on a socket on the second machine and accepting the file with own code and processing it and so forth, but this is just a very very small piece of a very big system, so I dont want to spend half a day implementing this.
Thanks,
Tom | Best Practise for transferring a MySQL table to another server? | 0 | 1 | 0 | 810 |
1,043,735 | 2009-06-25T12:52:00.000 | 5 | 1 | 1 | 0 | python,security,encryption | 1,043,762 | 4 | false | 0 | 0 | The most secure encryption is no encryption. Passwords should be reduced to a hash. This is a one-way transformation, making the password (almost) unrecoverable.
When giving someone a code, you can do the following to be actually secure.
(1) generate some random string.
(2) give them the string.
(3) save the hash of the string you generated.
Once.
If they "forget" the code, you have to (1) be sure they're authorized to be given the code, then (2) do the process again (generate a new code, give it to them, save the hash.) | 1 | 5 | 0 | I am making a little webgame that has tasks and solutions, the solutions are solved by entering a code given to user after completion of a task. To have some security (against cheating) i dont want to store the codes genereted by the game in plain text. But since i need to be able to give a player the code when he has accomplished the task i cant hash it since then i cant retrive it.
So what is the most secure way to encrypt/decrypt something using python? | What is the most secure python "password" encryption | 0.244919 | 0 | 0 | 4,268 |
1,044,473 | 2009-06-25T15:06:00.000 | 1 | 1 | 0 | 1 | python,solaris,yaml,beanstalkd | 1,048,086 | 3 | false | 0 | 0 | After looking in the code (beanstalkc):
your client has send his 'list-tubes' message, and is waiting for an answer.
(until you kill it)
your server doesn't answer or can't send the answer to the client.
(or the answer is shorter than the client expect)
is a network-admin at your side (or site) :-) | 2 | 2 | 0 | i am using Solaris 10 OS(x86). i installed beanstalkd and it starts fine by using command "beanstalkd -d -l hostip -p 11300".
i have Python 2.4.4 on my system i installed YAML and beanstalkc python libraries to connect beanstalkd with python my problem is when i try to write some code:
import beanstalkc
beanstalk = beanstalkc.Connection(host='hostip', port=11300)
no error so far but when i try to do someting on beanstalk like say listing queues. nothing happens.
beanstalk.tubes()
it just hangs and nothing returns. if i cancel the operation(using ctr+c on python env.) or stop the server i immediately see an output:
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 134, in tubes
return self._interact_yaml('list-tubes\r\n', ['OK'])
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 83, in _interact_yaml
size, = self._interact(command, expected_ok, expected_err)
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 57, in _interact
status, results = self._read_response()
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 66, in _read_response
response = self.socket_file.readline().split()
File "/usr/lib/python2.4/socket.py", line 332, in readline
data = self._sock.recv(self._rbufsize)
any idea whats going? i am an Unix newbie so i have no idea what i did setup wrong to cause this.
edit: seems like the problem lies within BeanStalkd itself, anyone have used this on Solaris 10? if so which version did you use? The v1.3 labeled one doesnt compile on Solaris while the latest from git code repository compiles it causes the above problem(or perhaps there is some configuration to do on Solaris?).
edit2: i installed and compiled same components with beanstalkd, PyYAML, pythonbeanstalc and libevent to an UBUNTU machine and it works fine. problems seems to be about compilation of beanstalkd on solaris, i have yet to produce or read any solution. | BeanStalkd on Solaris doesnt return anything when called from the python library | 0.066568 | 0 | 0 | 394 |
1,044,473 | 2009-06-25T15:06:00.000 | 1 | 1 | 0 | 1 | python,solaris,yaml,beanstalkd | 1,093,128 | 3 | true | 0 | 0 | I might know what is wrong: don't start it in daemon (-d) mode. I have experienced the same and by accident I found out what is wrong.
Or rather, I don't know what is wrong, but it works without running it in daemon mode.
./beanstalkd -p 9977 &
as an alternative. | 2 | 2 | 0 | i am using Solaris 10 OS(x86). i installed beanstalkd and it starts fine by using command "beanstalkd -d -l hostip -p 11300".
i have Python 2.4.4 on my system i installed YAML and beanstalkc python libraries to connect beanstalkd with python my problem is when i try to write some code:
import beanstalkc
beanstalk = beanstalkc.Connection(host='hostip', port=11300)
no error so far but when i try to do someting on beanstalk like say listing queues. nothing happens.
beanstalk.tubes()
it just hangs and nothing returns. if i cancel the operation(using ctr+c on python env.) or stop the server i immediately see an output:
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 134, in tubes
return self._interact_yaml('list-tubes\r\n', ['OK'])
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 83, in _interact_yaml
size, = self._interact(command, expected_ok, expected_err)
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 57, in _interact
status, results = self._read_response()
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 66, in _read_response
response = self.socket_file.readline().split()
File "/usr/lib/python2.4/socket.py", line 332, in readline
data = self._sock.recv(self._rbufsize)
any idea whats going? i am an Unix newbie so i have no idea what i did setup wrong to cause this.
edit: seems like the problem lies within BeanStalkd itself, anyone have used this on Solaris 10? if so which version did you use? The v1.3 labeled one doesnt compile on Solaris while the latest from git code repository compiles it causes the above problem(or perhaps there is some configuration to do on Solaris?).
edit2: i installed and compiled same components with beanstalkd, PyYAML, pythonbeanstalc and libevent to an UBUNTU machine and it works fine. problems seems to be about compilation of beanstalkd on solaris, i have yet to produce or read any solution. | BeanStalkd on Solaris doesnt return anything when called from the python library | 1.2 | 0 | 0 | 394 |
1,045,334 | 2009-06-25T17:59:00.000 | 1 | 1 | 1 | 0 | c#,.net,python | 1,045,606 | 12 | false | 0 | 0 | IF you are looking for reasons to convert them, I can think of a few. These don't necessarily mean you should, these are just possible reasons in the "recode" corner.
Maintainability
If you have a dev-shop that is primarily C# focused, then have python applications around may not be useful for maintainability reasons. It would mean that they need to keep python staffers around (assuming it's a complicated app) in order to maintain it. This probably isn't a restriction they want, especially if they don't intend to write anything in python from here on out.
Consistency
This sort of falls under maintainability, but it is of a different flavour. If they wanted to integrate part of this (python) application into a C# application, but not the whole thing, it's possible to write some boilerplate code, but again, that's messy to maintain. Ultimately, you would want to code of P_App to be able to be seamlessly integrated into C#_App, and not have to run them separately.
On the other side of the coin, it is fair to point out that you are throwing time and money at converting something which already works. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 0.016665 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 8 | 1 | 1 | 0 | c#,.net,python | 1,045,361 | 12 | false | 0 | 0 | There's IronPython , a python implementation for .NET. You could port it to that if you really need to get away from the "standard" python vm and onto the .NET platform | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 1 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | -1 | 1 | 1 | 0 | c#,.net,python | 1,045,479 | 12 | false | 0 | 0 | i will convert it from language a to language b for 1 million dollars. <--- this would be the only business reason I would consider legit. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | -0.016665 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 1 | 1 | 1 | 0 | c#,.net,python | 1,046,028 | 12 | false | 0 | 0 | Short and to the point answer: No, there is no reason. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 0.016665 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 0 | 1 | 1 | 0 | c#,.net,python | 1,045,561 | 12 | false | 0 | 0 | Some reasons that come to mind:
Performance
Easier to find developers
Huge huge huge developer and tools
ecosystem
But I second what the others have stated: if it ain't broke, don't fix it. Unless your boss is saying, "hey, we're moving all our crap to .NET", or you're presented with some other business reason for migrating, just stick with what you've got. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 0 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 0 | 1 | 1 | 0 | c#,.net,python | 1,045,532 | 12 | false | 0 | 0 | The only thing I can think of is the performance boost C# will give you. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 0 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 1 | 1 | 1 | 0 | c#,.net,python | 1,045,512 | 12 | false | 0 | 0 | As long as the application is running fine there is no reason to switch to C#. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 0.016665 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 6 | 1 | 1 | 0 | c#,.net,python | 1,045,356 | 12 | false | 0 | 0 | Leave them as Python unless you hear a very good business reason to convert. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 1 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 4 | 1 | 1 | 0 | c#,.net,python | 1,045,446 | 12 | false | 0 | 0 | Changing languages just for the sake of changing languages is rarely a good idea. If the app is doing its obj then let it do its job. If you've got a corporate mandate to only use C#, that may be a different story (estimate the work involved, give the estimate to management, let them decide to pursue it or write up an exception). Even if there isn't a strong (or any) knowledge of Python across the organization, developers are rather proficient at picking up new languages {it's a survival thing}, so that tends to be less of a concern.
Moral of the story, if an app is to be rewritten, there should really be more of a justification to do the rewrite than just to change languages. If you were to add features that would be significantly easier to implement and maintain using another languages library/framework ... good justification. If maintaining the environment/framework for one language is causing a significant operational expense that could be saved by a re-write, cool. "Because our other code is in c#" ... not cool. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 0.066568 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 1 | 1 | 1 | 0 | c#,.net,python | 1,045,349 | 12 | false | 0 | 0 | I would not convert unless you are converting as part of an enterprise-wide switch from one language to another. Even then I would avoid converting until absolutely necessary. If it works, why change it? | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 0.016665 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 13 | 1 | 1 | 0 | c#,.net,python | 1,045,351 | 12 | true | 0 | 0 | Quote: "If it doesn't break, don't fix it."
Unless your company is moving towards .NET and/or there are no more qualified Python developer available anymore, then don't. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 1.2 | 0 | 0 | 406 |
1,045,334 | 2009-06-25T17:59:00.000 | 3 | 1 | 1 | 0 | c#,.net,python | 1,045,378 | 12 | false | 0 | 0 | If you're the only Python developer in a C# shop, then it makes plenty of sense to convert. If you quit tomorrow, no one will be able to maintain these systems. | 12 | 4 | 0 | I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python? | Is there any good reason to convert an app written in python to c#? | 0.049958 | 0 | 0 | 406 |
1,046,068 | 2009-06-25T20:30:00.000 | 3 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,149 | 11 | false | 0 | 0 | In Java and Python, architecture details are abstracted away so that it is in fact more or less impossible to write architecture-dependant code.
With C++, this is an entirely different matter - you can certainly write code that does not depend on architecture details, but you have be careful to avoid pitfalls, specifically concerning basic data types that are are architecture-dependant, such as int. | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 0.054491 | 0 | 0 | 1,267 |
1,046,068 | 2009-06-25T20:30:00.000 | 1 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,141 | 11 | false | 0 | 0 | If you are programming in Python or in Java, the interpreter and the virtual machine respectively abstract this layer of the architecture. You then need not to worry if it's running on a 32 or 64 bits architecture.
The same cannot be said for C++, in which you'll have to ask yourself sometimes if you are running on a 32 or 64 bits machine | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 0.01818 | 0 | 0 | 1,267 |
1,046,068 | 2009-06-25T20:30:00.000 | 0 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,113 | 11 | false | 0 | 0 | In C++, you have to be very careful if you want to write code that works indifferently on 32 or 64 bits.
Many people wrongly assume that int can store a pointer, for example. | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 0 | 0 | 0 | 1,267 |
1,046,068 | 2009-06-25T20:30:00.000 | 0 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,737 | 11 | false | 0 | 0 | A 32 bit machine will allow you to have a maximum of 4 GB of addressable virtual memory. (In practice, it's even less than that, usually 2 GB or 3 GB depending on the OS and various linker options.) On a 64 bit machine, you can have a HUGE virtual address space (in any practical sense, limited only by disk) and a pretty damn big RAM.
So if you are expecting 6GB data sets for some computation (let's say something that needs incoherent access and can't just be streamed a bit at a time), on a 64 bit architecture you could just read it into RAM and do your stuff, whereas on a 32 bit architecture you need a fundamentally different way to approach it, since you simply do not have the option of keeping the entire data set resident. | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 0 | 0 | 0 | 1,267 |
1,046,068 | 2009-06-25T20:30:00.000 | 2 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,182 | 11 | false | 0 | 0 | As long as you do things correctly, you almost never need to know for most languages. On many, you never need to know, as the language behavior doesn't vary (Java, for example, specifies the runtime behavior precisely).
In C++ and C, doing things correctly includes not making assumptions about int. Don't put pointers in int, and when you're doing anything with memory sizes or addresses use size_t and ptrdiff_t. Don't count on the size of data types: int must be at least 16 bits, almost always is 32, and may be 64 on some architectures. Don't assume that floating-point arithmetic will be done in exactly the same way on different machines (the IEEE standards have some leeway in them).
Pretty much all OSes that support networking will give you some way to deal with possible endianness problems. Use them. Use language facilities like isalpha() to classify characters, rather than arithmetic operations on characters (which might be something weird like EBCDIC). (Of course, it's now more usual to use wchar_t as character type, and use Unicode internally.) | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 0.036348 | 0 | 0 | 1,267 |
1,046,068 | 2009-06-25T20:30:00.000 | 0 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,298 | 11 | false | 0 | 0 | With java and .net you don't really have to bother with it unless you are doing very low level stuff like twiddling bits. If you are using c, c++, fortran you might get by but I would actually recommend using things like "stdint.h" where you use definitive declares like uint64_t and uint32_t so as to be explicit. Also, you will need to build with particularly libraries depending on how you are linking, for example a 64 bit system might use gcc in a default 64 bit compile mode. | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 0 | 0 | 0 | 1,267 |
1,046,068 | 2009-06-25T20:30:00.000 | 0 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,100 | 11 | false | 0 | 0 | You will need to care about "endian-ness" only if you send and receive raw C structs
over the wire like
ret = send(socket, &myStruct, sizeof(myStruct));
However this is not a recommended practice.
It's recommended that you define a protocol between the parties such it doesn't matter
the parties' machine architectures. | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 0 | 0 | 0 | 1,267 |
1,046,068 | 2009-06-25T20:30:00.000 | 16 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,099 | 11 | true | 0 | 0 | correct for most circumstances
The runtime/language/compiler will abstract those details unless you are dealing directly with word sizes or binary at a low level.
Even byteorder is abstracted by the NIC/Network stack in the kernel. It is translated for you. When programming sockets in C, you do sometimes have to deal with byte ordering for the network when sending data ... but that doesn't concern 32 or 64 bit differences.
When dealing with blobs of binary data, mapping them from one architecture to another (as an overlay to a C struct for example) can cause problems as others have mentioned, but this is why we develop architecture independent protocols based on characters and so on.
In-fact things like Java run in a virtual machine that abstracts the machine another step!
Knowing a bit about the instruction set of the architecture, and how the syntax is compiled to that can help you understand the platform and write cleaner, tighter code. I know I grimace at some old C code after studying compilers! | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 1.2 | 0 | 0 | 1,267 |
1,046,068 | 2009-06-25T20:30:00.000 | 16 | 1 | 0 | 0 | java,c++,python,64-bit,32-bit | 1,046,128 | 11 | false | 0 | 0 | Knowing how things work, be it how the virtual machine works, and how it works on your platform, or how certain C++ constructs are transformed into assembly will always make you a better programmer, because you will understand why things should be done the way they are.
You need to understand things like memory to know what cache-misses are and why those might affect your program. You should know how certain things are implemented, even though you might only use an interface or high-level way to get to it, knowing how it works will make sure you're doing it in the best way.
For packet work, you need to understand how data is stored on platforms and how sending that across the network to a different platform might change how the data is read (endian-ness).
Your compiler will make best use of the platform you're compiling on, so as long as you stick to standards and code well, you can ignore most things and assume the compiler will whip out what's best.
So in short, no. You don't need to know the low level stuff, but it never hurts to know. | 9 | 6 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | Would one have to know the machine architecture to write code? | 1 | 0 | 0 | 1,267 |
1,046,157 | 2009-06-25T20:42:00.000 | 0 | 0 | 0 | 0 | python,wxpython | 1,046,259 | 2 | false | 0 | 1 | When the window is restored it is (on some platforms) repainted using EVT_PAINT handler.
The solution is e.g. to draw the same lines in OnPaint(). Or buffer what you draw. See the wxBufferedDC class. | 1 | 1 | 0 | In my wx.Frame based wxpython application, I draw some lines on a panel when some events occur by creating wx.ClientDC instances when needed. The only problem is, if the window is minimized and then restored, the lines disappear! Is there some kind of method that I should override or event to bind to that will allow me to call the drawing method I created when the window is restored?
Thanks! | wxpython: How can I redraw something when a window is retored? | 0 | 0 | 0 | 541 |
1,046,847 | 2009-06-26T00:28:00.000 | 4 | 1 | 0 | 0 | php,python,memcached | 1,046,859 | 2 | false | 0 | 0 | By default, the PHP client stores keys in PHP's serialized format (which Python won't understand by default). If the Python client does something similar (using its own serialization format), that'd be your problem.
You can always use telnet/netcat to see what exactly is getting stored. | 2 | 1 | 0 | I'm storing a value in memcached using PHP's Memcache extension and trying to retrieve it in a daemon written in Python sitting behind my webapp. But, it keeps returning None or throwing "local variable 'val' referenced before assignment".
I'm sure I'm looking for the same key, and there's only one mc server available to either app (localhost). If I try setting the key on a Python terminal, it returns False and unsets it (i.e., I can no longer retrieve it through PHP). Any ideas? | Accessing a PHP-set memcache key from Python | 0.379949 | 0 | 0 | 1,069 |
1,046,847 | 2009-06-26T00:28:00.000 | 1 | 1 | 0 | 0 | php,python,memcached | 4,357,288 | 2 | false | 0 | 0 | You could serialise the "data" into json, which I've done once. | 2 | 1 | 0 | I'm storing a value in memcached using PHP's Memcache extension and trying to retrieve it in a daemon written in Python sitting behind my webapp. But, it keeps returning None or throwing "local variable 'val' referenced before assignment".
I'm sure I'm looking for the same key, and there's only one mc server available to either app (localhost). If I try setting the key on a Python terminal, it returns False and unsets it (i.e., I can no longer retrieve it through PHP). Any ideas? | Accessing a PHP-set memcache key from Python | 0.099668 | 0 | 0 | 1,069 |
1,047,021 | 2009-06-26T02:04:00.000 | 41 | 0 | 1 | 0 | python,operators,overriding | 31,546,707 | 4 | false | 0 | 0 | In addition to what's correctly given in answers above, it is worth explicitly clarifying that when __iadd__ is overriden, the x += y operation does NOT end with the end of __iadd__ method.
Instead, it ends with x = x.__iadd__(y). In other words, Python assigns the return value of your __iadd__ implementation to the object you're "adding to", AFTER the implementation completes.
This means it is possible to mutate the left side of the x += y operation so that the final implicit step fails. Consider what can happen when you are adding to something that's within a list:
>>> x[1] += y # x has two items
Now, if your __iadd__ implementation (a method of an object at x[1]) erroneously or on purpose removes the first item (x[0]) from the beginning of the list, Python will then run your __iadd__ method) & try to assign its return value to x[1]. Which will no longer exist (it will be at x[0]), resulting in an ÌndexError.
Or, if your __iadd__ inserts something to beginning of x of the above example, your object will be at x[2], not x[1], and whatever was earlier at x[0] will now be at x[1]and be assigned the return value of the __iadd__ invocation.
Unless one understands what's happening, resulting bugs can be a nightmare to fix. | 1 | 85 | 0 | Is it possible to override += in Python? | Overriding "+=" in Python? (__iadd__() method) | 1 | 0 | 0 | 59,684 |
1,047,306 | 2009-06-26T04:19:00.000 | 1 | 0 | 0 | 1 | python,twisted,orbited | 1,047,755 | 5 | false | 0 | 0 | I'd suggest you use Twisted. ;) It has both chat clients and chat servers. Then you also need a web framework. I'd use either Grok or BFD, but there are many Python Web Frameworks around, and few of them are really bad. | 2 | 5 | 0 | i want to build a site similar to www.omegle.com. can any one suggest me some ideas.
I think its built usning twisted , orbiter comet server. | Chat comet site using python and twisted | 0.039979 | 0 | 0 | 4,166 |
1,047,306 | 2009-06-26T04:19:00.000 | 3 | 0 | 0 | 1 | python,twisted,orbited | 1,047,805 | 5 | true | 0 | 0 | Twisted is a good choice. I used it a few years ago to build a server for a browser-based online game I wrote - it kept track of clients, served them replies to Ajax requests, and used HTML5 Server-Sent DOM Events as well. Worked rather painlessly thanks to Twisted's good HTTP library.
For a Python web framework, I personally favor Django. It's quick to get going with it, and it has a lot of functionality out of the box ("batteries included" as it says on their site I think). Pylons is another popular choice. | 2 | 5 | 0 | i want to build a site similar to www.omegle.com. can any one suggest me some ideas.
I think its built usning twisted , orbiter comet server. | Chat comet site using python and twisted | 1.2 | 0 | 0 | 4,166 |
1,048,446 | 2009-06-26T10:44:00.000 | 1 | 0 | 1 | 0 | wxpython | 1,048,463 | 1 | false | 0 | 1 | You need to give your text control the TE_PASSWORD style.
(As Jørn's comment points out, this isn't "encryption" - I'm assuming you're only talking about the visual presentation of the password.) | 1 | 0 | 0 | I am developing an student attendance application in wxpython and I need to know how to ensure that password field doesn't echo characters to the screen.
Forexample :if I give the name as moni means then it should be displayed as in format of **** | Hiding characters typed into password field | 0.197375 | 0 | 0 | 427 |
1,048,651 | 2009-06-26T11:36:00.000 | 1 | 0 | 1 | 1 | python,deployment,wxpython,multiprocessing,py2exe | 1,124,797 | 4 | false | 0 | 0 | When you run py2exe, look closely at the final messages when it's completed. It gives you a list of DLLs that it says are needed by the program, but that py2exe doesn't automatically bundle.
Many in the list are reliably available on any Windows install, but there will be a few that you should manually bundle into your Inno Setup installation. Some are only needed if you want to deploy on older Windows installs e.g. Win 2000 or earlier. | 2 | 1 | 0 | I have a problem: I used py2exe for my program, and it worked on my computer. I packaged it with Inno Setup (still worked on my computer), but when I sent it to a different computer, I got the following error when trying to run the application: "CreateProcess failed; code 14001." The app won't run.
(Note: I am using wxPython and the multiprocessing module in my program.)
I googled for it a bit and found that the the user should install some MS redistributable something, but I don't want to make life complicated for my users. Is there a solution?
Versions:
Python 2.6.2c1,
py2exe 0.6.9,
Windows XP Pro | Problem deploying Python program (packaged with py2exe) | 0.049958 | 0 | 0 | 2,683 |
1,048,651 | 2009-06-26T11:36:00.000 | 1 | 0 | 1 | 1 | python,deployment,wxpython,multiprocessing,py2exe | 1,048,732 | 4 | false | 0 | 0 | You should be able to install that MS redistributable thingy as a part of your InnoSetup setup exe. | 2 | 1 | 0 | I have a problem: I used py2exe for my program, and it worked on my computer. I packaged it with Inno Setup (still worked on my computer), but when I sent it to a different computer, I got the following error when trying to run the application: "CreateProcess failed; code 14001." The app won't run.
(Note: I am using wxPython and the multiprocessing module in my program.)
I googled for it a bit and found that the the user should install some MS redistributable something, but I don't want to make life complicated for my users. Is there a solution?
Versions:
Python 2.6.2c1,
py2exe 0.6.9,
Windows XP Pro | Problem deploying Python program (packaged with py2exe) | 0.049958 | 0 | 0 | 2,683 |
1,049,648 | 2009-06-26T15:10:00.000 | 1 | 0 | 0 | 1 | python,subprocess | 1,049,684 | 2 | true | 0 | 0 | Are you using shell=True option for subprocess? | 2 | 3 | 0 | I have created temporary named files, with the tempfile libraries NamedTemporaryFile method.
I have written to them flushed the buffers, and I have not closed them (or else they might go away)
I am trying to use the subprocess module to call some shell commands using these generated files.
subprocess.call('cat %s' % f.name) always fails saying that the named temporary file does not exist.
os.path.exists(f.name) always returns true.
I can run the cat command on the file directly from the shell.
Is there some reason the subprocess module will not work with temporary files?
Is there any way to make it work?
Thanks in advance. | subprocess module: using the call method with tempfile objects | 1.2 | 0 | 0 | 819 |
1,049,648 | 2009-06-26T15:10:00.000 | 3 | 0 | 0 | 1 | python,subprocess | 1,049,697 | 2 | false | 0 | 0 | Why don't you make your NamedTemporaryFiles with the optional parameter delete=False? That way you can safely close them knowing they won't disappear, use them normally afterwards, and explicitly unlink them when you're done. This way everything will work cross-platform, too. | 2 | 3 | 0 | I have created temporary named files, with the tempfile libraries NamedTemporaryFile method.
I have written to them flushed the buffers, and I have not closed them (or else they might go away)
I am trying to use the subprocess module to call some shell commands using these generated files.
subprocess.call('cat %s' % f.name) always fails saying that the named temporary file does not exist.
os.path.exists(f.name) always returns true.
I can run the cat command on the file directly from the shell.
Is there some reason the subprocess module will not work with temporary files?
Is there any way to make it work?
Thanks in advance. | subprocess module: using the call method with tempfile objects | 0.291313 | 0 | 0 | 819 |
1,050,089 | 2009-06-26T16:39:00.000 | 1 | 1 | 0 | 0 | php,python,perl,parsing,feed | 1,050,136 | 4 | false | 0 | 0 | Most modern languages scripting languages allow you to do all of these things. Because of that, I think your choice of language should be based on what you and the people who read your code know.
In Perl I'd make use of the following modules:
Net::FTP to access the ftp sites.
DBI to insert data into your database.
Modules like that are nice reusable pieces of code that you don't have to write, and interaction with ftp sites and databases are so common that every modern scripting language should have similar modules.
I don't think that PHP is a great language so I'd avoid it if possible, but it might make sense for you if you have a lot of experience in it. | 1 | 2 | 0 | I've been having to do some basic feed processing. So, get a file via ftp, process it (i.e. get the fields I care about), and then update the local database. And similarly the other direction: get data from db, create file, and upload by ftp. The scripts will be called by cron.
I think the idea would be for each type of feed, define the ftp connection/file information. Then there should be a translation of how data fields in the file relate to data fields that the application can work with (and of course process this translation). Additionally write separate scripts that do the common inserting functions for the different objects that may be used in different feeds.
As an e-commerce example, lets say I work with different suppliers who provide feeds to me. The feeds can be different (object) types: product, category, or order information. For each type of feed I obviously work with different fields and call different update or insert scripts.
What is the best language to implement this in? I can work with PHP but am looking for a project to start learning Perl or Python so this could be good for me as well.
If Perl or Python, can you briefly give high level implementation. So how to separate the different scripts, object oriented approach?, how to make it easy to implement new feeds or processing functions in the future, etc.
[full disclosure: There were already classes written in PHP which I used to create a new feed recently. I already did my job, but it was super messy and difficult to do. So this question is not 'Please help me do my job' but rather a 'best approach' type of question for my own development.]
Thanks! | Get remote text file, process, and update database - approach and scripting language to use? | 0.049958 | 0 | 0 | 1,025 |
1,051,254 | 2009-06-26T20:54:00.000 | -1 | 0 | 1 | 0 | python,package,skype,python-import | 1,051,265 | 19 | false | 0 | 0 | Go option #2. If ImportError is thrown, then the package is not installed (or not in sys.path). | 3 | 148 | 0 | What's a good way to check if a package is installed while within a Python script? I know it's easy from the interpreter, but I need to do it within a script.
I guess I could check if there's a directory on the system that's created during the installation, but I feel like there's a better way. I'm trying to make sure the Skype4Py package is installed, and if not I'll install it.
My ideas for accomplishing the check
check for a directory in the typical install path
try to import the package and if an exception is throw, then install package | Check if Python Package is installed | -0.010526 | 0 | 0 | 234,729 |
1,051,254 | 2009-06-26T20:54:00.000 | 0 | 0 | 1 | 0 | python,package,skype,python-import | 58,277,135 | 19 | false | 0 | 0 | Hmmm ... the closest I saw to a convenient answer was using the command line to try the import. But I prefer to even avoid that.
How about 'pip freeze | grep pkgname'? I tried it and it works well. It also shows you the version it has and whether it is installed under version control (install) or editable (develop). | 3 | 148 | 0 | What's a good way to check if a package is installed while within a Python script? I know it's easy from the interpreter, but I need to do it within a script.
I guess I could check if there's a directory on the system that's created during the installation, but I feel like there's a better way. I'm trying to make sure the Skype4Py package is installed, and if not I'll install it.
My ideas for accomplishing the check
check for a directory in the typical install path
try to import the package and if an exception is throw, then install package | Check if Python Package is installed | 0 | 0 | 0 | 234,729 |
1,051,254 | 2009-06-26T20:54:00.000 | 1 | 0 | 1 | 0 | python,package,skype,python-import | 62,093,901 | 19 | false | 0 | 0 | I would like to comment to @ice.nicer reply but I cannot, so ...
My observations is that packages with dashes are saved with underscores, not only with dots as pointed out by @dwich comment
For example, you do pip3 install sphinx-rtd-theme, but:
importlib.util.find_spec(sphinx_rtd_theme) returns an Object
importlib.util.find_spec(sphinx-rtd-theme) returns None
importlib.util.find_spec(sphinx.rtd.theme) raises ModuleNotFoundError
Moreover, some names are totally changed.
For example, you do pip3 install pyyaml but it is saved simply as yaml
I am using python3.8 | 3 | 148 | 0 | What's a good way to check if a package is installed while within a Python script? I know it's easy from the interpreter, but I need to do it within a script.
I guess I could check if there's a directory on the system that's created during the installation, but I feel like there's a better way. I'm trying to make sure the Skype4Py package is installed, and if not I'll install it.
My ideas for accomplishing the check
check for a directory in the typical install path
try to import the package and if an exception is throw, then install package | Check if Python Package is installed | 0.010526 | 0 | 0 | 234,729 |
1,051,275 | 2009-06-26T21:02:00.000 | 2 | 0 | 0 | 0 | python,curl,amazon-s3,amazon-web-services,boto | 1,051,338 | 6 | false | 0 | 0 | I don't know anything about python, but in general you would want to break the task down into smaller chunks so that they can be run concurrently. You could break it down by file type, or alphabetical or something, and then run a separate script for each portion of the break down. | 2 | 3 | 0 | What's the Fastest way to get a large number of files (relatively small 10-50kB) from Amazon S3 from Python? (In the order of 200,000 - million files).
At the moment I am using boto to generate Signed URLs, and using PyCURL to get the files one by one.
Would some type of concurrency help? PyCurl.CurlMulti object?
I am open to all suggestions. Thanks! | Downloading a Large Number of Files from S3 | 0.066568 | 0 | 1 | 3,744 |
1,051,275 | 2009-06-26T21:02:00.000 | 0 | 0 | 0 | 0 | python,curl,amazon-s3,amazon-web-services,boto | 1,051,408 | 6 | false | 0 | 0 | I've been using txaws with twisted for S3 work, though what you'd probably want is just to get the authenticated URL and use twisted.web.client.DownloadPage (by default will happily go from stream to file without much interaction).
Twisted makes it easy to run at whatever concurrency you want. For something on the order of 200,000, I'd probably make a generator and use a cooperator to set my concurrency and just let the generator generate every required download request.
If you're not familiar with twisted, you'll find the model takes a bit of time to get used to, but it's oh so worth it. In this case, I'd expect it to take minimal CPU and memory overhead, but you'd have to worry about file descriptors. It's quite easy to mix in perspective broker and farm the work out to multiple machines should you find yourself needing more file descriptors or if you have multiple connections over which you'd like it to pull down. | 2 | 3 | 0 | What's the Fastest way to get a large number of files (relatively small 10-50kB) from Amazon S3 from Python? (In the order of 200,000 - million files).
At the moment I am using boto to generate Signed URLs, and using PyCURL to get the files one by one.
Would some type of concurrency help? PyCurl.CurlMulti object?
I am open to all suggestions. Thanks! | Downloading a Large Number of Files from S3 | 0 | 0 | 1 | 3,744 |
1,051,652 | 2009-06-26T23:02:00.000 | 0 | 0 | 1 | 0 | python,multithreading,locking,twisted,mutex | 1,302,967 | 2 | false | 0 | 0 | Twisted lets you write event-driven code in a single thread. Multiple events can write to standard Python non-thread-safe data structures in a safe matter, and non-thread-safe data structures can be used as mutexes. If you do start using threads, then you have to worry about these things. But you don't have to use them.
So, as commented: use task.LoopingCall or reactor.CallLater for your task. Never call time.sleep(), let the reactor call your task at the right time (and do other work in between). Respond to your RPCs as they come.
There won't be two threads running your code at once. However, you don't know the order in which your callbacks will be called. Once you relinquish control to a Deferred, application state may have changed by the time you get it back. | 1 | 2 | 0 | I'm using the Twisted framework, and am getting RPCs asynchronously. I have another function which does a task every 2 seconds, and sleeps in between. This is called through reactor.callInThread. These depend on a shared resources, so I need some thread-safe way of accessing them. How does one go about using critical sections / mutexes / locks in twisted? | Mutex in Python Twisted | 0 | 0 | 0 | 3,964 |
1,052,716 | 2009-06-27T11:54:00.000 | 4 | 0 | 0 | 1 | python,multiprocessing,atexit | 1,053,223 | 3 | false | 0 | 0 | When you fork to make a child process, that child is an exact copy of the parent -- including of course registered exit functions as well as all other code and data structures. I believe that's the issue you're observing -- of course it's not mentioned in each and every module, because it necessarily applies to every single one. | 1 | 4 | 0 | I am writing a daemon program using python 2.5. In the main process an exit handler is registered with atexit module, it seems that the handler gets called when each child process ends, which is not I expected.
I noticed this behavior isn't mentioned in python atexit doc, anybody knows the issue? If this is how it should behave, how can I unregister the exit handler in children processes? There is a atexit.unregister in version 3.0, but I am using 2.5. | Is registered atexit handler inherited by spawned child processes? | 0.26052 | 0 | 0 | 2,133 |
1,052,957 | 2009-06-27T14:52:00.000 | 3 | 0 | 0 | 1 | python,macos,postgresql | 1,052,990 | 3 | true | 0 | 0 | macports tells me that the psycopg2 package has a dependency on the postgres client and libraries (but not the db server). If you successfully installed psycopg, then you should be good to go.
If you haven't installed yet, consider using macports or fink to deal with dependency resolution for you. In most cases, this will make things easier (occasionally build problems erupt). | 1 | 2 | 0 | I want to access a postgreSQL database that's running on a remote machine, from Python in OS/X. Do I have to install postgres on the mac as well? Or will psycopg2 work on its own.
Any hints for a good installation guide for psycopg2 for os/x? | psycopg2 on OSX: do I have to install PostgreSQL too? | 1.2 | 1 | 0 | 4,829 |
1,052,969 | 2009-06-27T14:56:00.000 | 1 | 0 | 0 | 0 | python,windows,emacs,elisp,ropemacs | 1,052,995 | 7 | false | 0 | 0 | You can roll your own in bash/cmd.exe. The windows emacs distribution comes with a .bat file called runemacs.bat which accepts files to open as arguments. Write a small script and it should be able to open everything up from one icon. | 1 | 7 | 0 | I say "project file" in the loosest sense. I have a few python projects that I work on with ropemacs using emacs W32 for Windows. What would be ideal is if I could have an icon I could click on on my desktop to open up emacs, open up the rope project, and set the speed bar in the top-level directory of that project. Then I could also maybe have a way to open up the next project in its own emacs set up the same way (but for that project). Of course, it's also acceptable if there were an emacs command or a shell command I could use to achieve the same effect instead of an icon on my desktop.
Is there any way to do this? I have absolutely no elisp-fu. :-( | Is there any way to create a "project file" in Emacs? | 0.028564 | 0 | 0 | 2,471 |
1,053,794 | 2009-06-27T22:41:00.000 | 1 | 0 | 1 | 0 | python,windows | 1,053,888 | 2 | false | 0 | 0 | just FYI, since both c:\python25 and c:\python26 are on PATH, I copy C:\Python25\python.exe to C:\Python25\py25.exe, and copy C:\Python26\python.exe to C:\Python26\py26.exe
Then just type py25(or py26) get the specific version. | 2 | 5 | 0 | I have two python installations, 2.5 and 2.6
I want to change the default python interpreter from 2.5 to 2.6.
Anyone know how? | Changing python interpreter windows | 0.099668 | 0 | 0 | 7,934 |
1,053,794 | 2009-06-27T22:41:00.000 | 10 | 0 | 1 | 0 | python,windows | 1,053,856 | 2 | true | 0 | 0 | PYTHONPATH is NOT what you are looking for. That is for varying where Python's "import" looks for packages and modules.
You need to change the PATH variable in your environment so that it contains e.g. "....;c:\python26;...." instead of "....;c:\python25;....". Click on start > control panel > system > advanced > environment variables. Select "path". Edit it. Click on OK enough times to get out of there. | 2 | 5 | 0 | I have two python installations, 2.5 and 2.6
I want to change the default python interpreter from 2.5 to 2.6.
Anyone know how? | Changing python interpreter windows | 1.2 | 0 | 0 | 7,934 |
1,055,443 | 2009-06-28T18:27:00.000 | 3 | 0 | 1 | 1 | python | 1,055,554 | 7 | false | 0 | 0 | just run the Python interpeter and type the command
import "lib_name"
if it gives an error, you don't have the lib installed...else you are good to go | 4 | 13 | 0 | I'm just starting out with Python, and have found out that I can import various libraries. How do I find out what libraries exist on my Mac that I can import? How do I find out what functions they include?
I seem to remember using some web server type thing to browse through local help files, but I may have imagined that! | How do I find out what Python libraries are installed on my Mac? | 0.085505 | 0 | 0 | 30,575 |
1,055,443 | 2009-06-28T18:27:00.000 | 39 | 0 | 1 | 1 | python | 1,055,453 | 7 | false | 0 | 0 | From the Python REPL (the command-line interpreter / Read-Eval-Print-Loop), type help("modules") to see a list of all your available libs.
Then to see functions within a module, do help("posix"), for example. If you haven't imported the library yet, you have to put quotes around the library's name. | 4 | 13 | 0 | I'm just starting out with Python, and have found out that I can import various libraries. How do I find out what libraries exist on my Mac that I can import? How do I find out what functions they include?
I seem to remember using some web server type thing to browse through local help files, but I may have imagined that! | How do I find out what Python libraries are installed on my Mac? | 1 | 0 | 0 | 30,575 |
1,055,443 | 2009-06-28T18:27:00.000 | 2 | 0 | 1 | 1 | python | 1,055,474 | 7 | false | 0 | 0 | On Leopard, depending on the python package you're using and the version number, the modules can be found in /Library/Python:
/Library/Python/2.5/site-packages
or in /Library/Frameworks
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages
(it could also be 3.0 or whatever version)...
I guess it is quite the same with Tiger | 4 | 13 | 0 | I'm just starting out with Python, and have found out that I can import various libraries. How do I find out what libraries exist on my Mac that I can import? How do I find out what functions they include?
I seem to remember using some web server type thing to browse through local help files, but I may have imagined that! | How do I find out what Python libraries are installed on my Mac? | 0.057081 | 0 | 0 | 30,575 |
1,055,443 | 2009-06-28T18:27:00.000 | 3 | 0 | 1 | 1 | python | 1,055,520 | 7 | false | 0 | 0 | You can install another library: yolk.
yolk is a python package manager and will show you everything you have added via pypi. But it will also show you site-packages added through whatever local package manager you run. | 4 | 13 | 0 | I'm just starting out with Python, and have found out that I can import various libraries. How do I find out what libraries exist on my Mac that I can import? How do I find out what functions they include?
I seem to remember using some web server type thing to browse through local help files, but I may have imagined that! | How do I find out what Python libraries are installed on my Mac? | 0.085505 | 0 | 0 | 30,575 |
1,056,051 | 2009-06-28T23:37:00.000 | 1 | 1 | 0 | 0 | python,c,interop,cross-domain | 1,056,105 | 9 | false | 0 | 1 | I haven't used an IPC approach for Python<->C communication but it should work pretty well. I would have the C program do a standard fork-exec and use redirected stdin and stdout in the child process for the communication. A nice text-based communication will make it very easy to develop and test the Python program. | 3 | 52 | 0 | I want to extend a large C project with some new functionality, but I really want to write it in Python. Basically, I want to call Python code from C code. However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.
I'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing/reading from a socket (or unix pipe). my python component can read/write to socket to communicate. Is that a reasonable approach? Is there something better? Like some special RPC mechanism?
Thanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program. I don't want to embed a Python interpreter. Thanks! | How do you call Python code from C code? | 0.022219 | 0 | 0 | 79,185 |
1,056,051 | 2009-06-28T23:37:00.000 | 0 | 1 | 0 | 0 | python,c,interop,cross-domain | 1,621,442 | 9 | false | 0 | 1 | apparently Python need to be able to compile to win32 dll, it will solve the problem
In such a way that converting c# code to win32 dlls will make it usable by any development tool | 3 | 52 | 0 | I want to extend a large C project with some new functionality, but I really want to write it in Python. Basically, I want to call Python code from C code. However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.
I'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing/reading from a socket (or unix pipe). my python component can read/write to socket to communicate. Is that a reasonable approach? Is there something better? Like some special RPC mechanism?
Thanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program. I don't want to embed a Python interpreter. Thanks! | How do you call Python code from C code? | 0 | 0 | 0 | 79,185 |
1,056,051 | 2009-06-28T23:37:00.000 | 7 | 1 | 0 | 0 | python,c,interop,cross-domain | 1,056,087 | 9 | false | 0 | 1 | Have you considered just wrapping your python application in a shell script and invoking it from within your C application?
Not the most elegant solution, but it is very simple. | 3 | 52 | 0 | I want to extend a large C project with some new functionality, but I really want to write it in Python. Basically, I want to call Python code from C code. However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.
I'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing/reading from a socket (or unix pipe). my python component can read/write to socket to communicate. Is that a reasonable approach? Is there something better? Like some special RPC mechanism?
Thanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program. I don't want to embed a Python interpreter. Thanks! | How do you call Python code from C code? | 1 | 0 | 0 | 79,185 |
1,058,273 | 2009-06-29T13:22:00.000 | 1 | 0 | 1 | 0 | python,math,functional-programming | 1,058,290 | 5 | false | 0 | 0 | I would call it function compositor or something like that | 4 | 1 | 0 | What should 'foo' be called, given the following?
x.items is a set, y.values is a set.
function a(key) returns an ordered list of x.items
function b(x.item) returns a single y.value
Define foo(a, b), which returns a function, d, such that d(key) returns a list of y.values defined by: map(b, a(key)).
This feels like a fairly common and generic function composition but I don't know what to call it. | What should I call this function composition? | 0.039979 | 0 | 0 | 276 |
1,058,273 | 2009-06-29T13:22:00.000 | 0 | 0 | 1 | 0 | python,math,functional-programming | 1,058,328 | 5 | false | 0 | 0 | The synergy engine. | 4 | 1 | 0 | What should 'foo' be called, given the following?
x.items is a set, y.values is a set.
function a(key) returns an ordered list of x.items
function b(x.item) returns a single y.value
Define foo(a, b), which returns a function, d, such that d(key) returns a list of y.values defined by: map(b, a(key)).
This feels like a fairly common and generic function composition but I don't know what to call it. | What should I call this function composition? | 0 | 0 | 0 | 276 |
1,058,273 | 2009-06-29T13:22:00.000 | 1 | 0 | 1 | 0 | python,math,functional-programming | 1,107,216 | 5 | false | 0 | 0 | I would call that function permuted_values
What you are doing is equivalent to iterating over a hash map using a permutation based on your key. | 4 | 1 | 0 | What should 'foo' be called, given the following?
x.items is a set, y.values is a set.
function a(key) returns an ordered list of x.items
function b(x.item) returns a single y.value
Define foo(a, b), which returns a function, d, such that d(key) returns a list of y.values defined by: map(b, a(key)).
This feels like a fairly common and generic function composition but I don't know what to call it. | What should I call this function composition? | 0.039979 | 0 | 0 | 276 |
1,058,273 | 2009-06-29T13:22:00.000 | 0 | 0 | 1 | 0 | python,math,functional-programming | 1,058,402 | 5 | false | 0 | 0 | Here's are example names for a, b, and foo that might help (I don't like these, but they're sort of like what I'm getting at):
items_by_key(key)
value_by_item(item)
values_by_key(items_by_key, value_by_item) | 4 | 1 | 0 | What should 'foo' be called, given the following?
x.items is a set, y.values is a set.
function a(key) returns an ordered list of x.items
function b(x.item) returns a single y.value
Define foo(a, b), which returns a function, d, such that d(key) returns a list of y.values defined by: map(b, a(key)).
This feels like a fairly common and generic function composition but I don't know what to call it. | What should I call this function composition? | 0 | 0 | 0 | 276 |
1,059,214 | 2009-06-29T16:26:00.000 | 0 | 0 | 0 | 0 | python,performance,wxpython,tkinter,richtextediting | 1,070,836 | 2 | false | 0 | 1 | It kind of avoids the question slightly, but could you use wxStyledTextCtrl instead? | 2 | 0 | 0 | I've made a small tool that parses a chunk of text, does some simple processing (retrieves values from a dictionary, a few regex, etc.) and then spits the results.
In order to make easier to read the results, I made two graphic ports, one with tkInter and other with wxPython, so the output is nicely displayed in a Text Area with some words having different colours.
The tkInter implementation uses Tkinter.Text object and to apply the colours to the words uses tags (configured with the method Tkinter.Text.tag_config and passing them to Tkinter.Text.insert), and the measured while outputting about 400 different coloured words is < 0.02s.
The wxPython implementation uses wx.richtext.RichTextCtrl and to apply the colours to the words uses wx.richtext.RichTextCtrl.BeginTextColour and then wx.richtext.RichTextCtrl.AppendText; the performance is ridiculous, it takes abut 1.4s to do the same job that only took 0.02s to the tkInter port.
Is this an intrinsic problem of the RichTextCtrl widget, the wxPython bindings, or there is some way to speed it up?
Thanks! | wxPython RichTextCtrl much slower than tkInter Text? | 0 | 0 | 0 | 1,031 |
1,059,214 | 2009-06-29T16:26:00.000 | 1 | 0 | 0 | 0 | python,performance,wxpython,tkinter,richtextediting | 1,189,222 | 2 | true | 0 | 1 | I'm copying here the comment that solved the problem:
Have you tried using Freeze() and
Thaw() to only update the display
after you are done appending the
coloured text? – mghie Jun 30 at 7:20 | 2 | 0 | 0 | I've made a small tool that parses a chunk of text, does some simple processing (retrieves values from a dictionary, a few regex, etc.) and then spits the results.
In order to make easier to read the results, I made two graphic ports, one with tkInter and other with wxPython, so the output is nicely displayed in a Text Area with some words having different colours.
The tkInter implementation uses Tkinter.Text object and to apply the colours to the words uses tags (configured with the method Tkinter.Text.tag_config and passing them to Tkinter.Text.insert), and the measured while outputting about 400 different coloured words is < 0.02s.
The wxPython implementation uses wx.richtext.RichTextCtrl and to apply the colours to the words uses wx.richtext.RichTextCtrl.BeginTextColour and then wx.richtext.RichTextCtrl.AppendText; the performance is ridiculous, it takes abut 1.4s to do the same job that only took 0.02s to the tkInter port.
Is this an intrinsic problem of the RichTextCtrl widget, the wxPython bindings, or there is some way to speed it up?
Thanks! | wxPython RichTextCtrl much slower than tkInter Text? | 1.2 | 0 | 0 | 1,031 |
1,059,594 | 2009-06-29T17:56:00.000 | 0 | 0 | 1 | 1 | python,installation,distutils | 1,085,582 | 2 | false | 0 | 0 | using "python2.3" can be wrong if another (default) installation patched PATH to itself only.
Task can be solved by:
finding full path to desired python interpreter, on ActivePython it is C:\Python26 for default installation of Python 2.6
make a full path to binary (in this case C:\Python26\python.exe)
execute module install command from unpacked module directory using full path to interpreter: C:\Python26\python.exe setup.py install | 1 | 1 | 0 | I have a Windows machine with Python 2.3, 2.6 and 3.0 installed and 2.5 installed with Cygwin. I've downloaded the pexpect package but when I run "python setup.py install" it installs to the 2.6 installation.
How could I have it install to the Cygwin Python installation, or any other installation? | How do I install with distutils to a specific Python installation? | 0 | 0 | 0 | 327 |
1,060,334 | 2009-06-29T20:28:00.000 | 1 | 0 | 0 | 0 | python,pylons,payment-gateway,payment | 1,060,758 | 3 | false | 0 | 0 | That's something usual to do. Please follow the instructions your payment gateway gives you on how to send info to them, and write the code. If you have some issue, feel free to ask a more specific question. | 2 | 2 | 0 | I'm building an application that eventually needs to process cc #s. I'd like to handle it completely in my app, and then hand off the information securely to my payment gateway. Ideally the user would have no interaction with the payment gateway directly.
Any thoughts? Is there an easier way? | payment processing - pylons/python | 0.066568 | 0 | 0 | 1,120 |
1,060,334 | 2009-06-29T20:28:00.000 | 1 | 0 | 0 | 0 | python,pylons,payment-gateway,payment | 1,063,700 | 3 | false | 0 | 0 | You will probably find that it's easier to just let the payment gateway handle it. It's best to leave PCI compliance to the experts. | 2 | 2 | 0 | I'm building an application that eventually needs to process cc #s. I'd like to handle it completely in my app, and then hand off the information securely to my payment gateway. Ideally the user would have no interaction with the payment gateway directly.
Any thoughts? Is there an easier way? | payment processing - pylons/python | 0.066568 | 0 | 0 | 1,120 |
1,063,626 | 2009-06-30T13:14:00.000 | 7 | 0 | 0 | 0 | python,django,unicode | 1,063,665 | 2 | true | 1 | 0 | You are probably storing the template in a non-unicode encoding, such as latin-1. I believe Django assumes that templates are in UTF-8 by default (though there is a setting to override this).
Your editor should be capable of saving the template file in the UTF-8 encoding (probably via a dropdown on the save as page, though this may depend on your editor). Re-save the file as UTF-8, and the error should go away. | 1 | 5 | 0 | I have some french letters (é, è, à...) in a django template but when it is loaded by django, an UnicodeDecodeError exception is raised.
If I don't load the template but directly use a python string. It works ok.
Is there something to do to use unicode with django template? | how to use french letters in a django template? | 1.2 | 0 | 0 | 4,002 |
1,063,770 | 2009-06-30T13:45:00.000 | -10 | 0 | 0 | 0 | python,transactions,pyodbc | 1,063,879 | 2 | false | 0 | 0 | I don't think pyodbc has any specific support for transactions. You need to send the SQL command to start/commit/rollback transactions. | 1 | 15 | 0 | I have a username which I must change in numerous (up to ~25) tables. (Yeah, I know.) An atomic transaction seems to be the way to go for this sort of thing. However, I do not know how to do this with pyodbc. I've seen various tutorials on atomic transactions before, but have never used them.
The setup: Windows platform, Python 2.6, pyodbc, Microsoft SQL 2005. I've used pyodbc for single SQL statements, but no compound statements or transactions.
Best practices for SQL seem to suggest that creating a stored procedure is excellent for this. My fears about doing a stored procedure are as follows, in order of increasing importance:
1) I have never written a stored procedure.
2) I heard that pyodbc does not return results from stored procedures as of yet.
3) This is most definitely Not My Database. It's vendor-supplied, vendor-updated, and so forth.
So, what's the best way to go about this? | In Python, Using pyodbc, How Do You Perform Transactions? | -1 | 1 | 0 | 27,883 |
1,064,520 | 2009-06-30T15:56:00.000 | 2 | 0 | 0 | 0 | python,django,api,django-models,django-admin | 1,064,563 | 2 | false | 1 | 0 | Web services API's are just more URL's.
These WS API URL's map to view functions.
The WS view functions handle GET and POST (and possibly PUT and DELETE).
The WS view functions use Forms as well as the Models to make things happen.
It is, in a way, like an admin interface. Except, there's no HTML.
The WS view functions respond with JSON messages or XML messages. | 1 | 2 | 0 | I am adding MetaWeblog API support to a Django CMS, and am not quite sure how to layer the application.
I am using django_xmlrpc, which allows me to map to parameterised functions for each request. It is just a case of what level do I hook in calls to the django application from the service functions (AddPage, EditPage etc)
For django-page-cms, and I suppose many django apps, the business logic and validation is contained within the forms. In this case there is PageForm(forms.ModelForm) and PageAdmin(ModelAdmin), which both contain a lot of logic and validation.
If I am to build an API to allow maintenance of pages and content, does this mean I should be programmatically creating and filling a PageAdmin instance? Then catching any exceptions, and converting to their api equivalent? Or would this be a bad idea - misusing what forms are intended for?
The other option is refactoring the code so that business and logic is kept outside of the form classes. Then I would have the form and api, both go through the separate business logic.
Any other alternatives?
What would be the best solution? | What is the best way to add an API to a Django application? | 0.197375 | 0 | 0 | 299 |
1,065,964 | 2009-06-30T20:46:00.000 | 1 | 0 | 0 | 0 | python,ide,pylons | 3,596,813 | 9 | false | 0 | 1 | Try Aptana Studio... It's eclipse+pydev+web stuff, it doesnt have any specific pylons stuff or mako support. But eclipse+pydev alone is great + all the nice jscript+html+css stuff aptana adds. | 4 | 8 | 0 | I have been reading through this wonderful website regarding the recommended Python IDEs and have narrowed it down to either
WingIDE
KomodoIDE
which you guys will recommend for the purpose of developing Pylons apps? I know that most questions have been asked pertaining to Python IDEs but how about Python web framework IDEs which is a mishmash of various templating languages and Python itself.
One con i have to raise about WingIDE on Windows is that it has an AWFUL interface (probably cos of the GTK+ toolkit?)
I have been using e-text editor all the while and increasingly been dissatisfied with it especially when its unable to do correct syntax highlighting at times. Furthermore I am hoping syntax coloration can be done for Mako templates.
Thank you very much all and have a great day! | Recommended IDE for developing Pylons apps | 0.022219 | 0 | 0 | 4,484 |
1,065,964 | 2009-06-30T20:46:00.000 | 0 | 0 | 0 | 0 | python,ide,pylons | 2,364,669 | 9 | false | 0 | 1 | Wow, I've also been looking for a good Pylons web app IDE. Seems like KomodoIDE 5.1 kicks some serious ass. I love the support for Mako and that it supports pretty much all of the SCMs.
I've been using Textmate, but KomodoIDE will take over from now onwards | 4 | 8 | 0 | I have been reading through this wonderful website regarding the recommended Python IDEs and have narrowed it down to either
WingIDE
KomodoIDE
which you guys will recommend for the purpose of developing Pylons apps? I know that most questions have been asked pertaining to Python IDEs but how about Python web framework IDEs which is a mishmash of various templating languages and Python itself.
One con i have to raise about WingIDE on Windows is that it has an AWFUL interface (probably cos of the GTK+ toolkit?)
I have been using e-text editor all the while and increasingly been dissatisfied with it especially when its unable to do correct syntax highlighting at times. Furthermore I am hoping syntax coloration can be done for Mako templates.
Thank you very much all and have a great day! | Recommended IDE for developing Pylons apps | 0 | 0 | 0 | 4,484 |
1,065,964 | 2009-06-30T20:46:00.000 | 1 | 0 | 0 | 0 | python,ide,pylons | 4,134,659 | 9 | false | 0 | 1 | +1 for Spyder. Never heard of it before reading this page. Working great so far. | 4 | 8 | 0 | I have been reading through this wonderful website regarding the recommended Python IDEs and have narrowed it down to either
WingIDE
KomodoIDE
which you guys will recommend for the purpose of developing Pylons apps? I know that most questions have been asked pertaining to Python IDEs but how about Python web framework IDEs which is a mishmash of various templating languages and Python itself.
One con i have to raise about WingIDE on Windows is that it has an AWFUL interface (probably cos of the GTK+ toolkit?)
I have been using e-text editor all the while and increasingly been dissatisfied with it especially when its unable to do correct syntax highlighting at times. Furthermore I am hoping syntax coloration can be done for Mako templates.
Thank you very much all and have a great day! | Recommended IDE for developing Pylons apps | 0.022219 | 0 | 0 | 4,484 |
1,065,964 | 2009-06-30T20:46:00.000 | 0 | 0 | 0 | 0 | python,ide,pylons | 1,085,987 | 9 | true | 0 | 1 | after very very careful comparison, KomodoIDE 5.1 is most suitable for my purposes.
Reasons:
Extensibility
Support for Mako and YUI (required by me)
Native interface support (no GTK unfamiliarity)
Support for Mercurial SCM (required by me)
thats all I guess. I am extremely satisfied with KomodoIDE and have just shelled out some money to buy it.
I figured when making a choice of tools, spend a day or two (yes, it takes time) trying them out and choosing what best suits your day-to-day purposes. If its just your first time coding, using a standard free tool or open source tool is far more useful than expending the time to find out the best tool.
Only after some degree of expertise is acquired, you have a very narrow spectrum of requirements/preferences which will make choosing a tool far easier. | 4 | 8 | 0 | I have been reading through this wonderful website regarding the recommended Python IDEs and have narrowed it down to either
WingIDE
KomodoIDE
which you guys will recommend for the purpose of developing Pylons apps? I know that most questions have been asked pertaining to Python IDEs but how about Python web framework IDEs which is a mishmash of various templating languages and Python itself.
One con i have to raise about WingIDE on Windows is that it has an AWFUL interface (probably cos of the GTK+ toolkit?)
I have been using e-text editor all the while and increasingly been dissatisfied with it especially when its unable to do correct syntax highlighting at times. Furthermore I am hoping syntax coloration can be done for Mako templates.
Thank you very much all and have a great day! | Recommended IDE for developing Pylons apps | 1.2 | 0 | 0 | 4,484 |
1,066,710 | 2009-07-01T00:01:00.000 | 0 | 0 | 1 | 0 | python,multiprocessing | 1,066,750 | 4 | false | 0 | 0 | Sure you can. Expecially if you are using fork to spawn child processes, they works as perfectly normal processes (like the father). Thread management is quite different, but you can also use "second level" sub-treading.
Pay attention to not over-complicate your program, as example program with two level threads are normally unused. | 1 | 4 | 0 | I want to do a program and want make a the spawn like this process -> n process -> n process
can the second level spawn process with multiprocessing ? using multiprocessinf module of python 2.6
thnx | Multiprocessing in python with more then 2 levels | 0 | 0 | 0 | 2,092 |
1,068,573 | 2009-07-01T11:21:00.000 | 2 | 0 | 0 | 0 | python,django,formatting,django-templates | 1,068,601 | 4 | false | 1 | 0 | Since you are doing static comparison (no queries needed), you should go for the most DRY and easy to implement option. In this case, I would go for option 4, make a template filter. Then you could do value|filter to get the class you would need to set the background colour. Template filters are actually a bit simpler than template tags to implement. | 1 | 8 | 0 | What is the correct way to do conditional formatting in Django?
I have a model that contains a date field, and I would like to display a list of records, but colour the rows depending on the value of that date field. For example, records that match today's date I want to be yellow, records that is before today I want green and ones after I want red.
Somewhere in Django you will need to do that comparison, comparing the current date with the date in the record.
I can see three different places that comparison could be done:
Add a method to my model, for example, status(), that returns either 'past', 'present', 'future' and then use that in the template to colour the rows.
In the view instead of returning a queryset to the template, pre-process the list and compare each record, build a new dict containing the 'past', 'present' and 'future' values to be used in the template
Create a new template tag that does the comparison.
Which of these methods is the correct Django way of doing it? It sounds like conditional formating is something that would come up quite often, and since you can't do arbitrary comparisons in the template some other solution is needed.
The same would apply for simpler formatting rules, for example, if I wanted to display a list of student grades, and I wanted to make the ones higher than 80% green and the ones below 30% red. | Django way to do conditional formatting | 0.099668 | 0 | 0 | 6,131 |
1,070,932 | 2009-07-01T19:37:00.000 | 0 | 0 | 0 | 0 | python,windows,mfc,file | 1,071,011 | 1 | true | 0 | 1 | I think that the Python code needs to know the document structure.
Maybe you should make a python wrapper of your c++ code.
In this case, I would recommend to use http://sourceforge.net/projects/pycpp/>pycpp which is my opinion a great library for making python extensions in c++. | 1 | 1 | 0 | I want to use Python to access MFC document files generically? Can CArchive be used to query a file and view the structure, or does Python, in opening the document, need to know more about the document structure in order to view the contents? | How To: View MFC Doc File in Python | 1.2 | 0 | 0 | 216 |
1,071,071 | 2009-07-01T20:03:00.000 | 2 | 0 | 0 | 0 | python,nginx,pylons,paste,paster | 1,071,117 | 7 | false | 0 | 0 | As I understand your question, you start some application to listen on port 5000. Then without stopping it (?), you try to start another instance to listen on het same port? If so, you won't succeed.
You can always check what application is listening on what port number by using netstat (for both Windows and UNIX-like systems, I have no experience with others). | 3 | 4 | 0 | I'm running pylons and I did this:
paster server development.ini
It's running on :5000
But when I try to run the command again:
paster serve development.ini
I get this message:
socket.error: [Errno 98] Address already in use
Any ideas? | Pylons: address already in use when trying to serve | 0.057081 | 0 | 0 | 14,021 |
1,071,071 | 2009-07-01T20:03:00.000 | 1 | 0 | 0 | 0 | python,nginx,pylons,paste,paster | 2,933,318 | 7 | false | 0 | 0 | This has also happened to me when the server died unexpectedly, and didn't close it's socket's properly. Essentially, the socket is still listed as open with the operating system, even though the process has died. I've found if I wait for 30-60 seconds, the OS will realize the associated process has died, and cleanup the sockets automatically. | 3 | 4 | 0 | I'm running pylons and I did this:
paster server development.ini
It's running on :5000
But when I try to run the command again:
paster serve development.ini
I get this message:
socket.error: [Errno 98] Address already in use
Any ideas? | Pylons: address already in use when trying to serve | 0.028564 | 0 | 0 | 14,021 |
1,071,071 | 2009-07-01T20:03:00.000 | 0 | 0 | 0 | 0 | python,nginx,pylons,paste,paster | 8,516,490 | 7 | false | 0 | 0 | your default port 8080 is using.
you should add '-p 10000'
after command to take port 10000 | 3 | 4 | 0 | I'm running pylons and I did this:
paster server development.ini
It's running on :5000
But when I try to run the command again:
paster serve development.ini
I get this message:
socket.error: [Errno 98] Address already in use
Any ideas? | Pylons: address already in use when trying to serve | 0 | 0 | 0 | 14,021 |
1,072,028 | 2009-07-02T00:51:00.000 | 2 | 0 | 1 | 0 | python,python-3.x | 1,072,044 | 3 | false | 0 | 0 | Without a really compelling reason to upgrade, I would stick with what works. I looked at upgrading the scripts I use daily and it was too much work for no benefit that I could see.
"If it ain't broke, don't fix it!" | 1 | 4 | 0 | So with the final releases of Python 3.0 (and now 3.1), a lot of people are facing the worry of how to upgrade without losing half their codebase due to backwards incompatibility.
What are people's best tips for avoiding the many pitfalls that will almost-inevitably result from switching to the next-generation of python?
Probably a good place to start is "use 2to3 to convert your python 2.x code to 3.x" :-) | Tips on upgrading to python 3.0? | 0.132549 | 0 | 0 | 1,513 |
1,072,530 | 2009-07-02T04:42:00.000 | 3 | 1 | 1 | 0 | c#,.net,python,dynamic-languages | 1,073,426 | 8 | false | 0 | 0 | You're going to experience quite a bit of culture-shock going from C# to the wild duck-typed outback of Python. Lack of types and intellisense can be pretty daunting. Good thing that you're experienced in JavaScript. Also know that indent-sensitive block rules of Python can be very confusing for the inexperience (usually you either love it or hate it :-)
Apart from that the biggest challenge moving from one language to another is usually the framework. Getting to know all the classes and functions Just Takes Time unfortunately. | 2 | 22 | 0 | I have been doing active development in C# for several years now. I primarily build enterprise application and in house frameworks on the .NET stack.
I've never had the need to use any other mainstream high level languages besides C# for my tasks, since .NET is the standard platform we use.
There are some legacy Python applications that I have been asked to support going forward, I have no exposure to python and dynamic languages in general(although I've done a fair bit of JavaScript).
I was hoping to get some guidance/advise to aid in how to go about learning a language like python for the statically typed mind.
EDIT: Using IronPython is not an option! | Learning Python for a .NET developer | 0.07486 | 0 | 0 | 14,771 |
1,072,530 | 2009-07-02T04:42:00.000 | 4 | 1 | 1 | 0 | c#,.net,python,dynamic-languages | 1,072,788 | 8 | false | 0 | 0 | There is a big initial hurdle of getting comfortable with dynamic typing. The first step is when you look at Python-code and realize that variables aren't defined anywhere, you just create them out of thin air, which feels like jumping over a cliff. There is a brief moment before your hang glider catches the air properly.
And then it's going to take time before you trust your newfound dynamic wings, and you probably only can get their by doing aerobatics with them. Learn how python handles references, have fun with monkey-patching methods, duck type various animals. Try to learn some ugly tricks.
And although you can't use IronPython for this, there is no reason you can't use it to learn Python. | 2 | 22 | 0 | I have been doing active development in C# for several years now. I primarily build enterprise application and in house frameworks on the .NET stack.
I've never had the need to use any other mainstream high level languages besides C# for my tasks, since .NET is the standard platform we use.
There are some legacy Python applications that I have been asked to support going forward, I have no exposure to python and dynamic languages in general(although I've done a fair bit of JavaScript).
I was hoping to get some guidance/advise to aid in how to go about learning a language like python for the statically typed mind.
EDIT: Using IronPython is not an option! | Learning Python for a .NET developer | 0.099668 | 0 | 0 | 14,771 |
1,072,920 | 2009-07-02T07:02:00.000 | -1 | 0 | 0 | 0 | php,python,frameworks | 1,073,087 | 8 | false | 1 | 0 | Kentico,Umbraco and Sitefinity,DotNetNuke are meant for developers/designers/integrators. Use Wordpress or if you are looking for .NET version use Community server. | 2 | 7 | 0 | Hi,
Which are the user friendly frameworks for building personal sites? Specially if that comes with little programming knowledge. And integrated jquery will be great. python or php based framework will do better.
I tried wordpress and joomla! But those are far more complex for a simple personal site with personal blogging, live commenting, twitting, keeping personal projects and resume etc.
Please suggest me. Thanks in advance. | user friendly framework for personal website? | -0.024995 | 0 | 0 | 6,057 |
1,072,920 | 2009-07-02T07:02:00.000 | 0 | 0 | 0 | 0 | php,python,frameworks | 22,913,432 | 8 | false | 1 | 0 | AnchorCMS gets a lot of good feedback, give it a try. | 2 | 7 | 0 | Hi,
Which are the user friendly frameworks for building personal sites? Specially if that comes with little programming knowledge. And integrated jquery will be great. python or php based framework will do better.
I tried wordpress and joomla! But those are far more complex for a simple personal site with personal blogging, live commenting, twitting, keeping personal projects and resume etc.
Please suggest me. Thanks in advance. | user friendly framework for personal website? | 0 | 0 | 0 | 6,057 |
1,075,304 | 2009-07-02T16:16:00.000 | 3 | 1 | 0 | 1 | python,eclipse,pydev,scons | 1,075,694 | 6 | true | 1 | 0 | I'm not an Eclipse expert, but since you didn't get any other answer...
If you make the SCons source a part of the Eclipse project, and run the whole command from within Eclipse it should work like any Eclipse debugging. SCons is written in Python, there is no reason it shouldn't be debuggable in Eclipse just like anything else. | 5 | 4 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | How to debug SCons scripts using eclipse and pydev? | 1.2 | 0 | 0 | 2,414 |
1,075,304 | 2009-07-02T16:16:00.000 | 0 | 1 | 0 | 1 | python,eclipse,pydev,scons | 45,216,082 | 6 | false | 1 | 0 | As an addendum: on Windows, I had to copy the scons-installed files to reside under C:\Python27\Lib\site-packages\scons in order for this to work. Adding the original installed location, qualified with the version number, to the PYTHONPATH, did not work. | 5 | 4 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | How to debug SCons scripts using eclipse and pydev? | 0 | 0 | 0 | 2,414 |
1,075,304 | 2009-07-02T16:16:00.000 | 1 | 1 | 0 | 1 | python,eclipse,pydev,scons | 15,386,322 | 6 | false | 1 | 0 | On MAC to debug scons through pydev follow Lennart's answer but with one simply addition.
Using Finder (or terminal) browse to where scons is installed. You can find this with the "which" command.
e.g. which scons
-> /usr/local/bin/scons
Make a copy of the scons file and call it scons.py.
Now when you create the Debug Configuration in Eclipse use scons.py as the "Main Module".
PS: To add a scons project to Eclipse I found it easier to use a "Linked Folder" pointing at /usr/local/bin/. i.e. Because I was getting a read-only error when trying to add the directory itself. | 5 | 4 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | How to debug SCons scripts using eclipse and pydev? | 0.033321 | 0 | 0 | 2,414 |
1,075,304 | 2009-07-02T16:16:00.000 | 6 | 1 | 0 | 1 | python,eclipse,pydev,scons | 1,077,102 | 6 | false | 1 | 0 | You are right. Since the SCons is python based, the SCons scripts are debuggable via EClipse PyDev. For this, you need to do the following in the debug configuration...
1. Under the main tab, set the main module to the SCons file which will be available under the python/scripts directory if you have installed SCons. If you have not run the install of SCons you can point to this file under the SCons directory.
2. Under the arguments tab, set the working directory to the root of your project.
Now set the breakpoint either on SConstruct or SConcript and run in debug mode. That's all!!
With this approach you can not only debug your product code but also the build scripts that builds your product :-) Happy Debugging!!!! | 5 | 4 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | How to debug SCons scripts using eclipse and pydev? | 1 | 0 | 0 | 2,414 |
1,075,304 | 2009-07-02T16:16:00.000 | 0 | 1 | 0 | 1 | python,eclipse,pydev,scons | 32,887,089 | 6 | false | 1 | 0 | I've since gain more experience with SCons / Python and I'd recommend using python's pdb module. To use it simply add the following code to your SCons/Python files.
import pdb; pdb.set_trace()
When the file is run from the command line a breakpoint will be hit at this line. I also moved away from Eclipse. A lightweight editor will be just as good for Python development. I use Sublime. | 5 | 4 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | How to debug SCons scripts using eclipse and pydev? | 0 | 0 | 0 | 2,414 |
1,075,391 | 2009-07-02T16:32:00.000 | 7 | 1 | 0 | 1 | python,linux,ext3 | 1,075,459 | 2 | true | 0 | 0 | no need for ext3-specific hooks; just check lsof, or more exactly, /proc/<pid>/fd/* and /proc/<pid>/fdinfo/* (that's where lsof gets it's info, AFAICT). There you can check if the file is open, if it's writeable, and the 'cursor' position.
That's not the whole picture; but any more is done in processpace by stdlib on the writing process, as most writes are buffered and the kernel only sees bigger chunks of data, so any 'ext3-aware' monitor wouldn't get that either. | 1 | 4 | 0 | We have several cron jobs that ftp proxy logs to a centralized server. These files can be rather large and take some time to transfer. Part of the requirement of this project is to provide a logging mechanism in which we log the success or failure of these transfers. This is simple enough.
My question is, is there a way to check if a file is currently being written to? My first solution was to just check the file size twice within a given timeframe and check the file size. But a co-worker said that there may be able to hook into the EXT3 file system via python and check the attributes to see if the file is currently being appended to. My Google-Fu came up empty.
Is there a module for EXT3 or something else that would allow me to check the state of a file? The server is running Fedora Core 9 with EXT3 file system. | Does python have hooks into EXT3 | 1.2 | 0 | 0 | 640 |
1,077,273 | 2009-07-02T23:57:00.000 | 0 | 0 | 1 | 0 | python,django,ide | 1,108,063 | 9 | false | 0 | 0 | You should notice that cscope targets only the UNIX, Linux OSs. | 4 | 11 | 0 | A specific example: becoming familiar with django's project source code (core, contrib, utils, etc.). Example of a useful tool: ctags - it allows you to "jump" to the file+location where a function/method is defined. Wondering about other tools that developers use (example: is there a tool that given a function x(), lists the functions that call x() and that are called by x()?). Thanks.
Edit: added an answer with an aggregate of tools mentioned so far in other answers | tools to aid in browsing/following (large) python projects' source code | 0 | 0 | 0 | 5,688 |
1,077,273 | 2009-07-02T23:57:00.000 | 0 | 0 | 1 | 0 | python,django,ide | 1,077,377 | 9 | false | 0 | 0 | This is subjective so I think it should probably be a community wiki. That said, the best thing you can probably do to make browsing large projects is to be familiar with hotkeys provided in your favourite IDE. Using the keyboard to browse through large source code is much easier than manually scrolling through text, highlighting text and fumbling through an IDE with a mouse. | 4 | 11 | 0 | A specific example: becoming familiar with django's project source code (core, contrib, utils, etc.). Example of a useful tool: ctags - it allows you to "jump" to the file+location where a function/method is defined. Wondering about other tools that developers use (example: is there a tool that given a function x(), lists the functions that call x() and that are called by x()?). Thanks.
Edit: added an answer with an aggregate of tools mentioned so far in other answers | tools to aid in browsing/following (large) python projects' source code | 0 | 0 | 0 | 5,688 |
1,077,273 | 2009-07-02T23:57:00.000 | 1 | 0 | 1 | 0 | python,django,ide | 1,078,006 | 9 | false | 0 | 0 | Many (or even most, I should say) IDE's help you in this by enabling you do go to variable and function definitions, often by just Ctrl+click, or showing you class overviews where you can see all methods and attributes a class has including those inherited, and letting you go to their definition, etc, etc, etc. I can't recommend such a tool highly enough, it's very time-saving for development.
I personally use WingIDE, which is excellent and has all these features, but you should also check out KomodoEdit and Eclipse+PyDev. There maybe more that I don't know of, and it's fully possible that vim and emacs have some sort of plugins for this. | 4 | 11 | 0 | A specific example: becoming familiar with django's project source code (core, contrib, utils, etc.). Example of a useful tool: ctags - it allows you to "jump" to the file+location where a function/method is defined. Wondering about other tools that developers use (example: is there a tool that given a function x(), lists the functions that call x() and that are called by x()?). Thanks.
Edit: added an answer with an aggregate of tools mentioned so far in other answers | tools to aid in browsing/following (large) python projects' source code | 0.022219 | 0 | 0 | 5,688 |
1,077,273 | 2009-07-02T23:57:00.000 | 0 | 0 | 1 | 0 | python,django,ide | 1,077,398 | 9 | false | 0 | 0 | Document it as you go. Leave trails, improve the structure, and keep notes. By the time you've found you way around the enter codebase, you'll have a good map. | 4 | 11 | 0 | A specific example: becoming familiar with django's project source code (core, contrib, utils, etc.). Example of a useful tool: ctags - it allows you to "jump" to the file+location where a function/method is defined. Wondering about other tools that developers use (example: is there a tool that given a function x(), lists the functions that call x() and that are called by x()?). Thanks.
Edit: added an answer with an aggregate of tools mentioned so far in other answers | tools to aid in browsing/following (large) python projects' source code | 0 | 0 | 0 | 5,688 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.