posts - 225, comments - 6, trackbacks - 2

Technical Thoughts of Jorriss

Issues, ideas and technology solutions - The technical blog of Richie Rump

Sunday, November 09, 2008

Mulitiple Monitors + Notebooks = Hidden Windows

On my main machine, a T60 Thinkpad, I’m still using XP. Next month, I’ll be getting a new Thinkpad which I’ll install Vista 64 until then I’m still dealing with a small problem. When I’m at work with the dual monitors every thing runs just fine but when I get home and restart some apps they are stuck on the non-existent second monitor. Sometimes, I’m able to get into the registry and change the X, Y window coordinates but most time I’m stuck. Until now. To get the window back right click on the application in the task bar and select Move. From there, use the arrow keys to move the window to the current monitor. You can also press an arrow key then use the mouse to move the window. If you only use the mouse it won’t work. Via http://edwardkim.net

posted @ Sunday, November 09, 2008 5:33 PM | Feedback (0) | Filed Under [ General ]

Thursday, November 06, 2008

Download All of the PDC 2008 Sessions and Slides

This year I was able to attend Microsoft's PDC 2008. There were tons of fantastic sessions that I was unable to attend. One of the great things that Microsoft did with the PDC this year was to make the session videos available to everyone within twenty-four hours of the presentation. That's great but what if you wanted to download all of the session for offline viewing? Luckily for us Luciano Evaristo Guerche has made a tutorial to download all of the session videos and PowerPoint decks. Essentially, it involves a FireFox plug-in called DowThemAll to download all of the session videos that Luciano has aggregated in four blog posts PDC 2008 - Day 1 (46 matching sessions), PDC 2008 - Day 2 (50 matching sessions), PDC 2008 - Day 3 (60 matching sessions), PDC 2008 - Day 4 (49 matching sessions). Really nifty. But when the files are downloaded it saves the session number in the file name and not the session name. So I created a small program that scrapes the session titles from Luciano's posts and concatenates it with the session number and renames the file. You can download the project or view the source below. Enjoy.

Update: 11/1/08 7:30 PM - After downloading the files I've found a few are not available.

PowerPoint Slides:
BB13 SharePoint 2007 - Creating SharePoint Applications with Visual Studio 2008
BB39 NET Services - Logging, Diagnosing, and Troubleshooting Applications Running Live in the Cloud
SYMP05 Services Symposium - Enterprise Grade Cloud Applications
SYMP03 Parallel Symposium - Future of Parallel Computing
PC48 Research - Designing the World Wide Telescope
TL57 Panel - The Future of Programming Languages
TL61 Panel - The Future of Unit Testing

High Quality Videos
BB06 Live Services - Mesh Services Architecture and Concepts
BB51 Live Services - Programming Live Services Using Non-Microsoft Technologies

