Programming

Fun with language filters

All MMOs have profanity filters. Usually optional, but always available.

This week I had to look at a ticket about a particular player who was forced to change his name for “no apparent reason.” It turns out his name, his whole name, not a substring, had been added to the profanity filter in the most recent patch, which will cause an automatic rename. The closest translation of his name (it was German) appears to be “rascal”, but obviously more derogatory if someone put it in the profanity list. I’d link you the google translation of the German wikipedia page, but I don’t want to cause the player any grief by posting his (old) name.

Adding actual substring matching to profanity filters is usually a bad idea. You might think there are certain words that are always bad even if they only match substrings. You might even go and add them to the list.

Until your game winds up filtering out “Brightwater Lake”

That happened in beta. Look closely.

Also, the forums used to filter out cockroach.

Tags: ,

Friday, May 25th, 2007 Uncategorized 1 Comment

OS X includes 12 real programming languages

Maybe more. Some of these are only there after you install the developer tools, but that’s still on the included install disc.

  • Perl
  • Python
  • Java (javac is included)
  • Bash
  • Emacs Lisp
  • Javascript
  • Ruby
  • C/C++ (C++ is a superset of C for practical purposes, even though there are a few incompatibilities)
  • Objective C
  • AppleScript
  • PHP
  • Tcl

Even Flex and Bison are there in case you feel like making up your own language.

That’s an incredible wealth of development tools right out of the box (if you count a few extra clicks on the install disc as “out of the box”). Of course, most Unix-like systems like Linux will have all of those languages (except AppleScript) available from the get go too (though I was really surprised and pleased to find Ruby there!) You should expect any modern operating system to come with a similar suite of languages. They’re all free, why wouldn’t every OS maker include them? The more languages you have out of the box, the more likely people are to write software for your OS.

So what does the number one OS include?

  • Javascript
  • Batch files

Sorry if I’ve missed anything there, it’s definitely possible, especially with Vista, which I’m not really familiar with. I think they may have added a new scripting system in Vista. I’m not actually sure if there’s a new language to go with it though, or just more hooks for languages in general. But even if I did miss something, there’s still not much there.

It doesn’t matter as much now that downloading any of those languages is trivial, but I do think it still matters. And Microsoft charges money for their IDEs. If they weren’t the dominant OS, that would be a recipe for disaster. Every other OS maker needs the barrier to entry to development to be as low as possible. I know Microsoft does offer free stripped down versions of Visual C++ et. al these days, and that others sell IDEs and compilers for other OSs, but Microsoft is the only OS maker that also tries to make you pay them even more for the privilege of creating software for their OS. Apple gives you a really good C/C++/Obj-C IDE (not to mention Emacs, the bearded Unix geek’s IDE) for free plus all those other languages to play with.

So anyway, I’m about to start playing around with Ruby to see if it’s something I want to use for future large-scale projects. I’m procrastinating by writing this post. But finding it already installed on my Mac made me think about how great it is having all those languages right there, just in case.

It doesn’t have Erlang though (It did build and run just fine after downloading it). Erlang is another interesting language I might write more about later. Anyone interested in concurrent and distributed processing should at least go read about it. It’s not well suited to a lot of things, I wouldn’t want to write a whole game in it. But there are bits and pieces where it might be exceptionally useful and robust.

Tags:

Friday, May 25th, 2007 Uncategorized No Comments

Antisocial Bookmarking

There are some popular blogs out there under the “Lifehacking” and “GTD” (Getting Things Done) banners. Often, the topics they present border on obsessive compulsive behavior. I feel like following all the advice on those subjects would cost me far more time than it saved me. Just reading about it barely feels like a break-even proposition.

But somewhere this morning, not actually on a blog focused on those subjects, but definitely something they’d be concerned with, I found out about Google Browser Sync, which lets you sync your bookmarks, cookies, passwords, (and history and tab state if you really want, I opted out of those), with your Firefox browsers anywhere. Like, work, home and laptop. Add a bookmark anywhere, it shows up right in your bookmarks menu or toolbar everywhere.

This is something Netscape 4 had built-in, via FTP or LDAP, nearly a decade ago. I ran my own FTP server and used it. It was GREAT. I’ve been waiting for someone to do the same ever since Netscape 4 became basically unviable. Mozilla/Netscape never built it in past v4, nor did any other browser to my knowledge.

