Saturday, July 09, 2011

C# Batch Replace with encoding

Here is the code I wrote for batch replace with GB2312 encoding:-

var dir = new DirectoryInfo(@"D:\hgb");
string strFileName;
string content;
var encoding = Encoding.GetEncoding(936);

foreach (var f in dir.GetFiles("*.htm", SearchOption.AllDirectories))
{
strFileName = f.DirectoryName + @"\" + f.Name;
using (StreamReader reader = new StreamReader(strFileName, encoding))
{
content = reader.ReadToEnd();
content = Regex.Replace(content, "font size=-1", "font size=48");
}




StreamWriter writer = new StreamWriter(strFileName, false, encoding);
writer.Write(content);
writer.Close();
}

Thursday, July 07, 2011

10175 Lab Correction (SharePoint 2010 Application Development)

General
  1. Trainer MOC page number may different with student page number.

Lab 2


  1. There are spacing issues in Exercise 3 Task 4 PowerShell Commands, All *SP Solution commands should be corrected as *SPSolution, e.g. Add-SP Solution should be corrected as Add-SPSolution.
  2. The -GAC Deployment should be corrected as -GACDeployment

Lab 4
  1. We should remove the where clause in unfilteredJobs LINQ query from Exercise 3 Task 5 Step 12 then only step 21 All Jobs will be displayed correctly.
Lab 5
  1. The web.config never changed although the lab works as expected, this issue is caused by access denied, we have to fix it in Powershell:
    $svc = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $svc.RemoteAdministratorAccessDenied = $False
    $svc.Update()
  2. We should reference to System.Configuration to use the ConfigurationManager in Exercise 3 Task 2 Step 2.
Lab 6
  1. When you are instructed to input any object or variable name with spacing, please remove the space, example:- HR Training Management has to be input as HRTrainingManagement.

Lab 8
  1. There is a list "Mashup" is hidden, we can display it from SharePoint Designer All Files section.

Lab 10
  1. Please create a site page named Training for Exercise 2 Task 9 Step 3
  2. You may need to click the Share Documents few times to let the video thumbnails to display accordingly.
Lab 13
  1. The Microsoft Office is not activated in Hyper-V image and not able to perform Exercise 2 Task 1, workaround is to copy the Metro theme from C:\Program Files (x86)\Microsoft Office\Document Themes 14\Metro.thmx to Desktop