Friday, May 26, 2006

Fixing Bugs in DIKU !?!?

I believe I managed to fix a crash bug that came from the orginal Diku codebase, so it seems to have been around for a very long time, but rarely hit. What seems to have happened is that a player is able to generate enough command input to actually fill up the process space and therefore cause a core dump. The fix is actually pretty simple since each of the input queues are stored with each player. I added a check on each of the descriptors' queues to make sure there weren't more than 500 items waiting.

If someone manages more than that, they'll have a rude bye bye when the mud cuts their link. I'm not nice enough to try to figure out how to tell the player that they managed to spam the mud, and depending on the mud client they'll probably be happy that their link was cut so they can regain control of it. TinTin used to be a bugger to try to figure out when you got into loops in your own code. It would be a lot of trouble for me to add something to the write queue, flush it and then only do that once, so that we don't hang up the rest of the code for all of the other lines of input spam.

For now the player who was able to do this shall remain anonymous especially since the method they used to create this situation was not intentional

The reason I actually decided to post about this is that it is likely the first code bug fix I have made in several years. The last time I did one was when Jake forced me to fix some silly thing that was about one line of code, but took me an hour and 30 questions to him since I couldn't remember any of my passwords or the steps to compile and move anything. I've been around more lately and doing other things as may or may not be evident, which has made it much less painful to do.

Enough patting my own back. If you have a Diku and want the fix, I can probably describe in more detail what I did if you post in the comments the desire for it. Perhaps it's already been fixed as Sloth MUD is a pretty old branch.

Thursday, May 11, 2006

Wisdom of the Crowds

I've heard a lot about the power of the web and how it can be used to harness the "Wisdom of the Crowds." However, I think that concept is a little thin on follow-through. I believe it could be better stated that the power of the web is to find the "wise ones among the crowds."

I lack evidence to the refute that the sum of average minds is greater than any single exceedingly wise individual, however, I also counter there isn't a proof-positive example either.

