Viewing entries for January 2003
Question: Does Google support pages sent as
Hideous code, the like of which you have never seen before and will hope never to see again:
UPDATE tech SET progress = GREATEST(progress - round(((assigned / 100) * (IF(user_id = 1,0,(IF(user_id = 2,162,(IF(user_id = 3,162,(IF(user_id = 4,162,(IF(user_id = 5,0,(IF(user_id = 12,0,(IF(user_id = 13,0,(IF(user_id = 15,165,(IF(user_id = 6,33,(IF(user_id = 21,123.75,(IF(user_id = 26,33,(IF(user_id = 28,27,(IF(user_id = 27,0,(IF(user_id = 29,0,(IF(user_id = 39,0,(IF(user_id = 44,32.4,(IF(user_id = 45,1069.36911,(IF(user_id = 47,277.2,(IF(user_id = 48,105.3,(IF(user_id = 49,196.04151,1)))))))))))))))))))))))))))))))))))))))))), 0) WHERE user_id IN (1,2,3,4,5,12,13,15,6,21,26,28,27,29,39,44,45,47,48,49) AND progress != 0 AND assigned > 0
20 updates for the price of one.
So now, what is a conuery?
Database access with our web hosts is measured in
Conueriesis a term we at DreamHost came up with to measure MySQL database usage. The word is a combination ofconnectionsandqueries, as that is what the unit is derived from! Basically, the number of MySQL queries you have in a month, plus 25 times the number of connections you have is your totalconueriesfor a month!
Trouble is, if we go over a certain amount per month, we get charged extra. Which is bad, especially when you're running a free game (amazingly, bandwidth is not a problem for us yet since we're
only sending about 100MB of data per day).
We're already using persistent connections which reduces the number of database connections (the things worth 25x a query) that we make, by a very large amount. Now the problem is purely the number of database queries.
JOINs wherever possible (ie. a lot) to reduce the number of queries needed and to improve general efficiency of the code, but it's not enough.
The reason for the large increase is almost certainly due to the rapid increase in the number of players that we had recently (until the game reached maximum capacity of 90). The main problem lies in the ticker. The ticker is a piece of code that executes once every 3 minutes and performs all actions in the game (executing ship orders, calculating resources mined/spent, increasing populations, calculating combat). It has been optimised in the past, but it would seem that it needs more work.
Not to worry though, we've spotted some places where we can improve things and GwieF will soon have it running much more efficiently for us (well we can't all work on it at once ;)). If it becomes necessary though, we may have to decrease the speed of the ticker (eg. make it once every 6 minutes). That wouldn't exactly be the end of the world.
This looks ominous...
More details after Kam finishes eating. ☺
Trackbacking across the universe
Since everyone else seems to be doing it, this weblog (damn I really need to think of a decent name for my weblogging software) now has Trackback support. Having implemented both Pingback and Trackback I can now say with certainty that Pingback is much nicer.
The main problem I have with Trackback is that the embedded RDF for autodiscovery is absolutely hideous to parse (even the example code given in the spec. falls down on several valid examples) and because you need a separate entry for each post, you need to make damned sure that you are looking at the right piece of RDF. Not to mention the fact that putting data that needs parsing inside a comment (
<!-- -->) is just plain wrong.
Pingback is much more sensible: firstly all you need to look for is either an HTTP header or a simple
<link rel="pingback"> tag; secondly, you send the permalink of the post you are linking to in your request so you don't need to have a different pingback URI for each post on your weblog.
Pingback also has a much better written specification, which explains everything very clearly with good examples. The Trackback specification leaves out many of the details (eg. How does the server find out which post you are referring to when you send a Trackback? -- answer: you need a unique trackback URI for each entry) and has several ambiguities (eg.
url: The permalink for the entry. Which entry: the one I'm sending a Trackback to or the one I'm sending a Trackback from? -- answer: it's the latter).
All of this makes me wonder why Trackback appears to be more widely used than Pingback. The only technical advantage of Trackback over Pingback is the ability to send an excerpt of the document with the Trackback request. I can see how this can be useful (I don't use it personally), but it is not entirely impossible for a Pingback server to grab an excerpt from the source page should you wish to do so.
One reason I can think of is that many people seem to be very confused about Pingback:
...the key distinction being that trackbacks are client-server and pingbacks are peer-to-peer between servers. So [this software] could support trackbacks, but not pingbacks.
I hate to say this, but that is blatantly not the case. Pingback is just as much "client-server" as Trackback is. My code for Trackback and Pingback is very similar in both the client and server aspects (the only differences being in the format that the request is sent and in the method that the autodiscovery works).
Another reason why Trackback is quite successful is that a lot of people use Movable Type for their weblogs which of course comes with Trackback built in.
Ah well, I just hope this doesn't become another Betamax vs VHS scenario...
Willow would never have approved
This text must be preserved for all time as an example of one of the worst possible things a web "designer" can do:
Welcome to The Buffy Network. It has come to our attention recently that a lot of visitors to this website do not have the correct setting on their computer when they try and access the site. For example, 0.82% of visitors are using Netscape - which does not support the kind of html coding we use. 2.10% of visitors dont have Java installed and/or turned on, Java is essential for some of the pop up windows we use. And 40.76% of vistors are using the wrong screen resoloution. Anything larger than 800 x 600 is too large, and the pages do not diosplay properly. Please try and use the right settings on your computer before entering the site, in order to make it look on your screen, how we intened it to look on ours. Thank you for visiting The Buffy Network. Please click 'Ok' to close this window.
which can be roughly translated as:
Yes it is very sad that people exist who do things like that, but you can't help but be amused by the sheer ignorance and stupidity involved.
What the cat says, goes
After some pretty thorough studying of the XHTML 2.0 working draft and after reading Hixie's thoughts on the matter I have come to the conclusion that, despite Mark's earlier tantrum on the issue, and my initial misgivings, XHTML 2 looks like a vast improvement over the current XHTML and HTML specs.
My personal favourites are as follows:
<h>elements. The ability to actually mark up the sections of the document properly rather than having to say "well it's the bit between that
<h2>and that other one" is much better and somewhat more like the way LaTeX does it.
<p>) will be able to contain lists, blockquotes, pre's and tables as well as inline text. This means for example, that this very list could be contained within the paragraph above (
My personal favourites are as follows:) which would make more sense structurally.
<nl>element looks interesting and potentially very useful for making site navigation menus.
This is by no means a complete list of the good things about it. Those were just the things that really caught my attention.
I still have concerns about the ease of making the transition to XHTML 2 though. The early adopters (like myself - I fully intend to start using it the day after the final spec rolls out) are the ones who are going to "get it", since we'll have to provide XHTML 2 and legacy versions of the same documents until everyone's browsers support it (ie. till about 2023). This will be considerably more difficult than providing XHTML 1.1 and HTML 4 versions of the same document like I'm doing now, because of the large amount of structural changes that will be needed (specifically with regard to the
<h> elements). Yes, I know no-one's forcing me to use XHTML 2 (just like no-one's forcing me to use XHTML 1.1 now), but I'm afraid that's just the way I am...
Mark Pilgrim. Hello! Right here! ☺
He's right though, migrating to XHTML 2 looks like it's going to be damned near impossible. I'll probably still adopt it though, I clearly enjoy the pain.
It looks exactly the same!
I just completely rewrote about 90% of the code behind this site. Doesn't look very different though does it?
Well to begin with it's my first attempt at writing Object-Oriented PHP. I only have 4 classes in this code (
class HTMLpage extends Page,
class CSSpage extends Page,
class RSSpage extends Page) but it has at least been a "learning experience" for me.
Thirdly, the weblog navigation itself has been simplified (it no longer uses 4 separate forms to do the job) which should help accessibility a bit.
Finally, as before, if this site detects that your user agent (browser) supports XHTML (with a
Content-type of "
application/xhtml+xml") it will send the page as XHTML 1.1. However if it detects that your browser does not support XHTML, it will instead send the page as 100% valid HTML 4.01. I'm fairly confident that this is the only weblog that does this (feel free to prove me wrong on this). Whether it was actually worth doing is another matter altogether ☺.
Another day, another browser
So Apple went and released their new web browser ("Safari").
Thanks to Mark's Safari review and Safari information for web designers I was able to find out that my website was broken in Safari as it would attempt to download it instead of displaying it (identifying itself as
like Gecko was bound to cause problems and IMHO very stupid) but it should now be working fine. At least that's the theory, because like with Mac IE and Chimera I have absolutely no way of testing this without actually buying a Mac. Which is somewhat annoying.
Other than the various CSS problems which will hopefully be sorted out soon, there has been a lot of praise for this new browser. And Apple made it so it must be good (somewhat of an "in-joke", please ignore).