How you play the larger game. Keeping up a stead rate of income, expansions, proper buildings & upgrades.
How skillfully you can manage a single (or small) group of units, typically in avoiding damage/death.
| # Before. | |
| from tastypie import fields | |
| from tastypie.resources import ModelResource | |
| from myapp.models import Entry, Tag | |
| # First, the standard setup that's causing the error. | |
| class TagResource(ModelResource): | |
| entries = fields.ToManyField('myapp.api.resources.EntryResource', full=True) |
| # search_indexes.py | |
| from haystack import indexes | |
| from myapp.models import TheModel | |
| class TheModelSearchIndex(indexes.SearchIndex, indexes.Indexable): | |
| # The usual fields. | |
| # Then... | |
| sites = indexes.MultiValueField() |
| 7000003 function calls in 6.629 seconds | |
| Ordered by: standard name | |
| ncalls tottime percall cumtime percall filename:lineno(function) | |
| 1 3.487 3.487 6.629 6.629 string_microbench.py:1(<module>) | |
| 1000000 0.501 0.000 0.501 0.000 string_microbench.py:1(printf_style) | |
| 1000000 0.291 0.000 0.478 0.000 string_microbench.py:13(join_style) | |
| 1000000 0.419 0.000 0.998 0.000 string_microbench.py:5(format_style) | |
| 1000000 0.700 0.000 0.700 0.000 string_microbench.py:9(addition_style) |
| from django.utils import simplejson | |
| from haystack.query import SearchQuerySet | |
| def autocomplete(request): | |
| query = request.GET.get('q', '') | |
| results = SearchQuerySet().autocomplete(query) | |
| serialized = simplejson.dumps([res.title for res in results[:10]]) | |
| return serialized |
| In [9]: from basic.api.resources import NoteResource | |
| In [10]: NoteResource.Meta.filtering | |
| Out[10]: {'title': 1} |
With apologies to Gruber... http://www.flickr.com/photos/nasahqphoto/7088014787/
"Space shuttle Discovery, mounted atop a NASA 747 Shuttle Carrier Aircraft (SCA), flies over the Washington skyline as seen from a NASA T-38 aircraft, Tuesday, April 17, 2012. "
In celebration of abandoning our space program, we paraded our ailing 30-year old technology over the heads of warmongering lawmakers today.
"Discovery, the first orbiter retired from NASA’s shuttle fleet, ..."
A shuttle-sized walker was too expensive, especially after we bailed out all those banks.
| class CommonMeta: | |
| authentication = BasicAuthentication() | |
| authorization = DjangoAuthorization() | |
| class MyResource(ModelResource): | |
| class Meta(CommonMeta): | |
| queryset = User.objects.all() | |
| resource_name = 'auth/user' | |
| excludes = ['email', 'password', 'is_superuser'] |
| -- Base64-encoding | |
| -- Sourced from http://en.wikipedia.org/wiki/Base64 | |
| -- BSD licensed | |
| require('math') | |
| local index_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' | |