I'm having a tough time getting the logging on Appengine working. the statement
import logging
is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an Eclipse issue, so I tried calling
logging.debug("My debug statement")
which does not print anything out on the dev_appserver. I haven't...
I have a DNA file in the following format:
>gi|5524211|gb|AAD44166.1| cytochrome
ACCAGAGCGGCACAGCAGCGACATCAGCACTAGCACTAGCATCAGCATCAGCATCAGC
CTACATCATCACAGCAGCATCAGCATCGACATCAGCATCAGCATCAGCATCGACGACT
ACACCCCCCCCGGTGTGTGTGGGGGGTTAAAAATGATGAGTGATGAGTGAGTTGTGTG
CTACATCATCACAGCAGCATCAGCATCGACATCAGCATCAGCATCAGCATCGACGACT
TTCTATCATCATTCGGCGGGG...
Here's what I have, but it seems kind of redundant. Maybe someone more experienced in Python knows of a way to clean this up? Should be pretty self explanatory what it does.
def complementary_strand(self, strand):
''' Takes a DNA strand string and finds its opposite base pair match. '''
strand = strand.upper()
...
I am editing PROSS.py to work with .cif files for protein structures. Inside the existing PROSS.py, there is the following functions (I believe that's the correct name if it's not associated with any class?), just existing within the .py file:
...
def unpack_pdb_line(line, ATOF=_atof, ATOI=_atoi, STRIP=string.strip):
...
...
def read_pd...
I need to take a string, and shorten it to 140 characters.
Currently I am doing:
if len(tweet) > 140:
tweet = re.sub(r"\s+", " ", tweet) #normalize space
footer = "… " + utils.shorten_urls(post['url'])
avail = 140 - len(footer)
words = tweet.split()
result = ""
for word in words:
word += " "
if l...
What is the minimum configuration to do some Python and iPhone development on Mac ?
Platform wise: Mac Mini, Mac Pro, Mac Book, Mac Book Pro ?
Memory requirement
CPU speed
Thanks for your advice.
Laurent
...
In short I'm creating a socket server so I can add multiplayer support to my Flash game (Using Actionscript 3.0 Binary Socket on the Client-End).
I decided to go with Python since I'm the sole developer of the game/server and this will be my first non-blocking socket server. I was going to use Twisted but I deiced that I would use Pyth...
I have a simple problem. I have to fetch a url (about once a minute), check if there is any new content, and if there is, post it to another url.
I have a working system with a cronjob every minute that basically:
for link in models.Link.objects.filter(enabled=True).select_related():
# do it in two phases in case there is cross pol...
I want to make a wiki, and i must assign for each url a view. Each url can contain letters (A-Z, a-z), digits and punctuation ('.', ',', '/', '-', '_'). How can i make the expression ?
I want something like this :
(r'^(?P<wiki_page>\w+)/$', 'www.wiki.views.page')
but this works only for letters, digits and '_'.
...
At http://norvig.com/sudoku.html, there's an essay describing a Python program to solve sudoku puzzles, even the hardest ones, by combining deterministic logical operations and smart traversal of the possible solutions. The latter is done recursively; here's the function (from http://norvig.com/sudo.py):
def search(values):
"Using ...
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest I accomplish this (...
I am translating some python code to Matlab, and want to figure out what the best way to translate the python tuple unpacking to Matlab is.
For the purposes of this example, a Body is a class whose constructor takes as input two functionals.
I have the following python code:
X1 = lambda t: cos(t)
Y1 = lambda t: sin(t)
X2 = lambda t: ...
If it is environment-independent, what is the theoretical maximum number of characters in a python string?
Also if it differs with version number I'd like to know it for python 2.5.2
...
In Python, once I have imported a module X in an interpreter session using import X, and the module changes on the outside, I can reload the module with reload(X). The changes then become available in my interpreter session.
I am wondering if this also possible when I import a component Y from module X using from X import Y.
The statem...
Does the Google Eclipse Plugin work at all with Pydev or is it only useful if I am developing in Java?
...
class MyObject(Entity):
name = Field(Unicode(256), default=u'default name', nullable=False)
using_options(shortnames=True)
using_mapper_options(save_on_init=False)
def __init__(self):
self.name = None
I am using MySQL in this case, but have also checked against SQLite and I get the same result. It respects nul...
I have a data model from my database. This is a flat python list sorted by left values.
> id name left right
> 1 Beginning 1 6
> 2 FOO 2 5
> 3 BAR 3 4
> 4 Programming 6 13
> 5 Python 7 8
> 7 C# 9 12
> 8 XNA 10 11
> 6 About 14 15
I would like to compute this into a hierarchical python list,...
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with...
Where can I find the document and examples of PythonMagick?
I did a search on Google but no much information was found.
...
I'm trying to set up Trac on my server and have successfully installed it, compiled the bytecode and run the tracd server. The only problem is that it's not reading my SVN repository.
The error I'm receiving is:
Warning: Can't synchronize with the repository (Couldn't open Subversion repository /data1/repos: SubversionException: ("E...