Surely there must be a way to do this... I can't work it out.
I have a (9,4) array, and I want to repeat it along a 3rd axis 4096 times... So it becomes simply (9,4,4096), with each value from the 9,4 array simply repeated 4096 times down the new axis.
If my dubious 3D diagram makes sense (the diagonal is a z-axis)
4| /off to 4096
3...
I'm new to both Python and Google App Engine development and find myself at a loss on how to effectively debug my apps during development. I come from a C#/ASP.NET background where I can typically step through the code in Visual Studio. However, when using a text editor and running dev_appserver.py from a command line, I don't have the...
I want to allow users to create tiny templates that I then render in Django with a predefined context. I am assuming the Django rendering is safe (I asked a question about this before), but there is still the risk of cross-site-scripting, and I'd like to prevent this. One of the main requirements of these templates is that the user shoul...
I'm a newbie and i need to know how to modify a password guessing program to keep track of how many times the user has entered the password wrong. If it has been entered more than 3 times then it should print " This seems to be complicated" and the program should be ended.
The password guessing program is
password="abcd"
while password ...
I'm running an assertEqual test case for a list of methods in a particular class. These methods are expanded from string form to something callable using getattr().
How can I get unittest to tell me the particular method which failed? Meaning: how can I get unittest to print to stdout the particular parameters which caused the failure o...
Is there any way to monitor /proc files, such as
/proc/acpi/battery/BAT0/state
/proc/acpi/ac_adapter/ADP0/state
in a non-polling fashion, similar to inotify on a normal filesystem?
I want to do this in a PyGTK app, so I tried using PyGObject's gio.FileMonitor, but no dice. A Python solution that plays well with gtk.main() would be id...
I am trying to construct a general tree. Are there any built in data structures in Python to implement a tree?
...
I'd like to enable users to leave rich text comments, possibly using markdown. I've installed the libraries used on Reddit, but am concerned about the javascript injection attack which occurred last year, especially since I'm still not clear on the details of how the attack was done. Should I still be concerned about comment security? Is...
I'm using the Django manage.py runserver for developing my application (obviously), but it takes 10 seconds to completely load a page because the development server is very, very slow at serving static media.
Is there any way to speed it up or some kind of workaround? I'm using Windows 7.
...
I'd like to calculate a MAX() value for a column. What's the proper way to do this in sqlalchemy while preserving database independence?
...
I'm looking to get my hands dirty with PyGTK and was wondering if anyone can recommend any relatively simple, really cleanly written PyGTK apps that I can look to for best practices or examples? Any type of app will do, as long as it's simple-ish (i.e., please don't recommend a huge app) and generally considered to be well written.
The ...
From an ipy console I can
import ironclad
import numpy
with no problem.
However when I try the same imports with an embedded interpreter the numpy import fails. My Python engines is set up like this:
public PyEngine()
{
//Frames option needed to use sys.__getframe
//used in Numpy and others.
Dictiona...
SQLAlchemy seems really heavyweight if all I use is MySQL.
Why are convincing reasons for/against the use of SQLAlchemy in an application that only uses MySQL.
...
I'm looking to speed along my discovery process here quite a bit, as this is my first venture into the world of lexical analysis. Maybe this is even the wrong path. First, I'll describe my problem:
I've got very large properties files (in the order of 1,000 properties), which when distilled, are really just about 15 important properties...
I wish to export from multiple nodes log files (in my case apache access and error logs) and aggregate that data in batch, as a scheduled job. I have seen multiple solutions that work with streaming data (i.e think scribe). I would like a tool that gives me the flexibility to define the destination. This requirement comes from the fa...
I know that shutdown -a will abort a Windows shutdown, but I need to know if there is anything any where I can check for to see if a shutdown is in progress.
Ideally, I'd like a small program like this:
import os
while True:
shuttingDown = <shutdown variable to check>
if shuttingDown:
os.system("shutdown.exe -a")
...
I'm trying to use python + ffmpeg + oggenc to convert any audiofile to ogg. The program works, almost. But for big files (i think > ~6mb) the ffmpeg process starts to sleep at pipe_wait. I don't know which pipe it waits for.
If I kill the ffmpeg process, the oggenc process continues and I get a resulting ogg-file with about ~2:40 of all...
When an exception occurs in Python, can you inspect the stack? Can you determine its depth? I've looked at the traceback module, but I can't figure out how to use it.
My goal is to catch any exceptions that occur during the parsing of an eval expression, without catching exceptions thrown by any functions it may have called. Don't be...
How does one use multiprocessing to tackle embarrassingly parallel problems?
Embarassingly parallel problems typically consist of three basic parts:
Read input data (from a file, database, tcp connection, etc.).
Run calculations on the input data, where each calculation is independent of any other calculation.
Write results of calcula...
What are the pros and cons of using open id vs auth? Shoud I do both?
...