Is there a possibility to create any python object that will be not sortable? So that will be an exception when trying to sort a list of that objects?
I created a very simple class, didn't define any comparison methods, but still instances of this class are comparable and thus sortable. Maybe, my class inherits comparison methods from so...
In our project we need to import the csv file to postgres.
There are multiple types of files meaning the length of the file changes as some files are with fewer columns and some with all of them.
We need a fast way to import this file to postgres. I want to use COPY FROM of the postgres since the speed requirement of the processing are ...
If I set a session in mydomain.com, it doesn't work on www.mydomain.com. I'd like all subdomains, and all www, to be treated as one big thing.
mydomain.com and all its subdomains should have all the session cookies of everything.
Do I change this in Apache2?
edit I think I found the solution: SESSION_COOKIE_DOMAIN = ".mydomain.com"
...
I have a Python list that I'm supplying to the template:
{'error_name':'Please enter a name',
'error_email':'Please enter an email'}
And would like to display:
<ul>
<li>Please enter a name</li>
<li>Please enter an email</li>
</ul>
...
In database I have saved string in which the problem word is: za\u0161\u010diten.
[ed.: the "problem word" seems to have changed]
When I want to present this string on my page (with req.write(string)). I get this error: UnicodeEncodeError: 'ascii' codec can't encode characters in position 686-687: ordinal not in range(128).
I am usin...
I'm finding django foreign keys a bit confusing, is there any way to do the view below, using a single query?
# Model
class Programme(models.Model):
name = models.CharField(max_length = 64)
class Actor(models.Model):
programme = models.ForeignKey(Programme)
name = models.CharField(max_length = 64)
# View
def list_actors(...
I'm trying to create a class that will allow me to add/multiply/divide objects of the same class together or add/multiply numeric arguments to each member of the class
So my class is for coordinates (I am aware there are great packages out there that do everything I want better than I could ever hope to on my own, but now I'm just curio...
I have followed the suggestion in this question
as I am using Django, I have set the script to store date and time of each run of the script in the db, but no entry has been stored yet in the database.
Is there a way to figure out, other than typing "top" and searching through?
...
I'm filtering a few categories (cat1, cat2, cat3) to be rendered by different views then all the rest by other view functions. It is getting unwieldy to keep adding category slugs to the urlpatterns each time one is added. Can I factor that part out of the regex some how?
urlpatterns = patterns('catalog.category_views',
(r'^(?P<ca...
What's the ideal way to pass a large JSON data object from Javascript through AJAX to a Python script?
...
I've come to grips with the fact that ElementTree isn't going to do what I want it to do. I've checked out the documentation for lxml, and it appears that it will serve my purposes. To get lxml, I need to get easy_install. So I downloaded it from here, and put it in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-pac...
I just discovered PyCharm, which is a Python/Django/web IDE currently in "public preview" being developed by JetBrains.
Has anyone been using it for the last month it has been available, and if so, what are your impressions of it compared to other IDEs that are available such as:
Komodo
Wing IDE
Eclipse + Pydev
Aptana
...
Are there alternatives to manually coding the JS and HTML?
Is there a Pylons-way to do this?
Sample code is appreciated.
...
I am trying to integrate a multivariable function in scipy over a 2d area.
What would be the equivalent of the following Mathematica code?
In[1]:= F[x_, y_] := Cos[x] + Cos[y]
In[2]:= Integrate[F[x, y], {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}]
Out[2]= 0
Looking at the scipy documentation I could only find support for one dimensional...
I'm developing a django website which for production uses mod_wsgi - there are barely any visitors so anytime I visit it seems mod wsgi starts up and opens the python processes - it takes about 1-2 entire minutes for it to fully load.
Is there anything I could do to not make it slow on initial startup? Is this a common problem or could ...
I'm just getting started with Google App Engine. Currently, my app has two pages: one lists all the inventory currently in stock, and the other is a detail page for a given item. I feel that my coding could be much more DRY. (I'm making all the calls to print headers and footers twice, for instance.)
Here is the code. How can I factor o...
I'm trying to do something pretty simple, but I'm new to Django. I have a quiz system set up for an experiment I'm running.
The relevant entries in models.py follow:
class Flavor(models.Model):
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class Passage(models.Model):
name = models.CharFie...
I have a simple form in python + pylons that submits to a controller. However, each page load doesn't seem to be a fresh instantiation of the class. Rather, class variables specified on the previous page load are still accessible.
What's going on here? And what's the solution?
...
The title pretty much says it all: If I am using the sparse.lil_matrix format, how can I remove a column from the matrix easily and efficiently?
Thanks!
...
I'd like to make it as general as possible - e.g. handle as many versions as possible.
Since version 3 is not backwards compatible with version 2, I want to make sure that I use the right print statement.
Please let me know if you have questions and feel free to share related knowledge having to do with dynamic logic based on what (e.g...