Archives

Anticipation

  • No dates present

Happy 2022-02-22 02:22:20 UTC

I’m still alive, though I haven’t really come up with anything interesting to post in a while (and I guess I still haven’t). Blogs are kinda out of fashion at the moment, and nobody is really reading this, anyway.

But hey, enjoy a fun point in time.

Excessive whitespace in XmlWriter

I’ve had this post kicking around in my drafts folder for a while now, and hey, it’s only been a year or two since my last post. My how time flies.

This is just a short bit of utility code I felt like sharing in case anyone else runs into the same problem I did.

The issue was with XmlWriter in the .NET Framework 2.0-3.5; I think the problem is still present in 4.0 and later but I don’t recall if I’ve tested this explicitly or not. One of the useful features of XmlWriter is that you can set the Indent property to true in order to make the resulting XML more human-readable instead of all smooshed together on one line.

Most of the time, this doesn’t cause any issues, because like HTML, whitespace is generally considered either insignificant or collapsible, so the extra spaces can be ignored. There is one exception to this rule, however: an element can have the xml:space="preserve" attribute applied to it, which means that all whitespace within that element is significant and must be preserved entirely intact (and thus must not be touched in any way by reformatting for humans).
Continue reading Excessive whitespace in XmlWriter

Random musical musings

Turn on a popular music station (something not dedicated to a specific theme, such as classic or concert music), and listen for 30-60 minutes. Count how many songs you hear that do not feature love, sex, or related topics (such as partying).

I’ve tried this a few times. So far my record high score is one point. And I’m not entirely sure I can count that one.

I’m not entirely sure what this says about the music or the audience or the people who decide what ends up on the radio. It just seemed like an interesting pattern.

Kicked into the Lead

Torment: Tides of Numenera -- Kicktraq Mini

Another game that looks impressive. And clearly I’m not the only one to think so — this fully funded within six hours, and hit US$1.5m in only nine.

And, not that it’ll make much difference since I don’t have that many readers, but: don’t forget Dreamfall, from my previous post. As this posts there’s less than 48 hours to go until the deadline. And while it’s already comfortably over the main goal, there’s some nice stretch goals up for grabs.

The return of Dreamfall

Dreamfall Chapters, the long-awaited sequel to Dreamfall and The Longest Journey, has finally opened its Kickstarter pledge drive.

It’s hard to express how much I love this series. But maybe some small indication is that I’ve been hanging around the (now going to be superseded) official forums for the games for so long that they made me a moderator. :)

Dreamfall Chapters: The Longest Journey -- Kicktraq Mini

As I post this (breaking my normal post time pattern), it’s still early days (only 8 hours in) and we’re still in the “initial surge” phase (these things tend to follow a double-humped pattern, with an initial surge, slow burn, and final push), so the pledge rate will start to drop off soon — but this looks like a solid beginning and very likely to achieve the funding goal.

Multi-thread auto_ptr

So, last time I talked a bit about lock-free data structures. Here’s the second part, as promised.

I’m not going to go into great detail on the topic (unless people seem interested), and there’s plenty of other pages and sites dedicated to it. But I just wanted to share this little class I made. I doubt it’s original, but it is something I came up with on my own. (If that makes sense.)

This is a completely threadsafe and lock-free (though not atomic-free) way to pass an object from one thread to another. If you have many such objects, then a queue is typically the better way to go, but sometimes that’s a little too heavyweight for your needs. Essentially, this behaves like a queue or stack that can only hold a single object at a time — adding a second object will result in throwing away the first, but in a completely memory-safe manner. No memory will be leaked, no matter how many threads are adding or removing elements.
Continue reading Multi-thread auto_ptr

Lock Free

As part of my day job, I’m always striving towards higher performance code while at the same time trying to retain a readable and flexible design (since customers are always changing what they want).

One of the big killers of performance is locks — they’re the most basic way to ensure mutual-exclusion of shared data between threads. Normally this is all well and good, and there are some situations in which locks are the only acceptable solution, but the big problem with them is that they block progress (which is part of their job, of course).
Continue reading Lock Free

Curiosity

There’s just something strangely addictive about Curiosity (Android, iOS). I only just found it yesterday, so maybe it’ll be a passing fad, but I wore out my phone’s battery playing it yesterday.

I think it taps into the same part of the brain that enjoys popping bubble wrap. It’s somehow very cathartic.

Random grammatical thoughts

“Got” is a very strange word in the English language. Technically it’s the past tense of the verb “to get”. (And just to be difficult, so is “gotten” — at least in some dialects.) But that’s not the only way it’s used.

For example, the fragment “once you’ve got the window open” is fairly normal in common usage (though I’m fairly sure it’s frowned on in more formal grammar).

If you expand the contraction, “once you have got the window open” is still technically valid but is starting to sound quite dodgy — and it can be replaced by the equally-valid-but-still-dodgy “once you have the window open”, making the word “got” itself seemingly redundant. And yet “once you’ve the window open”, which logically ought to be the same, completely doesn’t work.

Of course the most correct (and formal) phrasing would have been “once you have opened the window”, which also works in the contracted form “once you’ve opened the window”. And yet it seems like most people seem to default to “you’ve got”, at least in casual conversation.

The original phrasing is using “to get” in its “achievement” sense — ie. “once you have achieved the state of the window being open”… not that anyone would normally state it in such a long-winded fashion. This is also why “have” works without it, as this is “to be” — ie. “once you have the window open” reads sufficiently close to the more formal phrasing above. It’s not as clear why it stops working once you reintroduce the contraction, though.

English is weird sometimes. Or maybe it’s just me.

(And yes, at times I’m a self-professed grammar/spelling nazi. Especially when it comes to misplaced apostrophes and homonyms (including using “of” instead of “have”). And even more especially when the person making the error should know better — eg. if formal writing is part of their job. (But clearly I have no objection to nested parentheses.))

This random musing is brought to you by the symbol ‘.

Steam Summer Sale

Sometimes Steam is just bad at maths. It pays to pay attention.

Notice something odd about the bundle price?

(I did end up buying the game, but not the guide — this was just for illustrative purposes. Haven’t played it yet, but I might eventually get around to posting some comments on it.)

Thus far, I’ve managed to resist the Sale fairly well, but Steam does still have a magical ability to make me throw money at them. (Despite their obvious failure at maths.) Sigh.