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,641,152 | 2010-09-04T06:25:00.000 | 1 | 0 | 1 | 0 | python,django,string,nlp | 3,644,860 | 6 | false | 1 | 0 | If some false positives/negatives are ok, search for bloom filter on wikipedia.
If not look at CDB, (yum install tinycdb, in Fedora -- no python API atm). | 2 | 9 | 0 | Stackoverflow implemented its "Related Questions" feature by taking the title of the current question being asked and removing from it the 10,000 most common English words according to Google. The remaining words are then submitted as a fulltext search to find related questions.
I want to do something similar in my Django site. What is the best way to filter a string (the question title in this case) against a long list of words in Python? Any libraries that would enable me to do that efficiently? | How to efficiently filter a string against a long list of words in Python/Django? | 0.033321 | 0 | 0 | 4,500 |
3,641,152 | 2010-09-04T06:25:00.000 | 2 | 0 | 1 | 0 | python,django,string,nlp | 3,641,324 | 6 | false | 1 | 0 | I think a much simpler solution and still reasonably fast is to use sqlite and regular expressions.
Put the long list of words in an sqlite table and build a b-tree index. This gives you log(n) time exists queries. Split the smaller string with a regular expression and loop over the words running an exists query for each of them.
You can stem the words first with the porter stemmer from nltk. | 2 | 9 | 0 | Stackoverflow implemented its "Related Questions" feature by taking the title of the current question being asked and removing from it the 10,000 most common English words according to Google. The remaining words are then submitted as a fulltext search to find related questions.
I want to do something similar in my Django site. What is the best way to filter a string (the question title in this case) against a long list of words in Python? Any libraries that would enable me to do that efficiently? | How to efficiently filter a string against a long list of words in Python/Django? | 0.066568 | 0 | 0 | 4,500 |
3,641,483 | 2010-09-04T08:35:00.000 | 7 | 0 | 0 | 0 | python,django | 3,641,584 | 3 | true | 1 | 0 | this doesn't seem to be possible without changing the User model source code.
Correct. Unless you are willing to change (or replace) User there isn't a way.
One (tenuous, hackish) way to do this would be to attach an UserProfile for each User instance. Each User should have exactly one UserProfile. You can then add your UUIDField to the profile. You will still have to do custom querying to translate from UUIDField to id.
If you don't like the name UserProfile you can rename it suitably. The key is that you have a one-to-one relationship to User. | 1 | 9 | 0 | Django by default makes a primary key field on each model named "id", with a type of AutoField. On my models, I'm overriding this to use a custom UUIDField as the primary key by using the "primary_key" attribute. I would also like the User model in django.contrib.auth to have a UUIDField as the primary key, but this doesn't seem to be possible without changing the User model source code.
Is there any recommended way to approach this problem? | django user model and custom primary key field | 1.2 | 0 | 0 | 16,452 |
3,641,538 | 2010-09-04T08:54:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine | 3,643,164 | 3 | false | 0 | 0 | Just place the package's folder in the root directory of your GAE application, easy! | 1 | 2 | 0 | I understand that if you want to include external packages you have to include them in your project. So I was wondering how do you do this?
Do people use one general script that auto imports them from a location. Maybe some kind of config file that lists all the external packages? Do you always zip the packages and use zipimporter?
Anway, I guess I am looking for a good general strategy for import external packages. I learned some already from looking at source code but extra info/examples would be super. | Google App Engine: Including external packages | 0.132549 | 0 | 0 | 506 |
3,643,065 | 2010-09-04T16:20:00.000 | 3 | 0 | 1 | 0 | python,regex,string | 3,745,035 | 6 | false | 0 | 0 | filter(str.isdigit, s) is faster and IMO clearer than anything else listed here.
It will also throw a TypeError if s is a unicode type. Depending on what definition of "digits" you want, this can be more or less useful than the alternative filter(type(s).isdigit, s), slightly slower but still faster than the re and comprehension versions for me.
Edit: Although if you are a poor sucker stuck with Python 3, you will need to use "".join(filter(str.isdigit, s)) which puts you firmly in the realm of equivalently bad performance. Such progress. | 1 | 10 | 0 | I need to replace non-numeric chars from a string.
For example, "8-4545-225-144" needs to be "84545225144"; "$334fdf890==-" must be "334890".
How can I do this? | Replace non-numeric characters | 0.099668 | 0 | 0 | 9,355 |
3,643,500 | 2010-09-04T18:35:00.000 | -3 | 0 | 1 | 1 | python,operating-system | 8,959,919 | 11 | false | 0 | 0 | Buddy, here is the answer you have been looking for:
Writting an Operating System is not different than writting any other application, actually it is far easier than writing any other code for the reason an Operating System is an ALL-PURPOSE software or what is meant as a platform... and you know it!.
All of the previous asnwers are EXTREMELY USEFUL!, and ALL OF THE PREVIOUS INCLUDING THIS ONE WILL HELP YOU IN CODING YOUR O.S. actually in less than three months.
Please, try to be objective and get rid of negative answers (that is just mindblocking...)
A Software Developer actually CODE EVERYTHING that comes to his mind! (in my case I was a SUPERB software developer until I had a brain accident and suffered hypoxia for a considerably period... not want to talk further about it... me traumatized...)...
Let's speak clear:
If you want to build an O.S. do the following and start TODAY!:
Define if you want to write a SHELL or if you want to write a CORE O.S.;
Plan main functions of the O.S., processes, etc.;
Choose the level you want to build it on:
VERY LOW LEVEL (Assembly Language required and MEMORY, CPU, AND HARDWARE RESOURCES KNOWLEDGE REQUIRED ALSO -NOT TO BE ACQUIRED IN MERELY THREE MONTHS... OH NO!...)...
Medium Level (Here you can use the STANDARD solution, that is C programming Language!);
High Level (This is the level you may want to use Python, it means you will use ALL of the same resources and shells you operating systems offer to you, whether it is any Linux Distribution, or a UNIX(R), Windows(R), CP/M(R) or any other known up to date);
Because of the time required for you to build it I must assume you are delivering a College work to earn credits... and yet in case you work for a Corporation or in case you are self employed or your own C.E.O., you must have resources assigned to this project... I will assume you are building it for a Academic's!.
Imagine you are writing a shell, that will ease the start-up of your work, and while you are writing the shell your mind should be drawing the real core of it, along with the addressing and along with the lowest level routines...
I think you may know MS(R)-DOS(R). The version 3.3 is one of the easiest and enriching (pedagogically speaking) Operating Systems ever designed and published by Microsoft(r) Corp. Please, be creative, DO NOT CLONE IT, just inspire your mind on it, and then build something your Professor or end-consumer will admire and enjoy!.
Do not forget we are in the age of Graphical User's Interface, so do not go into texting, although ASCII is still the most beautiful expression of computer age, you can play with both interfaces.
Once you work this from Top to Dowm you will find out how easy it is to build routines in High Level language, and once you build it, and debug it, may be you will speed up a CORE os. that is: Bootstrapping, Memory management, etcetera...
Do not get to involved in dealing with interruptions or you may end up loosing you enthusiasm INMEDIATELY!... leave the UNDERGROUND O.S. to deal and take care of the interruptions.
In less than three months you will have your first prototype, and then you need to make it work good (To Debug it, I mean!). Exceed yourself!.
If you work SOLO, you will need to write a manual, IT TAKES CONSIDERABLY PRECIOUS TIME YOU DO NOT WANT TO LOOSE... My advice (please, do not laugh, I used this technique and it made today's Magnate's earn BILLIONS) WRITE DOWN IN PAPER, HANDWRITTEN, ALL OF THE DOCUMENTATION (THIS IS BECAUSE YOUR FINE MOTRICE COORDINATION IS FASSST! AND EVEN IT WILL NOT EQUAL THE SPEED OF YOUR THOUGHTS IT IS A HARD COPY TO DELIVER TO A WELL PAID ASSISTANT TO TYPE IT INTO A COMPUTER AND EDIT IT MARVELOUS -MAYBE A .PDF WITH ILLUSTRATIONS, ALONG WITH A VIDEO WILL SHARPEN AND DELIGHT THE EYES OF THE END-CONSUMER!.
Remember, the build up of the first month must be actually a SHELL of the basic functions a BASIC operating system must deliver to the user:
Commands Processor;
File Directory listup;
Create/Edit and Delete files;
Create/Edit and Delete Directories;
Accessing drive units (floppies, Compact Discs, HardDrives, Flash Drives, etc...);
Update and Display of information through the screen!;
I would focus mainly in the previous, and then ANYTHING else comes up easily through the creation of enriching routines (trust me this phase is addictive and you will have NO MORE life when you reach to this poit for you will be married to this project and you will never leave it anymore), do not fear, it wil work!.
Present your Operating System, and if your expecting upcomming funds show up, or if your expecting grade gets the higher rated you expect, you may want to keep enlarging your project and then build it into a more solid, robust and steady application!.
Just imagine yourself using this platform as a plaintiff for any kind of hardware you may want to work with: ROBOTS, AUTOS; AIRPLANES; REMOTE CONTROL; ETC...
I know you will enjoy this assignment and I know you will entertain yourself greatly! Only a real programmer has this kind of ambitions!
God bless America!
KnowBuddy | 7 | 15 | 0 | I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python.
I have a few limitations:
I have only 3 months.
I want to do it in Python.
I can put in say 20-30 hours every week into it.
I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations?
Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS)
If the idea is not feasible, can anyone tell me how much do I need to scale down my idea?
Any help is much appreciated! | Operating System from scratch | -0.054491 | 0 | 0 | 13,899 |
3,643,500 | 2010-09-04T18:35:00.000 | 16 | 0 | 1 | 1 | python,operating-system | 3,643,520 | 11 | false | 0 | 0 | Scale this down a lot. I would recommend looking at one very small piece of an operating system that you would want to do, perhaps parallel processing. There is no feasible way you will be able to write an entire operating system in under 500 hours, let only 5000 hours. The real question is is this for an undergraduate course or a graduate course? The answer to that will greatly reflect what is needed to pass.
Adding
Grab a book on a topic about the operating system that interests you and focus intently on that for 3 months and you may just produce something that is good. Operating systems may seem like they don't do much on the outside, but think of it this way Windows has ~50 million lines of code. | 7 | 15 | 0 | I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python.
I have a few limitations:
I have only 3 months.
I want to do it in Python.
I can put in say 20-30 hours every week into it.
I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations?
Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS)
If the idea is not feasible, can anyone tell me how much do I need to scale down my idea?
Any help is much appreciated! | Operating System from scratch | 1 | 0 | 0 | 13,899 |
3,643,500 | 2010-09-04T18:35:00.000 | 9 | 0 | 1 | 1 | python,operating-system | 3,643,598 | 11 | false | 0 | 0 | Does your professor require a "low-level" component in the project? For example, anything that deals with the hardware or the instruction architecture. If so, your professor will not allow you to do the project in Python. The project must be written in C and assembly. And you will invariably be working on modifying the Linux kernel.
However, nowadays Operating System is no longer confined to the low-level aspect. Virtualization, database, parallelization are all built on top of the Operating System. If your professor is "old school" then he/she may not consider those new topics to be part of Operating System. So, you may need to bring some sample ideas to your professor and seek clarification.
Whether to go into low-level, as some have suggested, depends entirely on the professor's educational goals.
To teach basic concurrent programming constructs, such as events, semaphors and mutex. This can be taught by writing some multi-thread applications. It is arguably too easy as a goal for an OS class. Nevertheless, this is in fact the most "marketable" skill you will get from the class.
A variation on this theme is to teach how to "use" a particular flavor of OS API.
To teach how to write applications that make efficient use of the operating system. This may require you to implement some entry-level OS-related algorithms inside a "simulated OS project" (say, in Java or Python, could also be in C++). Each aspect can be studied in separate projects/simulators, without using a full-blown OS.
For example, to teach how to use the file cache efficiently, it is necessary to make students play with a "toy" file cache using a simple algorithm.
To teach the hardware aspect of operating system (including the ugliness of it), namely, how it interacts with the instruction set architecture and hardware I/O. This is usually done with "embedded system", with a small prototyping board.
To teach real-world algorithms used inside modern operating system. This will require lots of paper reading, as well as implementing a non-trivial algorithm inside a real Linux kernel. This level is appropriate for graduate studies.
A good project would include one or more of:
Input / Output
Storage
Deciding what to cache / predicting what to pre-load
Starting / managing / logging tasks (processes, threads or Python functions), locally or remotely
Managing resources
Require each process to give estimates of how much peak memory will be used, and to report a "progress" percentage regularly throughout their execution, which can then be used together to make estimates about resource usage
Communication
Concurrency
A project that does not directly interact with hardware, but would still be good project, will be:
If your project provides an abstraction of the operating system to the apps that will run "inside" your project
In other words, the "apps" rely solely on your "operating system project" for their I/O, storage, task management, resource, communication needs
Your project makes good (efficient, measurable) use of the real operating system (Windows, Linux etc)
Then it will be a good Operating Systems project, regardless of the language used.
I would suggest implementing your own memcached, map-reduce or a simple version control system as good project examples.
Edited: removed ranting | 7 | 15 | 0 | I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python.
I have a few limitations:
I have only 3 months.
I want to do it in Python.
I can put in say 20-30 hours every week into it.
I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations?
Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS)
If the idea is not feasible, can anyone tell me how much do I need to scale down my idea?
Any help is much appreciated! | Operating System from scratch | 1 | 0 | 0 | 13,899 |
3,643,500 | 2010-09-04T18:35:00.000 | 1 | 0 | 1 | 1 | python,operating-system | 3,644,442 | 11 | false | 0 | 0 | You could probably code a small embedded-system OS in the timeframe you indicate, using concepts that are over a decade old. Many newer operating systems require many more complicated scheduling and memory-management heuristics than would be typical in a small embedded OS; designing an entire modern OS would not be a practical single-person project, but one might be able to do something interesting with some subsystem of it. I personally think there's some room for improvement in flash file systems, but I don't know what your prof would think. What is your prof really looking for? | 7 | 15 | 0 | I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python.
I have a few limitations:
I have only 3 months.
I want to do it in Python.
I can put in say 20-30 hours every week into it.
I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations?
Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS)
If the idea is not feasible, can anyone tell me how much do I need to scale down my idea?
Any help is much appreciated! | Operating System from scratch | 0.01818 | 0 | 0 | 13,899 |
3,643,500 | 2010-09-04T18:35:00.000 | 0 | 0 | 1 | 1 | python,operating-system | 3,643,741 | 11 | false | 0 | 0 | Developing an operating system in Python is possible. However, you might want to choose C or Assembly because there's an huge code base developed in those languages. | 7 | 15 | 0 | I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python.
I have a few limitations:
I have only 3 months.
I want to do it in Python.
I can put in say 20-30 hours every week into it.
I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations?
Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS)
If the idea is not feasible, can anyone tell me how much do I need to scale down my idea?
Any help is much appreciated! | Operating System from scratch | 0 | 0 | 0 | 13,899 |
3,643,500 | 2010-09-04T18:35:00.000 | 2 | 0 | 1 | 1 | python,operating-system | 3,643,534 | 11 | false | 0 | 0 | I don't get how you think you can write an operating system in Python. You need native code to at least load an interpreter during bootup, not to mention hardware communication, drivers etc., all of which would be nearly impossible to do given current Python interpreters when running on a bare machine. I'm also pondering if you are aware that you'd have to port a given Python interpreter to compile and run without an underlying operating system, which alone would keep you busy for a time.
It's good that you are ambitious, but I honestly think you could not even finish the basic operating system, let alone "some very basic apps running". | 7 | 15 | 0 | I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python.
I have a few limitations:
I have only 3 months.
I want to do it in Python.
I can put in say 20-30 hours every week into it.
I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations?
Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS)
If the idea is not feasible, can anyone tell me how much do I need to scale down my idea?
Any help is much appreciated! | Operating System from scratch | 0.036348 | 0 | 0 | 13,899 |
3,643,500 | 2010-09-04T18:35:00.000 | 1 | 0 | 1 | 1 | python,operating-system | 3,644,477 | 11 | false | 0 | 0 | In our university we have operating systems course where we too are supposed to develop something on linux. Not entire OS. We did our own scheduling policy and file system for linux. But this will be done in C since linux is in C. | 7 | 15 | 0 | I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python.
I have a few limitations:
I have only 3 months.
I want to do it in Python.
I can put in say 20-30 hours every week into it.
I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations?
Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS)
If the idea is not feasible, can anyone tell me how much do I need to scale down my idea?
Any help is much appreciated! | Operating System from scratch | 0.01818 | 0 | 0 | 13,899 |
3,644,113 | 2010-09-04T21:43:00.000 | 0 | 0 | 0 | 0 | python,windows,transparency,tkinter,alpha | 3,644,372 | 2 | true | 0 | 1 | If you change the override redirect flag you need to withdraw and then deiconify the window to give the window manager a chance to make the change. You might try that.
Also, when you say "close out" the option menu top-level, what exactly do you mean? Are you sure destroying this second top-level window? | 1 | 0 | 0 | I have a python program that has no windows frame and doesn't show up in the taskbar because of self.overrideredirect(1). This program has an options menu (a top level widget) that allows for the alpha to be adjusted with self.attributes("-alpha", 0.85). However when I close out of the options menu my program shows up in the task bar. Obviously I don't want it to do this. I tried invoking the self.overrideredirect(1) command after the options menu was closed, but to no avail. Does anyone have a solution/ know of a line that will remove my program from the task bar? | Help with Tkinter Alpha | 1.2 | 0 | 0 | 2,723 |
3,644,777 | 2010-09-05T02:32:00.000 | 2 | 0 | 0 | 0 | python,pygtk | 3,644,788 | 1 | true | 0 | 1 | Answering my own question, it makes sense after 45 minutes of googling I solve my own problem 30 seconds after posting on StackOverflow.
I needed to use the get_iter function, not the get_iter_from_string function. | 1 | 1 | 0 | I'm trying to retrieve the row data from a treemodel when the row_activated callback is fired.
When row_activated is called, the 'path' variable it passes is a tuple. How do I easily use this tuple to retrieve an iter and ultimately the data itself? The treemodel class has a function to convert a string into an iter, but it seems like there should be an easier way than converting the tuple to a string, then the string to an iter. | PyGTK treeview and row_activated callback | 1.2 | 0 | 0 | 262 |
3,646,002 | 2010-09-05T12:11:00.000 | 6 | 0 | 0 | 0 | python,django,frameworks,web2py,turbogears | 4,338,367 | 7 | false | 1 | 0 | I have to say as not particularly skilled developer, the speed at which I have been able to create using web2py has blown my mind. In large part due to the amazing community and the core value Massimo has of making the framework accessible.
When I started I had written 0 lines of code in Python
Never heard of web2py
I've been at it seriously for about a month and have progressed (in my usual fashion) from asking questions that no one could answer (because they didn't make any sense) to coding for hours at a time without picking up a book or asking a question.
I'm really impressed. | 3 | 20 | 0 | I got a project in mind that makes it worth to finally take the plunge into programming.
After reading a lot of stuff, here and elsewhere, I'm set on making Python the one I learn for now, over C# or java. What convinced me the most was actually Paul Graham's excursions on programming languages and Lisp, though Arc is in the experimental stage, which wouldn't help me do this web app right now.
As for web app fast, I've checked out Django, Turbo Gears and Py2Web. In spite of spending a lot of time reading, I still have no clue which one I should use.
1) Django certainly has the nicest online presence, and a nicely done onsite tutorial, they sure know how to show off their thing.
2) Web2Py attracted me with its no-install-needed and the claim of making Django look complicated. But when you dig around on their website, you quickly find content that hasn't been updated in years with broken external links... There's ghosts on that website that make someone not intimately familiar with the project worry if it might be flatlining.
3) Turbo Gears ...I guess its modular too. People who wrote about it loved it... I couldn't find anything specific that might make it special over Django.
I haven't decided on an IDE yet, though I read all the answers to the Intellisense code completion post here. Showing extra code snippets would be cool too for noobs like me, but I suppose I should choose my web frame work first and then pick an editor that will work well with it.
Since probably no framework is hands down the best at everything, I will give some specifics on the app I want to build:
It will use MySQL, it needs register/sign-in, and there will be a load of simple math operations on data from input and SQL queries. I've completed a functional prototype in Excel, so I know exactly what I want to build, which I hope will help me overcome my noobness. I'll be a small app, nothing big.
And I don't want to see any HTML while building it ;-)
PS: thanks to the people running Stackoverflow, found this place just at the right moment too! | Django, Turbo Gears, Web2Py, which is better for what? | 1 | 0 | 0 | 15,591 |
3,646,002 | 2010-09-05T12:11:00.000 | 2 | 0 | 0 | 0 | python,django,frameworks,web2py,turbogears | 15,945,257 | 7 | false | 1 | 0 | I've used both web2py and RoR extensively, and while RoR has gotten a lot of popularity and support in the past few years, web2py is simpler, cleaner, less "magical", and yet also offers more (useful) out-of-the-box functionality. I'd say that web2py has more potential than RoR, but it is a relatively new framework and does yet not have the maturity of RoR. (Despite that, though, I'd choose web2py over RoR any day...) | 3 | 20 | 0 | I got a project in mind that makes it worth to finally take the plunge into programming.
After reading a lot of stuff, here and elsewhere, I'm set on making Python the one I learn for now, over C# or java. What convinced me the most was actually Paul Graham's excursions on programming languages and Lisp, though Arc is in the experimental stage, which wouldn't help me do this web app right now.
As for web app fast, I've checked out Django, Turbo Gears and Py2Web. In spite of spending a lot of time reading, I still have no clue which one I should use.
1) Django certainly has the nicest online presence, and a nicely done onsite tutorial, they sure know how to show off their thing.
2) Web2Py attracted me with its no-install-needed and the claim of making Django look complicated. But when you dig around on their website, you quickly find content that hasn't been updated in years with broken external links... There's ghosts on that website that make someone not intimately familiar with the project worry if it might be flatlining.
3) Turbo Gears ...I guess its modular too. People who wrote about it loved it... I couldn't find anything specific that might make it special over Django.
I haven't decided on an IDE yet, though I read all the answers to the Intellisense code completion post here. Showing extra code snippets would be cool too for noobs like me, but I suppose I should choose my web frame work first and then pick an editor that will work well with it.
Since probably no framework is hands down the best at everything, I will give some specifics on the app I want to build:
It will use MySQL, it needs register/sign-in, and there will be a load of simple math operations on data from input and SQL queries. I've completed a functional prototype in Excel, so I know exactly what I want to build, which I hope will help me overcome my noobness. I'll be a small app, nothing big.
And I don't want to see any HTML while building it ;-)
PS: thanks to the people running Stackoverflow, found this place just at the right moment too! | Django, Turbo Gears, Web2Py, which is better for what? | 0.057081 | 0 | 0 | 15,591 |
3,646,002 | 2010-09-05T12:11:00.000 | 2 | 0 | 0 | 0 | python,django,frameworks,web2py,turbogears | 3,757,753 | 7 | false | 1 | 0 | Django: Heard it has the best administrative
interface. But uses it's own ORM, i.e. doesn't use SQL-Alchemy.
Web2py: Didn't research this.
Turbogears2:
Uses SQL-Alchemy by default, uses Catwalk for admin
interface, but documentation isn't as
great.
I chose Turbogears2 because it uses popular components, so I didn't have to learn anything new... | 3 | 20 | 0 | I got a project in mind that makes it worth to finally take the plunge into programming.
After reading a lot of stuff, here and elsewhere, I'm set on making Python the one I learn for now, over C# or java. What convinced me the most was actually Paul Graham's excursions on programming languages and Lisp, though Arc is in the experimental stage, which wouldn't help me do this web app right now.
As for web app fast, I've checked out Django, Turbo Gears and Py2Web. In spite of spending a lot of time reading, I still have no clue which one I should use.
1) Django certainly has the nicest online presence, and a nicely done onsite tutorial, they sure know how to show off their thing.
2) Web2Py attracted me with its no-install-needed and the claim of making Django look complicated. But when you dig around on their website, you quickly find content that hasn't been updated in years with broken external links... There's ghosts on that website that make someone not intimately familiar with the project worry if it might be flatlining.
3) Turbo Gears ...I guess its modular too. People who wrote about it loved it... I couldn't find anything specific that might make it special over Django.
I haven't decided on an IDE yet, though I read all the answers to the Intellisense code completion post here. Showing extra code snippets would be cool too for noobs like me, but I suppose I should choose my web frame work first and then pick an editor that will work well with it.
Since probably no framework is hands down the best at everything, I will give some specifics on the app I want to build:
It will use MySQL, it needs register/sign-in, and there will be a load of simple math operations on data from input and SQL queries. I've completed a functional prototype in Excel, so I know exactly what I want to build, which I hope will help me overcome my noobness. I'll be a small app, nothing big.
And I don't want to see any HTML while building it ;-)
PS: thanks to the people running Stackoverflow, found this place just at the right moment too! | Django, Turbo Gears, Web2Py, which is better for what? | 0.057081 | 0 | 0 | 15,591 |
3,646,205 | 2010-09-05T13:28:00.000 | 0 | 1 | 0 | 0 | php,python,fastcgi | 3,646,236 | 3 | false | 0 | 0 | Python is compiled to bytecode when executed (the .pyc files), and the bytecode is kept around, not discarded. The compiled python is used instead of the source if it is present. Therefore, there is no need for additional opcode caching in python as it is already built in. | 1 | 4 | 0 | I'm a newbie to web technology, and still on a learning curve.
Heard that, fastcgi would keep the compiled(interpreted) php code in memory, so why would one has to use op-code caching (apc or eaccelerators) for PHP?
But I never heard of any such accelerators for Python. I'd expect as python and php are both interpreted language, it makes me think that, there has to be a room for python accelerators ? pls correct me if I'm wrong.
Many thanks | Why would one use accelerators with fastcgi for PHP? | 0 | 0 | 0 | 583 |
3,647,368 | 2010-09-05T19:08:00.000 | 2 | 0 | 0 | 0 | python,wxpython | 3,647,374 | 3 | true | 0 | 1 | If you run a .py file from the harddisk, the harddisk will be accessed.
In your GUI, just import your code and it will be loaded once and you can access it later. | 3 | 0 | 0 | I am starting to use python,more. Is there a good way to keep python disk access to a minimum.
Seems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.
Would creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit. | Python Software design | 1.2 | 0 | 0 | 181 |
3,647,368 | 2010-09-05T19:08:00.000 | 2 | 0 | 0 | 0 | python,wxpython | 3,647,570 | 3 | false | 0 | 1 | Modern operating systems cache file access pretty efficiently, as long as there is enough spare RAM available. You most likely won't notice any difference, fi you're not loading thousand of python files at once.
And as always, before trying to optimize one aspect, make sure that this is really the bottleneck. Chances are, your percieved slowness is not due to loading of the .py files. | 3 | 0 | 0 | I am starting to use python,more. Is there a good way to keep python disk access to a minimum.
Seems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.
Would creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit. | Python Software design | 0.132549 | 0 | 0 | 181 |
3,647,368 | 2010-09-05T19:08:00.000 | 0 | 0 | 0 | 0 | python,wxpython | 3,647,549 | 3 | false | 0 | 1 | I think if you took the time to measure how much time it takes to load your python code from disk you would end up with a very, very tiny number unless you are doing something very wrong. And if you are doing something really wrong, solving that problem will be a better use of your time.
Using wxpython to create a guy to work around what you perceive to be a problem wouldn't likely make any difference. | 3 | 0 | 0 | I am starting to use python,more. Is there a good way to keep python disk access to a minimum.
Seems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.
Would creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit. | Python Software design | 0 | 0 | 0 | 181 |
3,647,518 | 2010-09-05T19:46:00.000 | 33 | 0 | 1 | 0 | python,coding-style,pyqt,pyqt4,pep8 | 3,647,541 | 6 | false | 0 | 0 | In your shoes, I wouldn't fight your framework, just like, as a general principle, I don't fight City Hall;-). I happen to share your preference for lowercase-with-underscore function names as PEP 8 specifies, but when I'm programming in a framework that forces a different capitalization style, I resign myself to adopting that style too, since I can't convince the framework to adopt the "better" style, and style inconsistencies (haphazard mixes of different styles) are really worse.
Of course, some mixage is inevitable if you're using more than one framework... e.g., PyQt with its camelcase, and standard Python library functions with their lowercase and underscores!-). But since frameworks like Qt are often intended to be extended by subclassing, while the standard Python library has less aspects of such a design, in most case where the capitalization style is forced (because you need to override a method, so you can't choose a different capitalization), it will be forced to camelcase (by Qt), only rarely to lowercase (by the standard Python library). So, I think that adopting Qt style in this case is still the lesser evil. | 4 | 35 | 0 | I'm starting to use PyQt in some projects and I'm running into a stylistic dilemma. PyQt's functions use camel case, but PEP8, which I prefer to follow, says to use underscores and all lowercase for function names.
So on the one hand, I can continue to follow PEP8, meaning that my code will have mixed functions calls to camel case and underscore functions, and even my classes will have mixed function names, since I'll need to be overloading functions like mousePressEvent. Or, I can break PEP8 and adopt camel case for all my function names in the name of consistency.
I realize this is subjective and it's really just what I personally prefer, but I like to hear from others about what they do and why they chose to do it that way. | PEP8 and PyQt, how to reconcile function capitalization? | 1 | 0 | 0 | 3,416 |
3,647,518 | 2010-09-05T19:46:00.000 | 6 | 0 | 1 | 0 | python,coding-style,pyqt,pyqt4,pep8 | 3,647,555 | 6 | false | 0 | 0 | Use what fits best.
If you're subclassing Qt classes, or have a function heavily integrated with them UseCamelCase.
Otherwise, use_underscores. | 4 | 35 | 0 | I'm starting to use PyQt in some projects and I'm running into a stylistic dilemma. PyQt's functions use camel case, but PEP8, which I prefer to follow, says to use underscores and all lowercase for function names.
So on the one hand, I can continue to follow PEP8, meaning that my code will have mixed functions calls to camel case and underscore functions, and even my classes will have mixed function names, since I'll need to be overloading functions like mousePressEvent. Or, I can break PEP8 and adopt camel case for all my function names in the name of consistency.
I realize this is subjective and it's really just what I personally prefer, but I like to hear from others about what they do and why they chose to do it that way. | PEP8 and PyQt, how to reconcile function capitalization? | 1 | 0 | 0 | 3,416 |
3,647,518 | 2010-09-05T19:46:00.000 | 14 | 0 | 1 | 0 | python,coding-style,pyqt,pyqt4,pep8 | 5,201,198 | 6 | false | 0 | 0 | The pep8 document says what to do in this case (emphasis mine):
New modules and packages (including third party frameworks) should be written to these standards, but where an existing library has a different style, internal consistency is preferred. | 4 | 35 | 0 | I'm starting to use PyQt in some projects and I'm running into a stylistic dilemma. PyQt's functions use camel case, but PEP8, which I prefer to follow, says to use underscores and all lowercase for function names.
So on the one hand, I can continue to follow PEP8, meaning that my code will have mixed functions calls to camel case and underscore functions, and even my classes will have mixed function names, since I'll need to be overloading functions like mousePressEvent. Or, I can break PEP8 and adopt camel case for all my function names in the name of consistency.
I realize this is subjective and it's really just what I personally prefer, but I like to hear from others about what they do and why they chose to do it that way. | PEP8 and PyQt, how to reconcile function capitalization? | 1 | 0 | 0 | 3,416 |
3,647,518 | 2010-09-05T19:46:00.000 | 0 | 0 | 1 | 0 | python,coding-style,pyqt,pyqt4,pep8 | 3,647,955 | 6 | false | 0 | 0 | Maybe sensible use of modules to separate the styles in different modules can help. At least try to modularize basic PEP8 style code to own module of helper functions. | 4 | 35 | 0 | I'm starting to use PyQt in some projects and I'm running into a stylistic dilemma. PyQt's functions use camel case, but PEP8, which I prefer to follow, says to use underscores and all lowercase for function names.
So on the one hand, I can continue to follow PEP8, meaning that my code will have mixed functions calls to camel case and underscore functions, and even my classes will have mixed function names, since I'll need to be overloading functions like mousePressEvent. Or, I can break PEP8 and adopt camel case for all my function names in the name of consistency.
I realize this is subjective and it's really just what I personally prefer, but I like to hear from others about what they do and why they chose to do it that way. | PEP8 and PyQt, how to reconcile function capitalization? | 0 | 0 | 0 | 3,416 |
3,647,692 | 2010-09-05T20:32:00.000 | 18 | 0 | 1 | 0 | python,comparison,equality | 3,647,786 | 4 | false | 0 | 0 | == and is are always conceptually distinct: the former delegates to the left-hand object's __eq__ [1], the latter always checks identity, without any delegation. What seems to be confusing you is that object.__eq__ (which gets inherited by default by user-coded classes that don't override it, of course!) is implemented in terms of identity (after all, a bare object has absolutely nothing to check except its identity, so what else could it possibly do?!-).
[1] omitting for simplicity the legacy concept of the __cmp__ method, which is just a marginal complication and changes nothing important in the paragraph's gist;-). | 1 | 12 | 0 | I noticed I can use the == operator to compare all the native data types (integers, strings, booleans, floating point numbers etc) and also lists, tuples, sets and dictionaries which contain native data types. In these cases the == operator checks if two objects are equal. But in some other cases (trying to compare instances of classes I created) the == operator just checks if the two variables reference the same object (so in these cases the == operator is equivalent to the is operator)
My question is: When does the == operator do more than just comparing identities?
EDIT: I'm using Python 3 | When is the `==` operator not equivalent to the `is` operator? (Python) | 1 | 0 | 0 | 4,561 |
3,648,339 | 2010-09-06T00:04:00.000 | 1 | 0 | 1 | 0 | python,namespaces,module | 3,648,494 | 4 | false | 0 | 0 | Not sure if it is a good practice but maybe you could pass the objects and variables you need as parameters to the methods or classes you call in the imported module. | 1 | 21 | 0 | Specifically, I need to get at some objects and globals from the main module in an imported module. I know how to find those things when the parent module wants some particular thing from a child module, but I can't figure out how to go in the other direction. | In Python, how can I access the namespace of the main module from an imported module? | 0.049958 | 0 | 0 | 8,627 |
3,648,525 | 2010-09-06T01:19:00.000 | 1 | 0 | 0 | 0 | python,web-crawler,http-status-code-403 | 3,648,748 | 1 | true | 0 | 0 | Looks like you've been blacklisted at the router level in that subnet, perhaps because you (or somebody else in the subnet) was violating terms of use, robots.txt, max crawling frequency as specified in a site-map, or something like that.
The solution is not technical, but social: contact the webmaster, be properly apologetic, learn what exactly you (or one of your associates) had done wrong, convincingly promise to never do it again, apologize again until they remove the blacklisting. If you can give that webmaster any reason why they should want to let you crawl that site (e.g., your crawling feeds a search engine that will bring them traffic, or something like this), so much the better!-) | 1 | 0 | 0 | i'm crawling an SNS with crawler written in python
it works for a long time, but few days ago, the webpages got from my severs were ERROR 403 FORBIDDEN.
i tried to change the cookie, change the browser, change the account, but all failed.
and it seems that are the forbidden severs are in the same network segment.
what can i do? steal someone else's ip? = =...
thx a lot | how to crawl a 403 forbidden SNS | 1.2 | 0 | 1 | 2,076 |
3,649,577 | 2010-09-06T06:54:00.000 | 1 | 0 | 0 | 0 | java,python | 6,258,169 | 3 | false | 1 | 1 | Edit the Setup.py and remove the /EHsc option. | 1 | 3 | 0 | I'm having a right old nightmare with JPype. I have got my dev env on Windows and so tried installing it there with no luck. I then tried on Ubunto also with no luck. I'm getting a bit desperate now. I am using Mingw32 since I tried installing VS2008 but it told me I had to install XP SP2 but I am on Vista. I tried VS2010 but no luck, I got the 'error: Unable to find vcvarsall.bat' error. Anyway, I am now on Mingw32
Ultimately I am trying to use Neo4j and Python hence my need to use JPype. I have found so many references to the problem on the net for MySQL etc but they don't help me with JPype.
If I could fix unix or windows I could get going so help on either will be really appreciated.
Here's the versions..
Windows: Vista 64
Python: 2.6
Compiler Mingw32: latest version
Jpype: 0.5.4.1
Java info:
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)
I run:
python setup.py install --compiler=wingw32
and get the following output.
Choosing the Windows profile
running install
running build
running build_py
running build_ext
building '_jpype' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 "-IC:\Program Files (x86)\Java\jdk1.6.0_21/include" "-IC:\Program Files (x86)\Java\jdk1.6.0_21/include/win32" -Isrc/native/common/include -Isrc/native/python/include -Ic:\Python26\include -Ic:\Python26\PC -c src/native/common/jp_array.cpp -o build\temp.win32-2.6\Release\src\native\common\jp_array.o /EHsc
src/native/common/jp_array.cpp: In member function 'void JPArray::setRange(int, int, std::vector&)':
src/native/common/jp_array.cpp:56:13: warning: comparison between signed and unsigned integer expressions
src/native/common/jp_array.cpp:68:4: warning: deprecated conversion from string constant to 'char*'
src/native/common/jp_array.cpp: In member function 'void JPArray::setItem(int, HostRef*)':
src/native/common/jp_array.cpp:80:3: warning: deprecated conversion from string constant to 'char*'
gcc: /EHsc: No such file or directory
error: command 'gcc' failed with exit status 1
So on unix Ubunto the problem is as follows:
Java version: 1.6.0_18
JPype: 0.5.4.1
Python: 2.6
Java is in the path and I did apt-get install build-essentials just now so have latest GCC etc.
I won't paste all the output as it's massive. So many errors it's like I have missed the install of Java or similar but I haven't. typing java takes me into version above. This is the beginning:
running install
running build
running build_py
running build_ext
building '_jpype' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include/linux -Isrc/native/common/include -Isrc/native/python/include -I/usr/include/python2.6 -c src/native/common/jp_javaenv_autogen.cpp -o build/temp.linux-i686-2.6/src/native/common/jp_javaenv_autogen.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
In file included from src/native/common/jp_javaenv_autogen.cpp:21:
src/native/common/include/jpype.h:45:17: error: jni.h: No such file or directory
In file included from src/native/common/jp_javaenv_autogen.cpp:21:
src/native/common/include/jpype.h:77: error: ISO C++ forbids declaration of ‘jchar’ with no type
src/native/common/include/jpype.h:77: error: expected ‘,’ or ‘...’ before ‘’ token
src/native/common/include/jpype.h:82: error: ISO C++ forbids declaration of ‘jchar’ with no type
src/native/common/include/jpype.h:82: error: expected ‘;’ before ‘’ token
src/native/common/include/jpype.h:86: error: ISO C++ forbids declaration of ‘jchar’ with no type
src/native/common/include/jpype.h:86: error: expected ‘;’ before ‘&’ token
src/native/common/include/jpype.h:88: error: expected ‘;’ before ‘private’
src/native/common/include/jpype.h:89: error: ISO C++ forbids declaration of ‘jchar’ with no type
src/native/common/include/jpype.h:89: error: expected ‘;’ before ‘*’ token
In file included from src/native/common/include/jpype.h:96,
from src/native/common/jp_javaenv_autogen.cpp:21:
And this is the end:
src/native/common/include/jp_monitor.h:27: error: ‘jobject’ does not name a type
src/native/common/jp_javaenv_autogen.cpp:30: error: ‘jbyte’ does not name a type
src/native/common/jp_javaenv_autogen.cpp:38: error: ‘jbyte’ does not name a type
src/native/common/jp_javaenv_autogen.cpp:45: error: variable or field ‘SetStaticByteField’ declared void
src/native/common/jp_javaenv_autogen.cpp:45: error: ‘jclass’ was not declared in this scope
src/native/common/jp_javaenv_autogen.cpp:45: error: ‘jfieldID’ was not declared in this scope
src/native/common/jp_javaenv_autogen.cpp:45: error: ‘jbyte’ was not declared in this scope
error: command 'gcc' failed with exit status 1 | JPype compile problems | 0.066568 | 1 | 0 | 3,736 |
3,649,607 | 2010-09-06T06:59:00.000 | 2 | 1 | 0 | 1 | python,performance,caching,bytecode,web2py | 3,649,957 | 2 | false | 1 | 0 | I don't know web2py particularly, but it runs via WSGI like most other Python frameworks. This means that code is only interpreted when the process starts, and is otherwise kept in memory. Processes are dynamically started and killed by the web server itself, but usually last for multiple requests.
In any case, the Python interpreter usually creates a byte-code file, .pyc, when code is first read. This works in a webserver environment just as it does anywhere else.
Finally, however, it is generally considered that code parsing is not particularly a bottleneck - the conversion to bytecode is pretty quick. In a web application, your bottleneck is almost certainly elsewhere (probably in the connection to the database). | 2 | 4 | 0 | If so, What is the advantage ? (sure it will avoid restarting webserver). But isn't it a perfomance bottleneck? For production, is it possible to make web2py run directly from bytecode skipping interpreting stage (Caching) (except for the first request) ? | Is code interpreted at every call in Web2Py? | 0.197375 | 0 | 0 | 814 |
3,649,607 | 2010-09-06T06:59:00.000 | 6 | 1 | 0 | 1 | python,performance,caching,bytecode,web2py | 3,653,081 | 2 | false | 1 | 0 | In web2py, by default, all code in models, views and controllers (not web2py code, not code in modules imported by your models, views, controllers) is interpreted at every request. This allows to use a third party web server (for example apache) and still be able to see changes in your code reflected immediately without restart. PHP works in the same way. The performance penalty is negligible because the time to parse your code is less than the time to execute your code.
Anyway, in the admin interface there is a "compile" button that will bytecode compile your code and collapse the view hierarchy (extended and included views) into a single file per action and remove the performance penalty. It also allows you to distribute your code bytecode compiled without giving away the source. The license allows it. | 2 | 4 | 0 | If so, What is the advantage ? (sure it will avoid restarting webserver). But isn't it a perfomance bottleneck? For production, is it possible to make web2py run directly from bytecode skipping interpreting stage (Caching) (except for the first request) ? | Is code interpreted at every call in Web2Py? | 1 | 0 | 0 | 814 |
3,650,194 | 2010-09-06T09:04:00.000 | 25 | 1 | 0 | 0 | python,performance,numpy | 3,650,761 | 3 | false | 0 | 0 | You should use numpy function to deal with numpy's types and use regular python function to deal with regular python types.
Worst performance usually occurs when mixing python builtins with numpy, because of types conversion. Those type conversion have been optimized lately, but it's still often better to not use them. Of course, your mileage may vary, so use profiling tools to figure out.
Also consider the use of programs like cython or making a C module if you want to optimize further your program. Or consider not to use python when performances matters.
but, when your data has been put into a numpy array, then numpy can be really fast at computing bunch of data. | 1 | 67 | 1 | I have a function defined by a combination of basic math functions (abs, cosh, sinh, exp, ...).
I was wondering if it makes a difference (in speed) to use, for example,
numpy.abs() instead of abs()? | Are NumPy's math functions faster than Python's? | 1 | 0 | 0 | 39,385 |
3,651,031 | 2010-09-06T11:23:00.000 | 1 | 0 | 0 | 0 | python,ruby,unicode,xml-rpc | 3,698,942 | 2 | false | 1 | 0 | This issue comes from Kettle.
My program is using Kettle to get an Excel file, get the active sheet and transfer the data in that sheet to TerminateOOOR for further handling.
At the phase of reading data from Excel file, Kettle can not recognize the encoding then it gives bad data to TerminateOOOR.
My work around solution is manually exporting excel to csv before giving data to TerminateOOOR. By doing this, I don't use the feature to mapping excel column name a variable name (used by kettle). | 1 | 1 | 0 | I have to migrate data to OpenERP through XMLRPC by using TerminatOOOR.
I send a name with value "Rotule right Aurélia".
In Python the name with be encoded with value : 'Rotule right Aur\xc3\xa9lia '
But in TerminatOOOR (xmlrpc client) the data is encoded with value 'Rotule middle Aur\357\277\275lia'
So in the server side, the data value is not decoded correctly and I get bad data.
The terminateOOOR is a ruby plugin for Kettle ( Java product) and I guess it should encode data by utf-8.
I just don't know why it happens like this.
Any help? | Handling unicode data in XMLRPC | 0.099668 | 0 | 1 | 1,981 |
3,651,125 | 2010-09-06T11:38:00.000 | 1 | 0 | 0 | 0 | python,django | 3,651,185 | 1 | false | 1 | 0 | When i click 2nd page it again sending a request. Ideally it should not send the request.
What do you mean by request? Is it a request to Google?
Your application apparently does not cache the results. If your request to Google returns 100 pages then you should cache those hundred. When you request the second page the view should retrieve this cache and return the second page to you.
If you mean request to your app, then @Daniel's comment has it right. You can get around this by sending all the results to the browser and then do the pagination using JavaScript to avoid this.
A more detailed answer is difficult without seeing some code. | 1 | 0 | 0 | My google search application making a request each time while i am using paginator. Suppose i have a 100 records. Each page have to show 10 records so ten pages. When i click 2nd page it again sending a request. Ideally it should not send the request. | going to next page using django paginator sends request again. | 0.197375 | 0 | 0 | 79 |
3,651,609 | 2010-09-06T12:55:00.000 | 5 | 0 | 0 | 1 | python,database,google-app-engine,indexing | 3,651,774 | 2 | true | 1 | 0 | The App Engine SDK tracks this for its automatic index creation. Delete your index.yaml, then give your app a good workout. As long as you hit every distinct query in your testing, the SDK will generate a new index.yaml that contains only the indexes you need. | 1 | 3 | 0 | I have a App Engine/Python/Django application which has grown and been modified over the past year and currently has 175 indexes. The problem is that I have not been thourough in cleaning up/removing indexes that are no longer needed. Now, I am not sure which indexes are active and which are essentially dead, but I am guessing that about 20% of the idexes are useless.
I am curious if there are any App Engine tools available for tracking/counting number of accesses to indexes?
If no tools are available, then one possible idea is to overload the fetch method to track this information everytime an index is accessed, but I am not sure if this is a good idea (could slow things down) and I don't know what the best way to implement this might be.
If anybody has already gone through the experience of cleaning up (searching for) dead indexes, I would be interested in hearing about your experiences. | Google App Engine - Tracking which indexes are used | 1.2 | 0 | 0 | 226 |
3,653,239 | 2010-09-06T17:26:00.000 | 1 | 1 | 0 | 1 | python,django,nginx,subdomain | 3,653,270 | 2 | false | 0 | 0 | I think directories are the way to go. I believe it would be easier to adapt Django to the directories way much easier than to subdomains. And as one user commented you can avoid restarting your server each time.
I prefer to keep subdomains reserved for system use. Users should get their own directories instead. This is not a rule, just my preference. | 2 | 3 | 0 | I'm currently building a web application and I would like my users to have their own URLs to identify them. I could either do this using subdomains or using folders and am wondering what are the advantages and disadvantages of either one.
I really like the folder solution because my URL mapping would be fairly easy. I have read about auto-generating subdomains and one solution was to create virtual hosts and then restart my nginx. It's a solution but I would prefer not to have to restart my web server everytime a new account is created. If there are any other ways on how to do automated subdomain creation, that would be great as well!
Thanks! | Subdomains vs folders/directories | 0.099668 | 0 | 0 | 286 |
3,653,239 | 2010-09-06T17:26:00.000 | 0 | 1 | 0 | 1 | python,django,nginx,subdomain | 3,653,257 | 2 | false | 0 | 0 | Use something like mod_wsgi instead of cgi scripts, they allow you to use arbitrary URL configs (example: Django, web.py, Zope ...) | 2 | 3 | 0 | I'm currently building a web application and I would like my users to have their own URLs to identify them. I could either do this using subdomains or using folders and am wondering what are the advantages and disadvantages of either one.
I really like the folder solution because my URL mapping would be fairly easy. I have read about auto-generating subdomains and one solution was to create virtual hosts and then restart my nginx. It's a solution but I would prefer not to have to restart my web server everytime a new account is created. If there are any other ways on how to do automated subdomain creation, that would be great as well!
Thanks! | Subdomains vs folders/directories | 0 | 0 | 0 | 286 |
3,654,770 | 2010-09-06T23:12:00.000 | 1 | 0 | 1 | 0 | c++,python | 30,151,439 | 6 | false | 0 | 0 | Look at bintrees module (pip install bintrees). This package provides Binary- RedBlack- and AVL-Trees written in Python and Cython/C. | 3 | 29 | 0 | Is there a structure in Python which supports similar operations to C++ STL map and complexity of operations correspond to C++ STL map? | Is there a structure in Python similar to C++ STL map? | 0.033321 | 0 | 0 | 25,127 |
3,654,770 | 2010-09-06T23:12:00.000 | 18 | 0 | 1 | 0 | c++,python | 3,654,782 | 6 | true | 0 | 0 | dict is usually close enough - what do you want that it doesn't do?
If the answer is "provide order", then what's actually wrong with for k in sorted(d.keys())? Uses too much memory, maybe? If you're doing lots of ordered traversals interspersed with inserts then OK, point taken, you really do want a tree.
dict is actually a hash table rather than a b-tree. But then map isn't defined to be a b-tree, so it doesn't let you do things like detaching sub-trees as a new map, it just has the same performance complexities. All that's really left to worry about is what happens to dict when there are large numbers of hash collisions, but it must be pretty rare to use Python in situations where you want tight worst-case performance guarantees. | 3 | 29 | 0 | Is there a structure in Python which supports similar operations to C++ STL map and complexity of operations correspond to C++ STL map? | Is there a structure in Python similar to C++ STL map? | 1.2 | 0 | 0 | 25,127 |
3,654,770 | 2010-09-06T23:12:00.000 | 9 | 0 | 1 | 0 | c++,python | 3,654,778 | 6 | false | 0 | 0 | I believe that the standard python type dict() will do the trick in most cases. The difference from C++'s std::map is that dict is impemented as a hash map and C++'s map is tree-based. | 3 | 29 | 0 | Is there a structure in Python which supports similar operations to C++ STL map and complexity of operations correspond to C++ STL map? | Is there a structure in Python similar to C++ STL map? | 1 | 0 | 0 | 25,127 |
3,654,830 | 2010-09-06T23:29:00.000 | 492 | 0 | 1 | 0 | python,operators | 3,654,936 | 21 | true | 0 | 0 | It's not because it doesn't make sense; it makes perfect sense to define "x++" as "x += 1, evaluating to the previous binding of x".
If you want to know the original reason, you'll have to either wade through old Python mailing lists or ask somebody who was there (eg. Guido), but it's easy enough to justify after the fact:
Simple increment and decrement aren't needed as much as in other languages. You don't write things like for(int i = 0; i < 10; ++i) in Python very often; instead you do things like for i in range(0, 10).
Since it's not needed nearly as often, there's much less reason to give it its own special syntax; when you do need to increment, += is usually just fine.
It's not a decision of whether it makes sense, or whether it can be done--it does, and it can. It's a question of whether the benefit is worth adding to the core syntax of the language. Remember, this is four operators--postinc, postdec, preinc, predec, and each of these would need to have its own class overloads; they all need to be specified, and tested; it would add opcodes to the language (implying a larger, and therefore slower, VM engine); every class that supports a logical increment would need to implement them (on top of += and -=).
This is all redundant with += and -=, so it would become a net loss. | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 1.2 | 0 | 0 | 319,375 |
3,654,830 | 2010-09-06T23:29:00.000 | 0 | 0 | 1 | 0 | python,operators | 71,851,212 | 21 | false | 0 | 0 | This is not the answer, (just a log from me) but I believe: it should be there.
It is true that there is a python way of doing things and it is not needed for loop counters, However: there are few cases where one needs to manipulate other variable besides the one which is looping.
Looking at views for this thread.. there definitely is a use case.
We need lobbying to get this feature in... although I don't see that fructifying for a long long time. In the mean time: is there a way to do operator overloading to imitate ++? | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 0 | 0 | 0 | 319,375 |
3,654,830 | 2010-09-06T23:29:00.000 | 1 | 0 | 1 | 0 | python,operators | 3,654,981 | 21 | false | 0 | 0 | Maybe a better question would be to ask why do these operators exist in C. K&R calls increment and decrement operators 'unusual' (Section 2.8page 46). The Introduction calls them 'more concise and often more efficient'. I suspect that the fact that these operations always come up in pointer manipulation also has played a part in their introduction.
In Python it has been probably decided that it made no sense to try to optimise increments (in fact I just did a test in C, and it seems that the gcc-generated assembly uses addl instead of incl in both cases) and there is no pointer arithmetic; so it would have been just One More Way to Do It and we know Python loathes that. | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 0.009524 | 0 | 0 | 319,375 |
3,654,830 | 2010-09-06T23:29:00.000 | 68 | 0 | 1 | 0 | python,operators | 3,661,417 | 21 | false | 0 | 0 | I always assumed it had to do with this line of the zen of python:
There should be one — and preferably only one — obvious way to do it.
x++ and x+=1 do the exact same thing, so there is no reason to have both. | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 1 | 0 | 0 | 319,375 |
3,654,830 | 2010-09-06T23:29:00.000 | 17 | 0 | 1 | 0 | python,operators | 3,655,022 | 21 | false | 0 | 0 | Because, in Python, integers are immutable (int's += actually returns a different object).
Also, with ++/-- you need to worry about pre- versus post- increment/decrement, and it takes only one more keystroke to write x+=1. In other words, it avoids potential confusion at the expense of very little gain. | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 1 | 0 | 0 | 319,375 |
3,654,830 | 2010-09-06T23:29:00.000 | 6 | 0 | 1 | 0 | python,operators | 3,654,980 | 21 | false | 0 | 0 | I'm very new to python but I suspect the reason is because of the emphasis between mutable and immutable objects within the language. Now, I know that x++ can easily be interpreted as x = x + 1, but it LOOKS like you're incrementing in-place an object which could be immutable.
Just my guess/feeling/hunch. | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 1 | 0 | 0 | 319,375 |
3,654,830 | 2010-09-06T23:29:00.000 | 2 | 0 | 1 | 0 | python,operators | 21,724,247 | 21 | false | 0 | 0 | The ++ class of operators are expressions with side effects. This is something generally not found in Python.
For the same reason an assignment is not an expression in Python, thus preventing the common if (a = f(...)) { /* using a here */ } idiom.
Lastly I suspect that there operator are not very consistent with Pythons reference semantics. Remember, Python does not have variables (or pointers) with the semantics known from C/C++. | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 0.019045 | 0 | 0 | 319,375 |
3,654,830 | 2010-09-06T23:29:00.000 | 1 | 0 | 1 | 0 | python,operators | 17,702,839 | 21 | false | 0 | 0 | as i understood it so you won't think the value in memory is changed.
in c when you do x++ the value of x in memory changes.
but in python all numbers are immutable hence the address that x pointed as still has x not x+1. when you write x++ you would think that x change what really happens is that x refrence is changed to a location in memory where x+1 is stored or recreate this location if doe's not exists. | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 0.009524 | 0 | 0 | 319,375 |
3,654,830 | 2010-09-06T23:29:00.000 | 3 | 0 | 1 | 0 | python,operators | 3,657,707 | 21 | false | 0 | 0 | I believe it stems from the Python creed that "explicit is better than implicit". | 9 | 493 | 0 | Why are there no ++ and -- operators in Python? | Why are there no ++ and -- operators in Python? | 0.028564 | 0 | 0 | 319,375 |
3,655,306 | 2010-09-07T02:06:00.000 | 7 | 0 | 0 | 1 | python,ubuntu-9.04 | 66,512,967 | 7 | false | 0 | 0 | @mchid's answer is the one you should go for it.
just FYI,
if you do this:
$ python
it will say Command 'python' not found ...
But if you do this:
$ python3, it should work.
So, just modify the shebang line
from !#/usr/bin/env python
to !#/usr/bin/env python3, you're good to go.
(which is automatically done by doing
sudo apt install python-is-python3) | 1 | 91 | 0 | I update the kernel, after that the Ubuntu doesn't work well, PS: I try to exec "meld" command, it will report that "/usr/bin/env: python: No such file or directory",
then I exec "sudo apt-get install python" and get the result "python is already the newest version.", what should I do for it.
I'm not good at linux, can you tell me how to revert my linux to the last right status, or reinstall the python normally. | ubuntu /usr/bin/env: python: No such file or directory | 1 | 0 | 0 | 161,757 |
3,656,500 | 2010-09-07T07:16:00.000 | 0 | 1 | 0 | 1 | python | 3,656,550 | 3 | false | 0 | 0 | Just some basic ideas, with important python functions for that:
read the file; open
go through all lines and sum up the number of occurences of a line; for, dict
in case you only want to check parts of a command (for example treat cd XY and cd .. the same), normalize the lines by removing the command arguments after the space; split
sort the sums and print out the command with the highest sum. | 1 | 1 | 0 | I want to write a python script which reads the '.bash_history' file and prints the statistics. Also, I would like to print the command which was used the most. I was able to read the bash history through the terminal but I'm not able to do it through python programming. Can someone please help me with how to start with it? | reading .bash_history file through python script | 0 | 0 | 0 | 696 |
3,657,165 | 2010-09-07T08:51:00.000 | 1 | 1 | 0 | 0 | python | 3,657,249 | 3 | false | 0 | 0 | grep your codebase for from xml import or import xml. | 1 | 2 | 0 | I have a python code base and want to know whether pyxml is really used in the code any where. The python version i have is 2.6. pyxml's last binary distribution ended with 2.4 python version. Any clues or ideas to judge the code whether it is free of pyxml 0.8.4 on python 2.6 ?
Thanks in Advance. | Best way to know that my Python Code base is using PyXML or not? | 0.066568 | 0 | 0 | 364 |
3,657,271 | 2010-09-07T09:07:00.000 | 1 | 0 | 0 | 1 | python,sql-server,twisted | 4,059,366 | 2 | false | 0 | 0 | If you want to have portable mssql server library, you can try the module from www.pytds.com.
It works with 2.5+ and 3.1, have a good stored procedure support. It's api is more "functional", and has some good features you won't find anywhere else. | 1 | 0 | 0 | I have a Twisted application that runs in an x86 64bit machine with Win 2008 server.
It needs to be connected to a SQL Server database that runs in another machine (in a cloud actually but I have IP, port, db name, credentials).
Do I need to install anything more that Twisted to my machine?
And which API should be used? | Twisted and connection to SQL Server | 0.099668 | 1 | 0 | 1,128 |
3,657,955 | 2010-09-07T10:51:00.000 | 2 | 0 | 1 | 1 | python,debugging,command-line,runpy | 3,658,022 | 4 | false | 0 | 0 | Do you have control over another.py? It would be a good idea to change it and add a main() method. Main() can then be invoked if __name__ == '__main__'. This will alleviate your problems a great deal. It is also unit testing friendly. | 1 | 11 | 0 | You have wrapper python script that is calling another python script, currently using os.system('python another.py some-params').
You want to be able to debug both scripts and if you use os.system() you'll loose the debugger, so it does make sense to load the second script using the same interpretor instead of starting another one.
import doesn't to the expected thing because it does not run the __main__.
Other variants, like exec() or runpy seams to miss the argv parameters.
What solution do you see for this issue?
I'm looking for a solution that does not require you to modify the another.py script. Probably this will require to modify the sys.argv before executing it. | How to execute another python script from your script and be able to debug? | 0.099668 | 0 | 0 | 7,883 |
3,659,382 | 2010-09-07T14:07:00.000 | 1 | 0 | 0 | 1 | python,windows,streaming,gstreamer | 3,661,651 | 2 | true | 0 | 0 | For Windows streaming, I would suggest VLC. | 1 | 0 | 0 | I very new to the world of gstreamer. I was wondering, if it's possible to stream windows webcam via gstreamer? The only package i have seen so far is for linux. v4l2 (video for linux).
Is there also a package for windows webcams? what is the correct python syntax?
DJ | Is it possible to stream a windows (7 / vista / xp) webcams via Gstreamer | 1.2 | 0 | 0 | 1,416 |
3,659,687 | 2010-09-07T14:41:00.000 | 1 | 0 | 0 | 0 | php,python,ruby-on-rails,django,zend-framework | 3,660,249 | 7 | false | 1 | 0 | A web framework is supposed to provide means to handle certain kind of interaction. If you have site with no interaction or no "adaptation", you don't need either framework or programming language, you simply write HTML files and publish your files.
As you start to add features for the back-end (like publishing more plain pages) or in the front end (like sorting a list when the user clicks "order by") you start getting into frameworks/programming languages.
Basic interaction was handled with CGI - you write an script which responds with a string to a few parameters passed via a form. Then you have database access.
In my experience, if you need simple features AND want your website to be suitable for growth without resorting to rewriting it from scratch, you should start from a web framework like Django. You can do simple things quite easily in Django (granted - it is not trivial) and add very complex behavior with small, incremental steps. | 6 | 3 | 0 | When a Web framework ( like django, ruby on rails, zend, etc ) isn't convenient to use ?
And so... When a Web programming language ( like PHP, Asp, Python, etc ) is better than a Web Framework ? | When a Web framework isn't convenient to use? | 0.028564 | 0 | 0 | 295 |
3,659,687 | 2010-09-07T14:41:00.000 | 0 | 0 | 0 | 0 | php,python,ruby-on-rails,django,zend-framework | 3,659,996 | 7 | false | 1 | 0 | I'm at that stage where, because I spent so much time learning a framework recently, even if I do a one page "website", I will still use one, need to get my ROI up :p | 6 | 3 | 0 | When a Web framework ( like django, ruby on rails, zend, etc ) isn't convenient to use ?
And so... When a Web programming language ( like PHP, Asp, Python, etc ) is better than a Web Framework ? | When a Web framework isn't convenient to use? | 0 | 0 | 0 | 295 |
3,659,687 | 2010-09-07T14:41:00.000 | 0 | 0 | 0 | 0 | php,python,ruby-on-rails,django,zend-framework | 3,659,760 | 7 | false | 1 | 0 | When you have to build a very complex site, and the functionality is already exists in a CMS (eg Drupal, it has amazingly lot contrib for everything). | 6 | 3 | 0 | When a Web framework ( like django, ruby on rails, zend, etc ) isn't convenient to use ?
And so... When a Web programming language ( like PHP, Asp, Python, etc ) is better than a Web Framework ? | When a Web framework isn't convenient to use? | 0 | 0 | 0 | 295 |
3,659,687 | 2010-09-07T14:41:00.000 | 1 | 0 | 0 | 0 | php,python,ruby-on-rails,django,zend-framework | 3,659,776 | 7 | false | 1 | 0 | The rule that I have is that if whatever I'm building is only going to be a single page, I'll usually do it in just PHP. Whenever I need more than one page, I go with a framework (Symfony), because that usually means that I'm going to want things like routing and proper dispatching of requests.
This does however depend a lot on the language. In languages like PHP, the time needed to set up a project to use an MVC framework may be a lot more than just solving the problem. Other languages may very well be designed around using an MVC framework, and has a very low setup cost for that. | 6 | 3 | 0 | When a Web framework ( like django, ruby on rails, zend, etc ) isn't convenient to use ?
And so... When a Web programming language ( like PHP, Asp, Python, etc ) is better than a Web Framework ? | When a Web framework isn't convenient to use? | 0.028564 | 0 | 0 | 295 |
3,659,687 | 2010-09-07T14:41:00.000 | 3 | 0 | 0 | 0 | php,python,ruby-on-rails,django,zend-framework | 3,659,712 | 7 | false | 1 | 0 | You don't need frameworks when you don't plan to use their features. | 6 | 3 | 0 | When a Web framework ( like django, ruby on rails, zend, etc ) isn't convenient to use ?
And so... When a Web programming language ( like PHP, Asp, Python, etc ) is better than a Web Framework ? | When a Web framework isn't convenient to use? | 0.085505 | 0 | 0 | 295 |
3,659,687 | 2010-09-07T14:41:00.000 | 1 | 0 | 0 | 0 | php,python,ruby-on-rails,django,zend-framework | 3,659,725 | 7 | false | 1 | 0 | The difference is, in my opinion, the simpleness of what you are trying to build.
Are you trying to make a difficult, complicated web app, or are you making a simple script that performs a trivial task? In the first case you absolutely need a framework, in the second case.. don't even bother. | 6 | 3 | 0 | When a Web framework ( like django, ruby on rails, zend, etc ) isn't convenient to use ?
And so... When a Web programming language ( like PHP, Asp, Python, etc ) is better than a Web Framework ? | When a Web framework isn't convenient to use? | 0.028564 | 0 | 0 | 295 |
3,660,503 | 2010-09-07T16:17:00.000 | 2 | 1 | 1 | 0 | python | 3,660,592 | 2 | false | 0 | 0 | This is pretty much the same as for any language.
What projects have you done with Python?
What is your favorite Python reference?
Have you worked with other people on code written in Python?
That's how I would judge. If I wanted to test, it would depend on whether I were looking for someone to write in 2.x or 3.x. Since I'm familiar with the 2.x stuff...
How would you create a list containing the result of [insert operation] on another list?
How would you do the above if you cared about memory usage?
What tool do you use to debug your Python code?
CW'd because the question should be. | 2 | 0 | 0 | If you had to judge someones level of Python understand in just 3 questions, what would you ask? | Top 3 questions to test someones Python level, what would they be? | 0.197375 | 0 | 0 | 1,711 |
3,660,503 | 2010-09-07T16:17:00.000 | 1 | 1 | 1 | 0 | python | 3,660,564 | 2 | false | 0 | 0 | Explain generators.
Write unit tests for <important-piece-of-code>.
Who is Alex Martelli? | 2 | 0 | 0 | If you had to judge someones level of Python understand in just 3 questions, what would you ask? | Top 3 questions to test someones Python level, what would they be? | 0.099668 | 0 | 0 | 1,711 |
3,661,827 | 2010-09-07T19:06:00.000 | 1 | 0 | 0 | 0 | ironpython | 3,661,888 | 2 | false | 1 | 0 | I would definitely try to limit the number of script engines you instantiate. It is a slow process (from my experience), so the fewer times you have to wait for it, the better.
On that note, I would be careful with only 1. I think that scripts might (just might) have the potential to interfere with eachother if you have 1. I'm not sure, but just be careful. | 2 | 3 | 0 | Generally speaking, should I keep one ScriptEngine for the life of the application or should I create and destroy them as needed? | IronPython: How many script engines should I have? | 0.099668 | 0 | 0 | 401 |
3,661,827 | 2010-09-07T19:06:00.000 | 3 | 0 | 0 | 0 | ironpython | 3,664,939 | 2 | true | 1 | 0 | One ScriptEngine per AppDomain is fine. To isolate your scripts, make sure that each one is executed in its own ScriptScope. By reusing the ScriptEngine, IronPython won't have to recompile any imported modules, which is generally the slowest part of IronPython, especially if they are short-running scripts. | 2 | 3 | 0 | Generally speaking, should I keep one ScriptEngine for the life of the application or should I create and destroy them as needed? | IronPython: How many script engines should I have? | 1.2 | 0 | 0 | 401 |
3,662,134 | 2010-09-07T19:47:00.000 | 4 | 0 | 0 | 0 | python,oop | 3,662,258 | 3 | false | 0 | 0 | It's propably just me and my FP fetish, but I think a function executed solely for side effects is very different from a non-destructive function that fetches some data, and therefore have different names. Especially if the generic function would do something different depending on exactly that (the part on the commit parameter seems to imply that).
As for how to return results... I'm a huge fan of generators, but if the library you use for database connections returns a list anyway, you might as well pass this list on - a generator wouldn't buy you anything in this case. But if it allows you to iterate over the results (one at a time), seize the opportunity to save a lot of memory on larger queries. | 1 | 3 | 0 | I'm creating a basic database utility class in Python. I'm refactoring an old module into a class. I'm now working on an executeQuery() function, and I'm unsure of whether to keep the old design or change it. Here are the 2 options:
(The old design:) Have one generic executeQuery method that takes the query to execute and a boolean commit parameter that indicates whether to commit (insert, update, delete) or not (select), and determines with an if statement whether to commit or to select and return.
(This is the way I'm used to, but that might be because you can't have a function that sometimes returns something and sometimes doesn't in the languages I've worked with:) Have 2 functions, executeQuery and executeUpdateQuery (or something equivalent). executeQuery will execute a simple query and return a result set, while executeUpdateQuery will make changes to the DB (insert, update, delete) and return nothing.
Is it accepted to use the first way? It seems unclear to me, but maybe it's more Pythonistic...? Python is very flexible, maybe I should take advantage of this feature that can't really be accomplished in this way in more strict languages...
And a second part of this question, unrelated to the main idea - what is the best way to return query results in Python? Using which function to query the database, in what format...? | Design question in Python: should this be one generic function or two specific ones? | 0.26052 | 1 | 0 | 174 |
3,662,475 | 2010-09-07T20:30:00.000 | 1 | 0 | 1 | 0 | python | 3,666,355 | 12 | false | 0 | 0 | Python does not have arrays. It has other sequence types ranging from lists to dictionaries without forgetting sets - the right one depends on your specific needs.
Assuming your "array" is actually a list, and "initialize" means allocate a list of lists of NxM elements, you can (pseudocode):
for N times: for M times: add an element
for N times: add a row of M elements
write the whole thing out
You say you don't want to loop and that rules out the first two points, but why?
You also say you don't want to write the thing down (in response to JacobM), so how would you exactly do that? I don't know of any other way of getting a data structure without either generating it in smaller pieces (looping) or explicitly writing it down - in any programming language.
Also keep in mind that a initialized but empty list is no better than no list, unless you put data into it. And you don't need to initialize it before putting data...
If this isn't a theoretical exercise, you're probably asking the wrong question. I suggest that you explain what do you need to do with that array. | 1 | 9 | 0 | Is there a way in Python to initialize a multi-dimensional array / list without using a loop? | Python multi-dimensional array initialization without a loop | 0.016665 | 0 | 0 | 31,050 |
3,664,016 | 2010-09-08T01:27:00.000 | 1 | 1 | 0 | 0 | php,c++,python,web-crawler | 3,664,065 | 7 | false | 0 | 0 | You could consider using a combination of python and PyGtkMozEmbed or PyWebKitGtk plus javascript to create your spider.
The spidering could be done in javascript after the page and all other scripts have loaded.
You'd have one of the few web spiders that supports javascript, and might pick up some hidden stuff the others don't see :) | 4 | 3 | 0 | I have substantial PHP experience, although I realize that PHP probably isn't the best language for a large-scale web crawler because a process can't run indefinitely. What languages do people suggest? | What languages are good for writing a web crawler? | 0.028564 | 0 | 1 | 6,849 |
3,664,016 | 2010-09-08T01:27:00.000 | -3 | 1 | 0 | 0 | php,c++,python,web-crawler | 3,664,086 | 7 | false | 0 | 0 | C# and C++ are probably the best two languages for this, it's just a matter of which you know better and which is faster (C# is probably easier).
I wouldn't recommend Python, Javascript, or PHP. They will usually be slower in text processing compared to a C-family language. If you're looking to crawl any significant chunk of the web, you'll need all the speed you can get.
I've used C# and the HtmlAgilityPack to do so before, it works relatively well and is pretty easy to pick up. The ability to use a lot of the same commands to work with HTML as you would XML makes it nice (I had experience working with XML in C#).
You might want to test the speed of available C# HTML parsing libraries vs C++ parsing libraries. I know in my app, I was running through 60-70 fairly messy pages a second and pulling a good bit of data out of each (but that was a site with a pretty constant layout).
Edit: I notice you mentioned accessing a database. Both C++ and C# have libraries to work with most common database systems, from SQLite (which would be great for a quick crawler on a few sites) to midrange engines like MySQL and MSSQL up to the bigger DB engines (I've never used Oracle or DB2 from either language, but it's possible). | 4 | 3 | 0 | I have substantial PHP experience, although I realize that PHP probably isn't the best language for a large-scale web crawler because a process can't run indefinitely. What languages do people suggest? | What languages are good for writing a web crawler? | -0.085505 | 0 | 1 | 6,849 |
3,664,016 | 2010-09-08T01:27:00.000 | 6 | 1 | 0 | 0 | php,c++,python,web-crawler | 3,664,054 | 7 | false | 0 | 0 | Any language you can easily use with a good network library and support for parsing the formats you want to crawl. Those are really the only qualifications. | 4 | 3 | 0 | I have substantial PHP experience, although I realize that PHP probably isn't the best language for a large-scale web crawler because a process can't run indefinitely. What languages do people suggest? | What languages are good for writing a web crawler? | 1 | 0 | 1 | 6,849 |
3,664,016 | 2010-09-08T01:27:00.000 | 0 | 1 | 0 | 0 | php,c++,python,web-crawler | 3,664,049 | 7 | true | 0 | 0 | C++ - if you know what you're doing. You will not need a web server and a web application, because a web crawler is just a client, after all. | 4 | 3 | 0 | I have substantial PHP experience, although I realize that PHP probably isn't the best language for a large-scale web crawler because a process can't run indefinitely. What languages do people suggest? | What languages are good for writing a web crawler? | 1.2 | 0 | 1 | 6,849 |
3,664,438 | 2010-09-08T03:23:00.000 | 2 | 1 | 0 | 0 | python,email,smtp,vmware | 3,668,622 | 1 | true | 0 | 0 | The phrase "...because the target machine actively refused it" usually means there's a firewall that drops any unauthorized connections. Is there a firewall service on the SMTP server that's blocking the WinXP VM's IP address?
Or, more likely: Is the SMTP server not configured to accept relays from the WinXP VM's IP address? | 1 | 1 | 0 | I m trying to use smtp class from Python 2.6.4 to send smtp email from a WinXP VMware machine.
After the send method is called, I always got this error:
socket.error: [Errno 10061] No connection could be made because the target machine actively refused it.
Few stuff I noticed:
The same code works in the physical WinXP machine with user in/not in the domain, connected to the same smtp server.
If I use the smtp server which is setup in the same VM machine, then it works.
Any help is appreciate! | Python smtp connection is always failed in a VMware Windows machine | 1.2 | 0 | 1 | 828 |
3,664,519 | 2010-09-08T03:48:00.000 | 0 | 0 | 0 | 0 | python,django,security,permissions,chat | 3,664,632 | 1 | false | 1 | 0 | I think I could just make a room model with a ManytoMany Field indicating users, a queue for the chat history, and as users leave, I'd just remove their username from that model. So, when submitting post requests, I could just use the cookie in django.contrib.auth for sessions to validate data transfer. I think that should be secure, so that illegal users can't generate their own post request for the data. | 1 | 1 | 0 | If I wanted to implement some sort of chat tool in my django webapp, implemented with basic ajax polling as opposed to comet, what should I do to secure it, besides running over SSL. Should I just use the permissions app for each chat session and generate a random token to be accessed in my urlconf? Are there better/different approaches to this sort of thing? | Django Permissions and Security for Basic Chat App | 0 | 0 | 0 | 154 |
3,665,656 | 2010-09-08T07:55:00.000 | 17 | 1 | 1 | 0 | python,ruby,oop | 3,665,937 | 4 | false | 0 | 0 | One example that's commonly given is len, which in Python is a built-in function. You may implement a special __len__ method in your objects which will be called by len, but len is still a function. In Ruby, objects just have the .length property/method so it appears more object oriented when you say obj.length rather than len(obj) although deep under the hood pretty much the same thing happens.
That said, over the years Python have moved towards more object-orientation. Currently all objects (and implicitly user-defined objects) inherit from the object class. Meta-classes have also been added, and many of the built-in and core library classes have been organized into hierarchies with the help of ABCs (Abstract Base Classes).
In my heavy usage of Python I have never found it lacking in the OO department. It can do everything I want it to do with objects. True, Ruby feels somewhat more purely OO, but at least in my experience this hasn't been a really practical concern. | 2 | 23 | 0 | Matz, who invented Ruby, said that he designed the language to be more object-oriented than Python. How is Ruby more object-oriented than Python? | How is Ruby more object-oriented than Python? | 1 | 0 | 0 | 5,970 |
3,665,656 | 2010-09-08T07:55:00.000 | -2 | 1 | 1 | 0 | python,ruby,oop | 3,666,873 | 4 | false | 0 | 0 | It's simple, nearly everything in Ruby (including numbers) is an object; there are no scalar values. | 2 | 23 | 0 | Matz, who invented Ruby, said that he designed the language to be more object-oriented than Python. How is Ruby more object-oriented than Python? | How is Ruby more object-oriented than Python? | -0.099668 | 0 | 0 | 5,970 |
3,666,328 | 2010-09-08T09:31:00.000 | 0 | 0 | 0 | 0 | python,string,sqlite,unicode | 25,273,292 | 3 | false | 0 | 0 | Use Python 3.2+. It will automatically return string instead of unicode (as in Python 2.7) | 2 | 3 | 0 | AFAIK SQLite returns unicode objects for TEXT in Python. Is it possible to get SQLite to return string objects instead? | Can I get SQLite to string instead of unicode for TEXT in Python? | 0 | 1 | 0 | 7,275 |
3,666,328 | 2010-09-08T09:31:00.000 | 4 | 0 | 0 | 0 | python,string,sqlite,unicode | 3,666,433 | 3 | false | 0 | 0 | TEXT is intended to store text. Use BLOB if you want to store bytes. | 2 | 3 | 0 | AFAIK SQLite returns unicode objects for TEXT in Python. Is it possible to get SQLite to return string objects instead? | Can I get SQLite to string instead of unicode for TEXT in Python? | 0.26052 | 1 | 0 | 7,275 |
3,666,676 | 2010-09-08T10:17:00.000 | 0 | 0 | 0 | 0 | python,single-sign-on,plone,zope | 3,698,638 | 2 | false | 1 | 0 | If both sites are on the same domain (but different subdomain), you can try to set the cookie on ".domain.tld". But I'm not sure if that will work - sending the original credentials as cookies is highly insecure, a session should be used in stead, and you can't share this session between two different instances.
Have you considered something like openid, possibly with your own private OpenID provider? That basically implements simple SSO out of the box. | 1 | 2 | 0 | I'm installing an environment where I had two Zope/Plone servers:
plone1 -> for web content & user authentication
plone2 -> for web applications
I want to implement SSO around both servers but I don't know how to do it. I try to modify login_next and setAuthCookie(..) to share the __ac cookie in the domain, but didn't work.
Anyone know the best way to achieve it!
Thanks in advance,
Oscar Sánchez. | Two Zope/Plone machines and SSO | 0 | 0 | 0 | 560 |
3,666,750 | 2010-09-08T10:27:00.000 | 0 | 0 | 1 | 0 | python,version,backwards-compatibility | 3,668,628 | 2 | false | 0 | 0 | Mac OS X 10.6 (Snow Leopard) has 2.6.1 as the installed version.
IIRC, 10.5 (Leopard) has 2.5 as the installed version. | 1 | 5 | 0 | Is there an officially updated recommendation indicating which versions of Python should be supported by released modules? Or perhaps a page giving a survey of production usage of various versions? It's difficult to know how much use to make of newish features like context managers, class decorators, etc. when writing a module.
Note that learning which versions of Python are in common usage now is only part of my question; I'd like to find a resource which will provide up-to-date information for future readers of this thread (and myself). | earliest commonly used version of Python | 0 | 0 | 0 | 323 |
3,668,373 | 2010-09-08T13:50:00.000 | 2 | 0 | 1 | 0 | python,dll,static-libraries | 3,668,484 | 4 | false | 0 | 0 | Unfortunately, no. Dynamic Link Libraries are required for runtime loading. | 2 | 9 | 0 | is it possible to import modules from .lib library to Python program (as simple as .dll)? | Static library (.lib) to Python project | 0.099668 | 0 | 0 | 8,992 |
3,668,373 | 2010-09-08T13:50:00.000 | 4 | 0 | 1 | 0 | python,dll,static-libraries | 3,677,075 | 4 | false | 0 | 0 | In theory, yes; in practice, probably not -- and certainly not as simply as a DLL. Static libraries are essentially just collections of object files, and need a full linker to correctly resolve all relocation references they may contain. It might be possible to take your static library and simply link its contents to form a shared library, but that would require that the static library had been built as position independent code (PIC), which is not guaranteed. In theory there's no reason the work a full linker would do to link the library couldn't be done at runtime, but in practice there's no off-the-shelf code for doing so. Your best real option is probably to track down the source or a shared version of the library. | 2 | 9 | 0 | is it possible to import modules from .lib library to Python program (as simple as .dll)? | Static library (.lib) to Python project | 0.197375 | 0 | 0 | 8,992 |
3,671,466 | 2010-09-08T20:06:00.000 | 0 | 0 | 0 | 1 | python,linux,binary,compilation | 3,674,482 | 3 | false | 0 | 0 | In linux, try to avoid such things. Most package managers handle dependencies quite fine, just distribute your script and tell what dependencies it needs. | 1 | 7 | 0 | So I have a python script that relies on a couple modules. Specifically pexpect and pyinoitify. I know you can compile a python script into a .exe in windows, but is there something relatively equivalent in linux? I don't care about it being a binary, I'd just like to be able to distribute my script without requiring the separate installation of pexpect and pyinotify. Is that possible/worthwhile? | compile python script in linux | 0 | 0 | 0 | 12,788 |
3,671,535 | 2010-09-08T20:14:00.000 | 2 | 0 | 0 | 1 | python,pylons,cassandra | 3,687,133 | 2 | true | 0 | 0 | Well. I worked a little more. In fact, using a connection manager was probably not a good idea as this should be the template context. Additionally, opening a connection for each thread is not really a big deal. Opening a connection per request would be.
I ended up with just pycassa.connect_thread_local() in app_globals, and there I go. | 1 | 10 | 0 | I created a new Pylons project, and would like to use Cassandra as my database server. I plan on using Pycassa to be able to use cassandra 0.7beta.
Unfortunately, I don't know where to instantiate the connection to make it available in my application.
The goal would be to :
Create a pool when the application is launched
Get a connection from the pool for each request, and make it available to my controllers and libraries (in the context of the request). The best would be to get a connexion from the pool "lazily", i.e. only if needed
If a connexion has been used, release it when the request has been processed
Additionally, is there something important I should know about it ? When I see some comments like "Be careful when using a QueuePool with use_threadlocal=True, especially with retries enabled. Synchronization may be required to prevent the connection from changing while another thread is using it.", what does it mean exactly ?
Thanks.
--
Pierre | How to connect to Cassandra inside a Pylons app? | 1.2 | 1 | 0 | 885 |
3,672,330 | 2010-09-08T22:19:00.000 | 5 | 0 | 1 | 0 | python,list,trim | 3,672,351 | 4 | false | 0 | 0 | Is that a list of strings or tuples? Assuming they're tuples:
[t[0] for t in [('ABC', ), ('Abc', ), ('xyz', ), ('ABC', ), ('Abc', )]] | 1 | 0 | 0 | I have this:
Lt = [('ABC', ), ('Abc', ), ('xyz', ),
('ABC', ), ('Abc', )]
I want this:
Lt = ('Abc', 'Abc', 'xyz', 'ABC', 'ABc')
remove the extra "(",")" and ",".... How do i do this. | Python: Trim a list | 0.244919 | 0 | 0 | 1,820 |
3,673,418 | 2010-09-09T02:43:00.000 | 0 | 0 | 0 | 0 | python,wxpython | 3,677,070 | 2 | false | 0 | 1 | I usually use my close button's event handler to close connections and what-not before closing the frame. If you want to catch the upper right "x" button, then you'll need to bind to EVT_CLOSE. Unfortunately, when you do that, you need to call your frame's Destroy() method rather than its Close() method or you'll end up in an infinite loop. | 1 | 2 | 0 | I'm working on a wxPython app which has multiple frames and a serial connection. I need to be able to exit the app cleanly, closing the serial connection as the app terminates.
What is the best way to do this? Should this be handled by a subclass of wxApp?
Thanks,
Josh | Terminating a wxPython app cleanly | 0 | 0 | 0 | 1,263 |
3,673,487 | 2010-09-09T03:04:00.000 | 15 | 0 | 1 | 0 | python | 3,673,678 | 11 | true | 0 | 0 | I'd say the main reason is because Python isn't horribly verbose like, e.g., Java. You don't need an IDE to generate 100s of lines of boilerplate because you don't need 100s of lines of boilerplate in Python. You tend to automate stuff within the language instead of further up the toolchain.
A second reason is that you don't need build process automation b/c there's no build process. | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 1.2 | 0 | 0 | 3,313 |
3,673,487 | 2010-09-09T03:04:00.000 | 1 | 0 | 1 | 0 | python | 3,673,779 | 11 | false | 0 | 0 | Python uses dynamic typing and interpreting, rather than compiling.
The interpreter itself will output comprehensive error messages, similar to Perl.
If you look at dynamically typed programming languages in general, you'll find that most of them are not really suitable for IDEs. RAD components (code completion, code generation, code templates, etc) can be included in almost any smart text editor, like Vim, Emacs, Gedit, or SciTE.
I use Vim and Gedit for most of my programming, and I find, that I don't need IDE-ish stuff other than that, what is already included in those text editors. When I program in Java, however, I use Eclipse most of the time, since keeping track of all those parts manually, would be too time consuming. I tend not to use IDE's for my C++ stuff, too, but when the projects grows beyond a certain size, I tend to use either Eclipse (CDT), NetBeans, Code::Blocks, or something like that.
So it's the family of languages itself, that make IDE's unnecessary, but it doesn't mean that working with IDE's with those languages, is bad practice.
Side Note: There's even a Lua environment for Eclipse. Out of all languages, Lua is probably one of the least that needs an IDE... | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 0.01818 | 0 | 0 | 3,313 |
3,673,487 | 2010-09-09T03:04:00.000 | 1 | 0 | 1 | 0 | python | 3,673,506 | 11 | false | 0 | 0 | Python is dynamically typed and the way it handles modules as objects makes it impossible to determine what a name will resolve to at a certain time without actually running the code. Therefore, the 'tab completion' feature of IDEs is pretty useless.
Also, since Python doesn't have a build step, an IDE isn't needed to automate this. You can just fire up python app.py in a terminal and have much more control over how it runs. | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 0.01818 | 0 | 0 | 3,313 |
3,673,487 | 2010-09-09T03:04:00.000 | 0 | 0 | 1 | 0 | python | 3,673,557 | 11 | false | 0 | 0 | Well I use an IDE when programming in Python on my computer. Its easier that way . But when on the run or on university's terminal , I prefer terminal . | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 0 | 0 | 0 | 3,313 |
3,673,487 | 2010-09-09T03:04:00.000 | 1 | 0 | 1 | 0 | python | 3,673,659 | 11 | false | 0 | 0 | IDE's assist in developer productivity and can equally apply to Python. The defining thing about an IDE is the ability to not have to "mode switch" between tasks such as editing, compiling, testing, running and debugging etc. | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 0.01818 | 0 | 0 | 3,313 |
3,673,487 | 2010-09-09T03:04:00.000 | 0 | 0 | 1 | 0 | python | 3,673,739 | 11 | false | 0 | 0 | I'm still fairly new to Python and use an IDE with code completion but find myself rarely needing it, Python does a really good job of not having an uncessarily large number of verbose calls, as dsimcha pointed out above. I find that just using a basic IDE I can work efficiently in it and the fact that the code is a lot less cluttered without having brackets makes it easier to work with files that have a lot of lines of code (something that I found unbearable in PHP due to all its syntax clutter)
As far as @Postman's answer, I'm not sure that having an IDE makes RAD any faster, at least not in the case of python, its such a succinct language, the only thing that it would help in would be code completion, the way you answered it it sounds more like you are hinting at the use of a framework, which I believe is still very important in Python which does make RAD much more possible than otherwise. | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 0 | 0 | 0 | 3,313 |
3,673,487 | 2010-09-09T03:04:00.000 | 0 | 0 | 1 | 0 | python | 3,673,832 | 11 | false | 0 | 0 | The problems is IDEs dont work very well with dynamic languages.
The IDE cannot second guess runtime duck typing so other than some basic syntax checking and displaying the keywords in pretty colours they ar enot much help.
My personal experience is with groovy and eclipse where eclipse is actually pretty annoying. Method completion for a groovy object brings up about 200 posabilties, it constantly insert quotes and brackets exactly where you dont want them and messes up the syntax coloring whenever it encounters a reasonably complex regular expression. I would ditch eclipse except the majority of the code base is in Java where eclipse is useful. | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 0 | 0 | 0 | 3,313 |
3,673,487 | 2010-09-09T03:04:00.000 | 2 | 0 | 1 | 0 | python | 3,674,002 | 11 | false | 0 | 0 | Two Main Reasons
Because of the dynamic typing and generally super-powerful functionality, there just isn't much extra typing that the IDE can do for you. Implementing a Java interface in a package is a lot of work and dozens of lines of boilerplate. In Python or Ruby it just doesn't have to be typed in the first place.
Because of the dynamic typing, the fancy editor doesn't have nearly as much information at its fingertips, and so the capability is reduced as well.
So the squeeze is top-down from the reduced need and bottom-up from the reduced editor capability, the net result being a really small application area. The benefit of using a fast and familiar day-to-day editor ends up higher than the benefit of the mostly-pointless IDE.
I suppose it's also possible that the categories are a bit fuzzy now. Vi(1) is the lightest-weight and fastest "plain" editor around, and yet vim(1) can now colorize every language under the sun and TextMate is classified as "lightweight", so all of the categories have really begun to merge a bit. | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 0.036348 | 0 | 0 | 3,313 |
3,673,487 | 2010-09-09T03:04:00.000 | 1 | 0 | 1 | 0 | python | 3,673,648 | 11 | false | 0 | 0 | It sounds like 'You don't need vehicle to go to work' to me. It might be true or not, depends on how far your workplace is. | 9 | 10 | 0 | I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python.
What are the reasons people use to justify this claim? | Why don't you need a powerful ide for writing Python? | 0.01818 | 0 | 0 | 3,313 |
3,674,568 | 2010-09-09T07:27:00.000 | 0 | 0 | 1 | 0 | php,python,mysql,ruby-on-rails | 3,675,235 | 3 | false | 1 | 0 | I would go the vitual road (VMware or virtual box). Multiple enviroments have a lot of dependencies, so its just much much easier with vitual hosts. | 2 | 0 | 0 | Beginner here, stuck wondering what I need to do to learn development in different web environments. Say, for instance I want to play around in PHP & MySQL. But I also want to try things with Ruby on Rails and maybe even server things with Python. Do I need a different environment for each platform? Am I required to have a virtual machine to do so? Is it easy to uninstall and start over for each endeavor for a Windows 7 machine?
Or, better yet, would it just be easier to throw Linux in a virtual environment? | Multiple Web Development Environments on Windows | 0 | 0 | 0 | 225 |
3,674,568 | 2010-09-09T07:27:00.000 | 1 | 0 | 1 | 0 | php,python,mysql,ruby-on-rails | 3,675,212 | 3 | true | 1 | 0 | I started off with php and mysql, it's a lower-level then the rest of the environments like Django and Ruby on Rails; so it's much easier to understand what is really happening.
If you want to get into web development, php is a solid foundation and has easy bundle installers such as WAMP, and has a massive community.
However if understanding the core of web applications is not your goal and you want some magic to make your application quicker and speed through development, you would want to use a web application framework environment, my favorite here is Ruby on Rails.
Ruby on Rails is a little difficult for the newbie to setup, it typically sucks running in Windows, so you'd be better off with an install on top of a UNIX environment such as Linux, Mac OS, BSD.
If you do want to go the rails route, I suggest installing Ruby with a ruby manager called RVM which is very helpful for playing around with Ruby environments.
Django is a good solid framework but it's playing catch up with Rails and in my honest opinion, doesn't have all those power magic that Rails has such as database migrations. | 2 | 0 | 0 | Beginner here, stuck wondering what I need to do to learn development in different web environments. Say, for instance I want to play around in PHP & MySQL. But I also want to try things with Ruby on Rails and maybe even server things with Python. Do I need a different environment for each platform? Am I required to have a virtual machine to do so? Is it easy to uninstall and start over for each endeavor for a Windows 7 machine?
Or, better yet, would it just be easier to throw Linux in a virtual environment? | Multiple Web Development Environments on Windows | 1.2 | 0 | 0 | 225 |
3,675,659 | 2010-09-09T10:17:00.000 | 2 | 0 | 0 | 1 | java,python,linux,perl,tcl | 3,675,682 | 5 | false | 0 | 0 | On Linux you should use the distribution's native package format (DEB, RPM, …) to deploy applications. The package managers included in the distributions can handle dependencies automatically.
Apart from that, I think Perl is the only language that is available in most Linux systems out of the box. Python is very popular, too, but probably not as ubiquitous. | 1 | 1 | 0 | When deploy java app on linux, we don't need to install anything, all third-party libs are jar files and we only update classpath in script file. But java needs jre which is quite large.
So is there any other language supported by linux can do that? By default our server only support perl/python/tcl, no gcc available, sigh. | which language (python/perl/tcl) on linux doesn't need to install the third-party libs? | 0.07983 | 0 | 0 | 317 |
3,675,999 | 2010-09-09T11:17:00.000 | 2 | 0 | 1 | 0 | python,python-3.x,osx-snow-leopard,upgrade,pythonpath | 3,676,173 | 1 | true | 0 | 0 | Python 2 and Python 3 are sufficiently different that you cannot in general share modules between them. You will need new, Python-3-compatible modules instead of re-using the Python 2 ones.
(It's possible with a great deal of care to make scripts that will work in both, but it's not usually the done thing. Python 3 was designed to be the big syntax compatibility breaking version.) | 1 | 0 | 0 | I am trying to switch from using Python 2.6.5 to using Python 3.2a2.
I am using OSX 10.6.4.
However, when I open Idle in the Python 3.2a2 folder it cannot import any of the modules I installed to Python 2.6.5.
Is there a way that I can share the same folders on Python 3.2a2 ? | Howto change Pythonpath in Python 3 | 1.2 | 0 | 0 | 1,141 |
3,676,344 | 2010-09-09T12:05:00.000 | 5 | 1 | 0 | 0 | python,email,imap,imaplib | 3,676,393 | 2 | true | 0 | 0 | "attachment" is quite a broad term. Is an image for HTML message an attachment?
In general, you can try analyzing content-type header. If it's multipart/mixed, most likely the message contains an attachment. | 1 | 4 | 0 | I am developing an email client in Python.
Is it possible to check if an email contains an attachement just from the e-mail header without downloading the whole E-Mail? | Is it possible to check if an email contains an attachement just from the e-mail header? | 1.2 | 0 | 1 | 2,147 |
3,678,221 | 2010-09-09T15:49:00.000 | 2 | 1 | 0 | 0 | python,pylons,textmate | 3,679,180 | 2 | false | 1 | 0 | If you look under the Bundles menu in TextMate there is a Python-specific sub-menu that exposes a bunch of helpful things like syntax checking, script debugging, insertion of oft used code blocks, manual look ups and so on. Most of them are bound to keyboard shortcuts (or can be bound if they are not).
Also, under the Bundles are sort of general-to-code or general-to-text-editing tasks in sub-menus.
You can set up templates for new file creation that let you start new files with all the little bits and pieces you like to see in new files (copyright notice, author, SCC tags, etc.) See the File -> New From Template -> Edit Templates... menu option to do that. It ships with 4 Python templates already.
Finally, that browser is called the Project Drawer. View -> Show Project Drawer to get it to show up. It'll only be available when the window you're viewing is a project window, not a single document window. | 1 | 0 | 0 | I have textmate, but honestly the only thing I can do with it is simply edit a file.
The handy little file browser is aslo useful. (how can I show/hide that file browser anyhow!)
But I have no other knowledge/tricks up my sleeve, care to help me out? | How can textmate make my python (pylons) development easier? | 0.197375 | 0 | 0 | 274 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.