May 08 2008

Dotproject strikes again…

I’m sure I’ve bitched about open source plenty of times, but I have to rant once again. Dotproject is my project management application of choice. It does everything I want, and in particular allows for very awesome time estimation which was extremely useful for Bloodsport Colosseum. I was able to break down every task into subtasks and really get a feel for how much effort was left by looking at the accuracy of past estimates.

But it’s programmed by idiots. I mean, these guys are actually pretty stupid compared to the average rock. I’m sorry, it’s a great tool designed by somebody who had a head for project management, but programmed by idiots.

After not using dotproject for a while (after the death of bloodsport colosseum, I had little to track), I got a contract job that really needs careful design. So I jumped back into a semi-recent version of this awesome/disgusting app, and found that it uses overlib for popup help! (No, that isn’t the problem. Overlib is actually really nice for web-based hover-help) But the dotproject devs by default chose to make the popups STICKY. That is, when you hover over a link you think is just a link, a popup shows up that will not go away until you explicitly mouse over the “close” button.

This is revolting.

So I know overlib. I’m not phased a bit. I used it for Bloodsport Colosseum and it’s really a pretty straightforward JS library (a rarity these days). It’s open source, so it probably sucks monkey balls, but as a user of the tool, I liked it.

Overlib has a central area to put all your app’s default preferences for things like font, colors, opacity, and, of course, sticky. To override the defaults, you can actually specify “commands” in your call to the overlib methods, which is handy for special cases.

The dotproject dimwits actually ignored the defaults altogether, and put the exact same preferences into their HTML in seven different places. I’m not sure what can happen to a programmer where they learn the number one failing of software. The first thing you learn in your first CS class is about code reuse. Functions, code centralization, that sort of shit. HOW can somebody be so stupid as to ignore these amazingly simple principles when the library already provides a really easy and central place for this stuff?

Then I remembered my first dotproject disaster - an old version had some broken SQL for calculating the % left on a task, and to fix it I had to change this SQL in 3 or 4 places, and rewrite a couple rather large sections of code.

No, that memory didn’t comfort me, but at least I was able to say, “Oh yeah, they’re just dotproject developers. They didn’t know better.”

No responses yet

May 03 2008

Twilight of the Arnor officially released!

Published by Nerdmaster under Games, Opinions

All right, I’m a couple days late, but one of my all-time favorite games, Galactic Civilizations 2, has just released what I believe to be the most impressive expansion pack ever, Twilight of the Arnor.

I’ve played with the beta a bit, but now that it’s officially released (and the weekend is here), I am hoping to dig in a whole lot more, play some metaverse games, and maybe even tinker with the editors.

Why would you care about this release? Read on:


GalCiv2 is a 4X game (think of Civilizations, Age of Wonders, Heroes of Might and Magic, etc). These kinds of games have traditionally been somewhat complex, turn-based strategy games. Think of a game like the board game Risk, but with a whole lot more details, rules, military options, diplomacy, randomly-generated maps (or at least a large collection of hand-crafted maps), etc.

The biggest issue with games like these is there are so many options at every point of the games that a computer cannot effectively plan out a smart strategy. Most games give the computer cheats - free resources, “good luck” bonuses when attacking or defending territory, free military units, the ability to see the player’s private data, and so on. This is frustrating to a player, because instead of playing against a human-like opponent, she’s playing against what amounts to a really stupid cheater. The cheater isn’t playing by the rules, yet still really sucks at planning a long-term strategy.

Stardock, at least starting with GalCiv 2, doesn’t believe the AI should need to cheat. (In GalCiv1, the AI got a free peek at the galaxy, giving it a tremendous advantage when choosing where to colonize and such) Additionally, the AI is built with the philosophy that it should play like a human, so at various difficulty levels, the strategies actually vary. When you play against a “cakewalk” set of AI opponents, they will have fewer strategic options available than when playing against “normal”, which itself has fewer options than playing against “tough”. This amounts to a much more immersive single-player game.

The other thing that tends to plague most 4X games is repetition. Even GalCiv1, and to a lesser degree, GalCiv2, suffered from this problem. The thing is, all playable situations eventually amount to the same general approaches. In Civilization III, you have a couple civ-specific military units, and some bonus depending on your empire’s specialties, but overall very little is different from any one game to the next: you research the same technology, most military units are the same, cities build the same improvements, etc. The heroes series is a tiny bit better, as each faction has a semi-unique city and units, but even so, the game is so simple that the differentiation doesn’t change the repetitive play.

