Tuesday, January 31, 2012

ANN: Django Better Cache 0.5.1 with expanded docs


I've made a small incremental release on Django Better Cache, adding a from_miss() method to handle cache misses in CacheModel objects. Now, you can define your cache model and how it initializes data when the cache is empty, and perform all your lookups through the CacheModel, expecting misses to auto-populate for you.

You can see a quick example of the new functionality below, but I have also made large improvements to the documentation hosted over at ReadTheDocs, so go read the full docs right now, if you are interested.

from bettercache.objects import CacheModel
from django.contrib import auth

class User(CacheModel):
    username = Key()
    email = Field()
    full_name = Field()

    def from_miss(self, username):
        user = auth.models.User.objects.get(username=username)
        self.email = user.email
        self.full_name = user.get_full_name()


If this get() does not find the object in the cache, it will create a new
User instance and call from_miss() with the key parameter username to
initialize it, and then save and return that object for you. The next call,
it will find it in the cache.

user = User.get(username="bob")

Sunday, January 29, 2012

ANN: straight.plugin 1.3 released - with docs!


I think it is worth a new release to announce that I have documented straight.plugin and published the docs to ReadTheDocs. I hope this will help anyone who has had trouble parsing my terse README file, and will improve adoption of the project in the future.

Check out the new code and the new docs.

Thursday, January 26, 2012

A little trick for wide pages

We have wide monitors and our reading doesn't tend to like wide text very well. This is why newspapers have lots of narrow columns, rather than stretch each story across the entire width of the paper.


Not all websites follow this tip, so drag this to your bookmark toolbar and squeeze the margin in 100px at a time, until you can read more naturally.




Yes, I could resize my window, but the same width isn't right for all pages, and most are padded or have sidebars. This is good when you only need some of the pages you have open to be narrower than the rest.

Sunday, January 22, 2012

ANN: Django Better Cache 0.5 Released

I am announcing the release of Django Better Cache 0.5 today. This release includes a move to sphinx as a documentation tool and a new component, the bettercache.objects module, which provides a lite ORM-like interface for caching data.

Please read the full, but short documentation over at Read The Docs for details on the bettercache {% cache %} tag and the bettercache.objects ORM, and have a much easier time with your caching needs.


Here is just a quick example of the new cache models, from the docs:


class User(CacheModel):
    username = Key()
    email = Field()
    full_name = Field()

user = User(
    username = 'bob',
    email = 'bob@hotmail.com',
    full_name = 'Bob T Fredrick',
)
user.save()

...

user = User.get(username='bob')
user.email == 'bob@hotmail.com'
user.full_name == 'Bob T Fredrick'
 

Tuesday, January 17, 2012

Leaving Google AppEngine

Calvin Spealman
I can use AWS and work on technological engineering issues, or appengine and work on price-ological engineering issues. :-/


Maybe I should take myself seriously when I said this. In the past few months, I've barely done any feature or bug work on JournaApp, because it takes my limited time and energy just keeping myself under quota when I'm the only user of the app. I can't keep that up and keep my sanity, and it is honestly an emotionally draining exercise. This is creating a toxin that affects everything I do, so I'm going to take it out of my life.

I don't know if I'll port JournalApp or not. I like it, it has been fun and useful, but I'll probably take project notes in Evernote from here on forward, and on paper again. I miss paper.
I write here about programming, how to program better, things I think are neat and are related to programming. I might write other things at my personal website.

I am happily employed by the excellent Caktus Group, located in beautiful and friendly Carrboro, NC, where I work with Python, Django, and Javascript.

Blog Archive