Update 11/6/08 10:30 PM – Looks like I should read more carefully. Luciano’s post shows how you can rename the files within DownThemAll. Guess it’s just another case of a programmer creating a solution for something that’s already been solved. Either way it was good to get into some code.

   1: using System;
   2: using System.Collections.Generic;
   3: using System.Linq;
   4: using System.Text;
   5: using System.Net;
   6: using System.IO;
   7: using System.Text.RegularExpressions;
   8: using System.Collections;
   9:  
  10: namespace PDCLoadSessionNames
  11: {
  12:  
  13:     class Program
  14:     {
  15:  
  16:         static string getHTMLPage(string Url)
  17:         {
  18:  
  19:             // Open a connection
  20:             HttpWebRequest WebRequestObject = (HttpWebRequest)HttpWebRequest.Create(Url);
  21:             WebRequestObject.ContentType = "text/html";
  22:  
  23:             WebResponse Response = WebRequestObject.GetResponse();
  24:  
  25:             Stream WebStream = Response.GetResponseStream();
  26:             StreamReader Reader = new StreamReader(WebStream);
  27:  
  28:             string PageContent = Reader.ReadToEnd();
  29:  
  30:  
  31:             Reader.Close();
  32:             WebStream.Close();
  33:             Response.Close();
  34:  
  35:             return PageContent;
  36:         }
  37:  
  38:         static void ProcessPage(string Url, ArrayList Titles)
  39:         {
  40:             string html = getHTMLPage(Url);
  41:  
  42:             Regex titleRegex = new Regex("<P><STRONG>(?<title>[A-Z][A-Z][0-9][0-9].+?)</STRONG>");
  43:  
  44:             string pattern = "<P><STRONG>(?<title>.+?)</STRONG>";
  45:             MatchCollection titleMatches = Regex.Matches(html, pattern);
  46:             foreach (Match titleMatch in titleMatches)
  47:             {
  48:                 string title = titleMatch.Groups["title"].Value;
  49:                 Titles.Add(title);
  50:             }
  51:         }
  52:  
  53:         static void RenameFiles(string Path, ArrayList titles)
  54:         {
  55:             DirectoryInfo sessionDir = new DirectoryInfo(Path);
  56:  
  57:             foreach (string title in titles)
  58:             {
  59:                 string subTitle = title.Substring(0, 6);
  60:                 if (subTitle.Substring(4, 1) == " ")
  61:                 {
  62:                     subTitle = subTitle.Substring(0, 4);
  63:                 }
  64:  
  65:                 foreach (FileInfo sessionFile in sessionDir.GetFiles())
  66:                 {
  67:  
  68:                     int dotLoc = sessionFile.Name.LastIndexOf(".");
  69:                     string fileName = sessionFile.Name.Substring(0, dotLoc);
  70:  
  71:                     string newFileName = title;
  72:                     newFileName = newFileName.Replace(".", "");
  73:                     newFileName = newFileName.Replace(":", " -");
  74:                     newFileName = newFileName.Replace("/", "");
  75:  
  76:                     if (subTitle == fileName)
  77:                     {
  78:                         File.Move(sessionFile.FullName, Path + newFileName + sessionFile.Extension);
  79:                         Console.WriteLine(Path + newFileName + sessionFile.Extension);
  80:                     }
  81:                 }
  82:             }
  83:         }
  84:  
  85:         static void Main(string[] args)
  86:         {
  87:             ArrayList titles = new ArrayList();
  88:             ProcessPage("http://weblogs.asp.net/guerchele/archive/2008/10/29/pdc-2008-day-1-46-matching-sessions.aspx", titles);
  89:             ProcessPage("http://weblogs.asp.net/guerchele/archive/2008/10/29/pdc-2008-day-2-50-matching-sessions.aspx", titles);
  90:             ProcessPage("http://weblogs.asp.net/guerchele/archive/2008/10/29/pdc-2008-day-3-60-matching-sessions.aspx", titles);
  91:             ProcessPage("http://weblogs.asp.net/guerchele/archive/2008/10/29/pdc-2008-day-4-49-matching-sessions.aspx", titles);
  92:  
  93:             RenameFiles("e:\\sessions\\", titles);
  94:             Console.ReadKey();
  95:         }
  96:     }
  97: }

 

Technorati Tags:

posted @ Thursday, November 06, 2008 11:09 PM | Feedback (2) | Filed Under [ .Net C# Conferences & Gatherings ]

Monday, April 28, 2008

Project Web Server ActiveX controls cannot be downloaded

I ran into this issue today. When I logged into our Project Web Server website I received this error:

The controls for Project Web Access cannot be downloaded correctly. To download the controls:
  • Verify your security settings in Internet Explorer are set to allow ActiveX controls to be downloaded.
  • Check to see if Internet Explorer has stopped the installation of the ActiveX controls.
  • To install the controls, on the Information Bar, click Install ActiveX Control. You need to use a 32-bit version of your browser to download and run the ActiveX controls.
  • Contact your systems administrator.

After a reboot found this article entitled Error message when you start Microsoft Project Web Access: "The controls for Microsoft Project Web Access could not be downloaded correctly" in the Microsoft Knowledge Base. To fix the issue I removed the Project Web Access ActiveX controls by:

Remove any controls that are already downloaded
Project 2007
  1. Start Internet Explorer.
  2. On the Tools menu, click Internet Options.
  3. Click the General tab, and then click Settings in the Browsing history section.
  4. Click View Objects.
  5. Right-click Pj12enuC Class, and then click Remove.
  6. Right-click PjAdoInfo4 Class, and then click Remove.
  7. Close the View Objects window, and then click OK two times. 

I then went back into our Project Web Access website and downloaded the ActiveX controls again. Worked like a charm.

posted @ Monday, April 28, 2008 5:57 PM | Feedback (2) | Filed Under [ Project Web Server ]

Thursday, April 24, 2008

Unraveling the mysteries of NewSequentialID

A few months ago we started development on a new system. From the ground up we redesigned everything from our business processes to how we store data. Part of the redesign was deciding on using SOA technology in our middle tier. This will allow us to separate our UI from our middle tier even further. Due to the disconnected way our objects were going to work we decided to use guid or unique identifiers for our primary keys in our data model and assign guids in the middle tier. Of course, our DBAs weren't too keen on the idea and even now they are still a bit gunshy but they're coming around.

Of course, is one of the big concerns that the DB team has is the performance of SQL Server with GUIDs which has been well documented all across the net. So we decided to use the NewSequentialID() function as the default for all guid primary keys. On the application side we decided to implement a GUIDComb which was created by Jimmy Nilsson. The issue that we ran into with the GUIDComb was that it was creating guid sequence that was different from the NewSequentialID guid sequence.

At this point I decided to jump into the Google abyss and see if anyone else conquered this problem. The first solution that I found took a guid generated from System.Guid.NewGuid and reordered it so SQL Server would sort it correctly. The major issue that I found with this approach was the fact that it incremented the guid internally and didn't store the guid in the SQL Server sequence.

It was at this time that I found and excellent article by Rob Garrison entitled "Exploring NewSequentialID() in SQL Server 2005". In the article he discusses the differences between NewID() and NewSequenceID() and how NewSequenceID() uses a shared counter. So if you insert a row into Table1 then Table2 then Table1 again you will see the following GUID sequence.

63DD0AD3-A111-DD11-B2EB-005056AE063C -- Table1
64DD0AD3-A111-DD11-B2EB-005056AE063C -- Table2
65DD0AD3-A111-DD11-B2EB-005056AE063C -- Table1

That article led me to another article "How are GUIDs sorted by SQL Server?" Which linked to to the SQL Programmability & API Development Team Blog where I found this gem "Newsequentialid (Histrory/Benefits and Implementation)". In this post, they explain that sequential guids are created by calling UuidCreateSequential function of the rpcrt4.dll "with some byte scrambling to convince the rest of SQL engine that guids are produced in sequential order". Here's an example of the usage. The output of two calls to the UuidCreateSequential function would look like this:

6F9F9BFB-1203-11DD-BC40-001641E22FDB
6F9F9BFC-1203-11DD-BC40-001641E22FDB

But if you look at a SQL Server generated sequential guid it would looks like this:

4782336F-0312-DD11-B2EB-005056AE063C
4882336F-0312-DD11-B2EB-005056AE063C

And that's when it hit me, that "byte scrambling" that SQL Server was doing was in the first four bytes. If your guid is 6F9F9BFB-1203-11DD-BC40-001641E22FDB the first for bytes would be 6F 9F 9B FB. If you reverse them, FB 9B 9F 6F that would be in the sequence that SQL Server is currently using.

6F9F9BFB-1203-11DD-BC40-001641E22FDB -- UuidCreateSequential
6F9F9BFC-1203-11DD-BC40-001641E22FDB -- UuidCreateSequential
FB9B9F6F-1203-11DD-BC40-001641E22FDB -- UuidCreateSequential Reversed Bits 
FC9B9F6F-1203-11DD-BC40-001641E22FDB -- UuidCreateSequential Reversed Bits
4782336F-0312-DD11-B2EB-005056AE063C -- NewSequentialID
4882336F-0312-DD11-B2EB-005056AE063C -- NewSequentialID

Here's the code I created to create SQL Server formatted sequential guids in .Net:

Public Class SequentialGuid
    Declare Function UuidCreateSequential Lib "rpcrt4.dll" (ByRef id As Guid) As Integer

    Public Shared Function CreateSequentialGUID() As Guid

        Dim newGuid As Guid
        Dim returnVal As Integer
        returnVal = UuidCreateSequential(newGuid)

        Dim bytes As Byte() = newGuid.ToByteArray

        If returnVal <> 0 Then
            Throw New Exception("CreateSequentialGUID failed.")
        Else
            Array.Reverse(bytes, 0, 4)
            Array.Reverse(bytes, 4, 2)
            Array.Reverse(bytes, 6, 2)
            newGuid = New Guid(bytes)

            Return newGuid
        End If
    End Function
End Class

The one caveat is that DB generated guids and .Net generated guids may be not reflect the order in which the rows were inserted due to the mac address in the guid and the way SQL sorts its guids. (See the "How are GUIDs sorted by SQL Server?" article for more details.) You may see blocks of guids in your table generated by different machines. So if you need to know the true sequence of when a row was added to a table then use a created date field and the GetDate function.

Other Sources:

Improve Your Guid Key Performance with GuidCombs

The Cost of GUIDs as Primary Keys

The NewSequentialID Function

Generate Sequential GUIDs for SQL Server 2005 in C#

Sequential GUID Generator on Codeplex

UuidCreateSequential rptcrt4.dll 

SqlGuid Structure

How are GUIDs compared in SQL Server 2005?

posted @ Thursday, April 24, 2008 2:55 PM | Feedback (1) | Filed Under [ .Net Database Middleware SOA SQL Server ]

Tuesday, April 22, 2008

Google Calendar Sync Issue

Recently, I started to use Google Calendar to share my schedule with my wife. To do this I'm using Google's Outlook Calendar Sync utility. The first version that I used (0.9.3.0) worked fine but it didn't get all of my appointments and it loaded my Deleted folder with thousands of blank appointments after each sync. A few weeks ago they released an update (0.9.3.2) that appeared to fix the blank appointment issue but I started to get this error:

Some of your Outlook appointments could not be loaded. Sync is interrupted in order to prevent actual data loss.

I ignored it for some time hoping for a quick patch from Google. But today I started to investigate while waiting for some software to uninstall. A quick trip to the Google Calendar Help forum proved to be quite useful. My first task was to find out to view the Outlook Calendar Sync Logs which can be viewed in the following locations:

WINDOWS XP
C:\Documents and Settings\<username>\Local Settings\Application Data\Google\Google Calendar Sync\logs
WINDOWS VISTA
C:\Users\<username>\AppData\Local\Google\Google Calendar Sync\logs

The log had this information in it:

SEVERE: IDispatch::GetProperty : EntryID //  [hr: -2147352567] [exception One or more items in the folder you synchronized do not match. To resolve the conflicts, open the items, and then try this operation again. wCode: 4096 scode: -2147352567]
SEVERE: Failed to load even brief info.
Unable to load basic info
SEVERE: Unable to get events from Outlook

So, there was some sort of issue that the sync tool was having when trying to retrieve the calendar events. The resolution came when I came across this post in the forum. It details the following steps to resolve an Outlook conflict.

  1. Open your calendar in Microsoft Outlook.
  2. Select "View by Category." (Main Menu > View > Arrange By > Current
    View > By Category)
  3. You'll see a list of events (if the events are collapsed in categories, you can expand them by clicking the "+" sign"). Using the icons to the left of each event, find events that have a "warning" icon (i.e. crossing swords).
  4. Double-click on each problematic event to resolve the problem
 

Sure enough, I found seven conflicts with appointments dating all the way back to 2003. They must of been hanging around for the past five years and I didn't know it. I cleared the conflicts and reran the Google Outlook Sync and it worked.

posted @ Tuesday, April 22, 2008 2:30 PM | Feedback (0) | Filed Under [ Google Calendar ]

Monday, April 21, 2008

Free SQL Server 2008 Courses From Microsoft

Microsoft is offering free SQL Server 2008 online courses. The offered titles are:

  • What's New in SQL Server 2008 for Enterprise Data Platform
  • What's New in SQL Server 2008 for Business Intelligence
  • What's New in SQL Server 2008 for Database Development

We've been keeping our ear pretty close to the ground on SQL Server 2008 so this may come in handy. But according to my boy Jason SQL Server 2008 is a minor release. The course is free nonetheless.

Tuesday, April 08, 2008

Setting the default browser in Visual Studio

imageSince installing Visual Studio 2008 when I debug web projects VS opened the project in my default browser (currently Maxthon) and not Internet Explorer. Of course this isn't what I wanted. So I opened up trusty Google and found an answer on stevenharman.net.

As it turns out setting this is quite simple.

  1. Open a WebForm file in VS (anything ending in .aspx will do)
  2. Select the "Browse With..." option from the File menu
  3. Select your preferred browser from the list and click the "Set as Default" button

Now opening, browsing, or debugging a WebForm from within Visual studio will open the file in the specified browser (IE in my case) rather than my system default.

And what do you know it works. Here's the complete article if you are so inclined. Thanks Steven.

posted @ Tuesday, April 08, 2008 1:08 AM | Feedback (0) | Filed Under [ Visual Studio ]

Saturday, March 22, 2008

Visual Studio 2008 and .NET Framework 3.5 Training Kit

Microsoft has released the Visual Studio 2008 and .Net Framework 3.5 Training Kit.

The Visual Studio 2008 and .NET Framework 3.5 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2008 features and a variety of framework technologies including: LINQ, C# 3.0, Visual Basic 9, WCF, WF, WPF, ASP.NET AJAX, VSTO, CardSpace, SilverLight, Mobile and Application Lifecycle Management.

I always love free training material. Enjoy. Via Elegant Code.

posted @ Saturday, March 22, 2008 5:43 PM | Feedback (0) | Filed Under [ .Net Visual Studio ]

Wednesday, March 12, 2008

Team Foundation Server 2005 to 2008 Upgrade Experience

After the nightmare that was the Team Foundation Server 2005 installation I was secretly dreading the 2008 upgrade. But somewhere in the back of my mind I was also cautiously optimistic as well. I mean could it possibly be any worse than the 2005 install? I did my homework pouring over the install instructions over the past few days. I wanted to be ready for anything. Fortunately for me, I didn't have much to worry about. Two resources that helped immeasurably were the Team Foundation Installation Guide for Visual Studio Team System 2008 and Grant Holliday's Tips for upgrading from TFS2005 to TFS2008 post. I also got to give the guys over at Radio TFS an assist for their TFS 2008 What's New and Should You Upgrade show.

The only issue that we ran across was directly related to the installation instructions in the the Installation Guide. In the "Upgrading Your Team Foundation Server" page in the "Before You Upgrade Team Foundation Server" section step six says to "Uninstall Team Foundation Server". What it doesn't say is what applications consist of Team Foundation Sever. We later determined that this meant TFS 2005 Build and TFS 2005 Services and TFS 2005 Databases but initially we only uninstalled the build and services apps. Luckily, the System Health Check caught the problem and after uninstalling the databases app the install went fine.

Big ups to the TFS team for dramatically improving the install experience. What once took days now only takes hours.

posted @ Wednesday, March 12, 2008 9:26 PM | Feedback (0) | Filed Under [ TFS ]

Didn't think it would happen did ya?

I'm back. It's been a long time since my last post. Since then Alexa is 1.5 times older, I've been promoted at work, I've gotten more involved at church and I'm busier than ever. I did have a good logical reason why I stopped blogging but I'm going to save that for later. I've also been able to move the blog from .Text to Community Server thanks to Kevin Harder and his migration tool. I was able to move web hosts as well. I'm still going to keep the personal stuff on Jorriss.com and the technical stuff at Jorriss.net. The design of the blogs will also be changing over the next few months. Frankly, I have no idea what it's going to look like. Maybe J can help. Anyways brace yourself kids...I'm back.

 

posted @ Wednesday, March 12, 2008 1:05 AM | Feedback (0) | Filed Under [ General ]

Powered by: