What “The Land Before Time” taught me

17 05 2009

Inspired by the great folks at despair.com

Sometimes there is no Great Valley

Best oldschool RPG ever: Exile III

4 03 2009

Exile III was one of the most amazing, nostalgic games which I still play. It’s based on old D&D character creation, but with some unique differences in skills, etc. The point is that you level up your party while you are exploring the surface world. You’ve been banished to the underground “pit” civilization called “Exile”.

You are an adventurer party which explores the surface, reporting back to your Exile coordinator about the things you find up there.

Things get complicated as the story progresses, but it’s very heavily open-ended in the game play style. You literally go where your little heart leads you, finding out more and more about the surface in a very non-linear way. There are tons of “side” plots that you can discover.¬† As time progresses, cities and towns literally become overrun and sometimes destroyed by the forces at work in the world, keeping you interested in the world you’ve become a part of.

The game came as a trial, which impedes you from travelling further north than an predefined invisible line. I won’t promote pirating a serial key or an EXE patcher, but let it be known that I have seen one of the latter once upon a time, and the game was remade as Avernum (which I didn’t like nearly as much, for several reasons) and so Exile III has been cast aside.

The game comes with a save-game editor, which is pretty sweet. Most of the good stuff is enabled only after registering, but you still get several freebies like “heal hp/mp”, or “make towns forget you” (for those times where you decided to lead an assault on those innocent citizens of the town, thereby invoking the never-dying wrath of the town’s guards). Of course, no game is fun if you cheat your way through it, but at the same time, no game is fun if it is mercilessly hard with no hope for success if you’re ever in a weird jam.

Some notes about the playing the game:

  1. The installer you download from the Spidersoft page is actually more like a self-extracting exe. So, when you run it, it will expand the *real* installer into the same directory, so make a temp folder first and place the “exile3v10.exe” file into it before running it. After extracting run the “INSTALL.EXE” program to begin.
  2. The installer is a bit archaic, and defaults to the C drive, no matter what your main drive is.
  3. The installer can’t install to a directory with spaces or hyphens in its name. It’s no problem though, if you install it someplace easy first, and then just move the installed folder to the spot where you want it (including paths with spaces).
  4. All of the graphics are just bitmaps in the local game directory, so you can edit them to be whatever you want! ūüėÄ This makes for some fun edits, like making one of the characters a giant Yoshi, or something. My personal idea for a character set will be posted soon for anybody to download ūüėČ
  5. Vista and Windows 7 sort of molest the game, so I just set it to run in compatibility mode for Win95, and everything got better.

I guess that’s all for now ūüôā

LINUX: Set root password

31 01 2009

So, this isn’t tough stuff, but any gui-loving user will find themselves in shambles when put in front of a l?[ui]n[iu]x (pardon the regex) terminal. ¬†That is to say that it’s OKAY if you’re good “at computers”, yet you can’t fumble your way around a unix-style terminal.

I recently set up my own headless (no GUI) Ubuntu Linux, 8.10 server edition on an old computer I have lying around. ¬†I decided that making it run Apache and my personal SVN repositories (while doubling as a 160gb backup drive ūüôā ) was a good idea. ¬†Problem is, after I got it all set up, I of course have no decent programs, and suddenly find myself wanting to browse the web on my new server box, to find the appropriate urls to feed to the ‘wget’ command. ¬†And I’m tired of pushing my monitor’s “switch input source” button.

By default, Ubuntu tries to abstract the root account from you by letting you perform “root”-ish operations with your own account, using the sudo¬†command. ¬†But sometimes I just want to be root for an effing minute while I do stuff. ¬†By default, Ubuntu comes with no password on the root account, meaning that it also won’t let you sign in with it directly. ¬†Blank passwords are a no-no.

$ sudo passwd root

^^ that ‘$’ is the intrawebs’ way of saying “this is the start of a unix command-line thingy”. ¬†And that’s the technical term, trust me.

This is actually the command to change ANY user’s password, but it just so happens that you’re changing the root password, so you of course need ¬†the all-powerful pixie dust of the “sudo” command. ¬†If you were root already, or some other empowered user, you would only have to type:

$ passwd USERnameGOEShere

And it would prompt you for the new password. ¬†But again, if you don’t have good enough authentication, it’ll make you do “sudo” in front of it, or be root altogether.

As pointed out by Dave in the first comment below, the “sudo -s” command is a way to obtain sudo permissions for a more extended period of time. ¬†If that’s all you want, then go for it. ¬†But if you’re looking to actually give the root account a password, then you’ve gotten your instructions already.

Java: Count instances of a substring

6 01 2009

Despite my distaste for Java, I work in it every day at e-kiwi (author of software Screen-Scraper).

As usual, I was surprised to find that Java has no easy way to count the number of occurances of a substring within a given String variable. ¬†I Google’d it and was surprised at the first result’s poor coding. ¬†It had a ‘while (true)‘ loop with a goofy break statement tied to a misleadingly-named variable.

Try this:

public int countIndexOf(String text, String search)
    int count = 0;
    for (int fromIndex = 0; fromIndex > -1; count++)
        fromIndex = text.indexOf(search, fromIndex + ((count > 0) ? 1 : 0));
    return count - 1;

Pardon the ternary operator in there, but Java doesn’t like making boolean-casting-to-int easy.

If there are any errors you encounter, just let me know and I’ll fix it. ¬†My use for such a function doesn’t require the ‘border’ cases where substrings are at the beginning or end of the main string. ¬†If you know that you don’t need to match a substring which will begin at the first character of the main string, you can change the ternary part from:
fromIndex + ((count > 0) ? 1 : 0)
to just
fromIndex + 1

