web technology

Archived Posts from this Category

11 Django gotchas

Posted by Jim DeLaHunt on 31 Aug 2010 | Tagged as: Python, Unicode, robobait, software engineering, web technology

This post has been a long time in the making. A year ago, I started work on my Twanguages code. This was code to analyse a corpus of Twitter messages, and try to discern patterns about language use, geography, and character encoding.  I decided to use the Django web framework and the Python language for the Twanguages analysis code.  I know Python, but I was learning Django for the first time.

Django is really, really marvellous.  When I tried this expression, and got the Python array of records I was expecting,

q2 = TwUser.objects.annotate(ntweets=Count('twstatus')).filter(ntweets__gt=1)

I wrote in my log, “I think I just fell in love. Power and concision in a tool, awesome.”

But Django gave me fits.  It has its share of quirks to trap the unwary novice. Eventually I began writing notes about “Django gotchas” in my log.  Some of them are Django being difficult, or inadequate. Some are me being a clueless novice, and Django not rescuing me from my folly. But all of them were obstacles.  I share them in the hopes of helping another Django novice.

Here are my Django gotchas.  They are ranked from the most distressing to most benign. They apply to Django 1.1, the current version at the time. (As of August 2010, the current version is 1.2.1.) A couple of gotchas were addressed by Django 1.2, so I moved them down to a section of their own. The rest presumably still apply to Django 1.2, but I haven’t gone back to check.

  1. API fails unhelpfully. I wrote a simple query expression like:
    S2 = models.TwStatus.objects.get( key )

    I got a lot of weird errors, e.g. “ValueError: too many values to unpack” (where key is string) and “TypeError: ‘long’ object is not iterable” (where key is long). I had made a mistake, of course; the call to get() should have a keyword argument of “id__exact” or the like, not a positional argument. The correct spelling is this:

    S2 = models.TwStatus.objects.get( id__exact=key )

    The gotcha is that Django’s .get() isn’t written defensively. It isn’t very robust to programmer errors. Instead of checking parameters and giving clear error messages, it lets bad parameters through, only to have them fail obscurely deep in the framework. If defensive programming of the Django API would slow it down too much in production, I’d love to have a debug mode I could invoke during development. Continue Reading »

How about an IMLIG (Internationalisation, Multilingual, Localisation Interest Group) for Vancouver?

Posted by Jim DeLaHunt on 27 Jun 2010 | Tagged as: Unicode, Vancouver, i18n, language, meetings and conferences, multilingual, web technology

There is a lot of international, multilingual, and multicultural activity in Vancouver. Also, there’s a thriving tech scene. But there’s no place for the people in the intersection of those two circles — those interested in and working on the internationalisation, localisation, and multilingual aspects of technology projects — to get together and share ideas. I think there ought to be.

And I’ll even propose a name: IMLIG1604, the I18n L10n M11l I6t G3p (Internationalisation, Localisation, and Multilingual Interest Group) for North America’s 604 area code. If you can decipher the title, you’re in the club!

Continue Reading »

“Getting in touch with your Joomla’s inner database”

Posted by Jim DeLaHunt on 30 Nov 2009 | Tagged as: Joomla, Vancouver, meetings and conferences, web technology

I’m giving another talk at the Vancouver Joomla User Group started up recently. This group started this summer, and is now attracting a steady level of participation. It’s great to see a Joomla! community developing. Here’s the coordinates:

Getting in touch with your Joomla’s inner database

Monday, 30. November 2009, 18:30-20:30h. At The Network Hub, 422 Richards Street, 3rd floor, Vancouver, BC V6B 2Z3. tel +1 604 767 8778.

A monthly meeting of the Vancouver Joomla User Group. Admission free. All people interested in learning more about the Joomla! content management system, and helping others learn more, are welcome.

Agenda

  • Introductions.
  • Featured topic: Getting in touch with your Joomla’s inner database, by Jim DeLaHunt.
  • Q&A.
  • Door prize drawing.
  • Networking.

Continue Reading »

How to make standalone Django documentation on Mac OS X 10.5 using MacPorts.

Posted by Jim DeLaHunt on 06 Aug 2009 | Tagged as: Python, robobait, software engineering, web technology

One of the many nice touches of the Django framework is that it provides tools and instructions to make a standalone Django documentation set from its distribution.  (Django is an application framework for the Python language that helps with database access and web application.)  Standalone docs are great for people like me who work on a laptop and are sometimes off the net. But I’m using Mac OS X, I get my code through Macports, and Django’s instructions don’t quite cover this case.  So I just figured it out.  Here’s the tricks I needed.  Maybe it will help you.

Continue Reading »

Twanguages: a Language Census of Twitter

Posted by Jim DeLaHunt on 30 Jul 2009 | Tagged as: Unicode, language, meetings and conferences, multilingual, web technology

What “twanguage” do you “tweet”?  Twitter, the buzzing conversation of brief web and SMS messsages, exploded into wide use in 2009. But just how wide?  To how many countries has it spread?  And into which languages?  I’m aiming to find out.

I’ve started a project named “Twanguages”, a language census of a sample of Twitter’s global traffic. I’m curious: which are the top languages? Are #hashtags localised? How does language correlate with location?  And which Unicode character is the most rarely used?

I’ll be  presenting our results at the 33rd Internationalization and Unicode Conference (IUC33), held in San Jose, California, on October 14-16, 2009. I have a place cleared for a Twanguages project page, and I’ll post interim results there as they become available (right now it’s only a placeholder). Stay tuned!

Continue Reading »

“International and multilingual Drupal and Joomla! sites” at LinuxFest Northwest

Posted by Jim DeLaHunt on 29 Apr 2009 | Tagged as: CMS, Joomla, drupal, i18n, meetings and conferences, multilingual, web technology

“International and multilingual Drupal and Joomla! sites” slide previewLast week I gave a presentation, International and multilingual Drupal and Joomla! sites. I’ve posted my slides and handouts at that link for anyone who wants to catch up on them.

The occasion was LinuxFest Northwest 2009, held at Bellingham Technical College in Bellingham, WA, USA. It was a delightful event. It’s thoroughly grassroots and volunteer, it has a friendly and accessible vibe, yet it attracts very knowledgeable people.

Continue Reading »

« Previous Page