advanced web statistics

SQL 2008 and The Setup Failed to Read IIsMimeMap Table

Decided to install SQL 2008 recently because of it being 2009 and all.  What an adventure.  Although not near as bad as upgrading from Vista Home Premium to Vista Ultimate, it sucked pretty bad.

I downloaded the 120-day trial Developer Edition as a self-extracting executable because I didn't feel like burning a DVD / using Daemon Toolz.  The download was the smoothest part of this whole deal.

From the installer screen I chose the Upgrade from SQL 2000 / 2005 option because I have SQL 2005 Developer Edition installed so this made the most sense.  Miserable fail.  I kept erroring out when trying to install SQL Reporting Services.  The exact error(s) escape me but I remember it having something to do with authentication and the report service.  Naturally I thought to manually stop and start the service to see if there was any issue.  Good thing because manually starting the service failed.  It then dawned on me that between the time I had initially installed SQL 2005 and that very instant I had changed my Windows password.  Right-click, 'Properties' and changed it to my current password, restart the service: SUCCESS!

Now let's try upgrading again: FAIL!

After hitting the Google fairly hard I read a couple of blog entries detailing how uninstalling SQL Server 2005 entirely from the Control Panel would remedy the situation.  I tried this and received the following error when attempting to uninstall SQL 2005 Reporting Services:

Failed to read IIsMimeMap table 01

Awesome.  Have no idea what this means so I searched Google for it.  Apparently no one else does either.  There were tons of suggestions as to how to go about remedy'ing this so I tried a couple.  These solutions ranged from reconfiguring Reporting Services to uninstalling and reinstalling IIS7.  I opted to try and reconfigure Reporting Services only to find that the configuration tools no longer existed on my machine seeing as how that was successfully uninstalled before receiving the error message above.  I then tried to uninstall again and received this error message.

Failed to read IIsMimeMap table 02

Same error, different error code. Weird.

The final solution was to install each component of SQL 2005 one-by-one from Control Panel.  As crazy as that sounds it actually ended up being successful.

So, if you are getting these error messages try uninstalling each and every SQL 2005 component one-by-one and then do a clean install of SQL 2008.  It worked for me.

kick it on DotNetKicks.com

LAMP Developer Needed

Checked an e-mail account that has apparently been exluded from my main Send/Receive group in Outlook today and found this e-mail in the Junk E-mail folder.

Maybe I should use this to setup a rule...

;)

LAMP Developer Needed

I have learned a bunch of exciting things over the past couple of months but unfortunately it's proprietary and I can't blog about it!

I was never one to blog about where I work or what projects I have been working or else I'd have a ton of new entries.

kick it on DotNetKicks.com

Microsoft Office Interop Outlook & C# For Outlook Searches

I had a need yesterday to query a bunch of Outlook e-mails: 44,743 to be exact.  This was the result of a clients mailing list account being setup incorrectly and we just found out about it!  An e-mail account was setup strictly for the mailing list and it was never properly setup as an Outlook account locally.  No big deal.  When the hosting provider contacted us to clean it up I noticed that there were a BUNCH of bad e-mail addresses (Return to sender, bad account, etc...).  At first I started to click on individual e-mails, copy the bad e-mail address to a .txt file, then search that folder for the same e-mail address and delete the results.  That takes FOOOOORRREEEEVVVVEEEEERRRRRRR.  Then I realized I could dork around with Outlook via a C# console application and harvest the e-mails and output them in a sorted Excel spreadsheet.

Enter Microsoft.Office.Core and Microsoft.Office.Interop.Outlook namespaces. I decided it would be best to create a little C# console application utilizing these namespaces to search the e-mail, write a little regular expression pattern (by write I mean copy & paste one from the interwebs) to parse out e-mail addresses, and add e-mail addresses that didn't have the host name or the reply e-mail account in it to a List<string> (if it didn't already contain it!).  It was pretty easy.

First:

using Outlook = Microsoft.Office.Interop.Outlook;
using Microsoft.Office.Interop.Outlook;

I'm not going to bore you with the entire application unless you really want it.  I'll just get you to the point where you can start to do stuff with your e-mails.

