Archive for November, 2007

Django’s dev server and UTF-8

From time to time I got this UnicodeEncodeError, but I had done all the things (sitecustomize.py, some more) right in order to configure the system in UTF-8. I thought.

I did the usual

     ./manage runserver

and since I assumed that on my Mac everything is already properly configured to be UTF-8 I didn’t even think of the shell not being properly set up. Fortunately my colleague Tobi found out that I have to set the shell variable LANG=”utf-8″. So now I always do:

     export LANG="utf-8"
     ./manage runserver

So I went from the wrong locale output to the one working properly with UTF-8 and Django, jiha!

cain@home:~> locale
LANG=
...
cain@home:~> export LANG="utf-8"
cain@home:~> locale
LANG="utf-8"
...
cain@home:~> # now i can safely start Django :-)
cain@home:~> ./manage runserver

Comments (8)

json_encode() updated

[UPDATE] The link to the sourcecode now points to the dojango implementation, the dpaste one is gone.

Just in case someone is using json_encode() I wrote a while ago, I have updated the function due to updates in the latest Django dev version. Find the source here.

I have solved two problems here. One is that now lazy strings are used all over in Django, which this updates handles and detecting a list and a dictionary stumbled on subclasses of them.

Comments (5)

Terminal background color per server

I just changed the config of my application and tested it if it still works, since I only switched DB names. Everything is cool. It works, all the pages show the same stuff it seems to work. Great thing!
A couple minutes later, I go to the shell window where I did that change and am wondering what server I am on. Geeeeeeee, the online version. I changed the DB to use on the live version. God damn it.

It was no big deal, since I hadn’t restarted the server yet, since my local dev server (django) automatically restarts when I change any python file. So I just undid the change online.
Something has to change that this won’t happen again, searching the web a bit and with the help of Daniel I found this article “Colorful Terminal”, where he had solved the same problem. Great solution.
Just one little thing, when I accidently forget to start the script which logs me into the server and changes the background color of my terminal … what then? Can the script not trigger on “ssh me@server.com”? Any ideas?

Comments (3)

Nice hardware mash-up

I just found eye-fi via the Sitepen blog. Just mix wifi and a flash card and you got more spare time and less cables hanging around. Cool.

Comments (3)

On Hanselminutes, about MySQL licensing

A short time ago I found this very well done podcast: Hanselminutes by Scott Hanselman. In one of the latest episodes he was talking to Jonathan Zuck of ACT Online about Software Licensing. It’s great to get a quick overview about existing licenses and how to best use them. Since this is a huge topic you only get a short overview, but very understandable imho!
Especially interesting was what Jonathan said about the MySQL licensing model, which I had not properly understood all the way until now neither :-). He said since MySQL owns the rights of the software they can decide what license to sell a software under to a customer and

relief them of the burden of a GPL based license, by simply selling it to them commercially.

(starts at 27:30). That’s pretty well explained I think. It makes all this licensing stuff much simpler in my eyes.
Thanks Scott for your great podcasts!

Comments

Dojo 1.0 released

I guess by now everyone knows that the dojo version 1.0 had been released yesterday. I will closely follow the dojo development, since I think this is the most promising JavaScript framework out there.
Let’s hack on …

Comments