warning: Creating default object from empty value in /home/pulsar/webroot/htdocs/modules/taxonomy/taxonomy.pages.inc on line 33.

Sharepoint 2007 Variations Woes

While fighting some more problems with Sharepoint 2007 Variations "System" I had to write this comment in my code today:

  1. // note: there is a bug in Sharepoint 2007 when using ", " within a page name - "foo, bar.aspx" for instance.
  2. // note: This will render the relationship list entry useless. A healthy object id attribute in a
  3. // note: relationship list's entry looks like this:
  4. // note: ows_ObjectID='http://mucskysp04:4711/DE/Seiten/Seite mit Sönderzeichen.aspx, /DE/Seiten/Seite mit Sönderzeichen.aspx'
  5. // note: once "broken" using the naming-"exploit", the relationship will be represented as:
  6. // note: ows_ObjectID='http://mucskysp04:4711/DE/Seiten/variationsseite, mitkommaundleerzeichen.aspx'
  7. // note: note the missing relative path. There is no reason to work around this bug in this tool since the original
  8. // note: entry in Sharepoint won't be functional anyway (no entries will be shown in the variations dropdown)

Cry? Laugh? I think I'll stick with pulling my hair.

Visual Studio and Remote Debugging: The easy way

If you find yourself like me struggling with remote debugging using visual studio: here is a stupid easy way to get things running: READ THE FREAKIN' DIALOG MESSAGES!

