BLOG
Rueda de Casino Figuren als RSS feed
Mittwoch, 24. Juni 2009, Christoph Ertl

salsa dancing Meine aufgezeichneten Rueda de Casino Figuren sind jetzt auch als RSS feed verfügbar. Damit bleibt man automatisch am neuesten Stand.

 

Hier klicken: Rueda de Casino Figuren abbonieren

Keine Ahnung worum es hier geht? Einfach hier nachlesen.

Related Links in Umbraco
Freitag, 19. Juni 2009, Christoph Ertl

related_documents_buttonRelated links can be very useful to give the visitor an easy way to find additional information. This could be a page on your site or even a link to an external site.
How can this be realized with Umbraco?

A built in functionality is not available addressing this issue.

But there's already an extension package available. It's called Related Links. The package provides a property type allowing to add multiple internal and external links to a document.

I really feel confident with Umbraco and it's flexibility. Hence, I always think twice before installing a package.

Working with built in Features

With a few steps we can solve this issue using built in features and even get more flexibility.

Create a document type

To solve this we introduce a new document type called "Alias" with two properties "Node" and "Url". For easier editing we add a tab called "Settings" and assign the properties to this tab.

Properties of Alias Node

We want to add documents of this type to other documents. Therefore we must set the Alias document type as "Allowed child nodetype" of the document type where want the aliases to add to.

Set as allowed child node type

Create an xslt file with macro

To render the links we create an XSLT file ListAliases.xslt with the corresponding macro.
In this xslt stylesheet we iterate over all child nodes and set the href attribute according to the kind of link.

<xsl:for-each select="$currentPage/node [@nodeTypeAlias = 'alias']">
 
<
xsl:sort select="@sortOrder" order="ascending"/>
 
<
li><a>
   
<
xsl:attribute name="href">
     
<
xsl:choose
       
<
xsl:when 
         
test="string(./data [@alias = 'toUrl']) = ''"

         
<
xsl:value-of select="umbraco.library:NiceUrl(./data [@alias = 'toNode'])"/>
       
</
xsl:when>
       
<
xsl:otherwise>
         
<
xsl:value-of select="./data [@alias = 'toUrl']"/>
       
</
xsl:otherwise>
     
</
xsl:choose>
   
</
xsl:attribute>
   
<
xsl:value-of select="@nodeName"/>
 
</
a></li>
</
xsl:for-each>

Use the macro

The last step is to use the macro in the template where the related links should be displayed.

...
<h2>Related</h2>
<?UMBRACO_MACRO macroAlias="ListAliases" ></?UMBRACO_MACRO>

Working with the solution

Sample contentTo create related links we now just have to add a child node of type Alias to our document for each related link we need.

In this child nodes just set the Node or the url to link to.

In this example we have two related links - one external (Umbraco) and one internal (My Blog).

Settings of external link  Settings of internal link

The resulting page could look like the following

Rendered content

Key Benefits

  • First of all. A document type is the main feature of Umbraco and therefore this solution should work for all future releases and for all installations. See also CMS structure granularity - not only in Umbraco.
  • You can decide when to publish and when to remove the link by using the built in functionality available for all nodes.
  • This solution is very extensible. You could add additional properties to the Alias document type for instance:
    • an image to be displayed next to the link
    • a  flag for a special sort criteria
    • a description which is displayed with the tooltip of the link.
    • You could introduce a document type called "Alias group" for grouping the links in for instance "Related" and "Depends on".
    • You could even manage your links at the root of your content tree to reuse them at different nodes.

Rueda 2 - Maestro/Linz - Fr 12.06.09
Sonntag, 14. Juni 2009, Christoph Ertl

Schon wieder eine Woche vorbei. Und natürlich wurden etliche Figuren getanzt und auch "neue" gelernt.

Wie immer sind Kommentare und Korrekturen willkommen.

CMS structure granularity - not only in Umbraco
Sonntag, 14. Juni 2009, Christoph Ertl

publish_buttonWhat is the content? What is the structure of the content? What is a document type? What is a property of a document type? How can I reuse documents? Flexibility versus usability? How to avoid different appearance of same kind of data? How to extend the system on the fly?

These are some questions that come along when designing the internal structure of a CMS based website. Depending on your CMS some of them will be addressed with built in features, some of them could be done with some effort and some of them may not be solvable.