There have been other Firefox extensions that sort of accomplish this, but they’ve been based on social bookmarking sites like Del.icio.us. I don’t have anything against those sites, but I don’t actually want to share all my bookmarks with everyone in the world just so I can also have all my browsers present me the same bookmarks. Antisocial Bookmarking has its place too. I’d still prefer to store everything on my own server somewhere, but storing it privately, rather than socially, on Google’s servers is almost as good. And it’s probably even better for most people.

I installed it across all the machines I use on a regular basis, and I’m already feeling like web related things have finally gotten back to where I was eight years ago (when Netscape 4 was already getting long in the tooth and people were giving me funny looks for still using it).

I’d still rather not trust Google to save this stuff for me, but if I’m going to trust any corporation, it might as well be Google. Nevertheless, an implementation of this that let me run the repository on my own server rather than someone else’s would be very welcome. But short of that, this finally does everything I ever wanted.

Tags: ,

Friday, May 11th, 2007 Uncategorized 1 Comment

My phone is now an email notifier

If you send a mail to my “real” email address (not any of the ones I use for businesses and other non-people), it will now get sent to my mobile phone as an SMS. Unless it’s between 1AM and 8AM, then it won’t. Only the first few lines get sent, and it uses the sender’s email address as the sender for the SMS.

I use gmail to read all my mail these days, and I even have their mobile phone app on my phone, so in theory I can even reply from my phone. I set this up because GMail notifier on the Mac doesn’t work if the screensaver is active. Which is when I MOST want it to work. It’s really dumb. I could run Mail.app or some other pop mail program and let it notify me, but I don’t want to just on principle. I couldn’t find a simple pop notifier that worked with gmail.

Plus I figure it’ll be nice to get a notification of “real” email no matter where I am too. At least until I get tired of my phone beeping all the time. Before I switched to gmail, this would’ve been completely unreasonable, but gmail’s spam filter is excellent. I’m not worried about floods of spam making it to my phone.

Update: with a few more real world messages having passed through the system, something bizarre about my cell phone provider’s system emerged.  Any message that contains “href=” at all will not be forwarded to my phone.  “href” is fine, “foo=” is fine, URLs themselves are fine.  But  not “href=”.  So HTML email with links failed.  The fact that it was a spam that made it by GMail’s filter doesn’t mean I wasn’t annoyed that my system failed to work :).  I fixed it now, but I didn’t update the instructions.  That can’t possibly be true for everyone.  I just added a “| sed ‘s/href=/href:/'” into each procmail rule.

Read more for the full MacGyver details

› Continue reading

Tags:

Saturday, April 28th, 2007 Uncategorized No Comments

Puzzle Quest Solver

I figure it’s not cheating when I use this program to solve Puzzle Quest capture puzzles. But if you use it, you’re totally cheating. I wrote the code, that means I solved the puzzle. You, you’re scum.
pqsolver.exe (Get this if you just want to run it)

pqsolver.cpp (Source code, if you want to see how it works or don’t trust random executables off the internet. Builds on Mac, Linux, Windows, probably anything else with a C++ compiler)

Sample input files:

test2.pq (not a real puzzle, just an early test)

OrcLord.pq (Real)

Sandworm.pq (Real)

To run it:

pqsolver < file.pq

The magic values, straight from the code:
case red: c = 'r'; break;
case yellow: c = 'y'; break;
case green: c = 'g'; break;
case blue: c = 'b'; break;
case skull: c = 's'; break;
case skullx5: c = '5'; break;
case xp: c = 'x'; break;
case money: c = 'm'; break;
case empty: c = '.'; break;

The output has the first step at the bottom, last step at the top. Backwards, in other words. Harder to do it the right way around the way the algorithm works. The bottommost board displayed is the initial input, the topmost is the next to last state before winning. Above each board are the coordinates to move to get to the next step.

Updated 11/09/2007 : Thanks to Nige in the comments, the bug with skulls is fixed.  You Rock, Nige!

Tags: , ,

Wednesday, April 4th, 2007 Uncategorized 24 Comments

Corsair 0.2.6

I wrote a RSS reader/podcast aggregator called Corsair a while back. It’s for the Archos PMA400 media player, but is also known to work on Sharp Zaurus PDAs. Archos doesn’t even have a page about the PMA400 any more, so I don’t know if you can even get one anywhere. Too bad, it’s a great little media player for hacking around on.

I released an updated version today. Download page is here.

Tags:

Saturday, November 25th, 2006 Uncategorized No Comments