The Geek’s Weekly #2

The best part of The Geek’s Weekly so far is that, in fact, it’s not been very weekly! Perhaps I should rename this to The Geek’s Not-So-Weekly; I will have to ponder on this.

The second Geek’s Weekly is entirely my girlfriends fault. Yes it is, honey!

We have been farming Anzu for months, in hopes of getting Reins of the Raven Lord for our characters. She has been pestering me about it ever since I faction changed my Night Elf Druid to the Horde. I settled down to level to 80 and do the epic flight form quests, so that I could summon Anzu for her. In the same time she leveled her own Druid as well.

Anzu first dropped for her Druid. Lucky her! Amazingly enough, the following day Anzu dropped again for us! So we had achieved our initial goal, except she had not on one, but two Raven Lords now! I couldn’t believe her luck! Since then we’ve continued the farming, hoping to get another one to drop for me. I had given up hope, surely she had used up all luck already! But, last night we had another drop! Yay! I had been a little grumpy all evening and initially I didn’t feel like doing anything, but I’m very happy we made the trip to Sethekk Halls anyway!

Seeing me all cheered up, she suggested posting this as my Geek’s Weekly. I quickly agreed and asked her to pose together with me for a screenshot to accompany the post.

Our next goal is to get yet another Anzu drop. This time for my very own Druid. It would be nice to get him a Blue-Black-Birdie as well! It might require a lot of additional luck, but it’ll probably drop before we ever get to see the Tiger from Zul’Gurub! As an example to demonstrate how long we’ve been after the Zul’Gurub tiger I will tell you that in the same period we have gotten the drops for:

Grrrr!

The Dragon Keeper

After devouring all the books related to The Elderlings universe, I eagerly anticipated reading through my newly acquired book: The Dragon Keeper; part one of The Rain Wild Chronicles. Unfortunately it’s the first book in the entire series that I have been disappointed with. Considering I’ve already read nine this met with mixed feelings. One part of my conscience felt disappointed and another part told me I should be grateful that I’ve had read nine other superb books!

The Dragon Keeper picks up the story of Bingtown and the Rain Wilds again. In The Tawny Man there were plenty of hints about the stunted little dragons that had been hatched and this book starts with the hatching of the scrawny, stunted, little dragons and continues telling their tale. After having finished the book, I am left with a feeling of disappointment. I haven’t really formed a bond with any of the main characters. For me personally, Hobb didn’t succeed in creating a new character that could take the role of the hero, such as Fitz.

And yet, the last few pages of The Dragon Keeper made me a little more excited about the story. Did Sedric’s actions cause the death of one of the dragons? Will the other dragons suspect? What will their keepers do when they find out? How will things go for Sedric? Will he be able to gather the fortune he so desires, or will he meet a more dreadful fate? All questions that sparked in me when I turned the last page. At the same time I also felt the disappointment of having my excitement sparked into life on the last few pages out of the near six hundred.

Oh well, let’s hope Dragon Haven will continue where The Dragon Keeper has deserted me!

Creative goldseller ads!

I had heard about the goldsellers becoming a little more creative with their advertisements, but I had never witnessed it until yesterday. I was going about my business in Orgrimmar finding the best trades and generally looking for a profit, when, all of a sudden, a load or Orcs fell from the sky in such a way that they spelled the name of a website. I’d seen that before, so I shrugged and continued trading.

Suddenly, all the Orcs moved from lying on the floor to floating in the air in front of the Auction House. That did get my attention! I had not seen that before. I started recording this, anticipating some more spectacular things to come. Unfortunately that wasn’t the case, but at least I captured it on video how they ran through the air to float in a new position. I don’t know how they do this stuff, but it amused me for a minute. :)

The Geek’s Weekly

Today I’m going to introduce something new: The Geek’s Weekly. What this means is that at the end of every week I will try to write a post about something from my life that makes the geek inside me sit back and nod in satisfaction at a job well done, while everyone else would just roll their eyes at its stupidity.

The first ever weekly will be my new desktop background rotation! A good many months ago I had ordered a figure print of my World of Warcraft character, Grognak. I already had a really nice picture of him and I decided to make a few more, so that I could let them rotate as desktop backgrounds! After many failures, I managed to make some good shots:

IMG_0003.JPGIMG_0005 (2).JPGIMG_0005.JPG

Once I had transferred the photos to my computer and had them configured as my background, I set back and admired my work and decided I was satisfied. This also triggered the idea of introducing The Geek’s Weekly here on Storm in a Jar as there are bound to be many more of these geeky moments!

Creating a custom ConfigurationSection

