Molly

I adopted a dog (Molly) this month.  She was born in Tennessee but has been living up at my cabin for the last 5 years.  Molly is a pure bread Britney and I think she has a nipple fetish… Not my nipples, you sick bastards, but she sucks on toys like she missed out on something as a pup.  She seems to be enjoying city life since she came here.  I’ve taken her to a park close by, where she promptly harassed the local goose population.  Other than that, she has successfully eaten the head off her gorilla toy.  All and all it’s been an exciting last couple days…  She is a bit overweight, so I’m trying to get that under control for the holiday season… Hell, maybe she’ll make a New Years resolution about it ;).  Anyway, I’ll keep posting more pictures as the days ahead become memories. 

 

Molly with a toy

 

Also, I posted some pictures from this years deer hunting expedition at my cabin. 

Text description for enum values

I wanted to add text descriptions to my enum values; similar to overriding ToString on a class.  This is what I came up with, using the beauty of generics:

A sample enum implementing my custom description attribute:

public enum MyEnum

{

    [EnumDescription(“Funky chicken walks again!”)]

    FunkyChicken = 0,

    [EnumDescription(“Doctor?”)]

    Doctor = 1

}

 

This next code block defines the custom attribute:

[AttributeUsage(AttributeTargets.Field)]

public class EnumDescriptionAttribute : Attribute

{

    private string _text = “”;

 

    /// <summary>

    /// Text describing the enum value

    /// </summary>

    public string Text

    {

        get { return this._text; }

    }

 

    /// <summary>

    /// Instantiates the EnumDescriptionAttribute object

    /// </summary>

    /// <param name=”text”>Description of the enum value</param>

    public EnumDescriptionAttribute(string text)

    {

        _text = text;

    }

}

 

Finally, a static method that prints the attribute from any enum, using generics:

static StringDictionary _enumDescriptions = new StringDictionary();

public static string GetEnumDescription<EnumType>(EnumType @enum)

{

    Type enumType = @enum.GetType();

    string key = enumType.ToString() + “___” +  @enum.ToString();

    if (_enumDescriptions[key] == null)

    {

        FieldInfo info = enumType.GetField(@enum.ToString());

        if (info != null)

        {

            EnumDescriptionAttribute[] attributes = (EnumDescriptionAttribute[])info.GetCustomAttributes(typeof(EnumDescriptionAttribute), false);

            if (attributes != null && attributes.Length > 0)

            {

                _enumDescriptions[key] = attributes[0].Text;

                return _enumDescriptions[key];

            }

        }

        _enumDescriptions[key] = @enum.ToString();

    }

    return _enumDescriptions[key];

}


For performance reasons, the StringDictionary is used to cache the values.  Reflection tends to be expensive, so why not cache things? 🙂

Ctrl-s hotkey functionality for Community Server blog editor

Because the post editor uses postbacks, this doesn't feel like a native app.. but it's the best I can do w/ the design.  This will add a key mapping for ctrl-s so that it does the same as the "Save and Continue Writing" button.

Add this to the bottom of ~/ControlPanel/Blogs/CreateEditBlogPost.aspx

 

<script language="javascript">

var isSaving = false;
function DoKeyCommand(evt)
{
var key = (evt.which || evt.charCode || evt.keyCode);
var stringKey = String.fromCharCode(key).toLowerCase();
var cmd = '';

if (!evt || !evt.ctrlKey) return true;

switch (stringKey)
{
case 's':
{
if (isSaving) return false;
isSaving = true;
if (evt.preventDefault) {
evt.preventDefault();
evt.stopPropagation();
} else {
evt.returnValue = false;
evt.cancelBubble = true;
}
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$TaskRegion$Editor1$SaveEditButton", "", true, "", "", false, true));

return false;
}
};
return true;
}
if (document.addEventListener)
{
document.addEventListener("keypress", DoKeyCommand, true);
}
else if (document.attachEvent)
{
document.attachEvent("onkeydown", function(evt) {DoKeyCommand(evt)});
}

</script>

 

Community Server hosted…

I have to admit that I'm somewhat surprised at the pricing for the hosted version of Community Server.  They seem to be ignoring individual users and small companies with their pricing.  In my humble opinion, if they added a starter account for $5 or $10 per month, they could cater to the masses.  That would be a small enough price jump for people to consider not going with free alternatives: WordPress, Flickr, and ProBoards.   There is an obvious benefit to having blogs, forums, galleries, etc that share a common url and theme.

I definitely see the convenience hosted software packages have to offer, but man… when you have competitors offering similar services for free, it's hard for the "little guy" to justify signing up for $50 per month.  But who knows… maybe Telligent just doesn't want to cater to that market.

Playing with my first RAW photo…

Believe it or not, I actually took the picture that is now the background for this site.  I know, it's just a simple picture of clouds… but this picture is special to me since it's a portion of a picture I snapped when I was at my cabin, it was my first RAW picture, and I was later able to alter the lighting via Photoshop (multiple times, I might add).  I have never played with RAW format before, but man… you can REALLY change what a picture looks like by altering all of the values associated with it.  I can see where taking one RAW picture can be more valuable than taking 100 jpg pictures.  I suppose you have to find the happy medium of taking the picture w/ the right light on the camera first and then photoshop it if necessary.  In my humble opinion, I was able to bring out the blue color in the sky so that it matches the color scheme of the site pretty well. 

Bia Securities website upgraded… finally

After mulling over converting the site to WordPress MU and some other
gallery software, I decided to just upgrade to the latest version of
Community Server in the short term.  Who knows if I'll move to
WordPress MU in the future, but for now I'm going to stick with
Community Server.  The main problem was finding a replacement for the photo galleries.  Coppermine seemed like a decent alternative, but I'd really like something that allows me to have "local"
galleries as well as integrating 3rd party galleries like Flickr. 
Until I find something that solves that, I guess I'm stuck with
Community Server.

I love the industrial strength glue on cereal bags

I can’t get over the strength that some glues have to offer…  You find these glues not in a reasonable place like say where a strip of velcro meets an I-Pass transponder, but rather this particular glue held the seam of a cereal bag with a force rivaling jedi mind control.  This morning, after I tore apart a cereal bag in every possible location other than the seam, I decided to finally give in and purchase containers dedicated to holding and preserving cereal.  Apparently there are about 3 choices for this type of container, other than the cardboard box that the cereal originally came with.  You can go with a plastic version, a round stainless version, or the pyrex jars that require an air pump.  After much searching, including reading a thread by some hippies vegans who got side tracked and started talking about microwaving baby sea turtles, I decided to go with Tupperware’s Super Oval 4.  I’m not totally satisfied with my decision, but I feel that it was the best outcome from the choices presented.  Provided my crude math is accurate, I’m estimating that it’ll hold a large box of Crispix with little to no crushing needed.