Where Everybody's Crazy

I'm a missionary in Japan. The name of my mission agency is WEC International. That's supposedly Worldwide Evangelisation for Christ, but I think I have a better idea about what it stands for...

2007-06-26

Death of a thousand bugs

So today I've been doing work on Songbee, amongst other things; one of the areas I've been looking at is whether or not the Japanese localization of it works properly. It certainly doesn't on Mac OS X. Even if you select Japanese as your preferred language in Mac's System Preferences, the Songbee interface comes up in English. This is counter-intuitive, and means it doesn't work like any other OS X application.

Now it turns out that this is a problem with the Mozilla platform. It doesn't ask the operating system what language the user wants. (Although this isn't hard to do; here's some code which does it.)

It also turns out that this problem has been known about since 2001. I don't know, maybe it's just me, but I think if you have important bugs (of course it's important, because it's important to me dammit! ;) sitting around open for six freakin' years and nobody's touching them, something's gone wrong with your bug tracking system. Part of the problem, I guess, is that Mozilla gets a lot of bug reports, and there's enough work to do with triage and fighting fires trying to keep up rather than go look at old stuff. So this is no criticism of the Mozilla project - perhaps the only way old bugs will be looked over will be if someone volunteers for the boring and thankless job of trawling through a very large and very old bug list and working out which ones are still important. But volunteers for boring and thankless jobs are, for some reason, really hard to find...


Posted at 08:36:15 in technology songbee rants mozilla | # | G | P | 1 Comment

2007-04-02

ORM In Javascript

Years before people were creaming off about Active Record and Ruby on Rails, we were doing all that in Perl. The general principle behind Active Record is called "object relational mapping", since, predictably, it maps a relational database onto objects in your programming language. There's a chapter of Advanced Perl Programming about this and how it works.

So as you know, recently I've been fiddling a lot with Mozilla extensions, and also Songbee which is now a Mozilla application, and I've wanted them to be database backed. Thankfully, Mozilla apps these days ship with the Storage component, which is an API to SQLite. Fantastic, if you like writing SQL. I don't, and I've really missed the ORM systems I'm used to like Perl's Class::DBI. So I sat down and started writing an ORM in Javascript. Here it is.

With this, in your Mozilla application you can connect to a data source and then associate some classes with database tables:

var storageService = Components.classes["@mozilla.org/storage/service;1"]
                     .getService(Components.interfaces.mozIStorageService);
var mDBConn = storageService.openDatabase(file);

function Mail () {}; databaseclass(Mail, "mail");
function Attachment () {}; databaseclass(Attachment, "attachment");
function Entity () {}; databaseclass(Entity, "entity");

And with that, you have active records:

var mail = Mail.retrieve(msgid);
if (!mail) mail = Mail.create({ message_id: msgid, message: body });
// ...
mail.last_read((new Date).toUTCString());
// ...
mail.drop();

Currently you have to work out relationships yourself, but that shouldn't be far off once I start actually storing attachments and entities. At least it currently intuits all the field names and the primary key for you.

If you're working with Mozilla applications which you want to be database backed, and you're used to the Object Relational Mapping style of programming, have a look at class-dbi.js.


Posted at 21:25:16 in technology xul mozilla | # | G | P | 0 Comments
Language
Japanese English
Links

Tags and Tools
« 2008-05
S M TWTFS
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

RSS


I am...

lathos: Yay, back home! Now just got to write a sermon...


Photoblog

castle1_filtered.jpg

gosanpai_filtered.jpg

ichibangai2_filtered.jpg

machinaga_filtered.jpg

mizu.jpg


Speedblog

http://daiyainn.gooside.com/ # 京都だいや旅館 京へおこしやす

http://www.e-chords.com/guitartab.asp?idmusica=96629&keyb=true # Where Could I go Tab by Ben Harper - E-Chords

http://www.inmamaskitchen.com/RECIPES/RECIPES/Soups/vegetable_stock.html # Moosewood's Vegetable Stock Recipe

http://www.foodnetwork.com/food/recipes/recipe/0,,FOOD_9936_8389,00.html # Good Eats Roast Turkey Recipe: Recipes: Food Network

http://www.reallivepreacher.com/node/203 # You Ain't Jesus, PreacherPart Two: Losing The Language of Love

http://leiterreports.typepad.com/blog/2005/06/95_theses_on_th.html # Leiter Reports: A Philosophy Blog: 95 Theses on the Religious Right

http://cbae.nmsu.edu/~dboje/teaching/338/traits.htm # TRAITS

http://jweb.kokken.go.jp/gitaigo/index.html # 擬音語・擬態語 - 日本語を楽しもう! -

http://www.nanzan-u.ac.jp/SHUBUNKEN/publications/jjrs/jjrs_cumulative_list.htm # Japanese Journal of Religious Studies: Cumulative list of Essays & Book Reviews

http://www.myspace.com/chloecfrancis # www.myspace.com/chloecfrancis

http://www.solar.ifa.hawaii.edu/cgi-bin/StrikeProb?latitude=+35.38&longitude=-136.26&location=Nagahama,+Japan # Tropical Cyclone Strike Probabilities for Nagahama, Japan

http://www.missionjapan.org/mission/jmissionorg.html # Japan Mission Organization List

http://www.aquasapone.com.au/soapmaking/showergel_soap.html # AquaSapone - How to make shower gel from natural handmade soap

http://www.ultimate-guitar.com/tabs/d/danilo_montero/la_unica_razon_crd.htm # La Unica Razon Chords by Danilo Montero @ Ultimate-Guitar.Com

http://kb.mozillazine.org/Synchronizing_Windows_based_PDAs # Synchronizing Windows based PDAs - MozillaZine Knowledge Base

http://www.provider-navi.jp/campaign/gyao-withflets/ # USENインターネット接続サービス GyaO 光|当サイト限定キャンペーン

http://mytown.asahi.com/shiga/ # asahi.com:マイタウン滋賀 - 朝日新聞地域情報

http://news.bbc.co.uk/2/hi/programmes/from_our_own_correspondent/6506915.stm # BBC NEWS | Programmes | From Our Own Correspondent | Japanese men take marriage lessons

http://wiki.clamwin.com/index.php/Thunderbird_Extension # ClamWin Free Antivirus. GNU GPL Free Software Open Source Virus Scanner and Spyware Detector. Free Windows Antivirus and Anti Spyware. Stay Virus and Spyware Free with Free Software.

http://scan.dalo.us/ # Scandalous Software - Mac XML Tools


Musicblog

The Beatles – She Came in Through the Bathroom Window

Queen – Save Me

Herbie Hancock – All Apologies

Powered by Glob!
Search: