Older blog entries for malcolm (starting at number 116)

A Cool Use For Flickr

Suppose you were a startup company trying to attract people to work for you. You wanted to sell yourself as a "cool place to work". One approach, taken by Exoweb is to have a Flickr group devoted to your company. Probably kind of obvious in retrospect, but I'm easily impressed.

I found this whilst mindlessly browsing through Flickr today and realising I hadn't checked out the Django/Python cluster in a while. Always interesting to see what people are doing there.

(I'm not associated with Exoweb in any fashion; I've never paid any particular attention to them until 20 minutes ago. Merely noting their cluefulness in this particular instance.)

Syndicated 2007-05-19 06:15:06 from Malcolm Tredinnick

Foreign Workers In The USA

Articles like this one that suggest there are some pretty obvious abuses of the USA's H1-B visa program going on really annoy me. The article does a pretty good job of pointing out why there isn't any obvious way of returning the scheme to its original purpose without making things even more difficult for employers and employees (both local and international).

I have a very large vested in these problems: I'm an IT professional with a lot of experience who likes the US and wouldn't mind working in any number of places there. However, in the current climate, it isn't even possible to get a foot in the door and on the odd time when a firm hasn't done their homework and approaches me about an onsite position, interest rapidly dries up when they find out I'm Australian (on the Internet, nobody knows you're a dog a Southern hemisphere resident). There's even a special visa type for Australian professionals working in the US, but it's not well known and eyes have already glazed over by the time they hear "not currently able to work permanently in the US, but..."

The problem isn't isolated to the US, either. In most countries, an employer is taking on a lot of extra effort and expense when they consider trying to hire a foreign worker, even when genuine attempts to hire locally have been exhausted. The companies using foreign worker schemes as a way to ultimately outsource do not flag their applications as "frivolous" or "exploitative", so the genuine cases don't stand out from the others.

I have a lot of sympathy for the motivation behind a restricted visa program like this. International-scale outsourcing and other forms of job replacement make sense on a global economic scale, but at the level of the individual work, or community, it is completely debilitating. The reality is that knowing somebody else has a job doesn't put food on my table and the theoretical correction that redundant workers are retrained or placed elsewhere takes time and a person can't live outdoors and not eat for three months and then double up in the subsequent three: you are already in trouble after month one! So I am not an advocate for simplistic solutions like "increase the quota" or "add more sub-types", since that's a screw-your-buddy-in-the-other-country solution on a global scale.

There is not simple solution, or even necesarily a complex one, to this problem. How can you identify genuine cases where a foreign worker is the right solution, in the sense that they possess skills you cannot hire from your own country? How do you do this without driving down wages in a market-driven economy?

That, of course, is the counter-counter-argument: local job losses reallly bring home the downside of international markets and, yet, the same people live improved lives through the benefits of those same markets. Reduced income means you can no longer afford those foreign-manufactured shoes, clothers and cars that people like so much. Selective blindness to the bigger picture is certainly not a recent phenomenom. Everybody is aware of their own areas of speciality and take other pieces of the infrastructure they operate in as something akin to necessary and acceptable magic. Considering the full set of interactions is very depressing and only a few people have the necessary skills, drive and opportunity to try and take it all on.

I'm going through the first part of that last sentence at the moment: in many ways, I can't see that the regulators creating restricted working visa systems are doing the wrong thing. Politics is mostly local and it's often a question of considering how wide your local area extends when making decisions. I can easily get very angry at companies who try to work around such systems for purely their own benefits, though. I mean, a company like Wipro is, by their very nature, an outsourcing company. This isn't a case of a US company hiring a foreign worker directly. It may be legal, but I have trouble with the ethics behind it. Accenture is a trickier case. A US company with a huge multi-national presence where an internal transfer can involve a new country stamp in your passport. How do you stop them using foreign workers as a way of saving costs whilst still permitting cross-training experience that requires a couple of years to be worthwhile?

