Valid XHTML and YouTube embedding

If you look at the sidebar of this web page, you might see that “Valid XHTML” link. It’s a link that WordPress adds per default and that you have probably seen on a gazillion of other blogs as well.

Have you clicked on it? No one does, because why should you care if my Page is valid XHTML if it displays correctly for you? Anyway, I clicked it a few minutes ago, and was greeted with a nice “This page is not valid XHTML!”. Whoops. I tried clicking that link on a few other blogs, and many of them are not valid XHTML anymore, due to some funky stuff in the postings.

I think it’s quite embarrassing, having that “Look ma! Valid XHTML!” statement on your web site, and then not fulfilling it. Here, there are two solutions: Simply removing the link that no one cares about anyway, or actually fixing the broken XHTML.

I went with the second option, and I found that the little YouTube video i’ve embedded a few weeks ago is breaking my XHTML, because the default YouTube embed code is not XHTML compliant. I found that this is one of the more common sources of those false valid XHTML statements. Luckily, there are people who found a proper way to make XHTML compliant YouTube embedding, which you can find here. I went back and fixed the article, so now the valid XHTML link leads to a nice “This Page Is Valid XHTML 1.0 Transitional!” message. Woohoo!

Re-Using a SPQuery = bad Idea

I’ve just spend an hour trying to find the source of one of those dreaded “One or more field types are not installed properly. Go to the list settings page to delete these fields.” error messages, and it turns out that SPQuery can not easily be reused on multiple Lists.

My code was like this:

SPQuery query = new SPQuery();
query.Query = "<some CAML>";
SPListItemCollection ListOneResults = ListOne.GetItems(query);
// do more stuff
query.Query = "<some other CAML>";
SPListItemCollection ListTwoResults = ListTwo.GetItems(query);

The CAML is fine, but apparently SPQuery has a private List property that links the Query to the first list, causing the second call to be executed against the wrong list. Using “query = new SPQuery()” to overwrite the object completely works.

I’d also like to thank U2U for their CAML Query Builder, which helps in writing the CAML queries.

Freestyle Skating Weekend 2008

I’ve spent the last days in Mönchrngladbach, during the 4WheelFreestyle organized Freestyle Skating Weekend.

Friday, 15.02.2008

On Friday, we spent the Evening with moving all the technical equipment in place. Organizing such an Event is a lot more complicated that it may seem at first, and the list of equipment needed grows and grows and grows… Anyway, putting everything in the cars and the trailer and driving to Mönchengladbach Neuwerk was the easy part. But then, it had to be moved downstairs, which was easy for the small things, but interesting for the big speaker cabinets. But well, this is the first of 3 days and we were still fresh and relaxed, so building the Team Area was straight forward.

Also, the first guests arrived and after doing some free training, we spent a nice evening at the Mokka in Viersen till 1:30 or so.

Saturday, 16.02.2008

After a very short night of maybe 5 or so hours of sleep, we started into a much too cold day at 7:00. As we had a little shop on the Event, we had to take the pile of stuff from Thomas’ apartment into the car and to the event. The official start of the Event was at 10:00, and the time until 16:00 was spent with Workshops and free training and preparing the top-notch equipment that was used to make some 3000 photos and countless hours of video. At 16:00, the Battles started. With Sebastian Lafargue, Thomas Vilcans and Rudy Op’t Veldt as Judges it was guaranteed to have proper and well-founded judgements, even though it was a pity not seeing Rudy and Thomas compete in the Freestyle Battles.

The day ended at 22:00, and I think I never felt my feet with such an intensity than on that evening. But regardless of exhaustion, it was a very nice day.

Sunday, 17.02.2008

Sunday started with the Final rounds of Speed Slalom. Thanks to the Freestyle Slalomskater Munich Team, we had a light barrier and a nice display of the times. For the Men, Seba won the Speed Slalom, and Chloe Seyres was successful for the women.

After Speed Slalom, we went on to the finals of Freestyle Slalom. Chris Fessel won the Event for the Men, and Chloe Seyres was successful for the Women. The Riders seemed to like the Winner Certificates – they have style, certainly. Also, the Podium is a nice example of why multi-function sport halls are useful 🙂

One of the attractions of the Event was the DJ Equipment, thanks to Thomas. The people liked the live DJ set on Saturday evening. As Thomas was one of the Judges, Michel took over the music during the battles.

And as my personal Highlight, I could add some Souvenirs to my 4WheelFreestyle Shirt 🙂

Overall, it was a great event. It was quite exhausting but it was surely worth it. If you want some more photos, check out my album of the 4WheelFreestyle Forum Thread.

The full list of results is available here.

Querying the “Person or Group” field using SPQuery (Update)

One of the weak points of Sharepoint 2007 is documentation. If you want to query a “Person or Group” field, the documentation on MSDN is a bit sparse.
Here is how to query a person:

<where>
  <eq>
    <fieldref name="PersonFieldName"/>
    <value type="User">User Display Name</value>
  </eq>
</where>

Replace PersonFieldName with the internal Name of the Field.
The two important things here: Value Type is “User”, and the String to search for is the Display Name. So if you have a user called “John Doe” whose login is “mydomain\jdoe”, you have to search for “John Doe”, not for “mydomain\jdoe”.
There is an obvious drawback to this: What if you have two users called John Doe?

Sharepoint People or Group SettingsI was quite disappointed that the Person field does not store the LoginName by default and can therefore not be queried for it.
There are two workarounds. The first one: Go to the properties of the field in the list, and at the bottom you can change “Show Field” to “Account”.
This has the advantage that you can use the “domain\username” Syntax now. The drawback: The field looks bad in the list as it does now show the Login, not the Display Name with the neat presence status.

The second workaround: Use the undocumented LookupId property and search for the numeric ID:

<where>
  <eq>
    <fieldref name="PersonFieldName" LookupId="TRUE"/>
    <value type="int">UserID</value>
  </eq>
</where>

The UserID is not the “domain\username”, but the numeric internal ID (SPUser.ID). As I use this in a workflow, I can easily access this through workflowProperties.OriginatorUser.ID, which is good enough for me.

Update: The second code example was incorrect, I fixed it now.