Thursday, September 27, 2007

Offline Web 2.0

Everyone's abuzz about bringing the Web offline. Not shutting it down, but allowing webapps to be accessed offline.

Once you get past the initial "why would you do that?" there are some benefits. Some webapps do things desktop software simply doesn't. Many content-authoring apps don't need network access for 80%+ of their operation.

Somehow I don't see this being a huge success though. Not because it isn't a good idea, but the hassle involved. The story has already played out with Lotus Notes database replication, which personally I steer well clear of. Maybe Web 2.0 will make the required usability improvements; even so I see this as a niche.

Wednesday, September 19, 2007

Yet another reason to dislike Java

Java doesn't deal with lists fluently.

All I'm doing here is splitting a comma-separated string, adding MY_NAME and joining. In Java:

List list = new ArrayList();
StringBuffer newString = new StringBuffer();
for (int i = 0; i < list.size(); i++) {
if (i+1 < list.size())

In Ruby:


Back to Java again... because this beautiful listcentric pattern isn't supported, I end up using the below code. It's less DRY and the intention is obscured.

String newString;
if (original.length() > 0)
newString = original.trim() +","+ MY_NAME;
else newString = MY_NAME;

Friday, September 14, 2007

Shared RSS, pt 2

I've done it now.

I really like the Shared RSS feature of Google Reader. It bugs me that when I find a cool page, I have to post on my blog here about it. That clutters this blog, obscuring the little original content I do provide.

So (all credit to Mike T for the idea) I've created a second blog, which is autoshared from Google Reader. So everything I post there should end up in my Shared RSS. That means you know what you're getting - inimitable scrawlings of myself from here, links from the RSS.

Check it out by the way, the first article linked through the new mechanism is a cracker.
My Shared RSS - feed

Wednesday, September 5, 2007

Spike theory

Every so often, I get to use something I learnt at university. Rarely on work, but it's still cool. This time, it relates to WoW, which makes it doubleplus cool. In my world.

Top-end combat in WoW consists of a tank, some healers and some DPS (damagers). An important constraint on the DPS is to do less "threat" than the tank. This is usually okay, a good tank will on average deal more threat than the DPS. However, critical hits and crit chains (several crits in a row) increase short-term threat considerably. If this "threat spike" pushes the DPSer over the tank's threat, they usually die. So the size and frequency of one's spikes is of key interest.

Returning to school, queuing theory helps predict how long the queue at a checkout will be. It assumes a server who deals with customers at a steady pace and customers who arrive in a Poisson distribution. Can you see the connection yet?

If we pretend crits are the customers, and the server deals with crits at the effective crit rate, then we can see how long the queue is likely to get. That is, how many unexpected crits are likely to happen in a short time frame. It is possible, of course, for every single attack to crit over a 10 minute period despite only a 1% crit rate - however this is incredibly unlikely!

Using the Poisson distribution we can convert from the effective crit rate into an expected number of crits per second. From that we can determine the longest queue with a probability of, say, 5% or more, over the time it takes for a normal fight (3-10min). By moderating our damage to ensure the tank always has enough threat to handle a crit chain of this length, we can guarantee we stay under zir threat 95% of the time.

Exercises: what crit rate is the spikiest? A high crit rate means 'customers' arrive very fast, but the 'server' will also deal with them very quickly. That is, a lot of crits are expected, so they are less surprising.

Crits vary in size. A basic crit from a magic-user is 50% of the spell's total damage. However, talents can increase this to 125% for some spells. Given the total base damage and the total amount of additional damage done by crits, produce a strict ordering of character builds by spikiness.