Here I want to show a very simple case study concerning what could/should be a document type.

The site

We want to create a site providing news items. To keep it simple we forget about authors, date to appear, date to disappear, categories and so on.

I will use the naming of the Umbraco CMS for this case study.

Straight forward Solution

Our document template (NewsItem) contains only one dynamic property called "Content" of type "Rich text editor". The title of the article is the node name itself.

Really simple. Let's write articles. Create a new content node with a meaningful name. Fill in your text in the Content area. Publish it. Ready.

The authors of the content will write text, insert some pictures and everything will be fine. Style sheets are defined well, so all articles look just the same.

Content without structure

After a while you will realize that the authors add a section for related links to external resources in the content text. Some of them write a heading called "References" listing all links with a bullet list others add a bold text named "Related" and provide the links with a comma separated list.

The result are articles formatted in many different ways destroying the corporate identity of the site.

different_style

Approach 1

The first approach would be to tell the authors that they should use a heading, call it "References" and to list the links using a bullet list. Maybe it would solve the problem if the authors work really consistent. Let's face it. Don't event think about this approach. You are using a CMS!

Approach 2

The next approach would be to add a property called "References" of type "Rich text editor" to our document type. This property would be used to write the links (again using a bullet list). The difference would be that the designer can decide how to call this section and where to place it. Even the formatting could be easier changed. Still not happy? Right.

The authors must still ensure that the formatting of the links is consistent (bullet list). Changes of the formatting could only be done by rewriting each article (ok, style sheets would also help for some situations).

The solution

The solution in terms of a CMS is to introduce another document type called "LinkItem" containing a property "Url" of type "Text string". The Friendly name of this link would be again the name of the node. This LinkItem is then declared as a "Allowed child node type" of the "NewsItem" type.

To add related links to a news item the authors add one child node of type LinkItem for each link.

Benefits

With this solution the authors now can again force their energy to write content and to provide related links. The designer can decide where to place the links, how to format them and even if they should be hidden in a special situation.

That's why we use a CMS. Isn't it?

Rueda 2 - Maestro/Linz - Fr 05.06.09
Sonntag, 07. Juni 2009, Christoph Ertl

Folgende Figuren wurden am Freitag im Maestro
gelernt bzw. wiederholt.Salsa dancing

Eine Übersicht über Rueda de Casino Figuren ist hier zu finden.

Neu in Linz - Cafe Valdès
Samstag, 21. März 2009, Christoph Ertl

image In Linz gibt's ein neues Cafe zum Wohlfühlen.

DJ Antonio de Cuba eröffnet sein eigenes Cafe mit kubanischem Flair. Unbedingt ansehen!

Für Salsa Begeisterte gibt es jeden Samstag eine Fiesta Latina mit Salsa a lo cubano.

http://www.cafe-valdes.at/

Different behavior in Debug and Release version of a .NET application - How to find the bug
Samstag, 06. Dezember 2008, Christoph Ertl

binary conflict A few days ago I had a problem at a .NET 1.1 project where the release version of the application had a different behavior than the debug version. I felt like in the old days when developing with C++ and struggling through precompiler instructions.

The beginning

Tried to reproduce the bug with a Unit test which was not possible. Had a detailed look at the production data and refined the unit test. No success. At this point I had the suspicion that this could' be a debug vs. release problem. Tried the unit test in release mode and the test failed.

OK. There's a difference but how to find out where and what is the difference? And if found, why is there a difference?

Where's the difference?

Even with the information from the unit test it's not easy to find out why there is a difference. First of all we have to find the location of the difference. To find the location I used a profiler while running the unit test in debug and in release mode.

Then I compared the two call stacks and within seconds I got the method where the difference was located.

image 
callstack (orderd by execution time) as expected in the debug execution.

 

image
different callstack (ordered by execution time) in the release execution.

What's the difference?

Now we know the method were the difference is located. The next step is to compare the code of the release and debug assembly. This is best done using Redgate's .NET reflector.

Comparing the methods is an easy task with .NET Reflector. If your method is too large you can use an add-in which supports comparing two assemblies.

Why is there a difference?

While comparing the two version of the code you see in detail what's different. But why?

