Google Analytics

Tuesday, December 20, 2005

Team Fortress Theme Song

After years of on-and-off searching I finally managed to discover what the song was that the TF guys used in the opening demo of their insanely popular Quake mod.

It was from a collection of songs known as the Carmina Burana by Carl Orff. The theme song is number 5: I Primo Vere - Ecce gratum. Apparently Primo Vere means "In Springtime" or "the first Spring". Ecce gratum roughly means "behold, the pleasant (Spring)". If you're interested you can view the lyrics (with translation -- I know my Latin is pretty rusty).

It was great to be able to finally hear the song in something of greater quality than the woefully encoded wave file included in the TF package. The song brings back a lot of memories and I've blogged the details here in the hope other people will be able to find the song and experience the same thing.

If you happen to have the right plugins installed, the song can be found at http://media.putfile.com/05-I-Primo-Vere---Ecce-gratum. If you don't have the right plugins, you might be able to listen to it by trawling the HTML source code ;)

Tuesday, November 15, 2005

Goodbye Sony

I owned a Sony walkman. It was good. Sometime between then and now something went very wrong over at Sony.

To cut a long story short, Sony's music CDs intentionally infected people's computers. It opened up gaping security holes in the operating system (Macs too), let people cheat in online games, reported back to Sony the songs you were listening to and even got on Microsoft's bad side (of all companies!).

Why? To protect their copyright.

If that wasn't enough (and for any sane person it should be) it has been discovered that in the process of "protecting their copyright", Sony has violated another group's copyright! They used some software that is released under an open source license in their application, without complying with the (very liberal) conditions of its use. Essentially, they are hypocrites to boot.

I have a friend who has decided to boycott McDonalds, in order to do his part in not supporting evil corporations. Well, it's time for me to add Sony on to my black list.

Update: It seems Sony have officially apologised and released a list of affected titles. They are allowing people to replace their rootkitted CDs with normal ones too. It's great that they're doing this, but it only happened after the uproar became deafening -- they should have done it earlier.

Thursday, November 10, 2005

Resident Set Size in Mac OS X

