May, 2009

.Net Service Bus: How to make training kit examples authenticate without problems

I’m trying out Azure Training Kit examples to study cloud stuff that should hit the streets (or sky) later this year. I faced some trouble when trying to connect with .Net Service Bus using settings mentioned in examples (netTcpRelayBinding and CardSpace). I tried hard but CardSpace authentication failed every time. My final solution was simple: I moved to username and password authentication scheme.

Modifying ClientID of ASP.NET controls

Client-side ID-s of ASP.NET controls have been problem for a long time. They are hard to predict and guess. Fool-proof method that uses JavaScript block that defines client-side ID-s as variable values is not very elegant. Today’s web applications use client-size scripting heavily and now ASP.NET 4.0 provides us with elegant features to handle client-size ID-s of controls to make client-side scripting easier for us. Let’s see quick example.

Reading embedded files at runtime

I have class library that contains some XML-files as embedded resources. Reading these files at runtime is very easy. It takes only couple of lines of code.

ASP.NET 4.0 SEO features: Description and keywords

Another new SEO feature that ASP.NET 4.0 introduces is support for meta description and keywords. I think these are the most abused SEO features ever and search engines are very careful when considering these meta tags but I am very sure that there are still engines that respect those tags and that’s what makes these new features very useful.

ASP.NET 4.0 SEO features: Response.RedirectPermanent()

ASP.NET 4.0 introduces some SEO improvements. Response has now new method calledRedirectPermanent(). This method performs same redirect as Response.Redirect() but it uses response code 301. You can find more information about HTTP response codes from HTTP 1.1 specification, chapter 10. Status Code Definitions.

.Net Framework 4.0: Introducing BigInteger

My previous posting was about performance of Fibonacci numbers algorithms. In this posting I will introduce you some problems related to limits of our usual integers and introduce you new feature in .Net Framework 4.0 – big integers. Big integers are useful when solving different mathematical problems. Also they are used in cryptography.

Performance of Fibonacci numbers algorithms

Performance of algorithms is important topic if you want to write programs that work fast and doesn’t eat too much resources. In this example I will show you two implementations of famous Fibonacci numbers algorithm and let you compare how these two implementations perform. This posting will be also introduction to my next posting to keep it smaller and to keep focus on point.

SharePoint: SPList.Clear() extension method

Currently there is no good method in SharePoint for deleting all items from list. But there are solutions that need this kind of functionality. During one of my projects I wrote extension method for SPList that removes all items from it.

.Net Framework 4.0: System.Linq.Parallel

.Net Framework 4.0 has parallel computing extensions for LINQ. Previously it was possible to download parallel extensions for LINQ separately from CodePlex. Of course, you can still use these extensions if you have older version that 4.0. I wrote a little, simple and pretty pointless example that illustrates how parallel queries work in .Net Framework 4.0.

.Net Framework 4.0: Using System.Lazy

.Net Framework 4.0 provides us with a new class called Lazy. As documentation sais then Lazy provides support for several common patterns of lazy initialization, including the ability to initialize value types and to use null values. So it is construct that helps us implement lazy loading.

SharePoint: SPList.HasView() extension method

One quick posting. I wrote yesterday extension method for SharePoint that checks if view exists. I think it is far better for performance if I don’t live on try…catch to find out if view exists or not. Extension method that you have to put in static class is here.

string.Repeat() extension method

I needed str_repeat() functionality in one of my C# methods. As .Net currently doesn’t offer it I wrote my own Repeat() extension method for strings. Make sure you put the method inside static class.

Invalid postback or callback argument. Event validation is enabled using in configuration

I wrote web part that uses Repeater control to create some repeating blocks of output. Each of these blocks has Button control in it. When I ran web part under SharePoint I got the following error: Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Here is the solution.

SharePoint: COMException 0x81020069

A little mystery when updating publishing pages: page is checked out, some attributes are changed and now I want to update this page. All I get is error that even Google has never seen before: System.Runtime.InteropServices.COMException (0x81020069). As I got error message in my own language I try to translate it: Attributes of checked out […]

SharePoint: DCOM Error 10016

I you get Access Denied errors in SharePoint then take a look at Event Viewer to see if there are some DCOM 10016 Event Errors in System log: The application-specific permission settings do not grant Local Launch permission for the COM Server application with CLSID {A9E69610-B80D-11D0-B9B9-00A0C922E750} to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20) from […]

Running SharePoint on Windows 7

I tried to put up SharePoint development environment on Windows 7 and guess what – I succeeded. I took smaller challenge and installed WSS 3.0 SP2. Of course, you can also install SharePoint Server instead of WSS. On my machine WSS 3.0 uses SQL Server 2008 Express edition as database. For MOSS 2007 you should have SQL Server 2008 Developer edition.