So, here is the recipe:

  • Download a copy of the Remote-Debugger from Microsoft (I got mine over here: http://www.microsoft.com/downloads/details.aspx?FamilyID=440ec902-3260-4... )
  • Install it on the target machine
  • Don't bother yourself with setting it up as a service, we'll be running the remote debugging application manually.
  • Make sure the the username and password of your remote machine and the local machine are the same. Otherwise you might run into authentication problems when connecting to the remote host. Easiest way to achive that is being a part of a NT Domain and using the same account on both machines.
  • Now, listen very closely: Remote debugging needs the debug symbols to be available to the remote machine. Here is a rather stupid but dead simple way to get this working: In visual studio head over to Tools->Options->Debugging->Symbols and set it to C:\temp
  • Deploy your "to be debugged application" onto the remote host into C:\temp - include those funny .pdb files. Those are the debug symbols we'll need.
  • See a pattern here? If not re-read the last 2 list items
  • run the app on the remote host
  • Debug-> Attach Process: Enter the hostname of the remote machine (labeled Qualifier), select managed code from "Attach to:", hit refresh and pick your process.
  • Done.

And yes, I am pissed, mostly at myself because I did not pay attention to the debug symbols and was wondering why I could attach to a process but not set any breakpoints. Still a spoiled java coder I guess. No such headaches over there.

Using full-blown SQL Server instead of SQL Server Express Edition in Visual Studio / IIS

Dear Diary

Today kicked off rather troublesome. After installing the developer edition of SQL Server 2008 I've decided to get rid of the SQL Server Express Edition. Why would I want to run multiple versions of SQL Server on the same machine? This turned out not to be a very good idea, especially when you are about developing ASP.NET applications using Visual Studio. Once you try to run an ASP.NET application which requires some kind of role management and/or personalization (Web Parts do), you will run into this pretty error:


Yes, the local IIS is still referencing the SQL Server Express datasource. One would assume that you could change those settings somewhere within Visual Studio as you can change the Port of the ASP.NET application. Well… Don’t waste time as I did. It is not that easy, here is what you need to do:

Create a new Database dedicated to the IIS, for the sake of simplicity we’ll call it “IIS”:

Create a new IIS DatabaseCreate a new IIS Database

Locate and run “aspnet_regsql.exe”. In my case it is "C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe". Here you want to stick with the first option (Configure SQL Server for application services) and point it to the freshly created database on the next and let the configuration tool initialize the empty db.

Initialize the new DatabaseInitialize the new Database

Almost done, you still need to point the LocalSqlServer configuration not to use the SQLEXPRESS Server but the dedicated Database. Locate the machine.config and provide the connection string to the IIS Database:

Modify machine.configModify machine.config

Using .NET reflection to determine if a Class implements a generic interface.

Reflection and me? Big friends. With all the love and hate a good friendship should have. A few days ago it was all about hate again. I had a bunch of service classes, some of them would implement a generic interface... Let's call it IHasAdorable - so a Service-Implementation could look like this:

  1. public class MarketMerchant : IHasAdorable<CheeseBurger>, IProductSeller
  2. {
  3. // defined in IHasAdorable
  4. CheeseBurger BuyAdorable()
  5. {
  6. return new AdorableCheeseburger();
  7. }
  9. // defined in IProductSeller
  10. IProduct Buy(String eanCode)
  11. {
  12. if (eanCode.equals("12345"))
  13. return this.bigStackOfSmellyFishburgers.Pop();
  14. else
  15. throw new IAmSoSorryException("We don't have any of these!");
  16. }
  17. }

Now lets assume we want to browse through ALL market merchants and have a look if they have any adorable products. Let's skip the iteration process and pay attention to the probing of all market merchants in order to buy a adorable product from each of them. First attempt might be to use "is":

  1. IProductSeller merchant;
  2. // iteration goes here
  3. if (merchant is IHasAdorable<object>)
  4. {
  5. // this wont work. We are selling something very special, not just a stupid object!
  6. // Casting to IHasAdorable<> won't even compile.
  7. }

This one would not work either, although it makes sense to me:
  1. typeof(IHasAdorable<object>).IsAssignableFrom(merchant)

It seems we need to know what kind of objects a unknown merchant sells before we can "see" if those are also adorable. So here is how I got it working. Let me know if you do know a better solution:
  1. // `1 means there is 1 Generic parameter
  2. Type adorableInterfaceType = merchant.GetType().GetInterface("IHasAdorable`1");
  4. if (adorableInterfaceType != null)
  5. {
  6. // yay, the merchant has adorable products, what whould those be!?
  7. Type adorableProductType = adorableInterfaceType.GetGenericArguments()[0];
  9. // here is the magic we need to get the correct IHasAdorable Type
  10. // with "filled in" generic type.
  11. Type genericAdorableInterfaceType =
  12. typeof(IHasAdorable<>).MakeGenericType(adorableProductType);
  13. MethodInfo mi = genericAdorableInterfaceType.GetMethod("BuyAdorable");
  14. myBagOfAdorableProducts.Add(mi.invoke(merchant,null));
  15. }

Bon Appétit

Local IIS Dev-Server + Firefox = slow request response times

If you run into the same issue, disable IPv6 support in Firefox:
about:config -> network.dns.disableIPv6 -> true
Apparently Firefox and Microsoft Internet Information Server do not like to play together nicely on Vista without human intervention.

(Unix) Timestamp to .NET DateTime ?

Well, this is rather a note to myself:

for Javascript new Date().getTime() value (miliseconds, hence / 1000)

  1. new System.DateTime(1970, 1, 1, 0, 0, 0, 0)
  2. .AddSeconds(ajaxRequest.RequestDate / 1000)

One more reason why I love local initializers

  1. public static IDictionary<RequestTypeEnum, RequestGroupEnum>
  2. RequestTypeToGroup= new Dictionary<RequestTypeEnum, RequestGroupEnum>()
  3. {
  4. {RequestTypeEnum.RegisterAccount, RequestGroupEnum.Account},
  5. {RequestTypeEnum.UnregisterAccount, RequestGroupEnum.Account},
  6. {RequestTypeEnum.RegisterInetAccess, RequestGroupEnum.InetAccess},
  7. {RequestTypeEnum.UnregisterInetAccess, RequestGroupEnum.InetAccess},
  8. {RequestTypeEnum.RegisterMailbox, RequestGroupEnum.Mailbox},
  9. {RequestTypeEnum.UnregisterMailbox, RequestGroupEnum.Mailbox},
  10. {RequestTypeEnum.RegisterRLA, RequestGroupEnum.RLA},
  11. {RequestTypeEnum.UnregisterRLA, RequestGroupEnum.RLA}
  12. };

Dream Machine

Here is a small application I wrote from pure boredom and curiosity.

What is it?

It is a pathetic attempt to simulate a dream machine. It is supposed to provoke hallucinations by stimulating the optical nerves with a specific frequency. That simulation can alter the brainwaves and make you see complex patterns of color behind your closed eyelids.
Did not work for me – might work for you.


I’ve read an article on this topic some time ago and got curious. I made this stupid application to give it a try.

I want more background on this!

Do you? Head over to http://en.wikipedia.org/wiki/Dreamachine


right here

A word of warning

It might cause a epileptic seizure - so be careful if you have that kind of predisposition.

Unexpected Consequences

Ooops! That was quite unexpected

Imprint Datenschutzerklärung