Apr 3 2012

Dear Netflix…

Oh Netflix, I am so conflicted about you.

Your online streaming is really convenient.  I love being able to watch series from beginning to end.  And it is reasonably priced for me.

Sometimes your streaming selection could be better.  (Not to be confused with Netflix red™.)

Your DVD service helps to fill many of those streaming gaps.

But your DVD service is overpriced.

Your dashboard is well designed.  I love the interface.  

Your queue management is horrible.  Why when I’ve watched something does its status in my queue seem pretty much unchanged?

Your suggested content is great.

You need to handle your browser support better.  It is ridiculous that the Firefox 11 update breaks your instant streaming and requires me to install an add-on that spoofs the Firefox 10 user agent string (User Agent Switcher for those having the same issue).  AND your browser compatibility information is incorrect as it lists “Firefox 3 or higher”, when clearly it should say “Firefox 3-10” given your browser support mechanism. Here is my Firefox 10 user agent string

“Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0”

and here is my Firefox 11 user agent string

“Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0”.  

You are seriously telling me that you can’t programmatically support that update?  *I* can support that programmatically.  Even if you can’t, you weren’t paying attention to when the Firefox 11 update was released so that you could manually update your allowed user agent list?  After Internet Explorer, Firefox has the 2nd largest share of the browser market.  Why wouldn’t you stay on top of supporting that?  And by supporting I mean simply updating your list of allowed user agents.  You could complete that code change in less time than it would take to create the ticket to track the issue.

You have THE BEST server error experience that I have ever seen (and fortunately for you, I have only seen it once – good thing I’m quick with my Print Screen key). *Brilliant* idea to provide a 100 or so streaming selections that so users could still watch something.

So that’s about 5 greens and 4 reds… I guess I’m sticking with you for now.  Please do something about your User Agent support.  That is probably the most annoying issue.  When I want to kick back and watch something to relax and forget about your other foibles, that browser support issue is REALLY (and ironically) frustrating.  FYI, here is the RapidRelease calendar for Firefox.  Please study it.  New releases about every 6 weeks.  That’s a lot of recurring opportunity to lose otherwise [very? mostly? somewhat?] happy customers.

Well, I’m off to find that Arthur and the Invisibles DVD that we’ve had sitting around since October 26th and still haven’t watched (no lie, and don’t laugh).

Sincerely,

Another (happy?) customer


Mar 1 2012

How to add a UUID field in Django using Django Extensions and how to make it a read-only admin field

I’m using Django Extensions which is a great collection of extensions and utilities for the Django framework.  For a project I’m using it to generate and store UUID fields in several models.  I found an easy way to add that UUID field to my admin as read-only.

A sample model using Django Extensions’ UUID field (I chose to use a version 4 UUID):

 Python |  copy code |? 
1
from django.db import models
2
 
3
from django_extensions.db.fields import UUIDField
4
 
5
class SomeClass(models.Model):
6
    uuid = UUIDField(version=4)
7
    # ...other fields...

Sample admin.py class to show UUID as a read-only field:

 Python |  copy code |? 
1
from myapp.models import SomeClass
2
 
3
from django.contrib import admin
4
 
5
class SomeClassAdmin(admin.ModelAdmin):
6
    readonly_fields = ('uuid',)
7
 
8
admin.site.register(SomeClass, SomeClassAdmin)

That’s it!  Very easy to implement a UUID and make it visible as read-only in the Django admin.  Note that you need at least Django 1.2. More here.


Feb 17 2012

A better way to set your Django template directory setting — dynamically

When using Django you must specify where the framework can find your templates by setting the TEMPLATE_DIRS setting in settings.py.  Typically I just set it to a static path, but recently came across a great tip about how to set it dynamically (thanks to The Definitive Guide to Django).

In settings.py, I would usually specify something like this:

 Python |  copy code |? 
1
TEMPLATE_DIRS = (
2
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
3
    # Always use forward slashes, even on Windows.
4
    # Don't forget to use absolute paths, not relative paths.
5
    "C:/MyDjango/myproject/mytemplates"
6
)

But there is a much better way to specific this such that it is dynamic:

 Python |  copy code |? 
1
import os.path
2
 
3
TEMPLATE_DIRS = (
4
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
5
    # Always use forward slashes, even on Windows.
6
    # Don't forget to use absolute paths, not relative paths.
7
    os.path.join(os.path.dirname(__file__), 'mytemplates').replace('\\','/'),
8
)

This solution uses os.path.dirname(__file__), which gets the name of the directory that the current file resides in using __file__, which references the current Python module which the code lives in (settings.py).  The appropriate sub-directory mytemplates is appended using os.path.join. Finally, the .replace('\\','/') replaces any pesky backslashes with the required forward slashes.

A couple notes:

  1. Be sure to include the trailing comma at the end of the line, as you are able to specify more than one template directory and Django will not be happy without the comma.
  2. You must import os.path to have access to the appropriate Python functions used to assemble the path.

The flexibility of this solution should be immediately apparent, allowing for easily moving your project around, including to production, without having to update your template directory.


Nov 16 2011

Managing expectations for browser and device support

I’m currently reading Andy Clarke’s Hardboiled Web Design, which is very interesting.  I particularly like his suggested language around how to word contracts (and expectations) when it comes to browser and device support.

 “The landscape of web browsers and devices changes regularly and our approach is to look forward, not back. With that in mind we will test all our markup and CSS in current versions of all major desktop browsers to ensure that we make the most from them. Users of older or less capable browsers or devices will experience a design that is appropriate to the capabilities of their software. For people using Microsoft Internet Explorer 6, this means a universal, typographically focussed [sic] design but no layout.”

I think it really makes clear how you can have your clients’ best interests at heart.  Not only are you helping them get more value out of their money and your time by not having you hack around for too long, but you are also demonstrating your forward thinking approach to meeting their current and future needs.


Oct 26 2011

Opera even downloads and installs the fastest of all browsers!

OperaThe last time that I used Opera was back in the early 2000s while still at WPI.  I remember how it seemed to popularize the notion of tabbed browsing.  Before that I was using Netscape.  My past few years of web browsing have mostly occurred on Firefox and more recently Chrome.  However, being a fine upstanding citizen of the web community, I try to do my part with cross-browser/device testing.  So, between yesterday and today I’ve been installing the various web browsers onto a new laptop and decided that I’d give Opera another look-see.

Here are my experiences downloading and installing these various browsers: Continue reading


Oct 25 2011

Excellent explanation of Daylight Savings Time

This video does a great job of explaining the debate about whether or not to continue adjusting our clocks twice a year for Daylight Savings Time.  Does it really have a positive effect?  Sounds like whether the intended impact is positive or negative, it is negligible, especially when compared to the havoc it causes.