Goal: simple browser app, for navigating files on a web server, in a tree view.
Background: Building a web site as a learning experience, w/ Apache, mod_python, Python code. (No mod_wsgi yet.)
What tools should I learn to write the browser tree? I see JavaScript, Ajax, neither of which I know. Learn them? Grab a JS example from t...
I'm trying to use the password reset setup that comes with Django, but the documentation is not very good for it. I'm using Django 1.0 and I keep getting this error:
Caught an exception while rendering: Reverse for 'mysite.django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments ...
in my urlconf I ...
I am trying to solve a problem involving printing the product of all divisors of a given number. The number of test cases is a number 1 <= t <= 300000 , and the number itself can range from 1 <= n <= 500000
I wrote the following code, but it always exceeds the time limit of 2 seconds. Are there any ways to speed up the code ?
from math...
Hi,
I am trying to write a Python function which returns the same moon phase value as in the game NetHack. This is found in hacklib.c.
I have tried to simply copy the corresponding function from the NetHack code but I don't believe I am getting the correct results.
The function which I have written is phase_of_the_moon().
The functio...
Hello everyone,
Using Python, I'd like to compare every possible pair in a list.
Suppose I have
my_list = [1,2,3,4]
I'd like to do an operation (let's call it foo) on every combination of 2 elements from the list.
The final result should be the same as
foo(1,1)
foo(1,2)
...
foo(4,3)
foo(4,4)
My first thought was to iterate twice...
The Development version of Django has aggregate functions like Avg, Count, Max, Min, StdDev, Sum, and Variance (link text). Is there a reason Median is missing from the list?
Implementing one seems like it would be easy. Am I missing something? How much are the aggregate functions doing behind the scenes?
...
Apart from the books available from Kitware, I am looking for some links to any resources that could help in learning the VTK library. Preferably, with example code and tutorials. Google results have not been terribly informative for me. So I am asking here for links to VTK resources.
...
How do I change the mouse cursor to indicate a waiting state using Python and PythonCard?
I didn't see anything in the documentation.
...
How much of a difference are these two as far as performance?
tmp = []
tmp.append(True)
print tmp[0]
And
tmp = {}
tmp[0] = True
print tmp[0]
...
This question has been retitled/retagged so that others may more easily find the solution to this problem.
I am in the process of trying to migrate a project from the Django development server to a Apache/mod-wsgi environment. If you had asked me yesterday I would have said the transition was going very smoothly. My site is up, acce...
I'm starting Django development, and I can either install it from the .deb using
$ apt-get install python-django
on my Ubuntu machine, or I can download the .tar.gz from djangoproject.com, and start with that.
What are the benefits and drawbacks of each approach?
...
I want to get only function prototypes like
int my_func(char, int, float)
void my_func1(void)
my_func2()
from C files using regex and python.
Here is my regex format: ".*\(.*|[\r\n]\)\n"
...
os.path.getmtime() and os.stat() seem to return values in whole seconds only.
Is this the greatest resolution possible on either a Windows or OSX file system, or is there a way of getting greater resolution on file times?
...
I have code that does some very CPU-intensive string manipulations and I was looking for ways to improve performance.
(EDIT: I'm doing stuff like finding longest common substring, running lots of regular expressions which might be better expressed as state machines in c, stripping comments from HTML, stuff like that.)
I am currently lo...
For Visual Studio 6.0, I can connect to a running instance like:
o = GetActiveObject("MSDev.Application")
What prog ID do I use for Visual Studio 2003?
How do I execute a 'Build Solution' once I have the COM object that references the VS2003 instance?
How do I get the string contents of the build output window after executing the bui...
Hello
I have a program that records audio from firewire device (FA-66) with Jack connection. The interface is created with pygtk and the recording with py-jack (http://sourceforge.net/projects/py-jack/). The recording is done in a different thread because the GUI must be used at the same time for viewing results from the audio.
The pro...
Is there a method that I can add to my module, which will get called when destructing the class?
Update: We have a simple class which has only static member functions and needs to clean up the database connection when unloading the module. was hoping there would be a __del__ method either for modules or classes that don't have instances...
Is it possible to copy spreadsheets with gdata API or worksheets from one spreadsheet to other? For now i copy all cells from one worksheet to another. One cell per request. It is too slow. I read about "cell batch processing" and write this code:
src_key = 'rFQqEnFWuR6qoU2HEfdVuTw'; dst_key = 'rPCVJ80MHt7K2EVlXNqytLQ'
sheetcl = gdat...
I've got a daemon.py with a callback. How should I make the handler function execute a OS command?
...
Hi
I need a simple function to create a path in Python where the parent may or may not exist.
From python documentation os.makedirs will fail if one of the parents exists.
I have written the below method as which works by makes as many sub directories as necessary.
Does this look efficient?
def create_path(path):
import os.path...