Now you need to instantiate your Outlook object.

Outlook.Application application = new Application();
Outlook.NameSpace nameSpace = application.GetNamespace("MAPI");
Outlook.MAPIFolder mapiFolder = nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderJunk);

It might be worth mentioning the olFolderJunk business you see there.  In the interest of time I didn't want to mess around with trying to navigate to the folder that I actually stored these e-mails in since I have a bunch of subfolders in Outlook due to using multiple accounts and a handful of rules and what-not.  So in the interest of time I moved all the e-mails to the junk folder since I could easily access it.  I think the correct syntax would be something like:

nameSpace.Folders["FOLDER"].Folders["SUB"].Folders["YOU_GET_IT"];

Moving on.  Once you finally get access to your designated folder you need to start being able to do stuff with the items in that folder.  It's as easy as enumerating the, you guessed it; MailItem objects a la:

foreach (MailItem mailItem in mapiFolder.Items)
{
   // do stuff
}

Easy.  The properties are fairly braindead as well.  MailItem Object Members

Have fun.  I'll probably use this in the future as well.

kick it on DotNetKicks.com

Dilbert & Agile Programming

Just saw this cartoon this morning. Late pass I'm sure ;)

Dilbert & Agile Programming

kick it on DotNetKicks.com

Silverlight ObservableCollection Bug Will Be the Death of Me

BUG: Items are sorted correctly sometimes, other times not so much.

FREQUENCY: Intermittent, never when debugging and stepping through everything, always seems to happen when I'm not.

RATING: Probably the most painful bug I've worked on in some time.

So I've got an ItemsControl in a custom XAML user control.  All this does is display an IEnumerable<T> of video items.  Simple.  To provide a better user experience we implemented an ObservableCollection<T> as the source of the ItemsControl with a Collection_Changed event so we can add one item at a time to the collection so as to not wait for the entire collection to populate before displaying to the user.  Now we're able to display the first 2 items and the scrollbar height shrinks as items are being added.  It's a nice user-experience.

Anyway, so for the implementation.  When the VideoRetrieveComplete event fires (after making a web service request for the data) we call the UpdateVideoCollection method.

UIThread.Run(delegate
{
   videoListControl.UpdateVideos(args.VideoItems);
   videoListControl.itemsControlVideoListing.DataContext = new VideoItem();
}

Notice that we're doing this in the UI Thread.  The code above is located in our Controller class.  The args.VideoItems is an IEnumerable<VideoItem> and they are sorted in the order they need to be in.  I have verified this time and time again with painful debugging.

Now time for VideoList controls properties, objects, and methods:

public int CurrentPageIndex { get; set; }
public ObservableCollection<VideoItem> ObservableCollection { get; set; }
private List<VideoItem> VideoItems = new List<VideoItem>();

Constructor where everything is initialized.  Probably important to include this.

public VideoList()
{
   CurrentPageIndex = 0;
   InitializeComponent();
   ObservableCollection = new ObservableCollection<VideoItem>();
   itemsControlVideoListing.ItemsSource = ObservableCollection;
   ObservableCollection.CollectionChanged += CollectionChanged;
}

public void UpdateVideos(List<VideoItem> videoItems)
{
   UIThread.Run(delegate
         
   {
               VideoItems.AddRange(videoItems);
               ObservableCollection.Clear();

               if (VideoItems != null && VideoItems.Count > 0)
               {
                  VideoItem videoItem = VideoItems[0];
                  VideoItems.RemoveAt(0);
                  ObservableCollection.Add(videoItem);
               }
            });
}

void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
   if (VideoItems.Count > 0)
      UIThread.Run(delegate
               
{
                  VideoItem videoItem = VideoItems[0];
                  VideoItems.RemoveAt(0);
                  ObservableCollection.Add(videoItem);
               });
}

The reason for removing an item, and then re-adding it is that this is the only way we can get our Converters to fire off, otherwise the collection hasn't changed and UI elements don't update.  For example, switching between tabs the user can add videos to their playlist.  Each time the tabs are selected and the VideoListing populates the VideoItems within that listing needs to show either an ADD / DELETE FROM PLAYLIST button depending on whether or not the item is in the playlist.  If there's another way to get those Converters to fire off I'm all ears.

