Error in the VMs for FinalSbSVMs – ADFS2

I was running through the steps in Federated Document Collaboration Using Microsoft Office SharePoint Server 2007 and AD FS 2.0 and as I got the virtual machines running, tying to log in to ContosoSrv02, I was met by the error below;

Trust Relationship Between Workstation and Domain Fails

I’m not sure why I got this, but there was no way to log on using the domain admin account. I found this knowledgebase article http://support.microsoft.com/kb/162797 that states that I should

Log on locally as a local administrator. In the Network tool of Control Panel, select Change and enter a Workgroup name, leaving the domain. Restart the computer and log on locally as a local administrator.

  • There are two methods to rejoin the domain:
    You can join the domain from the client if at the same time you can provide an administrator username and password on the domain.
    -or-
  • You can delete the existing computer account in Server Manager, recreate the computer account, synchronize the domain, and then on the client rejoin the domain.

But what’s the local admin password for the ContosoSrv02 server? Turns out it can be found by heavy googling – and apparantly the local admin password for other Contoso Virtual Machines has been p@ssw0rd – and what do you know? It works for this machine as well!

Redust SEO Rules

I’m proud to announce a new site that focuses on Search Engine Optimization tools that I’m working on with a team of developers that’s called redust.com. Our first tool, SEO-Rules automatically validates a page against a large number of Search Engine Optimization Rules.

The redust.com application, which will host several different tools, we’re currently have very specific plans for two more tools.

Remove Google Stopwords From String

If you’re anything like me, you’ve often wondered “how do I remove google stopwords from my strings”? Well, maybe you haven’t, but this is the method I came up with to do just that.

Google stopwords are words that are ignored in your query and on indexing your web pages, things like “a”, “about”, “above”. Here’s a list of stopwords assumed to be used by search-engines; http://www.ranks.nl/resources/stopwords.html and here’s another; http://www.link-assistant.com/seo-stop-words.html.

My method converts this text;

This is a text with lots and lots of stopwords. It also talks
a bit about load balancing. Load balancing is not a stopword.

To this text;

      text   lots   lots   stopwords.
talks   bit   load balancing. Load balancing       stopword.

Note that there are many double spaces, which we’ll take care of next.

The actual regex for clearing out stopwords looks like this (I’m only using a few of the words here);

(?<=(\A|\s|\.|,|!|\?))(a|able|about|above|abroad)(?=(\s|\z|\.|,|!|\?))

Btw, I use the awesome Regex Buddy for all my Regex needs- Regex Buddy, you’re my buddy too!

The Regex uses look-ahead and look-behind which not all Regex engines supports, and Regex formats may be differ. The reason it uses look-ahead and look-behind is that we don’t want the regex to “eat” the word separators, because if it did it would lose every second word that matches the regex. Believe me, it’s true, or use – you guessed it – Regex buddy to confirm.

If you’re clever, like me, you’ll be able to read the regex like it was plain english… ok, it’s obtuse and obfuscated, but it works.

I generated it like this (after using aforementioned Regex Buddy to determine the format);

string[] stopwords = File.ReadAllLines("EnglishStopwords.txt");

string regexCode = 
  @"(?<=(\A|\s|\.|,|!|\?))(" + 
  string.Join("|", stopwords) + 
  @")(?=(\s|\z|\.|,|!|\?))";

Regex regex = new Regex(regexCode, RegexOptions.Singleline | RegexOptions.IgnoreCase);

string cleaned = regex.Replace(indata, " ");

As for removing the double spaces, use this;

Regex removeDoubleWhiteSpace = 
  new Regex(@"\s{2,}", RegexOptions.Singleline | RegexOptions.IgnoreCase);

string cleaned = 
  removeDoubleWhiteSpace.Replace(cleaned, " ");

So, this is a rather compact version of what I’m doing;

public static void Test()
{
    string text =
        @"This is a text with lots and lots of stopwords. It also" + Environment.NewLine +
            "talks a bit about load balancing. Load balancing is not a stopword.";

    Console.WriteLine("Before:");
    Console.WriteLine(text);

    string[] stopwords = File.ReadAllLines(@"c:\slask\EnglishStopwords.txt");

    string regexCode = 
        @"(?<=(\A|\s|\.|,|!|\?))(" + 
        string.Join("|", stopwords) + 
        @")(?=(\s|\z|\.|,|!|\?))";

    Regex regex = new Regex(regexCode, RegexOptions.Singleline | RegexOptions.IgnoreCase);
            
    string cleaned = regex.Replace(text, " ");

    Console.WriteLine("\nAfter remove stopwords:");
    Console.WriteLine(text);

    Regex removeDoubleWhiteSpace = 
        new Regex(@"\s{2,}", RegexOptions.Singleline | RegexOptions.IgnoreCase);

    cleaned = 
        removeDoubleWhiteSpace.Replace(cleaned, " ");

    Console.WriteLine("\nAfter remove double white spaces:");
    Console.WriteLine(cleaned);
}

and the output looks like this;

Before:

This is a text with lots and lots of stopwords. It also

talks a bit about load balancing. Load balancing is not a stopword.

After remove stopwords:

This is a text with lots and lots of stopwords. It also

talks a bit about load balancing. Load balancing is not a stopword.

After remove double white spaces:

text lots lots stopwords. talks bit load balancing. Load balancing stopword.