Download: alpha 5
I’ve released the next alpha of BFBC2 to address issues with alpha4. Exception handler code has been added which should me debug tripwire’s problem. The regex has been updated to include server names with !s in them.
Alpha 4 download Browse source It turns out that creating UIs in Visual Studio is really easy. I created one for BFBC2FavouriteManager, so it now actually lives up to its name; it can now manage your favourites. Here’s a screenshot:

The only thing missing now is that I’d like to add some signalling to the program so that the manager knows to reload the list when the link handler adds a new server. The link handler operates as a separate process, so I’m going to need IPC of some kind to achieve that. Outside of that, I can’t think of any other features to add. I’m open to suggestions.
Alpha release: download
It’s painfully difficult to add custom servers to Battlefield Bad Company 2. There’s no support for directly connecting via IP, and the server browser has a tendency to fail. Fortunately, the server strings for favourites and history are saved in a easily-parsed plaintext ini file, so it’s possible to hack in new servers to your favourites.
I’ve written this program to help make that process a little easier. It registers the bfbc2:// URI protocol, and when you click on a properly formatted link, it’ll automatically add that server to your favourites. Hopefully this will make sharing servers a bit easier on everyone.
The current release is alpha! Use at your own risk! It has nothing fancy like installers or icons! Read the readme in the archive for more information. I’m sure even this minimal program has a handful of bugs. Let me know what they are so I can fix them. I expect to see my regex reject a few server strings that are actually legit.
.NET 2.0 is a minimum requirement. If you don’t have that, you might as well get .NET 3.5 SP1 while you’re at it.
Anyway, here’s some sample links:
Reddit Unofficial Gaming Community- Chicago
—o Narwhal o— Ranked Rush 24/7
Hals n’ Pals - Mature Gaming Community
The regexp of horror is complete. I ran into some truncation problem with the ini library that I grabbed yesterday, because the buffer was too small. Thanks to the mercifully good debugger in Visual C#, I was able to track down the source of the truncation bug pretty quickly. The problem was that the author of the adaptor only allocated a buffer of 255. I’ve increased the limit to 2k, which should be way more than anyone should ever need (famous last words). It should be possible to test if the buffer was large enough, so I can probably future-proof the parser at some point by adding code that will dynamically increase the buffer size if the initial amount is too low. I’ll come back to that later.
I think the alpha is complete. Next on the list is to run some preliminary testing. Once that is done, I’ll make a source and binary release to the community.
Reddit Unofficial Gaming Community
Registration of the bfbc2:// protocol is now complete. Now on to the real part of the program. I also found a chunk of C# code that will bind to the win32 INI parsing functions, since .NET doesn’t have something built in for it. The next step is input validation. Here’s a sample server string: 3363010643,b652b484-4188-42ea-8885-50fc4991af5b,Reddit Unofficial Gaming Community - Chicago; As far as I can tell, the format for the server string is three fields separated by commas:
First day of haxpact report: I’m planning on making a favourite server manager for Battlefield Bad Company 2. The ingame server browser has a crappy UI, and has a tendency to just fail. For example, there is a well known bug where pings simply do not show up in the server browser. Makes it challenging for me to find a good server. Also, adding a server to the favourites list doesn’t work from the global list for me. It just locks up forever. Fortunately, the favourites list is saved in a fairly simple format in BFBC2’s configuration file, called GameSettings.ini. I can modify this file to add favourite servers manually, as long as I have their identification string. What I’m aiming to do with my haxpact project is make a program that is bound to the bfbc2:// uri; the config information can be hosted on webpages, and people can simply click on a link to add the server to their favourites. At first, this is all the program will do. Perhaps in the future I will add a GUI that will allow people to export their favourites, reorder their favourites, etc.
TL;DR:
ls [source] | rsync -a --exclude-from=- [source] [dest]
I’ve recently been working on setting up a backup solution for my various computers. One of the things I wanted to do was backup only my program settings. In unix-like operating systems, these are usually stored in the user’s home directory, with a . in the beginning of the filename. This denotes that the file is hidden by default.
Rsync is a utility that is used to copy files from a source to a destination, optionally over a network. It is great for backups since it checks the contents of the files on both sides, and only sends the (parts of) the files that have changed.
Rsync can be a bit cumbersome to use, and I searched google for a while and even asked in their IRC channel for help. I couldn’t figure out how to make rsync select only my dotdirs. I figured it out today.
The command is:
ls [source] | rsync -a --exclude-from=- [source] [dest]
How it works: by default, ls only shows non-hidden files. So, the command ls builds a list of files and directories that are not hidden - a list of everything I don’t want. I pipe that to rsync -a (a is for archive). —exclude-from usually operates on files, but when you give it a - as a filename, it reads from stdin instead. In this case, stdin is the listing of stuff that I don’t want, piped from ls. Works perfectly.
Scenario: I’m using an everyday modern GUI file manager to copy a huge file to my portable harddrive. A few minutes later, while the first transfer is still in progress, I realize that there were actually two huge files I want to copy to my portable harddrive. What are my options? I could copy the other file right away, or I can babysit the file copy and copy the second file when the first one is complete. The disadvantage to the first option is that the files copy in parallel. Harddrives operate best when used sequentially. Copying the files in parallel reduces the total rate at which data is copied to the harddrive, thanks to the head having to jump around to different parts of the disk. The total time of the operation is significantly increased. The disadvantage to the second option is that I have to sit here and babysit a process that should be automatic. I’m just copying two files. What if my two files would take 15 minutes each to copy, but I want to do something that is going to take half an hour, and then come back and collect my portable harddrive and then leave immediately? Another similar scenario: I want to copy two huge files to the same destination, but they’re in different source directories, meaning I can’t select both of them at once. The solution? I think a queue would work nicely, but while solving one problem would introduce several others:
I’ve picked up starcraft fever again. And, I’ve started watching professional games out of Korea.
For all of us non-Koreans, we’re able to get the videos in VOD form; that is, someone records the match from TV and posts it to the internet for the rest of us. However, these matches are almost always commentated in Korean. They’re still exciting to watch, but the commentary adds a lot to understanding why the players are playing how they’re playing.
Fortunately, GOM TV has started to provide internet-only english coverage of their tournament with tasteless, an American starcraft progamer. This is available in both a live format and as a series of recorded videos after the match (VOD). Also, there are a number of excellent amateur commentators that provide english commentary over top of Korean VODs, from sc2gg.com.
Obviously, I want to follow these games, but who wants to visit a bunch of sites just to keep up to date in this day and age of RSS? SC2GG’s aggregation is particularly bad: they only link to the individual commentator’s youtube pages and leave it from there.
Enter Yahoo! Pipes: a very handy web 2.0 mashup tool thing. It provides a method of aggregating and manipulating several different types of sources on the internet, but in my case, RSS feeds were available for everything, so my sources are all RSS. What I did was combine all of the youtube feeds for each SC2GG commentator, and GOMTV’s coverage, filter out non-starcraft entries, cut off entries from longer than a week ago, and sort the whole thing by the date it was published. The result: a RSS feed of Pro Starcraft games with English commentary. Or, you can view the Yahoo! Pipe itself, which allows you to get the output in several other formats, or take a look at the internals of how the pipe works, as long as you have a Yahoo! account. Pipes are pretty cool.
If anyone knows of any other sources of English commentary for Starcraft, let me know, and I’ll work on incorporating it into my feed.
I ran into a tiny poorly-documented problem with Firefox and jquery. I’m developing a website using XHTML 1.1 Strict. This causes firefox to barf with a semi-helpful parsing error when the page it loads is not valid XML, instead of the usual behaviour which is to guess at what the developer meant and make and display a DOM tree anyway. This can be nice to help you validate as you code. What it doesn’t handle well is when the changes you make to the DOM tree are not valid. I’m also using jquery in my page, and if you screw up your XML, you’ll get an almost useless error in your javascript console:
uncaught exception: [Exception… “Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]” nsresult: “0x80004003 (NS_ERROR_INVALID_POINTER)” location: “JS frame :: http://yourserver/include/jquery.js :: anonymous :: line 11” data: no] Line 0So, viewers who are hopefully finding this page via google: if you are getting this error when modifying the DOM tree with jquery, and you’re using XHTML 1.1 Strict, then you’ve probably screwed up your XML.