A process lives in its own segment of virtual memory. Not all of this virtual memory is in RAM though. The 'bits' (typically called 'pages') that are in RAM make up what is known as the resident set size (RSS) of a process. As a process runs, the active parts need to be brought into RAM, becoming part of the RSS. Unused pages may be removed (discarded completely or written back to disk if they've changed from the on-disk copy). It's up to the operating system when to do this. Usually when the system is low on physical RAM the OS will start removing pages.

You can view the RSS of a process on most Unices (Linux, Mac OS X included) by bringing up a terminal and going ps -o pid,ucomm,rss (it will probably be given in kilobytes). Or, try the popular top program, which may report it under the heading of 'RES' or 'RSIZE'.

For my thesis I needed to write a program that did some stuff and reported its effective memory usage at the same time. I also had to get it to run on several operating systems. OS X posed quite a challenge as it has no /proc pseudo file system. I couldn't simply open a file and pull out the right number.

After a heck of a lot of digging I eventually found this and this and this, not to mention the source code for the ps utility itself (yay OpenDarwin). This got me pretty close, and took me forever. However, it wasn't until I found a document in Google's cache (that 404'd when I tried it) by Chaz McGarvey that I got over the line.

Here's the code:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <mach/task.h>
#include <mach/mach_init.h>

void getres(task_t task, unsigned int *rss, unsigned int *vs)
{
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;

task_info(task, TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
*rss = t_info.resident_size;
*vs = t_info.virtual_size;
}

void memcheck()
{
unsigned int rss, vs, psize;
task_t task = MACH_PORT_NULL;

if (task_for_pid(current_task(), getpid(), &task) != KERN_SUCCESS)
abort();
getres(task, &rss, &vs);
psize = getpagesize();
fprintf(stderr, "RSS: %u KiB, VS: %u KiB.\n", rss, vs);
}

And that should report the RSS and total VM size of the current process that invokes this code (in bytes). It's probably not perfect (it should have more error checking) but hopefully it will get me by.

Wednesday, November 02, 2005

How to install the Luxi Mono font in TexShop

I've just spent way too much time trying to get this font installed. I wanted to install it as it was recommended by the Listings package (PDF) for LaTeX as the font to use if you wanted your code listings (a) in a monospace font (who wouldn't?) and (b) able to be in bold type (for highlighted keywords, etc.).

I found the LuxiMono package on CTAN, then tried to figure out how to install it for ages, then finally came across this post from the Mac-Tex mailing list describing the process for another font package.

The secret is putting everything in ~/Library/texmf/. I think it's just quickest to dump a tree listing of what I have there:

.
|-- doc
| `-- fonts
| `-- luxi
| |-- LICENSE
| `-- luximono.txt
|-- dvips
| |-- config
| | `-- ul9.map
| `-- luxi
| `-- ul9.map
|-- fonts
| |-- afm
| | `-- public
| | `-- luxi
| | |-- ul9b8a.afm
| | |-- ul9bo8a.afm
| | |-- ul9r8a.afm
| | `-- ul9ro8a.afm
| |-- map
| | `-- vtex
| | `-- ul9.ali
| |-- tfm
| | `-- public
| | `-- luxi
| | |-- ul9b8a.tfm
| | |-- ul9b8c.tfm
| | |-- ul9b8r.tfm
| | |-- ul9b8t.tfm
| | |-- ul9bo8a.tfm
| | |-- ul9bo8c.tfm
| | |-- ul9bo8r.tfm
| | |-- ul9bo8t.tfm
| | |-- ul9r8a.tfm
| | |-- ul9r8c.tfm
| | |-- ul9r8r.tfm
| | |-- ul9r8t.tfm
| | |-- ul9ro8a.tfm
| | |-- ul9ro8c.tfm
| | |-- ul9ro8r.tfm
| | `-- ul9ro8t.tfm
| |-- type1
| | `-- public
| | `-- luxi
| | |-- ul9b8a.pfb
| | |-- ul9bo8a.pfb
| | |-- ul9r8a.pfb
| | `-- ul9ro8a.pfb
| `-- vf
| `-- public
| `-- luxi
| |-- ul9b8c.vf
| |-- ul9b8t.vf
| |-- ul9bo8c.vf
| |-- ul9bo8t.vf
| |-- ul9r8c.vf
| |-- ul9r8t.vf
| |-- ul9ro8c.vf
| `-- ul9ro8t.vf
`-- tex
|-- context
| `-- pdfsync4context.tex
|-- latex
| |-- luxi
| | |-- luximono.sty
| | |-- t1ul9.fd
| | `-- ts1ul9.fd
| `-- pdfsync.sty
`-- plain
`-- pdfsync.tex

26 directories, 43 files


Then the magic command is sudo updmap --enable MixedMap ul9.map. You may need to be in the dvips/luxi dir to run that. Also, just in case you're getting confused, the .tex, .vf, .ali and .tfm files were either already there or auto-generated.

To take advantage of the font, I just added
\usepackage[scaled]{luximono}
to my LaTeX document, and it automatically became the default \tt font for it.

I hope this alleviates headaches for some others out there!

Tuesday, October 25, 2005

WoW Adventures Volume MCXVII

So I've been leveling an alt, a dwarf warrior. I have to say, I used to think a warrior would be the most boring class -- but I'm finding it awesome! I love the idea of being the person in charge of making sure I'm the only one who gets hurt.

I played a number of Warsong Gulch games last night, which prompted this blog entry. I played about three or four games. Every time I played I topped the Alliance ladder, and around half the time I topped the combined ladder. Of course, the ladder ranks you by number of killing blows, which is not a true indication of everyone's contributions (boy did I recognise that when I PvP'd as a priest). We actually won one of our games as well -- which in my books is a huge achievement as the Horde generally dominate PvP. Especially WSG. Below are a few highlights:

When running over to the Horde base I saw a rogue off in the distance heading towards ours. As I got closer he stealthed. I took a guess at where he might be and tossed some dynamite there. He was barely in the blast radius, the damage he took causing him to unstealth. I charged him and it was all over shortly :)

I was involved in a side-skirmish one on one with a hunter in my base. His stupid pet was gnawing away at me but I ignored it. It was fairly evenly matched, yet as we both started getting low on health my hamstring debuff ran out on him (oops), so he wing clipped me and started to run off (his pet still drawing me closer to death). Realising a chase would eventually end in my death, I cocked my rifle and shot him in the back. He fell down face first into the ground, his pet disappearing. I was quite lucky as he still had 5% health. The shot barely killed him.

Both teams held each others flag. The Horde carrier was hiding somewhere unknown. At about the same time, someone found the Horde carrier (a rogue) but was by himself, losing the battle, and our flag carrier died, returning the Horde flag back to its base. The player who lost to the rogue was smart enough to notify us and click the map, indicating the hiding spot. Using tab selection I managed to find the rogue and take him out, returning our flag.

I proceeded back to the flag room and grabbed the returned Horde flag and started running back to our base. By then I had a few helpers with me, and it wasn't long before we ran into what seemed like the entire Horde team heading back just to kill me. There was an epic battle where I was running around like crazy, managing to take out people along with my friends, with a druid and priest managing to drop heals on me too! Eventually we thinned them down and I made a run for it, drinking a health potion to increase my chances. By the time I got back to the base our flag had been taken, so I had to camp. The druid stayed with me for a while, but then went off to help get a return.

It was tempting to drop concentration, but I kept at it (camping is hard because it's boring). Eventually a lone Horde rogue unstealthed behind me and started getting stuck into me. I immediately started running around him in circles so he wouldn't be able to see my back very well. He got my health down quite low but I took him out. I then requested some backup and the druid and a hunter came back for me.

Soon after our team managed to return our flag, but some horde were reading to grab it again! As soon as it was returned I ran a few metres to cap it, but there is a slight delay (as I discovered). I need to stand there for a few seconds before it will register as a cap. As I was standing there a Horde player ran through me and grabbed our flag right from under our nose! Reinforcements came in just in time to help us take him down, but another Horde grabbed the flag in the exact same fashion straight after! Eventually we got on top of things and I was able to make my first WSG cap!

We started that game losing 0-1 but came back to win 3-1. My cap was our number 2. The game was lengthy -- I think I got over 100 honourable kills in that one alone.

It's almost tempting to leave this character at level 19 just for low-level BG PvP purposes! Suffice to say, I have discovered warriors are fun.

Monday, October 24, 2005

Thursday, October 20, 2005

Tuesday, September 27, 2005

How to get Java RMI going on Mac OS X and Linux

For a subject I'm doing at uni I need to make heavy use of Java RMI. I had a lot of problems getting it running, even when following the simplest tutorials so I thought I would write down how I eventually got it running.

This assumes you're running Java 1.5, which is important as there were significant changes to Java RMI between 1.4 and 1.5.

If you don't have Java 1.5 and you're running OS X 10.4 (Tiger), here's a brief run down on how to get it going:

  • Head over to Apple's Java 1.5 download page and download the DMG.
  • Open the DMG, run the package inside and follow the instructions.
  • While 1.5 is now installed, it has not overwritten the existing 1.4 stuff that comes with OS X 10.4. It also won't be the default. To make it the default you need to change a symlink. Open up Terminal and change the "CurrentJDK" symlink to the 1.5 install in "/System/Library/Frameworks/JavaVM.framework/Versions". That is:
    cd /System/Library/Frameworks/JavaVM.framework/Versions;
    sudo rm CurrentJDK;
    sudo ln -s 1.5 CurrentJDK;

For Gentoo Linux the 1.5 JDK is actually masked for compatibility reasons. I had no problems unmasking and installing it (i.e. my other Java applications still run OK) but your mileage may vary. Here are the steps:

# echo ">=dev-java/sun-jdk-1.4.99" >> /etc/portage/package.unmask
# emerge sun-jdk
(follow instructions given by the ebuild)
# java-config -S sun-jdk-1.5.0.05
# /usr/sbin/env-update && source /etc/profile
(The '#' shell prompt indicates it's the root user.)

For Ubuntu Linux I followed the instructions at https://wiki.ubuntu.com/RestrictedFormats#java.

Now that the 1.5 JDK is installed, let's get a quick, simple (and yes, probably dirty) example going just to prove to yourself that Java RMI can actually work.

Head over to Sun's "Getting Started Using Java RMI" page. Download the three Java files it lists up the top into a directory. Now it's probably quickest to just show shell actions:

$ cd /where/i/download/the/java/files
$ ls
Client.java  Hello.java  Server.java
$ mkdir classes
$ javac -d classes/ *.java
$ tree
.
|-- Client.java
|-- Hello.java
|-- Server.java
`-- classes
    `-- example
        `-- hello
            |-- Client.class
            |-- Hello.class
            `-- Server.class

3 directories, 6 files
$ cd classes/

Now at this point, bring up three terminals. We need to run the RMI registry in one, the object server in another and an object client.
$ rmiregistry

It is of utmost importance that this command is run in the same directory the package is in, (classes/ in our case). This problem had me confuzzled for hours and hours, as the server would just return vague "class not found" errors.

Now fire up the server in another shell.
$ java example.hello.Server
Server ready

Finally, run the client in its own shell.
$ java example.hello.Client
response: Hello, world!

Now wipe your brow and go and get some pizza ;)

Some things to note: Only once the RMI registry has been started can the server run (as it will attempt to register an object with it). Similarly, this example code doesn't check whether the object has already been registered with it, so if you try and run the server a second time without restarting the RMI registry it will produce an error.

Monday, September 26, 2005

Windows: window focus changing with mouse over

I don't normally use Windows, so it's rare for me to post tips on it. However, a friend of mine figured out a way to make my Windows experience a bit more like my Linux experience (well, the way I have it set up anyway).

Rather than clicking a window to bring it into focus, you can hack the registry to have a the position of the mouse cursor change the focus of a window. That is, the window your mouse cursor is hovering over will become the one in focus.

I'll let my friend explain how to do it:

19:19 <@wabz> wohooo
19:19 <@wabz> windows has the feature, its just not in control panel
19:20 <@wabz> if you want to do it, add 0x0001 to userpreferencesmask in hkcu\control panel\desktop

So if your UserPreferencesMask is b0 32 05 80 just change it to b1 32 05 80. If you don't much like registry editing, you can download the TweakUI powertoy and enable the "Activation follows mouse (X-Mouse)" option.

How to waste time in one easy step

I came across a problem yesterday while modifying a Joomla! template. The template I was making was kind of a hybrid of two different ones. One of them started like so:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


That is, the XML declaration followed by the doctype. The other template began:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0" encoding="iso-8859-1"?>


So the doctype and XML declaration were switched. Each template then proceeded to make heavy use of CSS and a mix of <div>'s and <table>'s in a complex layout.

Once I had finished the new hybrid template I then encountered every web developers worst (yet most common) nightmare. The template looked fine in Firefox, Opera and other sane browsers but not in ye olde Internet Explorer. The anomaly it caused is hard to describe. It was a sort of spilling in the rightmost <div> column.

To cut a long story short, I spent hours trying to fix the template and only after I had gone through every piece of the HTML body and CSS did I realised that all that was needed was to switch the doctype and XML declaration so that the XML declaration came first! I had used the template where it came second by chance (where it had no adverse effect).

Back when I started web design in the mid->late 90s Internet Explorer 4 had a much more complete CSS implementation than Netscape 4, and was by far a much more enjoyable browser to make sites for. These days the exact opposite is true, and IE is an absolute headache. Any IE user should do themselves a favour and download Mozilla Firefox right away!

Tuesday, September 20, 2005

Duh.

Some people think I'm smart (although I vehemently disagree, and will often volunteer evidence to the contrary). Having been at uni for a while has obviously put me amongst (actual) smart people. I have been thinking about what things make someone smart. Recently I have liked the idea that someone's intelligence is purely a measure of their ability to focus on a problem. More recently I have been thinking that in addition to focus (what is 'focus' exactly anyway?) it may also be the amount of distinct chunks you can work with in your mind at the same time. After all, if you can only focus on one single chunk you won't get very far.

I've noticed that smart people often tend to be perfectionists. Perhaps not perfectionistic about everything they do, but certainly with at least a handful of things. For example, I have a friend who is an audiophile. At this very moment he is meticulously sorting and annotating the metadata of his outrageously large music collection. He has a keen interest in sound compression algorithms, and will sometimes even use a lossless algorithm to encode his music with.

Like me, he also is very careful about his spelling and can never knowingly leave a spelling/grammar mistake in a piece of writing, even when it's in short, informal communications like IRC or email. Another friend I made back in first year (who was much smarter than I) put it quite succinctly when he said "I just hate not knowing how to do things" (this was in reference to studying for an exam for a university subject).

I hypothesise that perfectionism is actually a notable factor in intelligence (or, at least, being smart). A perfectionist does not like leaving a job half-done. If something is taught to them that they do not fully understand, their perfectionist tendencies will drive them to try and complete the puzzle -- just for the sake of completeness.

I think this tendency/attitude has its disadvantages though. Firstly there is the possibility of wasting time on useless things (such as correcting a spelling mistake in an instant message sent to a friend who could understand the original message easily anyway).

Also, since a perfectionist has a desire to do a complete, whole-hearted job of a task, there may eventually be less of a desire to take on certain large tasks. That is, there is an attitude of "I don't even want to start this project because I know that once I've started it will take a lot (possibly an indeterminable amount) of time to finish it to the standard I would like". Finishing it to a lesser standard is not an option! I have found this happen in a few projects I've needed to do, and I see some of my friends suffer under it too. I think this is at least part of the attitude of procrastination rampant among uni students and postgrad students in particular.

Sometimes the scenario works out to be that the only way to stop the project from taking over your life for months is to do no work on it until the deadline is in two weeks. Then the project has only occupied two weeks of your time, and the excuse that you weren't able to do it to the best of your ability is due to 'external factors' outside your control (namely the deadline).

Finally, I think it can also lead to being overworked, leaving the perfectionist burnt-out and unmotivated. This could possibly spell the end of a person's perfectionist attitude in that particular area (such as studying at university).

Perfectionism isn't like Force-sensitivity -- it comes in varying degrees. Perhaps being *really* smart is knowing when to perfecct something further or when to just let it go.

Monday, September 19, 2005

Reason #924 Night Elf Priests Are In Trouble

One of the things I enjoy about World of Warcraft is that the game is constantly being tweaked and improved (well, usually the changes they make are improvements).

My main character in the game is of the priest class, more of a healer than a damage-doer. Along with choosing a class, you can also choose what race your character is. The race I chose was Night Elf.

Now, all priests in the game have the same spells at their disposal (more or less). One exception to this are two spells called "racial spells". For example, a Human priest has the two racial spells called Feedback and Desperate Prayer. A Night Elf priest does not have these spells, but instead has Starshards and Elune's Grace.

Just before I get to the point of this post, let me explain one more thing. In order for Blizzard (the makers of the game) to try and achieve a good balance between players they have forums where Blizzard representatives listen to suggestions from players. There are some designated Blizzard people that are in charge of 'looking after' certain classes. Their job is to play the character class in many races, talent configurations, and situations -- this knowing the class inside-and-out. Unfortunately for priests, our guy is Eyonix.

Eyonix is renowned for ignoring the priest class, and we have been forced to sit back and watch our abilities grow stale compared with the improvements being brought in to other classes. As priests aren't primarily damage-doers it is probably harder to tell that we're falling behind, but anyone who actually plays a priest regularly can surely tell.

In addition, Night Elf priests have an even harder job than priests in general because their racial spells are very, very poor in comparison with those of all other races. Elune's Grace in particular is virtually useless. Priests have been petitioning for a very long time to have it replaced or modified in such a way as to make it useful in at least some situations.

This feeling was compounded for me today after reading this thread in the official forums. For some reason threads don't seem to last very long there so I will reproduce the relevant bits:

Player: Does anyone else think [Elune's Grace] should be fixed?

Eyonix: Admittedly, I've not used Elune's Grace much at all, as the ranged damage it prevents is seemingly less significant when compared to what my Renew spell or Healing Wave will restore - and with a worse mana to health efficiency ratio. I will try and test the ability out in more situations where it could be taken advantage of, and perhaps ask the class designers their particular thoughts on the ability.

(Emphasis added by me.)

OK, so this sounds great. Maybe Eyonix is actually going to do something that benefits priests for a change. Wait just a second. Healing Wave? I'm an experienced priest yet I don't recognise this spell. Oh! I know why! Healing Wave is a shaman spell!!

If our representative cannot even remember the most basic priest spell (called, unsurprisingly, Heal) what chance do we have?

Thursday, September 01, 2005

Macquarie University Linux Seminar

I'm organising a Linux seminar through the Macquarie IT Society. You can find the details in the relevant blog post and the poster I gimpped up (~150KiB).

We also got a mention in the news! Very cool!

A big thanks to Pia, Jeff and the MITS guys for helping out! Hopefully things will go smoothly and we'll get a decent turn-out.

Monday, August 22, 2005

Official, Accurate Internet Tests

Well maybe not official, or accurate... but they're certainly on the Internet.


My computer geek score is greater than 90% of all people in the world! How do you compare? Click here to find out!


Mechanical Intelligent Construct Hardwired for Assassination and Efficient Learning

Tuesday, August 16, 2005

Fight fire with fire

I saw these guys covered on Slashdot today. I remember a similar tactic used last year that didn't last too long for some reason, but was apparently quite effective.

There are ethical issues on DDoSing spammers, but having thought about it for six seconds, I don't have a problem with it -- assuming you're using your own bandwidth to do it and not your zombie army of trojaned Windows drones :)

Speaking of Windows, they don't have other versions of the software available, but they have provided the source code (good on them). Hopefully we should start seeing some meaningful ports soon.

Thursday, August 11, 2005

Mac laptop users -- switch to Linux!

OK, so maybe people won't be converting in droves. My good friend ctd (who I have had the pleasure of actually meeting a couple of times) just discovered that some genius has managed to get his airport extreme wireless card working under Linux!

This has been the major drawback of running Linux on a modern G4-based Mac laptop for some time. The general rumour is that the Airport Extreme cards manufactured by Broadcom are capable of military-grade wireless stuff (whatever that is). Anyway, they're not to keen to release specs or open drivers for the card, so it has only ever worked on OS X, until now.

While the hack seems pretty experimental, most people who try seem to be having success. Now, can I be bothered going back to a dual-boot system... ;)

Thursday, July 21, 2005

Ping!

It's come to my attention that I haven't really been keeping this thing updated lately. So here are some things I've been up to lately.

I updated my Advogato profile. I'm sure it will come in handy one day.

I have been struggling with (what I believe to be) a bug in glibc where asking for strict ANSI mode gives back invalid code! (More on this later.)

I submitted/fixed a bug with the wmium package in Gentoo but accidentally submitted the bug as being a `blocker' (i.e. highest severity), when I intended it to be simply a normal bug. Woopsie!

I've been slowly getting through some lisp tutorials as I find time, but am still far from competent.

Stay tuned for more details on my glibc tales!

Sunday, February 20, 2005

Lisp Ahoy!

Well after much beating around the bush I finally whipped up my own Lisp function that does something:

(defun mkreverse (string)
(unless (string= "" string)
(let ((tmp (char string 0)))
(mkreverse (subseq string 1))
(format t (string tmp)))))


I'm quite sure there are better ways to print out strings in reverse (considering there's even a built in REVERSE function in Common Lisp) but it's a start.

Sunday, February 06, 2005

Google's in the Stone Age?

I was having a read of this article by Andrew Orlowski. During the course of the article he mentioned:

By the by, you can begin to see Linux has such appeal to Asian manufacturers. It's not because it's particularly good - it's not. In computer science research it's Stone Age technology.

On the very next page he proceeds to say:

Sun too has complex, multithreaded machines in the pipelines, but only Sun, or maybe Google, has an OS that can bounce processes around the world.

Oops, what OS does Google run? -- Oh, it appears to be Linux!