HOWTO remove diacritics in a string

20. October 2009 13:31 by arnoldbo in General  //  Tags:   //   Comments

When comparing strings you sometimes need to ignore diacritics (accents) like é, ö etc.
The following method removes the diacritics:

With the following extension method you can compare two strings for equality: 

static string RemoveDiacritics(string stIn)
{
    string stFormD = stIn.Normalize(NormalizationForm.FormD);
    StringBuilder sb = new StringBuilder();
    for (int ich = 0; ich < stFormD.Length; ich++)
    {
        UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(stFormD[ich]);
        if (uc != UnicodeCategory.NonSpacingMark)
        {

            sb.Append(stFormD[ich]);
        }
    }
    return (sb.ToString().Normalize(NormalizationForm.FormC));
}

public static bool Equals2(this string source, string toCheck)
{
    return RemoveDiacritics(source).ToLower().Trim() == 
        RemoveDiacritics(toCheck).ToLower().Trim();
}
The following code gives as result 'True'. 
string x = "Azië";
bool equal = x.Equals2("azie");

 

Padding is invalid and cannot be removed

10. October 2009 13:14 by arnoldbo in General  //  Tags: , ,   //   Comments

After deploying my asp.net site to a webhosting company I suddenly was faced with error's when requesting WebResource.axd.

The following error occured:
Padding is invalid and cannot be removed.

Stacktrace:    at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
   at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
   at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
   at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo)
   at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType)
   at System.Web.UI.Page.DecryptString(String s)
   at System.Web.Handlers.ScriptResourceHandler.DecryptParameter(NameValueCollection queryString)


The solution for this problem for me was to set a fixed machine key in the web.config file.
For this you can use a machineKey generator or generate your own if you know how to do it (random chars will not work).

  <system.web>
    <machineKey    validationKey='A06BDCF2F6CF.A.VERY.LONG.44F13E76184945A7C477601'
        decryptionKey='99079B21C2F3644.A.BIT.SHORTER.BB81C7E9D58378'
        validation='SHA1'/>
  </system.web>


For more detailed information you can read the blog post from José Antonio

Using Fiddler with Visual Studio build in Webserver

14. September 2009 09:45 by arnoldbo in Tools  //  Tags: , ,   //   Comments
Today I needed to inspect the webtraffic to my WCF webservices, Fiddler was not able to see my webtraffic to localhost. To use fiddler with localhost these steps needs to be done: 1. Disable IPv6 in Fiddler configuration. [caption id="attachment_41" align="aligncenter" width="480" caption="Fiddler settings"]Fiddler settings[/caption] 2. Add <computername> to your hosts file and set it to 127.0.0.1. 127.0.0.1                       <computername> 3. request your webserver with :http://<machinename>:<portnumber>. [caption id="attachment_43" align="aligncenter" width="480" caption="Fiddler Traffic"]Fiddler Traffic[/caption]

Microsoft Techday's

6. March 2009 10:07 by arnoldbo in General  //  Tags: ,   //   Comments
Next week André and I attend the Microsoft TechDays in Antwerp. We are especially interested in the pre-conference day. This is a hole day of SharePoint sessions! LINQ and SharePoint WCF webservices and SharePoint Workflow and SharePoint

At the conference I will blog about the sessions. 480x325ani

Creating MSDN like documentation of your C# project

10. February 2009 06:28 by arnoldbo in Tools  //  Tags: , ,   //   Comments
[caption id="attachment_31" align="alignleft" width="100" caption="Sandcastle Logo"]Sandcastle Logo[/caption] Today I needed to document my C# project for a customer, for creating the documentation automatacly I used the Sandcastle tool. I used a Blog post from Jan Schreuder where he describes how to build your own documentation. http://bloggingabout.net/blogs/jschreuder/archive/2007/03/20/using-sandcastle-is-increasingly-mature.aspx The description didn't work for my directly I needed to install Microsoft HTML Help

Sharepoint Technical pre-sales course

6. January 2009 06:49 by arnoldbo in Course  //  Tags: , , ,   //   Comments
Last month I succesfully finished the course: Understanding and Positioning the New Features of Office SharePoint Server 2007 and Windows SharePoint Services 3.0 for Technical Pre-Sales Professionals. The course was about the features WSS3.0 and MOSS2007, this course is good to get up-to-speed with sharepoint the course covers all aspects of the system and how features can help company's to solve their problems.

WSS 3.0 Certification

14. November 2008 14:20 by arnoldbo in Course  //  Tags: ,   //   Comments
Today I passed the Microsoft Windows SharePoint Services 3.0 – Application Development (70-541) exam! Now I can move on and prepare for the Microsoft Office SharePoint Server 2007 – Application Development (70-542) course.

Sharepoint development course

