vrijdag 6 november 2009

The Machine SID Duplication Myth

I make heavily use of virtual machines. For development, testing beta applications (like Visual Studio 2010) and client-side testing. When something goes wrong, you just abandon the image, get a fresh copy and start again.

One of the things I always used to do is run the NewSID tool from sysinternals to generate a new SID for the copied VM. There was something about problems when running multiple computer with the same SID. At least, that was what I was told a long time ago by a system administrator. And they should know, right?

Wrong. It seems the whole process of changing a computers SID was a myth. Take some time and read through the article by Mark Russinovich. He is the creator of NewSID and explains in detail why it is not necessary anymore (and never was) to change a machines SID.

The full article: Mark's Blog : The Machine SID Duplication Myth

donderdag 5 november 2009

SharePoint : Site Provisioning Order

Recently, I stumbled across a annoying issue when building a new Site Definition for a SharePoint portal.

The Site Definition contained several document libraries and some features. One of these features interacted with the new document libraries. Within the attached feature receiver it sets some properties on the document libraries for the versioning of the documents.

I knew the entries in the onet.xml would be processed in sequence, but to my surprise the lists properties where not set. When debugging the feature receiver I discovered the lists were not there yet. But the List section in the onet.xml was put before WebFeatures section.

After some more debugging and searching the internet I came across an article describing the order in which the onet.xml is processed.

The appears the onet.xml sections are processed in a fixed way. And only the entries with in a section are processed in the order they are put in the file.

SharePoint provisions in the following order:

  1. global onet.xml
  2. SPSite scoped features defined in onet.xml, in the order they are defined in the file.
  3. SPSite scoped stapled features, in quasi random order
  4. SPWeb scoped features defined in onet.xml, in the order they are defined in the file.
  5. SPWeb scoped stapled features, in quasi random order
  6. List instances defined in onet.xml
  7. Modules defined in onet.xml

Right. My idea of using the onet.xml to contain all parts of the site and to use a generic feature for all site definitions went down the drain.

I have solved the problem by adding an additional feature for each site definition, which contains the document libraries to be created and the feature receiver. It works fine, but I would have preferred to keep it all down to the onet.xml and one feature.

The full article: Shared Points for SharePoint : Site Provisioning Order

woensdag 28 oktober 2009

.NET Cheat Sheets

One of the features of Visual Studio are code snippets. Visual Studio contains many of them, but it is not always clear which ones there are and what they do. Until now :-)

The link below shows a lot of Cheat Sheets for .NET and Visual Studio. Not only the code snippets are listed, but also HTML references, the Microsoft ASP.NET Ajax libraries, jQuery and many other subjects.

.NET Cheat Sheets « John Sheehan : Blog

dinsdag 27 oktober 2009

31 Days of Refactoring eBook

All developers know this. Written code can always be improved. As a developer I also spent time refactoring my code. Merge methods, extracting methods to new classes, streamlining loops. It’s just everyday business.

Sean Chambers, a blogger on Los Techies, did a great series on refactoring. For one month, he posted an article about one refactoring technique. In total there were 31 posts.

All these articles are now bundled into an excellent eBook, which is available for free download.

The eBook: 31 Days of Refactoring eBook - Sean Chambers - Los Techies

dinsdag 25 augustus 2009

Trojan software targeting Delphi

 

After reading the following post at F-Secure, some creepy feeling came over me. And I believe this is something most people (developers, like me, in particular) do not realize or have even considered before.

A short summary of the F-Secure post. A developer is creating a piece of software using a Delphi compiler. He delivers the software and says it’s free of Trojans etc., because he compiled it himself.
The thing he was not aware is that some of the standard libraries on his machine where replaced by a Trojan he got from somewhere. As a result all software compiled on that machine included the corrupted library and, alas, a Trojan.

The full F-Secure blog post: 0wn1ng Delphi - F-Secure Weblog : News from the Lab

The construct is not new. This article from 1984 described the same method of distributing Trojans: Reflections on Trusting Trust. But the implications of it are somewhat shocking.
This means I, as a developer, could unknowingly be distributing Trojans. This could even ruin your business if you are not careful.

Bottom line of the story is: Always be careful with your development machine, because a Trojan can be distributed on a lot of different ways.

maandag 25 mei 2009

Configure Authentication Types in Reporting Services

When setting up a Team Foundation Server 2008 environment, I ran into some problems with Reporting Services.
The environment consists of:

  • Windows 2008 server
  • SQL Server 2008
  • Team Foundation Server 2008

This is a supported configuration for TFS, and with a lot of manual configuration the environment was finally functioning fine. Except the Reporting part…

When accessing a report, any non-admin  user got challenged with an authentication prompt. After three attempts they received a blank screen without a report.