Like I said: no easy solutions here and the logistics of international business means it might well unfixable. There are other facets to the problem as well, particularly having to do with long-term contributions to the community you live/work in, but I don't want to write forever here. I mostly agree with what I wrote about a year ago in the comments at Dave's place, although I think I must have been on happy drugs at the time, because I'm a lot more frustrated by the realities now than I was then. On a practical level, I am grateful for the fact that most countries allow contract workers in most fields (particularly mine) to enter and work for a few months without requiring special visas. So off-site work with periodic visits are possible, as are short-term contracts.

Syndicated 2007-05-16 21:13:52 from Malcolm Tredinnick

I Told You It Was A Good Book

Random follow-up to a random post: Justine Larbalesteire's Magic Or Madness book (the first one in the trilogy I reviewed) won the Andre Norton Award last night for best Young Adult Science Fiction/Fantasy Novel in 2006. That's part of the Nebula Awards, so kind of a big deal.

See? Other people thought it was good too.

Syndicated 2007-05-13 15:41:17 from Malcolm Tredinnick

"This Should Be Easier..."

The sort of code comment that is usually a sign that whoever wrote this code originally thought it would be easier than it turned out:

  # If all that malarkey found an object domain, use it; otherwise fall back
# to whatever get_absolute_url() returned.

Syndicated 2007-05-12 00:55:01 from Malcolm Tredinnick

Runtime Model Creation In Django (?!)

One of the nice things I like about hacking on Django is that the design lends itself to changing things without having to modify the core code. The internal pieces are split up pretty sensibly into different classes and functions so that you can override and subclass just the bits you need to. It's something that orients my internal design compass a lot when I'm looking at code additions.

Consequently, it's nice to see other people taking advantage of this. Along these lines, Marty Alchin's recent documenting of how to create models at runtime deserves some publicity.

I don't know that this is a particularly robust idea in general, but it clearly has its uses. Marty needs to do it for some reason. I guess with a bit of work and some robust database schema migration code underneath, you could create a web-based model design tool, for example. It's certainly a nice example of using the available hooks and reading the existing code to see how to extend the process.

Syndicated 2007-05-11 19:07:56 from Malcolm Tredinnick

Banning Books Is Stupid, Okay?

Go and read this post over at author Maureen Johnson's blog. Ignore the fact that the blog is very pink and the post titles are in all-capitals and the pictures of headless women in the left column. Read the content. Now pick your jaw up off the floor.

I am astounded that the type of logic that led to the banning of one of Maureen's (or anybody's) books is considered acceptable anywhere. Okay, we're only hearing one side of the issue, but the other side would have to be pretty overwhelming to outweigh the side we read about there.

It's not unexpected that some adults hold extremely conservative views about what is appropriate for their child. Or that they think these values should be projected onto everybody else. Or even that they think kissing between two girls risks pregnancy (although one wonder how they became parents in the first place if this is their understanding of the mechanics). What boggles the mind is that a "committee" of reasonable high school teachers and librarians couldn't or wouldn't see through the obvious problems in the argument.

Syndicated 2007-04-28 15:35:45 from Malcolm Tredinnick

Best Foreign Language Test Phrase Ever!

I've been doing a lot of work lately that is ultimately of benefit to people who want to use a language other than English in their software output (and input). For this you need test data, preferably in a lot of languages. Until now, I've been using a little file with the equivalent of "the quick brown fox jumped over the lazy dog" in a number of languages.

Today I struck gold!

My new favourite test phrase is "my hovercraft is full of eels" and here is a page with the phrase in over 60 languages. Brilliant!

(For those who don't know the origin of the phrase, it's from a Monty Python sketch called The Hungarian Phrasebook.)

Syndicated 2007-04-27 18:57:34 from Malcolm Tredinnick

Review of "Magic or Madness" Trilogy

Why I'm reading a young adult series has a bit of a back story, explained below. Why I'm reviewing it is just because I haven't seen a lot of reviews of this series around and it deserves some wider coverage, at least in Google searches.