4. October 2008 06:36 by arnoldbo in Course  //  Tags: , ,   //   Comments
Last week Dirk Straathof en I followed the Sharepoint 2007 development course at u2u in Brussels. The course we followed was: http://www.u2u.be/CoursePage.aspx?CODE=UO12W. During this course we learned all about WSS3.0 and MOSS 2007. The Topics we discussed were: Module 01 – Introducing SharePoint 2007 Development
  • Windows SharePoint Services 3.0 versus Microsoft Office SharePoint Server 2007
  • What is SharePoint development all about? What are the skills needed? Your development environment?
  • A look at the WSS 3.0 architecture.
  • Extending an IIS Web Application.
Module 02 – WSS 3.0 Architecture
  • Farms and IIS Web Applications
  • Extending an IIS Web Application
  • LAB – Extending an IIS Web Application
Module 03 – Site Collections, Sites, Lists and Document
  • Site Collections and Sites
  • Site Templates and Site Definitions
  • Lists and Document Libraries
  • LAB – Site Collections, Sites, Lists and Document Libraries
Module 04 – Introducing the WSS 3.0 Object Model
  • Introducing the WSS 3.0 Object Model
  • SPSite and SPWeb
  • SPList and SPListItem
  • SPDocumentLibrary and SPFile
  • The Lists Web Service
  • LAB – Working with the WSS 3.0 Object Model
Module 05 - WSS 3.0 Features Framework
  • Introducing Features
  • Building a Feature Project
  • Light-Up SharePoint with Custom Actions
  • Installing, Activating, Deactivating and Uninstalling Features
  • Feature Receivers
  • LAB – Light-Up SharePoint with Features
Module 06 - SharePoint Solutions
  • Introducing SharePoint Solutions
  • Creating a SharePoint Solution
  • Adding and Deploying SharePoint Solutions
  • Installing, Activating, Deactivating and Uninstalling Features
  • Retracting SharePoint Solutions
  • LAB – Creating a SharePoint Solution
Module 07 - Application Pages and Site Pages
  • Application Pages
  • Site Pages
  • Web Part Pages
  • LAB – Application Pages and Site Pages
Module 08 - Branding WSS 3.0 Sites
  • Master Pages
  • Styling a SharePoint Site
  • Building Custom Themes
Module 09 – Managing Content in WSS 3.0
  • Document Management Features
  • User Administration
  • Introduction to the Building of Custom Field Types
  • Executing CAML Queries
  • Site Columns and Content Types
  • Event Handlers
Module 10 - More Programming with Lists and Document Libraries
  • Introduction in the Building of Custom Field Types
  • Executing CAML Queries
  • Introducing Event Handlers
  • LAB – More Programming with Lists and Libraries
Module 11 – Building Web Parts
  • Essential Steps of Building and Deploying a Web Part
  • Exposing Web Part Properties
  • Code-Access Security and Web Parts
  • Connectable Web Parts
  • User Controls and Web Parts
  • LAB – Building Web Parts
Module 12 – Introducing the Microsoft Office SharePoint Server 2007
  • Overview of MOSS 2007
  • Shared Services Providers
  • Collaboration and Publishing Portals
Module 13 – Configuring and Branding Portals
  • Configuration of available Site Templates
  • Master Pages
  • Styling of Portals
  • Site Variations
  • LAB - Configuring and Branding Portals
Module 14 – Authoring and Publishing Pages
  • Page Model in a Portal
  • Creating Custom Page Layouts
  • Configuring the Publishing Cycle
  • Working with the Content Query Web Part
  • LAB – Authoring and Publishing Pages
Module 15 – Building InfoPath Solutions
  • Introducing InfoPath 2007
  • Designing InfoPath 2007 Templates
  • Deploying InfoPath Templates
  • Integration
  • LAB – Building InfoPath Solutions
Module 16 – Building Workflow Solutions
  • Introducing Workflows and the Windows Workflow Foundation
  • Workflow Terminology and the OOB Experience
  • Building a Simple Workflow with Visual Studio
  • LAB _ Building Workflows Solutions/li>
Module 17 – The Business Data Catalog
  • Why the Business Data Catalog?
  • Business Data Catalog Architecture
  • Preparing the Business Data Catalog
  • Working with the Business Data Web Parts
  • Business Data in Other Places
  • BDC Programming Model
  • LAB - The Business Data Catalog
Module 18 – MOSS 2007 Search
  • Search Topology and Architecture
  • Search Administration 101 for Developers
  • Customizing the Search Center
  • Programmatically Executing Search Queries
  • LAB – MOSS 2007 Search
Module 19 – Excel Services and Reporting
  • Excel Services
  • Reports
  • Dashboards
Module 20 – Information Management Policies and Records Management
  • Working with Information Management Policies
  • Creation and Deployment of Custom Policies
  • Configuring a Records Center
  • Submitting Records to the Records Center