Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,602,728 | 2010-08-30T17:27:00.000 | -1 | 0 | 0 | 0 | python,itunes,win32com | 3,602,834 | 4 | false | 0 | 0 | Run dir(my_com_client) to get a list of available methods. | 1 | 5 | 0 | I'm trying to develop some scripts for iTunes in python and actually i'm having quite a hard time getting the API information.
I'm using the win32com.client module but i would really need to get all the specifications, methods and details.
There are a few examples but I need some extra data......
thanks!!! | iTunes API for python scripting | -0.049958 | 0 | 1 | 9,348 |
3,603,581 | 2010-08-30T19:32:00.000 | 5 | 0 | 1 | 0 | python,pickle | 63,610,942 | 4 | false | 0 | 0 | Pickling is the process in which the objects in python are converted into simple binary representation that can be used to write that object in a text file which can be stored. This is done to store the python objects and is also called as serialization. You can infer from this what de-serialization or unpickling means.
So when we say an object is picklable it means that the object can be serialized using the pickle module of python. | 3 | 96 | 0 | Python docs mention this word a lot and I want to know what it means! Googling doesn't help much.. | What does it mean for an object to be picklable (or pickle-able)? | 0.244919 | 0 | 0 | 41,912 |
3,603,581 | 2010-08-30T19:32:00.000 | 37 | 0 | 1 | 0 | python,pickle | 3,604,099 | 4 | false | 0 | 0 | Things that are usually not pickable are, for example, sockets, file(handler)s, database connections, and so on. Everything that's build up (recursively) from basic python types (dicts, lists, primitives, objects, object references, even circular) can be pickled by default.
You can implement custom pickling code that will, for example, store the configuration of a database connection and restore it afterwards, but you will need special, custom logic for this.
All of this makes pickling a lot more powerful than xml, json and yaml (but definitely not as readable) | 3 | 96 | 0 | Python docs mention this word a lot and I want to know what it means! Googling doesn't help much.. | What does it mean for an object to be picklable (or pickle-able)? | 1 | 0 | 0 | 41,912 |
3,603,581 | 2010-08-30T19:32:00.000 | 4 | 0 | 1 | 0 | python,pickle | 68,867,775 | 4 | false | 0 | 0 | These are all great answers, but for anyone who's new to programming and still confused here's the simple answer:
Pickling is making it so you can store it long term and get it later without it going bad. A bit like Saving in a video game.
So anything that's actively changing (like a live connection to a database) can't be stored directly (though you could probably figure out a way to store the information needed to create a new connection, and that you could pickle)
Bonus definition: Serializing is packaging it in a form that can be handed off to another program. Unserializing it is unpacking something you got sent so that you can use it | 3 | 96 | 0 | Python docs mention this word a lot and I want to know what it means! Googling doesn't help much.. | What does it mean for an object to be picklable (or pickle-able)? | 0.197375 | 0 | 0 | 41,912 |
3,603,858 | 2010-08-30T20:09:00.000 | 15 | 1 | 0 | 0 | python,matlab,structure | 3,604,355 | 18 | false | 0 | 0 | Well, if you want it in layman's terms:
I reccomend people to write the shortest readable program that works.
There are a lot more rules about how to format code, name variables, design classes, separate responsibilities. But you should not forget that all of those rules are only there to make sure that your code is easy to check for errors, and to ensure it is maintainable by someone else than the original author. If keep the above reccomendation in mind, your progam will be just that. | 5 | 45 | 0 | I would like to know the basic principles and etiquette of writing a well structured code. | Good practices in writing MATLAB code? | 1 | 0 | 0 | 3,967 |
3,603,858 | 2010-08-30T20:09:00.000 | 22 | 1 | 0 | 0 | python,matlab,structure | 3,604,376 | 18 | true | 0 | 0 | These are the most important two things to keep in mind when you are writing code:
Don't write code that you've already written.
Don't write code that you don't need to write. | 5 | 45 | 0 | I would like to know the basic principles and etiquette of writing a well structured code. | Good practices in writing MATLAB code? | 1.2 | 0 | 0 | 3,967 |
3,603,858 | 2010-08-30T20:09:00.000 | 2 | 1 | 0 | 0 | python,matlab,structure | 3,604,396 | 18 | false | 0 | 0 | Personally, I've found that I learned more about programming style from working through SICP which is the MIT Intro to Comp SCI text (I'm about a quarter of the way through.) Than any other book. That being said, If you're going to be working in Python, the Google style guide is an excellent place to start.
I read somewhere that most programs (scripts anyways) should never be more than a couple of lines long. All the requisite functionality should be abstracted into functions or classes. I tend to agree. | 5 | 45 | 0 | I would like to know the basic principles and etiquette of writing a well structured code. | Good practices in writing MATLAB code? | 0.022219 | 0 | 0 | 3,967 |
3,603,858 | 2010-08-30T20:09:00.000 | 1 | 1 | 0 | 0 | python,matlab,structure | 3,607,452 | 18 | false | 0 | 0 | Make it readable, make it intuitive, make it understandable, and make it commented. | 5 | 45 | 0 | I would like to know the basic principles and etiquette of writing a well structured code. | Good practices in writing MATLAB code? | 0.011111 | 0 | 0 | 3,967 |
3,603,858 | 2010-08-30T20:09:00.000 | 2 | 1 | 0 | 0 | python,matlab,structure | 3,604,559 | 18 | false | 0 | 0 | Many good points have been made above. I definitely second all of the above. I would also like to add that spelling and consistency in coding be something you practice (and also in real life).
I've worked with some offshore teams and though their English is pretty good, their spelling errors caused a lot of confusion. So for instance, if you need to look for some function (e.g., getFeedsFromDatabase) and they spell database wrong or something else, that can be a big or small headache, depending on how many dependencies you have on that particular function. The fact that it gets repeated over and over within the code will first off, drive you nuts, and second, make it difficult to parse.
Also, keep up with consistency in terms of naming variables and functions. There are many protocols to go by but as long as you're consistent in what you do, others you work with will be able to better read your code and be thankful for it. | 5 | 45 | 0 | I would like to know the basic principles and etiquette of writing a well structured code. | Good practices in writing MATLAB code? | 0.022219 | 0 | 0 | 3,967 |
3,603,883 | 2010-08-30T20:12:00.000 | 0 | 1 | 0 | 1 | python,mechanize | 3,603,922 | 2 | true | 1 | 0 | Yes. It can use any URL available so long as it is reachable. Just make sure it's properly formatted! | 1 | 0 | 0 | Can Mechanize access sites being locally hosted by Apache? | Can python's mechanize use localhost sites? | 1.2 | 0 | 0 | 257 |
3,604,205 | 2010-08-30T21:02:00.000 | 4 | 0 | 0 | 0 | python,ruby-on-rails,django | 3,604,329 | 3 | true | 1 | 0 | I have never seen Rails scaffold-generated view code used in a production app. The chances that it's going to create the look that you want is nearly zero. I use the generators for models and controllers all the time, as they are very useful.
To your question of frameworks:
If you know Python better, use Django.
If you know Ruby better, use Rails.
If this is a hobby site, use whichever one interests you the most. | 2 | 5 | 0 | If you take out the scaffolding feature where it creates the model/controller, and CRUD pages for you, is ruby on rails still any faster to market than say, django?
It seems very similiar to be if you take away that step...(even though I believe django has similar auto-gen capabilities)
I am reading the starting guide on the rails site, and when it introduces the scaffolding feature, it says that many people prefer to hand code these types of areas. | if you don't use scaffolding, is ruby on rails still good for rapid development? | 1.2 | 0 | 0 | 396 |
3,604,205 | 2010-08-30T21:02:00.000 | 1 | 0 | 0 | 0 | python,ruby-on-rails,django | 3,604,384 | 3 | false | 1 | 0 | Scaffolding is just a demo and learning feature. It's not intended for use in real site development. It's certainly not Rails' primary strength. | 2 | 5 | 0 | If you take out the scaffolding feature where it creates the model/controller, and CRUD pages for you, is ruby on rails still any faster to market than say, django?
It seems very similiar to be if you take away that step...(even though I believe django has similar auto-gen capabilities)
I am reading the starting guide on the rails site, and when it introduces the scaffolding feature, it says that many people prefer to hand code these types of areas. | if you don't use scaffolding, is ruby on rails still good for rapid development? | 0.066568 | 0 | 0 | 396 |
3,604,357 | 2010-08-30T21:28:00.000 | 0 | 0 | 1 | 0 | python,user-interface,gtk | 3,604,511 | 3 | false | 0 | 1 | You mean a widget to filter a large collection into multiple subsets / views?
I would guess you have to implement this yourself - a list of options on the left and filtered results on the right, I don't know of any existing (gtk) widgets. | 1 | 1 | 0 | I'm trying to write a simple GTD-style todo list app with python and gtk to learn python. I want a container that can select an individual list from a lot of choices. It would be something like the list of notebooks area in tomboy. Not a combobox.
As you can probably tell I'm a beginner and the terminology is probably off.
Can you please tell me what it is I'm looking for and an overview of how to implement it? | Python PyGTK. What's this component? | 0 | 0 | 0 | 256 |
3,604,565 | 2010-08-30T22:01:00.000 | 1 | 0 | 0 | 0 | python,django,mongodb | 3,605,615 | 3 | false | 1 | 0 | What does the migration process look like with a non-relational db?
Depends on if you need to update all the existing data or not.
In many cases, you may not need to touch the old data, such as when adding a new optional field. If that field also has a default value, you may also not need to update the old documents, if your application can handle a missing field correctly. However, if you want to build an index on the new field to be able to search/filter/sort, you need to add the default value back into the old documents.
Something like field renaming (trivial in a relational db, because you only need to update the catalog and not touch any data) is a major undertaking in MongoDB (you need to rewrite all documents).
If you need to update the existing data, you usually have to write a migration function that iterates over all the documents and updates them one by one (although this process can be shared and run in parallel). For large data sets, this can take a lot of time (and space), and you may miss transactions (if you end up with a crashed migration that went half-way through). | 2 | 18 | 0 | Since mongo doesn't have a schema, does that mean that we won't have to do migrations when we change the models?
What does the migration process look like with a non-relational db? | Does django with mongodb make migrations a thing of the past? | 0.066568 | 1 | 0 | 5,660 |
3,604,565 | 2010-08-30T22:01:00.000 | 2 | 0 | 0 | 0 | python,django,mongodb | 3,604,687 | 3 | false | 1 | 0 | There is no silver bullet. Adding or removing fields is easier with non-relational db (just don't use unneeded fields or use new fields), renaming a field is easier with traditional db (you'll usually have to change a lot of data in case of field rename in schemaless db), data migration is on par - depending on task. | 2 | 18 | 0 | Since mongo doesn't have a schema, does that mean that we won't have to do migrations when we change the models?
What does the migration process look like with a non-relational db? | Does django with mongodb make migrations a thing of the past? | 0.132549 | 1 | 0 | 5,660 |
3,605,188 | 2010-08-31T00:21:00.000 | 2 | 0 | 1 | 0 | python,multithreading,queue | 3,607,187 | 5 | false | 0 | 0 | Queue is a FIFO (first in first out) register so remember that the consumer can be faster than producer. When consumers thread detect that the queue is empty normally realise one of following actions:
Send to API: switch to next thread.
Send to API: sleep some ms and than check again the queue.
Send to API: wait on event (like new message in queue).
If you wont that consumers thread terminate after job is complete than put in queue a sentinel value to terminate task. | 3 | 14 | 0 | I'm learning to use the Queue module, and am a bit confused about how a queue consumer thread can be made to know that the queue is complete. Ideally I'd like to use get() from within the consumer thread and have it throw an exception if the queue has been marked "done". Is there a better way to communicate this than by appending a sentinel value to mark the last item in the queue? | Communicating end of Queue | 0.07983 | 0 | 1 | 10,185 |
3,605,188 | 2010-08-31T00:21:00.000 | 0 | 0 | 1 | 0 | python,multithreading,queue | 3,605,282 | 5 | false | 0 | 0 | The best practice way of doing this would be to have the queue itself notify a client that it has reached the 'done' state. The client can then take any action that is appropriate.
What you have suggested; checking the queue to see if it is done periodically, would be highly undesirable. Polling is an antipattern in multithreaded programming, you should always be using notifications.
EDIT:
So your saying that the queue itself knows that it's 'done' based on some criteria and needs to notify the clients of that fact. I think you are correct and the best way to do this is by throwing when a client calls get() and the queue is in the done state. If your throwing this would negate the need for a sentinel value on the client side. Internally the queue can detect that it is 'done' in any way it pleases e.g. queue is empty, it's state was set to done etc I don't see any need for a sentinel value. | 3 | 14 | 0 | I'm learning to use the Queue module, and am a bit confused about how a queue consumer thread can be made to know that the queue is complete. Ideally I'd like to use get() from within the consumer thread and have it throw an exception if the queue has been marked "done". Is there a better way to communicate this than by appending a sentinel value to mark the last item in the queue? | Communicating end of Queue | 0 | 0 | 1 | 10,185 |
3,605,188 | 2010-08-31T00:21:00.000 | 8 | 0 | 1 | 0 | python,multithreading,queue | 3,605,258 | 5 | false | 0 | 0 | A sentinel is a natural way to shut down a queue, but there are a couple things to watch out for.
First, remember that you may have more than one consumer, so you need to send a sentinel once for each running consumer, and guarantee that each consumer will only consume one sentinel, to ensure that each consumer receives its shutdown sentinel.
Second, remember that Queue defines an interface, and that when possible, code should behave regardless of the underlying Queue. You might have a PriorityQueue, or you might have some other class that exposes the same interface and returns values in some other order.
Unfortunately, it's hard to deal with both of these. To deal with the general case of different queues, a consumer that's shutting down must continue to consume values after receiving its shutdown sentinel until the queue is empty. That means that it may consume another thread's sentinel. This is a weakness of the Queue interface: it should have a Queue.shutdown call to cause an exception to be thrown by all consumers, but that's missing.
So, in practice:
if you're sure you're only ever using a regular Queue, simply send one sentinel per thread.
if you may be using a PriorityQueue, ensure that the sentinel has the lowest priority. | 3 | 14 | 0 | I'm learning to use the Queue module, and am a bit confused about how a queue consumer thread can be made to know that the queue is complete. Ideally I'd like to use get() from within the consumer thread and have it throw an exception if the queue has been marked "done". Is there a better way to communicate this than by appending a sentinel value to mark the last item in the queue? | Communicating end of Queue | 1 | 0 | 1 | 10,185 |
3,605,742 | 2010-08-31T03:00:00.000 | 0 | 0 | 1 | 0 | python,python-imaging-library | 29,567,988 | 3 | false | 0 | 0 | For Mac OSX there are two solid options. First you must open the Terminal App.
1. Try installing with homebrew with this command:
brew install pillow
brew list (this will check if it installed property)
2. Or you can install with pip with this command:
pip install pillow
pip show pillow (this will check if it installed property) | 1 | 0 | 0 | Where do I download the python PIL module from? I found some sites but not sure if they can be trusted.
This is for my macbookpro.
Is effbot the source? | Where do download python PIL module from? | 0 | 0 | 0 | 2,974 |
3,606,215 | 2010-08-31T05:18:00.000 | 0 | 0 | 0 | 0 | python,sql,database,google-app-engine,nosql | 3,649,176 | 5 | true | 1 | 0 | Thank you for all the answers. To summarize the answers, currently only web2py and Django supports this kind of abstraction.
It is not about a SQL-NoSQL holy grail, using abstraction can make the apps more flexible. Lets assume that you started a project using NoSQL, and then later on you need to switch over to SQL. It is desirable that you only make changes to the codes in a few spots instead of all over the place. For some cases, it does not really matter whether you store the data in a relational or non-relational db. For example, storing user profiles, text content for dynamic page, or blog entries.
I know there must be a trade off by using the abstraction, but my question is more about the existing solution or technical insight, instead of the consequences. | 3 | 2 | 0 | Is it even possible to create an abstraction layer that can accommodate relational and non-relational databases? The purpose of this layer is to minimize repetition and allows a web application to use any kind of database by just changing/modifying the code in one place (ie, the abstraction layer). The part that sits on top of the abstraction layer must not need to worry whether the underlying database is relational (SQL) or non-relational (NoSQL) or whatever new kind of database that may come out later in the future. | Is there any python web app framework that provides database abstraction layer for SQL and NoSQL? | 1.2 | 1 | 0 | 1,721 |
3,606,215 | 2010-08-31T05:18:00.000 | 1 | 0 | 0 | 0 | python,sql,database,google-app-engine,nosql | 3,609,648 | 5 | false | 1 | 0 | Regarding App Engine, all existing attempts limit you in some way (web2py doesn't support transactions or namespaces and probably many other stuff, for example). If you plan to work with GAE, use what GAE provides and forget looking for a SQL-NoSQL holy grail. Existing solutions are inevitably limited and affect performance negatively. | 3 | 2 | 0 | Is it even possible to create an abstraction layer that can accommodate relational and non-relational databases? The purpose of this layer is to minimize repetition and allows a web application to use any kind of database by just changing/modifying the code in one place (ie, the abstraction layer). The part that sits on top of the abstraction layer must not need to worry whether the underlying database is relational (SQL) or non-relational (NoSQL) or whatever new kind of database that may come out later in the future. | Is there any python web app framework that provides database abstraction layer for SQL and NoSQL? | 0.039979 | 1 | 0 | 1,721 |
3,606,215 | 2010-08-31T05:18:00.000 | 1 | 0 | 0 | 0 | python,sql,database,google-app-engine,nosql | 3,606,610 | 5 | false | 1 | 0 | Yo may also check web2py, they support relational databases and GAE on the core. | 3 | 2 | 0 | Is it even possible to create an abstraction layer that can accommodate relational and non-relational databases? The purpose of this layer is to minimize repetition and allows a web application to use any kind of database by just changing/modifying the code in one place (ie, the abstraction layer). The part that sits on top of the abstraction layer must not need to worry whether the underlying database is relational (SQL) or non-relational (NoSQL) or whatever new kind of database that may come out later in the future. | Is there any python web app framework that provides database abstraction layer for SQL and NoSQL? | 0.039979 | 1 | 0 | 1,721 |
3,606,669 | 2010-08-31T06:59:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 3,611,807 | 2 | false | 1 | 0 | I would suggest the following:
Make 'marked' entities child entities of the users who have marked them.
Use a key name for the 'marked' entity that is based on the URL of the page marked
To find friends who have marked a page, retrieve a list of friends, then generate the list of entity keys from the list of friends (easy, since you know the friend key and the URL), and do a single batch get to retrieve a list of 'mark' entities indicating which friends have marked that page. | 1 | 2 | 0 | In a python based facebook application on GAE, i want to check which friends of current user have "marked" a web page or not.
For this i have to run as many DB queries as the number of friends (say 100)
I fear this may run into "timeout" because of large no of queries.
Google DOCs suggest that "list" queries run in parallel, will this save time ??
Also list has a limit of 30, so i have to make 2 or 3 queries of list type.
Please suggest a better way if possible, using task ques or something.... | List query with, facebook friends in list? | 0.099668 | 0 | 0 | 442 |
3,606,743 | 2010-08-31T07:07:00.000 | 0 | 0 | 1 | 1 | python,google-app-engine,ssl | 3,606,827 | 3 | false | 0 | 0 | Why don't you provide the complete path to python executable. That should work.
C:\"Python2.5.2"\python.exe setup.py install | 1 | 1 | 0 | I'm running GAE SDK on a Windows Vista laptop. It keeps reminding me to install the SSL module. I've been having great difficulty on how to do that.
I've downloaded the SSL module.
I've done 'python setup.py install' in cmd, but it just says "python is not recognized as an internal..."
I've added C:\Python2.5.2 to my PATH.
Still the same message "python is not recognized as an internal or external command..."
What else should I do? | Installing Python SSL module on Windows Vista | 0 | 0 | 0 | 530 |
3,607,020 | 2010-08-31T07:46:00.000 | 3 | 0 | 1 | 0 | python,vba | 3,627,197 | 4 | false | 0 | 0 | It is matter of taste. If you use modules your 'program' will be more procedural oriented. If you choose classes it will be more or less object oriented. I'm working with Excel for couple of months and personally I choose classes whenever I can because it is more comfortable to me. If you stop thinking about objects and think of them as Components you can use them with elegance. The main reason why I prefer classes is that you can have it more that one. You can't have two instances of module. It allows me use encapsulation and better code reuse.
For example let's assume that you like to have some kind of logger, to log actions that were done by your program during execution. You can write a module for that. It can have for example a global variable indicating on which particular sheet logging will be done. But consider the following hypothetical situation: your client wants you to include some fancy report generation functionality in your program. You are smart so you figure out that you can use your logging code to prepare them. But you can't do log and report simultaneously by one module. And you can with two instances of logging Component without any changes in their code. | 4 | 5 | 0 | My first "serious" language was Java, so I have comprehended object-oriented programming in sense that elemental brick of program is a class.
Now I write on VBA and Python. There are module languages and I am feeling persistent discomfort: I don't know how should I decompose program in a modules/classes.
I understand that one module corresponds to one knowledge domain, one module should ba able to test separately...
Should I apprehend module as namespace(c++) only? | Module vs object-oriented programming in vba | 0.148885 | 0 | 0 | 4,745 |
3,607,020 | 2010-08-31T07:46:00.000 | 3 | 0 | 1 | 0 | python,vba | 3,607,773 | 4 | true | 0 | 0 | I don't do VBA but in python, modules are fundamental. As you say, the can be viewed as namespaces but they are also objects in their own right. They are not classes however, so you cannot inherit from them (at least not directly).
I find that it's a good rule to keep a module concerned with one domain area. The rule that I use for deciding if something is a module level function or a class method is to ask myself if it could meaningfully be used on any objects that satisfy the 'interface' that it's arguments take. If so, then I free it from a class hierarchy and make it a module level function. If its usefulness truly is restricted to a particular class hierarchy, then I make it a method.
If you need it work on all instances of a class hierarchy and you make it a module level function, just remember that all the the subclasses still need to implement the given interface with the given semantics. This is one of the tradeoffs of stepping away from methods: you can no longer make a slight modification and call super. On the other hand, if subclasses are likely to redefine the interface and its semantics, then maybe that particular class hierarchy isn't a very good abstraction and should be rethought. | 4 | 5 | 0 | My first "serious" language was Java, so I have comprehended object-oriented programming in sense that elemental brick of program is a class.
Now I write on VBA and Python. There are module languages and I am feeling persistent discomfort: I don't know how should I decompose program in a modules/classes.
I understand that one module corresponds to one knowledge domain, one module should ba able to test separately...
Should I apprehend module as namespace(c++) only? | Module vs object-oriented programming in vba | 1.2 | 0 | 0 | 4,745 |
3,607,020 | 2010-08-31T07:46:00.000 | 1 | 0 | 1 | 0 | python,vba | 3,607,379 | 4 | false | 0 | 0 | VBA also allows the use of classes. Unfortunately, those classes don't support all the features of a full-fleged object oriented language. Especially inheritance is not supported.
But you can work with interfaces, at least up to a certain degree.
I only used modules like "one module = one singleton". My modules contain "static" or even stateless methods. So in my opinion a VBa module is not namespace. More often a bunch of classes and modules would form a "namespace". I often create a new project (DLL, DVB or something similar) for such a "namespace". | 4 | 5 | 0 | My first "serious" language was Java, so I have comprehended object-oriented programming in sense that elemental brick of program is a class.
Now I write on VBA and Python. There are module languages and I am feeling persistent discomfort: I don't know how should I decompose program in a modules/classes.
I understand that one module corresponds to one knowledge domain, one module should ba able to test separately...
Should I apprehend module as namespace(c++) only? | Module vs object-oriented programming in vba | 0.049958 | 0 | 0 | 4,745 |
3,607,020 | 2010-08-31T07:46:00.000 | 1 | 0 | 1 | 0 | python,vba | 3,607,193 | 4 | false | 0 | 0 | Idioms of languages are different and thats the reason a problem solved in different languages take different approaches.
"C" is all about procedural decomposition.
Main idiom in Java is about "class or Object" decomposition. Functions are not absent, but they become a part of exhibited behavior of these classes.
"Python" provides support for both Class based problem decomposition as well as procedural based.
All of these uses files, packages or modules as concept for organizing large code pieces together. There is nothing that restricts you to have one module for one knowledge domain.
These are decomposition and organizing techniques and can be applied based on the problem at hand.
If you are comfortable with OO, you should be able to use it very well in Python. | 4 | 5 | 0 | My first "serious" language was Java, so I have comprehended object-oriented programming in sense that elemental brick of program is a class.
Now I write on VBA and Python. There are module languages and I am feeling persistent discomfort: I don't know how should I decompose program in a modules/classes.
I understand that one module corresponds to one knowledge domain, one module should ba able to test separately...
Should I apprehend module as namespace(c++) only? | Module vs object-oriented programming in vba | 0.049958 | 0 | 0 | 4,745 |
3,607,201 | 2010-08-31T08:12:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine | 3,608,338 | 1 | true | 1 | 0 | You need to edit it programmatically. Not all property types can be edited in the data viewer. | 1 | 0 | 0 | I would like to edit the value of a StringListProperty variable on App Engine. Is it possible? I don't see any sign of editable field for a StringListProperty variable right inside the DataViewer panel. | How to edit a StringListProperty value in Google App Engine? | 1.2 | 0 | 0 | 220 |
3,607,254 | 2010-08-31T08:21:00.000 | 0 | 1 | 0 | 1 | python,c,linux | 3,607,298 | 3 | true | 0 | 0 | On linux object files are written in ELF file format.So i think you have to start with understanding the ELF file format and how OS write object file using this format.That can give you a idea how you can read object file and symbol table by your own program.To get some initial idea you can look into the source code of readelf tool. | 1 | 0 | 0 | Question is simple, i have a object file and i want to read the symbols of the object file via code. I am aware that the linux command "nm" would be able to do this, but i want to be able to do it inside code.
Also note id like to do this either via C or Python.
Regards
Paul | How to read symbols of an object file using C | 1.2 | 0 | 0 | 1,506 |
3,607,285 | 2010-08-31T08:25:00.000 | 6 | 0 | 1 | 0 | python,orm | 3,609,616 | 4 | true | 0 | 0 | If you are looking for something thats high performance, and based on one of your comments "something that can handle >5k queries per second". You need to keep in mind that an ORM is not built specifically for speed and performance, it is built for maintainability and ease of use. If the data is so basic that even SqlAlchemy might be overkill, and your mostly doing writes, it might be easier to just do straight inserts and skip the ORM altogether. | 1 | 3 | 0 | Can you recommend a high-performance, thread-safe and stable ORM for Python? The data I need to work with isn't complex, so SQLAlchemy is probably an overkill. | Fast, thread-safe Python ORM? | 1.2 | 1 | 0 | 3,631 |
3,607,573 | 2010-08-31T09:09:00.000 | 3 | 0 | 0 | 0 | python,django,keyword-argument | 32,918,934 | 5 | false | 1 | 0 | Using instance._state.adding is the most logical approach, as you will be able to tell the model state exists or is new, regardless whether the primary key as been assigned or not. | 2 | 31 | 0 | I am using Django's pre_save signal to implement auto_now_add. There is a lot of discussion on the internet on why you should or shouldn't implement it yourself. I do not appreciate comments on this. Neither on whether I should be rewriting the save function (I have a lot of models that use auto_now_add so using signals makes sense).
My question is:
I would like to check if the instance is created or updated. According to some sources on the internet this can be done by testing if kwargs['created'] is True. However 'created' does not appear in my kwargs even though the instance is newly created.
I was just wondering if it has ever existed or that it has disappeared magically.
I know I could also test if kwargs['instance'].id is set (this in fact works for me), but I'd like to know if kwargs['created'] still exists. | Django pre_save signal: check if instance is created not updated, does kwargs['created'] (still) exist? | 0.119427 | 0 | 0 | 21,951 |
3,607,573 | 2010-08-31T09:09:00.000 | 57 | 0 | 0 | 0 | python,django,keyword-argument | 12,132,343 | 5 | false | 1 | 0 | Primary key attribute usually assigned by the database when the instance saved first time. So you can use something like if instance.pk is None | 2 | 31 | 0 | I am using Django's pre_save signal to implement auto_now_add. There is a lot of discussion on the internet on why you should or shouldn't implement it yourself. I do not appreciate comments on this. Neither on whether I should be rewriting the save function (I have a lot of models that use auto_now_add so using signals makes sense).
My question is:
I would like to check if the instance is created or updated. According to some sources on the internet this can be done by testing if kwargs['created'] is True. However 'created' does not appear in my kwargs even though the instance is newly created.
I was just wondering if it has ever existed or that it has disappeared magically.
I know I could also test if kwargs['instance'].id is set (this in fact works for me), but I'd like to know if kwargs['created'] still exists. | Django pre_save signal: check if instance is created not updated, does kwargs['created'] (still) exist? | 1 | 0 | 0 | 21,951 |
3,608,409 | 2010-08-31T11:12:00.000 | 0 | 0 | 1 | 0 | javascript,python,ide | 3,608,498 | 7 | false | 0 | 0 | It's not quite IDE, but on MacOSX i'm using TextMate, it have many extensions which makes it very powerful. | 4 | 6 | 0 | I am using python for web programming and javascript heavily. Currently, i am using NetBeans
but i am looking for another IDE. NetBeans is not very good while programming with python and javascript. Any suggestion? | IDE Suggestion for python and javascript | 0 | 0 | 1 | 6,379 |
3,608,409 | 2010-08-31T11:12:00.000 | 1 | 0 | 1 | 0 | javascript,python,ide | 3,608,554 | 7 | false | 0 | 0 | PyCharm (and other IDEs on IDEA platform) is brilliant IDE for python, js, xml, css and other languages in webdev stack. | 4 | 6 | 0 | I am using python for web programming and javascript heavily. Currently, i am using NetBeans
but i am looking for another IDE. NetBeans is not very good while programming with python and javascript. Any suggestion? | IDE Suggestion for python and javascript | 0.028564 | 0 | 1 | 6,379 |
3,608,409 | 2010-08-31T11:12:00.000 | 1 | 0 | 1 | 0 | javascript,python,ide | 3,608,748 | 7 | false | 0 | 0 | I use Eclipse with Pydev (Python) and Aptana (Javascript) plugins | 4 | 6 | 0 | I am using python for web programming and javascript heavily. Currently, i am using NetBeans
but i am looking for another IDE. NetBeans is not very good while programming with python and javascript. Any suggestion? | IDE Suggestion for python and javascript | 0.028564 | 0 | 1 | 6,379 |
3,608,409 | 2010-08-31T11:12:00.000 | 0 | 0 | 1 | 0 | javascript,python,ide | 28,404,847 | 7 | false | 0 | 0 | For web programming I used Espresso, it only work on Mac but it is quite good,this one is an IDE.
I don't think the rest classify as an IDE.
For python I use sublimetext2 because it can be customize and has a great GUI feel.
I used to use notepad++ don't really suggest it.
I think if you are asking for efficiency use vim. | 4 | 6 | 0 | I am using python for web programming and javascript heavily. Currently, i am using NetBeans
but i am looking for another IDE. NetBeans is not very good while programming with python and javascript. Any suggestion? | IDE Suggestion for python and javascript | 0 | 0 | 1 | 6,379 |
3,609,952 | 2010-08-31T14:25:00.000 | 6 | 1 | 1 | 0 | python,ubuntu,curl,pycurl | 3,609,988 | 2 | true | 0 | 0 | curl is a module which uses pycurl. It provides the curl.Curl class which provides a high-level interface to the pycurl functions.
I haven't found much documentation on how to use it, but reading /usr/share/pyshared/curl/__init__.py may make it pretty self-obvious.
There are also some examples in /usr/share/doc/python-pycurl/examples which use curl.Curl. | 1 | 5 | 0 | Newbie question: Python 2.6, Ubuntu 10.04, I can import both pycurl and curl, the former having different names for functions (set_option vs. setopt).
What's the difference between the two modules? | What's the difference between pycurl and curl in python | 1.2 | 0 | 0 | 1,716 |
3,610,071 | 2010-08-31T14:39:00.000 | 2 | 0 | 1 | 0 | python,naming,case,convention,pep | 3,610,856 | 3 | false | 0 | 0 | It's best to match whatever your organization uses or is comfortable with. Preaching "the One True Python style" doesn't exactly build harmony if everyone else already uses some other uniform manner. If it's some random hodgepodge of styles, then go ahead and advocate for some unification. | 2 | 1 | 0 | Are Java style camelCase names good practice in Python. I know Capilized names should be reserved by convention for Class names. Methods should be small letters according to good style, or actually I am not so sure. Is there PEP about naming?
COMMENTS:
Sorry for camels :) , I learned from answer PEP8, that my title is actually properly called mixedCase (Capitalized version is the CamelCase) After reading the PEP, I know that normal small case function naming with underscores should be used for methods also. | doesPythonLikeCamels | 0.132549 | 0 | 0 | 236 |
3,610,071 | 2010-08-31T14:39:00.000 | 1 | 0 | 1 | 0 | python,naming,case,convention,pep | 3,610,128 | 3 | false | 0 | 0 | Yes there's a PEP on code style, PEP 8.
Check "Naming Conventions" | 2 | 1 | 0 | Are Java style camelCase names good practice in Python. I know Capilized names should be reserved by convention for Class names. Methods should be small letters according to good style, or actually I am not so sure. Is there PEP about naming?
COMMENTS:
Sorry for camels :) , I learned from answer PEP8, that my title is actually properly called mixedCase (Capitalized version is the CamelCase) After reading the PEP, I know that normal small case function naming with underscores should be used for methods also. | doesPythonLikeCamels | 0.066568 | 0 | 0 | 236 |
3,610,272 | 2010-08-31T14:59:00.000 | 3 | 0 | 1 | 1 | python,eclipse,pydev | 14,501,729 | 4 | false | 1 | 0 | I've found that closing the project and reopening (after rescanning the interpreter) works for me. | 4 | 28 | 0 | I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py install and it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it.
Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing?
thanks | pydev doesn't find python library after installation | 0.148885 | 0 | 0 | 12,392 |
3,610,272 | 2010-08-31T14:59:00.000 | 37 | 0 | 1 | 1 | python,eclipse,pydev | 3,610,311 | 4 | true | 1 | 0 | Pydev doesn't automatically rescan the site-packages folder. You need to go to Preferences-> Interpreter -> Python and click apply to make it scan again. | 4 | 28 | 0 | I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py install and it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it.
Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing?
thanks | pydev doesn't find python library after installation | 1.2 | 0 | 0 | 12,392 |
3,610,272 | 2010-08-31T14:59:00.000 | 0 | 0 | 1 | 1 | python,eclipse,pydev | 43,832,437 | 4 | false | 1 | 0 | Well, I followed this sequence to make it work:
1) I installed the desired library by using pip install
2) I went in Eclipse to: Window --> Preferences --> Pydev --> Interpreters --> Python Interpreter, and clicked "Quick Auto-Config". It made the trick. | 4 | 28 | 0 | I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py install and it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it.
Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing?
thanks | pydev doesn't find python library after installation | 0 | 0 | 0 | 12,392 |
3,610,272 | 2010-08-31T14:59:00.000 | 14 | 0 | 1 | 1 | python,eclipse,pydev | 6,144,832 | 4 | false | 1 | 0 | I also faced the same error when i had installed a new package.i'm using eclipse Helios.
Even after applying and re scanning the folder it was NOT detecting the new packages. So finally i clicked on the "Click here to configure a interpreter not listed" listed and deleted the already selected interpreter and used the autoconfig to add the interpreter again.
Finally i was able to resolve the issue. | 4 | 28 | 0 | I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py install and it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it.
Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing?
thanks | pydev doesn't find python library after installation | 1 | 0 | 0 | 12,392 |
3,610,854 | 2010-08-31T15:59:00.000 | 7 | 0 | 0 | 1 | python,json,google-app-engine | 3,610,930 | 1 | true | 1 | 0 | JSON is just text, so yes, you can store it in memcache. | 1 | 2 | 0 | I think my question is already clear enough, but to make it even more clear i will illustrate it with my example.
I'm currently returning many json every request, which I would like to cache in some way. I thought memcache would be great, but I only see that they use memcache for caching queries. | Is it possible to memcache a json result in App Engine? | 1.2 | 0 | 0 | 717 |
3,611,830 | 2010-08-31T17:59:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,memcached,python-memcached | 3,611,908 | 3 | false | 1 | 0 | as in comments above, I guess I could stick all data in a single memcache entry with a known key.
Still for non-static data there are scenarios where it would be useful. | 2 | 4 | 0 | I want to use all the data in my python app engine memcache. I do not know the keys in advance.
How do I go about getting all data? | how do I return all memcached values in Google App Engine? | 0 | 0 | 0 | 3,350 |
3,611,830 | 2010-08-31T17:59:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,memcached,python-memcached | 4,524,611 | 3 | false | 1 | 0 | I am using a 'well known key' called "config" where I store a list of all other keys and use that to enumerate the rest of the items. | 2 | 4 | 0 | I want to use all the data in my python app engine memcache. I do not know the keys in advance.
How do I go about getting all data? | how do I return all memcached values in Google App Engine? | 0.066568 | 0 | 0 | 3,350 |
3,612,410 | 2010-08-31T19:18:00.000 | 2 | 0 | 0 | 0 | python,python-3.x,gpu | 10,986,086 | 2 | false | 0 | 1 | Clyther is a Python package for High-Performance Computing (HPC) using, for example, video cards with multiple Graphics Packaging Units (GPUs) or (less frequently) multi-core processors. Clyther is for parallel processing of algorithms or data sets that would normally take a lot of time to process serially. Meaning, if you have a problem that can be split into many smaller problems, then Clyther is a useful package to use. Additionally, your problem must be something that can use numpy arrays.
Clyther is a nice package to use if you have the problem it is intended to solve. It makes it fairly easy to write Python code to run on multiple processes.
If that's not the problem you need to solve, then Clyther probably won't help you. | 2 | 2 | 0 | I don't get what Clyther is or how to use it.
My stuff:
ATI OpenCl SDK (just dl'd)
clyther beta (just dl'd)
windows 7 pro 64 bit
active python 3.1.2
Xfxs Ati radeon 5850 video card
I downloaded the ATI OpenCl SDK and the clyther beta from sourceforge. Then I tooke the sample 'reduce' function from the sourceforge documents and pasted the code into notepad and named it clythersample.py. When I double-click the file or open it in the interactiveshell, it gives an error message on the first line.
Is naming the file .py wrong? I guess clyther is its own lqnguage and not really python? Can I write python code and in the middle of the program, write a chunk of clyther code? Will python IDEs (esp. Wing understand and debug it?) Will it work with python 3 or do I need 2.6? Is 64 bit os ok?
(I'm not a programme or technically competent, so things like its a python API for OpenCl or it had C bindings for python don't mean a whole lot). | Clyther-how to get started? | 0.197375 | 0 | 0 | 507 |
3,612,410 | 2010-08-31T19:18:00.000 | 1 | 0 | 0 | 0 | python,python-3.x,gpu | 3,612,526 | 2 | false | 0 | 1 | When you name the file .py (the file extension associated with python.exe) and double-click it, how is windows supposed to know it's supposed to run the file with CLyther?
Is naming the file .py wrong? I guess clyther is its own lqnguage and not really python?
Documentation compares it with Cython - so I suppose it's an extension to the language, i.e. they take Python and bolt more features on it.
Can I write python code and in the middle of the program, write a chunk of clyther code?
From the goals of the project, it should (like Cython) ultimately be able to accept all or most Python code. So, yes - but of course you'd have to run the whole program with CLyther.
Will python IDEs (esp. Wing understand and debug it?)
Not natively, I suppose.
Side note: The project is in a very early stage of developement (very first beta-release), so don't expect things to run smoothly right now. | 2 | 2 | 0 | I don't get what Clyther is or how to use it.
My stuff:
ATI OpenCl SDK (just dl'd)
clyther beta (just dl'd)
windows 7 pro 64 bit
active python 3.1.2
Xfxs Ati radeon 5850 video card
I downloaded the ATI OpenCl SDK and the clyther beta from sourceforge. Then I tooke the sample 'reduce' function from the sourceforge documents and pasted the code into notepad and named it clythersample.py. When I double-click the file or open it in the interactiveshell, it gives an error message on the first line.
Is naming the file .py wrong? I guess clyther is its own lqnguage and not really python? Can I write python code and in the middle of the program, write a chunk of clyther code? Will python IDEs (esp. Wing understand and debug it?) Will it work with python 3 or do I need 2.6? Is 64 bit os ok?
(I'm not a programme or technically competent, so things like its a python API for OpenCl or it had C bindings for python don't mean a whole lot). | Clyther-how to get started? | 0.099668 | 0 | 0 | 507 |
3,614,609 | 2010-09-01T02:17:00.000 | 0 | 0 | 1 | 0 | python,macos,tkinter | 3,614,650 | 2 | false | 0 | 1 | If I'm not greatly mistaken, it should pass the name of the file as the first argument to the script - sys.argv[1]. | 1 | 0 | 0 | I have a python script bundled into a application (I'm on a mac) and have the application set to be able to open .zip files. But when I say "open foo.zip with bar.py" how do I access the file that I have passed to it?
Additional info:
Using tkinter.
What's a good way to debug this, as there is no terminal to pass info to? | Python: open a file *with* script? | 0 | 0 | 0 | 310 |
3,615,122 | 2010-09-01T04:54:00.000 | 3 | 1 | 1 | 0 | javascript,jquery,python,c,syntax | 3,618,018 | 3 | false | 0 | 0 | For jQuery, the answer is pretty simple: jQuery isn't a language, therefore it doesn't have syntax.
For Python and C, the answer from a high-level point of view is also very simple: Python's syntax is directly inspired by C's syntax. (Or more precisely, both Python's and C's syntax are inspired by ALGOL's syntax.) There is really only one significant difference from a high-level point of view: C uses opening and closing curly braces to delimit blocks, Python uses indentation.
Otherwise, the two high-level syntaxes are almost the same: both have unary and binary operators, even with similar precedence (unline Smalltalk, for example, which doesn't have operators), both distinguish between statements and expressions (unlike Ruby, for example, which doesn't have statements), both use semicolons between statements (although technically, the semicolon is a statement terminator in C and a statement separator in Python), both use similar syntax for numeric literals and string literals as well as array/list indexing.
There are a couple of syntactic differences related to the different semantics: in Python, variables are untyped (only objects are typed), so there is no type annotation syntax for variable declarations (in fact, there is no syntax for variable declarations at all). There is syntax for type annotations of function parameters and function return values, but in Python the types come after the parameter name, and the type annotations are optional. With variables being untyped, the concept of type casting doesn't make sense, so there is no syntax for that. Neither is there any pointer-related syntax, since Python doesn't have those.
Python has a couple more literals than C: lists, sets, dictionaries, in particular. However, they follow in the C tradition: in C, an array is declared and indexed using square brackets, so Python uses square brackets for array literals. | 3 | 4 | 0 | I'm trying to get a sense of the similarities between languages in syntax. How similar are Python, jQuery and C? I started programming in Actionscript 3 and then moved on to Javascript , then went on and learned Prototype, and then I started using jQuery and found that the syntax is very different. So is jQuery more like C and Python? | How similar are Python, jQuery, C syntax wise? | 0.197375 | 0 | 0 | 2,839 |
3,615,122 | 2010-09-01T04:54:00.000 | 3 | 1 | 1 | 0 | javascript,jquery,python,c,syntax | 3,615,135 | 3 | false | 0 | 0 | Syntax wise, JavaScript (the language jQuery is implemented in) is similar to C. Python uses a different syntax which does not rely on semicolons and braces, but instead on indentation.
Semantically, JavaScript is closer to Python, so this would be easier to learn. I don't understand how you "moved" from ActionScript 3 to JavaScript to Prototype; ActionScript has the same syntax and is also otherwise very similar to JavaScript, and Protoype/jQuery are just applications written in JavaScript (so it's the same language, but different frameworks!) | 3 | 4 | 0 | I'm trying to get a sense of the similarities between languages in syntax. How similar are Python, jQuery and C? I started programming in Actionscript 3 and then moved on to Javascript , then went on and learned Prototype, and then I started using jQuery and found that the syntax is very different. So is jQuery more like C and Python? | How similar are Python, jQuery, C syntax wise? | 0.197375 | 0 | 0 | 2,839 |
3,615,122 | 2010-09-01T04:54:00.000 | 8 | 1 | 1 | 0 | javascript,jquery,python,c,syntax | 3,615,482 | 3 | true | 0 | 0 | C is much different from the languages you've asked about. Remember that C isn't an interpreted language and will not be treated as such in your code. In short, you're up for a lot more material to learn --while dealing with C-- in terms of things like memory management and semantics than the other languages.
In regards to syntax: You'll find that if you're writing code in any language other than Lisp, brainfuck, or some other non-intuitive language (not claiming that C is, but in comparison, certainly), the syntax isn't too much of a variable. There are some differences, but nothing that should be considered too abstract. In C, you have to worry about things like pointers and whatnot which is a pain, but I think the difference is more-so about memory management than syntax. You mostly have to worry about the differences in usages of semicolons and whatnot.
You'll find that Python is like writing English sentences, or at least writing pseudocode with constraints, which makes it significantly easier than C. Additionally, I wouldn't consider jQuery a language on its own. It's an extension of a language though, just as STL might be considered a particular type of extension to C++.
Good luck. | 3 | 4 | 0 | I'm trying to get a sense of the similarities between languages in syntax. How similar are Python, jQuery and C? I started programming in Actionscript 3 and then moved on to Javascript , then went on and learned Prototype, and then I started using jQuery and found that the syntax is very different. So is jQuery more like C and Python? | How similar are Python, jQuery, C syntax wise? | 1.2 | 0 | 0 | 2,839 |
3,615,561 | 2010-09-01T06:37:00.000 | 4 | 1 | 0 | 0 | python,imap,imaplib | 3,636,059 | 2 | true | 0 | 0 | Yes of course the UID is changed when you do move operation.
the new UID for that mail will be the next UID from the destination folder.
(i.e if the last mail UID of the destination folder is : 9332 ,
then the UID of the move email will be 9333)
Note: UID is changed but the Message-Id will not be changed during any operation on that mail) | 1 | 0 | 0 | I try to move email from mailbox's gmail to another one, Just curious that UID of each email will change when move to new mailbox ? | About IMAP UID with imaplib | 1.2 | 0 | 1 | 5,836 |
3,616,078 | 2010-09-01T08:04:00.000 | 0 | 0 | 0 | 0 | database,ironpython | 3,616,111 | 2 | false | 1 | 0 | good
That is highly subjective without far more detailed requirements.
You should be able to use any database with .NET support, whether out of the box (notably SQL Server Express and Compact) or installed separately (SQL Server-other editions, DB2, MySQL, Oracle, ...).
Ten select commands per second should be easily in each of any of the databases above, unless there is some performance issue (e.g. huge amount of data and not able to use an index). | 1 | 0 | 0 | i'm using IronPython 2.6 for .Net4 to build an GUI logging application.
This application received data via serialport and stores these data in an sqlite3 database while showing the last 100 received items in an listview. The listview gathers it's data via an SQL SELECT from the database every 100ms. It only querys data that is not already visible in the listview.
At first, the useage of the sqlite3 module was good and solid but i'm now stuck with several issues that i can't solve.
The sqlite3 module throws after a while exceptions like:
database disk image is malformed
database or disk is full.
These errors occur sporadic and never under high system load.
I stuck with this kind if issues for some weeks now and i'm looking for an alternative way to store binary and ascii data in a database-like object.
Please, does somebody know a good database solution i could use with IronPython 2.6 for .Net4?
Thanks | IronPython - What kind of database is useable | 0 | 1 | 0 | 495 |
3,616,822 | 2010-09-01T09:54:00.000 | 0 | 0 | 1 | 0 | python,hierarchy,tuples | 3,616,913 | 3 | false | 0 | 0 | Remove parent field. You can still implement any tree-manipulation operations efficient without keeping reference to parent node. | 3 | 0 | 0 | I am trying to represent a hierarchy using namedtuple. Essentially, every node has three attributes relevant to the hierarchy: parent, leftChild and rightChild (they also have some attributes that carry the actual information, but that is not important for the question). The problem is the circular reference between parents and children. Since I need to specify all values at construction time, I run into problems because parents need the children to be constructed first, and children need the parents to be constructed first. Is there any way around this (other than using a custom class instead of tuples)? | Representing an immutable hierarchy using tuples | 0 | 0 | 0 | 157 |
3,616,822 | 2010-09-01T09:54:00.000 | 2 | 0 | 1 | 0 | python,hierarchy,tuples | 3,616,851 | 3 | true | 0 | 0 | No, there is not. | 3 | 0 | 0 | I am trying to represent a hierarchy using namedtuple. Essentially, every node has three attributes relevant to the hierarchy: parent, leftChild and rightChild (they also have some attributes that carry the actual information, but that is not important for the question). The problem is the circular reference between parents and children. Since I need to specify all values at construction time, I run into problems because parents need the children to be constructed first, and children need the parents to be constructed first. Is there any way around this (other than using a custom class instead of tuples)? | Representing an immutable hierarchy using tuples | 1.2 | 0 | 0 | 157 |
3,616,822 | 2010-09-01T09:54:00.000 | 0 | 0 | 1 | 0 | python,hierarchy,tuples | 3,617,608 | 3 | false | 0 | 0 | One trick is not to use an object reference, but instead, a symbolic ID that you maintain in a hash table. | 3 | 0 | 0 | I am trying to represent a hierarchy using namedtuple. Essentially, every node has three attributes relevant to the hierarchy: parent, leftChild and rightChild (they also have some attributes that carry the actual information, but that is not important for the question). The problem is the circular reference between parents and children. Since I need to specify all values at construction time, I run into problems because parents need the children to be constructed first, and children need the parents to be constructed first. Is there any way around this (other than using a custom class instead of tuples)? | Representing an immutable hierarchy using tuples | 0 | 0 | 0 | 157 |
3,617,052 | 2010-09-01T10:23:00.000 | 0 | 0 | 0 | 0 | python,mysql,escaping | 61,042,304 | 7 | false | 0 | 0 | One other way to work around this is using something like this when using mysqlclient in python.
suppose the data you want to enter is like this <ol><li><strong style="background-color: rgb(255, 255, 0);">Saurav\'s List</strong></li></ol>. It contains both double qoute and single quote.
You can use the following method to escape the quotes:
statement = """ Update chats set html='{}' """.format(html_string.replace("'","\\\'"))
Note: three \ characters are needed to escape the single quote which is there in unformatted python string. | 1 | 77 | 0 | I use Python and MySQLdb to download web pages and store them into database. The problem I have is that I can't save complicated strings in the database because they are not properly escaped.
Is there a function in Python that I can use to escape a string for MySQL? I tried with ''' (triple simple quotes) and """, but it didn't work. I know that PHP has mysql_escape_string(), is something similar in Python?
Thanks. | Escape string Python for MySQL | 0 | 1 | 0 | 144,313 |
3,619,063 | 2010-09-01T14:22:00.000 | 5 | 1 | 0 | 0 | php,python,accelerator | 3,619,178 | 4 | false | 0 | 0 | As long as you do trivial amounts of work in your "main script" (the one you directly invoke with python and which gets a __name__ of __main__) you need not worry about "caching the pre-compiled python bytecode": when you import foo, foo.py gets saved to disk (same directory) as foo.pyc, as long as that directory is writable by you, so the already-cheap compilation to bytecode happens once and "forever after" Python will load foo.pyc directly in every new process that does import foo -- within a single process, every import foo except the first one is just a fast lookup into a dictionary in memory (the sys.module dictionary). A core performance idea in Python: makes sure every bit of substantial code happens within def statements in modules -- don't have any at module top level, in the main script, or esp. within exec and eval statements/expressions!-).
I have no benchmarks for PHP vs Python, but I've noticed that Python keeps getting optimized pretty noticeably with every new release, so make sure you compare a recent release (idealy 2.7, at least 2.6) if you want to see "the fastes Python". If you don't find it fast enough yet, cython (a Python dialect designed to compile directly into C, and thence into machine code, with some limitations) is today the simplest way to selectively optimize those modules which profiling shows you need it. | 3 | 4 | 0 | I'm planning to use Python to develop a web application. Anybody has any idea about any accelerator for python? (something like eAccelerator or apc for php) if not, is there any way to cache the pre-compiled python bytecode ?
Any idea about the performance comparison between python and php (assuming db/network latencies are same)
Thanks in advance. | Python accelerator | 0.244919 | 0 | 0 | 1,571 |
3,619,063 | 2010-09-01T14:22:00.000 | 3 | 1 | 0 | 0 | php,python,accelerator | 3,622,927 | 4 | true | 0 | 0 | Others have mentioned Python byte code files, but that is largely irrelevant. This is because hosting mechanisms for Python, with the exception of CGI, keep the Python web Application in memory between requests. This is different to PHP which effectively throws away the application between requests. As such, Python doesn't need an accelerator as the way Python web hosting mechanisms work avoids the problems that PHP has. | 3 | 4 | 0 | I'm planning to use Python to develop a web application. Anybody has any idea about any accelerator for python? (something like eAccelerator or apc for php) if not, is there any way to cache the pre-compiled python bytecode ?
Any idea about the performance comparison between python and php (assuming db/network latencies are same)
Thanks in advance. | Python accelerator | 1.2 | 0 | 0 | 1,571 |
3,619,063 | 2010-09-01T14:22:00.000 | 8 | 1 | 0 | 0 | php,python,accelerator | 3,619,244 | 4 | false | 0 | 0 | There's a trick to this.
It's called mod_wsgi.
The essence of it works like this.
For "static" content (.css, .js, images, etc.) put them in a directory so they're served by Apache, without your Python program knowing they were sent.
For "dynamic" content (the main HTML page itself) you use mod_wsgi to fork a "back-end" process that runs outside of Apache.
This is faster than PHP because now several things are going on at once. Apache has dispatched the request to a backend process and then moved on to handle the next request while the backend is still running the first one.
Also, when you've sent your HTML page, the follow-on requests are handled by Apache without your Python program knowing or caring what's going on. This leads to huge speedups. Nothing to do with the speed of Python. Everything to do with the overall architecture. | 3 | 4 | 0 | I'm planning to use Python to develop a web application. Anybody has any idea about any accelerator for python? (something like eAccelerator or apc for php) if not, is there any way to cache the pre-compiled python bytecode ?
Any idea about the performance comparison between python and php (assuming db/network latencies are same)
Thanks in advance. | Python accelerator | 1 | 0 | 0 | 1,571 |
3,619,990 | 2010-09-01T16:04:00.000 | 2 | 0 | 1 | 0 | python,c,installation | 3,620,269 | 2 | true | 0 | 0 | You can avoid having some one to install it independently but you can not avoid installation completely. If his computing platform differs from yours, he will have to build the extension.
What can be done is that you setup a package distribution using distutils. This way the package could be installed or built. You can include the "C" extension in your package.
For some standard platform, you can then provide binary package distribution. The user should have the ability to rebuild, if the binary package is not working out for him. | 2 | 4 | 0 | I wrote a Python extension in C, and my python program uses that extension. In order for it to work, I would have to install the extension on the user's system before my program can run. Is there a way to bypass that installation step and somehow just have the extension in my python package? The only compiled part obviously is the extension (since it's in C). | Is there a way to package a python extension written in C into a binary so I don't have to python-install it? | 1.2 | 0 | 0 | 112 |
3,619,990 | 2010-09-01T16:04:00.000 | 1 | 0 | 1 | 0 | python,c,installation | 3,621,206 | 2 | false | 0 | 0 | just put the .d compiled python dll in the same directory as your python script. then you'll be able to import it. | 2 | 4 | 0 | I wrote a Python extension in C, and my python program uses that extension. In order for it to work, I would have to install the extension on the user's system before my program can run. Is there a way to bypass that installation step and somehow just have the extension in my python package? The only compiled part obviously is the extension (since it's in C). | Is there a way to package a python extension written in C into a binary so I don't have to python-install it? | 0.099668 | 0 | 0 | 112 |
3,621,111 | 2010-09-01T18:38:00.000 | 0 | 0 | 0 | 0 | python,tkinter,abort | 3,621,138 | 3 | false | 0 | 1 | Why not use threads and stop that? I don't think it's possible to intercept a function call in a single threaded program (if not with some kind of signal or interrupt).
Also, with your specific issue, you might want to introduce a flag and check that in the command. | 2 | 1 | 0 | I have a widget that measures elapsed time, then after a certain duration it does a command. However, if the widget is left I want I want it to abort this function call and not do the command.
How do I go about this? | Is there a way to write a command so that it aborts a running function call? | 0 | 0 | 0 | 88 |
3,621,111 | 2010-09-01T18:38:00.000 | 0 | 0 | 0 | 0 | python,tkinter,abort | 3,621,195 | 3 | false | 0 | 1 | No idea about python threads, but in general the way you interrupt a thread is by having some sort of a threadsafe state object that you can set from the widget, and the logic in thread code to check for the change in state object value and break out of the thread loop. | 2 | 1 | 0 | I have a widget that measures elapsed time, then after a certain duration it does a command. However, if the widget is left I want I want it to abort this function call and not do the command.
How do I go about this? | Is there a way to write a command so that it aborts a running function call? | 0 | 0 | 0 | 88 |
3,621,297 | 2010-09-01T19:07:00.000 | 0 | 1 | 1 | 0 | java,python,static-typing,dynamic-typing | 3,621,365 | 7 | false | 0 | 0 | It's a load off your mind. You can think the color red as "Red" (a constant) as "255, 0, 0" (a tuple) or "#FF0000" (a string): three different formats, that would require three different types, or complex lookup and conversion methods in Java.
It makes code simpler. | 6 | 11 | 0 | I am from Java world and I wonder what is so great about dynamic typing in Python besides missing errors while compiling the code?
Do you like Python's typing? Do you have an example where it helped in a big project? Isn't it a bit error prone? | How to deal with Python ~ static typing? | 0 | 0 | 0 | 2,330 |
3,621,297 | 2010-09-01T19:07:00.000 | 0 | 1 | 1 | 0 | java,python,static-typing,dynamic-typing | 3,621,395 | 7 | false | 0 | 0 | For example, you can write functions
to which you can pass an integer as
well as a string or a list or a
dictionary or whatever else, and it
will be able to transparently handle
all of them in appropriate ways (or
throw an exception if it cannot handle
the type). You can do things like that
in other languages, too, but usually
you have to resort to (ab)use things
like pointers, references or
typecasts, which opens holes for
programming errors, and it's just
plain ugly. | 6 | 11 | 0 | I am from Java world and I wonder what is so great about dynamic typing in Python besides missing errors while compiling the code?
Do you like Python's typing? Do you have an example where it helped in a big project? Isn't it a bit error prone? | How to deal with Python ~ static typing? | 0 | 0 | 0 | 2,330 |
3,621,297 | 2010-09-01T19:07:00.000 | 5 | 1 | 1 | 0 | java,python,static-typing,dynamic-typing | 3,621,720 | 7 | false | 0 | 0 | Do you like it in Python?
It's part of Python. Liking it in Python is silly.
Do you have an example where it helped in a big project?
Yes. Every single day I rejoice that I can make changes and -- because of Duck typing -- they are reasonably localized, pass all the unit tests, pass all the integration tests, and nothing is disrupted elsewhere.
If this was Java, the changes would require endless refactoring to pull interfaces out of classes so that I could introduce variations that were still permitted under Java's static type checking.
Doesn't it a bit error prone?
Not any more than static typing is. A simple unit test confirms that the objects conform to the expected features.
It's easy to write a class in Java that (a) passes compile-time checks and (b) crashes horribly at run time. Casts are a good way to do this. Failing to meet the classes intent is a common thing -- a class may compile but still not work. | 6 | 11 | 0 | I am from Java world and I wonder what is so great about dynamic typing in Python besides missing errors while compiling the code?
Do you like Python's typing? Do you have an example where it helped in a big project? Isn't it a bit error prone? | How to deal with Python ~ static typing? | 0.141893 | 0 | 0 | 2,330 |
3,621,297 | 2010-09-01T19:07:00.000 | 2 | 1 | 1 | 0 | java,python,static-typing,dynamic-typing | 3,621,952 | 7 | false | 0 | 0 | A lot of patterns (e.g. from GoF) are unnecessary or can be implemented with less efforts in dynamic-typed languages with functional flavor. In fact, a lot of patterns are "built-in" into python so if you write short and 'pythonic' code you will get all the benefits for free. You don't need Iterator, Observer, Strategy, Factory Method, Abstract Factory, and a bunch of other patterns that are common in Java or C++.
This means less code to write and (much more important) less code to read, understand and support. I think this is the main benefit of languages like python. And in my opinion this greatly outweighs the absence of static typing. Type-related errors are not often in python code and they are easy to catch with simple functional tests (and such tests are easier to write in python than in java for sure). | 6 | 11 | 0 | I am from Java world and I wonder what is so great about dynamic typing in Python besides missing errors while compiling the code?
Do you like Python's typing? Do you have an example where it helped in a big project? Isn't it a bit error prone? | How to deal with Python ~ static typing? | 0.057081 | 0 | 0 | 2,330 |
3,621,297 | 2010-09-01T19:07:00.000 | 13 | 1 | 1 | 0 | java,python,static-typing,dynamic-typing | 3,621,904 | 7 | false | 0 | 0 | I suspect that the vast majority of non-trivial Java programs have dynamic typing in them.
Every time in Java that you do a cast from Object to an explicit type you are doing dynamic type checking - this includes every use of a collection class before generics were introduced in 1.5. Actually Java generics can still defer some type checking until runtime.
Every time you use Java reflection you are doing dynamic type checking. This includes mapping from a class or method name in an text file to a real class or method - e.g. every time you use a Spring XML configuration file.
Does this make Java programs fragile and error prone? Do Java programmers spend a significant part of their time having to track down and fix problems with incorrect dynamic typing? Probably not - and neither do Python programmers.
Some of the advantages of dynamic typing:
Greatly reduced reliance on inheritance. I have seen Java programs with massive inheritance trees. Python programs often use little or no inheritance, preferring to use duck typing.
It is easy to write truly generic code. For example the min() and max() functions can take a sequence of any comparable type - integers, strings, floats, classes that have the appropriate comparison methods, lists, tuples etc.
Less code. A huge proportion of Java code contributes nothing to solving the problem at hand - it is purely there to keep the type system happy. If a Python program is a fifth the size of the equivalent Java program then there is one fifth the code to write, maintain, read and understand. To put it another way, Python has a much higher signal to noise ratio.
Faster development cycle. This goes hand in hand with less code - you spend less time thinking about types and classes and more time thinking about solving the problem you are working on.
Little need for AOP. I think there are aspect oriented libraries for Python but I don't know of anyone that uses them, since for 99% of what you need AOP for you can do with decorators and dynamic object modification. The wide use of AspectJ in the Java world suggests to me that there are deficiencies in the core Java language that have to be compensated for with an external tool. | 6 | 11 | 0 | I am from Java world and I wonder what is so great about dynamic typing in Python besides missing errors while compiling the code?
Do you like Python's typing? Do you have an example where it helped in a big project? Isn't it a bit error prone? | How to deal with Python ~ static typing? | 1 | 0 | 0 | 2,330 |
3,621,297 | 2010-09-01T19:07:00.000 | 0 | 1 | 1 | 0 | java,python,static-typing,dynamic-typing | 3,621,429 | 7 | false | 0 | 0 | As you're from the Java world, the obvious answer would be that it's great not to be forced to write all that stuff you are forced to write, just to keep Java's type system happy.
Of course, there are other statically type checked languages that don't force you to write all that stuff that Java forces you to write.
Even C# does type inference for local method variables!
And there are other statically type checked languages that provide more compile time error checking than Java provides.
(The less obvious answers for - what is so great about dynamic typing in Python? - probably require more understanding of Python to understand.) | 6 | 11 | 0 | I am from Java world and I wonder what is so great about dynamic typing in Python besides missing errors while compiling the code?
Do you like Python's typing? Do you have an example where it helped in a big project? Isn't it a bit error prone? | How to deal with Python ~ static typing? | 0 | 0 | 0 | 2,330 |
3,621,463 | 2010-09-01T19:28:00.000 | 4 | 1 | 0 | 0 | python,mercurial,hook,mercurial-hook | 3,621,563 | 3 | false | 0 | 0 | You're right that you want a pretxnchangegroup hook, but you don't want to check all the new revisions -- because people will fix the errors you reject in subsequent changesets but if you're checking all changesets their work will never be accepted!
Instead either just check all files in all the heads, or use the hg status --rev x:y syntax to get a list of the changed files between the revision you already have and the tip revision you're receiving, and check only those files only in the tip revision.
If you really want the list of all revisions you'd use a revset ( hg help revsets ) new in version 1.6, but you really only want to check the results, not all the revisions that get you there. | 1 | 3 | 0 | I want a mercurial hook that will run JSLint/PyChecker/etc on all files that are modified. However, I do not have control over all hg clients, and want this to run on push to the master repository (which I have control), so a pretxnchangegroup hook on the master seems best.
How can I get a list of all changesets that are in the changegroup that is going to be committed?
I have seem other solutions that use a precommit hook, but these will not work for me because the clients may already have a commit that fails JSLint. In this case, they should be able to fix the errors in a new commit, and be able to push (both the bad and new commits) to the server successfully. The server just needs to check the most recent changeset on each branch, of every file that was modified in the changegroup. | Get list of changesets in a changegroup (mercurial python hook) | 0.26052 | 0 | 0 | 2,726 |
3,622,165 | 2010-09-01T21:07:00.000 | 4 | 0 | 0 | 1 | python,google-app-engine,version-control | 3,625,552 | 1 | true | 1 | 0 | No, there's no way to get a list of app versions from inside an app. | 1 | 1 | 0 | the title speaks for itself. I play with GAE and some of my apps have versions like (1,2,3,4 and dev). So, is there a way to get all of them, so I could use it in my app to generate links to different versions ? | Is it possible to get a list of all versions of an app? | 1.2 | 0 | 0 | 91 |
3,623,070 | 2010-09-02T00:36:00.000 | 8 | 0 | 0 | 0 | python,css,django,dynamic,django-templates | 3,623,235 | 1 | true | 1 | 0 | The Django templating system can be used for any text you like. It's used for HTML most of the time, but it could also be used to create CSS. The CSS reference in your HTML can be to a dynamic URL instead of to a static file, and the view function can create whatever context you like, then a .css template file can create your CSS.
If you have only a few different CSS possibilities, then you may be better served by creating them as static files, and using the HTML template to select the CSS file you want by writing a different CSS reference depending you your conditions. | 1 | 6 | 0 | I'm wondering if there is anything like Django's HTML templating system, for for CSS.. my searches on this aren't turning up anything of use. I am aware of things like SASS and CleverCSS but, as far as I can tell, these still don't solve my issue as I want to dynamically generate a CSS file based on certain conditions, so that a different CSS file would be served based on a specific user session...
I want to minimize the use of javascript / AJAX for some things (since its for a legacy system running in some hospital where they're still using IE 6 ), also I have an interest in possibly minimizing javascript for other projects as well... so it would be where there is 1 CSS file, but that it may need to be changed based on the situation (which would be done with CleverCSS), however the problem is that if I just write the changes to 1 file, then this would be served to everyone, even though they may have a different "state" of the CSS file depending on their use of the application, so I want to remove the physical association of a CSS file and rather have it dynamically generated each time (so that its unique to a specific user's session), the way that Django's HTML templating system works.. | CSS Templating system for Django / Python? | 1.2 | 0 | 0 | 995 |
3,623,077 | 2010-09-02T00:38:00.000 | 2 | 0 | 0 | 0 | python,web-applications,firebug,tkinter,urllib2 | 3,623,274 | 1 | false | 1 | 0 | Of course the captcha's served by a page which will serve a new one each time (if it was repeated, then once it was solved for one fake userid, a spammer could automatically make a million!). I think you need some "screenshot" functionality to capture the image you want -- there is no cross-platform way to invoke such functionality, but each platform (or desktop manager in the case of Linux, BSD, etc) tends to have one. Or, you could automate the browser (e.g. via SeleniumRC) to "screenshot" (e.g. "print to PDF") things at the right time. (I believe what you're seeing in firebug may be misleading you because it is "showing a snapshot"... just at the html source or DOM level rather than at a screen/bitmap level). | 1 | 0 | 0 | I am scripting in python for some web automation. I know i can not automate captchas but here is what i want to do:
I want to automate everything i can up to the captcha. When i open the page (usuing urllib2) and parse it to find that it contains a captcha, i want to open the captcha using Tkinter. Now i know that i will have to save the image to my harddrive first, then open it but there is an issue before that. The captcha image that is on screen is not directly in the source anywhere. There is a variable in the source, inside some javascript, that points to another page that has the link to the image, BUT if you load that middle page, the captcha picture for that link changes, so the image associated with that javascript variable is no longer valid. It may be impossible to gather the image using this method, so please enlighten me if you have any ideas on this.
Now if I use firebug to load the page, there is a "GET" that is a direct link to the current Captcha image that i am seeing, and i'm wondering if there is anyway to make python or ullib2 see the "GET"s that are going on when a page is loaded, because if that was possible, this would be simple.
Please let me know if you have any suggestions. | Is there a way to save a captcha image and view it later in python? | 0.379949 | 0 | 1 | 1,432 |
3,624,521 | 2010-09-02T07:10:00.000 | 2 | 1 | 0 | 0 | python,apache | 3,624,825 | 3 | false | 0 | 0 | as everyone else said, that's part of SIPVicious, of which I'm the original author. Your server got compromised (somehow) and is being used to scan and compromise PBX servers open on the internet.
I would like more details about your case. Would be great if you could get in contact - sandro@enablesecurity.com
sandro | 1 | 1 | 0 | i found out that my server is getting slower and slower.
on command top i get response that i have a lot svcrack.py and svwar.py processes active.
can you tell me what are those?
thank you in advance! | svcrack.py and svwar.py | 0.132549 | 0 | 0 | 4,163 |
3,626,766 | 2010-09-02T11:47:00.000 | 2 | 0 | 0 | 1 | python,windows-services | 3,626,820 | 2 | false | 0 | 0 | Add in script wait for the resources who script must use is in good standing, or rewrite script to better design like not exit if dont have connection; wait 1s and try again if connection failed. | 1 | 2 | 0 | I am running a Python script as a Windows service, but it seems to be failing whenever I set it to auto-start. I believe this may be because the service uses network resources that are not yet mounted when the service starts. Is there a way I can get it to wait until startup is complete before running? | Python Windows service autostarts too early | 0.197375 | 0 | 0 | 348 |
3,628,454 | 2010-09-02T15:07:00.000 | 2 | 0 | 0 | 0 | python,html,download,urllib | 3,628,497 | 1 | true | 1 | 0 | If you're getting back a thank you page, the URL to the file is likely to be in there somewhere. Look for <meta http-equiv="refresh"> or JavaScript redirects. Ctrl+F'ing the page for the file name might also help.
Some sites may have extra protection in, so if you can't figure it out, post a link to the site, just in case someone can be bothered to look. | 1 | 1 | 0 | I have a form which when submitted by a user redirects to a thank you page and the file chosen for download begins to download.
How can I save this file using python? I can use python's urllib.urlopen to open the url to post to but the html returned is the thank you page, which I suspected it would be. Is there a solution that allows me to grab the contents of the file being served for download from the website and save that locally?
Thanks in advance for any help. | Python - How do I save a file delivered from html? | 1.2 | 0 | 1 | 383 |
3,628,847 | 2010-09-02T15:54:00.000 | 1 | 1 | 1 | 1 | python,eclipse,wing-ide | 9,213,010 | 2 | false | 0 | 0 | I've added an experimental one in version 4.1.3 | 2 | 1 | 0 | While PyDev turns out to be a great IDE for python, especially if you are a former Java developer accustomed to all the eclipse ubercool navigation, it still lacks some features that Wing has, like GUI for running python unit-tests.
I know Wing has some "personalities" of other editors: vi, emacs, Visual Studio, ...
Unfortunately, Eclipse is not one of them.
Before I start configuring all the keys myself, creating a keymap.eclipse file, etc. (seems like it's gonna take ages), I wanted to know if no one already configured it and can share it with the rest of the world.
Thanks! | Is there an Eclipse personality settings for Wing IDE? | 0.099668 | 0 | 0 | 139 |
3,628,847 | 2010-09-02T15:54:00.000 | 0 | 1 | 1 | 1 | python,eclipse,wing-ide | 3,629,793 | 2 | true | 0 | 0 | Unfortunately, there's no Eclipse personality. | 2 | 1 | 0 | While PyDev turns out to be a great IDE for python, especially if you are a former Java developer accustomed to all the eclipse ubercool navigation, it still lacks some features that Wing has, like GUI for running python unit-tests.
I know Wing has some "personalities" of other editors: vi, emacs, Visual Studio, ...
Unfortunately, Eclipse is not one of them.
Before I start configuring all the keys myself, creating a keymap.eclipse file, etc. (seems like it's gonna take ages), I wanted to know if no one already configured it and can share it with the rest of the world.
Thanks! | Is there an Eclipse personality settings for Wing IDE? | 1.2 | 0 | 0 | 139 |
3,629,088 | 2010-09-02T16:22:00.000 | -1 | 1 | 1 | 0 | python,multithreading,twisted | 3,629,349 | 4 | false | 0 | 0 | A word of caution with twisted, while twisted is very robust I've found that spinning up a hundred threads using the code examples available in documentation is a recipe for race conditions and deadlocks. My suggestion is try twisted but have the stdlib multithreading module waiting in the wings if twisted becomes unmanageable. I have had good success with a producer consumer model using the aforementioned library. | 2 | 6 | 0 | I need to pull from hundreds of pop3 email accounts, and i want to build a robust server to do this.
Would twisted be a good choice for this type of project?
Right now a simple prototype would be to pull from a single pop3 account, then it would pull from many but it would be a serialized process.
I want to create a server that has multiple threads so it can do things at the same time. | Would twisted be a good choice for building a multi-threaded server? | -0.049958 | 0 | 0 | 2,134 |
3,629,088 | 2010-09-02T16:22:00.000 | 0 | 1 | 1 | 0 | python,multithreading,twisted | 3,629,187 | 4 | false | 0 | 0 | It is a good choice for a server but from your description you are acutally looking for a multithreaded POP client.
Twisted is made for reacting to events like incoming requests, you need to send requests, so in this case I fear twisted to be of limited value. | 2 | 6 | 0 | I need to pull from hundreds of pop3 email accounts, and i want to build a robust server to do this.
Would twisted be a good choice for this type of project?
Right now a simple prototype would be to pull from a single pop3 account, then it would pull from many but it would be a serialized process.
I want to create a server that has multiple threads so it can do things at the same time. | Would twisted be a good choice for building a multi-threaded server? | 0 | 0 | 0 | 2,134 |
3,630,664 | 2010-09-02T19:49:00.000 | -2 | 0 | 0 | 0 | python,binding,widget,tkinter,global | 3,630,691 | 4 | false | 0 | 1 | If you have a list that contains all your widgets, you could iterate over them and assign the events. | 2 | 7 | 0 | Is it possible to bind all widgets to one command, with a single line? It would be nice if I could type in one line as opposed to doing each widget individually. | Tkinter Global Binding | -0.099668 | 0 | 0 | 9,705 |
3,630,664 | 2010-09-02T19:49:00.000 | -3 | 0 | 0 | 0 | python,binding,widget,tkinter,global | 3,630,962 | 4 | false | 0 | 1 | You could also just define a function that calls on all your widgets, and call that function. Or better yet create a class that call on your widgets in init and import the class... | 2 | 7 | 0 | Is it possible to bind all widgets to one command, with a single line? It would be nice if I could type in one line as opposed to doing each widget individually. | Tkinter Global Binding | -0.148885 | 0 | 0 | 9,705 |
3,630,774 | 2010-09-02T20:05:00.000 | 78 | 0 | 0 | 0 | python,logging | 3,630,800 | 5 | true | 0 | 0 | logger.handlers contains a list with all handlers of a logger. | 1 | 70 | 0 | How can I remove / inspect / modify handlers configured for my loggers using the fileConfig() function?
For removing there is Logger.removeHandler(hdlr) method, but how do I get the handler in first place if it was configured from file? | logging remove / inspect / modify handlers configured by fileConfig() | 1.2 | 0 | 1 | 46,204 |
3,630,982 | 2010-09-02T20:30:00.000 | 3 | 0 | 1 | 0 | python,regex | 3,630,994 | 5 | false | 0 | 0 | (ABC){5} Should work for you | 2 | 25 | 0 | Is there a way using a regex to match a repeating set of characters? For example:
ABCABCABCABCABC
ABC{5}
I know that's wrong. But is there anything to match that effect?
Update:
Can you use nested capture groups? So Something like (?<cap>(ABC){5}) ? | repeating multiple characters regex | 0.119427 | 0 | 0 | 52,017 |
3,630,982 | 2010-09-02T20:30:00.000 | 5 | 0 | 1 | 0 | python,regex | 3,631,077 | 5 | false | 0 | 0 | ABC{5} matches ABCCCCC. To match 5 ABC's, you should use (ABC){5}. Parentheses are used to group a set of characters. You can also set an interval for occurrences like (ABC){3,5} which matches ABCABCABC, ABCABCABCABC, and ABCABCABCABCABC.
(ABC){1,} means 1 or more repetition which is exactly the same as (ABC)+.
(ABC){0,} means 0 or more repetition which is exactly the same as (ABC)*. | 2 | 25 | 0 | Is there a way using a regex to match a repeating set of characters? For example:
ABCABCABCABCABC
ABC{5}
I know that's wrong. But is there anything to match that effect?
Update:
Can you use nested capture groups? So Something like (?<cap>(ABC){5}) ? | repeating multiple characters regex | 0.197375 | 0 | 0 | 52,017 |
3,631,828 | 2010-09-02T22:39:00.000 | -1 | 1 | 1 | 0 | python,tweepy | 3,631,888 | 2 | false | 0 | 0 | Update: The comments below have some solid points against this technique.
2) What OS are you running? Generally, there is a symlink somewhere in your system, which points from 'python' to 'pythonx.x', where x.x is the version number preferred by your operating system. On Linux, there is a symlink /usr/bin/python, which points to (on Ubuntu 10.04) /usr/bin/python2.6 on a standard installation.
Just manually change the current link to point to the python3.1 binary, and you are fine. | 1 | 0 | 0 | I am attempting to use the tweepy api to make a twitter function and I have two issues.
I have little experience with the terminal and Python in general.
1) It installed properly with Python 2.6, however I can't use it or install it with Python 3.1. When I attempt to install the module in 3.1 it gives me an error that there is no module setuptools. Originally I thought that perhaps I was unable to use tweepy module with 3.1, however in the readme it says "Python 3 branch (3.1)", which I assume means it is compatible. When I searched for the setuptools module, which I figured I could load into the new version, there was only modules for up to Python 2.7. How would I install the Tweepy api properly on Python 3.1?
2) My default Python when run from terminal is 2.6.1 and I would like to make it 3.1 so I don't have to type python3.1. | Python defaults and using tweepy api | -0.099668 | 0 | 1 | 1,565 |
3,632,046 | 2010-09-02T23:33:00.000 | 1 | 0 | 1 | 0 | python,import,zip | 3,632,086 | 1 | true | 0 | 0 | Just insert the whole path to the zipfile, c:/what/ever/itis.zip, in your sys.path, and import themodule (assuming it's at the top "level" of the zipfile's simulated directory-tree structure). | 1 | 0 | 0 | There is a module I'd love to download, but it is only available in a zip file, how do I get such a file to work properly in python, so That I can import what I want?
This is in Windows 7 BTW. | Getting modules from a zip file? | 1.2 | 0 | 0 | 112 |
3,632,537 | 2010-09-03T01:47:00.000 | 0 | 0 | 0 | 0 | django,mod-python | 3,632,574 | 2 | false | 1 | 0 | It loads Django once per httpd process. Since multiple processes start (each child being a process), multiple instances of Django are started. | 2 | 1 | 0 | My understanding is that mod_python loads the python process into apache, avoiding the overhead of doing that on each call. My expectation was that this would mean that my django stack would also only be loaded once.
What I am observing, however, is that every request is running the entire django stack from the beginning, as though it were the first request. The settings are re-imported. Middleware __init__'s, which are supposed to be run once at django startup, are run each time. And so forth. It seems to be essentially like I would expect CGI to be.
Is this expected behavior? I have mostly worked with mod_wsgi, which I believe does not work this way, but I have to use mod_python for my current client.
Thanks! | Why is mod_python running entire django stack from beginning with each request? | 0 | 0 | 0 | 68 |
3,632,537 | 2010-09-03T01:47:00.000 | 2 | 0 | 0 | 0 | django,mod-python | 3,632,878 | 2 | true | 1 | 0 | Apache on UNIX systems is a multiprocess system as pointed out by someone else. Also make sure the MaxRequestsPerChild hasn't been set to be 1 in Apache configuration for some reason. Ideally that directive should be set to 0, meaning keep processes around and not recycle them based on number of requests. | 2 | 1 | 0 | My understanding is that mod_python loads the python process into apache, avoiding the overhead of doing that on each call. My expectation was that this would mean that my django stack would also only be loaded once.
What I am observing, however, is that every request is running the entire django stack from the beginning, as though it were the first request. The settings are re-imported. Middleware __init__'s, which are supposed to be run once at django startup, are run each time. And so forth. It seems to be essentially like I would expect CGI to be.
Is this expected behavior? I have mostly worked with mod_wsgi, which I believe does not work this way, but I have to use mod_python for my current client.
Thanks! | Why is mod_python running entire django stack from beginning with each request? | 1.2 | 0 | 0 | 68 |
3,636,286 | 2010-09-03T13:38:00.000 | 1 | 0 | 0 | 0 | python,django,postgresql,encryption | 3,636,320 | 4 | true | 1 | 0 | What are you protecting against? If attacker would get access to your DB/filesystem, he would find how you decrypt data & keys. Hiding your encription key is not an easy task (and rarely implemented in "usual" applications).
I would spend more time on protecting the server and fixing all general security issues. | 1 | 22 | 0 | I'm going to be storing a few sensitive pieces of information (SSN, Bank Accounts, etc) so they'll obviously need to be encrypted. What strategies do you recommend?
Should I do all the encryption/decryption in the web app itself? Should I use something like pgcrypto and have the conversions done on the DB side? Something else entirely?
Also, if you think I should do encryption on the web app side, what Python libraries would you recommend? | Strategies for Encryption with Django + Postgres? | 1.2 | 0 | 0 | 14,180 |
3,637,503 | 2010-09-03T15:59:00.000 | 1 | 1 | 0 | 1 | python,ruby-on-rails,ruby,django,shell | 3,637,544 | 7 | false | 1 | 0 | I'm not sure if it's what you want, but there are some web based ssh clients out there. If you care about security and really just want dynamic feedback, you could look into comet or just have a frame with its own http session that doesn't end until it's done printing. | 1 | 8 | 0 | Imagine a web application that allows a logged in user to run a shell command on the web server at the press of a button. This is relatively simple in most languages via some standard library os tools.
But if that command is long running you don't want your UI to hang. Again this is relatively easy to deal with using some sort of background process or putting the command to be executed onto a message queue (and maybe saving the output and status somewhere for later consumption). Just return quickly saving we'll run that and get back to you.
What I'd like to do is show the output of said web ui triggered shell command as it happens. So vertically scrolling text like when running in a terminal.
I have a vague idea of how I might approach this, streaming the output to a websocket perhaps and simply printing the output to screen.
What I'd like to ask is:
Are their any plugins, libraries or applications that already do this. Something I can either use or read the source of. Ideally an open source python/django or ruby/rails tool, but other stacks would be interesting too. | What is the best way of running shell commands from a web based interface? | 0.028564 | 0 | 0 | 4,016 |
3,637,579 | 2010-09-03T16:11:00.000 | 1 | 0 | 0 | 0 | python,web-services,dynamics-crm,dynamics-crm-4 | 3,639,310 | 1 | true | 1 | 0 | Catch SoapException and take a look at Detail property. You'll find everything about the error in there. | 1 | 0 | 0 | What is the best way to trap errors/exceptions with the CRM 4 Web service. Is there a way to get more detailed error messages from the web service? There is a custom application that creates orders and when the get a error message from the web service it is not very details or useful. Is there a better way to get more detailed message from the CRM 4 web service in a custom application written in python. | Error Handling CRM 4 Webservice | 1.2 | 0 | 0 | 211 |
3,637,681 | 2010-09-03T16:26:00.000 | 0 | 0 | 0 | 0 | javascript,python | 3,637,740 | 2 | false | 1 | 0 | How does the search page work? If it loads anything using Ajax, you could do some basic reverse engineering and find the URLs involved using Firebug's Net panel or Wireshark and then use urllib2 to load those.
If it's more complicated than that, you could simulate the actions JS performs manually without loading and interpreting JavaScript. It all depends on how the search page works.
Lastly, I know there are ways to run scripting on pages without a browser, since that's what some functional testing suites do, but my guess is that this could be the most complicated approach. | 1 | 0 | 0 | I'm using Python to parse an auction site.
If I use browser to open this site, it will go to a loading page, then jump to the search result page automatically.
If I use urllib2 to open the webpage, the read() method only return the loading page.
Is there any python package could wait until all contents are loaded then read() method return all results?
Thanks. | How to parse a web use javascript to load .html by Python? | 0 | 0 | 1 | 862 |
3,639,639 | 2010-09-03T21:18:00.000 | 3 | 0 | 0 | 0 | python,import,dataset,spss | 21,390,123 | 7 | false | 0 | 0 | Option 1
As rkbarney pointed out, there is the Python savReaderWriter available via pypi. I've run into two issues:
It relies on a lot of extra libraries beyond the seemingly pure-python implementation. SPSS files are read and written in nearly every case by the IBM provided SPSS I/O modules. These modules differ by platform and in my experience "pip install savReaderWriter" doesn't get them running out of the box (on OS X).
Development on savReaderWriter is, while not dead, less up-to-date than one might hope. This complicates the first issue. It relies on some deprecated packages to increase speed and gives some warnings any time you import savReaderWriter if they're not available. Not a huge issue today but it could be trouble in the future as IBM continues to update the SPSS I/O modules to deal new SPSS formats (they're on version 21 or 22 already if memory serves).
Option 2
I've chosen to use R as a middle-man. Using rpy2, I set up a simple function to read the file into an R data frame and output it again as a CSV file which I subsequently import into python. It's a bit rube-goldberg but it works. Of course, this requires R which may also be a hassle to install in your environment (and has different binaries for different platforms). | 3 | 6 | 1 | Is there any way to import SPSS dataset into Python, preferably NumPy recarray format?
I have looked around but could not find any answer.
Joon | Importing SPSS dataset into Python | 0.085505 | 0 | 0 | 9,605 |
3,639,639 | 2010-09-03T21:18:00.000 | 1 | 0 | 0 | 0 | python,import,dataset,spss | 3,691,267 | 7 | false | 0 | 0 | To be clear, the SPSS ODBC driver does not require an SPSS installation. | 3 | 6 | 1 | Is there any way to import SPSS dataset into Python, preferably NumPy recarray format?
I have looked around but could not find any answer.
Joon | Importing SPSS dataset into Python | 0.028564 | 0 | 0 | 9,605 |
3,639,639 | 2010-09-03T21:18:00.000 | 3 | 0 | 0 | 0 | python,import,dataset,spss | 3,640,019 | 7 | false | 0 | 0 | SPSS has an extensive integration with Python, but that is meant to be used with SPSS (now known as IBM SPSS Statistics). There is an SPSS ODBC driver that could be used with Python ODBC support to read a sav file. | 3 | 6 | 1 | Is there any way to import SPSS dataset into Python, preferably NumPy recarray format?
I have looked around but could not find any answer.
Joon | Importing SPSS dataset into Python | 0.085505 | 0 | 0 | 9,605 |
3,640,092 | 2010-09-03T22:51:00.000 | 1 | 0 | 0 | 1 | python,ctypes | 3,640,616 | 2 | false | 0 | 0 | Be aware that the operating system is going to be doing readahead for read() anyway. You're going to be blocking either in read() or write()--one or the other will bottleneck the operation--but even though you're blocking in one, that doesn't mean the other isn't taking place for you behind the scenes. That's the job of every multitasking operating system.
If you use mmap for this, you're very likely making things more complicated for the OS--making it harder for it to determine that you're really just streaming data in and out, and making it more complicated for it to do read-ahead. It may still figure it out (operating systems are very good at this), but you're probably not helping.
The only benefit in principle is avoiding the cost of a memory copy, but it doesn't sound like that's your goal here (and unless profiling clearly says otherwise, I'd strongly doubt that would help performance). | 1 | 12 | 0 | I am wondering if it is possible for the ctypes package to interface with mmap.
Currently, my module allocates a buffer (with create_string_buffer) and then passes that using byref to my libraries mylib.read function. This, as the name suggests, reads data into the buffer. I then call file.write(buf.raw) to write the data to disk. My benchmarks, however, show this to be far from optimal (time spent in file.write is time better spent in mylib.read).
I am therefore interested in knowing if ctypes can interoperate with mmap. Given an mmap.mmap instance and an offset how can I get a pointer (c_void_p) into the address space? | Python, ctypes and mmap | 0.099668 | 0 | 0 | 3,930 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.