Amongst the numerous blogs I read regularly are half a dozen or so by professional authors. Some of these are people whose books I read and enjoy — I've mentioned John Scalzi here before, for example. Others are people I've come across in one way or another, usually via an author's site I'm already reading. These blogs add a nice extra layer to books, because you can see them being developed, watch the author's excitement as they are released and read the readers' comment. Over the past couple of years, I've probably bought maybe a dozen books based on recommendations or curiosity from these writers.

For various reasons (mostly because they're interesting), some of the author sites I'm reading are"young adult" authors. Now, I'm not particularly young any longer (mid-30's-ish these days) and I'm not even particularly adult. However, having read along as Justine Larbalestier finished the third book of her trilogy and seen the eager comments from her young (I assume) fans, I thought I'd find out what goes into a good young adult novel these days. It was more of an curiosity satisfier than looking for a good book.

The Australian release date for Magic's Child came and went without it appearing in my local Border's — they still haven't got it on the shelves when I checked today — so I did what every decent person with a credit card would do: ordered the series of three books from Amazon.

The Books

I figured you can't just dive in and read the third book of a trilogy, so I read all three, Magic or Madness, Magic Lessons and Magic's Child. They were great fun.

Short version: 8 or 9 out of 10 from somebody way outside the target demographic.

I read fairly fast and at 270-odd pages each, the books felt very short, but I guess this isn't atypical for the genre (based on a rough sampling of books in the teenage section of the local bookshops). Since the timeline of the entire trilogy is only one and a half weeks (with the exception of a jump right at the end of book three), reading one book a night didn't feel like I was rushing the story at all.

Very hard to give much of a synopsis of the storyline, since so much is revealed in a way that is contrary to where you think it is going as you read along. However, generally, the books follow the adventures of three teenagers who have magical powers, but in a universe where magic is not a wonderous gift, but more of a curse — both using it and not using it have grave consequences. There seems to be not a lot of upside to having magical powers in this particular world, beyond short-term gratification, so the concept gives support to a great story about the three protagonsists learning about the wider implication of their "gift" and each dealing with it in their own way. The trade-off between short-term pleasure and long-term responsibility is at the front of the decisions throughout and I think Larbalestier has done a great job of capturing how people of that age might try to deal with the problems. They want to be grown up, but sometimes they just want to be kids, too.

The three main characters were just annoying enough that I figured they had to be well written. Likeable in most places, but you want to throttle them every couple of dozen pages or so. Pretty much normal teenagers, from my experience.

The books are set jointly in New York, USA and Sydney, Australia. Larbalestier is an Australian, married to a Texan (Scott Westerfeld), who lives in both cities. I usually cringe a bit when I'm reading Australian writers writing about Australia for overseas readers (or worse, movies that try to do the same — some of them are just plain awful). However, in this case, I think she's captured the differences between the countries without making either culture seem freaky. There's even some quite realistic-sounding scenes about life in Aboriginal camps and outback townships. The protagonsists tease each other about their different ways of speaking, but it highlights the differences without making them seem wrong. I am (clearly) not a writer, so it's hard to capture quite why this works in this case, for me, and not always in other books.

