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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,140,943 | 2010-11-10T03:20:00.000 | 0 | 1 | 1 | 0 | python,emacs | 4,143,655 | 2 | false | 0 | 0 | PATH is only searched when a program is launched via the shell.
For programs that are launched directly by Emacs (for example, via call-process), it's the exec-path variable that is searched. | 2 | 1 | 0 | how do I change the version of Python that emacs uses in the python-mode to the latest version that I just installed ?
I tried setting the PATH in my init.el file to the path where the latest version of python resides but its not working. | Emacs on Mac for Python - python-mode keeps using the default Python version | 0 | 0 | 0 | 811 |
4,140,943 | 2010-11-10T03:20:00.000 | 1 | 1 | 1 | 0 | python,emacs | 4,141,003 | 2 | false | 0 | 0 | Set the variable python-python-command. This can be done via customize:
M-x customize-option RET python-python-command RET
Change the value to point to the appropriate binary. | 2 | 1 | 0 | how do I change the version of Python that emacs uses in the python-mode to the latest version that I just installed ?
I tried setting the PATH in my init.el file to the path where the latest version of python resides but its not working. | Emacs on Mac for Python - python-mode keeps using the default Python version | 0.099668 | 0 | 0 | 811 |
4,141,511 | 2010-11-10T05:32:00.000 | 4 | 1 | 0 | 1 | java,c++,python,scons,gyp | 7,201,456 | 5 | false | 0 | 1 | I tried to do a Java / C++ / C++ To Java swig / (+ Protocol buffers) project in CMAKE and it was horrible! In such a case the problem with Cmake is, that the scripting language is extremely limited. I switched to Scons and everything got much easier. | 4 | 6 | 0 | I have projects in C++, Java and Python. Projects in C++ export SWIG interfaces so they can be used by Java and Python projects.
My question is: what building mechanism can I use to manage dependencies and build these projects?
I have used SCons and GYP. They are fairly easy to use and allow plugins (code-generators, compilers, packers). I'd like to know whether there are alternatives, in particular with native support for C++, Java and Python.
I develop in Linux platform, but I'd like to be able to build in mac and win platforms as well. | What are the SCons alternatives? | 0.158649 | 0 | 0 | 2,318 |
4,141,511 | 2010-11-10T05:32:00.000 | 1 | 1 | 0 | 1 | java,c++,python,scons,gyp | 4,142,509 | 5 | false | 0 | 1 | For Java and C++ projects you can take a look into Maven + Maven-nar-plugin but for Python i really don't know the best. May be other tools like CMake would fit better. | 4 | 6 | 0 | I have projects in C++, Java and Python. Projects in C++ export SWIG interfaces so they can be used by Java and Python projects.
My question is: what building mechanism can I use to manage dependencies and build these projects?
I have used SCons and GYP. They are fairly easy to use and allow plugins (code-generators, compilers, packers). I'd like to know whether there are alternatives, in particular with native support for C++, Java and Python.
I develop in Linux platform, but I'd like to be able to build in mac and win platforms as well. | What are the SCons alternatives? | 0.039979 | 0 | 0 | 2,318 |
4,141,511 | 2010-11-10T05:32:00.000 | 9 | 1 | 0 | 1 | java,c++,python,scons,gyp | 4,141,589 | 5 | false | 0 | 1 | CMake
I use and prefer it for my projects.
There's also Rake (comes with Ruby, but can be used for anything), which I regard rather highly. | 4 | 6 | 0 | I have projects in C++, Java and Python. Projects in C++ export SWIG interfaces so they can be used by Java and Python projects.
My question is: what building mechanism can I use to manage dependencies and build these projects?
I have used SCons and GYP. They are fairly easy to use and allow plugins (code-generators, compilers, packers). I'd like to know whether there are alternatives, in particular with native support for C++, Java and Python.
I develop in Linux platform, but I'd like to be able to build in mac and win platforms as well. | What are the SCons alternatives? | 1 | 0 | 0 | 2,318 |
4,141,511 | 2010-11-10T05:32:00.000 | 1 | 1 | 0 | 1 | java,c++,python,scons,gyp | 4,143,403 | 5 | false | 0 | 1 | In Java world ant is "lingua franca" for build systems.
Ant supports a C++ task via ant-contrib - so you can compile your C++ code.
With Ant's exec task you can still run swig on C++ code in order to get the wrappers.
Then standard tasks as javac/jar can be used for java application build. | 4 | 6 | 0 | I have projects in C++, Java and Python. Projects in C++ export SWIG interfaces so they can be used by Java and Python projects.
My question is: what building mechanism can I use to manage dependencies and build these projects?
I have used SCons and GYP. They are fairly easy to use and allow plugins (code-generators, compilers, packers). I'd like to know whether there are alternatives, in particular with native support for C++, Java and Python.
I develop in Linux platform, but I'd like to be able to build in mac and win platforms as well. | What are the SCons alternatives? | 0.039979 | 0 | 0 | 2,318 |
4,143,886 | 2010-11-10T11:18:00.000 | 10 | 0 | 0 | 0 | python,django,django-admin | 20,106,343 | 5 | false | 1 | 0 | By default syncdb creates 3 security permissions for each model:
Create (aka add)
Change
Delete
If your logged in as Admin, you get EVERYTHING no matter what.
But if you create a new user group called "General Access" (for example) then you can assign ONLY the CHANGE and DELETE permissions for all of your models.
Then any logged in user that is a member of that group will not have "Create" permission, nothing related to it will show on the screen. | 1 | 182 | 0 | I have a django site with lots of models and forms. I have many custom forms and formsets and inlineformsets and custom validation and custom querysets. Hence the add model action depends on forms that need other things, and the 'add model' in the django admin throughs a 500 from a custom queryset.
Is there anyway to disable the 'Add $MODEL' functionality for a certain models?
I want /admin/appname/modelname/add/ to give a 404 (or suitable 'go away' error message), I don't want the 'Add $MODELNAME' button to be on /admin/appname/modelname view.
Django admin provides a way to disable admin actions (http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#disabling-actions) however the only action for this model is 'delete_selected'. i.e. the admin actions only act on existing models. Is there some django-esque way to do this? | Django Admin - Disable the 'Add' action for a specific model | 1 | 0 | 0 | 61,849 |
4,145,053 | 2010-11-10T13:41:00.000 | 2 | 0 | 1 | 0 | python,text-extraction | 4,145,202 | 4 | false | 0 | 0 | Already given others' advice for your text file format, I'm just stepping in giving another suggestion... If rewriting your file is possible, an easy solution could be to change it to ConfigParser-readable (and writable) file:
[Horror]
1: Movie
2: Movie
3: Movie
[Comedy]
1: Movie
[Action]
1: Movie
2: Movie | 1 | 1 | 0 | Let's suppose I have a text file of movie genres with my favorite movies under each genre.
[category] Horror:
Movie
Movie
Movie
[category] Comedy:
Movie
[category] Action:
Movie
Movie
How would I create a function that extracts and packages all the movie titles below a certain [category] * into an array without spilling over into another category? | Extract lines below category and stop when another category is reached | 0.099668 | 0 | 0 | 208 |
4,145,282 | 2010-11-10T14:04:00.000 | 1 | 0 | 0 | 1 | python,linux | 4,145,649 | 3 | false | 0 | 0 | Pardus initialization (http://www.pardus.org.tr/eng/projects/comar/SpeedingUpLinuxWithPardus.html) is based on python and in theory you can even start system with windows executable (through Wine of course). You can see a sample initialisation script there doing almost same thing with shell script but in a pythonic way. | 1 | 1 | 0 | I'm new to python. I want to create controlled script executed from /etc/init.d command like /etc/init.d something start/stop/restart
Any advise appreciated. | /etc/init.d sh script | 0.066568 | 0 | 0 | 2,766 |
4,145,350 | 2010-11-10T14:11:00.000 | 5 | 0 | 0 | 0 | c#,java,python,user-interface,cross-platform | 4,145,581 | 1 | false | 0 | 1 | I'm a Python guy and use PyQt myself, and I can wholly recommend it. Concerning your cons:
compilation, distribution and deployment more difficult?
No, not really. For many projects, a full setup.py for e.g. cx_Freeze can be less than 30 lines that rarely need to change (most import dependencies are detected automatically, only need to specify the few modules that are not recognized), and then python setup.py will build a standalone executable. Then you can distribute it just like e.g. a C++ .exe.
no QT experience
I didn't have notable GUI experience either when I started out with Qt (only a bit of fiddling with Tkinter), but I grew to love Qt. Most of the time, all widgets work seamlessly and do what they're supposed to do - and there's a lot of them for many purposes. You name it, there's probably a widget that does it, and doesn't annoy the user by being half-assed. All the nice things we've been spoiled with are there.
Qt is huge, but the PyQt documentation answer most question with reasonable search effort. And if all else fails and you know a bit of C++, you can also look at Qt resources.
QT Designer not as nice as the Visual Studio Winforms designer
I don't know the VS Winforms designer, but I must admit that the Qt Designer is lacking. I ended up making a sketch of the UI in the designer, generating the code, cleaning that up and taking care all remaining details by hand. It works out okay so far, but my projects are rather small.
PS:
(now that QT is LGPLed)
PyQt is still GPL only. PySide is LGPL, yes, but it's not that mature, if that's a concern. The project website states that "starting development on PySide should be pretty safe now" though. | 1 | 11 | 0 | I'd like to develop a small/medium-size cross-platform application (including GUI).
My background: mostly web applications with MVC architectures, both Python (Pylons + SqlAlchemy) and Java (know the language well, but don't like it that much). I also know some C#. So far, I have no GUI programming experience (neither Windows Forms, Swing nor QT).
I plan to use SQLite for data storage: It seems to be a nice cross-platform solution and has some powerful features (e.g. full text search, which SQL Server Compact lacks).
I have done some research and these are my favorite options:
1) QT, Python (PyQT or PySide), and SQLAlchemy
pros:
Python the language
open source is strong in the Python world (lots of libraries and users)
SQLAlchemy: A fantastic way to interact with a DB and incredibly well documented!
cons:
compilation, distribution and deployment more difficult?
no QT experience
QT Designer not as nice as the Visual Studio Winforms designer
2) .NET/Mono, Windows Forms, C#, (Fluent) NHibernate, System.Data.SQLite
pros:
C# (I like it, especially compared to Java and would like to get more experience in it)
The Winforms GUI designer in Visual Studio seems really slick
IntelliSense
ClickOnce Deployment(?)
Windows Forms look and feel good on Windows
cons:
(Fluent) NHibernate far less documented than SQLAlchemy; also annoying: Fluent docs refer to NHibernate docs which refer to Hibernate (aargh!). But plain NHibernate + XML does not look very comfortable.
Windows Forms will not look + behave native on Linux/Mac OS (correct?)
fewer open source libraries in the .NET world, fewer OSS users, less documentation in general
no WinForms and NHibernate experience
3) JVM, Java + Jython, Swing, SQLAlchemy
(I'm emotionally biased against this one, but listed for completeness sake)
pros:
JVM/Swing work well as cross-platform basis
Jython
SQLAlchemy
lots of open source libraries
cons:
Swing seems ugly and difficult to layout
lacks a good GUI designer
Guessing that I won't be able to avoid Java for UI stuff
Not sure how stable the Jython/Java integration is
(Options that I have ruled out... just to avoid discussion on these):
- wxWidgets/wxPython (now that QT is LGPLed)
- GTK/PyGTK
The look and feel of the final application is very important to me. The above technology stacks are very different (PyQT, .NET WinForms, JVM Swing) and require some time to get proficient, so:
Which alternative would you recommend and why? | Python + QT, Windows Forms or Swing for a cross-platform application? | 0.761594 | 1 | 0 | 3,111 |
4,146,971 | 2010-11-10T17:03:00.000 | 1 | 0 | 0 | 0 | python,user-interface,text,tkinter,tkinter-entry | 32,384,249 | 3 | false | 0 | 1 | Update on using this method for Undo/Redo:
I am creating a GUI with lot of frames and each contains at least ten or more 'entry' widgets.
I used the History class and created one history object for each entry field that I had. I was able to store all entry widgets values in a list as done here.
I am using 'trace' method attached to each entry widget which will call 'add' function of History class and store each changes. In this way, I was able to do it without running any thread separately.
But the biggest drawback of doing this is, we cannot do multiple undos/redos with this method.
Issue:
When I trace each and every change of the entry widget and add that to the list, it also 'traces' the change that happens when we 'undo/redo' which means we cannot go more one step back. once u do a undo, it is a change that will be traced and hence the 'undo' value will be added to the list at the end. Hence this is not the right method.
Solution:
Perfect way to do this is by creating two stacks for each entry widget. One for 'Undo' and one for 'redo'. When ever there is a change in entry, push that value into the undo stack. When user presses undo, pop the last stored value from the undo stack and importantly push this one to the 'redo stack'. hence, when the user presses redo, pop the last value from redo stack. | 1 | 4 | 0 | Is there a way to add undo and redo capabilities in Tkinter Entry widgets or must I use single line Text widgets for this type of functionality?
If the latter, are there any tips I should follow when configuring a Text widget to act as an Entry widget?
Some features that might need tweaking include trapping the Return KeyPress, converting tab keypresses into a request to change focus, and removing newlines from text being pasted from the clipboard. | Undo and Redo in an Tkinter Entry widget? | 0.066568 | 0 | 0 | 4,108 |
4,147,202 | 2010-11-10T17:27:00.000 | 1 | 0 | 1 | 0 | python,arguments | 4,147,268 | 1 | true | 0 | 0 | I assume you want something like this, or perhaps it will be helpful at least:
def printObject(obj, attributes=()):
for a in attributes:
print getattr(obj, a) | 1 | 0 | 0 | I have to create a function, printObjects(attribute, option), which must print the objects based on a certain attribute. The attribute can take ints or strings as input. The option attribute is optional. How do I implement this for my class? | How can I handle attributes in python? | 1.2 | 0 | 0 | 107 |
4,147,635 | 2010-11-10T18:15:00.000 | 1 | 0 | 1 | 0 | c#,.net,c#-4.0,ironpython | 4,148,115 | 3 | false | 0 | 0 | If I really, really needed that I would create a wrapper DLL/EXE in another language. The Python code can then be stored as a resource in the DLL that is loaded when the assembly is first accessed. | 2 | 9 | 0 | Can I compile an IronPython code to EXE or DLL in a .NET runtime? | Compiling an IronPython code to EXE or DLL | 0.066568 | 0 | 0 | 8,973 |
4,147,635 | 2010-11-10T18:15:00.000 | 6 | 0 | 1 | 0 | c#,.net,c#-4.0,ironpython | 4,149,905 | 3 | true | 0 | 0 | Simply use clr.CompileModules in an IronPython script to convert it to a dll file.
Or you can use pyc.py (found inside of your IronPythonInstallDirectory\Tools\Scripts) which can also generate an exe for you also. | 2 | 9 | 0 | Can I compile an IronPython code to EXE or DLL in a .NET runtime? | Compiling an IronPython code to EXE or DLL | 1.2 | 0 | 0 | 8,973 |
4,149,086 | 2010-11-10T21:07:00.000 | 3 | 1 | 0 | 0 | c++,python,serialization,boost,pickle | 4,149,474 | 5 | false | 0 | 0 | something that could automatically
serialize all the members of a class
This is not possible in C++. Python, C#, Java et al. use run-time introspection to achieve this. You can't do that in C++, RTTI is not powerful enough.
In essence, there is nothing in the C++ language that would enable someone to discover the member variables of an object at run-time. Without that, you can't automatically serialize them. | 4 | 11 | 0 | Does anyone know of a "language level" facility for pickling in C++? I don't want something like Boost serialization, or Google Protocol Buffers. Instead, something that could automatically serialize all the members of a class (with an option to exclude some members, either because they're not serializable, or else because I just don't care to save them for later). This could be accomplished with an extra action at parse time, that would generate code to handle the automatic serialization. Has anyone heard of anything like that? | Python-style pickling for C++? | 0.119427 | 0 | 0 | 3,405 |
4,149,086 | 2010-11-10T21:07:00.000 | 0 | 1 | 0 | 0 | c++,python,serialization,boost,pickle | 4,149,445 | 5 | false | 0 | 0 | One quick way to do this that I got working once when I needed to save a struct to a file was to cast my struct to a char array and write it out to a file. Then when I wanted to load my struct back in, I would read the entire file (in binary mode), and cast the whole thing to my struct's type. Easy enough and exploits the fact that structs are stored as a contiguous block in memory. I wouldn't expect this to work with convoluted data structures or pointers, though, but food for thought. | 4 | 11 | 0 | Does anyone know of a "language level" facility for pickling in C++? I don't want something like Boost serialization, or Google Protocol Buffers. Instead, something that could automatically serialize all the members of a class (with an option to exclude some members, either because they're not serializable, or else because I just don't care to save them for later). This could be accomplished with an extra action at parse time, that would generate code to handle the automatic serialization. Has anyone heard of anything like that? | Python-style pickling for C++? | 0 | 0 | 0 | 3,405 |
4,149,086 | 2010-11-10T21:07:00.000 | 7 | 1 | 0 | 0 | c++,python,serialization,boost,pickle | 4,149,141 | 5 | true | 0 | 0 | I don't believe there's any way to do this in a language with no run-time introspection capabilities. | 4 | 11 | 0 | Does anyone know of a "language level" facility for pickling in C++? I don't want something like Boost serialization, or Google Protocol Buffers. Instead, something that could automatically serialize all the members of a class (with an option to exclude some members, either because they're not serializable, or else because I just don't care to save them for later). This could be accomplished with an extra action at parse time, that would generate code to handle the automatic serialization. Has anyone heard of anything like that? | Python-style pickling for C++? | 1.2 | 0 | 0 | 3,405 |
4,149,086 | 2010-11-10T21:07:00.000 | 1 | 1 | 0 | 0 | c++,python,serialization,boost,pickle | 4,149,128 | 5 | false | 0 | 0 | There's the standard C++ serialization with the << and >> operators, although you'll have to implement these for each of your classes (which it sounds like you don't want to do). Some practitioners say you should alway implement these operators, although of course, most of us rarely do. | 4 | 11 | 0 | Does anyone know of a "language level" facility for pickling in C++? I don't want something like Boost serialization, or Google Protocol Buffers. Instead, something that could automatically serialize all the members of a class (with an option to exclude some members, either because they're not serializable, or else because I just don't care to save them for later). This could be accomplished with an extra action at parse time, that would generate code to handle the automatic serialization. Has anyone heard of anything like that? | Python-style pickling for C++? | 0.039979 | 0 | 0 | 3,405 |
4,149,112 | 2010-11-10T21:11:00.000 | 4 | 0 | 0 | 0 | php,javascript,jquery,python | 4,149,206 | 5 | false | 1 | 0 | Well, for resizing it would of course be better to use GD... But indexed, I think. So that you have an upload script that automatically generates the images' in other sizes, and saves them somewhere.
However, it matters whether you have more disk space, or performance... Performance would get worse IF you have many people viewing these images. Disk space would get worse IF you have A LOT of these images. | 1 | 2 | 0 | I'm working on project where we are trying to adopt and resize template images to the various resolutions. For example if the website is viewed in 800px width (800x600) and 1024px width or larger the image size should be viewed in same quality.
I've had in mind to use sprite with 3 types of images for each range of this template , but I'm looking for other ideas , php gd maybe ? Any python solution ? | Dynamic images resizing | 0.158649 | 0 | 0 | 375 |
4,149,598 | 2010-11-10T22:07:00.000 | 0 | 0 | 0 | 0 | python,cgi,html-parsing | 4,149,742 | 4 | false | 1 | 0 | You can access only data, posted by form (or as GET parameters).
So, you can extract data you need using JavaScript and post it through form | 1 | 0 | 0 | I would like to access any element in a web page. I know how to do that when I have a form (form = cgi.FieldStorage()), but not when I have, for example, a table.
How can I do that?
Thanks | How can I access any element in a web page with Python? | 0 | 0 | 1 | 178 |
4,149,861 | 2010-11-10T22:46:00.000 | 1 | 1 | 1 | 0 | php,python | 4,149,942 | 4 | false | 0 | 0 | If you are familiar with MVC start learning from Zend Framework I think it will be easier for you to understand php, right php developing this way with a right leg start.
Object oriented business logics are same in any language.
I really want to get into python so we can exchange knowledge ;) | 2 | 10 | 0 | I'm a 5 years Python programmer, but shortly I'll be also working with PHP. Could you recommend me some readings to getting in touch with this language having in mind my Python skills? | PHP for Python programmers? | 0.049958 | 0 | 0 | 3,823 |
4,149,861 | 2010-11-10T22:46:00.000 | 0 | 1 | 1 | 0 | php,python | 4,149,875 | 4 | false | 0 | 0 | the best resource IMHO is still php.net there are a ton of decent books out there, but I still prefer to rely on php.net for the latest and greatest. | 2 | 10 | 0 | I'm a 5 years Python programmer, but shortly I'll be also working with PHP. Could you recommend me some readings to getting in touch with this language having in mind my Python skills? | PHP for Python programmers? | 0 | 0 | 0 | 3,823 |
4,150,443 | 2010-11-11T00:32:00.000 | 2 | 0 | 1 | 0 | python,nltk | 4,156,445 | 3 | false | 0 | 0 | There are two options i can think of off the top of my head:
Option one is to iterate over the sample POS-tagged corpora and simply build this mapping yourself. This gives you the POS tags that are associated with a particular word in the corpora.
Option two is to build a hidden markov model POS tagger on the corpora, then inspect the values of the model. This gives you the POS tags that are associated with a particular word in the corpora plus their a priori probabilities, as well as some other statistical data.
Depending on what your use-case is, one may be better than the other. I would start with option one, since it's fast and easy. | 2 | 0 | 1 | Is there any package in python nltk that can produce all different parts of speech words for a given word. For example if i give add(verb) then it must produce addition(noun),additive(adj) and so on. Can anyone let me know? | Extract different POS words for a given word in python nltk | 0.132549 | 0 | 0 | 430 |
4,150,443 | 2010-11-11T00:32:00.000 | 0 | 0 | 1 | 0 | python,nltk | 4,155,066 | 3 | false | 0 | 0 | NLTK has a lot of clever things hiding away, so there might be a direct way of doing it. However, I think you may have to write your own code to work with the WordNet database. | 2 | 0 | 1 | Is there any package in python nltk that can produce all different parts of speech words for a given word. For example if i give add(verb) then it must produce addition(noun),additive(adj) and so on. Can anyone let me know? | Extract different POS words for a given word in python nltk | 0 | 0 | 0 | 430 |
4,150,909 | 2010-11-11T02:26:00.000 | 0 | 0 | 0 | 0 | python,multidimensional-array,numpy,subdomain,overlap | 4,151,409 | 3 | false | 0 | 0 | Can you say more? What model are you using? What are you modelling? How is it computed?
Can you make the dimensions match to avoid the fit? (i.e. if B doesn't depend on all of A, only plug in the part of A that B models, or compute boring values for the parts of B that wouldn't overlap A and drop those values later) | 2 | 6 | 1 | I'm working with model output at the moment, and I can't seem to come up with a nice way of combining two arrays of data. Arrays A and B store different data, and the entries in each correspond to some spatial (x,y) point -- A holds some parameter, and B holds model output. The problem is that B is a spatial subsection of A -- that is, if the model were for the entire world, A would store the parameter at each point on the earth, and B would store the model output only for those points in Africa.
So I need to find how much B is offset from A -- put another way, I need to find the indexes at which they start to overlap. So if A.shape=(1000,1500), is B the (750:850, 200:300) part of that, or the (783:835, 427:440) subsection? I have arrays associated with both A and B which store the (x,y) positions of the gridpoints for each.
This would seem to be a simple problem -- find where the two arrays overlap. And I can solve it with scipy.spatial's KDTree simply enough, but it's very slow. Anyone have any better ideas? | Where do two 2-D arrays begin to overlap each other? | 0 | 0 | 0 | 1,367 |
4,150,909 | 2010-11-11T02:26:00.000 | 0 | 0 | 0 | 0 | python,multidimensional-array,numpy,subdomain,overlap | 4,191,918 | 3 | false | 0 | 0 | I need to find the indexes at which they start to overlap
So are you looking for indexes from A or from B? And is B strictly rectangular?
Finding the bounding box or convex hull of B is really cheap. | 2 | 6 | 1 | I'm working with model output at the moment, and I can't seem to come up with a nice way of combining two arrays of data. Arrays A and B store different data, and the entries in each correspond to some spatial (x,y) point -- A holds some parameter, and B holds model output. The problem is that B is a spatial subsection of A -- that is, if the model were for the entire world, A would store the parameter at each point on the earth, and B would store the model output only for those points in Africa.
So I need to find how much B is offset from A -- put another way, I need to find the indexes at which they start to overlap. So if A.shape=(1000,1500), is B the (750:850, 200:300) part of that, or the (783:835, 427:440) subsection? I have arrays associated with both A and B which store the (x,y) positions of the gridpoints for each.
This would seem to be a simple problem -- find where the two arrays overlap. And I can solve it with scipy.spatial's KDTree simply enough, but it's very slow. Anyone have any better ideas? | Where do two 2-D arrays begin to overlap each other? | 0 | 0 | 0 | 1,367 |
4,151,153 | 2010-11-11T03:31:00.000 | 1 | 0 | 1 | 0 | python,performance,runtime | 4,151,160 | 1 | true | 0 | 0 | Right after I posted, I figured you could make a list of the objects by the attribute needed before using heapify which would take O(n) linear time. This wouldn't affect the runtime of heapify or other heapq methods. | 1 | 1 | 0 | Since I'm trying to be efficient in this program I'm making, I thought I'd use the built in heapq module in python, but some of my objects have multiple attributes, like name and number. Is there a way to use the heapify method to heapify my objects based on a certain attribute? I don't see anything in the documentation. | Python heapq module, heapify method on an object | 1.2 | 0 | 0 | 664 |
4,151,746 | 2010-11-11T05:57:00.000 | 2 | 0 | 0 | 0 | c++,python,qt,image-processing,pyqt | 4,154,281 | 1 | true | 0 | 1 | You can't expect to find a library for any specific task. In this case, you need image-processing library, which is able to:
draw image region with transparent background. You have piece configuration, use it as a mask to cut out edges.
save drawn image to some format.
Qt graphics is totally able to do all that. | 1 | 1 | 0 | I'm working on a project involving puzzles made out of user-supplied images. I have been very hard-pressed to find a library that will serve my purposes. I would like to write the program in either Python or C++. I have been considering using Qt (or PyQt) to do it, so if you know of a library that will work with Qt it would be nice, though at this point anything would be nice. | Anyone know of a C++ or Python library that will divide an image into pieces of arbitrary shape? | 1.2 | 0 | 0 | 174 |
4,153,969 | 2010-11-11T11:35:00.000 | 0 | 0 | 0 | 0 | python,windows | 4,154,614 | 3 | false | 0 | 0 | I'm going to go out on a limb here, and suggest there probably isn't any Python library that can do this directly. Instead, you will need to call some C win32 functions from Python.
I think your best bet is to split this up into two separate questions.
The first question is "How do I programmatically, in Win32, initiate a log-out and log in as a different user?"
That will hopefully be answered by some Windows expert, even if they are unfamiliar with Python.
I don't know much about this, but it sounds awfully ambitious. Triggering a log-out might be possible, but triggering a log-in as a different user (presumably stopping to ask the user for a password)
The second question is "How do I call these win32 functions from within Python?"
That is a fairly regular request and there should be the expertise on StackOverflow to help. | 1 | 3 | 0 | I'm working on windows xp. How can i write a simple script which would automatically log me out of this account and log into another account on this computer upon execution of a trigger point I set in my application??
Please help. | Python script to switch user automatically | 0 | 0 | 0 | 3,490 |
4,155,126 | 2010-11-11T14:00:00.000 | 5 | 0 | 1 | 0 | python,windows,memory-management | 4,155,299 | 4 | false | 0 | 0 | As far as I know there is no easy way to see what the memory consumption of a certain object is. It would be a non-trivial thing to do because references could be shared among objects.
Here are my two favourite workarounds:
Use the process manager. Have the program pause for before allocation. Write down the memory used before allocation. Allocate. Write down memory after allocation. It's a low-tech method but it works.
Alternatively you can use pickle.dump to serialize your data structure. The resulting pickle will be comparable (not identical!) in size to the space needed to store the data structure in memory. For better results, use the binary pickle protocol. | 2 | 3 | 0 | I have some script that loads a lot of data to memory.
I want to know how efficient the data stored in memory.
So, I want to be able to know how many memory was used by python before I loaded data, and after I loaded data.
Also I wondering, if it is some way to check memory usage of complex object.
Let say i have nested dictionary with different types of data inside. How can i know how many memory used by all data in this dictionary.
Thanks,
Alex | How to find total amount of memory used by python process/object in windows | 0.244919 | 0 | 0 | 950 |
4,155,126 | 2010-11-11T14:00:00.000 | 0 | 0 | 1 | 0 | python,windows,memory-management | 4,187,961 | 4 | false | 0 | 0 | An alternative is that you could use windows's performance counters through pywin32 | 2 | 3 | 0 | I have some script that loads a lot of data to memory.
I want to know how efficient the data stored in memory.
So, I want to be able to know how many memory was used by python before I loaded data, and after I loaded data.
Also I wondering, if it is some way to check memory usage of complex object.
Let say i have nested dictionary with different types of data inside. How can i know how many memory used by all data in this dictionary.
Thanks,
Alex | How to find total amount of memory used by python process/object in windows | 0 | 0 | 0 | 950 |
4,155,955 | 2010-11-11T15:19:00.000 | 1 | 0 | 1 | 0 | python,programming-languages | 4,156,169 | 4 | false | 0 | 0 | If you just want to learn a new language you could take a look at scala. The language is influenced by languages like ruby, python and erlang, but is staticaly typed and runs on the JVM. The speed is comparable to Java. And you can use all the java libraries, plus reuse a lot of your python code through jython. | 2 | 1 | 1 | I use python heavily for manipulating data and then packaging it for statistical modeling (R through RPy2).
Feeling a little restless, I would like to branch out into other languages where
Faster than python
It's free
There's good books, documentations and tutorials
Very suitable for data manipulation
Lots of libraries for statistical modeling
Any recommendations? | moving on from python | 0.049958 | 0 | 0 | 210 |
4,155,955 | 2010-11-11T15:19:00.000 | 1 | 0 | 1 | 0 | python,programming-languages | 4,157,423 | 4 | false | 0 | 0 | I didn't see you mention SciPy on your list... I tend like R syntax better, but they cover much of the same ground. SciPy has faster matrix and array structures than the general purpose Python ones. Mostly places where I have wanted to use Cython, SciPy has been just as easy / fast.
GNU/Octave is an open/free version of Matlab which might also interest you. | 2 | 1 | 1 | I use python heavily for manipulating data and then packaging it for statistical modeling (R through RPy2).
Feeling a little restless, I would like to branch out into other languages where
Faster than python
It's free
There's good books, documentations and tutorials
Very suitable for data manipulation
Lots of libraries for statistical modeling
Any recommendations? | moving on from python | 0.049958 | 0 | 0 | 210 |
4,156,328 | 2010-11-11T15:57:00.000 | 3 | 0 | 0 | 0 | python,pickle,scapy | 4,157,378 | 6 | false | 0 | 0 | (This is more for reference, so no votes expected)
The Scapy list scapy.ml@secdev.org is well-monitored and tends to be very responsive. If you don't get answers here, try there as well. | 1 | 12 | 0 | I need to pickle a scapy packet. Most of the time this works, but sometimes the pickler complains about a function object. As a rule of thumb: ARP packets pickle fine. Some UDP packets are problematic. | How to pickle a scapy packet? | 0.099668 | 0 | 1 | 4,367 |
4,158,117 | 2010-11-11T18:51:00.000 | 2 | 0 | 1 | 0 | python,eval,exec | 4,158,176 | 8 | false | 0 | 0 | You don't need to use them, and in my opinion you should avoid them.
They are only useful in cases where you are generating the code itself, which in the end is going to most likely be considered bad practice.
If you are considering using eval() for things like mathematical expressions, you would be better sanitizing the input before evaluating it. You never know what kind of 'text' the user sends in that might screw up the application itself. | 4 | 8 | 0 | So I have understood what exec and eval and also compile do. But why would I need to use them? I am being unclear on the usage scenario.
Can anyone give me some examples so that I can better appreciate the concept. Cause right I know it is all theory. | Use of exec and eval in Python | 0.049958 | 0 | 0 | 4,288 |
4,158,117 | 2010-11-11T18:51:00.000 | 0 | 0 | 1 | 0 | python,eval,exec | 4,158,293 | 8 | false | 0 | 0 | Here's a valid use case. In the python paste middleware (for web programming) when an exception is raised it creates a command line within the browser. This works be using methods like these. Also, in Blender there is an option to animate values using python expressions and this works using eval. | 4 | 8 | 0 | So I have understood what exec and eval and also compile do. But why would I need to use them? I am being unclear on the usage scenario.
Can anyone give me some examples so that I can better appreciate the concept. Cause right I know it is all theory. | Use of exec and eval in Python | 0 | 0 | 0 | 4,288 |
4,158,117 | 2010-11-11T18:51:00.000 | 5 | 0 | 1 | 0 | python,eval,exec | 4,158,418 | 8 | true | 0 | 0 | I'll give an example in which I have used eval and where I think it was the best choice.
I was writing a simple software testing utility ... something to test whether student exercises were conforming to the assignment requirements. The goal was to provide a way for a simple configuration file to serve as a test specification (to get around a "chicken-and-egg" issue of using a programming language to describe/document/implement the test cases for elementary programming assignments).
I based my harness on the ConfigParser in the standard libraries. However, I did want the ability to represent arbitrary Python strings (including interpolations of \n, \t, and especially any interpolated hex encoded ASCII characters in the values read therefrom.
My solution was a try around an parsed_string=eval('''%s''' % cfg_read_item) followed by a try of the triple double-quoted version ("""%s""") of the same.
This is a case where the alternative would have been to write (or find a pre-written) Python language parser and figure out how to include and adapt it to my program. The risks are minimal (I'm not worried that student submitted code is going to trick my parser, break out if its jail, delete all my files, send my credit card numbers to Romania and so on)*
*(In part because I was testing them under Linux from an untrusted headless user account).
As here others have said, there are other use cases where you're building code from a template based on input data and need to execute that code (meta programming). You should always be able to accomplish those tasks in another way. However, whenever that alternative entails coding effort that approaches writing a general programming language parser/compiler/interpreter .... then eval may be the better approach. | 4 | 8 | 0 | So I have understood what exec and eval and also compile do. But why would I need to use them? I am being unclear on the usage scenario.
Can anyone give me some examples so that I can better appreciate the concept. Cause right I know it is all theory. | Use of exec and eval in Python | 1.2 | 0 | 0 | 4,288 |
4,158,117 | 2010-11-11T18:51:00.000 | 1 | 0 | 1 | 0 | python,eval,exec | 13,633,975 | 8 | false | 0 | 0 | I think I have a valid use. I am using Python 3.2.1 inside Blender 2.6.4 to modify a set of points with x,y coordinates (in the z-plane).
The goal is to add concentric rings of new points around each existing point, with the rings behaving as ripples, (like when you drop a stone in a pond). The catch is that I want the ripples to constructively/destructively interfere with one another, so first I'm going through and constructing a 'ripple equation' centered at each point, and summing all the ripple equations together into one gigantic mathematical equation, which I will then feed the original points into in order to generate the correct z-value to assign each one to.
My plan is to append each additional term in the equation to the previous as a string, and then use eval() to calculate the z-value for the new set of points. | 4 | 8 | 0 | So I have understood what exec and eval and also compile do. But why would I need to use them? I am being unclear on the usage scenario.
Can anyone give me some examples so that I can better appreciate the concept. Cause right I know it is all theory. | Use of exec and eval in Python | 0.024995 | 0 | 0 | 4,288 |
4,158,367 | 2010-11-11T19:19:00.000 | 72 | 0 | 0 | 0 | python,charts,matplotlib | 4,158,455 | 3 | true | 0 | 0 | It was easier than I expected, I just did: pylab.subplot(4,4,10) and it worked. | 1 | 51 | 1 | Is it possible to get more than 9 subplots in matplotlib?
I am on the subplots command pylab.subplot(449); how can I get a 4410 to work?
Thank you very much. | more than 9 subplots in matplotlib | 1.2 | 0 | 0 | 28,836 |
4,158,758 | 2010-11-11T20:03:00.000 | 0 | 0 | 0 | 1 | python,logging,message-queue,task,celery | 4,440,220 | 3 | false | 1 | 0 | It sounds like some kind of 'watcher' would be ideal. If you can watch and consume the logs as a stream you could slurp the results as they come in. Since the watcher would be running seperately and therefore have no dependencies with respect to what it is watching I believe this would satisfy your requirements for a non-invasive solution. | 1 | 5 | 0 | I want to convert my homegrown task queue system into a Celery-based task queue, but one feature I currently have is causing me some distress.
Right now, my task queue operates very coarsely; I run the job (which generates data and uploads it to another server), collect the logging using a variant on Nose's log capture library, and then I store the logging for the task as a detailed result record in the application database.
I would like to break this down as three tasks:
collect data
upload data
report results (including all logging from the preceding two tasks)
The real kicker here is the logging collection. Right now, using the log capture, I have a series of log records for each log call made during the data generation and upload process. These are required for diagnostic purposes. Given that the tasks are not even guaranteed to run in the same process, it's not clear how I would accomplish this in a Celery task queue.
My ideal solution to this problem will be a trivial and ideally minimally invasive method of capturing all logging during the predecessor tasks (1, 2) and making it available to the reporter task (3)
Am I best off remaining fairly coarse-grained with my task definition, and putting all of this work in one task? or is there a way to pass the existing captured logging around in order to collect it at the end? | How can I capture all of the python log records generated during the execution of a series of Celery tasks? | 0 | 0 | 0 | 1,306 |
4,159,847 | 2010-11-11T22:21:00.000 | 2 | 0 | 0 | 1 | python,client,bittorrent | 4,159,871 | 1 | true | 0 | 0 | The main bittorrent client, from bittorrent.com is all python based I believe. I have hacked it in the past, and it's very clean code easy to modify. | 1 | 2 | 0 | Is there any up-to-date bittorrent library which is written in python and can be used on windows to write client? Some time ago bitcomet was written in python and it was ok. Any alternatives?
And second question: does bittorrent protocol change? For example what may happen if I will use old bitcomet library | Bittorrent up-to-date library written in python | 1.2 | 0 | 0 | 484 |
4,160,082 | 2010-11-11T22:54:00.000 | 0 | 0 | 0 | 0 | python,image | 14,884,366 | 6 | false | 0 | 1 | The easiest way is to use a web server I reckon. You can script a nice, simple server with bottle and turn out a UI with images.
It depends what you want to do. Python can do it all, but needs something to work with. There's pygame and stuff like that if you're just starting out. | 4 | 3 | 0 | I am wondering, is it possible to display images in python? | How do you show a picture in python? | 0 | 0 | 0 | 12,412 |
4,160,082 | 2010-11-11T22:54:00.000 | 1 | 0 | 0 | 0 | python,image | 4,160,323 | 6 | false | 0 | 1 | The question needs more clearing up.
Do you want to put the picture on a system display?
Or on a window in a desktop app?
Or render it to a http response?
Python can do all these things in different manners, but for people to explain it - you need to specify your question a bit more. | 4 | 3 | 0 | I am wondering, is it possible to display images in python? | How do you show a picture in python? | 0.033321 | 0 | 0 | 12,412 |
4,160,082 | 2010-11-11T22:54:00.000 | 0 | 0 | 0 | 0 | python,image | 4,160,130 | 6 | false | 0 | 1 | The various OpenCV bindings for Python also provide ways to display images (and videos). Might be a bit heavy if you just want to display an image. | 4 | 3 | 0 | I am wondering, is it possible to display images in python? | How do you show a picture in python? | 0 | 0 | 0 | 12,412 |
4,160,082 | 2010-11-11T22:54:00.000 | 5 | 0 | 0 | 0 | python,image | 4,160,121 | 6 | false | 0 | 1 | Almost all GUI toolkits (wxWindows, pyQt, pyGTK, Tkinter) have Canvas or other-type widgets that allow you to draw an image.
The standard library way to draw an image is to use Tkinter's Canvas widget. | 4 | 3 | 0 | I am wondering, is it possible to display images in python? | How do you show a picture in python? | 0.16514 | 0 | 0 | 12,412 |
4,160,534 | 2010-11-12T00:16:00.000 | 3 | 0 | 1 | 0 | python,console,ironpython,interactive,read-eval-print-loop | 4,160,552 | 4 | false | 0 | 0 | There are a few different ways I can think of to get the ... prompt.
Starting (or continuing) a block
def foo():
Unclosed parenthesis, brace, square bracket (and watch out for nesting)
x = (
x = {
x = [
Unclosed triple quoted string
x = '''
Backslash at end of line:
x = \ | 3 | 3 | 0 | I'm implementing a custom (Iron)Python console.
I need to display a >>> prompt in general, but when a statement is incomplete, I need to change the prompt to ... and gather more lines before executing them.
How do I know if a line entered by a user is complete or if I need to read more lines?
A simple way seems to be checking if : is present. But I'm not sure if I'm not missing other cases where : is not present.
I looked into the IronPython source code to figure how it does this, but there are many steps involved and my simple reproduction failed to completely work. | Algorithm Python uses to decide between >>> and ... prompt in interactive console? | 0.148885 | 0 | 0 | 308 |
4,160,534 | 2010-11-12T00:16:00.000 | 3 | 0 | 1 | 0 | python,console,ironpython,interactive,read-eval-print-loop | 4,160,638 | 4 | false | 0 | 0 | The repl loop has full knowledge and access to the parser. If the parser state is such that it expects anything other than a statement, then the repl loop produces a .... In the case of unclosed parentheses, a statement would be illegal on the next line, because there's no possible subexpression which can contain a statement. Following a :, the next expected token is always an indent, once again a statement would always be illegal. Thats why it's always necessary to type a blank line at the end of an indented block at the repl loop, because you must provide the closing dedent for a statement to become the next expected production rule. | 3 | 3 | 0 | I'm implementing a custom (Iron)Python console.
I need to display a >>> prompt in general, but when a statement is incomplete, I need to change the prompt to ... and gather more lines before executing them.
How do I know if a line entered by a user is complete or if I need to read more lines?
A simple way seems to be checking if : is present. But I'm not sure if I'm not missing other cases where : is not present.
I looked into the IronPython source code to figure how it does this, but there are many steps involved and my simple reproduction failed to completely work. | Algorithm Python uses to decide between >>> and ... prompt in interactive console? | 0.148885 | 0 | 0 | 308 |
4,160,534 | 2010-11-12T00:16:00.000 | 1 | 0 | 1 | 0 | python,console,ironpython,interactive,read-eval-print-loop | 4,160,544 | 4 | false | 0 | 0 | Did you use a : or a \ (or an unclosed delimiter, like brackets or parens)? The interactive interpreter shows a ....
The actual logic might be a bit more complicated, but that's the basic rule. | 3 | 3 | 0 | I'm implementing a custom (Iron)Python console.
I need to display a >>> prompt in general, but when a statement is incomplete, I need to change the prompt to ... and gather more lines before executing them.
How do I know if a line entered by a user is complete or if I need to read more lines?
A simple way seems to be checking if : is present. But I'm not sure if I'm not missing other cases where : is not present.
I looked into the IronPython source code to figure how it does this, but there are many steps involved and my simple reproduction failed to completely work. | Algorithm Python uses to decide between >>> and ... prompt in interactive console? | 0.049958 | 0 | 0 | 308 |
4,162,603 | 2010-11-12T07:52:00.000 | 2 | 0 | 1 | 0 | python,django,utf-8,diacritics,transliteration | 43,379,468 | 4 | false | 0 | 0 | The simplest way I found:
unicodedata.normalize('NFKD', s).encode("ascii", "ignore") | 1 | 22 | 0 | Hello
I retrieve text based utf8 data from a foreign source which contains special chars such as u"ıöüç" while I want to normalize them to English such as "ıöüç" -> "iouc" . What would be the best way to achieve this ? | Python and character normalization | 0.099668 | 0 | 0 | 11,977 |
4,163,456 | 2010-11-12T09:58:00.000 | 0 | 1 | 0 | 0 | python | 4,164,507 | 2 | false | 0 | 0 | use the os.path module to manipulate path string (you need to import os)
the current directory is os.path.abspath(os.curdir)
join 2 parts of a path with os.path.join(dirname, filename): this will take care of inserting the right path separator ('\' or '/', depending on the operating system) for building the path | 1 | 10 | 0 | Using Python, how might one read a file's path from a remote server?
This is a bit more clear to me on my local PC. | Python - how to read path file/folder from server | 0 | 0 | 1 | 36,179 |
4,163,748 | 2010-11-12T10:37:00.000 | 2 | 0 | 0 | 0 | javascript,python,ajax,google-app-engine,jquery | 4,164,056 | 1 | true | 1 | 0 | Stupid me...
The ajax call was to localhost/broadcast
and the browser address field was 127.0.0.1/broadcast
...
the cookies for "different" domains ('127.0.0.1' != 'localhost') are not shared ofcourse...
Then I haven't gone mad... | 1 | 0 | 0 | I have 2 pages, a static html page and a python script - hosted on [local] google app engine.
/html/hello.html
define as login: required
/broadcast
which is a python script
when I access hello.html for the first time I am redirected to login page, I sign in, and then redirected back to hello.html.
inside hello.html - an AJAX call with jQuery is executed to load data from '/broadcast', this call errors saying 'you're not logged in'!
BUT - the same call to '/broadcast' through the browser address field succeeds as if I AM signed in!
as if the ajax and the browser callers have different cookies!??
HELP, am I going bananas? | AJAX and browser GET calls appear to have different cookies | 1.2 | 0 | 1 | 90 |
4,164,518 | 2010-11-12T12:17:00.000 | 0 | 0 | 1 | 0 | python | 4,164,577 | 2 | false | 0 | 0 | I'm guessing you want to find a difference between two dates in seconds?
If it's the case, then first get a timedelta (by simply subracting any two datetime objects with - operator). Then read the seconds field of the resulting object. | 1 | 3 | 0 | i have two datetime string like this '2010-08-31 04:35:50.176725' and '2010-09-05 04:35:50.176725' . now my question is how calculate seconds between two dates. i used time delta but its return in hour, minute formate. i want compltely in seconds. | Datetime to Second Conversion | 0 | 0 | 0 | 11,875 |
4,164,962 | 2010-11-12T13:13:00.000 | 0 | 0 | 0 | 0 | python,user-interface,tkinter | 7,360,992 | 1 | false | 0 | 1 | No, there is no way to do what you want. Tkinter only supports transparency on top-level windows. | 1 | 0 | 0 | Does Tkinter or underlying Tk framework support the ability to apply the equivalent of the attributes() method to Frames vs. Windows?
Specifically: I have forms with a message area that I would like to fade away in jquery-like manner, eg. display a non-modal status message that fades away. I know I can fade a Tkinter window via window.attributes("-alpha", alpha), but I don't see an equivalent way to achieve this effect with a Frame. (I know I could place a top-level message window over my dialog, but coordinating the position and size of this window to match the layout of my dialog sounds complicated). | Python/Tkinter: Apply .attributes() method to Frame vs. Window? | 0 | 0 | 0 | 502 |
4,165,452 | 2010-11-12T14:08:00.000 | 16 | 0 | 0 | 0 | python,sqlalchemy,pylons,data-migration,migrate | 4,165,496 | 4 | false | 1 | 0 | What we do.
Use "major version"."minor version" identification of your applications. Major version is the schema version number. The major number is no some random "enough new functionality" kind of thing. It's a formal declaration of compatibility with database schema.
Release 2.3 and 2.4 both use schema version 2.
Release 3.1 uses the version 3 schema.
Make the schema version very, very visible. For SQLite, this means keep the schema version number in the database file name. For MySQL, use the database name.
Write migration scripts. 2to3.py, 3to4.py. These scripts work in two phases. (1) Query the old data into the new structure creating simple CSV or JSON files. (2) Load the new structure from the simple CSV or JSON files with no further processing. These extract files -- because they're in the proper structure, are fast to load and can easily be used as unit test fixtures. Also, you never have two databases open at the same time. This makes the scripts slightly simpler. Finally, the load files can be used to move the data to another database server.
It's very, very hard to "automate" schema migration. It's easy (and common) to have database surgery so profound that an automated script can't easily map data from old schema to new schema. | 1 | 63 | 0 | I'm programming a web application using sqlalchemy. Everything was smooth during the first phase of development when the site was not in production. I could easily change the database schema by simply deleting the old sqlite database and creating a new one from scratch.
Now the site is in production and I need to preserve the data, but I still want to keep my original development speed by easily converting the database to the new schema.
So let's say that I have model.py at revision 50 and model.py a revision 75, describing the schema of the database. Between those two schema most changes are trivial, for example a new column is declared with a default value and I just want to add this default value to old records.
Eventually a few changes may not be trivial and require some pre-computation.
How do (or would) you handle fast changing web applications with, say, one or two new version of the production code per day ?
By the way, the site is written in Pylons if this makes any difference. | How to efficiently manage frequent schema changes using sqlalchemy? | 1 | 1 | 0 | 32,073 |
4,165,824 | 2010-11-12T14:53:00.000 | 9 | 0 | 0 | 0 | java,python,google-app-engine,integration,google-cloud-datastore | 4,166,178 | 2 | false | 1 | 0 | Different versions of an app share a datastore, and AFAIK you can still have a Java version of your app, and Python version, at the same time. It used to be a necessary hack to use features that were implemented in Python but not (yet) in Java, and quite possibly still is.
Of course only one of those versions can be the default, but other versions are accessible. | 1 | 4 | 0 | I need to have a Java instance fetching data directly from the Python's instance datastore. I don't know if that's possible at all. Is the datastore transparent/unique, or each instance (if they can indeed coexist) has its separate datastore?
Suming it up: how can a Java app fetch data from the datastore of a Python app, and vice-versa? | Can Java and Python coexist in the same app? | 1 | 0 | 0 | 1,007 |
4,166,169 | 2010-11-12T15:31:00.000 | 5 | 0 | 0 | 0 | python,gtk | 4,169,956 | 2 | false | 0 | 1 | The answer is actually not OS-specific -- you can do it within GTK. You can get a list of all the toplevel windows from the application using gtk.window_list_toplevels(), then iterate through it until you find one where window.is_active() returns True.
If you want to consider other windows than the ones from your application, then you could try gtk.gdk.screen_get_default().get_toplevel_windows() but this will only get you GDK windows and not GTK windows, because you have no way of knowing whether those GDK windows are actually associated with GTK windows. | 1 | 3 | 0 | How would I get a handle to the active gtk.Window in python? (not a window I created, but the currently focused window). | Get active gtk window in python | 0.462117 | 0 | 0 | 5,129 |
4,167,684 | 2010-11-12T18:07:00.000 | 0 | 0 | 0 | 0 | python,apache,rest,mod-wsgi,mod-python | 4,168,054 | 2 | false | 1 | 0 | Check if mod_wsgi is loaded as a module into the httpd.conf
Add apache host that points to a python/wsgi module which contains the 'def application' definition for your web-service.
Resolve any path issues that maybe arise from your import handling.
If this doesn't work, drop some error-dump here and we'll check. | 1 | 0 | 0 | Can anyone help me install Apache with mod_wsgi to run Python for implementation of RESTful Web services. We're trying to get rid of our existing Java REST services with Apache Tomcat.
The installation platform is SUSE Linux Enterprise. Please provide a step by step installation procedure with required modules, as I tried it and everytime was missinhg one module or other either in Python installation or Apache installation.
I followed the standard Installation steps for all 3, Apache, Python and mod_wsgi, but didn't work out for me.
Would this work at all? Do you have any other suggestions? | Install Apache with mod_wsgi to use Python for RESTful web services and Apache for web pages | 0 | 1 | 0 | 2,568 |
4,167,863 | 2010-11-12T18:29:00.000 | 1 | 0 | 0 | 0 | python | 4,168,693 | 1 | true | 1 | 0 | Depending on how often the feeds are updated and how often you check, you could simply fix broken dates (if it's in the future, reset it to today), before adding them to the database.
Other than that, you'd have to use some sort of ID—I think RSS has an ID field on each item. If your feeds are kept in order, you can get the most recent cached ID, find that in the feed items list, and then add everything newer. If they're out of order, you'd have to check each one against your cache, and add it if it's missing. | 1 | 1 | 0 | I am writing a python script to combine about 20+ RSS feeds. I would like to use a custom solution instead of feedjack or planetfeed.
I use feedparser to parse the feeds and mysql to cache them.
The problem I am running into is determining which feeds have already been cached and which haven't.
Some pseudo code for what I have tried:
create a list of all feed items
get the date of last item cached from db
check which items in my list have a date greater than my item from the db and return this filtered list
sort the returned filtered list by date the item was created
add new items to the db
I feel like this would work, but my problem is that not all of the dates on the RSS feeds I am using are correct. Sometimes a publisher, for whatever reason, will have feed items with dates in the future. If this future date gets added to the db, then it will always be greater than the date of the items in my list. So, the comparison stops working and no new items get added to the db. I would like to come up with another solution and not rely on the publishers dates.
How would some of you pros do this? Assuming you have to combine multiple rss feeds, save them to a mysql db and then return them in ordered by date. I'm just looking for pseudo code to give me an idea of the best way to do this.
Thanks for your help. | best algorithm to combine multiple RSS feeds using Python | 1.2 | 0 | 1 | 1,116 |
4,168,020 | 2010-11-12T18:49:00.000 | 0 | 0 | 0 | 0 | python,database,pyqt | 4,208,750 | 4 | false | 0 | 1 | i guess its totally upto you ..but as far as i am concerned i personlly use sqlite, becoz it is easy to use and amazingly simple syntax whereas for MYSQL u can use it for complex apps and has options for performance tuning. but in end its totally upto u and wt your app requires | 3 | 0 | 0 | i want to create application in windows. i need to use databases which would be preferable best for pyqt application
like
sqlalchemy
mysql
etc. | which databases can be used better for pyqt application | 0 | 1 | 0 | 535 |
4,168,020 | 2010-11-12T18:49:00.000 | 1 | 0 | 0 | 0 | python,database,pyqt | 4,294,636 | 4 | false | 0 | 1 | SQlite is fine for a single user.
If you are going over a network to talk to a central database, then you need a database woith a decent Python lirary.
Take a serious look at MySQL if you need/want SQL.
Otherwise, there is CouchDB in the Not SQL camp, which is great if you are storing documents, and can express searches as Map/reduce functions. Poor for adhoc queries. | 3 | 0 | 0 | i want to create application in windows. i need to use databases which would be preferable best for pyqt application
like
sqlalchemy
mysql
etc. | which databases can be used better for pyqt application | 0.049958 | 1 | 0 | 535 |
4,168,020 | 2010-11-12T18:49:00.000 | 1 | 0 | 0 | 0 | python,database,pyqt | 4,512,428 | 4 | false | 0 | 1 | If you want a relational database I'd recommend you to use SQLAlchemy, as you then get a choice as well as an ORM. Bu default go with SQLite, as per other recommendations here.
If you don't need a relational database, take a look at ZODB. It's an awesome Python-only object-oriented database. | 3 | 0 | 0 | i want to create application in windows. i need to use databases which would be preferable best for pyqt application
like
sqlalchemy
mysql
etc. | which databases can be used better for pyqt application | 0.049958 | 1 | 0 | 535 |
4,170,442 | 2010-11-13T01:33:00.000 | 0 | 1 | 0 | 0 | python,unit-testing,sqlite | 4,170,458 | 1 | true | 0 | 0 | Technically, yes. The only thing that you need is some kind of scripting language or shell script that can talk to sqlite.
You should think of a database like a file in a file system where you don't have to care about the file format. You just say, here are tables of data, with columns. And each row of that is one record. Much like in a Excel table.
So if you are familiar with shell scripts or calling command line tools, you can install sqlite and use the sqlitecommand to interact with the database.
Although I think the first thing you should do is to learn basic SQL. There are a lot of SQL tutorials out there. | 1 | 1 | 0 | I have my own unit testing suite based on the unittest library. I would like to track the history of each test case being run. I would also like to identify after each run tests which flipped from PASS to FAIL or vice versa.
I have very little knowledge about databases, but it seems that I could utilize sqlite3 for this task.
Are there any existing solutions which integrate unittest and a database? | Using sqlite3 to track unit test results | 1.2 | 1 | 0 | 280 |
4,170,477 | 2010-11-13T01:42:00.000 | 3 | 1 | 1 | 0 | python,packaging,egg,sdist | 4,170,898 | 1 | true | 0 | 0 | One reason: eggs can include compiled C extension modules so that the end user does not need to have the necessary build tools and possible additional headers and libraries to build the extension module from scratch. The drawback to that is that the packager may need to supply multiple eggs to match each targeted platform and Python configuration. If there are many supported configurations, that can prove to be a daunting task but it can be effective for more homogenous environments. | 1 | 1 | 0 | About the only reason I can think of to distribute a python package as an egg is so that you can not include the .py files with your package (and only include .pyc files, which is a dubious way to protect your code anyway). Aside from that, I can't really think of any reason to upload a package as an egg rather than an sdist. In fact, pip doesn't even support eggs.
Is there any real reason to use an egg rather than an sdist? | Why would one use an egg over an sdist? | 1.2 | 0 | 0 | 251 |
4,170,503 | 2010-11-13T01:50:00.000 | 0 | 1 | 1 | 0 | python,categorization | 4,170,680 | 3 | false | 0 | 0 | Use a FullText search index in MySQL. Then use AJAX calls to query against your database. | 1 | 3 | 0 | I'm looking at writing a mashup app that will take submission titles from a subreddit and attempt to plot them on a map based on where they are likely to be relevant. I'd also like to add on things like Twitter later on.
What I'm having difficulty planning is how to detect the most likely to be relevant country from the title. My first guess is to have a list of countries, along with their matching permutations (e.g. "English" matches "England", etc.) and check for occurrences of those items in the text. However this is probably going to be quite slow and will require me listing the possessive* name for each country.
I'm planning on doing this in Python (so as to learn to use it) so I'm wondering is there a) a library that does this (and that I can learn from it) or b) a more obvious way to do this?
To give an idea of the types of input I'm working with here are some samples and what I'm trying to get out of them:
"Well they can't arrest all of us - Giving the middle finger to the British legal system (pic)"
Keyword: British (Great Britain)
"Poll: Wikileaks Assange leading Time 'Person of the Year' - Assange, an Australian who has become a thorn in the side of the Pentagon with his releases of secret US military documents about the wars in Iraq and Afghanistan, had received 21,736 votes as of Friday."
Keywords: Afghanistan, Iraq, [Australian] (Afghanistan, Iraq, [Australia]) - Australia would be difficult to catch out as mainly irrelevant but this is acceptable for my purposes
"Cyber attack on Nobel peace prize website launched. Stay classy, China."
Keyword: China (China)
"A Jewish surgeon refuses to operate on a patient and walks out of the operating room after discovering a nazi tattoo on the patient's arm."
Keywords: none - acceptable for my purposes
* This is probably the wrong word to use | Extracting a country name from a text string | 0 | 0 | 0 | 2,432 |
4,171,255 | 2010-11-13T06:12:00.000 | 0 | 0 | 0 | 0 | javascript,python,django,image,video | 4,171,467 | 3 | false | 1 | 0 | You need specify the "Content-Type" in the http response header. | 2 | 0 | 0 | If I have a .mp4 file, it will automatically display a video (flash?)
If it's a jpg, it'll just display the image...
Edit: I want this embedded inside a webpage. | Is there a way to display any media, regardless of type? (especially in Django?) | 0 | 0 | 0 | 85 |
4,171,255 | 2010-11-13T06:12:00.000 | 0 | 0 | 0 | 0 | javascript,python,django,image,video | 4,171,542 | 3 | true | 1 | 0 | no, you must have file view generator,
thats mean you have list of pic and video and then for each file generate correct player and tag
its easy | 2 | 0 | 0 | If I have a .mp4 file, it will automatically display a video (flash?)
If it's a jpg, it'll just display the image...
Edit: I want this embedded inside a webpage. | Is there a way to display any media, regardless of type? (especially in Django?) | 1.2 | 0 | 0 | 85 |
4,171,555 | 2010-11-13T08:01:00.000 | 1 | 0 | 1 | 1 | python,linux,ms-word | 4,171,572 | 2 | false | 0 | 0 | Openoffice has some Python scripting ability. I only heard about it, haven't studied it nor used it. | 1 | 1 | 0 | I want to create new work document from sketch with Python on Linux platform, but do not know how to do that.
I do not willing to use RTF or use pythondocx to create docx document. Is there any other way to do so? Remember, I need the document keeps the formatting.
Thanks everyone's help! | How to create a well-formatted word document(.DOC) in python on Linux? | 0.099668 | 0 | 0 | 4,741 |
4,171,842 | 2010-11-13T09:27:00.000 | 0 | 0 | 0 | 0 | python,model-view-controller,pylons | 4,178,834 | 2 | false | 1 | 0 | This is probably where you start moving chunks of code to library functions, to the /lib part of your Pylons project. "Generated by a separate controller" is probably going too far - you merely need to not repeat yourself. Try using library functions to make sure that the correct data is available, then use Mako's inheritance and namespace features. | 1 | 2 | 0 | I have a main page in Python/Pylons project, which have multiple different blocks (e.g. news/demo/(registration|private zone)/...).
My thought is that each block should be generated in a separate controller.
How can I call another controller method in a main page controller? | python/pylons - multiple controllers for template | 0 | 0 | 0 | 296 |
4,172,426 | 2010-11-13T12:11:00.000 | 1 | 0 | 0 | 0 | python,button,tkinter,state | 4,187,733 | 1 | false | 0 | 1 | You are only changing button states based on events, right? There is no reason to 'poll' to see if a button state has changed. What you can do is build a function which does all of the calling for you, then call it with something like disable_buttons([okButton, graphButton, printButton]). When an event takes place that modifies the appropriate user interface options (such as importing data), have another function that turns them on: enable_buttons([graphButton]). You could do this with each object's methods, of course, but making a wrapper allows you to be consistent throughout your application. | 1 | 0 | 0 | I've done a few searches but I couldn't find anything about this topic. Perhaps because it is common programmer knowledge (I'm not a programmer, I've learned from necessity), or because I'm going about it the wrong way.
I would like ideas/suggestions on how to manage button states for a GUI. For example, if I have a program which allows the user to import and process data, then certain functions should be inaccessible until the data has been imported successfully, or if they want to graph certain data, they need to select which data to graph before hitting the 'graph' or 'export' button. Even in the simple programs I've built these relationships seems to get complicated quickly. It seems simple to say "User shouldn't be able to hit button 'A' until 'B' and 'C' have been completed, then 'A' should be disabled if button 'D' or the 'Cancel' button. But that's a lot to track for one button. Thus far, I've tried two things:
Changing/Checking button states in the callback functions for the button. So in the above example, I would have code in buttons B's and C's callback to check if A should be enabled. And in buttons D's and Cancel's callbacks I would have code to disable button A. This gets complicated quickly and is difficult to maintain as code changes.
Setting boolean variables in every buttons callback (or just checking the states later using cget()) and checking the variables in a polling function to determine which buttons should be enabled or disabled.
I'm just not sure about this. I would like to make code as short and easy to understand as possible (and easy to edit later), but I don't like the idea of polling all the button states every few hundred milliseconds just for button 'management'. You can extend the same idea to check boxes, menu items, etc... but I'd like to here what others have done and why they do it the way they do. | How to handle button states efficiently in Tkinter | 0.197375 | 0 | 0 | 851 |
4,172,659 | 2010-11-13T13:11:00.000 | 7 | 0 | 1 | 0 | python,events,tkinter | 4,172,710 | 3 | true | 0 | 0 | There is no such list as far as I know. There is a list of most events on the bind man page, but each widget can itself issue events unique to that widget (eg: <<ListboxSelect>>). Those are documented on the man page for each widget. | 1 | 11 | 0 | I'm searching for a master list of all Tkinter events. I've been googling for such a list all all morning without success. Any references for such a list would be appreciated. | Master list of all Tkinter Events? | 1.2 | 0 | 0 | 6,361 |
4,173,674 | 2010-11-13T17:05:00.000 | 1 | 0 | 1 | 1 | python,ubuntu-10.04 | 4,173,876 | 4 | false | 0 | 0 | You probably missing some libraries that are not bundled by default on Ubuntu with Python (I have no idea why they decided to split "core" python this way).
You can try running apt-get build-dep python python-dev and build again (you might need to add other packages as well).
Rule of thumb is that if Python complains about not having sqlite3 module, you need to install libsqlite3-dev, then rebuild. | 2 | 0 | 0 | I want to install python2.5.5 in Ubuntu10.10, since Ubuntu10.10 now just supports python>=2.6, so I download source file from python website and try to install it use
./configure && make && sudo make install, it seems that python2.5.5 has been installed successfully, but when I want to use it, sometimes it says "no module named ...", but it should be bundled, I have used it in my Win7, so I wonder whether I can install all the libs. | How to install python2.5.5 in Ubuntu10.10 with all libs bundled | 0.049958 | 0 | 0 | 626 |
4,173,674 | 2010-11-13T17:05:00.000 | 1 | 0 | 1 | 1 | python,ubuntu-10.04 | 4,174,467 | 4 | false | 0 | 0 | You can add 10.04 to your apt sources, then you can install in the usual way after an apt-update | 2 | 0 | 0 | I want to install python2.5.5 in Ubuntu10.10, since Ubuntu10.10 now just supports python>=2.6, so I download source file from python website and try to install it use
./configure && make && sudo make install, it seems that python2.5.5 has been installed successfully, but when I want to use it, sometimes it says "no module named ...", but it should be bundled, I have used it in my Win7, so I wonder whether I can install all the libs. | How to install python2.5.5 in Ubuntu10.10 with all libs bundled | 0.049958 | 0 | 0 | 626 |
4,173,787 | 2010-11-13T17:32:00.000 | 2 | 0 | 1 | 0 | python,string | 4,173,811 | 8 | false | 0 | 0 | Do a regular expression search for \blocal\b
\b is a "word boundry" it can include beginnings of lines, ends of lines, punctuation, etc.
You can also search case insensitively. | 2 | 23 | 0 | I have a string in which the word "LOCAL" occurs many times. I used the find() function to search for this word but it returns another word "Locally" as well. How can I match the word "local" exactly? | String exact match | 0.049958 | 0 | 0 | 91,453 |
4,173,787 | 2010-11-13T17:32:00.000 | 1 | 0 | 1 | 0 | python,string | 4,173,805 | 8 | false | 0 | 0 | Look for ' local '? Notice that Python is case sensitive. | 2 | 23 | 0 | I have a string in which the word "LOCAL" occurs many times. I used the find() function to search for this word but it returns another word "Locally" as well. How can I match the word "local" exactly? | String exact match | 0.024995 | 0 | 0 | 91,453 |
4,173,883 | 2010-11-13T17:49:00.000 | 5 | 1 | 0 | 0 | python,social-networking,pylons,get-satisfaction | 4,174,212 | 1 | true | 0 | 0 | So you're not interested in a fixed solution but want to program it yourself, do I get that correctly? If not: Go with a fixed solution. This will be a lot of programming effort, and whatever you want to do afterwards, doing it in another framework than you intended will be a much smaller problem.
But if you're actually interested in the programming experience, and you haven't found any tutorials googling for, say "messaging python tutorial", then that's because these are large-scale projects,- if you describe a project of this size, you're so many miles above actual lines of code that the concrete programming language almost doesn't matter (or at least you don't get stuck with the details). So you need to break these things down into smaller components.
For example, the friend/follow function: How to insert stuff into a table with a user id, how to keep a table of follow-relations, how to query for a user all texts from people she's following (of course there's also some infrastructural issues if you hit >100.000 people, but you get the idea ;). Then you can ask yourself, which is the part of this which I don't know how to do in Python? If your problem, on the other hand, is breaking down the problems into these subproblems, you need to start looking for help on that, but that's probably not language specific (so you might just want to start googling for "architecture friend feed" or whatever). Also, you could ask that here (beware, each bullet point makes for a huge question in itself ;). Finally, you could get into the Pinax code (don't know it but I assume it's open source) and see how they're doing it. You could try porting some of their stuff to Pylons, for example, so you don't have to reinvent their wheel, learn how they do it, end up in the framework you wanted and maybe even create something reusable by others.
sorry for tl;dr, that's because I don't have a concrete URL to point you to! | 1 | 3 | 0 | I am looking for tutorials and/or examples of certain components of a social network web app that may include Python code examples of:
user account auto-gen function(database)
friend/follow function (Twitter/Facebook style)
messaging/reply function (Twitter style)
live chat function (Facebook style)
blog function
public forums (like Get Satisfaction or Stack Overflow)
profile page template auto-gen function
I just want to start getting my head around how Python can be used to make these features. I am not looking for a solution like Pinax since it is built upon Django and I will be ultimately using Pylons or just straight up Python. | Where can I find Python code examples, or tutorials, of social networking style functions/components? | 1.2 | 0 | 1 | 2,075 |
4,174,633 | 2010-11-13T20:51:00.000 | 4 | 1 | 1 | 0 | python,emacs | 4,174,664 | 4 | false | 0 | 0 | That depends on what shell you are using, in GNU Emacs 23 there are at least 3 built in:
shell - ugly, not working tab
eshell - not ugly but tab not working
term - not ugly and seems like ipython works with all goodies in it
So you might want to try the term mode. | 1 | 2 | 0 | I'm using emacs for python, and I'd like to have a nice useable shell in emacs to run an interpreter alongside my editing.
Is there any better emacs shell package out there? The default shell is awful. | Is there any way to get a better terminal in emacs? | 0.197375 | 0 | 0 | 2,955 |
4,175,287 | 2010-11-13T23:29:00.000 | 0 | 0 | 1 | 0 | python,path-finding | 4,175,298 | 2 | false | 0 | 0 | Have you looked at Google Maps, rather than Google Earth? This has roads and a routing engine. | 1 | 3 | 0 | I want to retrace maps from google earth these maps would then be used for calculating fastest route from A to B as well as location probability defined by some factors. How would i go about doing these? My first thought is pygame and using some already made ones or using them as a template. | Making maps and pathfinding AI | 0 | 0 | 0 | 1,211 |
4,175,419 | 2010-11-14T00:04:00.000 | 10 | 1 | 0 | 0 | php,python,apache | 4,175,473 | 1 | true | 1 | 0 | For http requests, you need to set your web server to hand over certain request to PHP and others to Python. From within PHP's scripts, if you need to call some Python executable scripts, use one of PHP's shell functions. e.g. exec()
Yes it is possible. The djangobook is a nice tutorial that covers this in one of the earlier chapters. It shows you how to run python as a cgi or with apache.
On a personal note, if you have time to dig deeper into Python, I'd strongly encourage you to do the whole thing in it, rather than mix things with PHP. My experience tells me that there are probably more cases where a PHP app needs some Python support rather than the reverse.
If the supporting language can do everything that the main language does, what's the point of using the main language? | 1 | 4 | 0 | I have some Python scripts that I run on my desktop now for cutting up files. I want to put them on the web and write a simple front-end in PHP where a user uploads a file and it is passed as an argument to a python script on the web server and it is written out in chunks and the user can re-download the chunks.
I know a decent amount of PHP, but I do not see:
How to mix PHP and Python programmatically
Is it possible to have a webpage in python that can just call the python script? Can one have a GUI page that is like zzz.com/text.py as example | Mixing Python and PHP? | 1.2 | 0 | 0 | 4,155 |
4,175,611 | 2010-11-14T01:07:00.000 | 0 | 0 | 0 | 0 | python,ruby-on-rails,ruby,django | 4,175,695 | 5 | false | 1 | 0 | For a .Net developer try to start with www.pradosoft.com/ prado framework,
it's PHP framework which looks exactly like ASP.NET ..
try it | 2 | 0 | 0 | I am a web developer working mainly with C# on ASP.NET (Webforms and MVC)..
I have worked previously with PHP and Other Frameworks and languages of the sort..
I am currently looking and focusing all my development on 2 platforms..
One Proprietary and Industry Class Framework (ASP.NET MVC)
and
One Opensource and Free Framework (Insert framework of choice here)
I have no experience with python or ruby but would like to learn one and use either django or rails..
While i understand both are very different from ASP.NET please advise me which one would be the smoothest transition.. (or the one most worth the migration pain is better!)
Thanks
Daniel | Which opensource web framework should a C# ASP.NET Guy Learn? | 0 | 0 | 0 | 893 |
4,175,611 | 2010-11-14T01:07:00.000 | 1 | 0 | 0 | 0 | python,ruby-on-rails,ruby,django | 4,178,708 | 5 | false | 1 | 0 | I am a .NET guy and also worked on PHP for a couple of months. At present I am learning Ruby and after completing basics, I am going to move on Rails.
I would suggest you to go with Ruby and than Rails. Career-wise also, Ruby guys are in demand these days, at least in my country. | 2 | 0 | 0 | I am a web developer working mainly with C# on ASP.NET (Webforms and MVC)..
I have worked previously with PHP and Other Frameworks and languages of the sort..
I am currently looking and focusing all my development on 2 platforms..
One Proprietary and Industry Class Framework (ASP.NET MVC)
and
One Opensource and Free Framework (Insert framework of choice here)
I have no experience with python or ruby but would like to learn one and use either django or rails..
While i understand both are very different from ASP.NET please advise me which one would be the smoothest transition.. (or the one most worth the migration pain is better!)
Thanks
Daniel | Which opensource web framework should a C# ASP.NET Guy Learn? | 0.039979 | 0 | 0 | 893 |
4,175,697 | 2010-11-14T01:34:00.000 | 2 | 0 | 1 | 1 | python,error-logging | 4,175,711 | 2 | false | 0 | 0 | Look at the traceback module. If you catch a RuntimeError, you can write it to the log (look at the logging module for that). | 1 | 3 | 0 | I am writting a daemon server using python, sometimes there are python runtime errors, for example some variable type is not correct. That error will not cause the process to exit.
Is it possible for me to redirect such runtime error to a log file? | How to redirect python runtime errors? | 0.197375 | 0 | 0 | 2,714 |
4,176,087 | 2010-11-14T03:35:00.000 | 3 | 0 | 1 | 0 | c#,java,python,c | 4,176,101 | 11 | false | 0 | 0 | Yes, serialization is the only way to transmit data over the wire. Consider what the purpose of serialization is. You define the way that the class is stored. In memory tho, you have no way to know exactly where each portion of the class is. Especially if you have, for instance, a list, if it's been allocated early but then reallocated, it's likely to be fragmented all over the place, so it's not one contiguous block of memory. How do you send that fragmented class over the line?
For that matter, if you send a List<ComplexType> over the wire, how does it know where each ComplexType begins and ends. | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0.054491 | 0 | 0 | 3,339 |
4,176,087 | 2010-11-14T03:35:00.000 | 4 | 0 | 1 | 0 | c#,java,python,c | 4,176,102 | 11 | false | 0 | 0 | Serialization of some kind is required, but this can take many forms. It can be something like dotNET serialization, that is handled by the language, or it can be a custom built format. Maybe a series of bytes where each byte represents some "magic value" that only you and your application understand.
For example, in dotNET I can can create a class with a single string property, mark it as serializable and the dotNET framework takes care of most everything else.
I can also build my own custom format where the first 4 bytes represent the length of the data being sent and all subsequent bytes are characters in a string. But then of course you need to worry about byte ordering, unicode vs ansi encoding, etc etc.
Typically it is easier to make use of whatever framework your language/OS/dev framework uses, but it is not required. | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0.072599 | 0 | 0 | 3,339 |
4,176,087 | 2010-11-14T03:35:00.000 | 0 | 0 | 1 | 0 | c#,java,python,c | 4,176,105 | 11 | false | 0 | 0 | Binary serialization is not the only option. You can also serialize an object as an XML file, for example. Or as a JSON. | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0 | 0 | 0 | 3,339 |
4,176,087 | 2010-11-14T03:35:00.000 | 0 | 0 | 1 | 0 | c#,java,python,c | 4,176,230 | 11 | false | 0 | 0 | I think you're asking the wrong question. Serialization is a concept in computer programming and there are certain requirements which must be satisfied for something to be considered a serialization mechanism.
Any means of preparing data such that it can be transmitted or stored in such a way that another program (including but not limited to another instance of the same program on another system or at another time) can read the data and re-instantiate whatever objects the data represents.
Note I slipped the term "objects" in there. If I write a program that stores a bunch of text in a file; and I later use some other program, or some instance of that first program to read that data ... I haven't really used a "serialization" mechanism. If I write it in such a way that the text is also stored with some state about how it was being manipulated ... that might entail serialization.
The term is used mostly to convey the concept that active combinations of behavior and state are being rendered into a form which can be read by another program/instance and instantiated. Most serialization mechanism are bound to a particular programming language, or virtual machine system (in the sense of a Java VM, a C# VM etc; not in the sense of "VMware" virtual machines). JSON (and YAML) are a notable exception to this. They represents data for which there are reasonably close object classes with reasonably similar semantics such that they can be instantiated in multiple different programming languages in a meaningful way.
It's not that all data transmission or storage entails "serialization" ... is that certain ways of storing and transmitting data can be used for serialization. At very list it must be possible to disambiguated among the types of data that the programming language supports. If it reads: 1 is has to know whether that's text or an integer or a real (equivalent to 1.0) or a bit. | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0 | 0 | 0 | 3,339 |
4,176,087 | 2010-11-14T03:35:00.000 | 2 | 0 | 1 | 0 | c#,java,python,c | 4,176,793 | 11 | false | 0 | 0 | Is serialization a must in order to transfer data across the wire?
Literally no.
It is conceivable that you can move data from one address space to another without serializing it. For example, a hypothetical system using distributed virtual memory could move data / objects from one machine to another by sending pages ... without any specific serialization step.
And within a machine, the objects could be transferred by switch pages from one virtual address space to another.
But in practice, the answer is yes. I'm not aware of any mainstream technology that works that way. | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0.036348 | 0 | 0 | 3,339 |
4,176,087 | 2010-11-14T03:35:00.000 | 0 | 0 | 1 | 0 | c#,java,python,c | 4,177,077 | 11 | false | 0 | 0 | Having a messages as objects and serializing into bytes is a better way of understanding and managing what is transmitted over wire. In the old days protocols and data was much simpler, often, programmers just put bytes into output stream. Common understanding was shared by having well-known and simple specifications. | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0 | 0 | 0 | 3,339 |
4,176,087 | 2010-11-14T03:35:00.000 | 0 | 0 | 1 | 0 | c#,java,python,c | 4,176,100 | 11 | false | 0 | 0 | For anything more complex than a primitive or a homogeneous run of primitives, yes. | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0 | 0 | 0 | 3,339 |
4,176,087 | 2010-11-14T03:35:00.000 | 0 | 0 | 1 | 0 | c#,java,python,c | 4,177,202 | 11 | false | 0 | 0 | I would say serialization is needed to store the objects in file for persistence, but dynamically allocated pointers in objects need to be build again when we de-serialize, But the serialization for transfer depends on the physical protocol and the mechanism used, for example if i use UART to transfer data then its serialized bit by bit but if i use parallel port then 8 bits together gets transferred , which is not serialized | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0 | 0 | 0 | 3,339 |
4,176,087 | 2010-11-14T03:35:00.000 | 0 | 0 | 1 | 0 | c#,java,python,c | 4,176,254 | 11 | false | 0 | 0 | Strictly speaking it isn't the only option; you could put an argument that "remoting" meets the meaning inthe text; here a fake object is created at the receiver that contains no state. All calls (methods, properties etc) are intercepted and only the call and result are transferred. This avoids the need to transfer the object itself, but can get very expensive if overly "chatty" usage is involved (I.e. Lots of calls)as each has the latency of the speed of light (which adds up).
However, "remoting" is now rather out of fashion. Most often, yes: the object will need to be serialised and deserialized in some way (there are lots of options here). The paragraph is then pretty-much correct. | 9 | 9 | 0 | Below is something I read and was wondering if the statement is true.
Serialization is the process of
converting a data structure or object
into a sequence of bits so that it can
be stored in a file or memory buffer,
or transmitted across a network
connection link to be "resurrected"
later in the same or another computer
environment.[1] When the resulting
series of bits is reread according to
the serialization format, it can be
used to create a semantically
identical clone of the original
object. For many complex objects, such
as those that make extensive use of
references, this process is not
straightforward. | Is serialization a must in order to transfer data across the wire? | 0 | 0 | 0 | 3,339 |
4,176,256 | 2010-11-14T04:59:00.000 | 0 | 0 | 0 | 0 | pdf,reporting-services,render,python-2to3 | 4,195,530 | 1 | true | 1 | 0 | I was able to resolve using device info with startpage as 2 and endpage as int.maxvalue | 1 | 0 | 0 | I m rendering SSRS Report in pdf format. I want pages from 2 to Last page. Using deviceinfo is it possible? | SSRS Get from page 2 to end page | 1.2 | 0 | 0 | 148 |
4,176,405 | 2010-11-14T06:10:00.000 | 11 | 0 | 0 | 1 | python,twisted,nonblocking | 4,176,590 | 1 | true | 0 | 0 | Yes. The best practice is that this is a bad idea, and that you never really need to do it. It doesn't work with all reactors, and you certainly can't have two different libraries which want to do this.
Why do you need to maintain your own main loop? Chances are, it's something like "I want to work with PyGame" or "I am writing a GUI program and I want to use GTK's mainloop" or "I'm using Twisted from within Blender and it has its own event-handling". If this is the case, you should ask that specific question, because each one of those has its own answer.
If you absolutely need to do this (and, again: you don't) the way to do it is to call reactor.iterate() periodically. This will be slow, break signal handling, and have wonky semantics with respect to reactor.stop(). It will introduce lots of bugs into your program that wouldn't otherwise be there, and when you need help diagnosing them, if you ask someone on the Twisted dev team, the first thing they will tell you is "stop doing that, you don't need to do it". | 1 | 6 | 0 | Instead of running reactor.run(), I'd like to call something else (I dunno, like reactor.runOnce() or something) occasionally while maintaining my own main loop. Is there a best-practice for this with twisted? | What is the best way to control Twisted's reactor so that it is nonblocking? | 1.2 | 0 | 0 | 1,443 |
4,177,907 | 2010-11-14T14:27:00.000 | 3 | 0 | 0 | 1 | python,django,google-app-engine,django-nonrel | 4,180,124 | 1 | true | 1 | 0 | Yes, djangoappengine has a mail backend for GAE and it's enabled by default in your settings.py via "from djangoappengine.settings_base import *". You can take a look at the settings_base module to see all backends and default settings. | 1 | 2 | 0 | I'm using Django-nonrel for Google App Engine and I was wondering if it's possible to use Django's built-in mail API instead of GAE's mail API for sending mail. If it is, how do I do it?
Sorry if this seems like a noob question. I just started learning Django and GAE recently and I can't work out this problem that I have by myself. | Can I use Django's mail API in Google App Engine? | 1.2 | 0 | 0 | 670 |
4,178,742 | 2010-11-14T17:42:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,mongodb,pymongo | 4,179,091 | 3 | false | 1 | 0 | It's not possible because you don't have access to networks sockets in App Engine. As long as you cannot access the database via HTTP, it's impossible. | 1 | 4 | 0 | I'm trying to use a MongoDB Database from a Google App Engine service is that possible? How do I install the PyMongo driver on Google App Engine? Thanks | is it possible to use PyMongo in Google App Engine? | 0.066568 | 1 | 0 | 1,355 |
4,178,828 | 2010-11-14T18:04:00.000 | 2 | 0 | 0 | 0 | python,sqlite | 4,178,853 | 1 | true | 0 | 0 | Because cursor.execute() doesn't actually return the data. Presumably you need that, so you need to run fetchall. | 1 | 1 | 0 | Why would I want to reference cursor.fetchall() if I can use cursor.execute directly?a
Thanks | Why would I want to reference cursor.fetchall() if I can use cursor.execute directly? | 1.2 | 0 | 0 | 131 |
4,179,077 | 2010-11-14T18:57:00.000 | 1 | 0 | 0 | 1 | python,multithreading,sockets,admin-interface | 4,179,129 | 3 | false | 0 | 0 | python includes some multi-threading servers (SocketServer, BaseHTTPServer, xmlrpclib). You might want to look at Twisted as well, it is a powerful framework for networking. | 2 | 1 | 0 | I've built a very simple TCP server (in python) that when queried, returns various system level statistics of the host OS running said script.
As part of my experimentation and goal to gain knowledge of python and its available libraries; i would like to build on an administration interface that a) binds to a separate TCP socket b) accepts remote connections from the LAN and c) allows the connected user to issue various commands. The Varnish application is an example of a tool that offers similar administrative functionality.
My knowledge of threads is limited, and I am looking for pointers on how to accomplish something similar to the following :
user connects to admin port (telnet remote.host 12111), and issues "SET LOGGING DEBUG", or "STOP SERVICE".
My confusion relates to how i would go about sharing data between threads. If the service is started on for example thread-1 , how can i access data from that thread?
Alternatively, a list of python applications that offer such a feature would be a great help. I'd gladly poke through code, in order to reuse their ideas. | Suggestions for developing a threaded tcp based admin interface | 0.066568 | 0 | 0 | 178 |
4,179,077 | 2010-11-14T18:57:00.000 | 0 | 0 | 0 | 1 | python,multithreading,sockets,admin-interface | 4,179,107 | 3 | false | 0 | 0 | Probably the easiest starting point would involve Python's xmlrpclib.
Regarding threading, all threads can read all data in a Python program; only one thread at a time can modify any given object, so primitives such as lists and dicts will always be in a consistent state. Data structures (i.e. class objects) involving multiple primitives will require a little more care. The safest way to coordinate between threads is to pass messages/commands between threads via something like Queue.Queue; this isn't always the most efficient way but it's far less prone to problems. | 2 | 1 | 0 | I've built a very simple TCP server (in python) that when queried, returns various system level statistics of the host OS running said script.
As part of my experimentation and goal to gain knowledge of python and its available libraries; i would like to build on an administration interface that a) binds to a separate TCP socket b) accepts remote connections from the LAN and c) allows the connected user to issue various commands. The Varnish application is an example of a tool that offers similar administrative functionality.
My knowledge of threads is limited, and I am looking for pointers on how to accomplish something similar to the following :
user connects to admin port (telnet remote.host 12111), and issues "SET LOGGING DEBUG", or "STOP SERVICE".
My confusion relates to how i would go about sharing data between threads. If the service is started on for example thread-1 , how can i access data from that thread?
Alternatively, a list of python applications that offer such a feature would be a great help. I'd gladly poke through code, in order to reuse their ideas. | Suggestions for developing a threaded tcp based admin interface | 0 | 0 | 0 | 178 |
4,179,831 | 2010-11-14T21:38:00.000 | 5 | 0 | 1 | 0 | python | 4,179,849 | 4 | true | 0 | 0 | It's not necessary to do so, but if you want you can have your method raise a TypeError if you know that the object is of a type that you cannot handle. One reason to do this is to help people to understand why the method call is failing and to give them some help fixing it, rather than giving them obscure error from the internals of your function.
Some methods in the standard library do this:
>>> [] + 1
Traceback (most recent call last):
File "", line 1, in
TypeError: can only concatenate list (not "int") to list | 1 | 5 | 0 | I have a function that is supposed to take a string, append things to it where necessary, and return the result.
My natural inclination is to just return the result, which involved string concatenation, and if it failed, let the exception float up to the caller. However, this function has a default value, which I just return unmodified.
My question is: What if someone passed something unexpected to the method, and it returns something the user doesn't expect? The method should fail, but how to enforce that? | What is the proper python way to write methods that only take a particular type? | 1.2 | 0 | 0 | 134 |
4,179,879 | 2010-11-14T21:46:00.000 | 1 | 1 | 0 | 0 | python,multithreading,load-testing | 4,180,003 | 2 | false | 0 | 0 | too many variables. 1000 at the same time... no. in the same second... possibly. bandwidth may well be the bottleneck. this is something best solved by experimentation. | 1 | 4 | 0 | I want to do a test load for a web page. I want to do it in python with multiple threads.
First POST request would login user (set cookies).
Then I need to know how many users doing the same POST request simultaneously can server take.
So I'm thinking about spawning threads in which requests would be made in loop.
I have a couple of questions:
1. Is it possible to run 1000 - 1500 requests at the same time CPU wise? I mean wouldn't it slow down the system so it's not reliable anymore?
2. What about the bandwidth limitations? How good the channel should be for this test to be reliable?
Server on which test site is hosted is Amazon EC2 script would be run from another server(Amazon too).
Thanks! | Python script load testing web page | 0.099668 | 0 | 1 | 8,721 |
4,180,120 | 2010-11-14T22:41:00.000 | 5 | 0 | 0 | 0 | python,django,model,django-queryset | 4,180,322 | 1 | true | 1 | 0 | If the ForeignKey is, as you describe in ModelB and you do mb = ModelB.objects.get(pk=prim_id) then the look up for the modela attribute is not a reverse lookup. you simply access the related object via mb.modela! | 1 | 6 | 0 | I have a django project which has two apps, one is AppA and AppB. Now AppA has a model
ModelA which is referenced by the model ModelB in AppB, using modelA = models.ForeignKey(ModelA, related_name='tricky')
Now in my view for AppA, when it shows ModelA, I do a get_object_or_404(ModelA, pk=prim_id). Then I want to get all the ModelBs which have a Foreign Key pointing to ModelA.
Documentation says I should do a mb = ModelB.objects.get(pk=prim_id) then mb.modela_set.all()
But, it failed on the mb.modela_set, and it says "ModelB object has no attribute 'suchsuch'". Notice I added the related_name field to ForeignKey, so I tried with that as well, including mb.tricky.all() and mb.tricky_set.all() to no avail.
Oh, and I have specified a different manager for AppA where I do objects = MyManager() which returns the normal query but with a filter applied.
What could be the problem? What is the prefered way to get the ModelBs referencing ModelA? | Django reverse lookup by ForeignKey | 1.2 | 0 | 0 | 7,718 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.