I love both of those games, but I cannot deny their inherent problem. And as I stated above, even GalCiv2 (even with the Dark Avatar expansion) suffered from this issue. Dark Avatar made each race a bit more unique with the Super Abilities, but overall strategies, technologies, and planetary improvements were all shared.

Twilight of the Arnor throws this all away. What GalCiv2 did for the belief that all 4X AI has to suck, Twilight of the Arnor does for the belief that repetitive play is just a part of the 4X genre. Every single race (there are twelve, mind you) has its own technology tree, planetary improvements, and to a lesser degree, ship modules. The tech trees have many common elements, of course, and some races are very similar to each other. The Korath, for instance, are an offshoot of the Drengin, so their tech trees are naturally very similar - but there are still a few differences, and the already-present racial attributes and super abilities make even those two situations a bit different. When looking at the Humans and the Thalan, on the other hand, the trees and overall strategies are so different that it’s like playing a totally separate game.

Here are some of my favorite examples:

  • The Korx are mercenaries, and as such have a Mercenary Academy, available from the Mercenaries tech, unique to them. When the academy is built, they get a bonus to their income equal to 2% of the tax revenues of all warring civilizations.
    • In Dark Avatar, the Korx are described as mercenaries and war profiteers, but you only feel that when role-playing. In Twilight, you see a direct, in-game benefit to manipulating people into war.
  • The Arceans have a lot of trouble with space travel. Their ships default to moving at a rate of 1 parsec per turn (normal is 2 - this is a HUGE deal early game!), and they cannot develop the technology to use advanced ship drives, severely limiting their speed late game. They can trade for the technology (which I dislike, but that’s a separate topic), but if it’s entirely up to them, they’ll never learn it. To compensate, they have a few technologies that give them a “free” bonus to ship speed (research tech, instant bonus to all ships), and the ability to build navigation centers on their planets which give all ships built on that planet another “free” bonus.
    • This alone is a huge strategy change - you either trade for the techs and play a “normal” game, or you just live with slower ships. One interesting aspect of this is that you will have a lot more space for weapons, which is great given the existing Arcean Super Warrior ability.

Assuming this wasn’t enough, Twilight sports a ton of other features I can’t even try to explain. Amazing modder tools are finally included, “static” tournament scenarios, the new Ascension victory condition, terror stars, …

If you’ve never heard of GalCiv2, but you like 4X games, there is no better time to try it out.

No responses yet

May 02 2008

Phusion Passenger - first impressions

Published by Nerdmaster under Programming, Ruby on Rails

Okay, as I recently mentioned, I’m tired of Mongrel for my Rails apps, so I’m going with Phusion Passenger.

The install was actually tremendously more difficult than they claimed, but I attribute that to my own lack of smarts. I am running on Debian, and installed ruby via the source, but had another version of ruby I’d installed via apt-get (it’s over two years old, hence my desire to install from source), and libopenssl-ruby also installed via apt-get. Somehow or another the ruby I installed from source didn’t pick up openssl support, but debian thought it was there, so when Phusion Passenger’s install told me Just type ‘apt-get install libopenssl-ruby’, I got frustrated fast…. I removed the packages and reinstalled ruby from source and all seems to be well now.

Another minor issue, and one I still don’t fully get, is that while Passenger is supposedly running as my main user, it can’t seem to read things that aren’t world-readable, even if I am the file’s owner! A few permissions tweaks (chmod -R 755 app_dir did the trick, but I’m not sure it’s the best idea) fixed this, but it was still a small point of confusion.

The really interesting issue with Phusion Passenger is that if you’re security-minded like I am, it does not work. My base Apache config includes this:

# Tighten access to the file system.
<Directory />
  # Forbid default access to file system locations
  Order Deny,Allow
  Deny from all
  Options -Indexes
</Directory>

Well, I’m a dummy, so I don’t realize why my Passenger-driven apps are “running”, but unable to access their javascripts, style sheets, images, etc. After a long while of searching, I found that the errors were happening because my default behavior was to disallow everything from being viewed. The really bad part here? It’s clearly spelled out in the troubleshooting section of their guide….

