General Ramblings comments edit

I’ve gone through and re-listed all of my t-shirts (individually, this time) on eBay. Since the “lot of 10” didn’t sell, here’s hoping they’ll sell individually. I also put in starting prices instead of reserves, since it seems folks don’t like reserve auctions (at least, the people I talk to don’t).

We’ll see what happens this time. Luckily it only costs me like $0.35 per shirt to list the things.

gists, sharepoint, csharp comments edit

For those writing web parts for SharePoint Portal Server 2003 or Windows SharePoint Services, you may want to determine what context your web part is running in - is it WSS or SPS? I wrote a web part that had optional use of Audiences in SPS, but I wanted it to work (and ignore Audience settings) in WSS, too.

Here’s a static method to help you out.

/// <summary>
/// Returns a Boolean indicating whether we're running in SharePoint Portal Server
/// or not.
/// </summary>
/// <returns>True if we're running in SPS; false otherwise.</returns>
public static bool ContextIsSPS()
{
    var assemblyInstance = (Assembly)null;
    try
    {
        // Try to bind to the Microsoft.SharePoint.Portal assembly.
        // If it isn't there, we're not in SPS.
        assemblyInstance = Assembly.LoadWithPartialName("Microsoft.Sharepoint.Portal");
        if (assemblyInstance != null)
        {
            // We've successfully bound to the assembly, so now let's try to determine
            // the current PortalContext.
            var oType = assemblyInstance.GetType("Microsoft.SharePoint.Portal.PortalContext");
            var oInfo = oType.GetProperty("Current");
            var result = oInfo.GetValue(null, null);
            if (result == null)
            {
                // SPS Installation, but WSS context
                return false;
            }
            else
            {
                // Running in SPS context
                // To determine SPS site URL:
                // PropertyInfo oSiteURLInfo = result.GetType().GetProperty("SiteUrl");
                // string siteurl = (string)oSiteURLInfo.GetValue(result,null);
                return true;
            }
        }
        else
        {
            // We couldn't bind to the Portal assembly, so we're not on an SPS box
            return false;
        }
    }
    catch (Exception err)
    {
        System.Diagnostics.Debug.WriteLine("ContextIsSPS(): Exception determining SPS context; returning FALSE.");
        System.Diagnostics.Debug.WriteLine(err.Message);
        return false;
    }
    finally
    {
        assemblyInstance = null;
    }
}

General Ramblings comments edit

I was listening to a local radio station yesterday on my hour-and-forty-five-minute commute (to go 14 miles) and they have this feature called “Random Thursday” where they play different callers asking questions they don’t know the answer to or weird thoughts they’re having. I think today is “Random Friday” on the blog because there are a lot of disconnected thoughts I have that I haven’t gotten out here yet.

This is why I can’t work at home too well: My cat thinks she’s a parrot.

Tiny wanna
cracker?

I forgot to mention it, but this past weekend (I think it was this past weekend) Jenn and I were going into the Winter Hawks game when, passing through the turnstyle, Jenn nailed herself in the nuts. Not that she has nuts, but if she did, she’d have hit them. I had to laugh, but I’m sure it hurt pretty bad. Took a couple of days to get over.

Earlier this week the Christmas gifts my boss ordered for us from the UK arrived.

Spare no expense on the
packaging!