On the web there were several articles about this problem, but none were able to provide the solution. After some testing and digging around in the server, the authentication type seemed to be the problem.

One of the articles I found was about disabling Kerberos on the server (IIS7), and it described my exact problem. But unfortunately it didn't help. The problem was still there. It seemed not to work.

After some more digging I found the answer in the SQL books online of TechNet. One line in the chapter was:

In previous versions of Reporting Services, all authentication support was provided by IIS. In this release, IIS is no longer used. Reporting Services handles all authentication requests internally.

Ah… That’s why turning the Kerberos setting off in IIS didn’t help. After this the solution was straightforward. I removed the RSWindowsNegotiate option from the RSeportServer.config file and my authentication problem was solved.

The link to the full chapters on TechNet SQL books online: http://technet.microsoft.com/en-us/library/cc281310.aspx

woensdag 13 mei 2009

Master Page and Content Page Interaction.

When programming asp.net web applications with master and content pages, I often need to access some controls on the master page from the content pages. And it is always a reinvention of the wheel on how to do it the right way.

I have been using the same method for some time now, but never gotten to share this knowledge with the public. I believe the information is unknown to most developers.

Yesterday I came across an article on CodeProject, which describes this method in a very clear way. There goes my article.

The details are in short:

  • Add
    <%@ MasterType virtualpath="~/DetailsMaster.master" %>

    to the content page.




  • Create a public function in the master page to access the control

    public Label LabelReference()

    {
    ' Create a reference to an actual label on the page
    LabelReference = lblDetailsItemName;

    }



  • Call the function from the content page



    Master.LabelReference.Text = "Some Text";






The full details of the aricle are here: CodeProject: Master Page and Content Page Interaction.

dinsdag 5 mei 2009

Performance issues with Virtual PC on laptops

I have been working with Virtual Machines for a long time. Because I work on different environments with different configurations (Windows 2008, Windows 2003, SQL 2005 and 2008, etc.), it is not an option to reinstall my machine every time.

But the annoying thing is always the limited performance of them. You need to wait a lot as it runs slower than a normal physical machine.

A colleague of me found a little hack to speed up a Microsoft Virtual PC. By adding a line to the configuration of VPC it will use get a bit more processing power, thus running a bit faster.

Check out the article below:
SharePoint 2007 development: Performance issues with Virtual PC on laptops

dinsdag 14 april 2009

LINQ to SharePoint

I myself are quite happy with LINQ. I have used it on numerous occasions and it saved me time on those same occasions.

But when working with SharePoint and CAML, I felt like I was missing something. I could use LINQ to access the SharePoint data.
Recently I came across this solution on CodePlex: LINQ to SharePoint. I have looked into it, and although it hasn’t been updated recently, it looks promising. I am looking forward to the moment I give it a try on the next project.

A short highlight of the features (taken from CodePlex):

  • Custom query provider that translates LINQ queries to CAML, the Collaborative Application Markup Language used by SharePoint for querying.
  • Support for LINQ in C# 3.0 and Visual Basic 9.0.
  • Entity creation tool SpMetal to export SharePoint list definitions to entity classes used for querying.
  • Visual Studio 2008 integration for entity creation (a.k.a. SPML).
  • Can connect to a SharePoint site either using the SharePoint object model or via the SharePoint web services.
  • Planned support for updating through entity types.

If you are into SharePoint development and know how to use LINQ, you should definitely give this a try.

zaterdag 11 april 2009

SharePoint Data Zoom Web Part

During one of my searches for usable components to help me build great SharePoint solutions, I came across this web part: SharePoint Data Zoom Web Part. And I have to say, it works great.

It comes with a included code-editor for writing the scripts. And there are even some extensions available to access Active Directory, SQL Server databases and some others (the extensions are not free, but come with a thirty-day evaluation).

An excerpt from the website:

Using the free SharePoint Data Zoom Web Part, your SharePoint pages can perform powerful, flexible queries on a variety of data sources using simple, familiar syntax that's easy to write and understand. You'll be able to create robust, value-added SharePoint applications in a fraction of the time and without the need for .NET or XSLT programming.

The SharePoint Data Zoom Web Part is a free tool which allows SharePoint users to easily build dynamic, data-driven content on any page. Data from SharePoint Sites, SharePoint Lists and virtually any other source can be aggregated and formatted with ease.

Using the Data Zoom Web Part, your SharePoint pages can perform powerful, flexible queries on a variety of data sources using simple, familiar syntax that's easy to write and understand. You'll be able to create robust, value-added SharePoint applications in a fraction of the time, without the need for .NET or XSLT programming.

I should say, just give it a try. It’s free. And it can be a great addition to your SharePoint development.