Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
3,139,414
2010-06-29T09:32:00.000
7
0
0
0
c++,python,qt,pyqt
3,139,453
5
false
0
1
With Python you don't have to build your project. That's enough of a time saver I guess. And Pyqt bindings are awesome. I'm definitely more efficient with pyqt than with qt/C++.
5
47
0
Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity? In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that. However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python. I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install. Thoughts?
Qt programming: More productive in Python or C++?
1
0
0
16,818
3,139,414
2010-06-29T09:32:00.000
3
0
0
0
c++,python,qt,pyqt
3,139,458
5
false
0
1
Whether you use python or C++ depends more on the application you are building and not so much on Qt. If you are building an application which is resource heavy and needs lots of resources like CPU and memory, C++ would be a better bet. On the other hand, if you application is more UI driven, python provides lot of other benefits in terms of rapid development and rich libraries.
5
47
0
Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity? In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that. However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python. I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install. Thoughts?
Qt programming: More productive in Python or C++?
0.119427
0
0
16,818
3,139,414
2010-06-29T09:32:00.000
33
0
0
0
c++,python,qt,pyqt
3,139,451
5
false
0
1
If one or the other, I'd actually suggest Python in spite of being a C++ enthusiast. With Python code you don't have to bother with the MOC, portability, build times, etc. Just compare the work involved in implementing a QT slot in C++ vs. PyQT or PySide, e.g. I find it to be much less of a pain to deal with widgets this way (much greater productivity). You can still invoke C++ code from Python in cases where you need the added performance. If you do use a combination, consider extending Python rather than embedding it. Python is generally better suited to embed C/C++ code than to be embedded into a C/C++ system. It also tends to make more sense that way as applications are generally composed of far more mundane, non-performance critical code than performance-critical code, so writing your application primarily as a python application with C/C++ functions attached to it fits that kind of system design better.
5
47
0
Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity? In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that. However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python. I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install. Thoughts?
Qt programming: More productive in Python or C++?
1
0
0
16,818
3,139,414
2010-06-29T09:32:00.000
31
0
0
0
c++,python,qt,pyqt
3,139,545
5
true
0
1
My Opinion (having tried out C++ and Python in general and specifically in Qt case): Python always wins in terms of 'programmer productivity' and 'peace of mind'. PyQt represent Qt very well and hence question doesn't remain of "Qt with Python" or "Qt with C++", in general python is more productive unless off-course you need speed or something which isn't available in python. Best way for you to arrive at the answer would be to write a simple project first in C++ and then same project in python and compare, but that could be biased towards python as after coding the project once you may find it easy in Python, so try another project too and first do it in Python and then in C++.
5
47
0
Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity? In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that. However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python. I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install. Thoughts?
Qt programming: More productive in Python or C++?
1.2
0
0
16,818
3,139,414
2010-06-29T09:32:00.000
11
0
0
0
c++,python,qt,pyqt
7,457,626
5
false
0
1
definitely Python. Yes, people will say that Python is more productive without a reason. Some of the answers mention that you do not have to recompile. I will give you some more details Python is one layer of abstraction over C++, so you can think and express your designs with less code. Your program might not run as fast, but sure you express faster in code what you want. The most common case is when you launch your application, load some files, setup the environment and open a dialog. There you notice that a button is not working or where it should be. Now that is the point where most people close the application, bind one slot here, one signal there... and start the application, load the files, setup... with python you just write the code and fire up the dialog again, not the whole application. I do not know about you, but that type of task is what I do most of the time with Qt Python gives you something that C++ does not have: introspection. You can explore a running program and pull out information about its components on runtime. Qt gives you partially this. You have that MOC layer where meta properties and meta information can be attached to Qt objects. All parts of a Python program can be introspected. Many people debugging Python code, or trying to understand how it works, are addicted to this for a good reason
5
47
0
Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity? In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that. However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python. I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install. Thoughts?
Qt programming: More productive in Python or C++?
1
0
0
16,818
3,141,063
2010-06-29T13:28:00.000
1
1
0
1
python,windows,ssh,tunneling,ssh-tunnel
3,141,104
2
false
0
0
There are ssh executables for Windows, so you can uses the subprocess.Popen approach. This is not exactly elegant, a pure Python approach would be better.
1
4
0
I'm looking for a way to implement SSH Dynamic Port Forwarding ('ssh -D') under Python. The problem is that it has to work under Windows, i.e., running SSH with popen/pexec/etc. won't work. Any ideas? cheers, Bruno Nery.
SSH Dynamic Port Forwarding ('ssh -D') in Python
0.099668
0
0
1,634
3,142,770
2010-06-29T16:38:00.000
1
0
0
1
python,dropbox
3,142,886
1
false
0
0
It looks that Dropbox preserves mtime when synchronizing files. Try to detect changed file by changed file size and/or checksum (MD5, SHA1 or so) instead of modification time. Or just ask Dropbox :) (I don't know if it has any API for this).
1
1
0
I want to run a script to check whether certain files in my Dropbox folder have changed. I am currently using os.path.getmtime() to check that the modified time is in some window of time.time(). The problem is that if I modify a file in my Dropbox folder from a different computer than where the script is set to run, the modified time does not change on that latter computer. Is there a good way to watch shared files that doesn't run into this problem? Thanks for any help! I am just getting into python. *******UPDATE******* I have been playing more with how Dropbox handles file timestamping. It only updates the mtime if the file changes. If you open a file, modify it, but save it unchanged, the mtime stays the same.
os.path.getmtime of shared files in Dropbox
0.197375
0
0
384
3,143,106
2010-06-29T17:17:00.000
1
0
1
0
python,import,depth
3,143,143
3
false
1
0
Not really. A module imports stuff from other modules because it needs to use them in that module, otherwise it'll break.
3
2
0
I've noticed that importing a module will import its functions and methods, and the functions and methods of those as well. Is there a set rule for how many levels down python will import when you import an upper-level module? edit sorry, I think I've been misunderstood by the answers so far responding about multiple imports of some dependencies. I'm thinking of nested folders e.g. in django, if you import django, you can access django.contrib.auth, but you can't access django.contrib.auth.views unless you import that specifically. I was just wondering if it's always two levels down in such a case second edit to clarify again.. in the django example, the layout is /django/contrib/auth/views.py, where each of the subfolders has a "init.py" making it a module, none of which define any "all" attributes. Is my example bad, since maybe you can't use the dot syntax to navigate to a file within a module designated folder?
python import depth
0.066568
0
0
1,549
3,143,106
2010-06-29T17:17:00.000
3
0
1
0
python,import,depth
3,143,155
3
false
1
0
No, python will import what it needs to import. However, each module is only imported once. For example, if one module does import sys and another module does import sys, it will not physically do it twice.
3
2
0
I've noticed that importing a module will import its functions and methods, and the functions and methods of those as well. Is there a set rule for how many levels down python will import when you import an upper-level module? edit sorry, I think I've been misunderstood by the answers so far responding about multiple imports of some dependencies. I'm thinking of nested folders e.g. in django, if you import django, you can access django.contrib.auth, but you can't access django.contrib.auth.views unless you import that specifically. I was just wondering if it's always two levels down in such a case second edit to clarify again.. in the django example, the layout is /django/contrib/auth/views.py, where each of the subfolders has a "init.py" making it a module, none of which define any "all" attributes. Is my example bad, since maybe you can't use the dot syntax to navigate to a file within a module designated folder?
python import depth
0.197375
0
0
1,549
3,143,106
2010-06-29T17:17:00.000
1
0
1
0
python,import,depth
3,143,238
3
false
1
0
There is no pre-defined import depth level. Import statements are executed, just like any other python statement. But, you may wonder, how are cycles avoided? Modules are added to sys.modules (i.e., cached) when they get imported for the first time, and that is the first location examined when an import statement is executed. So each module is loaded just once, although it may appear in many import statements.
3
2
0
I've noticed that importing a module will import its functions and methods, and the functions and methods of those as well. Is there a set rule for how many levels down python will import when you import an upper-level module? edit sorry, I think I've been misunderstood by the answers so far responding about multiple imports of some dependencies. I'm thinking of nested folders e.g. in django, if you import django, you can access django.contrib.auth, but you can't access django.contrib.auth.views unless you import that specifically. I was just wondering if it's always two levels down in such a case second edit to clarify again.. in the django example, the layout is /django/contrib/auth/views.py, where each of the subfolders has a "init.py" making it a module, none of which define any "all" attributes. Is my example bad, since maybe you can't use the dot syntax to navigate to a file within a module designated folder?
python import depth
0.066568
0
0
1,549
3,143,115
2010-06-29T17:18:00.000
4
1
0
0
python,orm,rest,frameworks
3,143,591
4
false
1
0
I'm new to python myself, and plan to get more in depth with it this year. I've had a few false starts at this, but always professional needs bring me back to PHP. The few times I've done some development, I've had really good experiences with web2py as a python framework. It's quite well done, and complete in features, while still being extremely lightweight. The database layer seems to be very flexible and mature. As for TDD/BDD and the rest of your questions, I don't have any experience with python options, but would be interested to hear what others say.
1
20
0
I'm lucky enough to have full control over the architecture of my company's app, and I've decided to scrap our prototype written in Ruby/Rails and start afresh in Python. This is for a few reasons: I want to learn Python, I prefer the syntax and I've basically said "F**k it, let's do it." So, baring in mind this is going to be a pretty intensive app, I'd like to hear your opinions on the following: Generic web frameworks ORM/Database Layer (perhaps to work with MongoDB) RESTful API w/ oAuth/xAuth authentication Testing/BDD support Message queue (I'd like to keep this in Python if possible) The API is going to need to interface with a Clojure app to handle some internal data stuff, and interface with the message queue, so if it's not Python it'd be great to have some libraries to it. TDD/BDD is very important to me, so the more tested, the better! It'll be really interesting to read your thoughts on this. Much appreciated. My best, Jamie
Architecting from scratch in Python: what to use?
0.197375
0
0
4,392
3,143,703
2010-06-29T18:38:00.000
0
0
0
1
python,google-app-engine,web-applications,webstore
3,143,745
2
false
1
0
It is hard to say if App Engine is suited to your particular needs without more details about what functionality you want your web store to present. It also depends a little bit on your background and experience. However, the "app like feel" and crafting a "completely unique feel" for your site is something you can accomplish on any reasonable platform - I expect the presentation style will be relatively independent of the backend you choose.
2
0
0
I've begun planning a kind of web store interface that I want to work on soon. I'm starting to import products from China and want to have a completely unique feel for my site. Now I'm kinda a google fanboy and have heard alot about google app engine. Mostly I like the hosting available with google more then anything though. But I wanted to know, would the App Engine be good for what I'm making? Namely a web store with an app like feel. I've decided, to help if I ever need to move my host, to work in web2py hosted in the App Engine. Or would I be better with django or something on a normal host? Is google best for webapps? Or is it pretty well suited for webstores as well? Thanks
How can I use google app engine?
0
0
0
171
3,143,703
2010-06-29T18:38:00.000
0
0
0
1
python,google-app-engine,web-applications,webstore
3,143,763
2
true
1
0
You can build almost anything on GAE. As Monk would say that is a blessing and a curse. GAE is relatively new and so e commerce ventures are relatively rare. This means you would be responsible for every piece of the site. Other dedicated e commerce technologies trade some of the control and look and feel for ease of use/setup. So in short yes you could use GAE to create an e commerce site, but you would be spending a lot of time getting it up and running and then managing it. Time you may find better spent on sales and marketing.
2
0
0
I've begun planning a kind of web store interface that I want to work on soon. I'm starting to import products from China and want to have a completely unique feel for my site. Now I'm kinda a google fanboy and have heard alot about google app engine. Mostly I like the hosting available with google more then anything though. But I wanted to know, would the App Engine be good for what I'm making? Namely a web store with an app like feel. I've decided, to help if I ever need to move my host, to work in web2py hosted in the App Engine. Or would I be better with django or something on a normal host? Is google best for webapps? Or is it pretty well suited for webstores as well? Thanks
How can I use google app engine?
1.2
0
0
171
3,144,529
2010-06-29T20:37:00.000
0
0
1
0
python
3,144,564
2
false
0
0
As far as I know, no. I've never heard of such a thing being possible with a terminal, in Python or any other language. The closest way I can think of to fake it would be to put the terminal in silent mode (so that input characters are not echoed) and unbuffered mode (so that you get each character typed as it's typed, without waiting for the end of the line), then read each input character one by one; if it's a digit, print it and append it to a string, otherwise discard it. But I'm not even sure if the terminal would allow you to do that.
1
3
0
Is there a way to accept only numbers in Python, say like using raw_input()? I know I can always get the input and catch a ValueError exception, but I was interested in knowing whether there was someway I could force the prompt to accept only numbers and freeze on any other input.
Accepting only numbers as input in Python
0
0
0
3,962
3,145,483
2010-06-29T23:22:00.000
5
0
1
0
python,memory,performance,generator,yield
3,145,497
3
false
0
0
This cannot be done. Once a generator is exhausted it needs to be reconstructed in order to be used again. It is possible to define the __len__() method on an iterator object if the number of items is known ahead of time, and then len() can be called against the iterator object.
2
5
0
I have a generator for a large set of items. I want to iterate through them once, outputting them to a file. However, with the file format I currently have, I first have to output the number of items I have. I don't want to build a list of the items in memory, as there are too many of them and that would take a lot of time and memory. Is there a way to iterate through the generator, getting its length, but somehow be able to iterate through it again later, getting the same items? If not, what other solution could I come up with for this problem?
Python: get number of items in generator without storing the items
0.321513
0
0
784
3,145,483
2010-06-29T23:22:00.000
5
0
1
0
python,memory,performance,generator,yield
3,145,493
3
true
0
0
If you can figure out how to just write a formula to calculate the size based on the parameters that control the generator, do that. Otherwise, I don't think you would save much time. Include the generator here, and we'll try to do it for you!
2
5
0
I have a generator for a large set of items. I want to iterate through them once, outputting them to a file. However, with the file format I currently have, I first have to output the number of items I have. I don't want to build a list of the items in memory, as there are too many of them and that would take a lot of time and memory. Is there a way to iterate through the generator, getting its length, but somehow be able to iterate through it again later, getting the same items? If not, what other solution could I come up with for this problem?
Python: get number of items in generator without storing the items
1.2
0
0
784
3,147,213
2010-06-30T07:29:00.000
0
0
1
0
python,macports,installation
5,876,565
1
false
0
0
This answer is outdated, see Mark's response below I had trouble installing python and python libraries on osx, and this is what I ended up doing to fix it: Using macports I installed python26 and python_select. Then use python_select to change from the default python26-apple to python26 (which is from macports). Now when you use macports to install any python26 library it will just work. One of the main drawbacks of this approach is that macports installs everything from source, which is slow and buggy compared to using pre-build binaries, but for me it's worth it to be able to manage most of my FOSS software through macports.
1
0
0
I would like to install: A. Mod python on a regular Macbookpro (MacOSX 10.6.4) B. And MySQL for Python on the same computer. And the installation is constantly failing. Question 1: Is there a tutorial on how to achieve this on Mac OS? I also hoped that I could use Macports for this. I had bad experience with Macports and installing python. I am sure this is due to my not understanding the concept of: ports profile (pythonpath) Question 2: What would I have to write in the .profile to make packages be recognized by python? Question 3: What exactly is a port? In general it would be awesome to get an understanding on how to install packages in python quick and effectively. Also the build in version of Python by Apple seems to have settings, that, if changed can make your life difficult. Question 4: Any detailed experience or advice on this issues would he very helpful. For a quick start into programming. Thanks!
Python library installing macports
0
0
0
285
3,147,267
2010-06-30T07:38:00.000
0
1
0
1
python,google-app-engine,email
3,194,130
4
true
1
0
easiest is to encode an email address via base64 or simiar encoding and prefixed it to from address. all address from something@myapp.appspotmail.com are valid email address for from in gae. simply create a mail receive handler. decode the from string and get the email address to whom you send the email originally. sad thing is maximum 64 character length allowed for local part. in that case storing email address in datastore and using its key as a local part to email can be a option.
1
3
0
sometime due to wrong input from user side, mail bounce and did not reach the recipient. ( sent from google app engine.) How to detect such email ? edit: may be i was not clear in my question : I want to know to which mail i have sent the mail which was return ( so that i may alert the user or delete the email id ). this is more related to how email bounce works. normally the bounce mail does not come exactly same as sent but with different information, is there any particular header or something there to know which email id was that ? ... i think i have figure out while writing these, i am keeping this question so it might help somebody. i will simply mail from base64encodedrecipientemailaddress@myapp.appspot.com and create a mail receive handler. :) so one more question : what is the maximum length does app-engine ( or any mail server ) allows for email address ?
how to detect bounce mail in google app engine?
1.2
0
0
1,227
3,147,570
2010-06-30T08:28:00.000
3
0
1
0
python,list
3,147,622
3
false
0
0
eval("['elem1','elem2']") gives you back list ['elem1','elem2'] If you had string looking like this ["elem1","elem2",(...)] you might use json.read() (in python 2.5 or earlier) or json.loads() (in python 2.6) from json module to load it safely.
1
2
0
I have a reeeealy huge string, which looks like ['elem1','elem2',(...)] and contains about 100,000(!) elements. What is the best method to change it back to a list?
Convert array to string
0.197375
0
0
2,090
3,147,754
2010-06-30T08:55:00.000
2
0
0
1
c++,python,installation,cmake
3,150,286
1
true
0
0
Python doesn't really have to be installed to function properly. For my own CMake based projects on Windows, I just use a .zip file containing the entire python tree. All you need to do is extract it to a temporary directory, add it to your path, and set your PYTHONHOME/PYTHONPATH environment variables. Once that's done, you have a fully operational Python interpreter at your disposal. About the only 'gotcha' on Windows is to make sure you remember to copy the Python DLL out of C:\Windows\system32 into the top-level Python directory prior to creating the .zip.
1
2
0
I have a large, crossplatform, python-dependent project, which is built by CMake. In linux, python is either preinstalled or easily retrived by shell script. But on windows build, i have to install python manually from .msi before running CMake. Is there any good workaround using cmake scripts? PS All other external dependencies are downloaded from dedicated FTP server.
Python-dependency, windows (CMake)
1.2
0
0
1,123
3,148,483
2010-06-30T10:50:00.000
2
0
1
0
python,py2exe
5,093,220
1
true
0
0
An effective solution is to bundle everything in an standalone executable using bundle_files:1 in your setup.py py2exe options.
1
2
0
I use Py2exe to package a Python application with quite a few dependant packages. While Py2exe works flawlessly the resulting dist/ folder with the executable contains a large number (10-15) of support files (.dll, .pyd, .zip). Ideally I would like to be able to place all of these dependant files in a folder called support/ or lib/ or something to that effect. This way when people download the application and extract the archive they are only presented with an executable and some folders. Does Py2exe support placing dependant files in a sub-folder? If so, how can one accomplish this.
Py2exe Directory Structure
1.2
0
0
564
3,149,370
2010-06-30T12:50:00.000
0
0
0
0
python,sqlite
3,151,119
1
false
0
0
Search for PYTHONPATH. You probably have different settings in your OS and Netbeans.
1
0
0
I've decided to give Python a try on Netbeans. The problem so far is when try to run program I know works, i.e. if I ran it through the terminal. For the project I selected the correct Python version (2.6.5). And received the following error: Traceback (most recent call last): File "/Users/XXX/NetBeansProjects/NewPythonProject3/src/newpythonproject3.py", line 4, in import sqlite3 ImportError: No module named sqlite3
Netbeans + sqlite3 = Fail?
0
1
0
184
3,149,579
2010-06-30T13:17:00.000
5
0
1
0
python,geolocation
3,149,659
1
true
0
0
AFAIK, there's no elegant solution. You can make educated guesses, but then, take this example: I unplug my laptop in Germany and go to the USA. I plug it in the US office - the regional settings are the same, the time zone didn't change, now what? Things from which you can make a guess: regional and language settings (but a German in the USA can be using de_DE) time zone (but are we in NYC or in Brazil? same TZ offset; in your case, (PDT/EDT) and CET is different enough) internal IP address (assuming your offices have different internal addressing (e.g. "10.5.20.0/24 - Germany, 192.168.4.0/24 - USA"; what of the VPNs, what about unconnected devices?) external IP address (if you need accuracy on the scale USA/Europe, this is passable; of course, VPNs mess this up, and question says external connectivity may not be available) keeping a list of which computer is where (messy and hard to maintain) keeping a list of which user is where remembering where this computer was on last program start (and whether it was corrected manually) By assigning a score to each of these things, and checking for each, you could get a probability score where the computer is. You might get some incorrect guesses though, so make a manual override, too. The combined score might be quite accurate in the general case; what you need to do is find the edge and corner cases, then find some way to identify those.
1
3
0
My client has two offices in Germany and USA and a python program should recognize the office location. What will be the most elegant way to implement this? It only have to recognize the country. Furthermore it also could happens that there will be no permanent internet connection. The program works on windows but the solution should be os independent. Any suggestions? Thanks
How to recognize current location in python?
1.2
0
0
264
3,151,989
2010-06-30T17:55:00.000
2
0
0
0
python,rabbitmq
3,156,646
1
true
0
0
If I understand correctly, this is your setup: you have a producer publishing to a direct exchange; you have a queue bound to that exchange; you have many subscribers, all consuming from the above queue. This works perfectly for sending a message to an arbitrary subscriber (thus sort-of load balancing), but you want to be able to send some messages to ALL the subscribers. You could do this with a fanout exchange and an extra queue for each subscriber: your producer publishes system-wide messages to a fanout exchange; there's a queue for each subscriber bound to that exchange; each subscriber first attempts to consume from this queue; if it doesn't succeed, it tries to consume from the common queue you currently use.
1
0
0
Consider a tier of N-many subscribers, all connected to a direct exchange using identical queue name and routing key values. This creates a load-balanced system where an inbound message is send round-robin to 1 of the subscribers. This works very well for dealing with scale-out issues as more subscribers can be added as load increases and can later be withdrawn if necessary. Now consider the requirement of being able to send messages to ALL subscribers in that tier, without knowing how many there are (for example a "reset your state" or "shutdown now please" administrative message). Is there any way to do this in rabbitmq? If this isn't possible, is there a better approach? My environment is Python using amqplib.
How to broadcast to ALL subscribers w/identical queue name/routing key vals on a direct exchange
1.2
0
0
1,786
3,153,961
2010-06-30T22:46:00.000
0
1
0
0
php,python,phpbb,pygments
5,054,521
3
false
0
0
If you're interested in diving into Python, you could write an external script or server application to update new posts with syntax-highlighted code. If it were me, I'd retain the original code in one database column and place the syntax-highlighted version in another. A simple script to update new posts in batches could run as a cron job at whatever interval you find ideal. To support a near real-time scenario, you could write a server application that sits and waits to be notified of new posts one at a time. For example, upon processing a new post, the PHP application could send the highlighting application a message through an AMQP queue.
2
1
0
Is it possible to use Python (specifically Pygments) with PHP? Currently, I have a phpBB forum that I'm developing for and JS Syntax Highlighters just haven't been working for me. There's already a GeSHI mod, but I want to develop something myself just for experience. Also, would there be performance issues?
Using Pygments with PHP (Python in PHP)
0
0
0
2,098
3,153,961
2010-06-30T22:46:00.000
1
1
0
0
php,python,phpbb,pygments
3,154,550
3
true
0
0
Pretty much the only way to perform that integration (with PHP as the dominant language) is to shell out. This means starting python manually every time you need it. That can be a little slow if you need to do it a lot. You can mitigate this by creating the syntax hilite when posts are created or edited, not when viewing.
2
1
0
Is it possible to use Python (specifically Pygments) with PHP? Currently, I have a phpBB forum that I'm developing for and JS Syntax Highlighters just haven't been working for me. There's already a GeSHI mod, but I want to develop something myself just for experience. Also, would there be performance issues?
Using Pygments with PHP (Python in PHP)
1.2
0
0
2,098
3,154,830
2010-07-01T03:03:00.000
1
0
1
0
python,pygame
3,154,895
8
false
0
1
You don't need a grid to help you, you just need to know the origin point (easy - it is one of the corners). Since it is all interpreted, I say you just hack around displaying stuff on the screen till it clicks in your head. The other part is easy. It is Red, Blue, Green (each one goes from 0-255, 0 is no-color, 255 is full-color).
1
1
0
I've just started to learn pygame, and it pretty much needs some coordinates and points in the code in order to position the object. Do you know of any tool or application that I could use as a reference so that I could see a visual representation of the points. Maybe a grid with numbers. And pygame also includes declaring the color by using numbers. Do you know of any site or application that I can use as reference to those numbers and corresponding color. Like this one: 230, 170, 0 And what do these numbers mean. I'm using windows operating system.
tools for pygame
0.024995
0
0
1,295
3,154,900
2010-07-01T03:26:00.000
0
0
0
1
python,google-app-engine,exception-handling,global
3,154,925
3
false
1
0
You application probably has a main() function, put the try/except in that function, and it'll catch everything from your application.
2
2
0
Instead of encapsulating my entire code in a try{} except{} block, is there someway of catching exceptions globally? Basically I am looking for a way to have a global exception handler which will handle all unhandled exceptions in the my python application written for google app engine
Global Exception Handling in Google App Engine
0
0
0
1,028
3,154,900
2010-07-01T03:26:00.000
0
0
0
1
python,google-app-engine,exception-handling,global
3,154,924
3
false
1
0
Well, at the most basic level you could wrap all of your handler scripts referenced by app.yaml in a giant try-except block. If you are using the webapp framework, consider overriding handle_exception() for each of your request handlers. If you want all of your request handlers to have some basic exception handling that you specify, you could a request handler which implements this method and then derive all of your handlers from it.
2
2
0
Instead of encapsulating my entire code in a try{} except{} block, is there someway of catching exceptions globally? Basically I am looking for a way to have a global exception handler which will handle all unhandled exceptions in the my python application written for google app engine
Global Exception Handling in Google App Engine
0
0
0
1,028
3,155,441
2010-07-01T06:10:00.000
0
0
1
0
python
3,155,473
4
false
0
0
you should always use xrange rather than range for just looping n times over sth., but keep in mind that xrange has also a limit (if it is too small you need to do your own while loop with a counter) EDIT: too late...
1
3
0
In Python, is there some short way to do something like "for i in range(n)" when n is too big for Python to actually create the array range(n)? (short because otherwise I'd just use a while loop)
python for loop range(bigint)
0
0
0
4,845
3,155,462
2010-07-01T06:16:00.000
1
0
1
0
python,windows,symlink
3,265,203
1
true
0
0
I just did it on Windows 7 using Python 2.7, and it works. Here are the steps I followed. open a windows command prompt with necessary privileges cd to the site-packages directory cd c:\Python27\Lib\site-packages create the link mklink /D modulename c:\path\to\module\real\location\modulename
1
2
0
I tried to create a symbolic link in the Python site-packages directory using the mklink /D syntax (on a Windows 7 machine). Unfortunately the module is not found when using import clause. When I copy the module physicaly to site-package directory, it works OK. Am I doing something wrong or is this just not possible on Windows? I am using Python 2.6.
Can modules be added to the Python search path (e.g site-packages dir) using symbolic links on Windows?
1.2
0
0
1,245
3,155,624
2010-07-01T06:52:00.000
1
0
0
0
python,django,django-admin,customization
33,733,949
4
false
1
0
Django Admin is easy to customize if your requirements match what is customizable in Django. If you need fancy features that are not out-of-the-box functionality you either need to find a plugin that does it, or implement it yourself by subclassing the appropriate classes. Which can be difficult, and requires good understanding of the internals of Django. So in summary: it makes it easier to setup an admin, but if you need anything special that's not out of the box: you got a steep learning curve. Depending on your requirements you can choose to use django or not. Anything that requires a lot of functional speccing is better of implemented manually.
2
25
0
I have been playing for a couple of days with Django Admin to explore it, but I am still clueless of how it can be customized in the way we need. Every time I look for any help for the customization in the admin panel, what I find is, a bunch of articles on various communities and forums, explaining how to customize the template, the lists items, the the column views etc. But that should not be called Django Customization. If I need to make even a small change in the User functionality or any modification to the auth module. It takes a lots of efforts even in figuring out how that can be done. Is Django that difficult to customize or its just lack of the help available over internet for this or its me who is moving in the wrong direction ?
Is Django admin difficult to customize?
0.049958
0
0
21,336
3,155,624
2010-07-01T06:52:00.000
3
0
0
0
python,django,django-admin,customization
11,705,960
4
false
1
0
Personally, if you want a site to look like the admin, why not pull the templates and styles and use them, build your own views for what you need. Gobs of documentation and forum help is there for that. I like the idea of customizing the admin, but honestly, I have been doing it for awhile on a project and time and time again I think to myself, if this was built in the standard MVC (or MTV) manner with free templates online, copied admin ones, or some professionally made ones, and built with the plethora of addons and my code, it would be much easier!!! And, when you decide that request/response isn't cutting it, and you want to add lots of JavaScript, you'll be glad. I know. I have had to put all sorts of JavaScript on our Admin project. Mostly because it's impossible to make the admin do what we want, so we fix it with JavaScript once it is on screen. When you find yourself writing an Ajax based system, you'll wonder why you have the admin at all. If I could start this project over, I might not even use Django, but I probably would. I most certainly won't used the Admin. Now, if you are building an basic CRUD type site that doesn't have style-eyed users, then Django with grappelli, and some elbow grease will get the job done. Remember, Django is a collection of Python scripts. Just override everything you can, and you'll get there, if you aren't too ambitious.
2
25
0
I have been playing for a couple of days with Django Admin to explore it, but I am still clueless of how it can be customized in the way we need. Every time I look for any help for the customization in the admin panel, what I find is, a bunch of articles on various communities and forums, explaining how to customize the template, the lists items, the the column views etc. But that should not be called Django Customization. If I need to make even a small change in the User functionality or any modification to the auth module. It takes a lots of efforts even in figuring out how that can be done. Is Django that difficult to customize or its just lack of the help available over internet for this or its me who is moving in the wrong direction ?
Is Django admin difficult to customize?
0.148885
0
0
21,336
3,155,748
2010-07-01T07:17:00.000
2
1
0
1
python,linux,testing
3,155,835
1
true
0
0
You could make an object which does the chmod, and inject a mock when testing. This mock would not really do the chmod, but make it possible to test if it was called with the right parameters.
1
0
0
I wrote a function that copies the /etc/skel directory on a linux machine during a "create new user" RPC call. Now, there is quite a few things about this I want to test, for example the files in /etc/skel and the targets of symlinks should not have changed permissions afterwards, whereas the copied files including the actual symlinks should have a changed owner. Now, i can create my test directory and files using mkdtemp and stuff, but I can't chown those to another user without root privileges. How would you write a test for this?
How to test a function that deals with setting file ownership without being root
1.2
0
0
177
3,155,961
2010-07-01T07:54:00.000
0
0
0
1
python,linux,webcam,video-capture
3,156,482
5
false
0
0
If you have a favorite video capture C library, you can probably write a simple facade to it using the ctypes module.
2
7
0
I want to write an application to video capture from web-cams in linux. Is there a python library to do that?
What's the best library for video capture in Python on linux?
0
0
0
11,928
3,155,961
2010-07-01T07:54:00.000
0
0
0
1
python,linux,webcam,video-capture
3,158,044
5
false
0
0
there is a lib called open-cv. Try that. It has a lot of features for handling images as well.
2
7
0
I want to write an application to video capture from web-cams in linux. Is there a python library to do that?
What's the best library for video capture in Python on linux?
0
0
0
11,928
3,157,875
2010-07-01T12:45:00.000
17
0
0
0
python,django,logging,django-admin
3,157,915
3
false
1
0
Log is in django_admin_log table in database used by django.
1
32
0
I need to track/log activity on the Django admin. I know there are messages stored by admin somewhere, but I don't know how to access them in order to use them as a simple log. I'm trying to track the following: User performing the action Action committed Datetime of action Thanks guys.
Logging activity on Django's admin - Django
1
0
0
30,210
3,158,589
2010-07-01T14:12:00.000
4
0
0
0
python,django,django-admin,http-status-code-404
7,615,435
3
true
1
0
I had this same problem. The solution for me was to move my calls to admin.site.register() to admin.py. With DEBUG set to false, your models are lazily loaded, so the registration calls don't always get made. Apparently admin.py is always loaded at init time, however.
1
4
0
We're using the Django Admin to maintain some data that's exported to a few of our sites. Sometimes when clicking through the standard changelist view to get a model edit form instead of being routed to the correct page we're getting the Django 404 page/template. It was happening somewhat sporatically, and we could for a while reproduce it by reloading three times: First F5: 404 Second F5: 404 Third F5: Object change form loads correctly But lately it's been returning 404 more often than not. It seems to reduce the odds of returning 404 when we bounce apache (gracefully) and gets worse (again, seemingly) with more requests. Running Django 1.2.1 on Fast-CGI/MySQL 5.1.x FWIW, I can't reproduce the problem on my VM, but I'm running mod_wsgi there and have Debug=True set in the settings. Otherwise the code and database is identical.
Django Admin Intermittently Returning 404 On Model Edit
1.2
0
0
1,528
3,159,878
2010-07-01T16:48:00.000
3
0
0
0
python
3,161,473
2
false
0
0
One advice if you've never done any programming before is: small steps. Write a small program that extracts things from a SQLite database and just prints them. Learn how that works and throw it away. Do the same with reading files, make a simple GUI and so on with all the aspects you need to know for your program. Once you know the pieces, try putting them together.
1
2
0
I've never written a program, (although I've dabbled in Access and am familiar with OOP concepts), and have decided to undertake the challenge of writing myself a database program for home use. (It'll keep track of our finances and be customized to our way of doing things.) I've pretty much decided to use Python and SQLite, but that still leaves other decisions to be made. I think I should get experienced advice and help choosing because I know nothing about the pros and cons (for my situation) of what's out there. I know I'll need reports of some kind (something similar to Access reports would be ideal). Also I'll need (the easiest way) to build a UI. What are some softwares that I (total beginner) should look at for those purposes? And are there other tools will I need besides those? Thanks a lot for your help. Update. Are there any drag and drop form and report development tools for Python/Sqlite (similar to Access)? What about opinions on Netbeans IDE and Swing UI for me?
Beginner needing experienced advice for important choices
0.291313
0
0
172
3,160,699
2010-07-01T18:39:00.000
0
0
1
0
python,progress-bar
3,160,926
42
false
0
0
You should link the progress bar to the task at hand (so that it measures the progress :D). For example, if you are FTPing a file, you can tell ftplib to grab a certain size buffer, let's say 128K, and then you add to your progress bar whatever percentage of the filesize 128k represents. If you are using the CLI, and your progress meter is 20 characters long, you would add one character when 1/20th of the file had transferred.
1
476
0
How do I use a progress bar when my script is doing some task that is likely to take time? For example, a function which takes some time to complete and returns True when done. How can I display a progress bar during the time the function is being executed? Note that I need this to be in real time, so I can't figure out what to do about it. Do I need a thread for this? I have no idea. Right now I am not printing anything while the function is being executed, however a progress bar would be nice. Also I am more interested in how this can be done from a code point of view.
Python Progress Bar
0
0
0
744,169
3,162,096
2010-07-01T22:19:00.000
4
0
1
0
python,subprocess
3,162,133
4
false
0
0
It's usually safer to log the pids of all your child processes when you create them. There isn't a posix compliant way to list child PIDs. I know this can be done with the PS tool.
1
31
0
I'm using a third party library that starts various sub processes. When there's an exception I'd like to kill all the child processes. How can I get a list of child pids?
How do you list all child processes in python?
0.197375
0
0
26,041
3,162,450
2010-07-01T23:48:00.000
1
0
0
0
python,nlp,structured-data
3,166,594
4
false
0
0
Possibly look at "Collective Intelligence" by Toby Segaran. I seem to remember that addressing the basics of this in one chapter.
2
8
1
I am looking for references (tutorials, books, academic literature) concerning structuring unstructured text in a manner similar to the google calendar quick add button. I understand this may come under the NLP category, but I am interested only in the process of going from something like "Levi jeans size 32 A0b293" to: Brand: Levi, Size: 32, Category: Jeans, code: A0b293 I imagine it would be some combination of lexical parsing and machine learning techniques. I am rather language agnostic but if pushed would prefer python, Matlab or C++ references Thanks
Unstructured Text to Structured Data
0.049958
0
0
7,405
3,162,450
2010-07-01T23:48:00.000
0
0
0
0
python,nlp,structured-data
3,177,235
4
false
0
0
If you are only working for cases like the example you cited, you are better off using some manual rule-based that is 100% predictable and covers 90% of the cases it might encounter production.. You could enumerable lists of all possible brands and categories and detect which is which in an input string cos there's usually very little intersection in these two lists.. The other two could easily be detected and extracted using regular expressions. (1-3 digit numbers are always sizes, etc) Your problem domain doesn't seem big enough to warrant a more heavy duty approach such as statistical learning.
2
8
1
I am looking for references (tutorials, books, academic literature) concerning structuring unstructured text in a manner similar to the google calendar quick add button. I understand this may come under the NLP category, but I am interested only in the process of going from something like "Levi jeans size 32 A0b293" to: Brand: Levi, Size: 32, Category: Jeans, code: A0b293 I imagine it would be some combination of lexical parsing and machine learning techniques. I am rather language agnostic but if pushed would prefer python, Matlab or C++ references Thanks
Unstructured Text to Structured Data
0
0
0
7,405
3,163,688
2010-07-02T06:34:00.000
2
0
1
0
python,parsing,pyparsing
3,169,789
5
false
0
0
Switch to a generated C/C++ parser (using ANTLR, flex/bison, etc.). If you can delay all the action rules until after you are done parsing, you might be able to build an AST with trivial code and then pass that back to your python code via something like SWIG and process on it with your current actions rules. OTOH, for that to give you a speed boost, the parsing has to be the heavy lifting. If your action rules are the big cost, then this will buy you nothing unless you write your action rules in C as well (but you might have to do it anyway to avoid paying for whatever impedance mismatch you get between the python and C code).
1
22
0
I have a huge grammar developed for pyparsing as part of a large, pure Python application. I have reached the limit of performance tweaking and I'm at the point where the diminishing returns make me start to look elsewhere. Yes, I think I know most of the tips and tricks and I've profiled my grammar and my application to dust. What next? I hope to find a parser that gives me the same readability, usability (I'm using many advanced features of pyparsing such as parse-actions to start the post processing of the input which is being parsed) and python integration but at 10× the performance. I love the fact the the grammar is pure Python. All my basic blocks are regular expressions, so reusing them would be nice. I know I can't have everything so I am willing to give up on some of the features I have today to get to the requested 10× performance. Where do I go from here?
what next after pyparsing?
0.07983
0
0
4,398
3,164,241
2010-07-02T08:37:00.000
1
0
1
0
python,multithreading
3,164,364
1
true
0
0
Locals are thread-safe as they are not shared between threads. All constants (variables you never write to from any thread) are thread-safe. If that's all you have, then yes, that's fine. Ensure the class members you are talking about are really not written from any other thread. Check there are no underlying shared resources that might not be thread-safe, eg. if each thread is using the database connection object that may cause trouble, unless that object is specifically documented as being thread-safe.
1
5
0
I've read through the documentation on threading for python and as I've pereceived it the following should hold true: You can access (read) any PoD or python specific object (such as an array) without causing failure in a multi-threaded program trying the same thing at the same time, but you can not change them and accept thread integrity. My question is about classes. I have a server that is delegating database access to different threads, however I want them to be able to all access an instance of a class that handles response generation. However, I'm wondering if this class is thread-safe (I wish to avoid creating multiple instances), the thread does not change any instance variables (i.e. self.something = (something)) every function uses its own local variables (they do access class instance variables but does not change them), so to sum it up: my question is if many threads can use the same instance and call functions at the same time.
Thread safety in Python (Question how it works)
1.2
0
0
399
3,165,753
2010-07-02T12:46:00.000
5
0
0
1
python,django,google-app-engine
3,166,662
3
true
1
0
Welcome to Stack Overflow! One of the limitations in App Engine is that you cannot write directly to the filesystem from your app. Static files would be things like HTML, CSS, javascript and images that are global to your application, and get uploaded manually when you deploy. They are uploaded to and served from different servers than the ones that handle dynamic content. Since you can't write to the filesystem from your app, files uploaded by users must be saved to the datastore as blobs. These are not considered static files. As others have mentioned, you can use S3 or the Blobstore API, however both of these require billing. With the free quotas, each entity can be up to 1MB, and each HTTP request and response can be up to 10MB. Using standard entities with a BlobProperty, you can easily store and serve dynamically uploaded files up to 1MB, or 10MB if you want to get fancy and store your blob in slices across multiple entities.
1
3
0
I am developing an application in google application engine which would have a user profiles kind of feature. I was going through the Google App's online tutorial where I found that the maximum number of static files (app files and static files) should not exceed 3000. I am afraid whether the user's would be able to upload their images when the number of users increase. Is this limitation for the Free Quota only or its even after billing. In the document, its mentioned as the additional limit than the Free Quota. Please suggest. Thanks in advance.
Google application engine, maximum number of static files?
1.2
0
0
1,582
3,166,221
2010-07-02T13:44:00.000
0
0
1
0
python,image
3,166,629
4
false
0
0
It might be a lot easier to just generate a static web page with pictures than building a GUI for displaying pictures. You can just generate a hmtl page, put the images on it and start your web browser with the newly created html file. this gives you some possibilities for layout as well. If you just want a picture in the browser then muksie gave a working example.
1
2
0
How can I create a python script that runs through the images (1.jpeg-n.jpeg) in a directory on a mac and displays them in a browser OR via another python program? Do I import a file to python and than display in browser? Do I extract the file names 1,2,3,4,5 and add that to a list, which I give to another function that calls a browser and displays? Any help would be great. Thanks!
Python images display
0
0
0
18,628
3,167,154
2010-07-02T15:41:00.000
5
0
1
0
python
16,566,694
23
false
0
0
I can't actually contribute a real answer to this one (as I came here hoping to find one myself), but to me the number of differing approaches and all the caveats mentioned is the surest indicator that Python's os.path module desperately needs this as a built-in function.
5
211
0
I have a string variable which represents a dos path e.g: var = "d:\stuff\morestuff\furtherdown\THEFILE.txt" I want to split this string into: [ "d", "stuff", "morestuff", "furtherdown", "THEFILE.txt" ] I have tried using split() and replace() but they either only process the first backslash or they insert hex numbers into the string. I need to convert this string variable into a raw string somehow so that I can parse it. What's the best way to do this? I should also add that the contents of var i.e. the path that I'm trying to parse, is actually the return value of a command line query. It's not path data that I generate myself. Its stored in a file, and the command line tool is not going to escape the backslashes.
How to split a dos path into its components in Python
0.043451
0
0
252,238
3,167,154
2010-07-02T15:41:00.000
3
0
1
0
python
3,167,629
23
false
0
0
The stuff about about mypath.split("\\") would be better expressed as mypath.split(os.sep). sep is the path separator for your particular platform (e.g., \ for Windows, / for Unix, etc.), and the Python build knows which one to use. If you use sep, then your code will be platform agnostic.
5
211
0
I have a string variable which represents a dos path e.g: var = "d:\stuff\morestuff\furtherdown\THEFILE.txt" I want to split this string into: [ "d", "stuff", "morestuff", "furtherdown", "THEFILE.txt" ] I have tried using split() and replace() but they either only process the first backslash or they insert hex numbers into the string. I need to convert this string variable into a raw string somehow so that I can parse it. What's the best way to do this? I should also add that the contents of var i.e. the path that I'm trying to parse, is actually the return value of a command line query. It's not path data that I generate myself. Its stored in a file, and the command line tool is not going to escape the backslashes.
How to split a dos path into its components in Python
0.026081
0
0
252,238
3,167,154
2010-07-02T15:41:00.000
0
0
1
0
python
55,762,091
23
false
0
0
Below line of code can handle: C:/path/path C://path//path C:\path\path C:\path\path path = re.split(r'[///\]', path)
5
211
0
I have a string variable which represents a dos path e.g: var = "d:\stuff\morestuff\furtherdown\THEFILE.txt" I want to split this string into: [ "d", "stuff", "morestuff", "furtherdown", "THEFILE.txt" ] I have tried using split() and replace() but they either only process the first backslash or they insert hex numbers into the string. I need to convert this string variable into a raw string somehow so that I can parse it. What's the best way to do this? I should also add that the contents of var i.e. the path that I'm trying to parse, is actually the return value of a command line query. It's not path data that I generate myself. Its stored in a file, and the command line tool is not going to escape the backslashes.
How to split a dos path into its components in Python
0
0
0
252,238
3,167,154
2010-07-02T15:41:00.000
2
0
1
0
python
68,628,482
23
false
0
0
really easy and simple way to do it: var.replace('\\', '/').split('/')
5
211
0
I have a string variable which represents a dos path e.g: var = "d:\stuff\morestuff\furtherdown\THEFILE.txt" I want to split this string into: [ "d", "stuff", "morestuff", "furtherdown", "THEFILE.txt" ] I have tried using split() and replace() but they either only process the first backslash or they insert hex numbers into the string. I need to convert this string variable into a raw string somehow so that I can parse it. What's the best way to do this? I should also add that the contents of var i.e. the path that I'm trying to parse, is actually the return value of a command line query. It's not path data that I generate myself. Its stored in a file, and the command line tool is not going to escape the backslashes.
How to split a dos path into its components in Python
0.01739
0
0
252,238
3,167,154
2010-07-02T15:41:00.000
-2
0
1
0
python
3,167,168
23
false
0
0
use ntpath.split()
5
211
0
I have a string variable which represents a dos path e.g: var = "d:\stuff\morestuff\furtherdown\THEFILE.txt" I want to split this string into: [ "d", "stuff", "morestuff", "furtherdown", "THEFILE.txt" ] I have tried using split() and replace() but they either only process the first backslash or they insert hex numbers into the string. I need to convert this string variable into a raw string somehow so that I can parse it. What's the best way to do this? I should also add that the contents of var i.e. the path that I'm trying to parse, is actually the return value of a command line query. It's not path data that I generate myself. Its stored in a file, and the command line tool is not going to escape the backslashes.
How to split a dos path into its components in Python
-0.01739
0
0
252,238
3,167,469
2010-07-02T16:27:00.000
0
0
0
1
c#,java,python,hostname
3,167,542
3
false
0
0
In Windows you have to modify registry keys and the reboot the system. You actually have to change two entries: HostName under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpIp\Parameters and ComputerName under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName Please note that if the computer ha joined an NT Domain this change could be harmful (and in this case you have an additional entry to change under TcpIp\Parameters).
1
1
0
I need to automate the changing of the hostname of a computer, but I can't figure out how to do it inside a program. My options are open; I would be happy with a solution in any of the following: Command line Java Python C# (would prefer one of the other 3, but this is ok) It would be helpful to learn how to do this on both Linux and Windows.
Rename a computer programmatically
0
0
0
2,734
3,167,661
2010-07-02T16:58:00.000
0
0
0
1
c++,python,matlab,tcl,interpreter
3,188,680
3
false
0
0
Well, unless there are any other suggestions, the final answer I have arrived at is to go with Python. I seriously considered matlab/octave, but when reading the octave API and matlab API, they are different enough that I'd need to build separate interfaces for each (or get very creative with macros). With python I end up with a single, easier to maintain codebase for the front end, and it is used by just about everyone we know. Thanks for the tips/feedback everyone!
2
6
1
The simulation tool I have developed over the past couple of years, is written in C++ and currently has a tcl interpreted front-end. It was written such that it can be run either in an interactive shell, or by passing an input file. Either way, the input file is written in tcl (with many additional simulation-specific commands I have added). This allows for quite powerful input files (e.g.- when running monte-carlo sims, random distributions can be programmed as tcl procedures directly in the input file). Unfortunately, I am finding that the tcl interpreter is becoming somewhat limited compared to what more modern interpreted languages have to offer, and its syntax seems a bit arcane. Since the computational engine was written as a library with a c-compatible API, it should be straightforward to write alternative front-ends, and I am thinking of moving to a new interpreter, however I am having a bit of a time choosing (mostly because I don't have significant experience with many interpreted languages). The options I have begun to explore are as follows: Remaining with tcl: Pros: - No need to change the existing code. - Existing input files stay the same. (though I'd probably keep the tcl front end as an option) - Mature language with lots of community support. Cons: - Feeling limited by the language syntax. - Getting complaints from users as to the difficulty of learning tcl. Python: Pros: - Modern interpreter, known to be quite efficient. - Large, active community. - Well known scientific and mathematical modules, such as scipy. - Commonly used in the academic Scientific/engineering community (typical users of my code) Cons: - I've never used it and thus would take time to learn the language (this is also a pro, as I've been meaning to learn python for quite some time) - Strict formatting of the input files (indentation, etc..) Matlab: Pros: - Very power and widely used mathematical tool - Powerful built-in visualization/plotting. - Extensible, through community submitted code, as well as commercial toolboxes. - Many in science/engineering academia is familiar with and comfortable with matlab. Cons: - Can not distribute as an executable- would need to be an add-on/toolbox. - Would require (?) the matlab compiler (which is pricy). - Requires Matlab, which is also pricy. These pros and cons are what I've been able to come up with, though I have very little experience with interpreted languages in general. I'd love to hear any thoughts on both the interpreters I've proposed here, if these pros/cons listed are legitimate, and any other interpreters I haven't thought of (e.g.- would php be appropriate for something like this? lua?). First hand experience with embedding an interpreter in your code is definitely a plus!
Picking a front-end/interpreter for a scientific code
0
0
0
453
3,167,661
2010-07-02T16:58:00.000
3
0
0
1
c++,python,matlab,tcl,interpreter
3,168,060
3
false
0
0
Have you considered using Octave? From what I gather, it is nearly a drop-in replacement for much of matlab. This might allow you to support matlab for those who have it, and a free alternative for those who don't. Since the "meat" of your program appears to be written in another language, the performance considerations seem to be not as important as providing an environment that has: plotting and visualization capabilities, is cross-platform, has a big user base, and in a language that nearly everyone in academia and/or involved with modelling fluid flow probably already knows. Matlab/Octave can potentially have all of those.
2
6
1
The simulation tool I have developed over the past couple of years, is written in C++ and currently has a tcl interpreted front-end. It was written such that it can be run either in an interactive shell, or by passing an input file. Either way, the input file is written in tcl (with many additional simulation-specific commands I have added). This allows for quite powerful input files (e.g.- when running monte-carlo sims, random distributions can be programmed as tcl procedures directly in the input file). Unfortunately, I am finding that the tcl interpreter is becoming somewhat limited compared to what more modern interpreted languages have to offer, and its syntax seems a bit arcane. Since the computational engine was written as a library with a c-compatible API, it should be straightforward to write alternative front-ends, and I am thinking of moving to a new interpreter, however I am having a bit of a time choosing (mostly because I don't have significant experience with many interpreted languages). The options I have begun to explore are as follows: Remaining with tcl: Pros: - No need to change the existing code. - Existing input files stay the same. (though I'd probably keep the tcl front end as an option) - Mature language with lots of community support. Cons: - Feeling limited by the language syntax. - Getting complaints from users as to the difficulty of learning tcl. Python: Pros: - Modern interpreter, known to be quite efficient. - Large, active community. - Well known scientific and mathematical modules, such as scipy. - Commonly used in the academic Scientific/engineering community (typical users of my code) Cons: - I've never used it and thus would take time to learn the language (this is also a pro, as I've been meaning to learn python for quite some time) - Strict formatting of the input files (indentation, etc..) Matlab: Pros: - Very power and widely used mathematical tool - Powerful built-in visualization/plotting. - Extensible, through community submitted code, as well as commercial toolboxes. - Many in science/engineering academia is familiar with and comfortable with matlab. Cons: - Can not distribute as an executable- would need to be an add-on/toolbox. - Would require (?) the matlab compiler (which is pricy). - Requires Matlab, which is also pricy. These pros and cons are what I've been able to come up with, though I have very little experience with interpreted languages in general. I'd love to hear any thoughts on both the interpreters I've proposed here, if these pros/cons listed are legitimate, and any other interpreters I haven't thought of (e.g.- would php be appropriate for something like this? lua?). First hand experience with embedding an interpreter in your code is definitely a plus!
Picking a front-end/interpreter for a scientific code
0.197375
0
0
453
3,167,679
2010-07-02T17:00:00.000
2
0
0
0
python,html-parsing
3,167,761
3
false
1
0
BeautifulSoup is a nice library and provides a good way to parse HTML with some handy ways to parse the data very easily. What you are trying to do, can easily be done using some simple regular expressions. You can write regular expressions to search for a particular pattern of data and extract the data you need.
1
4
0
I am already aware of tag based HTML parsing in Python using BeautifulSoup, htmllib etc. However, I want a powerful engine which can do complex tasks like read html tables, lists etc. and present these as simple to use objects within code. Does python have such powerful libraries?
Complex HTML parsing with Python
0.132549
0
1
921
3,168,963
2010-07-02T20:34:00.000
0
1
0
1
python,apache2,mod-python,ubuntu-10.04
11,032,693
1
false
0
0
In my case, changing PythonHandler pywps to PythonHandler wps in the .htaccess (or the apache configuration file) fixed the problem. I think that the file pywps.py has been renamed to wps.py, and this gives problems, since the sample configuration file has been left with the old name.
1
0
0
hi all, how you must configure Apache 2.2 or mod_python?, to avoid the following error: MOD_PYTHON ERROR ProcessId: 5399 Interpreter: '127.0.1.1' ServerName: '127.0.1.1' DocumentRoot: '/var/www' URI: '/cgi-bin/wps/' Location: None Directory: '/usr/lib/cgi-bin/' Filename: '/usr/lib/cgi-bin/wps/' PathInfo: '' Phase: 'PythonHandler' Handler: 'pywps' Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1206, in _process_target object = apache.resolve_object(module, object_str, arg, silent=silent) File "/usr/lib/python2.6/dist-packages/mod_python/apache.py", line 696, in resolve_object raise AttributeError, s AttributeError: module '/usr/local/lib/python2.6/dist-packages/pywps/init.pyc' contains no 'handler' this is for a configuration (ubuntu (10.4)) for AMD64. thanks for your answers
correct configuration for apache and mod_python
0
0
0
1,196
3,169,096
2010-07-02T21:04:00.000
2
0
1
0
python,design-patterns
3,169,254
2
true
1
1
While simply passing strings around seems like a useful idea, I think you're going to discover it doesn't work as well as you might hope. Think about the date example—instead of passing around a date object, instead you pass around a str of the format "2010-01-01". In order to work with that data, every user of the class needs to know not only that it's a str which represents a date, but what the format of that string is. In other words, you haven't gained anything. Worse, you lose the ability to pass a datetime object into the widget (unless you take extra steps to deal with that case). The validator or formatter issue isn't as big a deal as you might think; how often are you going to want to validate a string which doesn't represent a date as if it were a date?
2
2
0
I'm building a form class in python for producing and validating HTML forms. Each field has an associated widget which defines how the field is rendered. When the widget is created, it is passed in a (default) value so that it knows what to display the first time it is rendered. After the form is submitted, the widget is asked for a value. I delegate this to the widget rather than just nabbing it from the POST data because a widget may consist of several HTML inputs (think of a month/day/year selector). Only the widget knows how to mash these together into one value. Problem is, I don't know if I should have the widget always accept a string, and always return a string for consistency, or accept and return a data type consistent with its purpose (i.e., a date selector should probably return a DateTime object). The philosophy behind my form class is "mix and match". You choose what widget you want, and what validators/formatters/converters you want to run on it. Which I guess lends itself towards "use strings" and let the developer decide on the data type afterwords, but... I can't think of a good but. Do you anticipate any problems with this approach?
What data type should my widgets accept/return?
1.2
0
0
80
3,169,096
2010-07-02T21:04:00.000
1
0
1
0
python,design-patterns
3,169,184
2
false
1
1
This approach is quite generic and serializing to and from strings should always work fine. You could also save the state of a widget to a file or send it over a network for recreating another widget from it. Some potential issues or aspects to consider: Localization: how to interpret the string regarding the culture, which format is the canonical format for comparisons. Performance: some transformations might be time consuming, but I assume for human interaction that will be far fast enough.
2
2
0
I'm building a form class in python for producing and validating HTML forms. Each field has an associated widget which defines how the field is rendered. When the widget is created, it is passed in a (default) value so that it knows what to display the first time it is rendered. After the form is submitted, the widget is asked for a value. I delegate this to the widget rather than just nabbing it from the POST data because a widget may consist of several HTML inputs (think of a month/day/year selector). Only the widget knows how to mash these together into one value. Problem is, I don't know if I should have the widget always accept a string, and always return a string for consistency, or accept and return a data type consistent with its purpose (i.e., a date selector should probably return a DateTime object). The philosophy behind my form class is "mix and match". You choose what widget you want, and what validators/formatters/converters you want to run on it. Which I guess lends itself towards "use strings" and let the developer decide on the data type afterwords, but... I can't think of a good but. Do you anticipate any problems with this approach?
What data type should my widgets accept/return?
0.099668
0
0
80
3,169,425
2010-07-02T22:19:00.000
0
0
0
0
python,proxy
3,169,461
2
false
0
0
You probably don't even need to use a proxy. The urllib module knows how to contact web servers directly. You may need to use a proxy if you're behind certain kinds of corporate firewalls, but in that case you can't just choose any proxy to use, you have to use the corporate proxy. In such a case, a list of open proxies on Google isn't going to help you.
2
0
0
Where? I'm trying google and any of the proxys I've tried worked... I'm trying urllib.open with it... I don't know if urllib need some special proxy type or something like that... Thank you ps: I need some proxies to ping a certain website and not got banned from my ip
Where can I get some proxy list good for use it with Python?
0
0
1
448
3,169,425
2010-07-02T22:19:00.000
0
0
0
0
python,proxy
3,169,457
2
true
0
0
Try setting up your own proxy and connecting to it...
2
0
0
Where? I'm trying google and any of the proxys I've tried worked... I'm trying urllib.open with it... I don't know if urllib need some special proxy type or something like that... Thank you ps: I need some proxies to ping a certain website and not got banned from my ip
Where can I get some proxy list good for use it with Python?
1.2
0
1
448
3,171,256
2010-07-03T10:55:00.000
0
0
0
0
python,wxpython,sizer
3,174,624
2
true
0
1
wx.GridSizer is the answer!
1
1
0
I have a function that calculates the number of images that can be displayed on the screen, if there are more images than the ones that can be put on screen, I resize the images till they all can appear. Then, I want to display them with one vertical box sizer and several horizontal box sizers! The horizontal number of box sizers are dynamic, it can be only one or more depending on the number of images. How can I define several box sizers and add them to the vertical box sizer?
How to make a dynamic number of horizontal BoxSizers?
1.2
0
0
153
3,171,404
2010-07-03T11:53:00.000
0
0
0
0
python,django,flash,cookies
3,172,147
3
false
1
0
There is no way to set cookie, so that it would be available in all browsers on computer. You can do it in Flash, because it is external library (one for all browsers).
2
0
0
Is there any way in django to store cookies which is independent to browser ? is there any technique just like what flash SharedObject does ..?
Is there any way to store cookies in django which is independent to browser?
0
0
0
404
3,171,404
2010-07-03T11:53:00.000
1
0
0
0
python,django,flash,cookies
3,171,859
3
false
1
0
As it's explain in the link you give in your comment, Shared Objects are not stored as browser cookies, they are completely managed by the Flash Player. That's why they are independent of the browser. So the answer is no, you can't store a cookie that is independent of the browser with Django (or any other web framework). A possible solution is, if your visitor need to log to your site, you can store the info on the server, probably in a database. But if you don't required users to be log in, it will not work. Your other solution is to use Flash only to store the cookies.
2
0
0
Is there any way in django to store cookies which is independent to browser ? is there any technique just like what flash SharedObject does ..?
Is there any way to store cookies in django which is independent to browser?
0.066568
0
0
404
3,171,768
2010-07-03T14:21:00.000
1
0
1
0
javascript,python,scripting
3,171,774
4
false
1
0
It is not possible, as Javascript usually runs on the client side, while Python runs on the server side. If it is code that needs to run on the client side, have it send an AJAX request to a python script with the results you need. If it does not need to run on the client side, I suggest you rewrite it in Python.
1
1
0
I have a Python script and a JS on my server. In the python script, I want to set the value of a variable to be the output of one of the functions in my .js file. Is this possible, and if so how wold one go about doing this? Thanks!
Setting variable values in JavaScript files
0.049958
0
0
2,283
3,171,824
2010-07-03T14:40:00.000
10
0
1
0
python,super
3,171,872
4
false
0
0
Simply remember that the self is optional - super(Type) gives access to unbound superclass methods - and optional arguments always come last.
1
7
0
As the title says, how do you remember the order of super's arguments? Is there a mnemonic somewhere I've missed? After years of Python programming, I still have to look it up :( (for the record, it's super(Type, self))
Python: how do you remember the order of `super`'s arguments?
1
0
0
631
3,172,291
2010-07-03T17:47:00.000
3
1
0
0
python,django,sms
3,172,331
6
false
1
0
Typically you would use normal HTTP GET or POST requests against an SMS Gateway, such as Clickatell and many many others.
1
5
0
I have to develop an application where I need to send SMS to the users on a particular action by the users. I have heard of kannel with PHP, is there some help for the same in Python as well or is there any other better open source sms gateway which I can use with my application? Please suggest. Thanks in advance.
How to send SMS using Python/Django application?
0.099668
0
0
4,227
3,172,535
2010-07-03T19:03:00.000
0
0
0
0
python,blender
3,172,669
2
false
0
1
One cheap and easy method for doing this would be to create the triangle and subdivide the faces down to the level of detail you want, then normalize all the vertices to the radius you want.
1
3
0
Suppose you know the three vertices for a spherical triangle. Then how do you draw the sides on a sphere in 3D? I need some python code to use in Blender 3d modelisation software. I already have the sphere done in 3D in Blender. Thanks & happy blendering. note 1: i have the 3 points / vertices (p1,p2,p3 ) on the sphere for a spherical triangle but i need to trace the edges on the sphere in 3D so what would be the equations needed to determine all vertices between each points pair of the triangle on the sphere 3 edges from p1 to p2 - p2 to p3 and o3 to p1 i know it has something to do with the Great circle for Geodesic on a sphere but cannot find the proper equations to do the calculations in spherical coordinates! Thanks Great circles it would have been interesting to see a solution with great circle and see tehsolution in spherical coordinates directly ! but still interesting to do it in the euclidiens space Thanks ok i used this idea of line segment between 2 points but did not do it as indicated before i used an alternative method - Bezier line interpolation** i parametrize the line with a bezier line then subdivided and calculated as shonw ealier the ratio and angle for each of the subdivided bezier point on the chord and it works very well and very precise but it would be interesting to see how it is done whit the earlier method but not certain how to do the iteration loop? how do you load up the python code here just past it with Ctrl-V? Thanks and happy 2.5 i do use the blenders' forum but no guaranti to get a clear answer all the time! that's why i tried here - took a chance i did the first edge seems to work now got to make a loop to get multi segment for first edge and then do the other edges also 2- other subject i open here a post on bezier triangle patch i know it's not a usfull tool but just to show how it is done have youeseen a python sript to do theses triangel patch and i did ask this questin on blender's foum and no answer also on IRC python and sems to be dead right now probably guys are too busy finishing the 2.5 Beta vesion which should come out in a week or 2 Hey Thanks a lot for this math discussion if i have problem be back tomorrow happy math and 2.5
How to draw a spherical triangle on a sphere in 3D?
0
0
0
3,171
3,172,893
2010-07-03T21:10:00.000
-6
0
0
1
python,google-app-engine
3,172,928
3
false
1
0
It's miserably bad style. 2-space indentation is simply unreadable. Don't copy it. Never use less than 4 spaces to indent in any language. (Don't assume that something is good simply because Google source is doing it. If you've ever spent some time looking through the Android source you'd know that there's as much incompetently-written code developed at Google as there is at any other company.)
1
3
0
Looking through the Google App Engine source, I noticed that the tab depth is 2 spaces instead of the conventional 4. Is there some wisdom behind this, or is it just someone's preference? (Maybe it's trivial, or maybe Google knows something that isn't immediately obvious.) UPDATE I wasn't suggesting that it ran differently based on the tab depth. But perhaps there's a good reason for their style.
Python: Google App Engine source uses tab depth 2
-1
0
0
468
3,173,047
2010-07-03T22:26:00.000
1
0
0
0
python,macos,qt
4,022,382
3
false
0
1
I've tried the same for some weeks now. Finally i have to say py2app just wont do. I was lucky with pyinstaller1.4. Although you need to add some minor modifications to run flawlessly on OS X. Furthermore the apps it creates are only 1/4 of the size compared to py2app. And most important it works :) And yet another goodie ... it works with the python framework which ships with OS X so there is no need to install python via MacPorts etc.
1
2
0
I've recently started using a mac, and I'm curious about how to make a mac app that uses PyQt and is self-contained. Can anyone give me any pointers on where to start and what I'll need?
How to create a self contained Python Qt app on mac
0.066568
0
0
1,222
3,173,154
2010-07-03T23:14:00.000
1
0
1
0
python,list
62,608,192
8
false
0
0
I profiled a few methods to move an item within the same list with timeit. Here are the ones to use if j>i: ┌──────────┬──────────────────────┐ │ 14.4usec │ x[i:i]=x.pop(j), │ │ 14.5usec │ x[i:i]=[x.pop(j)] │ │ 15.2usec │ x.insert(i,x.pop(j)) │ └──────────┴──────────────────────┘ and here the ones to use if j<=i: ┌──────────┬───────────────────────────┐ │ 14.4usec │ x[i:i]=x[j],;del x[j] │ │ 14.4usec │ x[i:i]=[x[j]];del x[j] │ │ 15.4usec │ x.insert(i,x[j]);del x[j] │ └──────────┴───────────────────────────┘ Not a huge difference if you only use it a few times, but if you do heavy stuff like manual sorting, it's important to take the fastest one. Otherwise, I'd recommend just taking the one that you think is most readable.
1
126
0
In Python, how do I move an item to a definite index in a list?
Move an item inside a list?
0.024995
0
0
162,145
3,173,977
2010-07-04T07:02:00.000
0
1
0
1
python
17,816,896
4
false
0
0
Paramiko is really good and convenient for transferring files and executing commands in remote server. But, the problem is that we won't be able to catch the output of the command. It will be difficult to understand whether the command executed properly or not.
1
4
0
What would be the best way to execute shell commands on remote servers and get output without actually logging in. Maybe with shh keys. Preferably with python.
Remote server command execute
0
0
0
15,038
3,174,374
2010-07-04T10:28:00.000
0
0
0
1
python,twisted
3,175,439
1
false
0
0
I don't think this really provides the direction the user requires - the question seems to be clear in how to use Twisted to achieve this - the answer implies reasonable knowledge of Twisted.
1
2
0
How do I download a remote file into several chunks using twisted? Lets say if the file is 100 bytes, I want to spawn 10 connection which will read 10 bytes each but in no particular order and then later on merge them all. I was able to do this using threads in Python but I don't have any idea how to use twisted's reactor + manager + protocol to achieve the same. Any advice as to how should I design this?
How to design a twisted solution to download a file by reading on certain portion?
0
0
0
427
3,175,462
2010-07-04T16:59:00.000
0
0
0
1
python,google-app-engine,memcached
3,322,690
1
true
1
0
Not possible. In dev, check namespace'd memcache items programmatically, e.g. using a handler. Credit: moraes on #appengine / freenode (validated by looking at source)
1
2
0
I'm trying to use the Memcache Viewer in the App Engine Dev Console to view keys in a specific namespace. The obvious syntax of namespace.key is not working; I haven't been able to find documentation describing specific usage. Is this possible?
App Engine SDK: How do I view keys in a specific namespace using the Memcache Viewer?
1.2
0
0
435
3,175,925
2010-07-04T19:21:00.000
0
0
0
0
python,textarea,tags
3,176,415
2
false
1
0
You can try Web2py , it is a webframework for python with support for Wiki Markup , MarkDown , and many things + Server side Validation , XSS Prevention. If you want to use only it's Lib you can use gluon of web2py (which is lib of web2py framework) www.web2py.com
1
2
0
i want to clean some tag like : <script> and other, so what python lib you are using to do this . thanks
best python lib to make the textarea safe in the web page when user submit
0
0
0
124
3,176,258
2010-07-04T21:20:00.000
1
0
0
0
python,restructuredtext,docutils
3,176,894
4
false
1
0
As a workaround to your problem, you could use a mass search/replace tool to add the Google Analytics code to the files after they have been through the translator. Just search for the </body> tag and replace it with <!--your tracking code--></body>. I checked to see if you can include raw HTML in reStructuredText (and have it be untouched), but it doesn't seem possible...
1
3
0
I am using reStructured text to create some easy websites. So I have got a lot of *.rst files in which I want to add the Google Analytics code. But as far as I know it is not possible to add something like this?! I am using rst2html to convert the files to html.
How to add Google Analytics to reStructuredText?
0.049958
0
0
616
3,176,599
2010-07-04T23:46:00.000
0
0
1
0
python,dll,build,ironpython,compilation
3,176,653
3
false
0
0
You can use the script at C:\Program Files\[IronPython Program Directory]\Tools\Scripts.
2
1
0
How do I make a DLL (.NET) written in python code (IronPython)?
Build .NET DLLs from Python code?
0
0
0
3,074
3,176,599
2010-07-04T23:46:00.000
3
0
1
0
python,dll,build,ironpython,compilation
3,222,749
3
true
0
0
You cannot create a standard .NET .dll from IronPython code (.dll that can be used directly from C# or VB). pyc.py produces .dll that can be used only by IronPython - check such .dll with Reflector and you will understand why.
2
1
0
How do I make a DLL (.NET) written in python code (IronPython)?
Build .NET DLLs from Python code?
1.2
0
0
3,074
3,176,695
2010-07-05T00:30:00.000
1
0
0
0
python,django,64-bit,x86-64,python-2.6
3,223,404
2
false
1
0
It certainly is possible: I do it every day. Some tips: use virtualenv to sandbox your python packages between projects. use mod_passenger (via Passenger.prefpane) to make VirtualHosts easier to deal with. You may need to fiddle a bit harder with things if you run stuff under mod_python, as I recall having to work hard to get a version compiled that worked with the version of apache that is installed by default, and the python I was using.
2
0
0
I'm trying to decide on which architecture to choose for developing Django 1.0.x through Django 1.2.1. I've managed to get MySQL, MySQLdb, PIL, and Python 2.65 installed on Snow Leopard using x86 64-bit builds, but I'm curious as to whether or not there is a definitive answer to this question at the moment, and if so, why? Thank you! Michaux
Is it possible, and/or advisable to develop Django web applications on OS X (10.6.4 and 10.5.8) using Python 2.6.5 64-bit? Why?
0.099668
0
0
73
3,176,695
2010-07-05T00:30:00.000
1
0
0
0
python,django,64-bit,x86-64,python-2.6
3,176,702
2
true
1
0
Of course it's possible. Advisable? You didn't mention httpd and mod_wsgi, or some other WSGI container. Get one installed and it should be fine.
2
0
0
I'm trying to decide on which architecture to choose for developing Django 1.0.x through Django 1.2.1. I've managed to get MySQL, MySQLdb, PIL, and Python 2.65 installed on Snow Leopard using x86 64-bit builds, but I'm curious as to whether or not there is a definitive answer to this question at the moment, and if so, why? Thank you! Michaux
Is it possible, and/or advisable to develop Django web applications on OS X (10.6.4 and 10.5.8) using Python 2.6.5 64-bit? Why?
1.2
0
0
73
3,176,967
2010-07-05T02:25:00.000
1
0
0
0
python,computer-science,artificial-intelligence,machine-learning
3,177,037
5
false
0
0
Decision tree. It is frequently used in classification tasks and has a lot of variants. Tom Mitchell's book is a good reference to implement it.
3
14
1
I find learning new topics comes best with an easy implementation to code to get the idea. This is how I learned genetic algorithms and genetic programming. What would be some good introductory programs to write to get started with machine learning? Preferably, let any referenced resources be accessible online so the community can benefit
What is a good first-implementation for learning machine learning?
0.039979
0
0
5,717
3,176,967
2010-07-05T02:25:00.000
1
0
0
0
python,computer-science,artificial-intelligence,machine-learning
3,182,779
5
false
0
0
Neural nets may be the easiest thing to implement first, and they're fairly thoroughly covered throughout literature.
3
14
1
I find learning new topics comes best with an easy implementation to code to get the idea. This is how I learned genetic algorithms and genetic programming. What would be some good introductory programs to write to get started with machine learning? Preferably, let any referenced resources be accessible online so the community can benefit
What is a good first-implementation for learning machine learning?
0.039979
0
0
5,717
3,176,967
2010-07-05T02:25:00.000
-8
0
0
0
python,computer-science,artificial-intelligence,machine-learning
3,177,077
5
false
0
0
There is something called books; are you familiar with those? When I was exploring AI two decades ago, there were many books. I guess now that the internet exists, books are archaic, but you can probably find some in an ancient library.
3
14
1
I find learning new topics comes best with an easy implementation to code to get the idea. This is how I learned genetic algorithms and genetic programming. What would be some good introductory programs to write to get started with machine learning? Preferably, let any referenced resources be accessible online so the community can benefit
What is a good first-implementation for learning machine learning?
-1
0
0
5,717
3,177,057
2010-07-05T03:02:00.000
1
0
0
1
python,gnome,vala,compiz
3,185,814
1
false
0
0
You want to look into gnome-compiz especially into gtk-window-decorator and gnome-xgl-settings.
1
0
0
Several laptops on the market have problems with Linux for brightness controls. However, recently I found out that you can use CompizConfig settings to dim at least a particular window. Many people, however, want to dim all windows. I know Compiz can do this in the API somewhere because look what happens when you do Super + Tab in Compiz. So this got me thinking...what I need to build is a GNOME applet in either Python, or perhaps this new Vala language, that interfaces with the Compiz API and lets me dim the entire screen. Does anyone know where I might find some programming resources to learn how to use Compiz API in Python or Vala to dim the screen?
Controlling Linux Compiz Brightness Programmatically with Python or Vala
0.197375
0
0
579
3,177,759
2010-07-05T07:28:00.000
0
0
1
0
python,django,django-templates
3,178,961
2
false
1
0
You could put pdb on the form field render surely? If you really want to spit the field value out to some sort of log then I recommend using logging and putting the logger into the form field's unicode method (or str depending on what version of django).
2
0
0
I am working on a custom Django form field and accompanying widget. While rendering the template, i would like to inspect the form.field as a python object. How do I do that, because anything in a Django template outside of template tags and filters is rendered as text.
How do I print some python function output to console (for debugging purposes, while using manage.py runserver) from within a django template
0
0
0
303
3,177,759
2010-07-05T07:28:00.000
1
0
1
0
python,django,django-templates
3,177,791
2
true
1
0
You'll need to write and install a custom tag (or filter... though that might considered be somewhat bizarre, it may help you fit in more places) that, as a side effect, performs the logging calls you desire (or print>>sys.stderr or whatever).
2
0
0
I am working on a custom Django form field and accompanying widget. While rendering the template, i would like to inspect the form.field as a python object. How do I do that, because anything in a Django template outside of template tags and filters is rendered as text.
How do I print some python function output to console (for debugging purposes, while using manage.py runserver) from within a django template
1.2
0
0
303
3,177,772
2010-07-05T07:31:00.000
1
0
0
0
python,django,drupal,drupal-views,django-apps
3,177,922
4
false
1
0
I don't think there is something similar and for a good reason. Django is a framework, while Drupal is a full scale CMS. One of the powerful things about Drupal, is how it handles content. Every piece of content is a node, and it lets developers make modules that can add to a node's functionality. Django is a great tool to, but it's strength is more the ease of development, that lets you create applications very fast. That is what it was built for after all. It would be hard to make something CCK and Views like with Django, and I don't think it would make much sense either. I find that when developing with Django, you can very quickly create most CCK and views things, withe Django models and the orm. You can't do it in a GUI, but that was never the goal of Django. The admin interface also reflects that, as it is good mainly for one thing. Handling content, CRUD style operations. I guess that is why Satchmo created their own settings system for shops.
3
5
0
Are there any Django apps equivalent to Drupal's Views and CCK modules? I find Django much more flexible and logically organized than Drupal. But I think Drupal's Views and CCK modules are killer apps. They let the webmaster very rapidly to build new data models and queries through GUI without touching the code. These modules are very useful for rapid application development. Do you know any similar apps in Django?
Django apps equivalent to Drupal's CCK and Views modules?
0.049958
0
0
1,026
3,177,772
2010-07-05T07:31:00.000
4
0
0
0
python,django,drupal,drupal-views,django-apps
3,238,877
4
false
1
0
Django is a framework, this had been said, but if you look for functionality close to CCK, PINAX makes for python/Django, the equivalent of modules in Drupal, sort of ready to go modules, login/pass check, listing, input output, or CRUDs ect. But in no ways radio buttons and check boxes action programming. You will have to put your building blocks together and indulge some python programming. I found myself spending more time loading extra modules and themes tweaking in Drupal, than putting together a full blown site in Django, maybe because, I own many libraries wrote several times and improved over time, for cases encountered over and over. I focus only on new or cutting edge things. Both approaches are ok as long as you know what you want to go. The hard fact is that for a CMS that want to attract non programmers peoples if you want to build great sites, you have to be good in php/mysql and a good grip on css, and it kind of defeats the purpose. In France we say, "the best tool is the one you use every day". If you are frustrated with Drupal, learn Django, and in the same time needed to master Drupal, you will have a skill to write your own Drupal and others CMS, maybe. Good luck in your endeavor.
3
5
0
Are there any Django apps equivalent to Drupal's Views and CCK modules? I find Django much more flexible and logically organized than Drupal. But I think Drupal's Views and CCK modules are killer apps. They let the webmaster very rapidly to build new data models and queries through GUI without touching the code. These modules are very useful for rapid application development. Do you know any similar apps in Django?
Django apps equivalent to Drupal's CCK and Views modules?
0.197375
0
0
1,026
3,177,772
2010-07-05T07:31:00.000
1
0
0
0
python,django,drupal,drupal-views,django-apps
26,184,850
4
false
1
0
The lack of flexibility that you refer to is the price you pay for CCK and Views. I've used both Drupal and Django to complete major projects. You can use Drupal as a framework too, so in my opinion the two are absolutely comparable. Django has a way better database abstraction than Drupal, follows more modern programming paradigms like OOP, MVC etc, is more flexible, and Python is just straight up superior to PHP. ...but I still usually use Drupal if either will do. It just gets the job done with less time spent, and works and performs well. Django has nothing like Views, and Drupal's form api is just light years ahead of Django's. Creating multi step ajax forms can be done without ever touching the markup or writing a single line of javascript in Drupal, and presenting dynamic lists to the user can be achieved without even leaving your browser. Drupal has a much greater deployment rate than Django, not just because of PHP's popularity, but because it actually does some things really well. My time is precious, and the end user doesn't give a damn as long as my system works.
3
5
0
Are there any Django apps equivalent to Drupal's Views and CCK modules? I find Django much more flexible and logically organized than Drupal. But I think Drupal's Views and CCK modules are killer apps. They let the webmaster very rapidly to build new data models and queries through GUI without touching the code. These modules are very useful for rapid application development. Do you know any similar apps in Django?
Django apps equivalent to Drupal's CCK and Views modules?
0.049958
0
0
1,026
3,177,918
2010-07-05T08:03:00.000
3
0
1
0
visual-studio-2010,windows-7,ironpython,file-type,root
32,558,068
2
false
0
1
I also had this issue. Here is what I did. Right click on a python program. Select properties. You will find "opens with" option in the general tab. Click change and select "python.exe". Now, you will have your python icons back for all .py type of files.
1
1
0
Installed the IronPython tools for VS 2010 but it didn't associate the *.py files to VS, neither did it (obviously) change the *.py files' icon. How do I do that in Windows 7?
How to make *.py files have the python icon in Win7?
0.291313
0
0
4,332
3,178,259
2010-07-05T09:05:00.000
1
0
0
0
python,django
3,178,580
1
true
1
0
If you want to delete some python library go to /site-packages or /dist-packages, find this module(single file) or package(directory) or egg file (look at the extension) and delete this. If you want to delete an app and you have it inside your project, simply delete app directory, remove it from settings and remove all references to objects from this app.
1
0
0
If I want to delete a Django App or Project. Is there a way to cleanly delete it? Or a library in Python? How can I delete and re install libraries. So I am SURE that nothing is left of that library.
Django Python Delete Project App Library
1.2
0
0
1,209
3,179,469
2010-07-05T12:34:00.000
0
0
1
0
python,qt,pyqt,paint
3,497,327
3
false
0
1
Have you looked at the scribble example included in PyQt? It does basic drawing, saving, loading, etc.
1
0
0
i have just received a task to implement a software that paints over pictures (pretty much like microsoft paint ) i have no idea where to start or how to do that. do anyone have a good reference or idea for painting in qt or pyqt ? this will be highly appreciated thanks in advance
making paint in pyqt or qt
0
0
0
1,562
3,179,754
2010-07-05T13:16:00.000
0
0
0
1
python,build-process,python-3.x
5,056,761
1
false
0
0
Make sure your cxFreexe is installed with and run with the same python as you run the application you want to freeze. That way your PYTHONPATH should be set up correctly. The exception is if the script you want to freeze itself modifies Python path. In that case you need to make the same modifications yourself before freezing.
1
0
0
I m building a python script using a setup.py file. In building process, it links to python framework. I want to change the linking framework path as its linking to the wrong location. How to set the framework path before building the script. Thanks in advance for sparring ur valuable time for this thread.
how to set the python framework path before building cxfreeze for python3
0
0
0
135
3,179,979
2010-07-05T13:49:00.000
2
0
0
0
python,windows,web-crawler,scrapy
3,186,698
1
false
1
0
You can override the start_requests() method in your spider to get the starting requests (which, by default, are generated using the urls in the start_urls attribute).
1
0
0
I am new to python and scrapy . I am running the scrapy-ctl.py from another python script using subprocess module.But I want to parse the 'start url' to the spider from this script itself.Is it possible to parse start_urls(which are determined in the script from which scrapy-ctl is run) to the spider? I will be greatful for any suggestions or ideas regarding this....:) Thanking in advance....
how to parse a string to spider from another script
0.379949
0
1
179
3,182,183
2010-07-05T21:10:00.000
-2
0
1
0
python,list,instance
3,182,889
7
false
0
0
I think what you're of doing here is using a structure containing your class instances. I don't know the syntax for naming structures in python, but in perl I could create a structure obj.id[x] where x is an incremented integer. Then, I could just refer back to the specific class instance I needed by referencing the struct numerically. Is this anything in the direction of what you're trying to do?
1
46
0
How do I go about creating a list of objects (class instances) in Python? Or is this a result of bad design? I need this cause I have different objects and I need to handle them at a later stage, so I would just keep on adding them to a list and call them later.
How to create a list of objects?
-0.057081
0
0
274,371
3,182,298
2010-07-05T21:42:00.000
0
0
0
0
python,django
3,223,385
5
false
1
0
A warning: if you try to deploy code with print statements under WSGI, expect things to break. Use the logging module instead.
1
11
0
I have a Django app on a Linux server. In one of the views, some form of print command is executed, and some string gets printed. How can I find out what the printed string was? Is there some log in which these things are kept?
Where do things go when I ‘print’ them from my Django app?
0
0
0
22,170
3,182,760
2010-07-05T23:52:00.000
3
0
1
0
python,list,dictionary,set
3,182,764
3
false
0
0
set and dict are unordered. "Append" and "extend" conceptually only apply to ordered types.
1
6
0
Is there an article or forum discussion or something somewhere that explains why lists use append/extend but sets and dicts use add/update. I frequently find myself converting lists into sets and this difference makes that quite tedious so for my personal sanity I'd like to know what the rationalization is. The need to convert between these occurs regularly as we iterate on development. Over time as the structure of the program morphs various structures gain and lose requirements like ordering and duplicates. For example something that starts out as an unordered bunch of stuff in a list might pick up the the requirement that there be no duplicates and so need to be converted to a set. All such changes require finding and changing all places where the relevant structure is added/appended and extended/updated. So I'm curious to see the original discussion that led to this language choice, unfortunately I've had no luck googling for it.
add append update and extend in python
0.197375
0
0
9,659
3,183,431
2010-07-06T04:03:00.000
1
0
1
0
python,design-patterns
3,183,465
2
true
1
0
It really depends on how you interact with the structures in question. Do you manipulate Form and Field objects prior to assigning them values? Do you need to frequently iterate over all the given Fields? Do you need Form once it's been submitted? Etc. I'd suggest writing some/all of the code that uses Form and figure out how you want to interact with Form data, and what your ideal interface would look like.
1
1
0
Forms have Fields, Fields have a value. However, they only get a value after the form has been submitted. How should I store this value? Should I give every field a value attribute, field.value, leave it as None prior to posting, and fill it in afterwords? Omit it completely, and dynamically add it? Store it on the form instead, like form.data['field']. Create a a wrapper class FieldWithData to avoid any inconsistent states (if you have an object of this type, you know it has data) and allows me to set the data in the initializer rather than accessing attributes directly (although I guess this isn't so different from using a setter) How should I provide access to the field data through the Form object? Options: form.fields['name'].value (how it's presently being stored internally) form.data['field'] (create a proxy "data" class that retrieves the real data off the field, or re-arrange the internals to actually store the data like this) form.field.value - looks fairly nice, but then I'd have two references to the same field, one as form.field and one as form.fields['field'] which I need internally so that I can iterate over them Too many design decisions. Driving me nuts. This is what sucks about solo'ing a project.
Where to store field data and how to provide access to it?
1.2
0
0
91
3,183,617
2010-07-06T05:08:00.000
2
1
0
0
python,dns,urllib,hosts
3,184,895
2
true
0
0
Whether this works or not will depend on whether the far end site is using HTTP/1.1 named-based virtual hosting or not. If they're not, you can simply replace the hostname part of the URL with their IP address, per @Greg's answer. If they are, however, you have to ensure that the correct Host: header is sent as part of the HTTP request. Without that, a virtual hosting web server won't know which site's content to give you. Refer to your HTTP client API (Curl?) to see if you can add or change default request headers.
2
2
0
I want my Python script to access a URL through an IP specified in the script instead of through the default DNS for the domain. Basically I want the equivalent of adding an entry to my /etc/hosts file, but I want the change to apply only to my script instead of globally on the whole server. Any ideas?
Alternate host/IP for python script
1.2
0
1
911
3,183,617
2010-07-06T05:08:00.000
0
1
0
0
python,dns,urllib,hosts
3,183,666
2
false
0
0
You can use an explicit IP number to connect to a specific machine by embedding that into the URL: http://127.0.0.1/index.html is equivalent to http://localhost/index.html That said, it isn't a good idea to use IP numbers instead of DNS entries. IPs change a lot more often than DNS entries, meaning your script has a greater chance of breaking if you hard-code the address instead of letting it resolve normally.
2
2
0
I want my Python script to access a URL through an IP specified in the script instead of through the default DNS for the domain. Basically I want the equivalent of adding an entry to my /etc/hosts file, but I want the change to apply only to my script instead of globally on the whole server. Any ideas?
Alternate host/IP for python script
0
0
1
911