He ordered a bunch of mugs, so the company just grabbed each mug in its own styrofoam packaging block and taped all the blocks together. No box, just tape. Spare no expense on the packaging, right? Amazing what the post office allows through. (We ended up playing a sort of white elephant game with the mugs, where the first person picks up a mug, then the second person either gets a mug or steals the one from the first person, and so on. It was a lot of fun. I ended up with a mug that says, “Please do not use the Internet. It affects my MP3 downloading.”

Last night Jenn, my dad, and I went to Mickey Finn’s to participate in Mr. Bill’s Traveling Trivia Show. My friend Susan works at the show sometimes (tallying up scores and whatnot) and has been badgering me to go, so we did.

The show is sort of like a group game of Trivial Pursuit. You form teams, pick a name (we were the S.W.A.T. Team), and answer three questions at a time. After something like 18 questions, you get some raffle tickets (based on how many your team got right) that could win you free t-shirts, gift certificates, etc.

Our team kicked ass. I mean, we were always right up in the top few teams. We each had our specialties - I know movies and music, Jenn knows TV, and my dad knows history and geography. Well, sort of. See, Dad flubbed the only WWII question we had, so I don’t know that we can really count on him to come through. Where did I go wrong with that guy? Heh.

About halfway through, Susan’s friend Sharon joined our team. Sharon’s cool and has this job where she gets to travel to all these cool and exotic places on the company dime. I think that would be pretty cool… for a while. Not sure I could get used to the whole jet lag thing, or losing so much time on an airplane (date lines and all). She had some interesting stories, though, and came through in the pinch with some correct question answers (*cough*Dad*cough*).

That said, as many questions as we answered correctly, not a single one of our raffle tickets was drawn. I seriously think every single team except ours won something. At first I blamed it on the fact that I was the one going up to get our raffle tickets, but then I sent Jenn up to get a set and we still didn’t win. Now I’m convinced that there’s some sort of CSI-esque spray that they’d coat the tickets in so our tickets would glow and they’d know which tickets not to draw.

Slept like crap last night. I think it was the mega-onion-burger and onion rings I had for dinner, followed by the mountain of bread pudding with rum sauce for dessert. I was too hot in the blankets, too cold out of them. Heartburn all night. Woke up twice to pee. I have no idea what was going on.

I woke up this morning and my right eye is half swollen shut and hurts like hell. I don’t know what’s up with that, either. One of the guys in the office suggested that I may have slept on it wrong. How do you sleep wrong on your eye?

I noticed in the shower this morning that we desperately need some Drano. By the end of the shower I was ankle deep in soapy disgusting drainwater. Then it occurred to me that I’ve been noticing this same thing for like a week now and just never remember long enough to write down the word “Drano” on the shopping list. I’m really hoping I remember to get some between now and tomorrow morning. Every morning it happens, and every morning I’m disgusted anew. Sort of like living in an unhygienic version of Groundhog Day.

Watching the news this morning and noticed that this reporter on there always does stories where, rather than acutally have any interesting video footage, he’ll actually aim the camera at his computer while he surfs sites about his story or reads email from viewers. Story about the airport? Cool! Stand outside the airport with the news van and point the camera at the airport’s web site. Information about a new health care bill? Great! Aim the camera at the email feedback inbox and read viewer thoughts. Where did this guy learn journalism?

I’m not sure why I think this, but for some reason I feel like I need some Snoop Dogg albums.

My dad’s stoked for the Survivor All-Star show coming up. I’m interested, too, but I’m not sure as much as he is. Dad still wants to try out for Survivor. Heh.

Okay, last thing: I had this weird dream last night that I went to the Estacada Timber Bowl and, rather than being a park, it was more of a natural history exhibit. They had this life-size reproduction of a scene in a cave (and the cave was the size of an airplane hangar) where prehistoric man had greeted visitors from Mars around a huge bonfire. I don’t remember too much, but I do remember the audio-animatronics being used were of excellent quality. After looking at that for a while, I went through the cave and at the other end was a giant plantation-style house where they were having an estate sale. I want to say I bought an antique phonograph, but I can’t really recall. Just about the time I was leaving the sale, I woke up.

Damn, my eye hurts.

blog, gists comments edit

UPDATE: This category is now “gists.”

I’ve added another new category - Code Snippets - for little pieces of code I come across or use that I think might be helpful to folks. Not really Geek Moments, not really Tech Support. Sorry to the casual readers who don’t care about code. I don’t really have anywhere else to publish this stuff, so everyone gets to see it.