Now, in a normal Rails app, the Rails code handles static files, so you can keep your blindingly-high security in place. But Passenger is meant to be speedy, and letting Apache just serve static content directly is way faster than letting Rails do it.

So to fix this, one just has to say that the given app’s directory is allowed to be viewed:

<Directory /path/to/rails/app/public>
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

The following of symlinks and AllowOverride settings are of course a matter of personal preference and security, but you must have the other two lines to let Apache server your static content!


Okay, I’ve had things running for a few hours now, and I’m having a few weird issues. One time when I restarted apache, Passenger simply didn’t start up for some weird reason. A new Rails app I built kept thinking it had bad permissions - I reset the whole dir tree to 777, then 755, then all was well again for no obvious reason. (Yes, I had already set it to 755. I think. Maybe.)


So aside from these issues (which are hopefully just due to my almost nonexistent linux admin experience), so far I’m liking Passenger. I have no idea how it would handle a traffic spike or if it has issues with rarely-used apps, but its Rails-centric approach makes it much nicer for a dummy like me to use. Configuration is a breeze, it auto-spawns and auto-destroys Rails processes as necessary, keeping me from needing to manage memory, it spawns the Rails framework separately from the app, allowing a huge memory savings on multiple apps that use the same Rails version, and it has a really helpful memory stat tool to see how much my apps are really hurting things.

Only the coming months will tell if it’s as solid as Mongrel usually was, but even if it’s only as good (i.e., crashes for no obvious reasons once in a while), I’m sticking with it for its nice configuration options.

No responses yet

May 02 2008

A new day, a new blogging app

Typo seems cool to us Ruby on Rails jerks. Because it’s Ruby on Rails. It has sexy live searching. Um… and like… did I mention it’s Ruby on Rails?

So… yeah. After the thing sucking time and again, and eating too much memory and having funny stability problems, I’ve given up. I have enough annoyances with Ruby on Rails apps (I truly hope mod_rails helps here - stay tuned for my upcoming first impressions) that I wrote myself - no need to make things worse with badly-built open source.

So here I am on Wordpress. I’m willing to bet it’s just another badly-build open source app. The difference, though, is it’s been around the block, and seems to have some stability under the hood. It wasn’t written with the “do what’s cool right now!” approach - it has been more geared toward functionality. So as much as I despise PHP, I can’t deny that this app is much nicer to deal with than Typo ever was. Even the conversion of my old articles was about a 10 minute process, thanks to Will Bridges. And with some minor tweaks, I now have a (hopefully) nicer URL structure.

Yeah, I’ll lose some SEO in the mean time - major site change, loss of something like 50 old URLs, but hell, it’s time for something that isn’t a headache.

No responses yet

May 01 2008

I’m sick of Mongrel

Published by Nerdmaster under Opinions, Ruby on Rails

I’ve been running my Rails apps (this blog as well as Bloodsport Colosseum) via mod_proxy and mongrel. Run a mongrel server at a given port, tell Apache to redirect a given virtual host to said port. Takes a lot more knowledge than a noob like me has, so even though it’s better than dealing with fastcgi + Apache or lighttpd, it’s still annoying.

Once I got it up and running, however, I figured it was good enough - everything worked, so all was well. Until I had apps that weren’t hit very often. Bloodsport Colosseum is hit pretty regularly, and this blog seems to get pinged by random sources all the time, so both worked well. But my now-deceased fanmail app (granted it was really far too simple to warrant the RoR framework, but that’s a whole different story) was hit maybe every few days.

Mongrel did not like this for some reason. It seems that any app that isn’t getting regular hits just dies after a while. I read somewhere that it was mysql’s fault, closing the socket or something like that. Interestingly, my PHP apps that use mysql don’t have that problem, and on my last server (privately hosted by a friend and using fastcgi), my Rails apps didn’t have that problem.

Okay, fanmail app was kind of unnecessary anyway - I can just put my smart and not at all fat fan’s letters of praise on the main site, run via PHP, and that’ll be good enough.