So the problem is that more often than not the videos, which come in sorted correctly, are not always displayed that way.  For example, if I have 5 videos with dates 10/1/2008, 10/1/2008, 9/30/2008, 9/29/2008, 9/28/2008 sometimes the sort will be:

10/1/2008
9/30/2008
9/29/2008
9/28/2008
10/1/2008

or:

9/30/2008
9/29/2008
10/1/2008
9/28/2008
10/1/2008

You get the idea.  Could it be that we are not implementing this correctly?  Do we need to rebind the ItemsControl or is this correct?

I've been working on this bug for a day and a half now and have nothing.  I'm sure it's probably something stupid.

I'm all ears if you have anything. ANYTHING!

Oh, should probably add that if I page to the next listing of videos and then back it'll remedy itself!

kick it on DotNetKicks.com

What's Wrong With This Picture?

Tried to debug a new Silverlight application today.  By new I mean it was hosted in a different web project then the one I had been previously working on due to the fact that I needed to test some stuff locally.  I was trying for about half an hour to get this thing to debug.  The application would start to load up and then just hang on the loading animation.  A co-worker told me to make sure I had the Silverlight debugger checkbox checked.  I then go into the appropriate property tab and am greeted with this:

what's wrong with this picture? (image)

I remember this debugger option used to be located in the appropriate Debuggers group box.  Apparently when I performed my Visual Studio 2008 and .NET Framework updates my Visual Studio 2008 UI ended up getting mutated.

Very strange.

kick it on DotNetKicks.com

Way to Go Vista File Transfers!

Better grab a lunch, or 9.

kick it on DotNetKicks.com

The Zune Update Totally Sucks

Updated the Zune application software this morning at about 7:00am.  Since I had no choice in the matter, I went ahead and did it ;)

Wow.  Talk about a change... for the worst.  The application seems to lag a lot even when I have nothing else open.  If I try to listen to it with Visual Studio 2008, SQL Management Studio, and Outlook forget about it.  Too bad because those are all the things I use on a daily basis for work.  That's also when I listen to the most of my music.

Luckily I've got 4 stereos in the house wired up to my Zune player so depending on where in the house I'm working (laptop) I can listen to my music.  I've also got 2 30GB zunes for this and am thinking of buying another when the new line is released (if it hasn't been already).

Like any Microsoft product there will be a patch released for the Zune software if enough people are experiencing these symptoms and at the end of the day I'm still glad I don't use any Apple products.

Does anyone else find that the Zune software responds a lot like a poorly-written RIA (rich internet application)?  To me it responds like Silverlight applications do when they are first written; before any story board animations / overlays are added to let the user know that SOMETHING is actually happening.  Just a thought....

If anyone from Zune reads this you might want to update the Zune Card widget (see left navigation column) to utilize Silverlight instead of Flash.  It would probably be a good look since, you know; you're Microsoft and you have this new technology you want to promote.

Looks like I'll try this again later.  Maybe rebooting (again) will help.

UPDATE
Unresponsiveness of the application aside, the hardware update seems to be pretty sweet! Now I can play games while listening to tasty licks by The Chameleons.  The wireless feature is pretty sweet. I wonder if I have to be at one of 9,800 McDonald's restaurants to be able to download?  I'd guess not...

kick it on DotNetKicks.com

No Generic List FindAll Method in Silverlight 2 Beta 2

Came across a need this morning to use the FindAll method. To my dismay it wasn't there.  I know that Silverlight uses a subset of the .NET Framework but the System.Collections.Generic namespace is definitely there.

System.Collections.Generic namespace in Silverlight 2 Beta 2

You can clearly see that I'm using the namespace in the above image.

ReSharper List.FindAll Error Silverlight 2 Beta 2

Here you can see that ReSharper's background compiling caught it right away. For a second there I thought: "You know, maybe ReSharper is full of shit. This can't be right." I tried to compile to make sure (which was the case with the version 4 nightly builds).

