Roy Tang

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

Blog Notes Photos Links Archives About

All entries tagged software-development.

You can subscribe to an RSS feed of this list.

Jul 2009

  • Any idea for this?

    Problems encountered: Using screen.availHeight and screen.availWidth as the height and width params in window.open causes the browser size to include the taskbar, and positioning at (0, 0) ignores the possibility of the taskbar being up there.

    What I want is to open a new window with the size as if it was “maximized” by the user, i.e. it shouldn’t cover the windows taskbar.

    (Oh, and no need to remind me that users don’t like Javascript interfering with their browser windows, etc. This is for an internal intranet webapp…)

Jun 2009

  • Specifically, say I have a string like ABC-123-NNN. I would like the paragraph to have line breaks, but not to break at the dashes.

    i.e. if my text is “The serial number ABC-123-NNN is not valid”, I would like to keep together the entire serial number if it exceeds the container width.

    So the following is ok:

      The serial number 
      ABC-123-NNN is not 
      valid
    

    But the following (which is the behavior of IE6) is not:

      The serial number ABC-
      123-NNN is not valid
    

    Currently IE seems to break at dashes. Is there any applicable CSS or whatever I can apply to avoid it?

  • Given the code below:

    function test() {
        document.forms[0].TEST[0].focus();
    }
    
    <form>
        <input type="button" value="Test" onclick="test()" />
        <input type="radio" name="TEST" value="A">A
        <input type="radio" name="TEST" value="B">B
    </form>
    

    In IE6, clicking the button doesn’t focus the control, unless I’ve already tabbed through the radio at least once, in which case it works. =/

    Any idea how I should be focusing the control? The above works perfectly fine in FF of course.

    Edit: I found that the control is being focused, except the highlight box around the radio button is not being rendered. (I can hit space to activate the radio button, and also use arrow keys to change the active button). So the question becomes: how can I force the focus highlighting box to render?

Apr 2009

  • I’m experimenting with wx.aui.AuiNotebook; is there a way I can prevent particular tabs from being closed? i.e. I have an app that allows the user to create multiple tabs in an AuiNotebook, but the first 2 tabs are system managed and I don’t want them to be closed.

    Also, in a close event, can I get the window object attached to the tab being closed? (to extract data from it)

Mar 2009

Feb 2009

  • You may have noticed the new color scheme and new “Theme Switcher” widget in the sidebar. I had done some CSS work during the past month in the office and it made me want to tweak the stylesheets on this site a bit. I figured I might as well make it easy to switch stylesheets, so I wrote a small Theme Switcher django app. (Well, it’s more of a stylesheet switcher I guess)

    read more (406 words)

  • Zed Shaw -- the ACL is Dead

    Excellent talk given at the Canadian University Software Engineering Conference (CUSEC) last year (2008). The presenter is Zed Shaw who’s a famous Ruby guy or something. The video is around 70 minutes long. The first part of the talk is mostly about a Document Management System he worked on, kinda interesting, but the second part is better where he talks about people who program cool things as a hobby and how to avoid becoming just another corporate code.

    read more (101 words)

    Posted by under post at #Software Development
    / 0 / 101 words
  • Code Quality

    I was doing code reviews on an interface file-processing framework to be used in one of our projects. The code was workable and already being used by several programs, and I didn’t see any major functional flaws. But design-wise I felt that it could stand for some improvements/refactoring to be “better object-oriented code” or “easier to maintain”. The current design required a lot of inheritance – the usual way of doing things in older Java code at work.

    read more (562 words)

    Posted by under post at #Software Development
    / 3 / 562 words

Jan 2009

Dec 2008

  • My current blog app supports syntax highlighting in the blog posts, something I cribbed off Djangosnippet #119 One problem I encountered was that there was no quick visual reference for the styles available with pygments, so I wrote a short demo page here so that I could easily see the appearance of each syntax highlighting class. Of course, I haven’t had a chance to use it in a post yet…
    Posted by under post at #Software Development
    / 0 / 70 words
  • Colophon 2008

    Frontend: All page templates are valid (X)HTML. However, I choose not to claim valid XHTML (and no doc type declaration) since I can’t guarantee that blog posts I write are compliant! The site uses standard CSS and uses the Blueprint CSS Framework for the grid layout of the page. The site design is entirely original (if not simple and bland – I’m not very good with website design yet!). The site has minor usage of JQuery Javascript library in some parts.

    read more (283 words)

  • I’m not sure if this a settings problem or an HTML problem, but on a page layout I’m working on, Firefox does not render the stylesheet immediately. Meaning for maybe half a second I can see the unstyled page, then the stylesheet kicks in and it renders as I expect.

    All my stylesheets are in external css files loaded in the head tag. I’m not encountering this on Flock (which is a Firefox variant) nor on Google Chrome/IE.

    Any idea how to avoid it?

  • Fixing up the comments

    I played around with the built-in comments app today, trying to clean it up. Some findings: Some of the moderation views, such as flagging a post or deleting a post, accept a next parameter that determines where the view will redirect to after the operation. However, the way the url’s are set up, there’s no easy way to pass this parameter normally, even through query strings. This lovely bug is documented in http://code.

    read more (438 words)