Then I for once blogged a popular topic - the Network Solutions “scandal”. I was actually #3 on google for the search “network solutions domain name front running” for a little while. But the next day when I checked how things were going, I noticed that mongrel was “running”, but not responding, much like what I saw when an app wasn’t hit regularly. The process list would show a mongrel process using almost no memory (very atypical of a Rails app), and Apache would give an error that the proxying couldn’t happen. So the one time I’m really getting visitors (About 100x normal traffic levels for my shitty blog), within about an hour mongrel had decided it had enough.

I don’t believe mongrel can’t handle large traffic loads, I just think my lack of skills combined with mongrel’s funky behavior problems caused issues.

All in all, I’m tired of that - Mongrel keeps misbehaving, and I’m DONE. Time for something new. I’m trying out Phusion Passenger tonight and we’ll see how it goes.

No responses yet

Apr 25 2008

If you’re not smart enough to program, don’t write a programming guide

I can’t believe this. Simply amazing.

I really can’t.

I’m not even sure this is good enough to fall under my usual “Awesome Software Discovery” banner.

So I work at a place where we use Ruby and Perl a lot, right? The above site is supposedly a “conversion” of O’Rielly’s Perl Cookbook into Ruby. Good idea. But here’s the thing - if you don’t know your ass from a hole in the ground, maybe you shouldn’t be writing a programming guide. Maybe. I don’t know. Am I being too harsh?

The introduction shows this example:

# $defout (or its synonym '$>') is the destination of output
# for Kernel#print, Kernel#puts, and family functions
logfile = File.new("log.txt", "w")
old = $defout
$defout = logfile                 # switch to logfile for output
puts "Countdown initiated ..."
$defout = old                     # return to original output
puts "You have 30 seconds to reach minimum safety distance."

There is no fucking excuse for this kind of programming style. Even a total noob should look at this and say, “What the fuck?”

  1. Yes, sometimes you need to redirect output or errors to a file… but the introduction doesn’t explain that this is an exception rather than a rule.
  2. Redirecting $defout is very dangerous if the developer doesn’t fully understand 100% of what they’re writing, and the libraries they’re using. (And if they need a perl-to-ruby cookbook, chances are they don’t understand 100% of what they’re writing)
  3. Maybe I’m misreading something, but isn’t it significantly safer in an app more than 3 lines long to call .dup on $stdout / $defout when saving the old value? (The answer is “yes,” for my less astute readers)

In any case, here’s how you write to a file in Ruby without making the guy who reviews your code cringe and then stab you in the fucking eye (note that it’s not only safer, but also easier to read and generally doesn’t make you look like a moron):

# $defout, $stdout, and other magic variables are NOT TOUCHED!
logfile = File.new("log.txt", "w")
logfile.puts "Countdown initiated..."
puts "You have 30 seconds blah blah I'm a monkey licker."

Neat!

No responses yet

Apr 24 2008

AutoIt fans rejoice! New version of myAutToExe available!

Published by Nerdmaster under Programming, Security

As I previously mentioned, I like AutoIT a great deal, but I like decompiling other people’s stuff even better. Just a couple days ago, the genius who brought us the only 3.2.6 decompiler released a new version, 2.2. I haven’t kept up like I should, but if cw2k ever gives me the okay, I’d gladly keep up a mirror as he releases new versions. For now, at least, I’ll just try to remember to check back regularly and grab the latest versions.

So if you want my local copy of myAutToExe 2.2, it’s here. If you want to get it from the source, check out either the main forum thread or the actual angelfire site.

Enjoy!

No responses yet

Mar 13 2008

Wait, are you saying those thieves aren’t destroying the world after all?

Published by Nerdmaster under Opinions, Random Shit

I’m a huge fan of Stardock. They kick ass hands down. Galactic Civilizations II, especially with the expansions Dark Avatar and the still-in-beta Twilight of the Arnor, blows away other 4x games that exist today. Civ 4 is so far behind in terms of AI and economic complexity (while still having way too much micromanagement anyway), it’s just amazing.

Then Brad Wardell, CEO of Stardock, has to post this incredible claim that piracy isn’t the root cause for everything bad that happens to us today. Here’s an excerpt of this poor, deluded fool’s insanity:

Blaming piracy is easy. But it hides other underlying causes. When Sins popped up as the #1 best selling game at retail a couple weeks ago, a game that has no copy protect whatsoever, that should tell you that piracy is not the primary issue.

