I am implementing a C++ program that uses python/C++ Extensions. As of now I am explicitly linking my program to python static library I compiled. I am wondering is there any way to link my program with system installed python(i mean the default python installation that comes with linux)
...
I have the following lines in a file where I want to take the third column; In the file I don't have the numbers column:
Red; Blue; Green; White; Orange;
Green; White; Orange;
Blue; Green; White;
Red; Blue; Green; White;
Blue; Green; White; Orange;
Orange
Green; White; Orange;
White; Orange
Green;
I used this code line to do that:
l...
I seem to have a problem with Django when it comes Rendering ManyToManyField in a template. I can make it work partially, but I cannot make it work properly as I want it.
Firstly I have an invoice template which displays Invoice details from my data base
#invoice_details.html
{% extends "base.html" %}
{% block content %}
<h2>Invoice D...
I'm trying to decide which approach to take to testing a Django app I'm writing. I've seen Cucumber and that put me onto lettuce (URL is lettuce.it) and pycurracy. I like the look of these frameworks since hopefully non-technical people will be able to write definitions.
I want to be able to:
run functional tests integrated with Djang...
Hello.
I'd like to ask you for an advice.
How to connect pyqtSignal between two different objects (classes) PROPERLY? I mean best practice.
Look what I have done to achieve the goal: The Thermometer class is notified when Pot increases its temperature:
from PyQt4 import QtCore
class Pot(QtCore.QObject):
temperatureRaisedSignal = Qt...
Hi all
I've been tasked to find N clusters containing the most points for a certain data set given that the clusters are bounded by a certain size. Currently, I am attempting to do this by plugging in my data into a kd-tree, iterating over the data and finding its nearest neighbor, and then merging the points if the cluster they make do...
I have a 'GameBoard' class and am doing a search on it. I want to save the current gameboard in a list, change the state of the gameboard, save THAT one in a list, and so on (so I would have incremental versions of the gameboard as a game progresses).
I'm currently doing this with copy.deepcopy, but it doesn't seem to be saving and mov...
Hi, I am dealing with a problem how to raise a Warning in Python without having to let the program crash / stop / interrupt.
I use following simple function that only checks if the user passed to it a non-zero number. If the user passes a zero, the program should warn the user, but continue normally. It should work like the following co...
How to make entry.category to be instance of CategoryProxy? See code for details:
class Category(models.Model): pass
class Entry(models.Model):
category = models.ForeignKey(Category)
class EntryProxy(Entry):
class Meta:
proxy = True
class CategoryProxy(Category):
class Meta:
proxy = True
entry = EntryProx...
I'm setting up a development version of a live server on Webfaction, running Django apps in a virtual Apache server environment (running without any errors) on my local machine - XP, running XAMPP Lite with Python 2.6 - which I can commit changes from via Git.
XAMPP is up and running OK with Python, and the server starts perfectly with ...
Hi i am new to Pyqt and i am wondering if it is possible to have goodness of sqlalchemy e.g. connection pooling and managing, abstracting away all the menial low level details?
...
Hi, I have a following function in Python and I want to test with unittest that if the function gets 0 as argument, it throws a warning. I already tried assertRaises, but since I don't raise the warning, that doesn't work.
def isZero( i):
if i != 0:
print "OK"
else:
warning = Warning( "the input is 0!...
Currently I have a splash screen in place. However, it does not work as a real splash screen - as it halts the execution of the rest of the code (instead of allowing them to run in the background).
This is the current (reduced) arquitecture of my program, with the important bits displayed in full. How can I adapt the splash screen curr...
I tried to run this code from the book 'Python Standard Library' of 'Fred Lunde'.
import popen2, string
fin, fout = popen2.popen2("sort")
fout.write("foo\n")
fout.write("bar\n")
fout.close()
print fin.readline(),
print fin.readline(),
fin.close()
It runs well with a warning of
~/python_standard_library_oreilly_lunde/scripts/pope...
I get access to part of the Internet by ssh login a server, like:
ssh -D 9999 -C user@server
Then set sock proxy on browser 127.0.0.1:9999
The server is behind a firewall.
On the server I can access the Internet using a 'proxy.pac' file with username and password
The problem is:
can I ssh to the server while having the server use th...
I'm trying to find a Python coding style enforcer (tool, not person!). Any recommendations?
--Steve
...
Hello,
I am trying to simplify this function at his maximum, how can I do?
def eleMax(items, start=0, end=None):
if end is None:
end = len(items)
return max(items[start:end])
I though of
def eleMax(items, start=0, end=-1):
return max(items[start:end])
But the last element is deleted from the list.
Thank for y...
I'm working on embedding Python 2.6 into an existing c++ application. So far I have the Libraries linked in and am able to successfully initialize the Python Interpreter and can also transfer data to Python. I'm having trouble retrieving it, and hope someone can steer me the right direction. I'm working with this:
Py_Initialize();
p...
I need to retrieve 5 objects that match a certain complex criteria, and I can't/don't want to pass that criteria to the WHERE clause(filter in django), so I need to iterate over the results, testing each record for the criteria until I get my 5 objects, after that I want to throw the query set away and never see it again.
In most cases...
http://code.google.com/appengine/articles/update_schema.html
Trying to work this out for a nice little updater across my web application. The only difference is rather than sorting on a StringProperty as shown in the example I am using an IntegerProperty.
No matter which way round I turn the query I cannot get it to respond correctly t...