-
posts
-
UTF-8 with guile
Getting UTF-8 to work with guile is a bit of a stretch as guile doesn’t have any real encoding or UTF-8 support to speak of, but I was able to get at least some basic stuff working by using the Unicode Manipulation routines which are part of the Guile-Glib module. This requires that you have your LD_LIBRARY_PATH and GUILE_LOAD_PATH set properly so that it can load the glib libraries. This didn’t work for me out of the box with guile, but Ubuntu’s guile-gnome0-glib package provides a script called guile-gnome-0 for setting these values for you and running guile. If you...
-
Django Sitemap Framework
Using the Django sitemap framework is so easy it’s almost no work at all. Just make a sitemap object and add it to the sitemap in urls.py. The sitemap framework calls items() in your Sitemap to get the list of objects to put in the sitemap and then calls get_absolute_url() on each object. # models.py from django.db import models class Entry(models.Model): @permalink def get_absolute_url(self): return self.url # sitemap.py from django.contrib.sitemaps import Sitemap from mysite.blog.models import Entry from django.contrib.sitemaps import Sitemap from mysite.blog.models import Entry class BlogSitemap(Sitemap): priority = 0.5 def items(self): return Entry.objects.filter(is_draft=False) def lastmod(self, obj): return obj.pub_date # changefreq...
-
Django admin inline forms
For my new project dlife (Update: Now django-lifestream), I went about implementing a simple comments interface that would allow users to make comments on imported feed items. I wanted to support this in the admin in the typical manner such that when you click on an item in the admin, you can see all the comments and edit them from the item’s page. I found that you can use inline forms in the admin but it seems to show a bunch of forms (3 by default) even though I don’t have any comments for the item yet. I’ll mess with...
-
Feedparser and Django
Over the weekend at Python Onsen I worked on a lifestream web application using Django and feedparser. I was really impressed with how simple feedparser is to use and how easy it is to get unified results from atom or rss feeds. You simply import feedparser and call feedparser.parse to parse a feed from a url. # feeds.py def update_feeds(): feeds = Feed.objects.filter(feed_deleted=False) for feed in feeds: try: feed_items = feedparser.parse(feed.feed_url) for entry in feed_items['entries']: # ... You can check out feeds.py on Bitbucket. The interesting bit comes with how I had to parse the dates which sometimes include timezone...
-
Python Onsen Oct. 2008
Last weekend I went to my second Python Onsen organized by Nakai-san(id:voluntas). I talked about Python Onsen in my first blog post. Python Onsen is a 3 day event (Fri, Sat, Sun) but as before I only participated on Saturday and Sunday. This time I opted to work on creating a lifestream web app using feedparser and Django. feedparser is a snappy little parser for reading RSS and Atom feeds. The result was dlife which so far can parse a set of feeds and show them on a user’s lifestream though it’s not in any way user friendly yet (you...
-
Disqus Plugin
The first version of the Disqus plugin has been released!
The Disqus plugin allows you to use comments from the social commenting website
Disqus. It embeds javascript to show comments when viewing a particular blog
post and shows how many comments a post has when viewing a blog post list. Find
out more about what Disqus does on the Disqus
website. Read more about the plugin on the
disqus_plugin plugin
page.
Download: disqus_plugin-0.1.zip
-
Ok/Cancel buttons with jqModal
I recently quit using Google Web Toolkit and started using jQuery for a personal project of mine and I wanted to be able to show some modal dialog boxes using jQuery. As it turns out there is an easy to use plugin that does exactly this called jqModal. jqModal makes it simple to create modal dialogs by simply setting a css class on the tag you want to open the dialog and on the tag in the dialog that you want to close it. <a href="#" class="jqModal">view</a> ... <div class="jqmWindow" id="dialog"> <p>This is my dialog.</p> <a href="#" class="jqmClose">Close</a> </div> $().ready(function...
-
jsonschema 0.2 alpha
I just released a new version of jsonschema 0.2 alpha over at http://code.google.com/p/jsonschema The source can be downloaded here: jsonschema-0.2a.tar.gz The documentation can be found here: jsonschema (version 0.2a) documentation The new release includes the following notable changes. The additionalProperties attribute is now validated. Using schemas in the type attribute now works properly. Changed support for unique attribute to the “identity” attribute (Note: this is not a backwards compatible change) Fixed a bug where the original schema object/dictionary was modified by the validator Added a new “interactive mode” which will add default values to objects if not specified as read-only...
-
New Sweetcron Homepage
I just finished implementing Sweetcron on my homepage. It’s a pretty architecturally bare-bones but slick feed aggregator that makes a page containing all the most current information about you or what your are interested in. This page is called a “lifestream” and I liked the concept because I’m a busy person and I want to make publishing to my homepage easier so that it doesn’t become dusty and so I don’t have to create blog posts on anything and everything just to get a blurb on my homepage. It basically aggregates feeds and puts the entries in your lifestream. Your...
-
Twitter reply updates via e-mail
I just set up Plagger to send me e-mails to my cellphone and Gmail when there are updates to my replies rss feed on twitter. This took way longer than anticipated because of how long it took to install and configure Plagger properly. First installing it took a long time. I installed it via CPAN and Plagger has a huge number of dependencies. Many of the dependencies are not set properly so CPAN fails to install it more often than not. I had to force install the IO::Socket::SSL package because the tests failed. I didn’t need TLS for mail and...