Yesterday afternoon and the early bits of this morning I spent my time breaking my head on creating a custom ConfigurationSection. I kept getting an exception with the message unrecognized element ‘add’. I thought it would all be so simple!

Here’s the background of why I ended up tinkering with this stuff. I wanted to define a few custom tags in my web.config to specify which modules should be loaded when the application would start. A quick google search learned me that creating my own custom ConfigurationSection was the way to go. It didn’t look too difficult, so I got right down to business and started coding away!

Web.config:

<configSections>
    <sectionGroup name="moduleSettings">
        <section
            name="modules"
            type="Storminajar.Modules.Framework.Configuration
                  .ModuleSection,
                  Storminajar.Modules.Framework"
            allowDefinition="Everywhere"
            allowLocation="true"/>
    </sectionGroup>
</configSections>
<moduleSettings>
    <modules>
        <module name="Module 1"
                description="My first module!"
                type="Storminajar.Modules.Module1.MyModule,
                      Storminajar.Modules.Module1" />
        <module name="Module 2"
                description="My second module!"
                type="Storminajar.Modules.Module2.MyModule,
                      Storminajar.Modules.Module2" />
    </modules>
</moduleSettings>

Let’s have a look at the working code.

ConfigurationSection:

public class ModuleSection : ConfigurationSection
{
    [ConfigurationProperty("", IsDefaultCollection = true)]
    [ConfigurationCollection(typeof(ModuleCollection),
        AddItemName="module")]
    public ModuleCollection Modules
    {
        get { return (ModuleCollection)this[""]; }
        set { this[""] = value; }
    }
}

ConfigurationElementCollection:

public class ModuleCollection : ConfigurationElementCollection
{
    public ModuleCollection()
    {
    }

    #region ConfigurationElementCollection Specific Memebers
    protected override ConfigurationElement CreateNewElement()
    {
        return new ModuleElement();
    }

    protected override object GetElementKey(
        ConfigurationElement element)
    {
        return ((ModuleElement)element).Name;
    }

    public override ConfigurationElementCollectionType
        CollectionType
    {
        get
        {
            return ConfigurationElementCollectionType
                .AddRemoveClearMap;
        }
    }
    #endregion

    #region Collection Related Members
    public ModuleElement this[int index]
    {
        get { return (ModuleElement)BaseGet(index); }
        set
        {
            if (BaseGet(index) != null)
            {
                BaseRemoveAt(index);
            }
            BaseAdd(value);
        }
    }

    public new ModuleElement this[string cultureKey]
    {
        get { return (ModuleElement)BaseGet(cultureKey); }
        set
        {
            if (BaseGet(cultureKey) != null)
            {
                BaseRemove(cultureKey);
            }
            BaseAdd(value);
        }
    }

    public bool Contains(string name)
    {
        foreach (ModuleElement element in this)
        {
            if (element.Name == name)
            {
                return true;
            }
        }
        return false;
    }

    public void Add(ModuleElement element)
    {
        BaseAdd(element, true);
    }

    public int IndexOf(ModuleElement element)
    {
        return BaseIndexOf(element);
    }

    public void RemoveAt(int index)
    {
        if (this.Count > index)
        {
            BaseRemoveAt(index);
        }
    }

    public void Remove(ModuleElement element)
    {
        if (BaseIndexOf(element) >= 0)
        {
            RemoveAt(BaseIndexOf(element));
        }
    }

    public void Clear()
    {
        BaseClear();
    }
    #endregion
}

ConfigurationElement:

public class ModuleElement : ConfigurationElement
{
    [ConfigurationProperty("name", IsRequired = true)]
    public string Name
    {
        get
        {
            return this["name"] as string;
        }
    }

    [ConfigurationProperty("description", IsRequired = false)]
    public string Description
    {
        get
        {
            return this["description"] as string;
        }
    }

    [ConfigurationProperty("type", IsRequired = false)]
    public string Type
    {
        get
        {
            return this["type"] as string;
        }
    }
}

If you ever get to the point of banging your head on your desk, because of the aforementioned unrecognized element ‘add’, make sure to double check the implementation of the ConfigurationSection! It’s extremely important to have defined the ConfigurationProperty with an empty string! It only seems to occur when a value is specified at this point!

[ConfigurationProperty("", IsDefaultCollection = true)]
[ConfigurationCollection(typeof(ModuleCollection),
        AddItemName="module")]
    public ModuleCollection Modules { ... }

Let me repeat that:

It’s extremely important to have defined the ConfigurationProperty of the ConfigurationElementCollection in the ConfigurationSection with an empty string!

I spent a couple of hours trying to figure this out… A bit of a waste of time!