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
974,741
2009-06-10T10:18:00.000
1
0
0
0
python,urllib2,wget
974,809
10
false
1
0
Maybe you can wget and then inspect the data in Python?
5
9
0
I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size. The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec. But, just to play around I was also using python to build my urlparser. Downloading via Python's urlretrieve is damm slow, possible 4 times as slow as wget. The download rate is 500kb/sec. I use HTMLParser for parsing the href tags. I am not sure why is this happening. Are there any settings for this. Thanks
wget Vs urlretrieve of python
0.019997
0
1
37,225
974,821
2009-06-10T10:42:00.000
1
0
1
0
python,windows,django-admin
974,834
4
false
1
0
you can't run a command that isn't in your path. it should be set globally when you installed python. type 'set' at a dos prompt and look at the PATH variable. c:\python25 (or whever you installed python) has to be in that variable ie PATH=c:\windows;c:\python25;... etc if it isn't in PATH then you or the installer missed the part where you needed to set it. It can be done from the 'Environment Variables' button in the 'System' control panel.
3
0
0
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run properly?
python not starting properly
0.049958
0
0
139
974,821
2009-06-10T10:42:00.000
0
0
1
0
python,windows,django-admin
974,848
4
true
1
0
Either use the system control panel to set the PATH environment variable that applies permanently or Reinstall Python as a system administrator so that the installer can set the registry and environment variables for you. If you install the "just for me" option, then you have to set the PATH variable in the control panel.
3
0
0
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run properly?
python not starting properly
1.2
0
0
139
974,821
2009-06-10T10:42:00.000
0
0
1
0
python,windows,django-admin
975,292
4
false
1
0
In your path, I think you need to have both the location of the Python install and the Python\Scripts folder. For example, on XP, I have C:\Python25;C:\Python25\Scripts. Can you verify that you have both?
3
0
0
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run properly?
python not starting properly
0
0
0
139
976,506
2009-06-10T15:54:00.000
1
0
1
0
python,eclipse,ubuntu,interpreter
1,393,294
2
false
0
0
I had a similar problems with this on Mac OS X. My problem was that I had a space in Eclipse's application path, e.g. "/Applications/eclipse 3.3/Eclipse". I changed the folder name to "/Applications/eclipse3.3" and it fixed it.
2
1
0
When trying to set the interpreter for python in Eclipse by choosing the executable, clicking OK displays "An error has occured." Does the interpreter name matter?
Problem with Python interpreter in Eclipse
0.099668
0
0
1,391
976,506
2009-06-10T15:54:00.000
0
0
1
0
python,eclipse,ubuntu,interpreter
983,463
2
false
0
0
Testing/running your apps on the command line is the safest bet, especially when writing threaded applications (you can kill your threadlocked program without killing eclipse)
2
1
0
When trying to set the interpreter for python in Eclipse by choosing the executable, clicking OK displays "An error has occured." Does the interpreter name matter?
Problem with Python interpreter in Eclipse
0
0
0
1,391
976,639
2009-06-10T16:13:00.000
1
0
0
1
java,python,google-app-engine,data-modeling
979,391
4
false
1
0
The non relational database design essentially involves denormalization wherever possible. Example: Since the BigTable doesnt provide enough aggregation features, the sum(cash) option that would be in the RDBMS world is not available. Instead it would have to be stored on the model and the model save method must be overridden to compute the denormalized field sum. Essential basic design that comes to mind is that each template has its own model where all the required fields to be populated are present denormalized in the corresponding model; and you have an entire signals-update-bots complexity going on in the models.
2
6
0
I'm looking for resources to help migrate my design skills from traditional RDBMS data store over to AppEngine DataStore (ie: 'Soft Schema' style). I've seen several presentations and all touch on the the overarching themes and some specific techniques. I'm wondering if there's a place we could pool knowledge from experience ("from the trenches") on real-world approaches to rethinking how data is structured, especially porting existing applications. We're heavily Hibernate based and have probably travelled a bit down the wrong path with our data model already, generating some gnarly queries which our DB is struggling with. Please respond if: You have ported a non-trivial application over to AppEngine You've created a common type of application from scratch in AppEngine You've done neither 1 or 2, but are considering it and want to share your own findings so far.
Thinking in AppEngine
0.049958
1
0
1,022
976,639
2009-06-10T16:13:00.000
1
0
0
1
java,python,google-app-engine,data-modeling
978,757
4
false
1
0
The timeouts are tight and performance was ok but not great, so I found myself using extra space to save time; for example I had a many-to-many relationship between trading cards and players, so I duplicated the information of who owns what: Card objects have a list of Players and Player objects have a list of Cards. Normally storing all your information twice would have been silly (and prone to get out of sync) but it worked really well. In Python they recently released a remote API so you can get an interactive shell to the datastore so you can play with your datastore without any timeouts or limits (for example, you can delete large swaths of data, or refactor your models); this is fantastically useful since otherwise as Julien mentioned it was very difficult to do any bulk operations.
2
6
0
I'm looking for resources to help migrate my design skills from traditional RDBMS data store over to AppEngine DataStore (ie: 'Soft Schema' style). I've seen several presentations and all touch on the the overarching themes and some specific techniques. I'm wondering if there's a place we could pool knowledge from experience ("from the trenches") on real-world approaches to rethinking how data is structured, especially porting existing applications. We're heavily Hibernate based and have probably travelled a bit down the wrong path with our data model already, generating some gnarly queries which our DB is struggling with. Please respond if: You have ported a non-trivial application over to AppEngine You've created a common type of application from scratch in AppEngine You've done neither 1 or 2, but are considering it and want to share your own findings so far.
Thinking in AppEngine
0.049958
1
0
1,022
976,796
2009-06-10T16:40:00.000
0
0
1
1
python,windows,python-2.5
978,669
4
false
0
0
Run Cygwin Python if windowisms are bothering you... Unless what you are doing depends on pywin32 that is.
2
7
0
I'm used to ending the python interactive interpreter using Ctrl-d using Linux and OS X. On windows though, you have to use CTRL+Z and then enter. Is there any way to use CTRL+D?
Can I make Python 2.5 exit on ctrl-D in Windows instead of ctrl-Z?
0
0
0
5,212
976,796
2009-06-10T16:40:00.000
0
0
1
1
python,windows,python-2.5
977,031
4
false
0
0
You can change the key set that Idle should be using. Under Options->"Configure IDLE..." go to the "Keys" tab. On the right you can select the "IDLE Classic Unix" key set.
2
7
0
I'm used to ending the python interactive interpreter using Ctrl-d using Linux and OS X. On windows though, you have to use CTRL+Z and then enter. Is there any way to use CTRL+D?
Can I make Python 2.5 exit on ctrl-D in Windows instead of ctrl-Z?
0
0
0
5,212
977,404
2009-06-10T18:33:00.000
13
1
1
0
c++,python
977,443
13
false
0
1
I've heard these complaints before about C++, but the fact is, programming in any language with which you are unfamiliar is time consuming. A good C++ programmer can probably crank out the app much faster than an okay Python programmer and visa versa. I think C++ often gets a bad reputation because it allows you get much lower level - pointers, memory management, etc, and if you aren't used to thinking about such things, it can take a bit of time. If you are used to working in that environment, it can become second nature. Unless choice of language is something imposed upon you by your company, team, client, etc. I usually recommend that folks go with the language they are most comfortable with OR most interested in learning more about. If speed is the issue you are concerned with, look at the learning curve for each language and your past experience. C++ tends to have a higher learning curve, but that too depends on the person. Kindof a non-answer I know.
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
1
0
0
5,902
977,404
2009-06-10T18:33:00.000
24
1
1
0
c++,python
977,451
13
false
0
1
There are two things that are relevant between C++ and Python that will affect your time-to-develop any project including a game. There are the languages themselves and the libraries. I've played with the SDL to some extent and peeked at PyGame and for your specific instance I don't think the libraries are going to be much of a factor. So I'll focus on the languages themselves. Python is a dynamically-typed, garbage-collected language. C++ is a statically-typed, non-garbage-collected language. What this means is that in C++ a lot of your development time will be spent managing memory and dealing with your type structure. This affords you a lot of power, but the question is do you really need it? If you're looking to write a simple game with some basic graphics and some good gameplay, then I don't think you truly need all the power that C++ will give you. If you're looking to write something that will push the envelope, be the next A-list game, be the next MMO, fit on a console or a handheld device, then you will likely need the power that C++ affords.
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
1
0
0
5,902
977,404
2009-06-10T18:33:00.000
2
1
1
0
c++,python
977,412
13
false
0
1
It's time consuming because in C++ you have to deal with more low-level tasks. In Python you are free to focus on the development of the actual game instead of dealing with memory management etc.
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0.03076
0
0
5,902
977,404
2009-06-10T18:33:00.000
0
1
1
0
c++,python
4,546,946
13
false
0
1
Some people would argue that development time is slower in C++ when compared to Python. Wouldn't it be the case that the time you saved in developing an application (or game) in python is the time you gonna use in improving performance after its developed? and in the later part when you have least options left? It largely depends upon the purpose for which you are going to develop the application. If you are thinking for an enterprise application in which case it is going to be hit by millions (web-app) or an application with focus on low-footprint, faster loading into memory, faster execution, then your choice is C++. If you are projecting your application for not being use at this level, surely Python is the choice to go for. Maintainability is considerable, but disciplined code can overcome this. Largely depends upon long term projections. On how serious and critical the application is going to be.
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0
0
0
5,902
977,404
2009-06-10T18:33:00.000
0
1
1
0
c++,python
1,079,100
13
false
0
1
Why limit yourself to those two options? With C# or Java you get access to a huge collection of useful libraries plus garbage collection and (in the case of C#) JIT compiling. Furthermore, you're saying that you're looking to do game development, but from your task description it sounds like you're also looking at coding your own engine. Is that part of the exercise? Otherwise you should definitely take a look at the available Indie engines out there - lots are cheap of not free and open source. Needless to say, working from an existing engine is definitely faster than going from scratch :)
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0
0
0
5,902
977,404
2009-06-10T18:33:00.000
2
1
1
0
c++,python
1,009,820
13
false
0
1
It takes about the same amount of time to write the same code in pretty much all of the high level languages. The win is that in certain languages it is easier to use other peoples code. In a lot of Python/Ruby/Perl apps, you write 10% of the code and import libraries to do the other 90%. That is harder in C/C++ since the libraries have different interfaces and other incompatibilities. C++ vs Python is a pretty personal choice. Personally I feel I lose more time with not having the C/Java class system (more run time errors/debugging time, don't have anywhere near as good auto completion, need to do more documentation and optimization) than I gain (not having to write interfaces/stub function and being able to worry less about memory managment). Other people feel the exact opposite. In the end it probably depends on the type of game. If your processor intensive go to C++ (maybe with a scripting language if it makes sense). Otherwise use whatever language you prefer
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0.03076
0
0
5,902
977,404
2009-06-10T18:33:00.000
3
1
1
0
c++,python
986,810
13
false
0
1
Python has some big advantages over programming languages like C++. I myself have programmed a lot with C++, C and other programming languages. Lately I am also programming in Python and I got to like it very much! You can have a quick start with Python. Since it is rather simple to learn (at least with some programming experience and enough abstract thinking), you can have fast successes. Also the script-like behaviour makes starting easy and it is also possible, to quickly test some things in the integrated shell. This can also be good for debugging. The whole language is packed with powerful features and it has a good and rather complete set of libraries. There was the argument that with the "right library" you can develop as quickly with C++ as with Python. This might (partly) be, but I myself have never experienced it, because such libraries are rare. I had also a big library at hand, but still lacked many valuable features in C++. The so called "standard template library" STL makes things even worse in my opinion. It is a really powerful library. But it is also that complex, that it adds the complexity of an additional programming language to C++. I really disliked it and in a company I worked in, much worktime was lost, because the compiler was not able to give useful error-output in case of errors in the STL. Python is different. Instead of putting the "speed of the programm" on the throne -- sacrificing all else (as C++ and especially the STL does) -- it puts "speed of development" first. The language gives you a powerful toolkit and it is accompanied by a huge library. When you need speed, you can also implement time critical things in C or C++ and call it from Python. There is also at least one big online Game implemented in Python.
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0.046121
0
0
5,902
977,404
2009-06-10T18:33:00.000
0
1
1
0
c++,python
977,759
13
false
0
1
Do you have any programming experience at all? If not, I would start with Python which is easier to learn, even if it is not a better tool for game development. If you decide you want to program games for living, you'll probably need to switch to C++ at some point.
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0
0
0
5,902
977,404
2009-06-10T18:33:00.000
0
1
1
0
c++,python
977,460
13
false
0
1
Short Answer Yes python is faster in terms of development time. There are many case studies in real life that show this. However, you don't want to do a 3d graphics engine in Python.
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0
0
0
5,902
977,404
2009-06-10T18:33:00.000
0
1
1
0
c++,python
977,452
13
false
0
1
I'd focus more on choosing a framework to build your game on than trying to pick a language. Unless the goal is to learn how games work inside and out, you're going to want to use a framework. Try out a couple, and pick the one that meets your requirements and feels nice to you. Once you've picked the framework, the language choice becomes easy - use the language for which the framework is written. There are many options for game frameworks in C++ - pygame works for python. There are many that work with other languages/tools as well (including .NET, Lua, etc.)
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0
0
0
5,902
977,404
2009-06-10T18:33:00.000
2
1
1
0
c++,python
977,414
13
false
0
1
there are many things that make c++ longer to develop in. Its lower level, has pointers, different libraries for different systems, the type system, and there are others I am sure I am missing.
11
19
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
C++ slow, python fast? (in terms of development time)
0.03076
0
0
5,902
978,581
2009-06-10T23:09:00.000
3
0
0
0
python,mysql,xml,django,parsing
978,590
9
false
1
0
Consuming the webservices is more efficient because there are a lot more things you can do to scale your webservices and webserver (via caching, etc.). By consuming the middle layer, you also have the options to change the returned data format (e.g. you can decide to use JSON rather than XML). Scaling database is much harder (involving replication, etc.) so in general, reduce hits on DB if you can.
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
0.066568
0
1
856
978,581
2009-06-10T23:09:00.000
0
0
0
0
python,mysql,xml,django,parsing
978,717
9
false
1
0
It depends from case to case, you'll have to measure (or at least make an educated guess). You'll have to consider several things. Web service it might hit database itself it can be cached it will introduce network latency and might be unreliable or it could be in local network and faster than accessing even local disk DB might be slow since it needs to access disk (although databases have internal caches, but those are usually not targeted) should be reliable Technology itself doesn't mean much in terms of speed - in one case database parses SQL, in other XML parser parses XML, and database is usually acessed via socket as well, so you have both parsing and network in either case. Caching data in your application if applicable is probably a good idea.
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
0
0
1
856
978,581
2009-06-10T23:09:00.000
1
0
0
0
python,mysql,xml,django,parsing
978,603
9
false
1
0
There is not enough information to be able to say for sure in the general case. Why don't you do some tests and find out? Since it sounds like you are using python you will probably want to use the timeit module. Some things that could effect the result: Performance of the web service you are using Reliability of the web service you are using Distance between servers Amount of data being returned I would guess that if it is cacheable, that a cached version of the data will be faster, but that does not necessarily mean using a local RDBMS, it might mean something like memcached or an in memory cache in your application.
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
0.022219
0
1
856
978,581
2009-06-10T23:09:00.000
0
0
0
0
python,mysql,xml,django,parsing
978,773
9
false
1
0
As a few people have said, it depends, and you should test it. Often external services are slow, and caching them locally (in a database in memory, e.g., with memcached) is faster. But perhaps not. Fortunately, it's cheap and easy to test.
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
0
0
1
856
978,581
2009-06-10T23:09:00.000
-1
0
0
0
python,mysql,xml,django,parsing
979,028
9
false
1
0
It sounds like you essentially want to cache results, and are wondering if it's worth it. But if so, I would NOT use a database (I assume you are thinking of a relational DB): RDBMSs are not good for caching; even though many use them. You don't need persistence nor ACID. If choice was between Oracle/MySQL and external web service, I would start with just using service. Instead, consider real caching systems; local or not (memcache, simple in-memory caches etc). Or if you must use a DB, use key/value store, BDB works well. Store response message in its serialized form (XML), try to fetch from cache, if not, from service, parse. Or if there's a convenient and more compact serialization, store and fetch that.
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
-0.022219
0
1
856
978,581
2009-06-10T23:09:00.000
0
0
0
0
python,mysql,xml,django,parsing
978,864
9
false
1
0
Test definitely. As a rule of thumb, XML is good for communicating between apps, but once you have the data inside of your app, everything should go into a database table. This may not apply in all cases, but 95% of the time it has for me. Anytime I ever tried to store data any other way (ex. XML in a content management system) I ended up wishing I would have just used good old sprocs and sql server.
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
0
0
1
856
978,581
2009-06-10T23:09:00.000
4
0
0
0
python,mysql,xml,django,parsing
978,857
9
true
1
0
Everyone is being very polite in answering this question: "it depends"... "you should test"... and so forth. True, the question does not go into great detail about the application and network topographies involved, but if the question is even being asked, then it's likely a) the DB is "local" to the application (on the same subnet, or the same machine, or in memory), and b) the webservice is not. After all, the OP uses the phrases "external service" and "display on your own site." The phrase "parsing it once or however many times you need to each day" also suggests a set of data that doesn't exactly change every second. The classic SOA myth is that the network is always available; going a step further, I'd say it's a myth that the network is always available with low latency. Unless your own internal systems are crap, sending an HTTP query across the Internet will always be slower than a query to a local DB or DB cluster. There are any number of reasons for this: number of hops to the remote server, outage or degradation issues that you can't control on the remote end, and the internal processing time for the remote web service application to analyze your request, hit its own persistence backend (aka DB), and return a result. Fire up your app. Do some latency and response times to your DB. Now do the same to a remote web service. Unless your DB is also across the Internet, you'll notice a huge difference. It's not at all hard for a competent technologist to scale a DB, or for you to completely remove the DB from caching using memcached and other paradigms; the latency between servers sitting near each other in the datacentre is monumentally less than between machines over the Internet (and more secure, to boot). Even if achieving this scale requires some thought, it's under your control, unlike a remote web service whose scaling and latency are totally opaque to you. I, for one, would not be too happy with the idea that the availability and responsiveness of my site are based on someone else entirely. Finally, what happens if the remote web service is unavailable? Imagine a world where every request to your site involves a request over the Internet to some other site. What happens if that other site is unavailable? Do your users watch a spinning cursor of death for several hours? Do they enjoy an Error 500 while your site borks on this unexpected external dependency? If you find yourself adopting an architecture whose fundamental features depend on a remote Internet call for every request, think very carefully about your application before deciding if you can live with the consequences.
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
1.2
0
1
856
978,581
2009-06-10T23:09:00.000
1
0
0
0
python,mysql,xml,django,parsing
978,607
9
false
1
0
It depends - who is calling the web service? Is the web service called every time the user hits the page? If that's the case I'd recommend introducing a caching layer of some sort - many web service API's throttle the amount of hits you can make per hour. Whether you choose to parse the cached XML on the fly or call the data from a database probably won't matter (unless we are talking enterprise scaling here). Personally, I'd much rather make a simple SQL call than write a DOM Parser (which is much more prone to exceptional scenarios).
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
0.022219
0
1
856
978,581
2009-06-10T23:09:00.000
6
0
0
0
python,mysql,xml,django,parsing
978,593
9
false
1
0
First off -- measure. Don't just assume that one is better or worse than the other. Second, if you really don't want to measure, I'd guess the database is a bit faster (assuming the database is relatively local compared to the web service). Network latency usually is more than parse time unless we're talking a really complex database or really complex XML.
9
1
0
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
Is it more efficient to parse external XML or to hit the database?
1
0
1
856
978,643
2009-06-10T23:35:00.000
2
0
0
0
python,django,vim
10,666,285
5
false
1
0
Today, you not need special extentions for django autocomplete in vim. Make sure that you have vim with python support. To check it, type in xterm: vim --version|grep python output: +python -python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs ... ... To make work autocomplete, add this lines in your .vimrc: autocmd FileType python set omnifunc=pythoncomplete#Complete if has("python") python import sys,os python sys.path.append('/home/sergey/workspace/django') python os.environ['DJANGO_SETTINGS_MODULE'] = 'djangoProject.settings' endif where: sys.path.append is path to your django workspace directory djangoProject is name of your django project, which is going just after '/home/sergey/workspace/django' Finally, save it and restart vim. Now, after '.', you press default ctrl-x ctrl-o to get your autocomplete.
2
48
0
Does anyone know how to set up auto completion to work nicely with python, django, and vim? I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project directory, then I also run pysmell in the project directory. Vim doesn't pick up the django tags, though, and they don't get auto completed. Does anyone know how to set up auto completion in vim so that it will complete the long django functions (like get_object_or_404) as well as classes/functions in my own code? I have poked around on google but haven't found any good resources. Thanks.
Vim, Python, and Django autocompletion (pysmell?)
0.07983
0
0
19,878
978,643
2009-06-10T23:35:00.000
3
0
0
0
python,django,vim
978,766
5
false
1
0
I've had good luck with exuberant-ctags for this. I use this macro in my vimrc: execute 'map :!/usr/bin/exuberant-ctags -f '.&tags.' --recurse '.$_P4ROOT.' ' You'll want to modify that slightly, so that it includes your python /site-packages/django/ directory as well as your own code. Then, hit F2 inside vim to update the tags, and use the regular vim tag bindings to navigate.
2
48
0
Does anyone know how to set up auto completion to work nicely with python, django, and vim? I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project directory, then I also run pysmell in the project directory. Vim doesn't pick up the django tags, though, and they don't get auto completed. Does anyone know how to set up auto completion in vim so that it will complete the long django functions (like get_object_or_404) as well as classes/functions in my own code? I have poked around on google but haven't found any good resources. Thanks.
Vim, Python, and Django autocompletion (pysmell?)
0.119427
0
0
19,878
979,551
2009-06-11T05:56:00.000
4
0
0
0
python,ssl,openssl
979,598
3
true
0
0
Did you install the OpenSSL development libraries? I had to install openssl-devel on CentOS, for example. On Ubuntu, sudo apt-get build-dep python2.5 did the trick (even for Python 2.6).
2
2
0
I tried using the ssl module in Python 2.6 but I was told that it wasn't available. After installing OpenSSL, I recompiled 2.6 but the problem persists. Any suggestions?
Adding SSL support to Python 2.6
1.2
0
1
7,646
979,551
2009-06-11T05:56:00.000
-1
0
0
0
python,ssl,openssl
996,622
3
false
0
0
Use the binaries provided by python.org or by your OS distributor. It's a lot easier than building it yourself, and all the features are usually compiled in. If you really need to build it yourself, you'll need to provide more information here about what build options you provided, what your environment is like, and perhaps provide some logs.
2
2
0
I tried using the ssl module in Python 2.6 but I was told that it wasn't available. After installing OpenSSL, I recompiled 2.6 but the problem persists. Any suggestions?
Adding SSL support to Python 2.6
-0.066568
0
1
7,646
979,599
2009-06-11T06:16:00.000
3
0
0
0
python,http,header,request,ip
979,637
2
false
0
0
web.env.get('REMOTE_ADDR')
1
3
0
I have a Pythonic HTTP server that is supposed to determine client's IP. How do I do that in Python? Is there any way to get the request headers and extract it from there? PS: I'm using WebPy.
Extracting IP from request in Python
0.291313
0
1
1,464
980,058
2009-06-11T08:57:00.000
3
0
0
0
python,html,perl,rendering,rendering-engine
980,098
7
false
1
0
lxml isn't going to help you at all. It isn't concerned about front-end rendering at all. To accurately work out how something renders, you need to render it. For that you need to hook into a browser, spawn the page and run some JS on the page to find the DOM element and get its attributes. It's totally possible but I think you should start by looking at how website screenshot factories work (as they'll share 90% of the code you need to get a browser launching and showing the right page). You may want to still use lxml to inject your javascript into the page.
1
2
0
I would like to get the dimensions (coordinates) for all the HTML elements of a webpage as they are rendered by a browser, that is the positions they are rendered at. For example, (top-left,top-right,bottom-left,bottom-right) Could not find this in lxml. So, is there any library in Python that does this? I had also looked at Mechanize::Mozilla in Perl but, that seems difficult to configure/set-up. I think the best way to do this for my requirement is to use a rendering engine - like WebKit or Gecko. Are there any perl/python bindings available for the above two rendering engines? Google searches for tutorials on how to "plug-in" to the WebKit rendering engine is not very helpful.
Finding rendered HTML element positions using WebKit (or Gecko)
0.085505
0
0
3,938
981,200
2009-06-11T13:50:00.000
0
0
1
1
python,windows,drivers
981,251
7
false
0
0
No they cannot. Windows drivers must be written in a language that can Interface with the C based API Compile down to machine code Then again, there's nothing stopping you from writing a compiler that translates python to machine code ;)
5
13
0
Can Windows drivers be written in Python?
Can Windows drivers be written in Python?
0
0
0
13,794
981,200
2009-06-11T13:50:00.000
0
0
1
1
python,windows,drivers
981,227
7
false
0
0
Never say never but eh.. no You might be able to hack something together to run user-mode parts of drivers in python. But kernel-mode stuff can only be done in C or assembly.
5
13
0
Can Windows drivers be written in Python?
Can Windows drivers be written in Python?
0
0
0
13,794
981,200
2009-06-11T13:50:00.000
1
0
1
1
python,windows,drivers
981,216
7
false
0
0
Python runs in a virtual machine, so no. BUT: You could write a compiler that translates Python code to machine language. Once you've done that, you can do it.
5
13
0
Can Windows drivers be written in Python?
Can Windows drivers be written in Python?
0.028564
0
0
13,794
981,200
2009-06-11T13:50:00.000
3
0
1
1
python,windows,drivers
981,320
7
false
0
0
The definitive answer is not without embedding an interpreter in your otherwise C/assembly driver. Unless someone has a framework available, then the answer is no. Once you have the interpreter and bindings in place then the rest of the logic could be done in Python. However, writing drivers is one of the things for which C is best suited. I imagine the resulting Python code would look a whole lot like C code and defeat the purpose of the interpreter overhead.
5
13
0
Can Windows drivers be written in Python?
Can Windows drivers be written in Python?
0.085505
0
0
13,794
981,200
2009-06-11T13:50:00.000
1
0
1
1
python,windows,drivers
981,268
7
false
0
0
I don't know the restrictions on drivers on windows (memory allocation schemes, dynamic load of libraries and all), but you may be able to embed a python interpreter in your driver, at which point you can do whatever you want. Not that I think it is a good idea :)
5
13
0
Can Windows drivers be written in Python?
Can Windows drivers be written in Python?
0.028564
0
0
13,794
981,371
2009-06-11T14:17:00.000
2
0
0
0
python,django,file,forms,field
981,666
1
true
1
0
I think that is not possible, most browsers at least firefox3.0 do not allow fullpath to be seen, so even from JavaScript side you can not get full path If you could get full path you can send it to server, but I think you will have to be satisfied with file name
1
1
0
My django app accepts two files (in this case a jad and jar combo). Is there a way I can preserve the folders they came from? I need this so I can check later that they came from the same path. (And later on accept a whole load of files and be able to work out which came from the same folder).
Get original path from django filefield
1.2
0
0
1,174
981,411
2009-06-11T14:24:00.000
3
0
0
1
python,eclipse,root,sudo,gksudo
982,463
3
false
0
0
It may not be an ideal solution, but the rare times that I need this same functionality I end up just running Eclipse as root.
1
10
0
I use Eclipse as my IDE, and when I run my application I wish the application itself to run as root. My program currently checks if it is root, and if not it restarts itself with gksudo. The output, however, isn't written to the console. I can't use sudo, since it doesn't give me a graphical prompt. (While my program is CLI, Eclipse doesn't permit console interaction afaict) What's the "right" way to be elevating my application?
Run a Python project in Eclipse as root
0.197375
0
0
4,783
981,691
2009-06-11T15:07:00.000
3
0
0
1
python,windows,command-line
981,705
6
true
0
0
python myscript.py
1
1
0
I have a python script that i want to run from the command line but unsure how to run it. Thanks :)
windows command line and Python
1.2
0
0
8,771
982,260
2009-06-11T16:47:00.000
0
0
1
0
python,linux,encryption,passwords,obfuscation
982,287
6
false
0
0
Many password-accepting protocols and facilities have a way to specify a keyfile rather than a password. That strategy will probably work here; rather than hard-coding a password, hard-code a filename (or better yet, make it a parameter!). You could even go as far as SSH and refuse to load keyfiles that aren't (1) owned by the current user (2) only readable by that user.
3
10
0
I have a password string that must be passed to a method. Everything works fine but I don't feel comfortable storing the password in clear text. Is there a way to obfuscate the string or to truly encrypt it? I'm aware that obfuscation can be reverse engineered, but I think I should at least try to cover up the password a bit. At the very least it wont be visible to a indexing program, or a stray eye giving a quick look at my code. I am aware of pyobfuscate but I don't want the whole program obfuscated, just one string and possibly the whole line itself where the variable is defined. Target platform is GNU Linux Generic (If that makes a difference)
Obfuscate strings in Python
0
0
0
9,052
982,260
2009-06-11T16:47:00.000
0
0
1
0
python,linux,encryption,passwords,obfuscation
982,431
6
false
0
0
It depends alot on why you're keeping the password around, and where you feel there is a security issue. If you're storing or matching this password to a database in the future: This shouldn't really be a problem, but if you're concerned, use your database's password encryption early and store that ( SELECT PASSWORD('mySamplePassword'); ), then compare the encrypted version directly in your later query. If you're saving it for later transmision: There really isn't much you can do. The transmission itself is very likely to be easier to sniff than your handling of the password. Without knowing a few more details of what you're doing, this is sortof hard to answer.
3
10
0
I have a password string that must be passed to a method. Everything works fine but I don't feel comfortable storing the password in clear text. Is there a way to obfuscate the string or to truly encrypt it? I'm aware that obfuscation can be reverse engineered, but I think I should at least try to cover up the password a bit. At the very least it wont be visible to a indexing program, or a stray eye giving a quick look at my code. I am aware of pyobfuscate but I don't want the whole program obfuscated, just one string and possibly the whole line itself where the variable is defined. Target platform is GNU Linux Generic (If that makes a difference)
Obfuscate strings in Python
0
0
0
9,052
982,260
2009-06-11T16:47:00.000
2
0
1
0
python,linux,encryption,passwords,obfuscation
982,750
6
false
0
0
Obviously your best option is to delegate this to a third party. If you can authenticate with whatever you're connecting to using some other credential (eg. the user account your process is running as), you can leave the permission levels up to the OS layer. Alternatively, if sufficiently important / possible you could prompt the user (storing the key in the (arguably) slightly less hackable wetware instead) If you do need to store some password or key, I'd recommend you store it seperate from your code, in a file you read in, and de-obfusticate if neccessary. This has the advantages that: You can set the file permissions on the file as tight as possible (ie. only readable by the account your program runs as), unlike the rest of your program which may be read by more people. You won't accidently check it into your version control system! No need to be restricted to printable characters (or use awkward escaping) for a python string, so you can use an arbitrary keyfile if possible, rather than a human readable password. If it's non human-entered, there's no reason to have all the weaknesses of passwords. To obfusticate, you can use base64 as suggested, or some home-brew scheme like XORing or decrypting with another key stored elsewhere, requiring both locations to be looked at. Be aware that this doesn't protect against anything beyond opportunistic shoulder surfing (if that) - make sure that there is some level of real security as well (including obvious ones like physical access to the machine!)
3
10
0
I have a password string that must be passed to a method. Everything works fine but I don't feel comfortable storing the password in clear text. Is there a way to obfuscate the string or to truly encrypt it? I'm aware that obfuscation can be reverse engineered, but I think I should at least try to cover up the password a bit. At the very least it wont be visible to a indexing program, or a stray eye giving a quick look at my code. I am aware of pyobfuscate but I don't want the whole program obfuscated, just one string and possibly the whole line itself where the variable is defined. Target platform is GNU Linux Generic (If that makes a difference)
Obfuscate strings in Python
0.066568
0
0
9,052
982,682
2009-06-11T18:05:00.000
2
0
1
0
python,security,passwords,coredump
982,735
5
false
0
0
No way to "mark as sensitive", but you could encrypt the data in memory and decrypt it again when you need to use it -- not a perfect solution but the best I can think of.
2
22
0
I need to store a user's password for a short period of time in memory. How can I do so yet not have such information accidentally disclosed in coredumps or tracebacks? Is there a way to mark a value as "sensitive", so it's not saved anywhere by a debugger?
Mark data as sensitive in python
0.07983
0
0
10,793
982,682
2009-06-11T18:05:00.000
2
0
1
0
python,security,passwords,coredump
982,748
5
false
0
0
XOR with a one-time pad stored separately always store salted hash rather than password itself or, if you're very paranoid about dumps, store unique random key in some other place, e.g. i a different thread, in a registry, on your server, etc.
2
22
0
I need to store a user's password for a short period of time in memory. How can I do so yet not have such information accidentally disclosed in coredumps or tracebacks? Is there a way to mark a value as "sensitive", so it's not saved anywhere by a debugger?
Mark data as sensitive in python
0.07983
0
0
10,793
983,399
2009-06-11T20:14:00.000
1
0
0
0
c#,c++,python,xml,schema
985,246
7
false
0
1
One solution could be to write an XSL transformation that converts the XML file into a XAML file.
2
15
0
I have to write a desktop application to edit data stored in a XML file. The format is defined by a XML schema file (.xsd). The format is quite complex. Are there tools which can generate a basic GUI automatically? It's not yet decided which language to use. I have experience in Python and C++ using wxWidgets and C# (.NET 1) using Windows Forms.
Create a GUI from a XML schema automatically
0.028564
0
0
19,538
983,399
2009-06-11T20:14:00.000
1
0
0
0
c#,c++,python,xml,schema
1,015,238
7
false
0
1
If the GUI will be simple and you don't bother about the geometry of the components(widgets) in the dialogs, Qt will be a good option. Actually I'm working on a similar task for my project, and my goal was to validate the form data by using an XML file. Using Qt, it is possible to access any widget on the dialog at run-time by using its object name. So that validation can be applied to the dialog contents. Creating any dialogs will be even easier, since you will have the widget type and certain information and using layouts, fascinating results can be obtained.
2
15
0
I have to write a desktop application to edit data stored in a XML file. The format is defined by a XML schema file (.xsd). The format is quite complex. Are there tools which can generate a basic GUI automatically? It's not yet decided which language to use. I have experience in Python and C++ using wxWidgets and C# (.NET 1) using Windows Forms.
Create a GUI from a XML schema automatically
0.028564
0
0
19,538
983,699
2009-06-11T21:09:00.000
371
0
1
0
python,list
983,727
3
true
0
0
If the "default value" you want is immutable, @eduffy's suggestion, e.g. [0]*10, is good enough. But if you want, say, a list of ten dicts, do not use [{}]*10 -- that would give you a list with the same initially-empty dict ten times, not ten distinct ones. Rather, use [{} for i in range(10)] or similar constructs, to construct ten separate dicts to make up your list.
1
243
0
How do I initialise a list with 10 times a default value in Python? I'm searching for a good-looking way to initialize a empty list with a specific range. So make a list that contains 10 zeros or something to be sure that my list has a specific length.
Initialise a list to a specific length in Python
1.2
0
0
315,620
984,816
2009-06-12T03:16:00.000
4
0
0
0
python,wxpython,icons
984,833
1
true
0
1
I don't think wxPython provides native images on each platform but just for consistency sake you can use wx.ArtProvider e.g. wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN)
1
2
0
I'm designing a simple text editor using WxPython, and I want to put the platform's native icons in the toolbar. It seems that the only way to make toolbars is with custom images, which are not good for portability. Is there some kind of (e.g.) GetSaveIcon()?
How to use standard toolbar icons with WxPython?
1.2
0
0
1,725
985,155
2009-06-12T05:28:00.000
5
0
1
0
python
985,176
1
true
0
0
Assuming you're talking about a .so file, it's not up to Python to find it -- it's up to the operating system's dynamic library loaded. For Linux, for example, LD_LIBRARY_PATH is the environment variable you need to set.
1
5
0
I have installed lxml which was built using a standalone version of libxml2. Reason for this was that the lxml needed a later version of libxml2 than what was currently installed. When I use the lxml module how do I tell it (python) where to find the correct version of the libxml2 shared library?
How to specify native library search path for python
1.2
0
1
2,097
985,294
2009-06-12T06:41:00.000
0
0
1
0
python,pickle,memoization
985,362
2
false
0
0
What do you mean by same output ? You should normally always get the same output for a roundtrip (pickling -> unpickling), but I don't think the serialized format itself is guaranteed to be the same in every condition. Certainly, it may change between platforms and all that. Within one run of your program, using pickling for memoization should be fine - I have used this scheme several times without trouble, but that was for quite simple problems. One problem is that this does not cover every useful case (function come to mind: you cannot pickle them, so if your function takes a callable argument, that won't work).
1
8
0
Does Pickle always produce the same output for a certain input value? I suppose there could be a gotcha when pickling dictionaries that have the same contents but different insert/delete histories. My goal is to create a "signature" of function arguments, using Pickle and SHA1, for a memoize implementation.
Is the pickling process deterministic?
0
0
0
1,588
986,403
2009-06-12T12:35:00.000
3
0
0
0
python,sqlite,encryption
987,942
5
false
0
0
SQLite databases are pretty human-readable, and there isn't any built-in encryption. Are you concerned about someone accessing and reading the database files directly, or accessing them through your program? I'm assuming the former, because the latter isn't really database related--it's your application's security you're asking about. A few options come to mind: Protect the db with filesystem permissions rather than encryption. You haven't mentioned what your environment is, so I can't say if this is workable for you or not, but it's probably the simplest and most reliable way, as you can't attempt to decrypt what you can't read. Encrypt in Python before writing, and decrypt in Python after reading. Fairly simple, but you lose most of the power of SQL's set-based matching operations. Switch to another database; user authentication and permissions are standard features of most multi-user databases. When you find yourself up against the limitations of a tool, it may be easier to look around at other tools rather than hacking new features into the current tool.
1
10
0
I have a sqlite3 db which i insert/select from in python. The app works great but i want to tweak it so no one can read from the DB without a password. How can i do this in python? note i have no idea where to start.
Encrypted file or db in python
0.119427
1
0
29,194
986,594
2009-06-12T13:17:00.000
-1
0
0
0
python,django
990,440
2
false
1
0
Are you saying that a random survey of some posted Django apps (not Django itself) reveals that some people post code that doesn't meet your standards of quality? Isn't that universally true of all code posted everywhere on the internet? A random survey of any code in any language for any framework will turn up quality issues. What's your real question? Do you think this phenomena will somehow rub off on you and taint your code with their lack of quality?
1
13
0
I plan to sneak in some Python/Django to my workdays and a possible social network site project seems like a good possibility. Django itself seems excellent, but I am skeptical about the quality of large amount of Django apps that seem to be available. I would like to hear what kind of experiences you may have had with Django in creating social network type sites. Any experiences in using any of the Django powered social network "frameworks" would also be welcome.
Experiences of creating Social Network site in Django
-0.099668
0
0
5,087
986,616
2009-06-12T13:23:00.000
0
0
1
0
python,multithreading,exit-code
986,658
3
false
0
0
You could set some global variable to 0 if success, or non-zero if there was an exception. This is a pretty standard convention. However, you'll need to protect this variable with a mutex or semaphore. Or you could make sure that only one thread will ever write to it and all others would just read it.
2
15
0
Is there a way to tell if a thread has exited normally or because of an exception?
Python thread exit code
0
0
0
12,475
986,616
2009-06-12T13:23:00.000
0
0
1
0
python,multithreading,exit-code
986,698
3
false
0
0
Have your thread function catch exceptions. (You can do this with a simple wrapper function that just calls the old thread function inside a try...except or try...except...else block). Then the question just becomes "how to pass information from one thread to another", and I guess you already know how to do that.
2
15
0
Is there a way to tell if a thread has exited normally or because of an exception?
Python thread exit code
0
0
0
12,475
988,346
2009-06-12T18:47:00.000
1
1
1
0
python,algorithm,list,tuples
988,462
5
false
0
0
I don't know how many types you have. But If we assume you have only type 1 and type 2, then it sounds like a problem similar to a merge sort. Doing it with a merge sort, you make a single pass through the list. Take two indexes, one for type 1 and one for type 2 (I1, I2). Sort the list by id, start1. Start I1 as the first instance of type1, and I2 as zero. If I1.id < I2.Id then increment I1. If I2.id < I1.id then increment I2. If I1.id = I2.id then check iStart. I1 can only stop on a type one record and I2 can only stop on a type 2 record. Keep incrementing the index till it lands on an appropriate record. You can make some assumptions to make this faster. When you find an block that succeeds, you can move I1 to the next block. Whenever I2 < I1, you can start I2 at I1 + 1 (WOOPS MAKE SURE YOU DONT DO THIS, BECAUSE YOU WOULD MISS THE FAILURE CASE!) Whenever you detect an obvious failure case, move I1 and I2 to the next block (on appropriate recs of course).
2
2
0
I am kind of hitting a wall on this problem and I was wondering if some fresh brains could help me out. I have a large list of four element tuples in the format: (ID number, Type, Start Index, End Index) Previously in the code, I have searched through thousands of blocks of text for two specific types of substrings. These tuples store in which large chunk of text the substring was found, which of the two types of substrings it is, and the start and end index of this substring. The final goal is to look through this list to find all instances where a type 1 substring occurs before a type 2 substring in a block of text with the same ID. Then I would like to store these objects in the format (ID, Type 1, Start, End, Type2, Start, End). I've tried to mess around with a bunch of stuff that was super inefficient. I have the list sorted by ID then Start Index, and if been trying varying ways of popping the items off the list for comparisons. I have to imagine there is a more elegant solution. Any brilliant people out there wish to assist my tired brain??? Thanks in advance
Efficient Tuple List Comparisons
0.039979
0
0
551
988,346
2009-06-12T18:47:00.000
0
1
1
0
python,algorithm,list,tuples
988,650
5
false
0
0
Assuming there are lots of entries for each ID, I would (pseudo-code) for each ID: for each type2 substring of that ID: store it in an ordered list, sorted by start point for each type1 substring of that ID: calculate the end point (or whatever) look it up in the ordered list if there's anything to the right, you have a hit So, if you have control of the initial sort, then instead of (ID, start), you want them sorted by ID, then by type (2 before 1). Then within the type, sort by start point for type2, and the offset you're going to compare for type1. I'm not sure whether by "A before B" you mean "A starts before B starts" or "A ends before B starts", but do whatever's appropriate. Then you can do the whole operation by running over the list once. You don't need to actually construct an index of type2s, because they're already in order. Since the type1s are sorted too, you can do each lookup with a linear or binary search starting from the result of the previous search. Use a linear search if there are lots of type1s compared with type2s (so results are close together), and a binary search if there are lots of type2s compared with type1s (so results are sparse). Or just stick with the linear search as it's simpler - this lookup is the inner loop, but its performance might not be critical. If you don't have control of the sort, then I don't know whether it's faster to build the list of type2 substrings for each ID as you go; or to sort the entire list before you start into the required order; or just to work with what you've got, by writing a "lookup" that ignores the type1 entries when searching through the type2s (which are already sorted as required). Test it, or just do whatever results in clearer code. Even without re-sorting, you can still use the merge-style optimisation unless "sorted by start index" is the wrong thing for the type1s.
2
2
0
I am kind of hitting a wall on this problem and I was wondering if some fresh brains could help me out. I have a large list of four element tuples in the format: (ID number, Type, Start Index, End Index) Previously in the code, I have searched through thousands of blocks of text for two specific types of substrings. These tuples store in which large chunk of text the substring was found, which of the two types of substrings it is, and the start and end index of this substring. The final goal is to look through this list to find all instances where a type 1 substring occurs before a type 2 substring in a block of text with the same ID. Then I would like to store these objects in the format (ID, Type 1, Start, End, Type2, Start, End). I've tried to mess around with a bunch of stuff that was super inefficient. I have the list sorted by ID then Start Index, and if been trying varying ways of popping the items off the list for comparisons. I have to imagine there is a more elegant solution. Any brilliant people out there wish to assist my tired brain??? Thanks in advance
Efficient Tuple List Comparisons
0
0
0
551
990,169
2009-06-13T06:56:00.000
10
0
1
0
python,unicode,python-2.x
12,083,259
3
false
0
0
Given a byte string with Unicode escapes b"\N{SNOWMAN}", b"\N{SNOWMAN}".decode('unicode-escape) will produce the expected Unicode string u'\u2603'.
1
31
0
When I tried to get the content of a tag using "unicode(head.contents[3])" i get the output similar to this: "Christensen Sk\xf6ld". I want the escape sequence to be returned as string. How to do it in python?
How do convert unicode escape sequences to unicode characters in a python string
1
0
0
44,729
990,459
2009-06-13T10:09:00.000
0
0
0
0
python,active-directory,ldap,webserver
991,550
2
false
1
0
There are quite a few components between your hosted django application and your internal AD. You will need to test each to see if everything in the pathways between them is correct. So your AD server is sitting behind your firewall. Your firewall has ip "a.b.c.d" and all traffic to the firewall ip on port 389 is forwarded to the AD server. I would recommend that you change this to a higher more random port on your firewall, btw. Less scans there. With the shell access you can test to see if you can reach your network. Have your firewall admin check the firewall logs while you try one of the following (or something similar with python) : check the route to your firewall (this might not work if webfaction blocks this, otherwise you will see a list of hosts along which your traffic will pass - if there is a firewall on the route somewhere you will see that your connection is lost there as this is dropped by default on most firewalls): tracert a.b.c.d do a telnet to your firewall ip on port 389 (the telnet test will allow your firewall admin to see the connection attempts coming in on port 389 in his log. If those do arrive, that means that external comm should work fine): telnet a.b.c.d 389 Similarly, you need to check that your AD server receives these requests (check your logs) and as well can respond to them. Perhaps your AD server is not set up to talk to the firewall ?
1
0
0
I have a django application hosted on webfaction which now has a static/private ip. Our network in the office is obviously behind a firewall and the AD server is running behind this firewall. From inside the network i can authenticate using python-ldap with the AD's internal IP address and the port 389 and all works well. When i move this to the hosted webserver i change the ip address and port that has been openend up on our firewall. For simplicity the port we opened up is 389 however the requests to authenticate always timeout. When logged into webfaction and running python from the shell and querying the ipaddress i get webfactional's general ip address rather than my static ip. Is this whats happening when i try and auth in django? the request comes from the underlying ip address that python is running on rather than the static ip that my firewall is expecting? Im fairly clueless to all this networking and port mapping so any help would be much appreciated! Hope that makes sense?
Python LDAP Authentication from remote web server
0
0
1
2,571
991,027
2009-06-13T16:57:00.000
5
0
1
0
python
41,274,686
7
false
0
0
I don't think you're fully grasping modulo. a % b and a mod b are just two different ways to express modulo. In this case, python uses %. No, 15 mod 4 is not 1, 15 % 4 == 15 mod 4 == 3.
2
168
0
Is there a modulo function in the Python math library? Isn't 15 % 4, 3? But 15 mod 4 is 1, right?
How to calculate a mod b in Python?
0.141893
0
0
700,325
991,027
2009-06-13T16:57:00.000
258
0
1
0
python
991,034
7
true
0
0
There's the % sign. It's not just for the remainder, it is the modulo operation.
2
168
0
Is there a modulo function in the Python math library? Isn't 15 % 4, 3? But 15 mod 4 is 1, right?
How to calculate a mod b in Python?
1.2
0
0
700,325
991,904
2009-06-14T01:12:00.000
56
0
1
0
java,python,multithreading,jvm,gil
1,162,596
5
false
0
0
The JVM (at least hotspot) does have a similar concept to the "GIL", it's just much finer in its lock granularity, most of this comes from the GC's in hotspot which are more advanced. In CPython it's one big lock (probably not that true, but good enough for arguments sake), in the JVM it's more spread about with different concepts depending on where it is used. Take a look at, for example, vm/runtime/safepoint.hpp in the hotspot code, which is effectively a barrier. Once at a safepoint the entire VM has stopped with regard to java code, much like the python VM stops at the GIL. In the Java world such VM pausing events are known as "stop-the-world", at these points only native code that is bound to certain criteria is free running, the rest of the VM has been stopped. Also the lack of a coarse lock in java makes JNI much more difficult to write, as the JVM makes less guarantees about its environment for FFI calls, one of the things that cpython makes fairly easy (although not as easy as using ctypes).
2
186
0
I'm hoping someone can provide some insight as to what's fundamentally different about the Java Virtual Machine that allows it to implement threads nicely without the need for a Global Interpreter Lock (GIL), while Python necessitates such an evil.
Why is there no GIL in the Java Virtual Machine? Why does Python need one so bad?
1
0
0
19,199
991,904
2009-06-14T01:12:00.000
-2
0
1
0
java,python,multithreading,jvm,gil
37,918,400
5
false
0
0
Python lacks jit/aot and the time frame it was written at multithreaded processors didn't exist. Alternatively you could recompile everything in Julia lang which lacks GIL and gain some speed boost on your Python code. Also Jython kind of sucks it's slower than Cpython and Java. If you want to stick to Python consider using parallel plugins, you won't gain an instant speed boost but you can do parallel programming with the right plugin.
2
186
0
I'm hoping someone can provide some insight as to what's fundamentally different about the Java Virtual Machine that allows it to implement threads nicely without the need for a Global Interpreter Lock (GIL), while Python necessitates such an evil.
Why is there no GIL in the Java Virtual Machine? Why does Python need one so bad?
-0.07983
0
0
19,199
992,136
2009-06-14T04:07:00.000
32
0
1
0
python
992,141
2
true
0
0
The GIL only affects threads within a single process. The multiprocessing module is in fact an alternative to threading that lets Python programs use multiple cores &c. Your scenario will easily allow use of multiple cores, too.
1
20
0
I'm curious in how the Global Interpreter Lock in python actually works. If I have a c++ application launch four separate instances of a python script will they run in parallel on separate cores, or does the GIL go even deeper then just the single process that was launched and control all python process's regardless of the process that spawned it?
Does running separate python processes avoid the GIL?
1.2
0
0
5,775
992,638
2009-06-14T10:57:00.000
1
0
1
0
python
992,645
2
false
0
0
easiest way is to just unzip the twill and keep it somewhere in PYTHONPATH e.g. in your project and just import twill else copy twill folder directly to D:\Python26\Lib\site-packages
1
0
0
I have already downloaded twill 0.9. Also, I have installed easy_install for python 2.6. Now I'm stuck with twill installation. Could you help me to settle the problem?
How to setup twill for python 2.6 on Windows?
0.099668
0
0
1,647
993,029
2009-06-14T15:33:00.000
3
0
0
0
python,templates,template-engine,cherrypy
994,184
6
false
1
0
I like Genshi. One reason that I like it is simply that the XML syntax looks much cleaner to me when mixed with HTML versus the text-level syntax of the other popular templating engines. For example, it's nice to be able to stick a py:for attribute on to output a table versus nesting messy #if or whatever lines. Another reason is that because it's based on XML and treats your HTML as XML, it guarantees that your markup is syntactically correct -- i.e. that tags are closed and properly nested, special characters are properly escaped, etc.. Other templating engines will simply treat your HTML as text and output whatever you give it without the extra santity checks. The main disadvantage of Genshi is that it is much slower than the faster text-based engines. However, its performance should be good enough for most sites. Unless you have a site that has a special need to render text/HTML at a super fast rate, the readability and syntax checking that Genshi provides probably outweigh the performance hit.
1
11
0
I'm in the process of building a web application using cherrypy. What template technology do you recommend I use?
Which template technology should I use with CherryPy?
0.099668
0
0
8,175
993,274
2009-06-14T17:34:00.000
1
0
1
0
python
993,284
9
false
0
0
As these answers are implying, 1/2 doesn't return what you are expecting. It returns zero, because 1 and 2 are integers (integer division causes numbers to round down). Python 3 changes this behavior, by the way.
5
0
0
When I do 1/2 in Python why does it give me zero? Even if I coerce it with float(1/2) still I get zero. Why? And how can I get around it? When I give arctan(1/2) I get 0 as answer, but when I give arctan(.5) I get the correct answer!
Error while I use math.atan in Python!
0.022219
0
0
2,230
993,274
2009-06-14T17:34:00.000
1
0
1
0
python
993,285
9
false
0
0
Your coercing doesn't stand a chance because the answer is already zero before you hand it to float. Try 1./2
5
0
0
When I do 1/2 in Python why does it give me zero? Even if I coerce it with float(1/2) still I get zero. Why? And how can I get around it? When I give arctan(1/2) I get 0 as answer, but when I give arctan(.5) I get the correct answer!
Error while I use math.atan in Python!
0.022219
0
0
2,230
993,274
2009-06-14T17:34:00.000
2
0
1
0
python
993,281
9
false
0
0
From the standard: The / (division) and // (floor division) operators yield the quotient of their arguments. The numeric arguments are first converted to a common type. Plain or long integer division yields an integer of the same type; the result is that of mathematical division with the ‘floor’ function applied to the result.
5
0
0
When I do 1/2 in Python why does it give me zero? Even if I coerce it with float(1/2) still I get zero. Why? And how can I get around it? When I give arctan(1/2) I get 0 as answer, but when I give arctan(.5) I get the correct answer!
Error while I use math.atan in Python!
0.044415
0
0
2,230
993,274
2009-06-14T17:34:00.000
1
0
1
0
python
993,293
9
false
0
0
If 1/2 == 0 then float(1/2) will be 0.0. If you coerce it to float after it's been truncated it'll still be truncated. There are a few options: Add the following import: from __future__ import division. This will make the / operator divide "correctly" in that module. You can use // if you need truncating division. Coerce either of the operands to a float. eg: float(1)/2 If you're actually using constants then just add a decimal point instead of using float(), eg: 1.0/2 or 1/2.0 or 1.0/2.0
5
0
0
When I do 1/2 in Python why does it give me zero? Even if I coerce it with float(1/2) still I get zero. Why? And how can I get around it? When I give arctan(1/2) I get 0 as answer, but when I give arctan(.5) I get the correct answer!
Error while I use math.atan in Python!
0.022219
0
0
2,230
993,274
2009-06-14T17:34:00.000
1
0
1
0
python
993,288
9
false
0
0
In Python, dividing integers yields an integer -- 0 in this case. There are two possible solutions. One is to force them into floats: 1/2. (note the trailing dot) or float(1)/2. Another is to use "from future import division" at the top of your code, and use the behavior you need. python -c 'from future import division;import math;print math.atan(1/2)' yields the correct 0.463647609001
5
0
0
When I do 1/2 in Python why does it give me zero? Even if I coerce it with float(1/2) still I get zero. Why? And how can I get around it? When I give arctan(1/2) I get 0 as answer, but when I give arctan(.5) I get the correct answer!
Error while I use math.atan in Python!
0.022219
0
0
2,230
994,278
2009-06-15T02:05:00.000
5
0
0
0
python,compilation,tkinter
994,311
1
true
0
1
Unfortunately I suspect you can't do it without editing some file or other -- it's not a configure option we wrote in as far as I recall (I hope I'm wrong and somebody else snuck it in while I wasn't looking but a quick look at the configure file seems to confirm they didnt'). Sorry -- we never thought that somebody (with all the tk libraries installed, otherwise tkinter gets skipped) would need to deliberately avoid building _tkinter:-(. In retrospect, we clearly were wrong, so I apologize.
1
3
0
I'm trying to explicitly disable the compilation of the _tkinter module when compiling Python 2.4.3. It's easy enough to do by modifying the makefile but I'd rather just append a configuration option to avoid supplying a patch. I do not understand the complex interplay between Modules/Setup*, setup.py and their contribution to the generation of makefile.
How can I explicitly disable compilation of _tkinter.c when compiling Python 2.4.3 on CentOS 5?
1.2
0
0
672
994,476
2009-06-15T04:15:00.000
31
0
1
0
python,oop
994,482
2
true
0
0
An abstract method is one that (in the base class) raises NotImplementedError. An abstract class, like in C++, is any class that has one or more abstract methods. All methods in Python are virtual (i.e., all can be overridden by subclasses). A "pure virtual" method would presumably be the same thing as an abstract one. In each case you could attempt deep black magic to fight against the language, but it would be (generally speaking) exceedingly silly to do so. I've striven to deal with the "etc" part in two books, a dozen videos, two dozen essays and PDFs and other presentations, and I can't spend the next few days summarizing it all here. Ask specific questions, and I'll be glad to try and answer!
1
9
0
How does python handle object oriented constructs such as abstract, virtual, pure virtual etc Examples and links would really be good.
What is the equivalent of object oriented constructs in python?
1.2
0
0
2,068
994,965
2009-06-15T08:03:00.000
2
0
0
0
python,google-app-engine,authentication,registration
995,085
3
false
1
0
You can't customize the login page. Allowing you to do so would introduce the possibility of XSS vulnerabilities, as well as making it harder for users to identify a legitimate login page. If you want to provide for federated login, you may want to simply redirect users to an interstitial page that allows them to pick standard Google login, or one of a number of other services.
1
2
0
I need to add few more options for login and therefore need to customize create_login_url with some HTML code. Is there a way to add on your code in default login screen of Google? Environment: Python (Google App Engine) I want to continue having the default Google ext class Users behavior in place.
Customize login in Google App Engine
0.132549
0
0
4,081
995,165
2009-06-15T09:15:00.000
0
0
1
0
c++,python,regex,namespaces
998,230
6
false
0
0
That is what I did earlier today: Extract the comment out of the C++ files Use regex to extract the namespace definition Use a simple string search to get the open & close braces positions The various sanity check added show that I am successfully processing 99.925% of my files (5 failures ouf of 6678 files). The issues are due to mismatches in numbers of { and } cause by few '{' or '}' in strings, and unclean usage of the preprocessor instruction. However, I am only dealing with header files, and I own the code. That limits the number of scenari that could cause some issues and I can manually modify the ones I don't cover. Of course I know there are plenty of cases where it would fail but it is probably enough for what I want to achieve. Thanks for your answers.
5
1
0
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestion of how I could do that using python-regex? Thanks.
Using python regex to extract namespaces from C++ sources
0
0
0
799
995,165
2009-06-15T09:15:00.000
1
0
1
0
c++,python,regex,namespaces
997,076
6
false
0
0
You could write a basic lexer for it. It's not that hard.
5
1
0
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestion of how I could do that using python-regex? Thanks.
Using python regex to extract namespaces from C++ sources
0.033321
0
0
799
995,165
2009-06-15T09:15:00.000
2
0
1
0
c++,python,regex,namespaces
997,110
6
false
0
0
The need is simple enough that you may not need a complex parser. You need to: extract the namespace names count the open/close braces to keep track of where your namespace is defined. This simple approach works if the other conditions are met: you don't get spurious namespace like strings inside comments or inside strings you don't get unmatched open/closeing braces inside comments or strings I don't think this is too much asking from your source.
5
1
0
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestion of how I could do that using python-regex? Thanks.
Using python regex to extract namespaces from C++ sources
0.066568
0
0
799
995,165
2009-06-15T09:15:00.000
6
0
1
0
c++,python,regex,namespaces
995,182
6
false
0
0
Searching for the namespace names is pretty easy with a regular expression. However, to determine the nesting level you will have to keep track of the curly bracket nesting level in the source file. This is a parsing problem, one that cannot be solved (sanely) with regular expressions. Also, you may have to deal with any C preprocessor directives in the file which can definitely affect parsing. C++ is a notoriously tricky language to parse completely, but you may be able to get by with a tokeniser and a curly bracket counter.
5
1
0
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestion of how I could do that using python-regex? Thanks.
Using python regex to extract namespaces from C++ sources
1
0
0
799
995,165
2009-06-15T09:15:00.000
0
0
1
0
c++,python,regex,namespaces
997,065
6
false
0
0
Most of the time when someone asks how to do something with regex, they're doing something very wrong. I don't think this case is different. If you want to parse c++, you need to use a c++ parser. There are many things that can be done that will defeat a regex but still be valid c++.
5
1
0
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestion of how I could do that using python-regex? Thanks.
Using python regex to extract namespaces from C++ sources
0
0
0
799
996,129
2009-06-15T13:31:00.000
1
0
1
0
python,windows-services,py2exe
996,645
2
false
0
0
You will find an example in the py2exe package, look in site-packages\py2exe\samples\advanced.
1
6
0
I have successfully converted my python project to a service. When using the usual options of install and start/stop, everything works correctly. However, I wish to compile the project using py2exe, which seems to work correctly until you install the EXE as a service and try and run it. You get the following error message: Starting service CherryPyService Error starting service: The service did not respond to the start or control request in a timely fashion. My compile python file (which links to the main project) is as follows: from distutils.core import setup import py2exe setup(console=['webserver.py']) Any help would be greatly appreciated.
py2exe windows service problem
0.099668
0
0
2,895
997,485
2009-06-15T18:04:00.000
1
0
1
0
python,git,ide,editor
997,510
4
false
0
0
Eclipse should be able to fit the bill. I know there's a decent python plugin, and I'm sure there's one for git by now.
1
2
0
I am looking for a Text Editor on Windows which is integrated with GIT (check out, check in from the UI). Also, it would be nice is this editor could also support Python syntax highlighting. Is there anything like that available? Thanks!
Looking for Windows Text Editor which supports GIT
0.049958
0
0
3,475
997,904
2009-06-15T19:25:00.000
0
0
0
0
python,icons,pyqt4
999,115
3
false
0
1
I spent a decent amount of researching this myself not long ago, and my conclusion was that, unfortunately, Qt doesn't provide this functionality in a cross-platform fashion. Ideally the QIcon class would have defaults for file open, save, '+', '-', preferences, etc, but considering it doesn't you'll have to grab the appropriate icon for your desktop environment.
1
8
0
I'm writing a basic program in python using the PyQt4 module. I'd like to be able to use my system theme's icons for things like the preference dialog's icon, but i have no idea how to do this. So my question is, how do you get the location of an icon, but make sure it changes with the system's icon theme? If it matters, i'm developing this under ubuntu 9.04, so i am using the gnome desktop.
System theme icons and PyQt4
0
0
0
3,720
1,000,540
2009-06-16T09:56:00.000
1
0
0
0
python,database,session,caching,memcached
1,130,289
1
false
0
0
Not that I know of. memcached is designed to be very fast and very straightforward, no fancy weights and priorities keep it simple. You should not rely on memcache for persistent session storage. You should keep your sessions in the DB, but you can cache them in memcache. This way you can enjoy both worlds.
1
0
0
A hashtable in memcached will be discarded either when it's Expired or when there's not enough memory and it's choosen to die based on the Least Recently Used algorithm. Can we put a Priority to hint or influence the LRU algorithm? I want to use memcached to store Web Sessions so i can use the cheap round-robin. I need to give Sessions Top Priority and nothing can kill them (not even if it's the Least Recently Used) except their own Max_Expiry.
Is there an option to configure a priority in memcached? (Similiar to Expiry)
0.197375
1
0
799
1,000,900
2009-06-16T11:31:00.000
59
0
1
1
python,windows
1,031,891
25
false
0
0
cmd /k is the typical way to open any console application (not only Python) with a console window that will remain after the application closes. The easiest way I can think to do that, is to press Win+R, type cmd /k and then drag&drop the script you want to the Run dialog.
6
214
0
I have just started with Python. When I execute a python script file on Windows, the output window appears but instantaneously goes away. I need it to stay there so I can analyze my output. How can I keep it open?
How to keep a Python script output window open?
1
0
0
389,804
1,000,900
2009-06-16T11:31:00.000
6
0
1
1
python,windows
4,477,506
25
false
0
0
I had a similar problem. With Notepad++ I used to use the command : C:\Python27\python.exe "$(FULL_CURRENT_PATH)" which closed the cmd window immediately after the code terminated. Now I am using cmd /k c:\Python27\python.exe "$(FULL_CURRENT_PATH)" which keeps the cmd window open.
6
214
0
I have just started with Python. When I execute a python script file on Windows, the output window appears but instantaneously goes away. I need it to stay there so I can analyze my output. How can I keep it open?
How to keep a Python script output window open?
1
0
0
389,804
1,000,900
2009-06-16T11:31:00.000
1
0
1
1
python,windows
60,842,143
25
false
0
0
I found the solution on my py3 enviroment at win10 is just run cmd or powershell as Administrator,and the output would stay at the same console window,any other type of user run python command would cause python to open a new console window.
6
214
0
I have just started with Python. When I execute a python script file on Windows, the output window appears but instantaneously goes away. I need it to stay there so I can analyze my output. How can I keep it open?
How to keep a Python script output window open?
0.008
0
0
389,804
1,000,900
2009-06-16T11:31:00.000
-2
0
1
1
python,windows
56,816,573
25
false
0
0
You can open PowerShell and type "python". After Python has been imported, you can copy paste the source code from your favourite text-editor to run the code. The window won't close.
6
214
0
I have just started with Python. When I execute a python script file on Windows, the output window appears but instantaneously goes away. I need it to stay there so I can analyze my output. How can I keep it open?
How to keep a Python script output window open?
-0.015999
0
0
389,804
1,000,900
2009-06-16T11:31:00.000
0
0
1
1
python,windows
69,880,499
25
false
0
0
You can launch python with the -i option or set the environment variable PYTHONINSPECT=x. From the docs: inspect interactively after running script; forces a prompt even if stdin does not appear to be a terminal; also PYTHONINSPECT=x So when your script crashes or finishes, you'll get a python prompt and your window will not close.
6
214
0
I have just started with Python. When I execute a python script file on Windows, the output window appears but instantaneously goes away. I need it to stay there so I can analyze my output. How can I keep it open?
How to keep a Python script output window open?
0
0
0
389,804
1,000,900
2009-06-16T11:31:00.000
2
0
1
1
python,windows
30,281,797
25
false
0
0
Apart from input and raw_input, you could also use an infinite while loop, like this: while True: pass (Python 2.5+/3) or while 1: pass (all versions of Python 2/3). This might use computing power, though. You could also run the program from the command line. Type python into the command line (Mac OS X Terminal) and it should say Python 3.?.? (Your Python version) It it does not show your Python version, or says python: command not found, look into changing PATH values (enviromentl values, listed above)/type C:\(Python folder\python.exe. If that is successful, type python or C:\(Python installation)\python.exe and the full directory of your program.
6
214
0
I have just started with Python. When I execute a python script file on Windows, the output window appears but instantaneously goes away. I need it to stay there so I can analyze my output. How can I keep it open?
How to keep a Python script output window open?
0.015999
0
0
389,804
1,001,744
2009-06-16T14:09:00.000
5
1
0
1
python,linux,encryption,passwords
1,001,833
3
true
0
0
Encrypting the passwords doesn't really buy you a whole lot more protection than storing in plaintext. Anyone capable of accessing the database probably also has full access to your webserver machines. However, if the loss of security is acceptable, and you really need this, I'd generate a new keyfile (from a good source of random data) as part of the installation process and use this. Obviously store this key as securely as possible (locked down file permissions etc). Using a single key embedded in the source is not a good idea - there's no reason why seperate installations should have the same keys.
1
7
0
First, my question is not about password hashing, but password encryption. I'm building a desktop application that needs to authentificate the user to a third party service. To speed up the login process, I want to give the user the option to save his credentials. Since I need the password to authentificate him to the service, it can't be hashed. I thought of using the pyCrypto module and its Blowfish or AES implementation to encrypt the credentials. The problem is where to store the key. I know some applications store the key directly in the source code, but since I am coding an open source application, this doesn't seem like a very efficient solution. So I was wondering how, on Linux, you would implement user specific or system specific keys to increase password storing security. If you have a better solution to this problem than using pyCrypto and system/user specific keys, don't hesitate to share it. As I said before, hashing is not a solution and I know password encryption is vulnerable, but I want to give the option to the user. Using Gnome-Keyring is not an option either, since a lot of people (including myself) don't use it.
How To Reversibly Store Password With Python On Linux?
1.2
0
0
2,912
1,002,627
2009-06-16T16:34:00.000
0
1
0
1
c#,python,windows,ssh
11,246,704
7
false
0
0
pexpect can't import on Windows. So, I use plink.exe with a Python subprocess to connect to the ssh server.
1
1
0
I want to be able to execute openssh with some custom arguments and then be able to automatically login to the server. I want that my script will enter the password if needed and inject 'yes' if I'm prompted to add the fingerprint to the known hosts. I've found SharpSsh for C# that do that, but I also need to use -D parameter and use ProxyCommand that I define in SSH, and the library is quite lacking for that usage. Another thing that I've found was pexcept for Python that should do the trick but I couldn't find where to download it, on the offical page I'm being redirectred from sourceforge to some broken link. Any help would be appreciated, Bill.
Automate SSH login under windows
0
0
0
3,061
1,003,131
2009-06-16T18:21:00.000
1
0
0
0
python,frameworks,web-frameworks
2,246,687
7
false
1
0
I would absolutely recommend Repoze.bfg with SQLAlchemy for what you describe. I've done projects now in Django, TurboGears 1, TurboGears 2, Pylons, and dabbled in pure Zope3. BFG is far and away the framework most designed to accomodate a project growing in ways you don't anticipate at the beginning, but is far more lightweight and pared down than Grok or Zope 3. Also, the docs are the best technical docs of all of them, not the easiest, but the ones that answer the hard questions you're going to encounter the best. I'm currently doing a similar thing where we are overhauling a bunch of legacy databases into a new web deliverable app and we're using BFG, some Pylons, Zope 3 adapters, Genshi for templating, SQLAlchemy, and Dojo for the front end. We couldn't be happier with BFG, and it's working out great. BFGs classes as views that are actually zope multi-adapters is absolutely perfect for being able to override only very specific bits for certain domain resources. And the complete lack of magic globals anywhere makes testing and packaging the easiest we've had with any framework. ymmv!
4
4
0
I need your advices to choose a Python Web Framework for developing a large project: Database (Postgresql)will have at least 500 tables, most of them with a composite primary key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements are coming. Will a ORM be helpful?
python web framework large project
0.028564
1
0
2,101
1,003,131
2009-06-16T18:21:00.000
2
0
0
0
python,frameworks,web-frameworks
1,003,329
7
false
1
0
Depending on what you want to do, you actually have a few possible frameworks : [Django] Big, strong (to the limit of what a python framework can be), and the older in the race. Used by a few 'big' sites around the world ([Django sites]). Still is a bit of an overkill for almost everything and with a deprecated coding approach. [Turbogears] is a recent framework based on Pylons. Don't know much about it, but got many good feedbacks from friends who tried it. [Pylons] ( which Turbogears2 is based on ). Often saw at the "PHP of Python" , it allow very quick developements from scratch. Even if it can seem inappropriate for big projects, it's often the faster and easier way to go. The last option is [Zope] ( with or without Plone ), but Plone is way to slow, and Zope learning curve is way too long ( not even speaking in replacing the ZODB with an SQL connector ) so if you don't know the framework yet, just forget about it. And yes, An ORM seem mandatory for a project of this size. For Django, you'll have to handle migration to their database models (don't know how hard it is to plug SQLAlchemy in Django). For turbogears and Pylons, the most suitable solution is [SQLAlchemy], which is actually the most complete ( and rising ) ORM for python. For zope ... well, nevermind Last but not least, I'm not sure you're starting on a good basis for your project. 500 tables on any python framework would scare me to death. A boring but rigid language such as java (hibernate+spring+tapestry or so) seem really more appropriate.
4
4
0
I need your advices to choose a Python Web Framework for developing a large project: Database (Postgresql)will have at least 500 tables, most of them with a composite primary key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements are coming. Will a ORM be helpful?
python web framework large project
0.057081
1
0
2,101
1,003,131
2009-06-16T18:21:00.000
8
0
0
0
python,frameworks,web-frameworks
1,003,173
7
false
1
0
Yes. An ORM is essential for mapping SQL stuff to objects. You have three choices. Use someone else's ORM Roll your own. Try to execute low-level SQL queries and pick out the fields they want from the result set. This is -- actually -- a kind of ORM with the mappings scattered throughout the applications. It may be fast to execute and appear easy to develop, but it is a maintenance nightmare. If you're designing the tables first, any ORM will be painful. For example, "composite primary key" is generally a bad idea, and with an ORM it's almost always a bad idea. You'll need to have a surrogate primary key. Then you can have all the composite keys with indexes you want. They just won't be "primary". If you design the objects first, then work out tables that will implement the objects, the ORM will be pleasant, simple and will run quickly, also.
4
4
0
I need your advices to choose a Python Web Framework for developing a large project: Database (Postgresql)will have at least 500 tables, most of them with a composite primary key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements are coming. Will a ORM be helpful?
python web framework large project
1
1
0
2,101
1,003,131
2009-06-16T18:21:00.000
12
0
0
0
python,frameworks,web-frameworks
1,003,161
7
false
1
0
Django has been used by many large organizations (Washington Post, etc.) and can connect with Postgresql easily enough. I use it fairly often and have had no trouble.
4
4
0
I need your advices to choose a Python Web Framework for developing a large project: Database (Postgresql)will have at least 500 tables, most of them with a composite primary key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements are coming. Will a ORM be helpful?
python web framework large project
1
1
0
2,101
1,003,302
2009-06-16T18:50:00.000
-2
0
0
0
python,django
1,004,658
4
false
1
0
Edit: Added some more information about why I present this answer here. I found chartbeat when I tried to answer this same question for my django based site. I don't work for them. Not specifically Django, but chartbeat.com is very interesting to add to a website as well. django-tracking is great, +1 for that answer, etc. Couple of things I could not do with django-tracking, that chartbeat helped with; tracked interactions with completely cached pages which never hit the django tracking code and pages not delivered through django (e.g. wordpress, etc.)
1
3
0
In Django, how can I see the number of current visitors? Or how do I determine the number of active sessions? Is this a good method? use django.contrib.sessions.models.Session, set the expiry time short. Every time when somebody does something on the site, update expiry time. Then count the number of sessions that are not expired.
Number of visitors in Django
-0.099668
0
0
4,771