Looking around for a noSQL database implementation that has an ORM syntax (pref. like Django's), lets me store and retrieve nested dictionary attributes but written entirely in Python to ease deployment and avoids Javascript syntax for map/reduce. Even better if it has a context-aware (menus), python-based console, as well as being able ...
I really love the way the StackExchange family of sites allow someone to log in using their OpenID or OAuth provider, which has been open-sourced as DotNetOpenAuth. This is absolutely wonderful, but I am unable to use it on a *AMP stack.
Is there anything analogous that runs in PHP, Perl, Python or Ruby?
...
All discussion is about python 3.1.2; see Python docs for the source of my question.
I know what zip does; I just don't understand why it can be implemented like this:
def zip(*iterables):
# zip('ABCD', 'xy') --> Ax By
iterables = map(iter, iterables)
while iterables:
yield tuple(map(next, iterables))
Let's say I ...
I've been looking around and trying to find a way to click on a link in selenium that's matched by a regexp.
Here is the code that works;
from selenium import selenium
sel = selenium("localhost", 4444, "*chrome", "http://www.ncbi.nlm.nih.gov/")
sel.start()
sel.open('/pubmed')
sel.type("search_term", "20032207[uid]")
sel.click("search")...
I'm using Python and SQLAlchemy to query a SQLite FTS3 (full-text) store and I would like to prevent my users from using the - as an operator. How should I escape the - so users can search for a term containing the - (enabled by changing the default tokenizer) instead of it signifying "does not contain the term following the -"?
...
Hi,
I was wondering how can I make python order my collection of tuples so that first similar items would appear grouped and groups ordered by first item.
order group
3 1
4 2
2 2
1 1
After sort
order group
1 1
3 1
2 2
4 2
Python list
unordered = [(3, 1), (4, 2), (2, 2), (1, 1)]
...
Can I have a translation of PHP’s preg_match_all('/(https?:\/\/\S+)/', $text, $links) in Python, please? (ie) I need to get the links present in the plain text argument in an array.
...
Here is a Python postfix notation interpreter which utilizes a stack to evaluate the expressions. Is it possible to make this function more efficient and accurate?
#!/usr/bin/env python
import operator
import doctest
class Stack:
"""A stack is a collection, meaning that it is a data structure that
contains multiple el...
Hello,
I'm writing a Django app requesting permission to post on facebook.
I can access authorization and callback, but I can't get the parameter 'code' that facebook needs to continue with oauth.
def connect_fb(request):
return redirect("https://graph.facebook.com/oauth/authorize?"
+"client_id=MY_ID&"
+...
I have a database with 4 tables with this structure:
categories
subcategories
dates
events
We have events, that can have multiple dates. Events are categorized in categories and subcategories, but can have only a category and no subcategory, too.
I tried this query:
SELECT
t.id as sortid,
t.numprint,
s.titel,
s.int...
Has anyone comes across a SQL templating engine which allows one to mix SQL with a dynamic language like Ruby or Python?
I'm looking for something similar to Ruby erb templates. For example, in Ruby on Rails you can have various templates for a view:
customers.html.erb (html + ruby)
customers.js.erb (javascript + ruby)
Though I want s...
I'd like to plot a normalized histogram from a vector using matplotlib. I tried the following:
plt.hist(myarray, normed=True)
as well as:
plt.hist(myarray, normed=1)
but neither option produces a y-axis from [0, 1] such that the bar heights of the histogram sum to 1. I'd like to produce such a histogram -- how can I do it?
thanks...
hi all,
im attempting to do the django tutorial from the django website, and ive run into a bit of an issue: ive got to adding my __unicode__ methods to my models classes, but when ever i try to return the objects of that model i get the following error:
in __unicode__
return self.question()
TypeError: 'unicode' object is not call...
Hello,
I'm trying to restore the current working database to the data stored in a .sql file from within Django. Whats the best way to do this? Does django have an good way to do this or do I need to grab the connection string from the settings.py file and send command line mysql commands to do this?
Thanks for your help.
...
I need to convert strings with valid python syntax such as:
'1+2**(x+y)'
and get the equivalent LaTeX:
$1+2^{x+y}$
I have tried sympy's latex function but it processes actual expression, rather than the string form of it:
>>> latex(1+2**(x+y))
'$1 + 2^{x + y}$'
>>> latex('1+2**(x+y)')
'$1+2**(x+y)$'
but to even do this, it requ...
Hi folks,
I'm stuck for a full afternoon now trying to get python to build in 32bit mode. I run a 64bit Linux machine with openSUSE 11.3, I have the necessary -devel and -32bit packages installed to build applications in 32bit mode.
The problem with the python build seems to be not in the make run itself, but in the afterwards run of s...
Questions Update: Why there is no In[1]: prompt?
Please see the following output of IPython command line in Emacs.
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and ove...
Hi,
I have several long lists in python and have compare them and find the lists that are equal to each other except the last elements in the them.
Which is the fastest way?
...
How can I access my request.params post data from my Mako template with Pylons?
...
Can a descriptor auto-detect the name of an object passed to it?
class MyDecorator( object ):
def __init__(self, wrapped):
# Detect that wrapped's name is 'some_attr' here
pass
class SomeClass( object ):
some_attr = dict()
wrapper = MyDecorator( some_attr )
...