Now many of you out there may fall for this kind of pro-terrorist propaganda, but not me. I’ve seen the DVD commercials that tell me how piracy is just like stealing a car and how it supports terrorism and kills babies and causes hurricanes and the apocalypse is coming early because of torrents. I’m no fool. You morons can go on believing that Hollywood is going to hell because of poor quality movies that nobody wants to pay to see. You can keep convincing yourselves that the record industry is going to be okay and Amazon.com’s DRM-free MP3 sales are proof. And you can say that a game can sell well even if it has no copy protection.

I’ll pray for your souls. I can only hope the very intelligent entertainment companies find a way to not only jail all the pirates (victimless crime my ass!), but also those who spread these filthy, disgusting, dirty dirty lies.

Brad Wardell, you’re now on my “list”. Watch your back, buddy. Watch your fucking back.

No responses yet

Mar 12 2008

Another reason Perl is crappy. Really crappy. REALLY REALLY crappy.

Published by Nerdmaster under Opinions, Programming

I’ve been using Perl professionally for about four years now. I never really loved the language, but I certainly didn’t hate it quite so much before this job.

There are many obvious reasons to hate Perl: * The hacked-in OOP never impressed me much, but gets really old after working on a very large application for a while. * Exporter is evil - being able to pollute somebody else’s namespace just by their use of your module is truly horrific. Most modules are smart enough to only export things as requested, such as use Foo qw|cool_function|; or use Foo qw|:cool_functions|;. But the fact that you can choose to have your module muck up others’ namespaces is terrible. And the fact that there’s nothing akin to the C++ using namespace Foo; in Perl makes it highly annoying to do things the proper way and not pollute your namespace. * The lack of real exception handling is amazing. Look at how the Error module works sometime if you want to be disgusted. The way it works is so awful, and has some really nasty side effects if you’re not careful (like not being able to return from a try “block” because it’s really a function and not just a code block — or how a missing semicolon generates no errors, but can do some incredibly strange things).

But today a more insidious problem struck. I wanted to make a mock class based on the BerkeleyDB class. When we write a unit test, we need to test that our program logic works, not that the BDB class works, right? So I’ll just write a mock, right?

WRONG! The method we use the most is $bdb->db_get($key, $value), and due to the magic of XS bound to C, the second parameter, $value, gets set to the given key’s value. In a normal Perl function, you must send a value by reference in order to have it changed by a function: normal_method($key, \$value). But we can’t change the calling convention for this mock class to work - the point of the mock is to make it a drop-in replacement used just during testing!

So I looked into method prototypes to fix this for me. A method prototype in Perl is a powerful thing that can allow you to “convert” a normal argument into a reference, such that my mock BDB class would be able to keep the same calling conventions as the real one (which is kind of essential for a mock class). So I did something like this:

# db_get takes two or three arguments - the second is by-reference
sub db_get($\$;$) {
    my ($self, $key, $value, $flags) = @_;
    $value = $self->{$key};
    return 0;
}

Beautiful solution, considering how annoying Perl can be. Just one little problem: class methods can not use prototypes. There is no warning, no errors, no indication of what’s wrong whatsoever. The prototype is simply ignored. Silently. After reading the documentation a while, a coworker was able to point out the problem, and I was forced to use the real BDB class instead of a mock in order to complete my unit testing.

I could, of course, write some XS and C in order to get a mock class built, but that’s just an absurd solution to the problem.

I could also write a wrapper and retrofit all our current code to use the wrapper, such that I have complete control of the new API. The new API for the real and mock wrappers could easily be kept in sync. This, however, is even more absurd a solution, because it requires a lot of code to be changed.

That the inconsistent nature of Perl causes such headaches is just one more reason that Perl sucks. A whole lot.


Now to be fair, Perl wasn’t really meant for large-scale applications when first built. But instead of fixing things the proper way, new features seem to be done in a very band-aid sort of way, instead of fixed properly. Perl 6 will deal with a lot of this, but I suspect the conversion won’t be worth it, considering how many better options there are nowadays.

No responses yet

Feb 26 2008

Network Solutions SUED for front running!

Published by Nerdmaster under Opinions

Just a brief follow-up to my last post - looks like those bastards are getting sued for being such pieces of sh*t. SWEET.

I only hope that justice can be served in an appropriate and fair way. For instance, the entire executive team at Network Solutions could be drawn and quartered.

No responses yet

Next »