The difference can be caused by some reasons:

  1. Removed code in release assembly because of the Conditional attribute.
    Check the method which is missing in the callstack if it is marked with this attribute.
  2. The difference can also be caused by a compiler optimization like inlining etc. but this should not lead to a different behavior unless there is an
  3. Error in the compiler
    In this case you must try to change your code and see what's the result. A detailed inspection and understanding of the differences can help.

The found bug

For the sake of completeness the details about the bug I found. This bug only arises with the compiler shipped with Visual Studio .NET 2003. With Visual Studio .NET 2005/2008 there were no problems.

The code written in the editor:

private static void DoIt(bool flag) {
 
if(flag) {
   
using(MyDisposable d = DoItNormal()) {
   
}
 
}
 
else {
   
DoItDifferent();
 
}
}

The debug version inspected with .NET Reflector:

Debug assembly inspected

The release version inspected with .NET Reflector:

Release assembly inspected

Removing the empty using block and calling Dispose() explicitly solves the problem.

References

RSS in aller Kürze
Sonntag, 16. November 2008, Christoph Ertl

Feed-Icon Sie besuchen täglich die gleichen Webseiten um nach Neuigkeiten zu suchen? In den meisten Fällen ist die Suche jedoch vergeblich? Warum verschwenden Sie Ihre Zeit?

Immer wieder stelle ich fest, dass das Thema RSS bei Internet Benutzern weitgehend unbekannt ist oder zumindest nicht genutzt wird. Dabei bietet diese Technologie einen wesentlichen Mehrwert für jeden interessierten Internet Benutzer. Und man muss kein Technik Profi sein um diesen Service zu nutzen.

Was ist RSS ?

RSS oder auch RSS-Feed ist ein Internet Nachrichten Format zum elektronischen Austausch von "Nachrichten".

RSS-Feeds werden auf "Webseiten" angeboten um deren Informationen elektronisch abholen zu können. Das Angebot reicht von klassischen Nachrichten über Event-Informationen bis hin zu privaten "Tagebüchern".

Warum soll ich das verwenden ?

Um Zeit zu sparen und den Komfort aktueller Technologien für sich zu nutzen !

Wenn Sie RSS verwenden, entscheiden Sie welche Informationen Sie erhalten möchten und vergeuden keine Zeit auf der Suche nach neuen Informationen. Die Informationen kommen zu Ihnen und das automatisch.

Ein Beispiel:

Sie besuchen (mehrmals) täglich eine oder mehrere Webseiten um die aktuellsten Nachrichten zu lesen.
Das hat folgende wesentliche Nachteile für Sie:

  1. Sie müssen aktiv auf die Webseite gehen und warten bis der Inhalt geladen ist
  2. Sie müssen inhaltlich prüfen ob es Neuigkeiten gibt
  3. Sie werden oft feststellen, dass keine Neuigkeiten vorhanden sind

Je mehr Seiten Sie auf diese Weise durchforsten, desto stärker wirken sich die Nachteile aus.

Unter Verwendung von RSS entscheiden Sie einmal, dass Sie an Neuigkeiten dieser Webseite interessiert sind. Ein Computer Programm erledigt den Rest für Sie indem es Sie automatisch über neue Neuigkeiten informiert.

Aufgrund des Titels können Sie entscheiden ob Sie die jeweilige Nachricht lesen möchten.

Habe ich Ihr Interesse geweckt? Dann lesen Sie weiter.

Was benötige ich dazu ?

Um RSS-Feeds zu abonnieren benötigen Sie einen sogenannten FeedReader. Das ist ein Computer Programm, dem Sie mitteilen welche Feeds sie abonnieren möchten und das Sie dann in geeigneter Form über Neugikeiten informiert.

Integrierte Reader

Internet Explorer 7.0, Firefox 1.0, Outlook 2007 und andere bieten bereits die Möglichkeit an, Feeds zu abonnieren. Sie können also sofort loslegen und arbeiten in einem Ihnen vertrautem Programm.

Computer Programm auf Ihrem Computer

Der FeedReader wird heruntergeladen und lokal installiert. Diese Programme sind speziell dafür entwickelt und bieten teilweise mehr Komfort und Möglichkeiten.

FeedDemon - RSS Bandit - NetNewsWire (Mac OS)

