Uncategorized 01 Jul 2007 10:35 am

Blog Moving

With great pleasure I announce that this blog will be moving to www.lethain.com.

The new blog is hosted on a home rolled Django solution I have been cooking up for the past several weeks. It is still a bit of a work in progress, but I have begun posting new material there.

The primary feed is http://www.lethain.com/feeds/all/ although you may wish to go to the site and click on the RSS section and choose one of the other RSS feeds more appropriate for you.

I hope everyone enjoys the new layout/functionality, and please give me any feedback or complaints about the new site. Like I said it is homebrewed and still slightly under development, but I’d say that is about 80% finished, and has about 90% of its functionality intact. You may notice that comments are missing… yep. Thats 9% of the 10% of missing functionality, they are currently under development and will be in relatively soon. I am trying to build a very spam hardened comment system, which is why they have been taking a bit longer than hoped.

There are already a couple of new articles there, so take a look. If everything craches… ha..haha… crap.

Internet & Programming 21 Jun 2007 09:33 am

Examining Web Analytics with the Intent to Implement

To use the internet is to become a number. Not only a number in the sense of being stripped of distinction and being treated (or mistreated) by the invisible hands of machinery, but we also become numbers in the sense of a tracking number–we are labeled, tracked, and inadvertently leave behind us copious amounts of data about ourselves. In an entry in the Google Operating System blog the author mentioned Google has 220 terabytes of information from their Google Analytics program. That is second in size only to the databases used by their search crawler, which has 850 TB of information. (Google Earth only uses 80.5 TB.) At the current rate of growth, the Analytics entry will overtake the web crawler in size–thats a whole lot of data about who has been doing what, and where they did it.

Okay, so thats pretty scary, what do we do about it? Well, we write our own analytics system, of course! Recently I have been building a web analytics kit for usage with Django, and early on it had a high potential–like most programming projects–for dying the death of a thousand little cuts. This article aims to look at the overall design of a web analytics system, and how one might be implemented. It will linger briefly on some particularly key details, but won’t attempt to implement a web analytics system in code.

(For those who are curious I will be brushing up my web analytics system for Django over the next several days, and will then be releasing it (with an open source license). I won’t discuss it further in this entry, but intend to write several entries on it (implementation/design, installation, usage, flaws) in the next several days.)


Continue Reading »

Tutorial & Django & Programming 14 Jun 2007 06:05 pm

Building a Django Middleware for Google Analytics

Part of the beauty of Django is that it was designed to maximize flexibility. As developers we have multiple places we can hook into Django, and these hooks allow access to most of Django’s moving parts. The first hook a Django developer is introduced to is the urls.py file where we map urls onto our applications.

The urls.py file is the fundamental Django hook, but sometimes Django’s second hook–the Middleware–can offer us real gains in simplicity. In this article, we will first look at how to use the GoogleAnalyticsMiddleware to inject calls to Google Analytics into your pages, and then we’ll take a step-by-step look at how it was built.

The source for the GoogleAnalyticsMiddleware is available here (it is under a Lesser GNU license).


Continue Reading »

Tutorial & Ajax & Django 12 Jun 2007 06:19 pm

Part 6: Other Resources and Wrapup

This is the sixth and final part of my tutorial on using Ajax in Django. This section is primarily a list of resources and links that may be helpful as you move foward and attempt increasingly complex fusings of our favorite two technologies.

Continue Reading »

Tutorial & Ajax & Django 12 Jun 2007 06:19 pm

Part 5: Django and Script.aculo.us: Visual Effects (Web2.0 Kitsch)

This is the fifth section of the Django and Ajax tutorial, and we’ll be looking at adding some simple animations to Django webpages. These animations don’t strictly interact with Django, but they can add some spice to your Django website, and any introduction to Script.aculo.us would be incomplete without at least a brief introduction to its animations library.


Continue Reading »

Tutorial & Ajax & Django 12 Jun 2007 06:18 pm

Part 4: Django and Script.aculo.us: Sortables (Drag and Drop)

Now that we have seen the raw power of Prototype, we’re going to move on to some features that are a bit more flashy, courtesy of the Script.aculo.us library. In this segment we are going to use Sortables to create a drag-and-drop list of html elements. Each of those elements will correspond to an instance of a Django Model, and we’ll see how we can use drag-and-drop to change the order of our elements–and have Django keep track of those changes. You can get the source for this example here.


Continue Reading »

Tutorial & Ajax & Django 12 Jun 2007 06:17 pm

Part 3: Django and Prototype: Ajax Request (Sending Data Out Of Band)

Another frequent use of Ajax is to send data to your server without forcing your user to reload the entire page they are on. In this third segment of the Django and Ajax tutorial we are going to use the content from a form generated in Django directly to the server. (Request differs from Updater in that Request does not expect a response from the server. A more thorough explanation is below.) You can get the source code for this example here.
Continue Reading »

Tutorial & Ajax & Django 12 Jun 2007 06:17 pm

Part 2: Django and Prototype: Ajax Updater (Dynamically Updating Content)

One of the common uses of Ajax is to update a portion of your website without having to reload the entire page. This is most easily done via the Ajax.Updater() class, which is part of the Prototype package. You can grab the finished source code for this example here.
Continue Reading »

Tutorial & Ajax & Django 12 Jun 2007 06:16 pm

Part 1: Django and Ajax: Introduction and Setup

Recently I began adding Ajax to a site I am developing in Django, and it was a bit of a rough start. The documentation available on the topic is close to non-existent. Here is my humble attempt to rectify the current paucity.

This article is the first in a six part series that will walk through using Ajax and Django together to create dynamic websites.


Continue Reading »

R & Python & Programming 08 Jun 2007 07:10 pm

Creating Graphs Programmatically with Python, R, and RPy

When I bought my MacBook I was feeling pretty good about myself. 1 gig of RAM? Lets make it two. Should I get the white one? Nah, black is totally the future. Microsoft Office? Hell no, Pages and Keynote will take its place… WHAT?

Okay, so I made a mistake. I figured that I could replace the Office Suite with Apple’s much smaller iWork suite (Pages and Keynote). For the most part it has worked out well; Keynote and Pages are both great programs that work how you’d expect them to (minor exceptions aside). The one lump of functionality I can’t begin to replicate is the statistics, graphing, and spreadsheet capabilities of Excel.

My first reaction was to search out a nice OS X equivalent and call it a day. Unfortunately one of the very first search results was this absolute panning of OS X spreadsheets (the full title of that article is: Mac OS X Spreadsheet Roundup: A Few Excel, The Rest Should Be Shot). I enjoyed reading the article… until I finished it and realized that my quest for an OS X spreadsheet was completely hosed.


Continue Reading »

Next Page »