Since I travel a bit between Australia and the US for work and I love New York (and live in the northern suburbs of Sydney), the descriptions about the differences between Manhattan and Sydney really resonated. It's a lovely city, but it's so different in many ways. Their (the United States peoples') love of all-day breakfasts and serving sizes that could feed a small family of four alone, is something that I have pegged as iconically dentifying about that country and it's one of the many small differences brought out as the characters move between the two countries.

I've been struggling for a few days to put my finger on exactly why I like these books. The storyline isn't particularly complicated. I think it's the characters. Setting aside the slightly flukey setup that all three of them met up in the same ten day period that they had to make life-and-death decisions, which I found a little contrived at first, they are basically very human people. They have real and different interests: The boy, Tom, has an interest in fashion and creating clothes, which is unusual but doesn't feel out of place. One of the girls, Reason, keeps order in her thinking through mathematics and problem solving, so the Fibonacci sequence and perfect numbers put in a regular appearance (making this another entry on my list of books with cool female lead characters who are mathematicians in some sense). The other girl, Jay-Tee is the American and more of a nightlife and party girl. Each characters interests and thinking was consistent and fit in with their behaviour throughout. I like characters with a some depth, but I hate it when they seem to have been brought up with ridiculously improbable and fortuitious things happening in their childhood or present. Okay, in this case, some of the characters have magical powers and that's bordering on the improbable. But the rest of their experiences weren't completely far-fetched. The short verison is that I prefer intelligent, ordinary background characters to Ritchie Rich-style protagonists.

I also really enjoyed the frequency with which I would just start to draw conclusions about one of the characters and my assumption would be challenged (and turn out to be wrong). The timing here was uncanny — I think Larbalestier has a good intuitive sense of how fast the reader is going to form an impression, let's it just start to take root and then has a good laugh to herself as she removes the chair you're sitting on. Either that or she needs to get out of my head, because it was uncanny. This wasn't so apparent in book three as in the earlier books, though, so either I was becoming more wary, or by the time the third book was written, we already knew too much about the characters for much to be surprising. Still, there were a few nice moments of timing even in the third book and it's a writing style I'm going to want to think about a bit more: how does it work so effectively here?


Would I recommend reading this series? Absolutely. I really enjoyed them a lot more than I expected to.

Would I recommend buying them? Harder to say. If you're me, maybe not worth it. Books are not cheap these days and these three were a bit short for three volumes. On the other hand, if I was a teenage me, I would beg somebody to buy them for me or save up my money and go for it (of course, how would I know I liked them so much in that case? And wouldn't Justine Larbalestier be too young to be a published author back then... hmmm). If I was a parent looking for a present for my well-behaved, all her homework done on time, child: definitely.

Syndicated 2007-04-24 00:02:56 from Malcolm Tredinnick

Documenting Helps Design

As a counterpoint to yesterday's quote about designer's being intelligent, here's one I ran across today.

"Before long I figured out that if Caroline [Rose, a technical writer,] had trouble understanding something, it probably meant the design was flawed. On a number of occasions, I told her to come back after she asked me a penetrating question, and I revised the API to fix the flaw she had pointed out. I began to imagine her questions when I was coding something new, which made me work harder to get things clearer before I went over them with her."

This is Andy Hertzfeld in his fantastic book Revolution In The Valley, which I recently bought and am slowly reading. Caroline Rose was writing the first version of the early Macintosh developer documentation in mid-1982.

Good design doesn't happen in a vacuum. You need to road test your decisions from time to time.

Syndicated 2007-04-07 19:41:52 from Malcolm Tredinnick

Odd Python Fact

Using the long weekend to get some intensive hacking done, I'm converting Django's internals to be more transparently unicode aware. All this character encoding twiddling has me thinking about performance, so I've been writing lots of little test programs to time features.

One unusual result that popped up this afternoon concerned reading a UTF-8-encoded file. Contrary to my intuition, this version:

  data = open(filename).read()

was consistently a little bit faster than this version:

  data = codecs.open(filename, 'r', 'utf-8').read()

Admittedly the differences were generally (much) less than 5%, in favour of the first version, but I was a little surprised there was any real difference at all. I'm not worried by this result, but I would have guessed incorrectly.

In both cases, I'm reading in the data and converting it a unicode string. I was running it against some examples I had lying around from Markus Kuhn. The results were consistent if I changed the order of the tests or intermixed them. Aliasing codecs.open to a global variable sped up the second method very slightly, but not enough to catch up. I was careful to pre-fill the disk buffer cache and run each test enough times in a loop for any noise on a single run to be absorbed.

Turns out, the results are closest (essentially identical speed) for files that have mostly one byte per character (pure ASCII files being the fastest) and diverged the most for more complex characters. The runic poem, with lots of three byte characters, and Greek text, which is entirely two byte characters were the most divergent.

Syndicated 2007-04-07 19:26:47 from Malcolm Tredinnick

107 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!