Sorry to the dude that I flamed on his blog, but poorly written code is easy to find these days. ¬†Idioms are the way to go. ¬†Java’s slow enough as an interpretted language that it doesn’t need extraneous if-else statements in ‘while (true)’ loops and incessant variable assignment to immutable values.

You might argue that it doesn’t really matter¬†if you lose a few cycles on today’s machines, but programs should be as efficient as possible when it’s worth the time. ¬†You may as well take a few minutes (or even an hour) and figure out the best way to do something. ¬†Forethought with save you an amazing amount of time in the future when you develope real programs and not just school assignments.

Python, MySQL, and a dictionary

19 12 2008

Here is a line in python that should be recorded for posterity…

Some background. ¬†I have a multilingual database where several tables exist. ¬†Each table is named after a particular “vocabulary” for my website. ¬†For instance, there’s a “forums” table for all the terms that are used for pages related to the forums. ¬†The purpose of having this table is so that I have all the needed terms very isolated into a nice¬†hierarchy. ¬†The SELECT * sql would look like this.. (pardon the fake spanish translations)

mysql> SELECT * FROM forum;
| ID                  | enUS                       | es                           |
| Audio Review        | Audio Review               | [Audio Review]               |
| by                  | by                         | [by]                         |
| complete            | completed                  | [completed]                  |
| current             | current                    | [current projects]           |
| dropped             | abandoned                  | [dropped]                    |
| loading             | Loading...                 | [Loading...]                 |
| no                  | no                         | no                           |

As you can see, there is a column “ID”, which is what I use site-wide to access a term, and I select only one other column, according to the language code the user has his/her preference set for. ¬†Thus, a general select for such a thing is …

mysql> SELECT ID,enUS FROM forum;
| ID                  | enUS                       |
| Audio Review        | Audio Review               |
| by                  | by                         |

… etc, etc. ¬†Then, I just used PHP to fetch these results into an associative array. ¬†I would then have to loop through each record, saving whatever is in the $row[‘ID’] spot as a key to this array, and whatever is in the $row[currentLanguage] spot as the value to said key.

So anyway..  I was trying to achive this effect in python; a Dictionary-type object where I can simply index into it with the term that I want, in order to get the language-translated value represented by the term.  I knew there had to be a way to do a famous python one-liner, and since those one-liners typically clock much faster than manual loops..

resultSet = (map(None, row.values()) for row in rows)

Seems simple, but it’s a hassle to work it out when your data is a tuple of dictionaries ūüėõ

Miko’s Blog, straight out of Hamamatsu, Shizuoka, Japan

15 12 2008

One of my interests is languages. ¬†Included in that is Japanese. ¬†Perhaps some of you may shun me for claiming I like Japanese, yet I don’t fit that anime-addicted mold that tends to be the basic framework that Japanese groupies persue. ¬†Truth be told, a person can like, and even love, a language without fitting such a mold. ¬†I prefer not to deign to any insulting level, though, so I shall move on before my tounge starts cutting people.

My wife speaks japanese. ¬†I’ll leave it at that.

Each week I read a blog by a japanese woman named Miko, who has a talent for posting just the sort of stuff that I find interesting… it’s not the web-log (blog) of an uber l33t hackzor with an anime collection to rival those that I would insult in paragraph 1. ¬†Instead, it’s a normal person with normal experience, yet who finds fun things that are (in reality) little jewels of interest. ¬†I think the blog is great ūüôā¬†


Enjoy, if you choose to so do.

Windows Hyper-V Server 2008: Part 1 Clarification

12 11 2008

So, the trouble with “Hyper-V Server 2008″ is that it, by nature, is pretty much a free version of one of the full/pay editions of the stripped down “Server Core” versions of “Windows Server 2008 with Hyper-V“. ¬†In fact, it is so much like a server core version, that I’m just going to classify it right now as part of the server core family.

What are the implications of that accusation? ¬†Well, for starters, don’t go expecting to be able to use Hyper-V from the local machine. ¬†The concept of a server core is that it runs and runs and does its job like bread and butter, but it can only be managed remotely.

…And?¬†¬†you ask. ¬†Managing it “remotely” means that your Server Core can only recieve user interaction from another computer. ¬†This includes installing OSes on top of Hyper-V, and also running those OSes. ¬†In other words, even if you use a nearby computer to install the OS and do the basic setup, the computer that Hyper-V is installed on is now dead in the water if you expected to use the machine locally. ¬†Even though Hyper-V is running your Virtual Machines, there is no way to connect to those VMs visually while sitting in front of your Server Core.

So, if you were a misled hopeful of Hyper-V’s application to you as a virtualization groupie for your sweet desktop at home to run Windows Vista and Ubuntu side by side, then I’m afraid you’ve made a blunder ūüôā ¬†There will be no Visbuntu for you, laddies. ¬†Your only other options are to download and crack up one of the full versions of WS 2008 w/Hyper-V (so that you have a GUI and the management tool right there on the local machine, thus allowing you to run your VMs and interact with them locally)¬†or, alternately, you could use the free edition of VMware Server (I’d recommend 1.x, since version 2 got a little goofy with the interface– it’s webbrowser-based only)¬†or something free like VirtualBox, by Sun Microsystems.

For those of you who want to press forward, you’ll find only minimal documentation on the matter. ¬†You’ll be adding Windows Firewall rules from the command line, etc (the Windows Firewall is on by default in a Server Core installation, and there’s no easy GUI to turn it off with). ¬†And make sure you’ve got a copy of Vista with Service Pack 1 on it. ¬†You’ll need it to do the remote management, once you’ve got the Hyper-V configuration done.