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,388,464 | 2009-09-07T09:36:00.000 | 0 | 0 | 1 | 1 | python,linux | 1,391,295 | 3 | false | 0 | 0 | The best solution will be installing python2.6 in the choosen directory - It will you give you access to many great features and better memory handling (infamous python=2.4 memory leak problem).
I have got several pythons installed onto my two computers, I found that the best solution for are two directories:
$HOME/usr... | 2 | 2 | 0 | I have a linux VPS that uses an older version of python (2.4.3). This version doesn't include the UUID module, but I need it for a project. My options are to upgrade to python2.6 or find a way to make uuid work with the older version. I am a complete linux newbie. I don't know how to upgrade python safely or how I coul... | Upgrade python in linux | 0 | 0 | 0 | 25,211 |
1,389,082 | 2009-09-07T12:07:00.000 | 7 | 0 | 0 | 0 | java,javascript,c++,python,ipv6 | 1,390,016 | 11 | true | 1 | 0 | On POSIX systems you can use inet_pton and inet_ntop in combination to do canonicalization. You will still have to do your own CIDR parsing. Fortunately, I believe the only valid CIDR syntax for IPv6 is the /number_of_bits notation, so that's fairly easy.
The other issue you will run into is the lack of support for i... | 1 | 5 | 0 | What libs have you used for that? How compatible are they with one another? Or did you write your own parsing routine?
I'm particularly interested in mutually-compatible implementations for Java, C++, Python, and JavaScript, which support:
zero compression ("::")
IPv4-mapped addresses ("::ffff:123.45.67.89")
canonic... | IPv6 address validation and canonicalization | 1.2 | 0 | 0 | 17,450 |
1,389,385 | 2009-09-07T13:14:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,udp | 17,618,253 | 3 | false | 1 | 0 | You could run a separate agent on a cloud host like DigitalOcean or Amazon EC2 that proxies this protocol and makes itself available to Google App Engine via ordinary HTTP or web sockets. | 1 | 1 | 0 | I have a service provider who is transmitting data thro' UDP. I want to establish a connection to them, receive & process data (will be with in the 30 sec limit/request)
Is it possible to get & process UDP data in appengine. I am looking for some simple example. | How to process UDP data in Appengine | 0 | 0 | 0 | 2,113 |
1,389,738 | 2009-09-07T14:49:00.000 | 3 | 0 | 1 | 0 | python,data-structures,save | 1,389,790 | 7 | false | 0 | 0 | You could do something like:
to write
Pickle
Sign pickled file
Done
to read
Check pickled file's signature
Unpickle
Use
I wonder though what makes you think that the data files are going to be tampered but your application is not going to be? | 4 | 15 | 0 | I am working on a program in Python and want users to be able to save data they are working on. I have looked into cPickle; it seems like it would be a fast and easy way to save data, it seems insecure. Since entire functions, classes, etc can be pickled, I am worried that a rogue save file could inject harmful code ... | How to save data with Python? | 0.085505 | 0 | 0 | 18,313 |
1,389,738 | 2009-09-07T14:49:00.000 | 1 | 0 | 1 | 0 | python,data-structures,save | 1,389,757 | 7 | false | 0 | 0 | You need to give us more context before we can answer: what type of data are you saving, how much is there, how do you want to access it?
As for pickles: they do not store code. When you pickle a function or class, it is the name that is stored, not the actual code itself. | 4 | 15 | 0 | I am working on a program in Python and want users to be able to save data they are working on. I have looked into cPickle; it seems like it would be a fast and easy way to save data, it seems insecure. Since entire functions, classes, etc can be pickled, I am worried that a rogue save file could inject harmful code ... | How to save data with Python? | 0.028564 | 0 | 0 | 18,313 |
1,389,738 | 2009-09-07T14:49:00.000 | 1 | 0 | 1 | 0 | python,data-structures,save | 1,391,437 | 7 | false | 0 | 0 | Who -- specifically -- is the sociopath who's going through the effort to break a program by hacking the pickled file?
It's Python. The sociopath has your source. They don't need to fool around hacking your pickle file. They can just edit your source and do all the "damage" they want.
Don't worry about "insecurity" ... | 4 | 15 | 0 | I am working on a program in Python and want users to be able to save data they are working on. I have looked into cPickle; it seems like it would be a fast and easy way to save data, it seems insecure. Since entire functions, classes, etc can be pickled, I am worried that a rogue save file could inject harmful code ... | How to save data with Python? | 0.028564 | 0 | 0 | 18,313 |
1,389,738 | 2009-09-07T14:49:00.000 | 1 | 0 | 1 | 0 | python,data-structures,save | 1,389,803 | 7 | false | 0 | 0 | *****In this answer, I'm only concerned about accidental corruption of the application's integrity.*****
Pickle is "secure". What might be insecure is accessing code you didn't write, for example in plugins; that is not relevant to pickles though.
When you pickle an object, all its data is saved, but code and implement... | 4 | 15 | 0 | I am working on a program in Python and want users to be able to save data they are working on. I have looked into cPickle; it seems like it would be a fast and easy way to save data, it seems insecure. Since entire functions, classes, etc can be pickled, I am worried that a rogue save file could inject harmful code ... | How to save data with Python? | 0.028564 | 0 | 0 | 18,313 |
1,390,868 | 2009-09-07T20:33:00.000 | 2 | 1 | 1 | 0 | python,database,open-source,frameworks | 1,390,896 | 6 | false | 0 | 0 | There are many answers to your question because you raise a number of issues:
Agile development is methodology and has very little to do with the language or software platform. It is more a set of principles around which software teams organize themselves. Refer to the works of Kent Beck for a bit more detail.
Do you... | 1 | 2 | 0 | I have been trying to learn a cross platform language with a fast learning curve, and so it seemed obvious Python was the logical choice. I've never programmed before but I have been reading on pragmatic programming and agile development for quite some time. The question comes, "What is the single best choice to crea... | Agile Software Development in Python | 0.066568 | 0 | 0 | 2,206 |
1,391,608 | 2009-09-08T02:02:00.000 | 5 | 0 | 0 | 1 | python,google-app-engine | 1,392,766 | 3 | true | 1 | 0 | Is it possible? Yes. The protocol appcfg uses to update apps is entirely HTTP-based, so there's absolutely no reason you couldn't write an app that's capable of deploying other apps (or redeploying itself - self-modifying code)! You may even be able to reuse large parts of appcfg.py to do it.
Is it easy? Probably not. ... | 3 | 3 | 0 | In order to redeploy a GAE application, I currently have to install the GAE deployment tools on the system that I am using for deployment. While this process is relatively straight forward, the deployment process is a manual process that does not work from behind a firewall and the deployment tools must be installed on... | Is it possible to deploy one GAE application from another GAE application? | 1.2 | 0 | 0 | 418 |
1,391,608 | 2009-09-08T02:02:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine | 1,391,649 | 3 | false | 1 | 0 | One limiting constraint could be the protocol that the python sdk uses to communicate with the GAE servers. If it only uses HTTP, you might be OK. but if it's anything else, you might be out of luck because you can't open a socket directly from within GAE. | 3 | 3 | 0 | In order to redeploy a GAE application, I currently have to install the GAE deployment tools on the system that I am using for deployment. While this process is relatively straight forward, the deployment process is a manual process that does not work from behind a firewall and the deployment tools must be installed on... | Is it possible to deploy one GAE application from another GAE application? | 0.132549 | 0 | 0 | 418 |
1,391,608 | 2009-09-08T02:02:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine | 1,391,652 | 3 | false | 1 | 0 | What problem did you have by trying to update behind a firewall?
I've got some, but finally I manage to work around them.
About your question, the constraint is that you cannot write files into a GAE app, so even though you could possibly pull from the VCS you can't write those pulled files.
So you would have to upda... | 3 | 3 | 0 | In order to redeploy a GAE application, I currently have to install the GAE deployment tools on the system that I am using for deployment. While this process is relatively straight forward, the deployment process is a manual process that does not work from behind a firewall and the deployment tools must be installed on... | Is it possible to deploy one GAE application from another GAE application? | 0 | 0 | 0 | 418 |
1,393,075 | 2009-09-08T09:58:00.000 | 8 | 0 | 1 | 0 | python,vim,syntax-highlighting,vim-syntax-highlighting | 1,410,674 | 6 | true | 0 | 0 | I had below statement in my vimrc file. This made else: be tokenized as one word. After removing that else: syntax highlighting works just fine.
set iskeyword+=: | 1 | 8 | 0 | I'm getting annoyed with the default python syntax highlighting in Vim.
It does not highlight the else: statement correctly.
Vim only highlights the else statement if I have some white space between the else and the colon :, so else : works, but else: does not.
It must be easy to fix.
I'm using Vim 7.2 | Vim syntax highlighting 'else:' for Python | 1.2 | 0 | 0 | 3,440 |
1,393,731 | 2009-09-08T12:28:00.000 | 0 | 0 | 1 | 0 | python,configuration,naming-conventions | 1,393,752 | 5 | false | 0 | 0 | I don't think there's any convention for this. You may just use file with extension like: .ini, .cfg, .conf, .config, .pref or anything you like. | 4 | 4 | 0 | Is there a general naming conventions for configuration files for a simple python program?
Thanks,
Udi | configuration filename convention | 0 | 0 | 0 | 1,765 |
1,393,731 | 2009-09-08T12:28:00.000 | 4 | 0 | 1 | 0 | python,configuration,naming-conventions | 1,393,754 | 5 | true | 0 | 0 | .conf is a nice extension too. But since mostly configuration files are application specific, it does not really matter what extension they have as long as they are consistent (i.e do not use .conf with .cfg in the same application). | 4 | 4 | 0 | Is there a general naming conventions for configuration files for a simple python program?
Thanks,
Udi | configuration filename convention | 1.2 | 0 | 0 | 1,765 |
1,393,731 | 2009-09-08T12:28:00.000 | 1 | 0 | 1 | 0 | python,configuration,naming-conventions | 1,394,828 | 5 | false | 0 | 0 | Django uses settings.py I like that a lot. It's very clear. | 4 | 4 | 0 | Is there a general naming conventions for configuration files for a simple python program?
Thanks,
Udi | configuration filename convention | 0.039979 | 0 | 0 | 1,765 |
1,393,731 | 2009-09-08T12:28:00.000 | 4 | 0 | 1 | 0 | python,configuration,naming-conventions | 1,393,736 | 5 | false | 0 | 0 | A convention? Mine would be, if my program was called "Bob", simply "bob.cfg".
I have to admit, I didn't really suffer any angst in coming up with that convention. Maybe I've been here too long :-)
Of course, if your configuration information is of a specific format (e.g., XML), you could consider "bob.xml". But, reall... | 4 | 4 | 0 | Is there a general naming conventions for configuration files for a simple python program?
Thanks,
Udi | configuration filename convention | 0.158649 | 0 | 0 | 1,765 |
1,395,356 | 2009-09-08T17:53:00.000 | 1 | 0 | 1 | 0 | python | 44,833,943 | 7 | false | 0 | 0 | python 2.7
print "{0:b}".format(30)
python 3.x
print ('{0:b}'.format(30)) | 1 | 48 | 0 | What does the "b" stand for in the output of bin(30): "0b11110"? Is there any way I can get rid of this "b"? How can I get the output of bin() to always return a standard 8 digit output? | How can I make `bin(30)` return `00011110` instead of `0b11110`? | 0.028564 | 0 | 0 | 72,777 |
1,396,668 | 2009-09-08T22:26:00.000 | 36 | 0 | 1 | 0 | python | 1,396,696 | 7 | false | 0 | 0 | Short answer, you can't.
Long answer, you can maintain a dict for mapping IDs to objects, or look the ID up by exhaustive search of gc.get_objects(), but this will create one of two problems: either the dict's reference will keep the object alive and prevent GC, or (if it's a WeakValue dict or you use gc.get_objects())... | 1 | 148 | 0 | Let's say I have an id of a Python object, which I retrieved by doing id(thing). How do I find thing again by the id number I was given? | Get object by id()? | 1 | 0 | 0 | 93,777 |
1,397,553 | 2009-09-09T04:40:00.000 | 1 | 0 | 0 | 0 | python,user-interface,qt | 1,414,819 | 2 | false | 0 | 1 | I contacted maintainer of VPython and he confirmed, that he is not aware of any working solution where Visual is embedded into QT window.
That turned me to try VTK and so far I'm pretty happy, no problem with using VTK within PyQT framework. | 1 | 2 | 0 | How do you embed a vpython plot (animated) within your Qt GUI? so that it has its own display area and would not need to created a new window anymore. | embedding plot within Qt gui | 0.099668 | 0 | 0 | 1,265 |
1,397,572 | 2009-09-09T04:47:00.000 | 2 | 0 | 1 | 0 | python,open-source | 1,397,650 | 8 | false | 0 | 0 | I have had to do a lot of this in my job. What works for me may be different to what works for you, but I'll share my experience.
I start by trying to identify the data structures being used and draw diagrams showing the relationships between them. Not necessarily something formal like UML, but a sketch on paper which ... | 3 | 7 | 0 | I have a source of python program which doesn't have any documentation or comments.
I did tried twice to understand it but most of the times I am losing my track, because there are many files.
What should be the steps to understand that program fully and quickly. | How to reverse engineer a program which has no documentation | 0.049958 | 0 | 0 | 9,658 |
1,397,572 | 2009-09-09T04:47:00.000 | 1 | 0 | 1 | 0 | python,open-source | 6,623,248 | 8 | false | 0 | 0 | pyreverse from Logilab and PyNSource from Andy Bulka are helpful too for UML diagram generation. | 3 | 7 | 0 | I have a source of python program which doesn't have any documentation or comments.
I did tried twice to understand it but most of the times I am losing my track, because there are many files.
What should be the steps to understand that program fully and quickly. | How to reverse engineer a program which has no documentation | 0.024995 | 0 | 0 | 9,658 |
1,397,572 | 2009-09-09T04:47:00.000 | 3 | 0 | 1 | 0 | python,open-source | 1,397,654 | 8 | false | 0 | 0 | You are lucky it's in Python which is easy to read. But it is of course possible to write tricky hard to understand code in Python as well.
The steps are:
Run the software and learn to use it, and understand it's features at least a little bit.
Read though the tests, if any.
Read through the code.
When you encounter c... | 3 | 7 | 0 | I have a source of python program which doesn't have any documentation or comments.
I did tried twice to understand it but most of the times I am losing my track, because there are many files.
What should be the steps to understand that program fully and quickly. | How to reverse engineer a program which has no documentation | 0.07486 | 0 | 0 | 9,658 |
1,397,977 | 2009-09-09T07:04:00.000 | 2 | 0 | 1 | 0 | python,thread-safety,cython,pyrex | 1,399,771 | 2 | false | 0 | 0 | Python's global interpreter lock means that only one thread can be active in the interpreter at any one time. However, once control is passed out to a C extension another thread can be active within the interpreter. Multiple threads can be created, and nothing prevents a thread from being interrupted within the middl... | 1 | 4 | 0 | If not, is there a way I can guarantee thread safety by programming a certain way?
To clarify, when talking about "threadsafe,' I mean Python threads, not OS-level threads. | Are Python extensions produced by Cython/Pyrex threadsafe? | 0.197375 | 0 | 0 | 1,771 |
1,399,717 | 2009-09-09T13:33:00.000 | 1 | 0 | 1 | 0 | python | 1,399,804 | 2 | false | 0 | 0 | I think you answered the question yourself. You need to subclass a dict. And you also of course needs to have a list of the keys, so when the list gets too long you can purge the oldest one.
I would however possibly look into memcached or similar. | 1 | 1 | 0 | I'm searching for the a datatype for a cache, basically I need the functionality of a dict, i.e. random access based on a key, which has a limited number of entries so that when the limit is reached the oldest item gets automatically removed.
Furthermore I need to be able to store it via shelve or pickle and rely on Py... | Python datatype suitable for my cache | 0.099668 | 0 | 0 | 166 |
1,399,746 | 2009-09-09T13:40:00.000 | 7 | 0 | 0 | 0 | python,django,monkeypatching | 1,399,813 | 5 | true | 1 | 0 | When you add a field to any model, even if you do it the 'official' way, you need to migrate the database - Django doesn't do it for you. Drop the table and run ./manage.py syncdb again.
You might want to investigate one of the migrations frameworks, such as south, which will manage this sort of thing for you. | 1 | 4 | 0 | I have recently started experimenting with Django for some web applications in my spare time. While designing the data model for one, I came across the dilemma of using inheritance to define a user of the website or using a technique known as monkey patching with the User class already supplied by the framework.
I trie... | Django and monkey patching issue | 1.2 | 0 | 0 | 1,938 |
1,400,012 | 2009-09-09T14:20:00.000 | 2 | 0 | 1 | 0 | python,integer,endianness | 1,400,075 | 4 | false | 0 | 0 | Check when?
When doing bitwise operations, the int in will have the same endianess as the ints you put in. You don't need to check that. You only need to care about this when converting to/from sequences of bytes, in both languages, afaik.
In Python you use the struct module for this, most commonly struct.pack() and st... | 1 | 21 | 0 | I'm working on a program where I store some data in an integer and process it bitwise. For example, I might receive the number 48, which I will process bit-by-bit. In general the endianness of integers depends on the machine representation of integers, but does Python do anything to guarantee that the ints will alway... | Endianness of integers in Python | 0.099668 | 0 | 0 | 41,057 |
1,400,179 | 2009-09-09T14:45:00.000 | 0 | 0 | 0 | 0 | python,wxpython | 1,579,014 | 4 | false | 1 | 1 | Usually, click events are trigged by MouseUp events. If you track the mouse position by capturing any MouseDown events, you will know where the last click (MouseUp) happened, and that should allow you to reconstruct things.
For this particular problem, you might have to do a bit more work in MouseDown like checking if ... | 1 | 2 | 0 | I am using a wxPython wx.html.HtmlWindow to display part of my interface. The user can scroll down a list of links in a window smaller than the list. When they click on a link, I need to repaint the web page, but I want to return the page position back to where they clicked it.
I've tried MouseEvent.GetLogicalPosition... | How do I scroll a wxPython wx.html.HtmlWindow back down to where it was when the user clicked a link? | 0 | 0 | 0 | 1,216 |
1,400,295 | 2009-09-09T15:05:00.000 | 0 | 0 | 1 | 0 | python,persistence,pickle | 1,401,887 | 3 | false | 0 | 0 | you could use simply a dictionnary with the key and the values the same in the receiver. And to avoid a memory leak use a WeakKeyDictionary. | 1 | 5 | 0 | I'm trying to write a class for a read-only object which will not be really copied with the copy module, and when it will be pickled to be transferred between processes each process will maintain no more than one copy of it, no matter how many times it will be passed around as a "new" object. Is there already something... | Class for pickle- and copy-persistent object? | 0 | 0 | 0 | 3,512 |
1,401,102 | 2009-09-09T17:57:00.000 | 0 | 0 | 1 | 0 | python,matplotlib,figures | 14,591,411 | 3 | false | 0 | 0 | The best way to show multiple figures is use matplotlib or pylab. (for windows)
with matplotlib you can prepare the figures and then when you finish the process with them you can show with the comand "matplotlib.show()" and all figures should be shown.
(on linux) you don´t have problems adding changes to figures becaus... | 1 | 32 | 1 | I have functions that contribute to small parts of a figure generation. I'm trying to use these functions to generate multiple figures? So something like this:
work with Figure 1
do something else
work with Figure 2
do something else
work with Figure 1
do something else
work with Figure 2
If anyone could help, that'd... | Python with matplotlib - drawing multiple figures in parallel | 0 | 0 | 0 | 43,360 |
1,401,218 | 2009-09-09T18:16:00.000 | 7 | 1 | 0 | 0 | c#,python,url,crc32,short-url | 1,401,231 | 6 | true | 0 | 0 | There is no such number as the "maximum number of urls can be used so that we can avoid duplicates" for CRC32.
The problem is that CRC32 can produce duplicates, and it's not a function of how many values you throw at it, it's a function of what those values look like.
So you might have a collision on the second url, if... | 5 | 5 | 0 | I am trying to understand crc32 to generate the unique url for web page.
If we use the crc32, what is the maximum number of urls can be used so that we can avoid duplicates?
What could be the approximative string length to keep the checksum to be 2^32?
When I tried UUID for an url and convert the uuid bytes to base 64,... | CRC32 to make short URL for web | 1.2 | 0 | 1 | 3,162 |
1,401,218 | 2009-09-09T18:16:00.000 | 4 | 1 | 0 | 0 | c#,python,url,crc32,short-url | 1,401,237 | 6 | false | 0 | 0 | If you're already storing the full URL in a database table, an integer ID is pretty short, and can be made shorter by converting it to base 16, 64, or 85. If you can use a UUID, you can use an integer, and you may as well, since it's shorter and I don't see what benefit a UUID would provide in your lookup table. | 5 | 5 | 0 | I am trying to understand crc32 to generate the unique url for web page.
If we use the crc32, what is the maximum number of urls can be used so that we can avoid duplicates?
What could be the approximative string length to keep the checksum to be 2^32?
When I tried UUID for an url and convert the uuid bytes to base 64,... | CRC32 to make short URL for web | 0.132549 | 0 | 1 | 3,162 |
1,401,218 | 2009-09-09T18:16:00.000 | 1 | 1 | 0 | 0 | c#,python,url,crc32,short-url | 1,401,243 | 6 | false | 0 | 0 | CRC32 means cyclic redundancy check with 32 bits where any arbitrary amount of bits is summed up to a 32 bit check sum. And check sum functions are surjective, that means multiple input values have the same output value. So you cannot inverse the function. | 5 | 5 | 0 | I am trying to understand crc32 to generate the unique url for web page.
If we use the crc32, what is the maximum number of urls can be used so that we can avoid duplicates?
What could be the approximative string length to keep the checksum to be 2^32?
When I tried UUID for an url and convert the uuid bytes to base 64,... | CRC32 to make short URL for web | 0.033321 | 0 | 1 | 3,162 |
1,401,218 | 2009-09-09T18:16:00.000 | 0 | 1 | 0 | 0 | c#,python,url,crc32,short-url | 1,401,286 | 6 | false | 0 | 0 | No, even you use md5, or any other check sum, the URL CAN BE duplicate, it all depends on your luck.
So don't make an unique url base on those check sum | 5 | 5 | 0 | I am trying to understand crc32 to generate the unique url for web page.
If we use the crc32, what is the maximum number of urls can be used so that we can avoid duplicates?
What could be the approximative string length to keep the checksum to be 2^32?
When I tried UUID for an url and convert the uuid bytes to base 64,... | CRC32 to make short URL for web | 0 | 0 | 1 | 3,162 |
1,401,218 | 2009-09-09T18:16:00.000 | 2 | 1 | 0 | 0 | c#,python,url,crc32,short-url | 1,401,331 | 6 | false | 0 | 0 | The right way to make a short URL is to store the full one in the database and publish something that maps to the row index. A compact way is to use the Base64 of the row ID, for example. Or you could use a UID for the primary key and show that.
Do not use a checksum, because it's too small and very likely to conflic... | 5 | 5 | 0 | I am trying to understand crc32 to generate the unique url for web page.
If we use the crc32, what is the maximum number of urls can be used so that we can avoid duplicates?
What could be the approximative string length to keep the checksum to be 2^32?
When I tried UUID for an url and convert the uuid bytes to base 64,... | CRC32 to make short URL for web | 0.066568 | 0 | 1 | 3,162 |
1,401,527 | 2009-09-09T19:15:00.000 | 3 | 1 | 0 | 0 | php,python,image | 1,401,566 | 5 | false | 0 | 0 | If your exact requirements are that it show correctly in FireFox you may have a difficult time - the only way to be sure would be to link to the exact same image loading source code as FireFox.
Basic image corruption (file is incomplete) can be detected simply by trying to open the file using any number of image librar... | 1 | 20 | 0 | Okay. So I have about 250,000 high resolution images. What I want to do is go through all of them and find ones that are corrupted. If you know what 4scrape is, then you know the nature of the images I.
Corrupted, to me, is the image is loaded into Firefox and it says
The image “such and such image” cannot be displaye... | How do I programmatically check whether an image (PNG, JPEG, or GIF) is corrupted? | 0.119427 | 0 | 1 | 23,397 |
1,403,103 | 2009-09-10T02:30:00.000 | 18 | 0 | 0 | 0 | python,excel,vba,ironpython,python.net | 1,403,134 | 5 | false | 0 | 1 | 1) IronPython and CPython share nearly identical language syntax. There is very little difference between them. Transitioning should be trivial.
2) The libraries in IronPython are very different than CPython. The Python libraries are a fair bit behind - quite a few of the CPython-accessible libraries will not work (... | 2 | 15 | 0 | I'm starting to study Python, and for now I like it very much. But, if you could just answer a few questions for me, which have been troubling me, and I can't find any definite answers to them:
What is the relationship between Python's C implementation (main version from python.org) and IronPython, in terms of languag... | Python - IronPython dilemma | 1 | 0 | 0 | 3,658 |
1,403,103 | 2009-09-10T02:30:00.000 | 1 | 0 | 0 | 0 | python,excel,vba,ironpython,python.net | 1,403,118 | 5 | false | 0 | 1 | 1) The language implemented by CPython and IronPython are the same, or at most a version or two apart. This is nothing like the situation with Java and Javascript, which are two completely different languages given similar names by some bone-headed marketing decision.
2) 3rd-party libraries implemented in C (such as n... | 2 | 15 | 0 | I'm starting to study Python, and for now I like it very much. But, if you could just answer a few questions for me, which have been troubling me, and I can't find any definite answers to them:
What is the relationship between Python's C implementation (main version from python.org) and IronPython, in terms of languag... | Python - IronPython dilemma | 0.039979 | 0 | 0 | 3,658 |
1,403,674 | 2009-09-10T06:32:00.000 | 69 | 0 | 1 | 0 | list,python | 1,404,229 | 9 | false | 0 | 0 | source_list[::10] is the most obvious, but this doesn't work for any iterable and is not memory efficient for large lists.
itertools.islice(source_sequence, 0, None, 10) works for any iterable and is memory-efficient, but probably is not the fastest solution for large list and big step.
(source_list[i] for i in xrange(... | 1 | 210 | 0 | Say we have a list of numbers from 0 to 1000. Is there a pythonic/efficient way to produce a list of the first and every subsequent 10th item, i.e. [0, 10, 20, 30, ... ]?
Yes, I can do this using a for loop, but I'm wondering if there is a neater way to do this, perhaps even in one line? | Pythonic way to return list of every nth item in a larger list | 1 | 0 | 0 | 278,755 |
1,404,515 | 2009-09-10T10:34:00.000 | 25 | 0 | 1 | 0 | python,perl,editor,vim | 1,404,570 | 4 | false | 0 | 0 | In your $HOME, make .vim/ directory (or vimfiles/ on Windows), in it make ftplugin/ directory, and in it keep files named "perl.vim" or "python.vim" or "html.vim" or ...
These should be loaded automatically when you open/create new file of given filetype as long as you don't forget to add :filetype plugin on in your .v... | 1 | 15 | 0 | My day job involves coding with Perl. At home I play around with Python and Erlang. For Perl I want to indent my code with two spaces. Whereas for Python the standard is 4. Also I have some key bindings to open function declarations which I would like to use with all programming languages. How can this be achieved in g... | gVim and multiple programming languages | 1 | 0 | 0 | 3,389 |
1,406,213 | 2009-09-10T16:07:00.000 | 3 | 0 | 0 | 0 | python,emacs,pyflakes | 1,408,670 | 3 | true | 0 | 0 | latest pyflakes in development mode fixed this problem for me. Thanks all
sudo easy_install -U pyflakes | 1 | 0 | 0 | My Emacs hangs (Ubuntu 9 + Emacs 23 + Pyflakes) when I type """ quotes for string blocks.
Anybody experienced the same problem? I think, it may not be an Emacs problem but some Python mode or Pyflakes which I use it for error checking.
Anybody got around the issue? It is a really frustrating experience. | Emacs 23 hangs on python mode when typing string block """ | 1.2 | 0 | 0 | 846 |
1,406,636 | 2009-09-10T17:32:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine | 1,406,768 | 2 | false | 1 | 0 | The ways to reliable keep state between requests are memcache, the datastore or through the user (cookies or post/get).
You can use the runtime cache too, but this is very unreliable as you don't know if a request will end up in the same runtime or the runtime can drop it's entire cache if it feels like it.
I really wo... | 1 | 1 | 0 | I'm writing a simple app with AppEngine, using Python. After a successful insert by a user and redirect, I'd like to display a flash confirmation message on the next page.
What's the best way to keep state between one request and the next? Or is this not possible because AppEngine is distributed? I guess, the underlyi... | How do I keep state between requests in AppEngine (Python)? | 0.291313 | 0 | 0 | 564 |
1,407,016 | 2009-09-10T18:45:00.000 | 0 | 0 | 0 | 0 | python,database,desktop,crud | 1,407,116 | 3 | false | 0 | 0 | If it were me, I would consider borrowing django's ORM, but then again, I'm already familiar with it.
Having said that, I like working with it, it's usable outside the framework, and it will give you mysql, postgres, or sqlite support. You could also hook up the django admin site to your models and have a web-based edi... | 1 | 2 | 0 | I want to develop a desktop application using python with basic crud operation. Is there any library in python that can generate a code for CRUD functionality and user interface given a database table. | How to generate basic CRUD functionality in python given a database tables | 0 | 0 | 0 | 6,272 |
1,407,248 | 2009-09-10T19:31:00.000 | 0 | 0 | 0 | 0 | python,database,sqlite,ado | 1,407,345 | 9 | false | 0 | 0 | Django is perfect for this but the poster is not clear if he needs to actually make a compiled EXE or a web app. Django is only for web apps.
I'm not sure where you really get "heavy" from. Django is grossly smaller in terms of lines of code than any other major web app framework. | 1 | 7 | 0 | What is the best way to use an embedded database, say sqlite in Python:
Should be small footprint. I'm only needing few thousands records per table. And just a handful of tables per database.
If it's one provided by Python default installation, then great. Must be open-source, available on Windows and Linus.
Better... | python database / sql programming - where to start | 0 | 1 | 0 | 5,927 |
1,407,364 | 2009-09-10T19:52:00.000 | 5 | 1 | 1 | 0 | python,gettext | 1,408,109 | 3 | false | 0 | 0 | Reading just quickly about .mo files, it is clear that:
It is a machine-readable representation
It is a hash table
Given gettext's function, to lookup strings by keys at runtime, it is reasonable for this lookup to be implemented efficiently.
Also, it is needed for gettext's performance impact to be negligible; else ... | 2 | 0 | 0 | I don't see that the compilation step is adding any value. | Why does the Python gettext module require a compilation step (.po -> .mo)? | 0.321513 | 0 | 0 | 626 |
1,407,364 | 2009-09-10T19:52:00.000 | 1 | 1 | 1 | 0 | python,gettext | 2,021,653 | 3 | false | 0 | 0 | Because gettext module in Python follows GNU gettext standards which required to use PO files for do translations by people, and MO files for using by application in runtime. When you're using gettext module you're actually using GNUTranslations class, which name suggests it's implementation of GNU gettext.
But you can... | 2 | 0 | 0 | I don't see that the compilation step is adding any value. | Why does the Python gettext module require a compilation step (.po -> .mo)? | 0.066568 | 0 | 0 | 626 |
1,407,474 | 2009-09-10T20:14:00.000 | 0 | 0 | 0 | 1 | python,logging,python-logging | 67,012,969 | 8 | false | 0 | 0 | I think what described here is an anti-pattern - different processes should not write data into the same file.
And non of the solutions above worked for me, causing different permissions issues in different scenarios.
As a temp workaround I've added a random suffix into the log filename so each process will get a uniqu... | 1 | 38 | 0 | I'm using the standard python (2.5.2) logging module, specifically the RotatingFileHandler, on a linux system. My application supports both a command-line interface and a web-service interface. I would like to have both write to the same log file. However, when the log file gets rotated, the new file has 644 permiss... | Does python logging.handlers.RotatingFileHandler allow creation of a group writable log file? | 0 | 0 | 0 | 14,631 |
1,408,272 | 2009-09-10T23:35:00.000 | -1 | 1 | 0 | 1 | python,linux | 48,969,869 | 7 | false | 0 | 0 | What do you mean it can't be done [1]? The function, os.stat(path).st_birthtime, works great.
[1]:
Somebody said that it couldn’t be done
But he with a chuckle replied
That “maybe it couldn’t,” but he would be one
Who wouldn’t say so till he’d tried.
So he buckled right in with the trace of a grin
On... | 1 | 21 | 0 | os.stat returns st_mtime and st_ctime attributes, the modification time is st_mtime and st_ctime "change time" on POSIX.
is there any function that return the creation time of a file using python and under Linux? | Get file creation time with Python on linux | -0.028564 | 0 | 0 | 11,846 |
1,408,326 | 2009-09-10T23:48:00.000 | 1 | 0 | 1 | 1 | python,executable | 1,408,428 | 4 | false | 0 | 0 | Avoid concatenating all arguments into one string using that string.
It's a lot simpler and better and safer to just pass a sequence (list or tuple) of arguments. This is specially true if any argument contains a space character (which is quite common for filenames). | 1 | 2 | 0 | p = subprocess.Popen(args = "myprog.exe" + " " +
str(input1) + " " +
str(input2) + " " +
str(input3) + " " +
strpoints, stdout = subprocess.PIPE)
in the code above, input1, input2, and input3 are all integers that get converted to stri... | send an arbitrary number of inputs from python to a .exe | 0.049958 | 0 | 0 | 656 |
1,408,627 | 2009-09-11T01:47:00.000 | 1 | 0 | 0 | 1 | python,process,crash,subprocess | 1,408,646 | 2 | false | 0 | 0 | Yes to all. | 1 | 3 | 0 | I want to start a number of subprocesses in my Python script and then track when they complete or crash.
subprocess.Popen.poll() seems to return None when the process is still running, 0 on success, and non-zero on failure. Can that be expected on all OS's?
Unfortunately the standard library documentation is lacking fo... | Track process status with Python | 0.099668 | 0 | 0 | 4,015 |
1,408,726 | 2009-09-11T02:42:00.000 | 6 | 0 | 1 | 0 | python | 1,408,735 | 3 | false | 0 | 0 | One trick I've learned while trimming down .py files to ship: Delete all the .pyc files in the standard library, then run your application throughly (that is, enough to be sure all the Python modules it needs will be loaded). If you examine the standard library directories, there will be .pyc files for all the modules... | 1 | 6 | 0 | We've got a (Windows) application, with which we distribute an entire Python installation (including several 3rd-party modules that we use), so we have consistency and so we don't need to install everything separately. This works pretty well, but the application is pretty huge.
Obviously, we don't use everything avail... | Trimming Python Runtime | 1 | 0 | 0 | 1,175 |
1,410,444 | 2009-09-11T11:56:00.000 | 3 | 0 | 1 | 0 | python,compiler-construction,correctness | 1,410,452 | 10 | false | 0 | 0 | use editor / IDE that supports code highlighting. E.g., Notepad++ has word-highlighting feature that I find very useful.
use unit tests
stupid errors will be weeded out first, so I wouldn't worry to much about this type of errors. it's "smart" error you should be afraid of. | 2 | 6 | 0 | In C++ I have compiler that tell me if something wrong with my code after refactoring. How to make sure that Python code is at least correct after changes? There may be some stupid error like wrong function name etc. that pretty easy to find in compile time.
Thanks | Checking Python code correctness | 0.059928 | 0 | 0 | 2,794 |
1,410,444 | 2009-09-11T11:56:00.000 | 2 | 0 | 1 | 0 | python,compiler-construction,correctness | 1,411,292 | 10 | false | 0 | 0 | Static analysis (as from the IDE, or from tools like pyLint and pyChecker) is a very quick and effective way to check simple errors, and enforce a common style.
Unit tests are a great way to ensure the code stands for its contract.
Code reviews and pair programming are one of the best ways to find errors of all sor... | 2 | 6 | 0 | In C++ I have compiler that tell me if something wrong with my code after refactoring. How to make sure that Python code is at least correct after changes? There may be some stupid error like wrong function name etc. that pretty easy to find in compile time.
Thanks | Checking Python code correctness | 0.039979 | 0 | 0 | 2,794 |
1,410,967 | 2009-09-11T13:46:00.000 | 11 | 0 | 0 | 1 | python,apache,twisted | 1,411,038 | 4 | true | 0 | 0 | Twisted is a platform for developing internet applications, for handling the underlying communications and such. It doesn't "do" anything out of the box--you've got to program it.
Apache is an internet application, of sorts. Upon install, you have a working web server which can serve up static and dynamic web pages. Be... | 3 | 6 | 0 | I know Twisted is a framework that allows you to do asynchronous non-blocking i/o but I still do not understand how that is different from what Apache server does. If anyone could explain the need for twisted, I would appreciate it.. | Apache vs Twisted | 1.2 | 0 | 0 | 4,183 |
1,410,967 | 2009-09-11T13:46:00.000 | 2 | 0 | 0 | 1 | python,apache,twisted | 1,456,513 | 4 | false | 0 | 0 | @alphazero You read that Twisted vs. Tornado benchmark wrong (or you didn't read it at all). Quote from the article: " Lower mean response time is better." Twisted is lower. People want their webservers to respond with lower (faster) times.
Twisted leaves Tornado in the dust... or, in reality, they differ by a nearly... | 3 | 6 | 0 | I know Twisted is a framework that allows you to do asynchronous non-blocking i/o but I still do not understand how that is different from what Apache server does. If anyone could explain the need for twisted, I would appreciate it.. | Apache vs Twisted | 0.099668 | 0 | 0 | 4,183 |
1,410,967 | 2009-09-11T13:46:00.000 | 2 | 0 | 0 | 1 | python,apache,twisted | 1,411,014 | 4 | false | 0 | 0 | They are two different things, one is a pure WEB server and one is a WEB framework with a builtin event driven servers.
Twisted is good for constructing high-end ad-hoc network services. | 3 | 6 | 0 | I know Twisted is a framework that allows you to do asynchronous non-blocking i/o but I still do not understand how that is different from what Apache server does. If anyone could explain the need for twisted, I would appreciate it.. | Apache vs Twisted | 0.099668 | 0 | 0 | 4,183 |
1,412,169 | 2009-09-11T17:09:00.000 | 5 | 0 | 0 | 1 | python,django,asynchronous,twisted,real-time | 1,468,718 | 6 | false | 1 | 0 | The biggest advantage for me is that Twisted gives me an application that has state, and can communicate with many different clients using many protocols.
For me, my Twisted server communicates with a number of sensors installed in houses and businesses that monitor power usage. It stores the data and keeps recent data... | 4 | 15 | 0 | I need help understanding what the advantage of using an asynch framework is. Suppose I want to develop a simple chat web app. Why cant I write python code in the Django framework that does long polling where I dont send a response back the server until someone enters a new msg. What does Twisted provide that gives it ... | Twisted(asynch server) vs Django(or any other framework) | 0.16514 | 0 | 0 | 11,799 |
1,412,169 | 2009-09-11T17:09:00.000 | 3 | 0 | 0 | 1 | python,django,asynchronous,twisted,real-time | 1,417,358 | 6 | false | 1 | 0 | In twisted you can implement protocols of your own. Django certainly can't do this. | 4 | 15 | 0 | I need help understanding what the advantage of using an asynch framework is. Suppose I want to develop a simple chat web app. Why cant I write python code in the Django framework that does long polling where I dont send a response back the server until someone enters a new msg. What does Twisted provide that gives it ... | Twisted(asynch server) vs Django(or any other framework) | 0.099668 | 0 | 0 | 11,799 |
1,412,169 | 2009-09-11T17:09:00.000 | 16 | 0 | 0 | 1 | python,django,asynchronous,twisted,real-time | 1,412,226 | 6 | true | 1 | 0 | Asynchronous servers support much larger numbers of simultaneous client connections. More conventional servers come up against thread and process limits when servicing large number of concurrent clients, particularly those with long-lived connections. Async servers can also provide better performance as they avoid the ... | 4 | 15 | 0 | I need help understanding what the advantage of using an asynch framework is. Suppose I want to develop a simple chat web app. Why cant I write python code in the Django framework that does long polling where I dont send a response back the server until someone enters a new msg. What does Twisted provide that gives it ... | Twisted(asynch server) vs Django(or any other framework) | 1.2 | 0 | 0 | 11,799 |
1,412,169 | 2009-09-11T17:09:00.000 | 19 | 0 | 0 | 1 | python,django,asynchronous,twisted,real-time | 1,412,372 | 6 | false | 1 | 0 | First off Django is a framework for writing web apps so it provides ORM, html templating, it requires running an http server etc. Twisted helps to write much lower level code than that. You could use twisted to write the http server Django runs on. If you use Django you are limited to http model, with twisted it cou... | 4 | 15 | 0 | I need help understanding what the advantage of using an asynch framework is. Suppose I want to develop a simple chat web app. Why cant I write python code in the Django framework that does long polling where I dont send a response back the server until someone enters a new msg. What does Twisted provide that gives it ... | Twisted(asynch server) vs Django(or any other framework) | 1 | 0 | 0 | 11,799 |
1,413,540 | 2009-09-11T22:22:00.000 | 5 | 0 | 1 | 0 | python,image | 1,413,561 | 14 | false | 0 | 0 | You cannot display images in a console window.
You need a graphical toolkit such as Tkinter, PyGTK, PyQt, PyKDE, wxPython, PyObjC, or PyFLTK.
There are plenty of tutorials on how to create simple windows and loading images in python. | 2 | 41 | 0 | What is the easiest way to show a .jpg or .gif image from Python console?
I've got a Python console program that is checking a data set which contains links to images stored locally. How should I write the script so that it would display images pop-up graphical windows? | Showing an image from console in Python | 0.071307 | 0 | 0 | 190,850 |
1,413,540 | 2009-09-11T22:22:00.000 | 6 | 0 | 1 | 0 | python,image | 1,413,575 | 14 | false | 0 | 0 | Why not just display it in the user's web browser? | 2 | 41 | 0 | What is the easiest way to show a .jpg or .gif image from Python console?
I've got a Python console program that is checking a data set which contains links to images stored locally. How should I write the script so that it would display images pop-up graphical windows? | Showing an image from console in Python | 1 | 0 | 0 | 190,850 |
1,414,258 | 2009-09-12T04:16:00.000 | 1 | 0 | 0 | 0 | python,python-3.x,pygame | 1,416,509 | 4 | true | 0 | 1 | Just stick with Python 2.6. | 1 | 3 | 0 | I'm using pygame with python 2.6 right now, But I want to use python 3.1.1 instead. The normal pygame only works with 2.x, but the subversion ones work with 3.x I think. But what about pgreloaded? Is that useable yet? The normal pygame actually works with 3.1 too, but not for os x (at least there isn't a download). Doe... | Should I use pgreloaded? Or subversion of pygame? | 1.2 | 0 | 0 | 1,917 |
1,415,208 | 2009-09-12T14:07:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,user-controls,controls | 1,415,236 | 3 | false | 1 | 0 | The google app engine "Getting Started" tutorial is very good. The django documentation is also really detailed.
Take a look at GoogleIO on youtube and watch some of the tutorials. | 2 | 2 | 0 | I would like to ask about some sources for developing applications with Python and Google App Engine.
For example, some controls to generate automatically pages with the insert/update/delete of a database table, or any other useful resources are welcome.
Thank you! | Resources for developing Python and Google App Engine | 0.197375 | 0 | 0 | 471 |
1,415,208 | 2009-09-12T14:07:00.000 | 7 | 0 | 0 | 1 | python,google-app-engine,user-controls,controls | 1,419,518 | 3 | true | 1 | 0 | The Python community tends to look askance at code generation; so, @Hoang, if you think code generation is THE way to go, I suggest you try just about any other language BUT Python.
@Dominic has already suggested some excellent resources, I could point you to more (App Engine Fan, App Engine Utilities, etc, etc) but th... | 2 | 2 | 0 | I would like to ask about some sources for developing applications with Python and Google App Engine.
For example, some controls to generate automatically pages with the insert/update/delete of a database table, or any other useful resources are welcome.
Thank you! | Resources for developing Python and Google App Engine | 1.2 | 0 | 0 | 471 |
1,416,005 | 2009-09-12T20:10:00.000 | 3 | 0 | 1 | 0 | python,macos,python-3.x,pygame,virtualenv | 1,416,162 | 5 | true | 0 | 0 | Your use case doesn't actually need virtualenv. You just need to install several different Python versions. | 2 | 9 | 0 | Seems everyone recommends virtualenv for multiple python versions (on osx), but does it even work with python 3.0? I downloaded it, and it doesn't seem to.. And I don't really understand how it works, Can you 'turn on' on env at a time or something? What I want is to leave the system python 2.5 (obviously), and to have... | Python - Virtualenv , python 3? | 1.2 | 0 | 0 | 10,930 |
1,416,005 | 2009-09-12T20:10:00.000 | 0 | 0 | 1 | 0 | python,macos,python-3.x,pygame,virtualenv | 1,416,051 | 5 | false | 0 | 0 | Not sure if I understood you correctly, but here goes :)
I don't know about OS X, but in Linux you can install both 2.6 and 3. Then you can either specify to use python25 or python3, or change the /usr/bin/python symlink to the version you want to use by default. | 2 | 9 | 0 | Seems everyone recommends virtualenv for multiple python versions (on osx), but does it even work with python 3.0? I downloaded it, and it doesn't seem to.. And I don't really understand how it works, Can you 'turn on' on env at a time or something? What I want is to leave the system python 2.5 (obviously), and to have... | Python - Virtualenv , python 3? | 0 | 0 | 0 | 10,930 |
1,416,570 | 2009-09-13T00:59:00.000 | 0 | 1 | 0 | 0 | python,ruby | 25,123,266 | 6 | false | 1 | 0 | Using Ruby für two years now , i find it powerful, easy to learn, having good libraries, good community.
But how should we know if it fits your needs? Try it an you will find out. | 5 | 1 | 0 | I know that this is a difficult question to answer, but I thought I would try anwyays....
I am just starting at a new company where they have a minimal existing code base. It probably has a month of man effort invested at this point. It is currently written in Ruby.
It is also currently using Ruby on Rails -- but mo... | To Ruby or not to Ruby | 0 | 0 | 0 | 567 |
1,416,570 | 2009-09-13T00:59:00.000 | 4 | 1 | 0 | 0 | python,ruby | 1,416,827 | 6 | false | 1 | 0 | Ruby Madness. Sure, it seems cool, but it might lead to the hard stuff: Lisp
My predictions:
It's pretty clear that you are OK with either Ruby or Python, and obviously php can be made to work.
You will really like Ruby.
I'm a little bit worried that after Ruby the only place left to go will be Lisp, and that I wil... | 5 | 1 | 0 | I know that this is a difficult question to answer, but I thought I would try anwyays....
I am just starting at a new company where they have a minimal existing code base. It probably has a month of man effort invested at this point. It is currently written in Ruby.
It is also currently using Ruby on Rails -- but mo... | To Ruby or not to Ruby | 0.132549 | 0 | 0 | 567 |
1,416,570 | 2009-09-13T00:59:00.000 | 1 | 1 | 0 | 0 | python,ruby | 1,416,574 | 6 | false | 1 | 0 | Rails apps can potentially make a great REST backend for a php based system.
The REST stuff is made for it. You want xml? ok. You want json? ok.
If you and the staff aren't comfy with it, use something you are more comfy in to write a REST interface. :) | 5 | 1 | 0 | I know that this is a difficult question to answer, but I thought I would try anwyays....
I am just starting at a new company where they have a minimal existing code base. It probably has a month of man effort invested at this point. It is currently written in Ruby.
It is also currently using Ruby on Rails -- but mo... | To Ruby or not to Ruby | 0.033321 | 0 | 0 | 567 |
1,416,570 | 2009-09-13T00:59:00.000 | 0 | 1 | 0 | 0 | python,ruby | 1,416,583 | 6 | false | 1 | 0 | Why wouldn't you just keep it consistent and use PHP? | 5 | 1 | 0 | I know that this is a difficult question to answer, but I thought I would try anwyays....
I am just starting at a new company where they have a minimal existing code base. It probably has a month of man effort invested at this point. It is currently written in Ruby.
It is also currently using Ruby on Rails -- but mo... | To Ruby or not to Ruby | 0 | 0 | 0 | 567 |
1,416,570 | 2009-09-13T00:59:00.000 | 0 | 1 | 0 | 0 | python,ruby | 1,416,625 | 6 | false | 1 | 0 | IMO, if you're comfortable with Python then you shouldn't have too much trouble picking up Ruby. This doesn't mean Ruby is the best choice - you should still evaluate the options. | 5 | 1 | 0 | I know that this is a difficult question to answer, but I thought I would try anwyays....
I am just starting at a new company where they have a minimal existing code base. It probably has a month of man effort invested at this point. It is currently written in Ruby.
It is also currently using Ruby on Rails -- but mo... | To Ruby or not to Ruby | 0 | 0 | 0 | 567 |
1,416,921 | 2009-09-13T05:23:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 1,416,947 | 2 | false | 1 | 0 | Apart from the argument-less .fetch() call in your code, which I believe can't possibly work (you ALWAYS have to pass fetch an argument -- the max number of entities you're willing to fetch!), I can't reproduce your problem -- assigning a new attribute (including one obtained by processing existing ones) to each item j... | 1 | 0 | 0 | I'm using google appengine (python, of course :) ) and I'd like to do a string.replace on a string from the template file.
{% for item in items %}
<p>{{ item.code.replace( '_', ' ' ) }}</p>
{% endfor %}
But that isn't working. So we cannot execute anything other than basic checks in the app engine templates. Is t... | Google appengine string replacement in template file | 0.099668 | 0 | 0 | 600 |
1,417,715 | 2009-09-13T13:12:00.000 | 0 | 1 | 0 | 0 | python,http,httpwebrequest,cgi | 1,420,886 | 3 | false | 0 | 0 | Why do you need to distinguish between GET and HEAD?
Normally you shouldn't distinguish and should treat a HEAD request just like a GET. This is because a HEAD request is meant to return the exact same headers as a GET. The only difference is there will be no response content. Just because there is no response content ... | 1 | 12 | 0 | How can I find out the http request my python cgi received? I need different behaviors for HEAD and GET.
Thanks! | Detecting the http request type (GET, HEAD, etc) from a python cgi | 0 | 0 | 1 | 6,773 |
1,417,902 | 2009-09-13T14:44:00.000 | 4 | 0 | 0 | 0 | python,soap,cookies,suds | 1,417,916 | 1 | true | 0 | 0 | Set a "Cookie" HTTP Request Header having the required name/value pairs. This is how Cookie values are usually transmitted in HTTP Based systems. You can add multiple key/value pairs in the same http header.
Single Cookie
Cookie: name1=value1
Multiple Cookies (seperated by semicolons)
Cookie: name1=value1; name2=val... | 1 | 2 | 0 | I'm trying to access a SOAP API using Suds. The SOAP API documentation states that I have to provide three cookies with some login data. How can I accomplish this? | Sending cookies in a SOAP request using Suds | 1.2 | 0 | 1 | 1,581 |
1,418,082 | 2009-09-13T16:07:00.000 | 4 | 0 | 0 | 0 | python,selenium,selenium-rc | 1,750,751 | 12 | false | 0 | 0 | If you're on Windows, one option is to run the tests under a different user account. This means the browser and java server will not be visible to your own account. | 4 | 93 | 0 | I am using Selenium RC to automate some browser operations but I want the browser to be invisible. Is this possible? How? What about Selenium Grid? Can I hide the Selenium RC window also? | Is it possible to hide the browser in Selenium RC? | 0.066568 | 0 | 1 | 90,474 |
1,418,082 | 2009-09-13T16:07:00.000 | 3 | 0 | 0 | 0 | python,selenium,selenium-rc | 11,261,393 | 12 | false | 0 | 0 | This is how I run my tests with maven on a linux desktop (Ubuntu). I got fed up not being able to work with the firefox webdriver always taking focus.
I installed xvfb
xvfb-run -a mvn clean install
Thats it | 4 | 93 | 0 | I am using Selenium RC to automate some browser operations but I want the browser to be invisible. Is this possible? How? What about Selenium Grid? Can I hide the Selenium RC window also? | Is it possible to hide the browser in Selenium RC? | 0.049958 | 0 | 1 | 90,474 |
1,418,082 | 2009-09-13T16:07:00.000 | 0 | 0 | 0 | 0 | python,selenium,selenium-rc | 24,662,478 | 12 | false | 0 | 0 | On MacOSX, I haven't been able to hide the browser window, but at least I figured out how to move it to a different display so it doesn't disrupt my workflow so much. While Firefox is running tests, just control-click its icon in the dock, select Options, and Assign to Display 2. | 4 | 93 | 0 | I am using Selenium RC to automate some browser operations but I want the browser to be invisible. Is this possible? How? What about Selenium Grid? Can I hide the Selenium RC window also? | Is it possible to hide the browser in Selenium RC? | 0 | 0 | 1 | 90,474 |
1,418,082 | 2009-09-13T16:07:00.000 | 0 | 0 | 0 | 0 | python,selenium,selenium-rc | 55,484,939 | 12 | false | 0 | 0 | Using headless Chrome would be your best bet, or you could post directly to the site to interact with it, which would save a lot of compute power for other things/processes. I use this when testing out web automation bots that search for shoes on multiple sites using cpu heavy elements, the more power you save, and the... | 4 | 93 | 0 | I am using Selenium RC to automate some browser operations but I want the browser to be invisible. Is this possible? How? What about Selenium Grid? Can I hide the Selenium RC window also? | Is it possible to hide the browser in Selenium RC? | 0 | 0 | 1 | 90,474 |
1,418,266 | 2009-09-13T17:15:00.000 | 3 | 1 | 1 | 0 | python | 1,418,321 | 5 | false | 0 | 0 | Speed depends on the ratio of hits to misses. To be pythonic choose the clearer method.
Personally I think way#1 is clearer (It takes less lines to have an 'if' block rather than an exception block and also uses less brain space). It will also be faster when there are more hits than misses (an exception is more expensi... | 3 | 2 | 1 | I'm removing an item from an array if it exists.
Two ways I can think of to do this
Way #1
# x array, r item to remove
if r in x :
x.remove( r )
Way #2
try :
x.remove( r )
except :
pass
Timing it shows the try/except way can be faster
(some times i'm getting:)
1.16225508968e-06
8.80804972547e-07
1.143141965... | Which is more pythonic for array removal? | 0.119427 | 0 | 0 | 267 |
1,418,266 | 2009-09-13T17:15:00.000 | 2 | 1 | 1 | 0 | python | 1,418,275 | 5 | false | 0 | 0 | The try/except way | 3 | 2 | 1 | I'm removing an item from an array if it exists.
Two ways I can think of to do this
Way #1
# x array, r item to remove
if r in x :
x.remove( r )
Way #2
try :
x.remove( r )
except :
pass
Timing it shows the try/except way can be faster
(some times i'm getting:)
1.16225508968e-06
8.80804972547e-07
1.143141965... | Which is more pythonic for array removal? | 0.07983 | 0 | 0 | 267 |
1,418,266 | 2009-09-13T17:15:00.000 | 6 | 1 | 1 | 0 | python | 1,418,310 | 5 | true | 0 | 0 | I've always gone with the first method. if in reads far more clearly than exception handling does. | 3 | 2 | 1 | I'm removing an item from an array if it exists.
Two ways I can think of to do this
Way #1
# x array, r item to remove
if r in x :
x.remove( r )
Way #2
try :
x.remove( r )
except :
pass
Timing it shows the try/except way can be faster
(some times i'm getting:)
1.16225508968e-06
8.80804972547e-07
1.143141965... | Which is more pythonic for array removal? | 1.2 | 0 | 0 | 267 |
1,418,553 | 2009-09-13T18:53:00.000 | 3 | 1 | 0 | 1 | python,linux | 1,419,455 | 6 | true | 0 | 0 | First, pick a file extension you want for files you want to have this behavior. pyw is probably a good choice.
Name your file that, and in your file browser associate that file type with python. In GNOME, you'd open its Properties window, go to the Open With tab, and enter python as a custom command.
Now here's the i... | 1 | 3 | 0 | Sorry if this is on the wrong site ( maybe superuser ) but I'm trying to make my python.py file executable so I can click on it and it automatically does its thing, without me specifying it to open in the terminal by that default prompt, and I already have 'chmod +x' for its permissions.
Clarification:
I want to run i... | Auto executable python file without opening from terminal? | 1.2 | 0 | 0 | 9,279 |
1,418,588 | 2009-09-13T19:03:00.000 | 16 | 0 | 1 | 0 | python,performance,data-structures,dictionary | 1,418,591 | 2 | false | 0 | 0 | Dictionaries are one of the more heavily tuned parts of Python, since they underlie so much of the language. For example, members of a class, and variables in a stack frame are both stored internally in dictionaries. They will be a good choice if they are the right data structure.
Choosing between lists and dicts bas... | 1 | 35 | 0 | As the title states, how expensive are Python dictionaries to handle? Creation, insertion, updating, deletion, all of it.
Asymptotic time complexities are interesting themselves, but also how they compare to e.g. tuples or normal lists. | How expensive are Python dictionaries to handle? | 1 | 0 | 0 | 30,446 |
1,418,825 | 2009-09-13T21:02:00.000 | 5 | 0 | 1 | 0 | python,class,magic-methods | 37,850,243 | 10 | false | 0 | 0 | Do this if you prefer reading documentation from a CLI instead of the browser.
$ pydoc SPECIALMETHODS | 2 | 52 | 0 | Where is a complete list of the special double-underscore/dunder methods that can be used in classes? (e.g., __init__, __new__, __len__, __add__) | Where is the Python documentation for the special methods? (__init__, __new__, __len__, ...) | 0.099668 | 0 | 0 | 25,147 |
1,418,825 | 2009-09-13T21:02:00.000 | -3 | 0 | 1 | 0 | python,class,magic-methods | 1,418,931 | 10 | false | 0 | 0 | Familiarize yourself with the dir function. | 2 | 52 | 0 | Where is a complete list of the special double-underscore/dunder methods that can be used in classes? (e.g., __init__, __new__, __len__, __add__) | Where is the Python documentation for the special methods? (__init__, __new__, __len__, ...) | -0.059928 | 0 | 0 | 25,147 |
1,419,039 | 2009-09-13T22:48:00.000 | 3 | 0 | 1 | 0 | python,file,naming-conventions,explicit,variable-names | 1,420,921 | 6 | false | 0 | 0 | Generally if the scope of a file object is only a few lines, f is perfectly readable - the variable name for the filename in the open call is probably descriptive enough. otherwise something_file is probably a good idea. | 4 | 16 | 0 | A pretty silly trivial question. The canonical example is f = open('filename'), but
f is not very descriptive. After not looking at code in a while,
you can forget whether it means
"file" or "function f(x)" or "fourier
transform results" or something else. EIBTI.
In Python, file is already taken by a function.
Wha... | What variable name do you use for file descriptors? | 0.099668 | 0 | 0 | 5,842 |
1,419,039 | 2009-09-13T22:48:00.000 | 0 | 0 | 1 | 0 | python,file,naming-conventions,explicit,variable-names | 1,420,872 | 6 | false | 0 | 0 | I rather use one of: f, fp, fd.
Sometimes inf / outf for input and output file. | 4 | 16 | 0 | A pretty silly trivial question. The canonical example is f = open('filename'), but
f is not very descriptive. After not looking at code in a while,
you can forget whether it means
"file" or "function f(x)" or "fourier
transform results" or something else. EIBTI.
In Python, file is already taken by a function.
Wha... | What variable name do you use for file descriptors? | 0 | 0 | 0 | 5,842 |
1,419,039 | 2009-09-13T22:48:00.000 | 4 | 0 | 1 | 0 | python,file,naming-conventions,explicit,variable-names | 1,419,303 | 6 | false | 0 | 0 | I'm happy to use f (for either a function OR a file;-) if that identifier's scope is constrained to a pretty small compass (such as with open('zap') as f: would normally portend, say). In general, identifiers with large lexical scopes should be longer and more explicit, ones with lexically small/short scopes/lifespans ... | 4 | 16 | 0 | A pretty silly trivial question. The canonical example is f = open('filename'), but
f is not very descriptive. After not looking at code in a while,
you can forget whether it means
"file" or "function f(x)" or "fourier
transform results" or something else. EIBTI.
In Python, file is already taken by a function.
Wha... | What variable name do you use for file descriptors? | 0.132549 | 0 | 0 | 5,842 |
1,419,039 | 2009-09-13T22:48:00.000 | 2 | 0 | 1 | 0 | python,file,naming-conventions,explicit,variable-names | 1,419,050 | 6 | false | 0 | 0 | generally I'll use "fp" for a short-lifetime file pointer.
for a longer-lived descriptor, I'll be more descriptive. "fpDebugLog", for example. | 4 | 16 | 0 | A pretty silly trivial question. The canonical example is f = open('filename'), but
f is not very descriptive. After not looking at code in a while,
you can forget whether it means
"file" or "function f(x)" or "fourier
transform results" or something else. EIBTI.
In Python, file is already taken by a function.
Wha... | What variable name do you use for file descriptors? | 0.066568 | 0 | 0 | 5,842 |
1,419,046 | 2009-09-13T22:54:00.000 | 26 | 0 | 1 | 0 | python,arguments,keyword,optional-parameters,named-parameters | 1,419,098 | 10 | false | 0 | 0 | There are two ways to assign argument values to function parameters, both are used.
By Position. Positional arguments do not have keywords and are assigned first.
By Keyword. Keyword arguments have keywords and are assigned second, after positional arguments.
Note that you have the option to use positional argument... | 1 | 317 | 0 | How are "keyword arguments" different from regular arguments? Can't all arguments be passed as name=value instead of using positional syntax? | Normal arguments vs. keyword arguments | 1 | 0 | 0 | 279,057 |
1,419,442 | 2009-09-14T02:24:00.000 | 0 | 0 | 0 | 0 | python,django,django-models | 1,419,548 | 6 | false | 1 | 0 | Probably you need to use the content types app to link to a model. You might then arrange for your app to check the settings to do some additional checking to limit which content types it will accept or suggest. | 1 | 17 | 0 | In my django site I have two apps, blog and links. blog has a model blogpost, and links has a model link. There should be a one to many relationship between these two things. There are many links per blogpost, but each link has one and only one blog post. The simple answer is to put a ForeignKey to blogpost in the link... | How to Model a Foreign Key in a Reusable Django App? | 0 | 0 | 0 | 3,459 |
1,422,368 | 2009-09-14T15:43:00.000 | 95 | 1 | 0 | 1 | python,windows,linux | 1,422,436 | 3 | true | 0 | 0 | The substitute of fcntl on windows are win32api calls. The usage is completely different. It is not some switch you can just flip.
In other words, porting a fcntl-heavy-user module to windows is not trivial. It requires you to analyze what exactly each fcntl call does and then find the equivalent win32api code, if any.... | 1 | 86 | 0 | I received a Python project (which happens to be a Django project, if that matters,) that uses the fcntl module from the standard library, which seems to be available only on Linux. When I try to run it on my Windows machine, it stops with an ImportError, because this module does not exist here.
Is there any way for me... | fcntl substitute on Windows | 1.2 | 0 | 0 | 122,994 |
1,422,969 | 2009-09-14T17:45:00.000 | 10 | 0 | 1 | 0 | python | 1,423,016 | 1 | true | 0 | 0 | heapq uses the intrinsic comparisons on queue items (__le__ and friends). The general way to work around this limit is the good old approach known as "decorate/undecorate" -- that's what we used to do in sorting, before the key= parameter was introduced there.
To put it simply, you enqueue and dequeue, not just the ite... | 1 | 3 | 0 | At the moment, I am trying to write a priority queue in Python using the built in heapq library. However, I am stuck trying to get a handle on what Python does with the tie-breaking, I want to have a specific condition where I can dictate what happens with the tie-breaking instead of the heapq library that seems to alm... | Python and the built-in heap | 1.2 | 0 | 0 | 489 |
1,423,000 | 2009-09-14T17:56:00.000 | 0 | 0 | 0 | 0 | python,web-applications,python-3.x,wsgi | 1,934,744 | 4 | false | 1 | 0 | Even though it's not officially released yet, I am currently 'playing around' with CherryPy 3.2.0rc1 with Python 3.1.1 and have had no problems yet. Haven't used it with py-postgresql, but I don't see why it shouldn't work.
Hope this helps,
Alan | 1 | 1 | 0 | I have started learning Python by writing a small application using Python 3.1 and py-PostgreSQL. Now I want to turn it into a web application.
But it seems that most frameworks such as web-py, Django, zope are still based on Python 2.x. Unfortunately, py-PostgreSQL is incompatible with Python 2.x.
Do I have to rewrite... | web framework compatible with python 3.1 and py-postgresql | 0 | 1 | 0 | 1,695 |
1,423,041 | 2009-09-14T18:03:00.000 | 0 | 0 | 0 | 0 | python,frameworks,cgi,nearlyfreespeech | 1,423,084 | 4 | false | 1 | 0 | By the things they reject. I think that twisted.web is still an option there, but I don't have any experience with nearlyfreespeech.net | 1 | 6 | 0 | From nearlyfreespeech's website, they state that the following don't work well:
mod_python Web application
frameworks that depend on persistent processes, including: Ruby On Rails, Django, Zope, and others (some of these will run under CGI, but will run slowly and are suitable only for development purposes)
Are ther... | What python web frameworks work well with CGI (e.g. on nearlyfreespeech.net)? | 0 | 0 | 0 | 1,934 |
1,423,308 | 2009-09-14T18:59:00.000 | 0 | 1 | 0 | 0 | python,modem,gsm,at-command | 1,424,253 | 2 | false | 0 | 0 | I find I can't remember much of the AT command set related to SMS. Andre Miller's answer seems to ring a few bells. Anyway you should read the documentation very carefully, I'm sure there were a few gotchas.
My recommentation for polling is at least every 5 seconds - this is just for robustness and responsiveness in ... | 1 | 8 | 0 | I have a GSM modem connected to my computer, i want to receive text messages sent to it using a python program i have written, am just wondering what is the best technique to poll for data.
Should i write a program that has a infinite loop that continuously checks for incoming sms's i.e within the loop the program sen... | What is the best design for polling a modem for incoming data? | 0 | 0 | 0 | 3,845 |
1,424,392 | 2009-09-14T23:26:00.000 | 8 | 0 | 0 | 0 | python,django,ide,code-completion,komodo | 1,424,443 | 3 | false | 1 | 0 | o to Edit > Preferences. Expand the
"Languages" group by clicking the [+]
symbol. Click "Python". Click the
little "Add..." button under
"Additional Python Import
Directories". Add the directory ABOVE
your project and you should have
intellisense enabled.
This has always worked for me for both Django ... | 3 | 2 | 0 | I've been using Komodo Edit for a small project in Django.
The code completion features seem to work pretty well for standard python modules, however, it doesn't know anything about Django modules. Is there any way to configure Komodo Edit to use Django modules for autocomplete as well? | Komodo Edit - code-completion for Django? | 1 | 0 | 0 | 6,602 |
1,424,392 | 2009-09-14T23:26:00.000 | 4 | 0 | 0 | 0 | python,django,ide,code-completion,komodo | 1,424,422 | 3 | true | 1 | 0 | By sure Django is on your python path and Komodo should pick it up. Alternatively you can add the location of Django to where Komodo looks for its autocomplete. | 3 | 2 | 0 | I've been using Komodo Edit for a small project in Django.
The code completion features seem to work pretty well for standard python modules, however, it doesn't know anything about Django modules. Is there any way to configure Komodo Edit to use Django modules for autocomplete as well? | Komodo Edit - code-completion for Django? | 1.2 | 0 | 0 | 6,602 |
1,424,392 | 2009-09-14T23:26:00.000 | 2 | 0 | 0 | 0 | python,django,ide,code-completion,komodo | 1,424,499 | 3 | false | 1 | 0 | Hmmm. It's installed by default so my answer probably isn't the right solution. :-)
But here goes...
You can install a Django extension in Komodo edit. I haven't tested it myself but you can test it.
Tools -> Add-ons -> Extensions
It's name is "Django Language".
Check if it works. | 3 | 2 | 0 | I've been using Komodo Edit for a small project in Django.
The code completion features seem to work pretty well for standard python modules, however, it doesn't know anything about Django modules. Is there any way to configure Komodo Edit to use Django modules for autocomplete as well? | Komodo Edit - code-completion for Django? | 0.132549 | 0 | 0 | 6,602 |
1,424,398 | 2009-09-14T23:28:00.000 | 4 | 1 | 0 | 1 | python,python-idle | 20,500,218 | 11 | false | 0 | 0 | I actually just discovered the easiest answer, if you use the shortcut link labeled "IDLE (Python GUI)". This is in Windows Vista, so I don't know if it'll work in other OS's.
1) Right-click "Properties".
2) Select "Shortcut" tab.
3) In "Start In", write file path (e.g. "C:\Users...").
Let me know if this works! | 8 | 9 | 0 | Does anyone know where or how to set the default path/directory on saving python scripts prior to running?
On a Mac it wants to save them in the top level ~/Documents directory. I would like to specify a real location. Any ideas? | Default save path for Python IDLE? | 0.072599 | 0 | 0 | 28,611 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.