Online Reader

Eine Online Plattform, bei der man sich registriert, online seine Feeds abonniert und auch dort liest. Der Vorteil ist die ständige Verfügbarkeit Ihrer Feeds egal wo Sie gerade sind und welches Betriebssystem Sie gerade verwenden.

Newsgator - Google Reader - Bloglines

Wie erkenne ich, dass eine Webseite Feeds anbietet?

Auf Webseiten werden RSS-Feeds meist mit einem Symbol 48px-Feed-icon_svg xml rss oder dem Text RSS, XML oder ATOM gekennzeichnet.

Zusätzlich dazu bieten moderne Webbrowser eine entsprechende Information zur aktuellen Webseite an.

Internet Explorer: Symbol in der Werkzeugleiste Internet Explorer Werkzeugleiste

Mozilla Firefox: Symbol in der Adresszeile Mozilla Firefox Adresszeile

Sobald sie RSS verwenden, werden Sie feststellen, dass beinahe jede Webseite, die Sie besuchen, über ein RSS-Feed verfügt. Es liegt nur an Ihnen dieses Service auch zu nutzen.

Wie finde ich RSS Angebote ?

Zu allererst sollte man sich auf den Webseiten, die man häufig besucht, "umsehen" ob diese RSS-Feeds anbieten - siehe oben - und diese abonnieren. Weitere RSS-Feeds können Sie über Verzeichnisdienste oder natürlich über Suchmaschinen suchen.

Viele Webseiten Betreiber bieten eine Liste (Blogroll, Feedlist) von RSS-Feeds an, die sie selbst abonniert haben. Diese sind sehr zu empfehlen, da sie meist ähnlichen thematischen Inhalt aufweisen, wie die Seite, die Sie gerade besuchen.

RSS Agent (AT) - RSS Verzeichnis (DE)

Links

Url Rewriting in Umbraco - Friendly Tag Filter
Samstag, 15. November 2008, Christoph Ertl

After finishing the Tag Cloud package the next step to improve my web site was to get rid of the ugly query URLs when filtering blog posts by tag.

The Goal

Instead of

/blog.aspx?filterBy=TagName

I wanted something like

/blog/tag/TagName

Why ?

  1. As we all - techies of course - know search engines are not happy with URLs like this
  2. I also had the impression that Google AdSense didn't distinguish the pages correctly.
  3. I personally don't like URLs containing query parameters on a web page as they are not user friendly.
  4. Some kind of perfectionism

The Solution

It's that simple that I was not sure if it's being worth posting. But it took me a while to find the solution. Like in most cases. It's easy if you know where and how to do it. It would be easier if the feature would be mentioned in the feature list or online help. However, here it is:

In the file /config/UrlRewriting.config one can place rules for rewriting URLs. Just add a rule like this.

<add name="tagfilter"
  virtualUrl="^~/blog/tag/(.*).aspx"

 
rewriteUrlParameter="ExcludeFromClientQueryString"
  destinationUrl="~/blog.aspx?filterBy=$1"

 
ignoreCase="true"

/>

A detailed description how it works can be found in the file itself.

One important thing is that without reconfiguring the IIS Server the URL must end up with .aspx. So the new URL looks like this

/blog/tag/TagName.aspx

which is very straight forward as all other nodes are also referenced using the aspx extension.

References

  • This Umbraco feature is powered by the ASP.NET UrlRewritingNet component which can be found at http://www.urlrewriting.net/
  • A Post where the feature is at least mentioned.
  • A Post from Warren where he points to some problems using this feature.

Sort Umbraco Nodes by sortOrder property
Donnerstag, 07. August 2008, Christoph Ertl

Today I added two nodes, changed the sorting and published the whole bunch. The first look at the resulting page was surprising because the sort order seemed to be totally confused.

After a while I realized that I reached the count of 11 nodes and the node with the sortOrder = 10 was displayed after the one with sortOrder = 1.

Got it? The property is compared as string.

The problem is that XSLT handles values as string unless you declare what type should be used.

So instead of sorting nodes with

<xsl:sort
  
select="@sortOrder"
  
order="ascending"
/>

you have to set the data-type to be used for comparison

<xsl:sort
  
select="@sortOrder"
  
order="ascending"
  
data-type="number"
/>