Hi,
I have a set of data's as,
Table-1
X1 | Y1
------+--------
0.1 | 0.52147
0.02 | 0.8879
0.08 | 0.901
0.11 | 1.55
0.15 | 1.82
0.152 | 1.95
Table-2
X2 | Y2
-----+------
0.2 | 0.11
0.21 | 0.112
0.34 | 0.120
0.33 | 1.121
I have to interpolate Table-2 'Y2' value f...
If I derive a class from ctypes.BigEndianStructure, pylint warns if I don't call BigEndianStructure.init (). Great, but if I fix my code, pylint still warns:
import ctypes
class Foo(ctypes.BigEndianStructure):
def __init__(self):
ctypes.BigEndianStructure.__init__(self)
$ pylint mymodule.py
C: 1: Missing docstring
C: 3:F...
Suppose I have the following structure:
app/
__init__.py
foo/
a.py
b.py
c.py
__init__.py
a.py, b.py and c.py share some common imports (logging, os, re, etc). Is it possible to import these three or four common modules from the __init__.py file so I don't have to import them in every one of the files?
Edit: My goa...
I'm trying to find out if an Element in a Django model exists. I think that should be very easy to do, but couldn't find any elegant way in the Making queries section of the Django documentation.
The problem I have is that I've thousands of screenshots in a directory and need to check if they are in the database that is supposed to stor...
I'm trying to raise an exception on the Server Side of an SimpleXMLRPCServer; however, all attempts get a "Fault 1" exception on the client side.
RPC_Server.AbortTest()
File "C:\Python25\lib\xmlrpclib.py", line 1147, in call
return self.send(self.__name, args)
File "C:\Python25\lib\xmlrpclib.py", line 1437, in __request
verb...
I can successfully use Python to create a database and run the execute() method to create 2 new tables and specify the column names. However, I cannot insert data into the database. This is the code that I am trying to use to insert the data into the database:
#! /usr/bin/env python
import sqlite3
companies = ('GOOG', 'AAPL', 'MSFT')
...
In Pylons I have a mako template linking to /static/resource.css. How do I automatically link to /pylons/static/resource.css when I decide to map the application to a subdirectory on my web server?
...
I have to deploy some Web Services on a server that only supports the Java ones, but some of them will be done using perl or python. I want to know if is possible to develop a Java wrapper to call a specific code written in perl or python. So, I want to have all the Web Services in Java, but some of them will call some code using other l...
Is there a way to get a list of wireless networks (SSID's) that are currently available? And seeing what is the current connected network?
Doesn't need to be exactly the SSID, I just need to identify the current wireless network.
...
How can I get the current Windows' browser proxy setting, as well as set them to a value?
I knnow I can do this by looking in the registry at Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer, but I'm looking, if it is possible, to do this without directly messing with the registry.
...
I am integrating "legacy" code with Django, and have problems when the process executing Django must write to legacy code directories where it lacks write permissions. (The legacy code is a Python backend to a Tkinter GUI, which I'm repurposing to a browser-based UI.)
I could:
Make the legacy directory writeable
to all, but this seem...
What is the cleanest way to add a field to a structured numpy array? Can it be done destructively, or is it necessary to create a new array and copy over the existing fields? Are the contents of each field stored contiguously in memory so that such copying can be done efficiently?
...
I have a wxPython notebook, in this case a wx.aui.AuiNotebook. (but this problem has happened with other kinds of notebooks as well.) In my notebook I have a widget, in this case a subclass of ScrolledPanel, for which I am trying to do some custom event handling (for wx.EVT_KEY_DOWN). However, the events are not being handled. I checked ...
i am planning to develop an app in Python on win32 platform and was wondering if the opensocial api worked upon the win32 platform as well.
to make things more clear, i need to use info from the opensocial api to conduct certain things in teh app.
i know i am a bit confused here as i have practicaly no knowledge of opensocial.
can anyon...
This is related to the various other questions about sorting values of dictionaries that I have read here, but I have not found the answer. I'm a newbie and maybe I just didn't see the answer as it concerns my problem.
I have this function, which I'm using as a Django custom filter to sort results from a list of dictionaries. Actually, ...
Is there a way of using raw_input without leaving a sign in the readline history, so that it don't show when tab-completing?
...
Hi SO,
This is a kind of newbie question, but I couldn't find a solution. I read a list of strings from a file, and try to get a random, 5 element sample with random.sample, but the resultung list only contains characters. Why is that? How can I get a random sample list of strings?
This is what I do:
names = random.sample( open('n...
Assume a game in which one rolls 20, 8-sided die, for a total number of 8^20 possible outcomes. To calculate the probability of a particular event occurring, we divide the number of ways that event can occur by 8^20.
One can calculate the number of ways to get exactly 5 dice of the value 3. (20 choose 5) gives us the number of orders o...
Thinking through an idea, wanted to get feedback/suggestions:
Having had great success with url rewriting and nginx, I'm now thinking of a more capable reverse proxy/router that would do the following:
Map requests to handlers based on regex matching (ala Django)
Certain requests would simply be routed to backend servers - eg. static ...
Class hierarchies and constructors are related. Parameters from a child class need to be passed to their parent.
So, in Python, we end up with something like this:
class Parent(object):
def __init__(self, a, b, c, ka=None, kb=None, kc=None):
# do something with a, b, c, ka, kb, kc
class Child(Parent):
def __init__(sel...