I have two points in 3D:
(xa,ya,za)
(xb,yb,zb)
And I want to calculate the distance:
dist = sqrt((xa-xb)^2 + (ya-yb)^2 + (za-zb)^2)
What's the best way to do this with Numpy, or with Python in general? I have:
a = numpy.array((xa,ya,za))
b = numpy.array((xb,yb,zb))
I am investigating a switch from windows to linux struggle to find samples of design patterns applied in this world.
If i use python or ruby, what should i use for GUI ?
And what pattern : is MVC, MVVM or MVP any good ?
Or is there anything better ?
Hello,
I'm writing a program in python using dbus that detects inserted usb drives and manipulates the files inside of them. However, I can't seem to retrieve the path on my system of an inserted usb. Is there someway that I can get the path of an inserted usb in dbus, perhaps by using the GetProperty() method? I have tried using GetProperty("block.device"), but that returns /dev/sdc1 which doesn't exist on my system. Thanks in advance for any help!
Let's say I managed to get the dictionary opened for iTunes in the Applescript editor:
How would I access the "search" commands using Python with pyobjc?
I know I get can hold of the iTunes application using:
iTunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")
but after I do a dir on it, I don't see the search command in the returned dictionary. Help please!
Hello,
I use a c++ dll in python. That dll uses other dlls.
I want to know if it's possible to include all the dll's in my .exe using py2exe without calling them directlly. If so, how can I do it?
Thanks in advance :)
I'm currently migrating all existing (incomplete) documentation to Sphinx.
The problem is that the documentation uses Python docstrings (the module is written in C, but it probably does not matter) and the class documentation must be converted into a form usable for Sphinx.
There is sphinx.ext.autodoc, but it automatically puts current docstrings to the document. I want to generate source (RST) file based on current docstrings, which I could edit and improve manually.
How would you transform docstrings into RST for Sphinx?
Hello,
I want to know if it's possible to control "Microsoft Speech Recognition" using c#.
Is it possible, for instance, to simulate the click on "On: Listen to everything I say" programmatically using c# or python?
I can look inside setup.py I suppose to see if it's a distutils package. But in the process of familiarizing myself with python package management I have noticed that there seems to be more than one way to do it. So:
How can I check an unzipped packages directory or setup.py to see how to build it?
I tried to install pygtk on mac. I downloaded the pygtk file, opened up terminal and set it to my working directory, then ran the command "python setup.py install". There was an import error because there was no module dsextras. Does anyone know how to install pygtk on a mac or get dsextras.
I am looking for a convenient way to create a list of lists for which the lists within the list have consecutive numbers. So far I only came up with a very unsatisfying brute-typing force solution (yeah right, I just use python for a few weeks now):
block0 = []
...
block4 = []
blocks = [block0,block1,block2,block4]
I appreciate any help that works with something like nrBlocks = 4.
I want to execute an external program in each thread of a multi-threaded python program.
Let's say max running time is set to 1 second. If started process completes within 1 second, main program capture its output for further processing. If it doesn't finishes in 1 second, main program just terminate it and start another new process.
How to implement this?
I am trying to use python's multiprocessing library to hopefully gain some performance. Specifically I am using its map function. Now, for some reason when I swap it out with its single threaded counterpart I don't get any memory leaks over time. But using the multiprocessing version of map causes my memory to go through the roof. For the record I am doing something which can easily hog up loads of memory, but what would the difference be between the two to cause such a stark difference?
Are there any publicly available SOAP 1.2/WSDL 2.0 compliant free web services for testing a Python based soap client library (e.g. Zolera SOAP Infrastructure)?
So far, it appears to me that Google Web API may be the only option.
Otherwise, how can one test a SOAP 1.2 compliant client library?
Hi, I have a guitar and I need my pc to be able to tell what note is being played, recognizing the tone. Is it possible to do it in python, also is it possible with pygame? Being able of doing it in pygame would be very helpful.
I got a headache looking for this:
How do you use s/// in an expression as opposed to an assignment. To clarify what I mean, I'm looking for a perl equivalent of python's re.sub(...) when used in the following context:
newstring = re.sub('ab', 'cd', oldstring)
The only way I know how to do this in perl so far is:
$oldstring =~ s/ab/cd/;
$newstring = $oldstring;
Note the extra assignment.
There is a library in python that I love called requests. requests is a http client build on urllib3, top-notch :) (http://docs.python-requests.org/en/latest/)
I am looking for something similar in ruby, basically what I need is :
Upload files support (multipart/form-data)
Easy get/post
Cookies can be passed from a response object to a request object (build manually login script)
Stable and Flexible
Sessions support (to not have to handle cookies manually if we don't have too)
I've looked at Typhoeus, but the code example in the home page doesn't work (they have moved code along and the get method is not longer directly accessible like that), so it's not starting well! :) Curb seems nice and I like curl, there is alson RestClient which seems popular and em-http seems pretty fast according to benchmark. There is a aso Patron and CurlFu which I haven't have the time to try. And of course Net:Http. But it doesn't seems to have a main stream solution that everyone point.
I think a lot of people have been in my situation and I wonder what they have choosen and why?
Hi,
I am working on Enterprise Search and we are using Fast ESP and for now i have 4 projects but i have no information about stages and python. But i realize that i have learn custom stage development. Because we have a lot of difficulties about document processing. I want to know how can i develop custom stage and especially i wanna know about how i can find Attributefilter stage source code. I am waiting your answers
The Selenium setup.py can be found at http://code.google.com/p/selenium/source/browse/trunk/setup.py.
When running "python setup.py sdist" the "firefox/test/py" directory
is ignored for some reason though it's
mentioned in the "package_dir" and in "packages".
Any ideas why it's ignored?
The table is:
currency_name exchange_rate
USD 1.000000
EUR 1.194929
CAD 0.942142
etc.
What I want is to make a simple little cron job Python script to run every couple hours and update these values in the database. Are there any open APIs? I mean I am like 99% sure Yahoo! or Google finance has something like this but cannot find. Maybe someone here has done this?
How do I use lookahead assertion to determine if a certain character exist at most a certain number of times in a string.
For example, let's say I want to check a string that has at least one character to make sure that it contains "@" at most 2 times. Thanks in advance. Using python if that matters.
Hi all.
What are the most stable and useful Cryptography libraries, that they are:
written with/for python, c++, c#, .net
opensource, GNU, or other free license
My doc strings have references to other python classes that I've defined. Every time Sphinx encounters one of these classes, I want it to insert a link to the documentation for that other class. Is this possible in Sphinx?
Specifically, I have a doc string like:
'''This class contains a bunch of Foo objects'''
I could write:
'''This class contains a bunch of :class:`~foo.Foo` objects'''
but I would prefer that Sphinx finds all text matching Foo and makes it seem as though I had typed
:class:~foo.Foo
Hi,
I'm using Google Book Search API to add missings bits and pieces to my database.
Problem is that The API gives me back a list of book editions, and not reference to the original book itself.
The data I'm trying to get is this:
Original title: The Hobbit
Original year of publication: 1937
Can anyone help?
Just in case anyone asks: I'm developing this in Python.
I believe it's because I installed python using SciPy, so apparently it's not in the registry where the psycopg2 installer is looking. Anyway to fix this without installing python26 over the existing install? I'm not sure if that will corrupt it.