Tuesday, November 10, 2009

roleProvider app.config parsing troubles

I recently had the pleasure of trying to get our RC out the door, while doing that we realized that for whatever reason, Microsoft seems to use a non-standard parser for the app.config file.

Basically this does not work:

<system.web>
  <
roleManager defaultProvider="MyCustomProvider" enabled="true">
    <
providers>
      <
clear></clear>
      <
add name="MyCustomProvider" type="Namespace.MyCustomProvider, MyAssembly"/>
    </
providers>
  </
roleManager>
</
system.web>

While this does:

<system.web>
  <
roleManager defaultProvider="MyCustomProvider" enabled="true">
    <
providers>
      <
clear/>
      <
add name="MyCustomProvider" type="Namespace.MyCustomProvider, MyAssembly"/>
    </
providers>
  </
roleManager>
</
system.web>

Of course, the well known commercial installer making tool we are using insists of creating the former… :(

A workaround is to throw the file through an identity XSLT transform in a custom tool / custom action run after custom actions from said vendor have done their job.

Oh, the bug reported on connect is already closed as Won’t Fix

Wednesday, September 02, 2009

Windows Live Movie Maker - FAIL

As I wanted to edit some movies, and Windows 7 no longer includes Windows Movie Maker I had to give Windows Live Movie Maker a try, as based on the name you’d assume it does something similar?

Turns out I was wrong. This application seems to be geared towards dropping a number of photos and creating a “movie” and not actually editing movies.

While you can import video from a DV camera, it does not split the imported video into scenes, instead it chops it into pieces, the size of which you can determine by dragging a slider !?! And to make matters worse, it does not bother to extract thumbnails from the individual pieces but instead uses what seems to be the first frame of the entire movie. Good luck finding the pieces you need.

Of course, the timeline also seemed unnecessary to include …

Time to look for a Video editor, Windows Live Movie Maker is not one.

</rant>

Tuesday, March 03, 2009

Generating GUIDs

This may seem trivial but here we go:

I recently created an installer with WIX and obviously had to create a number of GUIDs along the way. While there is a "Create GUID" option in the Tools menu it has a number of drawbacks:

  • Clicking around a UI with a mouse is not the most efficient thing in the world
  • There is not an immediately suitable format available, registry format is closest, but braces need to be removed and the rest uppercased

The obvious? solution to this problem is to create a macro like the following:

Public Sub CreateWixGuid()
Dim g As Guid = Guid.NewGuid()
Dim textSelection As EnvDTE.TextSelection

textSelection = CType(DTE.ActiveDocument.Selection(), EnvDTE.TextSelection)
textSelection.Text = g.ToString("D").ToUpper()
End Sub


and assign a keyboard shortcut to it (I chose Ctrl+G,Ctrl+G), and voilà a GUID in the correct format is generated and inserted.



 



 

Tuesday, November 11, 2008

How to not do validation

Yesterday when I was trying to do some online shopping I the e-commerce system in use perfomed input validation in a slightly suboptimal way. Here is what happened:

  • To be able check out the stuff in my shopping basket I had to create an account.
  • To create an account I had to enter username, password and address.
  • Go to checkout
  • Confirm to use the just entered address as the shipping address
  • On the following page where the pay button should be there's this small note "The city is not long enough"  WTF!?!
  • Try again with the city name in the other language as it is longer
  • Same story "The city is not long enough" ...
  • Only when changing the primary address the order goes through

A validation rule stating that the city cannot be just three letters are just plain stupid, secondly if there is a need to use stupid validation rules, then do the validation when the data is entered and not when it is used ...

This comic comes to mind.

Saturday, November 08, 2008

Debugging WPF databinding issues

Lately due to switching teams and project I've been doing much more WPF than before. I cannot say I have fully mastered the learning curve yet but I'm getting better and it is an interesting journey.

Occasionally the data bindings does not work as expected and then it is nice to get more information about them in order to figure out what went wrong.

The following is useful when you want to know why a particular binding is misbehaving (or rather you want to know where you screwed up...)

xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"



ItemsSource="{Binding <snip>, diagnostics:PresentationTraceSources.TraceLevel=High}"


The above information and MUCH more is presented by Beatriz Stollnitz



(This post is also a 'reminder to self')

Monday, November 03, 2008

C# quiz 9/?

Consider the following:

Guid globallyUnique1 = new Guid();
Guid globallyUnique2 = new Guid();
if (globallyUnique1 == globallyUnique2)
{
MessageBox.Show("This cannot be");
}
else
{
MessageBox.Show("Everything is well");
}

What is shown? Why?

Wednesday, October 15, 2008

Sandcastle to dead tree format woes

For reasons partially unknown to me, I was tasked with converting Sandcastle generated API documentation to dead tree format.

The best way seems to be feeding some magic XSLT to Sandcastle that would that would directly create PDF via XSL-FO or DocBook or whatever. However, I haven't been able to find such a thing and I'm not ready to put down that kind of work to create it myself at this point.

Another option I pursued was to print the CHM to XPS/PDF but this has its own cons. Firstly directly printing from CHM viewer strips CSS rendering ugliness. This is correctable by finding the correct html file from %TEMP% and a little search/replace magic and providing the stylesheets and images.

Having gotten this far I found out that the stylesheet needs to use something else but relative font size to keep the text legible.

Now as if this wasn't enough the browser or at least the PDF/XPS "printer" chokes on the sheer amount of input, still not finished after N hours, and this just for the documentation of a smallish test assembly. :(

This does not look feasible at this point.

Bright ideas appreciated!