Roy Tang

roytang.net

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

2008 October

  • HamSandwich.dec

    "Clearly Chris Woltereck was one of the best players in the room, and probably could have won the tournament with a ham sandwich." -- Gerry Thompson on Cruel Control winning the 25-Oct SCG 5k Standard Tournament
    Posted by under blog at #mtg

    / 36 words

  • django-tagging

    I wanted to add some basic tagging to my blog app so I tried out django-tagging. Unfortunately, the featured downloads on the Google Code site are quite out-of-date and would not work with Django 1.0, so I did a subversion checkout instead. If you're getting an error like "ImportError: cannot import name parse_lookup", then you need to get the source code from SVN. Adding the tagging to the blog was pretty easy: Add the tagging app to settings.py Add a tagging.fields.TagField to the Post model Add a "tags" text field to the post form used. Modify templates to display the

    read more (164 words)

  • In my program, I have been receiving an error when I use a command-line compile command for mxmlc. The error is related to an embedded font name not being correctly identified by flex in the system fonts list.

    However, on a whim, I decided to copy the code to Flex Builder and compile it there. To my surprise, it worked, and it found the proper font using the same system name I had given (PMingLiU).

    I suspected my problem may be a locale one, and that my system cannot correctly identify the font name because of locale considerations.

    I've tried setting the locale of the compile code to en_US, to no avail. So I would like to ask if anyone here knows how exactly Flex Builder invokes the MXML compiler and what differences there are compared to running mxmlc directly? We know it's not using the mxmlc.exe directly, since we tried replacing mxmlc with our own executable to capture the command line parameters.

    If it matters, the OS used is Windows XP.

  • C# HTML Font Tag Parsing

    I need to parse a large amount of text that uses HTML font tags for formatting,

    For example:

    <font face="fontname" ...>Some text</font>
    

    Specifically, I need to determine which characters would be rendered using each font used in the text. I need to be able to handle stuff like font tags inside another font tag.

    I need to use C# for this. Is there some sort of C# parser class to make this easier? Or would I have to write it myself?

    Thanks!

  • GPT Taipei II

    2nd Trial for Taipei was last Sunday, October 17 at Robinson's Galleria. I open to register a very mediocre pool while the rest of the guys at my table open awesome pools with lots of bombs. "Gee, I hope we don't keep this pool." The judge comes over, rolls the dice and we keep our pools. Awkward. Lands 2 Crumbling Necropolis 9 Plains 1 Mountain 5 Forest Creatures 2 Akrasan Squire 1 Ranger of Eos 1 Rockcaster Platoon 1 Sighted-Caste Sorcerer 1 Sigiled Paladin 1 Yoked Plowbeast 1 Jund Battlemage 1 Ridge Rannet 1 Vithian Stinger 1 Cavern Thoctar 1

    read more (778 words)

    Posted by under blog at #mtg

    / 778 words

  • Deployment Problems

    So I got a basic blog app up and running. Posting, paged archives, etc. Comments implemented using the django.contrib.comments. No problems here, the only caveat being most of the current documentation found by Google searches refer to the pre-1.0 version. Need to peruse the official docs for 1.0 stuff. RSS feeds implemented using django.contrib.syndication, this one seems fine. I tested it and it's running fine on localhost. I also have a free django hosting account at http://bells-n-whistles.net, so I try to upload it there. However, when I access the website there (http://www.randomencounters.bells-n-whistles.net/blog/), I get the following error: 'comments' is not

    read more (143 words)

  • Philippine Airlines

    My dad asked me to help book a flight from Manila to Boracay for my uncle who would be a balikbayan this weekend. The rates at PAL were better, so we decided to book using their website. I did the search for the flights, booked the seats, input my uncle's details, etc. When we got to the screen to input the credit card info, my dad went to call my uncle to confirm and to get his credit card. He can't have been gone five minutes. When he came back, I enter the credit card info in the form, click

    read more (541 words)

  • Imeem

    Posted by under blog at #tech-life

    / 100 words

  • Playing with Generic Views and URLs

    "when redirecting, how can I make the redirect URL decoupled from the urls.py of the parent app?" -> It turns out that HttpResponseRedirect supports relative paths, so this was fine. return HttpResponseRedirect("../" + str(post.id) + "/") I got the basic posting structure up. /post/new/ -> To make new posts /post// -> To view a single post /post/all/ -> To view all posts I should probably start thinking of a better url scheme. Ideally, I'd want the @login_required views to be indicated as such in the urls. Something like "/admin/post/" for new posts "/admin/manage/" for a screen to manage posts to

    read more (167 words)

  • Anyone have any idea how to get the value of "Language for Non-Unicode Programs" in Control Panel Regional Settings programmatically using c#?

    Already tried CultureInfo, RegionInfo and getting the default encoding using the Encoding object, but I can only get the Standards and Formats value or the main code page.

  • Starting out

    The quintessential app to learn from is of course a blog. Started using a simple Post model. Added the new post form and view. Can now successfully insert posts into the DB. Next: -- create the detail page that will show the post after saving Figure out: -- when redirecting, how can I make the redirect URL decoupled from the urls.py of the parent app? i.e. if the parent app has the following mapping: β€˜^blog/' -> pass to blog.urls.urlpatterns the blog app has mappings for β€˜^post/new/' -> new post β€˜^post/([A-Za-z-])/' -> post detail inside the view, I want to redirect

    read more (127 words)