Nov 2008

  • I’ve been busy at work so fell a bit behind with Django. Last night I worked on a WordPress importer, so that I could migrate posts from my current blog(s) into the Django-powered blog that I’m coding. I’m using BeautifulSoup to parse the WordPress export file and insert them as Django objects. Since I was running the script repeatedly, I had to figure out how to easily run it from the command line, without having to run it from inside manage.

    read more (232 words)

  • Free Flex Shirt from Adobe

    Free Flex T-Shirt from Adobe (my name is near the lower part of that F) Uploaded with the <a href="http://www.flock.com/">Flock Browser (Click to view full-size) Free Flex T-Shirt from Adobe (my name is near the lower part of that F) Uploaded with the <a href="http://www.flock.com/">Flock Browser 21 Nov 2008 5:42amView postClose A while back I got an email telling me that Adobe was sending out free Flex T-Shirts to people who had contributed to Flex 3.

    read more (132 words)

    Posted by under post at #Software Development
    / 3 / 132 words

Oct 2008

  • 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:

    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.

  • 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!

  • 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.

    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.

    read more (541 words)

    Posted by under post at #Software Development
    / 1 / 541 words
  • “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.

    read more (167 words)

  • 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:

    read more (127 words)

Sep 2008

Aug 2008

Jun 2008

  • Google Treasure Hunt

    Google started a treasure hunt about a month ago, releasing four questions (one per week) that covered a range of computational topics. I actually joined the treasure hunt late, the 2nd question was already released by the time I got wind of it. The site says there are prizes to be won for the people who are able to provide complete answers first; I’m not sure what my odds of winning anything are since (a) I joined late and (b) I can only do the questions during the weekends, typically a few days after they are released.

    read more (152 words)

    Posted by under post at #Software Development
    / 0 / 152 words

May 2008

Apr 2008

Mar 2008

  • Trust and Evil Programmers

    Never give out any of your confidential usernames and passwords to programs or services that you do not trust completely. This may be a bit obvious to the more tech-savvy, but everybody has to watch out. Luckily, there are even some programmers who are able to catch the work of evil programmers. Coding Horror has this story about an evil programmer who sold a GMail backup solution that steals your username and password.

    read more (97 words)

    Posted by under post at #Software Development
    / 0 / 97 words

Feb 2008

  • MTG Autocard WordPress Plugin

    I had been planning to do this for a while: it’s my first WordPress Plugin! Over at Roy on Magic, I often have to write out decklists and such, so I wanted to have an autocard feature similar to the one used at MTGSalvation. After a quick five-minute search I couldn’t figure out how they did it, so I just wrote the plugin myself. Actual effort was around 3.5 hours, most of it struggling with PHP and Regular Expressions.

    read more (371 words)

Jan 2008

  • Job Hunting for Programmers

    No, I’m not job hunting. But other people are, apparently. I got a comment on an old post I made about my job hunting days. Not only that, but the guy IM’d me asking to talk (I put my yahoo id on this site somewhere me). It’s a bit strange, but I figured, why not? What I got from listening to him was that he was just extremely frustrated at how difficult it is to find a good job, so he was looking for people who had gone through similar experiences.

    read more (691 words)

    Posted by under post at #Software Development
    / 0 / 691 words

Oct 2007

  • How to Solve Technical Problems

    One of the qualities that I think make a really good software developer is the ability to solve difficult technical problems. Unless you’re the sort of software developer who just sells the same piece of software over and over again, at some point in time you’ll to need to find out how to implement some feature you’ve never tried before. Or you’ll hit a problem that’s not documented in any official docs and you need that critical functionality.

    read more (771 words)

    Posted by under post at #Software Development
    / 2 / 771 words

Aug 2007

  • Announcing PyMTG

    I couldn’t sleep, so obviously, I had to start a new personal project. PyMTG I was inspired after forum-browsing lead me to look at existing MTG open-source software. I’ve been thinking of starting a true-blue personal software project for a while now, and the idea of PyMTG appeals to me for several reasons: (a) It’s related to one of my current hobbies (b) Allows me to become familiar with a new language (Python)

    read more (438 words)

    Posted by under post at #Software Development
    / 1 / 438 words

Jul 2007

  • Rich Internet Applications

    Most of the time, my work involves mostly run-of-the-mill information management systems. Lately however, I’ve been asked to look into some new tech, and that got me interested in what’s called Rich Internet Applications (RIAs for short). The primary platform for RIAs is Flash, which apparently is already owned by Adobe and Macromedia is no more. Yeah, I never really paid attention to Flash, like most people I assumed it was only for making amusing movies and annoying ads.

    read more (433 words)

    Posted by under post at #Software Development
    / 0 / 433 words