How can I create multiple hashes of a file using only one pass?
How can I get a MD5, SHA and other hashes from a file but only doing one pass? I have 100mb files, so I'd hate to process those 100MB files multiple times. ...
How can I get a MD5, SHA and other hashes from a file but only doing one pass? I have 100mb files, so I'd hate to process those 100MB files multiple times. ...
Hi I develop in Visual Studio 2008 a lot and would like to find an addin like vsphp which enables intellisense and debugging in Visual Studio. Is IronStudio what I am looking for? As far as I understand IronStudio is a Plugin for .NET. If there is no Plugin for Visual Studio 2008 whats a great IDE for a python newbee who loves Visual S...
In C++, I could do: for(int i = 0; i < str.length(); ++i) std::cout << str[i] << std::endl; How do I iterate over a string in Python? ...
I've been considering fast poker hand evaluation in Python. It occurred to me that one way to speed the process up would be to represent all the card faces and suits as prime numbers and multiply them together to represent the hands. To whit: class PokerCard: faces = '23456789TJQKA' suits = 'cdhs' facePrimes = [11, 13, 17, 1...
Hi, I'm a python newbie (2 weeks) and I'm having trouble formatting a datetime.timedelta object. Here's what I'm trying to do. I have a list of objects and one of the members of the class of the object is a timedelta object that shows the duration of an event. I would like to display that duration in the format of hours:minutes. I ha...
I have large data files stored in S3 that I need to analyze. Each batch consists of ~50 files, each of which can be analyzed independently. I'd like to setup parallel downloads of the S3 data into the EC2 instance, and setup triggers that start the analysis process on each file that downloads. Are there any libraries that handle an as...
Currently, I'm trying to get a method in Python to return a list of zero, one, or two strings to plug into a string formatter and then pass them to the string method. My code looks something like this: class PairEvaluator(HandEvaluator): def returnArbitrary(self): return ('ace', 'king') pe = PairEvaluator() cards = pe.returnArbit...
My application is running on App Engine and is implemented using Werkzeug and Jinja2. I'd like to have something functionally equivalent of Django's own context processor: a callable that takes a request and adds something to the template context. I already have a "context processors" that add something to the template context, but how d...
In Python on Windows, is there a way to determine if a user has permission to access a directory? I've taken a look at os.access but it gives false results. >>> os.access('C:\haveaccess', os.R_OK) False >>> os.access(r'C:\haveaccess', os.R_OK) True >>> os.access('C:\donthaveaccess', os.R_OK) False >>> os.access(r'C:\donthaveaccess', os...
Hi, I am trying to create a GUI in Jython. I want to import a background image that I can place buttons and textfields on. I've already created the frame with the buttons and labels in their appropriate places, I just need to know how to import a background image. The GUI is implemented in Jython. ...
Is there any way to connect to an MS SQL Server database with python on linux using Windows Domain Credentials? I can connect perfectly fine from my windows machine using Windows Credentials, but attempting to do the same from a linux python with pyodbs + freetds + unixodbc >>import pyodbc >>conn = pyodbc.connect("DRIVER={FreeTDS};SER...
Why do some languages, like C++ and Python, require the namespace of an object be specified even when no ambiguity exists? I understand that there are backdoors to this, like using namespace x in C++, or from x import * in Python. However, I can't understand the rationale behind not wanting the language to just "do the right thing" whe...
Not sure that the example (nor the actual usecase) qualifies as NP-Complete, but I'm wondering about the most Pythonic way to do the below assuming that this was the algorithm available. Say you have : class Person: def __init__(self): self.status='unknown' def set(self,value): if value: self.status='happy' else :...
As an exercise I am trying to create a custom django widget for a 24 hour clock. The widget will is a MultiWidget - a select box for each field. I am trying to follow docs online (kinda sparse) and looking at the Pro Django book, but I can't seem to figure it out. Am I on the right track? I can save my data from the form, but when I pre...
I'm working on a Django project that's slated to be using Satchmo for its e-commerce aspects. I'd like to install it on my Windows Vista machine but some of the cPython modules it needs can't be compiled or easy_installed. Has anyone been able to get Satchmo working on Windows, and if so, what additional steps does it take over the ins...
File "/usr/local/lib/python3.0/cgi.py", line 477, in __init__ self.read_urlencoded() File "/usr/local/lib/python3.0/cgi.py", line 577, in read_urlencoded self.strict_parsing): File "/usr/local/lib/python3.0/urllib/parse.py", line 377, in parse_qsl pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')] TypeError: T...
I have a C interface that looks like this (simplified): extern bool Operation(void ** ppData); extern float GetFieldValue(void* pData); extern void Cleanup(p); which is used as follows: void * p = NULL; float theAnswer = 0.0f; if (Operation(&p)) { theAnswer = GetFieldValue(p); Cleanup(p); } You'll note that Operation() alloca...
I have Pydev installed and running without problem with Python 2.6. I installed Pylons 0.9.7 RC 4 into virtual environment, then configured new interpreter to pint into virtual environment and this one is used for pylons project. My problem is that code auto completion does not work for a classes from base library (one that are installed...
Hi, I have a very simple piece of code (just for testing): import smtplib import time server = 'smtp.myprovider.com' recipients = ['[email protected]'] sender = '[email protected]' message = 'Subject: [PGS]: Results\n\nBlaBlaBla' session = smtplib.SMTP(server) session.sendmail(sender,recipients,message); This works but the prob...
I've gotten a hold of Python Imaging Library (PIL) and installed the PNG support stuff just fine. I am however having issues with theJPEG Library. The default setting for it is nothing but they suggest "/home/libraries/jpeg-6b". On the Mac that directory doesn't exist, the library is however installed fine, here's the output of the inst...