A crowd could be considered wise when it is obvious to everyone in the crowd that they have come to the correct solution to a problem (and in fact they are right, which isn't always the case). In order for a crowd to be wiser than each individual, each person must contribute some small amount of information leading to the correct answer. Each incremental piece of information must also be assumed by the other members to be correct without significant scrutiny. In some aspect this requires a problem that is addressed by the crowd to be something similar to a labor task. Building a pyramid is a monumentous task where each person's incremental labor is obvious and trivially accepted by the next laborer assisting with putting up the next row of blocks.

Intellectual problems are rarely a case of brute force labor where like minds can march in lockstep to add a brick at a time to the cause. In general significant academic or industrial problems are usually solved by a few specialized or highly intelligent individuals that may collaborate in small groups. The power of the web to create seemingly wise crowds may in fact be that it bridges the gaps between people who are either highly intelligent or highly specialized. While there are also typically a large number of people who are interested in solving difficult problems, they may lack the time, specialty or intellect to solve them.

However, in contract to the intellectually challenging problems, I bet there are examples of problems where the average minds focussed on relatively straightfoward problems can produce results. I have heard of one intriguing problem where supposedly the CIA or some U.S. security agency was going to make public records it has found on weapons of mass destruction in Iraq. The problem is a large one in that there is a gigantic amount of documentation that is in (to the U.S. at least) a foreign language. The vast majority of this documentation is likely to have nothing to do with weapons of mass destruction nor would be helpful in actually finding them even if they are on topic. A large crowd of dedicated people could spend their energy each contributing to mining the documentation for information. A positive response could be validated pretty easily by other members of the group under several assumptions. The assumptions include:
  • everyone searching is faithful to the same cause
  • the evidence they find to support is contained within a small subset of documents (for example no more than 3 or 4 needed to piece together some proof)
A group working on a problem like this probably doesn't need too much organization. That is, it needs to be able to reject members who based on some amount of feedback by other members are deemed not faithful to the cause. For example, a person reporting every page as evidential. The group would not need to know what other members are working on because duplication of effort should be considered trivial and also the evidence may have been missed by a single reviewer or possibly ignored by an unfaithful member.

It is the power of the web and some group dynamics and leadership that would harness the power of the crowd, but its widsom is likely safe with the relatively few individuals that possess it to begin with.

Anyway, I got to thinking about this some because of work and I happened to also think about a quote from Albert Einstein that I see as part of a signature on the game posting board:

"He who joyfully marches in rank and file has already earned my contempt. He has been given a large brain by mistake, since for him the spinal cord would suffice."

I wonder what he would think of the Wisdom of the Crowds since hardly any of the crowd understands the theories he created other than meagerly quoted "E equals M C squared!".

Sunday, April 30, 2006

YACD (Yet Another Coding Distraction)

This past week I've been working on creating a theme from some stunning graphics provided for the Sloth III website. There are several points of difficulty I'm running into while applying the theme to the site.

The first is that the graphics provided, while stunning, don't quite cover the spectrum of content types we have on the site. For example, we have a few pages where the entire content is simply a table, such as the list of players online. Of course, I got distracted trying to make them look nicer within the theme by hacking up some of the graphics provided. I had to download and install GIMP to do reasonable amount of editing on images because Microsoft Paint doesn't cut it and Adobe Photoshop costs too much. It doesn't look any better; but, what I did learn is that the code that I put together for the auction module and what I have done so far on the

The second is that the method for creating a theme for Post Nuke CMS isn't well documented (surprise). Yes, there are some documents, but there are undocumented sections of the config file that is required for each theme. That indicates likely one of two things, either the developers haven't gotten to documenting it, or they haven't gotten to coding it. I'd guess the latter since I can't find any examples of anything using the undocumented config settings, but it is time consuming to figure out the useless config sections.

The third point of difficulty is that I haven't finished applying the entire theme before I skipped to modifying a few of the modules. It's a tough choice to figure out the best order of this since, I don't know the best way to make the theme and I don't know the best way to make a module look in a theme, I'm bumbling back and forth between the two. My current lean is to go back to the theme and finish either the two-column or three-column format. So far, I have finished the home page and found that there is one graphic mistake provided to us that I will have to address at some point.

Saturday, April 22, 2006

Yahoo has some nice free code

I'm currently working on creating a set of functions that will serve as a library for making simple form-based applications on top of the Post Nuke CMS framework. So far I have taken the approach that I'll abstract the details of creating the html, processing the return and creating an SQL query by making it all configurable in a single helper file.

It's a work in progress, but so far I have created a set of functions that will generate a form based on a configuration file that has the following types of inputs:
  • a text field
  • a radio button with "yes, no, maybe" options
  • a radio button with "yes, no" options
  • a text field with a linked greater than, less than, equals drop down list
  • a drop down list that is populated from a colum of a table
  • a drop down list that is populated from a colum of a table with a linked greater than, less than equals drop down list
  • a date picker with a linked greater than, less than, or equals, drop down list
The last item the list leverages some really nice UI code that I leveraged in this. It's going to make packaging this up a bit more difficult, but we'll cross that bridge if we get there.

So what's left to do is to finish the parser for each of these form pieces (most are done) and then plug that into the dynamic SQL generator. I know I am missing a whole layer for business logic in this but I don't need it yet for the application I'm building. It is a replacement for the the SlothMud III Equipment List that was previously built on core PHP and is linked to on the site. It has a tremendous breadth of features that all boil down to a generating the right query based on a set of checkboxes and a few text fields. It selects the appropriate data without really much further processing and then returns the results.

When I began approaching this problem, I wanted to just make the core scripts look like the rest of the site, but that really was going to leave a lot of functionality on the table, plus when I got into it, I really didn't like what I saw on how it was written (no disrespect to Enea intended).

The current difficulty with integrating this with Post Nuke is that though the 0.8 has a scripting language being built, it seems to be currenlty just an engine without a script library to leverage. I believe that once I have this working it could be relatively easy to wrap it into the format needed for use in the scripting engine and potentially become part of the core with some additional administration functions around table creation to support the scripts.

When I get the processor and dynamic SQL generator done, I'll post a link to the main page here.

Sunday, April 16, 2006

PostNuke Auction Module

I'm going to write in a bit about the work I am currently doing to create a new module for the Slothmud III site that will be used for an equipment list, but first I wanted to brag a little about a module I wrote a couple of years ago based on the PostNuke CMS that is nominally and Ebay-style auction module. It has been up and running for a couple of years now and only has a couple of known bugs, but has several limitations.

Here are some of the features it has:
  • Integration with PostNuke CMS user tables
  • Automatic bid increments while bidder is away
  • Requires users to be registered in PostNuke
  • Allows user to select the time for auction to end
  • Allows a minimum bid to be set
  • Built-in support for internationalization
It's written for the SlothMud III game, so it has "gold coins" as the currency, but this can be easily be changed via configuration.

It needs a lot of features like:
  • Online Administration
  • Auction Search
  • Archiving Auctions
  • Feedback
It's got a couple known bugs that used to work in a previous version of PostNuke:
  • Closing an auction early if there are no bids
  • Editing an auciton if there are no bids
I like a lot of the core features within PostNuke and that is one of the reasons I went ahead and made this a module instead of trying to hack up someone else's auction script. Another annoying thing I found about other scripts was that most required some sort of fee.

I learned a lot of things from working on the module. The first thing is that the example modules that come with Post Nuke absolutely suck. They aren't documented and have no usable functionality to exemplify any best practices. There are about 30 ways to do anything in PHP/Post Nuke and there really should be some suggestions on what is at least unacceptable, much less is ideal.

The second thing I learned is that there doesn't seem to be much early benefit from doing any of the abstraction that is common in many of the other modules I have seen written in Post Nuke. There are two main types that I saw when I did it, internationalization support and database query abstraction. I think the big problem was that there is not a good MVC architecture example template.

The latest version of Post Nuke I have used (about 0.7.6) has samples that uses the pnRender engine and this seems to have a scripting language in it to create the view layer, but I still think there isn't a good example of a controller (the missing piece that at least I haven't seen).