'System.Collections.Generic.List' does not contain a definition for 'FindAll' and no extension method 'FindAll' accepting a first argument of type 'System.Collections.Generic.List' could be found (are you missing a using directive or an assembly reference?)

Weird.

kick it on DotNetKicks.com

Hacking Silverlight, ObservableCollections, & Scarface

In working with Silverlight lately I've found that there's not a lot of documentation, especially for more complex functionality.  More times than not I find myself sort of scratching my head and wondering if the solution provided is really the best way to accomplish a certain task.

Let's say you're creating an application that serves up articles (i.e. for a library search application).  You have an ItemsControl that uses a article item control as it's DataTemplate. The ItemsSource of this ItemsControl is an ObservableCollection<T> of type, I don't know; SearchResult.  The DataContext for your ItemsControl is, you guessed it; SearchResult.

Now say you have, above your search results, a little panel that provides filtering.  The filters are List<T> -bound that expand when clicked (and roll up when done). In keeping with our library search application let's pretend the filters are by year (Last Week, Last Month, Last Year, Last 2 Years, etc....) and by topic (Sociology, Psychology, Political Science, Computer Science, etc..).  The year filter allows you to select only one (the selection of a listitem triggers the list to hide and the listing of articles below to refresh).  The user can select any number of topics.  Each listitem in the topic filter has an overlay that provides button functionality such as "SELECT / DESELECT, CLEAR ALL, DONE".  When you select an item, it highlights that row.  DESELECT unhighlights the row.  DONE means you are done selecting and rolls (hides) the list back up.  CLEAR ALL is the problem child.  Behind the scenes we are storing the id for the listitem in a List<T>.  We have easy access to these on MouseLeftButtonUp due to our DataContext being set earlier.  Clicking done will trigger the enumeration of this list to build our query and then that is sent to a web service.  There is a subscription to the ArticleRefresh trigger and the ItemsControl listing is updated. Easy.

The issue is the unhighlighting of all the listitems in the topic list upon clicking CLEAR ALL.  That sounds really easy (and it may very well be!) but I haven't seemed to figure out an efficient way to do this.

In ASP.NET it was extremely easy to enumerate all the controls from within, let's say a Repeater.  You have in your ItemTemplate a control that you want to repeat.  You could write a little bit of code to enumerate every RepeaterItem and alter the display of certain text and controls within that Repeater.  It's extremely easy.

In Silverlight you don't have that luxury.  Well, you're supposed to have an easier way of doing business but I haven't yet found it.  By the way, I'm talking about Silverlight 2 Beta 2. 

My first attempt at this was to create a Converter that sets the IsSelected property based on the presence of the topic's id in the List<T> it is bound to.  I get a BAD_PROPERTY_VALUE error when that is attempted.

The next attempt was creating an event handler for the Loaded event of my topic filter control that will cast the sender to the filter object, check to see if the id of the objects DataContext is contained in the List<T>.  If it is, highlight, else, no highlight.  This works the first time the application is loaded but not on subsequent list views.  Reason being the use of the ObservableCollection<T>.  The collection itself hasn't changed, so no rebinding needs to occur.  This is probably a good thing.  What if the collection had 100's, 1000's of items?  Makes for quick UI responsiveness.

The only way I have found to accomplish this is instantiating an IEnumerable object, setting its collection to that of the ObservableCollection<T> that the filter list is bound to (public property), then setting said public property to this IEnumerable object that is, in a sense, the same exact thing.  This way the collection has changed (sort of), and the CollectionChanged event now gets fired.  The list is re-bound and we start from scratch with no highlighted rows.

That seems like kind of a hack to me.  Anyone else care to chime in?

I'll try to get a code sample but this is one of those things that I had to voice out first.  I hope it's not too hard to follow.   For some reason today I had Paul Engemann's "Push it to the Limit" in my head while trying out all sorts of different ways of accomplishing this task.  I kind of laughed to myself at the idea of a programming montage set to this song (kind of like in the South Park episode with the skiing contest. And, of course, Scarface).

For the first time EVER on this blog, musical accompaniment:

kick it on DotNetKicks.com

<< Newer Entries Older Entries >>