Under xcode 3.2 my ObjectiveC + Python/Ruby projects can still be opened updated and compiled, but you cannot create new projects.
Given that all traces of ruby and python are missing from xcode 3.2 (ie create project and add new ruby/python file), is there an easy way to get the templates installed again?
I found some info about copy...
I have a sequence of new objects. They all look like similar to this:
Foo(pk_col1=x, pk_col2=y, val='bar')
Some of those are Foo that exist (i.e. only val differs from the row in the db)
and should generate update queries. The others should generate inserts.
I can think of a few ways of doing this, the best being:
pk_cols = Foo.table...
I need to write (or find) a script to create a Debian package (using python-support) from a Python package. The Python package will be pure Python (no C extensions).
The Python package (for testing purposes) will just be a directory with an empty __init__.py file and a single Python module, package_test.py.
The packaging script must us...
I'm a fairly strong Python coder, but too much of my style is a little haphazard, and I'm sure there are more Pythonic solutions to many problems than the ones I come up with. Which PEPs are essential for any well versed Pythonista to read?
...
Hi,
I have a list filter = ['a', 'b', 'c']. I need to frame the following string out of the list
"item -a item -b item -c". Which is the most efficient way to do this? Usually the list filter contains 100 to 200 items and each would be of length 100 - 150. Wouldn't that lead to overflow? And what is the maximum length of the string supp...
I want to create an array holding a function f(x,y,z). If it were a function of one variable I'd do, for instance:
sinx = numpy.sin(numpy.linspace(-5,5,100))
to get sin(x) for x in [-5,5]
How can I do the same to get, for instance sin(x+y+z)?
...
I am working with a Python class, and I don't have write access to its declaration.
How can I attach a custom method (such as __str__) to the objects created from that class without modifying the class declaration?
EDIT:
Thank you for all your answers. I tried them all but they haven't resolved my problem. Here is a minimal example tha...
I have a unicode string with accented latin chars e.g.
n=unicode('Wikipédia, le projet d’encyclopédie','utf-8')
I want to convert it to plain ascii i.e. 'Wikipedia, le projet dencyclopedie', so all acute/accent,cedilla etc should get removed
What is the fastest way to do that, as it needed to be done for matching a long autocomplete ...
Hello,
I have Pythong2.6, psycopg2 and pgAdmin3 installed using Macports. My settings.py is:
DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'mysite' # Or path to database file if using sqlite3.
DATABASE_USER = 'postgres' # ...
I want to define a constant that should be available in all of the submodules of a package. I've thought that the best place would be in in the __init__.py file of the root package. But I don't know how to do this. Suppose I have a few subpackages and each with several modules. How can I access that variable from these modules?
Of cours...
Hi, I can't figure out how to log info-level messages to stdout, but everything else to stderr. I already read this http://docs.python.org/library/logging.html. Any suggestion?
...
I have a class called Path for which there are defined about 10 methods, in a dedicated module Path.py. Recently I had a need to write 5 more methods for Path, however these new methods are quite obscure and technical and 90% of the time they are irrelevant.
Where would be a good place to put them so their context is clear? Of course I ...
I am setting up a simple test page in Python. I only have two files: .htaccess and index.py. I get a 403 Forbidden error when trying to view the page - how can I fix this?
.htaccess:
RewriteEngine On
AddHandler application/x-httpd-cgi .py
DirectoryIndex index.py
index.py:
#!/usr/bin/python
print "Content-type: text/html\n\n"
print "...
Hi,
I would like to remove border on a gtk.Button and also set its size fixed. How can I accomplish that?
My button looks like that:
b = gtk.Button()
b.set_relief(gtk.RELIEF_NONE)
Thanks!
p.d: I'm using pygtk
...
Hello,
I need a collection of objects which can be looked up by a certain (unique) attribute common to each of the objects. Right now I am using a dicitionary assigning the dictionary key to the attribute.
Here is an example of what I have now:
class Item():
def __init__(self, uniq_key, title=None):
self.key = uniq_key
...
If you install multiple versions of python (I currently have the default 2.5, installed 3.0.1 and now installed 2.6.2), it automatically puts stuff in /usr/local, and it also adjusts the path to include the /Library/Frameworks/Python/Versions/theVersion/bin, but whats the point of that when /usr/local is already on the PATH, and all inst...
Hello
I have this dictionary in my apps model file:
TYPE_DICT = (
("1", "Shopping list"),
("2", "Gift Wishlist"),
("3", "test list type"),
)
model, which uses this dict is this:
class List(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=200)
type = models.PositiveIntegerFi...
i am stuck at scope resolution in python.
let me explain a code first:
class serv_db:
def __init__(self, db):
self.db = db
self.dbc = self.db.cursor()
def menudisp (self):
print"Welcome to Tata Motors"
print"Please select one of the options to continue:"
print"1. Insert Car Info"
print"2. Display Car Info"
print"3. Update Car I...
Hey gang, I'm trying to convert a legacy php script over to python and not having much luck.
The intent of the script is to serve up a file while concealing it's origin. Here's what's working in php:
<?php
$filepath = "foo.mp3";
$filesize = filesize($filepath);
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control:...
Hi,
Please, how to convert an int (number a seconds) to these formats: mm:ss or hh:mm:ss ?
I need to do this with Python code (and if possible in a Django template ?).
Thank you very much ;-)
...