In any case, when I work on the next module I may take a look at the pnRender system but I doubt I'll go through the effort of using it throughout the entire module since I haven't yet figured out it really is going to be useful.

Friday, April 14, 2006

Return of Krom

I must say it is good to have some more Immortals around. I was just glancing at the board at the west gate and noticed a few of the posts on there were from people from long ago. The first couple posts are on average 7 years old from Jake.

Posts included contributions from Ming, Judge and Alana. Ming is gone and likely never to return. Alana said she is gone, but may well come back at some point. Judge is around, but very infrequently. He's done coding, which is a shame, because he was a great contributor.

Judge and I started on a really interesting project to upgrade the live maps to have much more information. He did some good reorganization of the code in the mud and then turned over some stuff to me for the web page, but I haven't had time to get to it and don't have the art to back it up, so it won't happen any time soon (if at all). To go into a little more detail, we had discussed making a graphical interface for immortal information such as areastats and mobstats. This would be tremendously helpful for us as we continually try to balance the areas so that players don't get in a rut of cycling one area at a time over and over.

This was a pretty daunting task to me a couple of years ago, but a lot of technologies have evolved (or at least become more mainstream) in that time. Things like SVG, AJAX and even to some extent PHP could make this quite a bit easier than it was the last time we discussed it. For now, I'm going to try to stay focussed on my current project which is building a better version of the equipment list. I'll post more on the approach I am taking to that in the future.

Easter Egg Hunt

I decided to run an Easter Egg Hunt. So I made 100 bunnies, 100 eggs. I put 3 million gold coins into one of the eggs. Ninety-nine of the eggs were pink and blue and the one with the gold in it was blue and white. I then scattered them all over the mud with mscatter and told the players to "go get'em!"

Getting the gold coins into the egg was actually pretty difficult. For some reason you can't put gold into containers, and this is probably to avoid some crash bug.

Mandos found the egg with the coins in it after about 15 minutes.

The post reference on the Sloth Town Crier mentions using the empty found eggs as an entrance fee to a future quest. I'm not 100% certain yet when I'll use the eggs as an entrance fee, but it will likely not be on Easter Sunday.

I thought this was an amusing gossip from a 3x40:
Sickcow gossips-- 'sux man clink .. u sux.. ur quest too hard for me'

I'm not entirely sure he was joking since he struggled with the basic concept of an easter egg hunt.