Dugan Chen's Homepage

Various Things

Converting Manga To Kindle Format

The following BASH converts directories full of bitmaps into Kindle books. You will find this useful if you enjoy scanned comic books, which are usually distributed as archives full of graphics files. The script, as presented here, is for the Kindle DX, which has a screen resolution of 1280×824 and can display 16 colors. If […]

The Javascript MVC framework: Part 3

It’s possible to make the Javascript MVC framework we’ve built even more like Django. To the file that contains the createHashHandler function, add a url function. It corresponds to Django’s django.conf.urls.defaults.url function, and it’s very simple: Now your initialization function can look like this: If you’ve used Django, you can see that this now looks […]

View Templates

After reading my last post, you now have a system that dispatches controller functions based on the URL hash fragment. It works exactly like django’s url dispatcher, only it works with the hash fragment and not the URL. Well, what do you do in the controller functions that you dispatch? In django, the controller usually […]

Javascript MVC View Dispatcher

I probably shouldn’t start blogging even before my website migration is done, but I need to mention this. I’ve recreated Django’s URL dispatching subsystem in Javascript. My version, appropriately, responds to changes in the URL hash and not in the whole URL. The way it works is that you have a list of pairs of […]