<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2titles.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemtitles.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
	<channel>
		<title>Klopfenstein.net</title>
		<link>http://www.klopfenstein.net</link>
		<description>Homepage of the swiss Klopfenstein family living in Italy.</description>
		<language>en</language>
		<webMaster>lck@klopfenstein.net</webMaster>
		
		<lastBuildDate>Fri, 5 Jun 2009 01:03:06 +02:00</lastBuildDate>
		
		
        <image><link>http://www.klopfenstein.net</link><url>http://www.klopfenstein.net/favicon.png</url><title>Klopfenstein.net</title></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/klopfensteinnet" type="application/rss+xml" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fklopfensteinnet" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/klopfensteinnet" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fklopfensteinnet" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fklopfensteinnet" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Fklopfensteinnet" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><item>
            <title><![CDATA[Internationalization in .NET and WPF]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/UaG8bYVmuvE/internationalization-in-net-and-wpf-presentation-foundation</link>
            <description>&lt;p&gt;Building a localized application and ensuring that the correct language is used in its &lt;acronym title="Graphical User Interface"&gt;GUI&lt;/acronym&gt; (a process also called &lt;i&gt;internationalization&lt;/i&gt; or &lt;i&gt;i18n&lt;/i&gt;) has always been quite simple in .NET. &lt;b&gt;Resx resource files&lt;/b&gt; natively support multiple localized versions (which are built into "&lt;i&gt;satellite&lt;/i&gt;" dll assemblies) and automaticaly determine the correct resources to read from (eventually falling back to the base language).&lt;/p&gt;

&lt;p&gt;This is done by creating a simple resource file containing all strings of your application (for instance, &lt;code&gt;Strings.resx&lt;/code&gt;) and then define a localized version of the same strings in separate resource files (&lt;code&gt;Strings.it.resx&lt;/code&gt; for the italian strings, &lt;code&gt;Strings.de-CH.resx&lt;/code&gt; for the swiss-german dialect version... etc.).&lt;/p&gt;

&lt;p class="centered"&gt;&lt;img src="/public/Uploads/lorenz/wpf/localization_resources.png" width="286" height="291" alt="String resources and localized versions." /&gt;&lt;/p&gt;

&lt;p&gt;Visual Studio will create a static &lt;i&gt;Strings&lt;/i&gt; class (defined in &lt;code&gt;Strings.Designer.cs&lt;/code&gt;) that you can use to retrieve each single string (this also allows you to retrieve the localized strings in a strongly typed fashion, ensuring that you won't have null strings and exceptions thrown around randomly in your code).&lt;/p&gt;

 &lt;p&gt;&lt;span class="more-link"&gt;&lt;a href="/lorenz.aspx/internationalization-in-net-and-wpf-presentation-foundation"&gt;More...&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/UaG8bYVmuvE" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Fri, 5 Jun 2009 01:03:06 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/internationalization-in-net-and-wpf-presentation-foundation]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/internationalization-in-net-and-wpf-presentation-foundation</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[Recover notes from the Sidebar Gadget]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/sse3uHm6p5A/recover-notes-from-the-sidebar-gadget</link>
            <description>&lt;p&gt;&lt;img src="/public/Uploads/lorenz/notes_gadget.png" width="127" height="118" alt="The notes gadget" class="side" /&gt;
One of the few really useful Windows Sidebar Gadgets I often used is the "Notes" gadget: just great to paste snippets of text or to keep a short to-do list. Unfortunately, if you close the gadget by mistake, you'll also lose all the notes you were keeping!&lt;/p&gt;

&lt;p&gt;There is &lt;a href="http://www.winvistaclub.com/t42.html"&gt;a simple solution&lt;/a&gt; that works as long as you leave the "shadow copies" enabled on your OS. You'll have to access the folder where all gadgets settings are stored:&lt;/p&gt;

&lt;pre&gt;C:\Users\&lt;i&gt;&amp;lt;userprofile&amp;gt;&lt;/i&gt;\AppData\Local\Microsoft\Windows Sidebar&lt;/pre&gt;

&lt;p&gt;Open up the folder's "previous versions" dialog and cross fingers. If you're lucky you'll find a version of the &lt;b&gt;Settings.ini&lt;/b&gt; file of before you closed the notes gadget. Search for a line that contains the "&lt;i&gt;Notes.gadget&lt;/i&gt;" string. Just a couple of lines below you should find something like:&lt;/p&gt;

&lt;pre&gt;0=Note one.
1=Note two...&lt;/pre&gt;

&lt;p&gt;Copy the contents of the notes to your current Settings.ini or restore the file completely.&lt;/p&gt;

&lt;p&gt;Windows 7 includes an improved version of "Notes", which now has been promoted to a full blown application instead of being a simple gadget. That should also prevent the loss of notes due to accidental closing. &lt;img src="/BabilRes/emoticons/smile.gif" width="15" height="15" alt=" :)" /&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/sse3uHm6p5A" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Sat, 30 May 2009 10:05:17 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/recover-notes-from-the-sidebar-gadget]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/recover-notes-from-the-sidebar-gadget</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[Nested styles in WPF]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/OamUkKJpbd4/nested-cascading-styles-in-wpf</link>
            <description>&lt;p&gt;I have started to work on &lt;acronym title="Windows Presentation Foundation"&gt;WPF&lt;/acronym&gt; GUI programming again, and finally found out how to use &lt;i&gt;nested&lt;/i&gt; styles in an application (pretty basic, I know, but I'm slowly getting to know the framework on my own &lt;img src="/BabilRes/emoticons/smile.gif" width="15" height="15" alt=" :)" /&gt;).&lt;/p&gt;

&lt;p&gt;So, starting from the basics, to embed some global styles in the application, you can define an external ResourceDictionary (much like an external CSS stylesheet):&lt;/p&gt;

&lt;pre&gt;&lt;code class="xml"&gt;&amp;lt;ResourceDictionary xmlns=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&amp;gt;

    &amp;lt;!-- Colors --&amp;gt;
    &amp;lt;Color x:Key=&amp;quot;WhiteDark&amp;quot; A=&amp;quot;255&amp;quot; R=&amp;quot;238&amp;quot; G=&amp;quot;240&amp;quot; B=&amp;quot;245&amp;quot; /&amp;gt;
    &amp;lt;Color x:Key=&amp;quot;WhiteBright&amp;quot; A=&amp;quot;255&amp;quot; R=&amp;quot;254&amp;quot; G=&amp;quot;254&amp;quot; B=&amp;quot;254&amp;quot; /&amp;gt;
    &amp;lt;!-- ... --&amp;gt;
	
    &amp;lt;RadialGradientBrush x:Key=&amp;quot;PaleBackgroundRadial&amp;quot; Center=&amp;quot;0.8,0.8&amp;quot; GradientOrigin=&amp;quot;0.8,0.8&amp;quot;
                         RadiusX=&amp;quot;0.8&amp;quot; RadiusY=&amp;quot;0.7&amp;quot;&amp;gt;
        &amp;lt;GradientStop Offset=&amp;quot;0&amp;quot; Color=&amp;quot;{StaticResource WhiteBright}&amp;quot; /&amp;gt;
        &amp;lt;GradientStop Offset=&amp;quot;1&amp;quot; Color=&amp;quot;{StaticResource WhiteDark}&amp;quot; /&amp;gt;
    &amp;lt;/RadialGradientBrush&amp;gt;
    &amp;lt;!-- ... --&amp;gt;
	
&amp;lt;/ResourceDictionary&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In order to reference those resources in your code (using their x:Key name), you must embed the dictionary where it is needed. The simplest solution is to embed all styles at an application level:&lt;/p&gt;

&lt;pre&gt;&lt;code class="xml"&gt;&amp;lt;Application x:Class=&amp;quot;Application&amp;quot;
    xmlns=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&amp;gt;
    
    &amp;lt;Application.Resources&amp;gt;
        &amp;lt;ResourceDictionary&amp;gt;
            &amp;lt;ResourceDictionary.MergedDictionaries&amp;gt;
                &amp;lt;ResourceDictionary Source=&amp;quot;MyResourceDictionary.xaml&amp;quot; /&amp;gt;
                &amp;lt;!-- other dictionaries --&amp;gt;
            &amp;lt;/ResourceDictionary.MergedDictionaries&amp;gt;
        &amp;lt;/ResourceDictionary&amp;gt;
    &amp;lt;/Application.Resources&amp;gt;
    
&amp;lt;/Application&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, everywhere in your XAML code you'll be able to reference one of your styles, for instance:&lt;/p&gt;

&lt;pre&gt;&lt;code class="xml"&gt;&amp;lt;Rectangle Background="{StaticResource PaleBackgroundRadial}" /&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, if you - like me - are used to web programming using CSS and HTML, you'll expect to be able to define a "class" with a custom style and then specify additional styles for all nested tags in an element of that class. You could for instance define a class for a menu and then define another (nested) style for all &lt;code&gt;&amp;lt;b&amp;gt;&lt;/code&gt; bold tags inside it:&lt;/p&gt;

&lt;pre&gt;&lt;code class="css"&gt;.menu {
    width: 200px;
    font-size: 0.8em;
    background: red;
}

.menu b {
    font-size: 1.2em;
    color: blue;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The definition for the bold tag will only be applied to &lt;code&gt;&amp;lt;b&amp;gt;&lt;/code&gt; elements inside the element with the "menu" class. The same can be done in XAML, albeit in a somewhat different way:&lt;/p&gt;

&lt;pre&gt;&lt;code class="xml"&gt;&amp;lt;Style TargetType=&amp;quot;{x:Type Window}&amp;quot; x:Key=&amp;quot;GlossyWindow&amp;quot;&amp;gt;
    &amp;lt;Setter Property=&amp;quot;Background&amp;quot; Value=&amp;quot;{StaticResource GlossyBackground}&amp;quot; /&amp;gt;
    &amp;lt;Setter Property=&amp;quot;TextElement.FontFamily&amp;quot; Value=&amp;quot;Segoe UI&amp;quot; /&amp;gt;
    &amp;lt;Setter Property=&amp;quot;TextElement.Foreground&amp;quot; Value=&amp;quot;White&amp;quot; /&amp;gt;
    &amp;lt;!-- Other setters, trigger, etc... --&amp;gt;

    &lt;b&gt;&amp;lt;!-- NESTED STYLES --&amp;gt;&lt;/b&gt;
    &amp;lt;Style.Resources&amp;gt;
        &amp;lt;Style TargetType=&amp;quot;{x:Type Button}&amp;quot;&amp;gt;
            &amp;lt;Setter Property=&amp;quot;Margin&amp;quot; Value=&amp;quot;3.0&amp;quot; /&amp;gt;
            &amp;lt;Setter Property=&amp;quot;Control.Template&amp;quot;&amp;gt;
                &amp;lt;Setter.Value&amp;gt;
                    &amp;lt;ControlTemplate TargetType=&amp;quot;Button&amp;quot;&amp;gt;
                        &amp;lt;Grid&amp;gt;
                            &amp;lt;Rectangle /&amp;gt;

                            &amp;lt;ContentPresenter /&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                    &amp;lt;/ControlTemplate&amp;gt;
                &amp;lt;/Setter.Value&amp;gt;
            &amp;lt;/Setter&amp;gt;
        &amp;lt;/Style&amp;gt;
        
        &amp;lt;Style TargetType=&amp;quot;{x:Type Menu}&amp;quot;&amp;gt;
            &amp;lt;!-- Setters, triggers, etc... --&amp;gt;
        &amp;lt;/Style&amp;gt;
    &amp;lt;/Style.Resources&amp;gt;
&amp;lt;/Style&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The effect of the XAML code above is that if you define a Window's style as "&lt;i&gt;GlossyWindow&lt;/i&gt;", automatically &lt;b&gt;all&lt;/b&gt; buttons and menus contained in that same window will have the nested styles applied (in addition to other styles you might have explicitly set on each button or on each menu).&lt;/p&gt;

&lt;p&gt;This allows you to efficiently mark only a root element as being &lt;i&gt;styled&lt;/i&gt; and apply a custom appearance to all nested elements in the XML structure. However, using nested styles can get you some quite... nested XAML code: the code above is still readable, but obviously if you start using more nested levels you'll end with a &lt;b&gt;huge&lt;/b&gt; XML hierarchy.&lt;/p&gt;

&lt;p&gt;To clean the code up, define each single style individually and then declare the nested styles hierarchy by "basing" them on the previously defined templates (this is done by using the &lt;code&gt;BasedOn&lt;/code&gt; attribute on your styles and referencing the styles above by their dictionary key):&lt;/p&gt;

&lt;pre&gt;&lt;code class="xml"&gt;&amp;lt;Style TargetType=&amp;quot;{x:Type Button}&amp;quot; x:Key=&amp;quot;GlossyButton&amp;quot;&amp;gt;
    &amp;lt;Setter Property=&amp;quot;Margin&amp;quot; Value=&amp;quot;3.0&amp;quot; /&amp;gt;
    &amp;lt;Setter Property=&amp;quot;Control.Template&amp;quot;&amp;gt;
        &amp;lt;Setter.Value&amp;gt;
            &amp;lt;ControlTemplate TargetType=&amp;quot;Button&amp;quot;&amp;gt;
                &amp;lt;Grid&amp;gt;
                    &amp;lt;Rectangle /&amp;gt;

                    &amp;lt;ContentPresenter /&amp;gt;
                &amp;lt;/Grid&amp;gt;
            &amp;lt;/ControlTemplate&amp;gt;
        &amp;lt;/Setter.Value&amp;gt;
    &amp;lt;/Setter&amp;gt;
&amp;lt;/Style&amp;gt;

&amp;lt;Style TargetType=&amp;quot;{x:Type Menu}&amp;quot; x:Key=&amp;quot;GlossyMenu&amp;quot;&amp;gt;
    &amp;lt;!-- Setters, triggers, etc... --&amp;gt;
&amp;lt;/Style&amp;gt;

&amp;lt;Style TargetType=&amp;quot;{x:Type Window}&amp;quot; x:Key=&amp;quot;GlossyWindow&amp;quot;&amp;gt;
    &amp;lt;Setter Property=&amp;quot;Background&amp;quot; Value=&amp;quot;{StaticResource GlossyBackground}&amp;quot; /&amp;gt;
    &amp;lt;Setter Property=&amp;quot;TextElement.FontFamily&amp;quot; Value=&amp;quot;Segoe UI&amp;quot; /&amp;gt;
    &amp;lt;Setter Property=&amp;quot;TextElement.Foreground&amp;quot; Value=&amp;quot;White&amp;quot; /&amp;gt;
    &amp;lt;!-- Other setters, trigger, etc... --&amp;gt;

    &amp;lt;!-- NESTED STYLES --&amp;gt;
    &amp;lt;Style.Resources&amp;gt;
        &amp;lt;Style TargetType=&amp;quot;{x:Type Button}&amp;quot; &lt;b&gt;BasedOn=&amp;quot;{StaticResource GlossyButton}&amp;quot;&lt;/b&gt; /&amp;gt;
        
        &amp;lt;Style TargetType=&amp;quot;{x:Type Menu}&amp;quot; &lt;b&gt;BasedOn=&amp;quot;{StaticResource GlossyMenu}&amp;quot;&lt;/b&gt; /&amp;gt;
    &amp;lt;/Style.Resources&amp;gt;
&amp;lt;/Style&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/OamUkKJpbd4" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Tue, 19 May 2009 11:15:22 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/nested-cascading-styles-in-wpf]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/nested-cascading-styles-in-wpf</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[OnTopReplica 2.6 with High DPI support]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/yUUUS_dNlJs/ontopreplica-2-6-with-high-dpi-support-chrome-less</link>
            <description>&lt;p&gt;I recently received a bug report on OnTopReplica, because it did render incorrectly when in &lt;b&gt;High DPI&lt;/b&gt; mode. Some UI elements did slip beyond the window boundaries or were misaligned.&lt;/p&gt;

&lt;p&gt;Even if Windows Forms simplifies high DPI mode the problem (Control instances have a special &lt;code&gt;AutoScaleMode&lt;/code&gt; property that automatically adapts your UI based on the system font size or the DPI mode), you still must be certain to never &lt;i&gt;ever&lt;/i&gt; use constant pixel values in your code.&lt;/p&gt;

&lt;p&gt;Essentially, the code that handled the opening and closing of the "region" side box did increase (or decrease) the width of the form of a constant value (which I tought would always match the size of the region box control). Unfortunately, Windows Forms would automatically adapt the size of said control, thus making it bigger than expected. The solution is quite easy: simply drop every constant value and always refer to the actual size of each control (in &lt;code&gt;Control.Size&lt;/code&gt; and &lt;code&gt;Control.ClientSize&lt;/code&gt;).&lt;/p&gt;

&lt;p class="centered"&gt;&lt;img src="/public/Uploads/lorenz/on_top_replica_26.jpg" width="700" height="274" alt="OnTopReplica in chromeless mode." /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="/lorenz.aspx/ontopreplica"&gt;The new version can be downloaded now&lt;/a&gt; via ClickOnce. As seen in the screenshot above, OnTopReplica 2.6 now also includes a "chrome less" mode that will remove the classic window borders (and make the application unresizable, even if it can still be moved). Should be much nicer for videos and similar.&lt;/p&gt;

&lt;p&gt;Unfortunately, while publishing the new version I discovered that the original license I used to sign the ClickOnce manifest had expired last month (this means OnTopReplica was first published with ClickOnce around one year ago, woot! &lt;img src="/BabilRes/emoticons/smile.gif" width="15" height="15" alt=" :)" /&gt;). I had to sign it with a new key: should you encounter manifest or license problems when updating the application, please update .NET to version 3.5 SP1, which should fix all manifest problems.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/yUUUS_dNlJs" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Sun, 17 May 2009 09:55:03 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/ontopreplica-2-6-with-high-dpi-support-chrome-less]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/ontopreplica-2-6-with-high-dpi-support-chrome-less</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[MySQL and Unicode (again)]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/w6piDP7dUgE/mysql-and-unicode-utf8-again</link>
            <description>&lt;p&gt;&lt;img src="/public/Uploads/lorenz/utf.png" width="150" height="125" alt="UTF" class="side" /&gt;
I already posted about the &lt;a href="/lorenz.aspx/php-mysql-and-utf-encoding"&gt;problems I ran into using UTF-8 encoding on MySQL and PHP&lt;/a&gt;. Unfortunately, MySQL still seems to not be completely happy about Unicode characters, even if you work with ASP.NET and NHibernate (which both have complete Unicode support by default).&lt;/p&gt;

&lt;p&gt;Therefore, in order to get your UTF strings stored in the database and get them back correctly in .NET, you'll first have to specify the charset you're using for the database connection in your &lt;b&gt;connection string&lt;/b&gt;. For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code class="xml"&gt;&amp;lt;hibernate-configuration xmlns=&amp;quot;urn:nhibernate-configuration-2.2&amp;quot;&amp;gt;
	&amp;lt;reflection-optimizer use=&amp;quot;false&amp;quot;/&amp;gt;
	&amp;lt;session-factory&amp;gt;
		&amp;lt;property name=&amp;quot;dialect&amp;quot;&amp;gt;NHibernate.Dialect.MySQL5Dialect&amp;lt;/property&amp;gt;
		&amp;lt;property name=&amp;quot;connection.provider&amp;quot;&amp;gt;NHibernate.Connection.DriverConnectionProvider&amp;lt;/property&amp;gt;
		&amp;lt;property name=&amp;quot;connection.driver_class&amp;quot;&amp;gt;NHibernate.Driver.MySqlDataDriver&amp;lt;/property&amp;gt;
		&lt;b&gt;&amp;lt;property name=&amp;quot;connection.connection_string&amp;quot;&amp;gt;
		Server=localhost;Database=db_name;User ID=user_id;Password=pwd;&lt;i&gt;charset=utf8&lt;/i&gt;
		&amp;lt;/property&amp;gt;&lt;/b&gt;
		&amp;lt;!-- other properties --&amp;gt;
	&amp;lt;/session-factory&amp;gt;
&amp;lt;/hibernate-configuration&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As far as I know, this should be equal to sending the "&lt;code&gt;SET NAMES utf8;&lt;/code&gt;" command I used to send in PHP.&lt;/p&gt;

&lt;p&gt;Then, you must ensure that your database tables actually use the Unicode encoding to store strings. This is especially true if your table creation SQL is automatically generated by NHibernate, through the &lt;code&gt;GenerateSchemaCreationScript()&lt;/code&gt; method, because NHibernate will just use the default encoding (&lt;i&gt;not&lt;/i&gt; Unicode). On Microsoft SQL Server it will instead use the Unicode column types like "nvarchar" and "ntext", preventing any problem.&lt;/p&gt;

&lt;p&gt;Hence, when you create a new database, explicitly define the charset to use or MySQL will default to &lt;i&gt;latin1&lt;/i&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class="sql"&gt;CREATE DATABASE db_name
    DEFAULT CHARACTER SET utf8
    DEFAULT COLLATE utf8_unicode_ci;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then you can normally create all your tables and start using them. Test the database using some uncommon characters, like the "famous" dotless turkish &lt;b&gt;&amp;#305;&lt;/b&gt;, and try to do some upper/lowercase conversion on the database.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/w6piDP7dUgE" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Tue, 12 May 2009 20:54:00 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/mysql-and-unicode-utf8-again]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/mysql-and-unicode-utf8-again</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[Solving XOR using Genetic Algorithms]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/fc2BbAl0RlU/solving-xor-using-genetic-algorithms</link>
            <description>&lt;p&gt;Yesterday &lt;a href="/lorenz.aspx/genetic-algorithms"&gt;I posted about genetic algorithms&lt;/a&gt;. Now it's time to put a GA to use and solve a very simple problem: in this case, generating &lt;b&gt;boolean logic gates&lt;/b&gt; until one of them behaves exactly like a logic &lt;b&gt;XOR gate&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="/public/Uploads/lorenz/genetic_algorithms/xor_truth_table.png" width="260" height="155" alt="XOR truth table" class="side" /&gt;
Boolean logic gates take one or more boolean values as input (in our case, value A and B) and return a single boolean response value. Their behavior can be expressed by a so called &lt;b&gt;truth table&lt;/b&gt;: in XOR's case, the gate will return True if the two input values are different, while it will return False if both are true or both are false.&lt;/p&gt;

 &lt;p&gt;&lt;span class="more-link"&gt;&lt;a href="/lorenz.aspx/solving-xor-using-genetic-algorithms"&gt;More...&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/fc2BbAl0RlU" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Sat, 9 May 2009 13:17:42 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/solving-xor-using-genetic-algorithms]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/solving-xor-using-genetic-algorithms</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[Genetic Algorithms]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/EGla8WTd_nM/genetic-algorithms</link>
            <description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/mrhappy8/417831333/"&gt;&lt;img src="/public/Uploads/lorenz/genetic_algorithms/dna.jpg" width="190" height="122" alt="Double helix by ?mrhappy?" class="side" /&gt;&lt;/a&gt;
I decided to write a couple of posts about a topic I have been working on a couple of years ago and I still find very interesting: &lt;b&gt;Genetic Algorithms&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;Genetic Algorithms are very general methods, based on the same mechanisms the biological theory of evolution is built upon, that can be successfully applied to solve optimization or search problems, without having to resort to a well known solution or a fully described algorithm.&lt;/p&gt;

&lt;p&gt;Very generally speaking, genetic algorithms can be seen as a form of heuristic that approximates a possible solution for a problem by improving it step by step. Evolution in biology depicts how a population of simple organisms eventually can evolve in functioning complex life forms, whereas genetic algorithms apply the same incremental approach to the solution of mathematically defined problems.&lt;/p&gt;

&lt;p&gt;Genetic Algorithms can also be made to &lt;i&gt;mimic&lt;/i&gt; intelligent behavior and can be seen as a form of &lt;b&gt;Artificial Intelligence&lt;/b&gt;. Even if the algorithm's process is basically "dumb" (and blind), its emergent behavior in response to changes in input can be easily mistaken as "awareness" by a human user.&lt;/p&gt;

 &lt;p&gt;&lt;span class="more-link"&gt;&lt;a href="/lorenz.aspx/genetic-algorithms"&gt;More...&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/EGla8WTd_nM" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Fri, 8 May 2009 00:27:31 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/genetic-algorithms]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/genetic-algorithms</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[15 years of Opera]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/lR56fh8Its4/15-years-of-opera-browser</link>
            <description>&lt;p&gt;Years after the &lt;a href="http://en.wikipedia.org/wiki/Browser_wars"&gt;first browser wars&lt;/a&gt;, nowadays there are lots of different browsers available either for desktop computers, smartphones and portable media devices. The internet is growing steadily, while compatibility and accesibility standards are getting more and more important to ensure an equally acceptable browsing experience on every platform.&lt;/p&gt;

&lt;p&gt;On the Windows desktop platform there are several different choices: one of those is the &lt;a href="http://www.opera.com/download/"&gt;Opera browser&lt;/a&gt;. I used it for a week or less when version 6 came out, but then switched back to explorer. Only years later I bought Opera, just &lt;i&gt;weeks&lt;/i&gt; before version 8 finally went free (lucky me), and stuck with it till now - eagerly waiting for release 10.0!&lt;/p&gt;

&lt;p&gt;Yesterday Opera did celebrate its "&lt;a href="http://www.opera.com/portal/15/"&gt;15 years of innovation&lt;/a&gt;" in the browser market. They changed the frontage of their website to a &lt;a href="http://www.opera.com/?flashed=0"&gt;very funny example of how the web was 15 years ago&lt;/a&gt; (that is, cluttered with awful gif animations). If the page has been removed, &lt;a href="http://operawatch.com/news/2009/04/operas-homepage-cracks-me-up.html"&gt;here's a screenshot of it&lt;/a&gt;.&lt;/p&gt;

&lt;p class="centered"&gt;&lt;a href="http://www.opera.com/portal/15/"&gt;&lt;img src="/public/Uploads/lorenz/opera/opera_15_years.gif" width="468" height="60" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So... why use Opera? Here's a couple of reasons of why I think that Opera deserves some attention and how it can enhance your browsing experience.&lt;/p&gt;

 &lt;p&gt;&lt;span class="more-link"&gt;&lt;a href="/lorenz.aspx/15-years-of-opera-browser"&gt;More...&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/lR56fh8Its4" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Mon, 4 May 2009 11:02:28 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/15-years-of-opera-browser]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/15-years-of-opera-browser</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[Sins of a Solar Empire]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/ry2DmxPU9a0/sins-of-a-solar-empire-review</link>
            <description>&lt;p&gt;Last week I finally had enough time to install &lt;a href="http://www.impulsedriven.com/"&gt;Impulse&lt;/a&gt;, the digital delivery solution from Stardock, and buy their newest space &lt;acronym title="Real Time Strategy"&gt;RTS&lt;/acronym&gt; game: "Sins of a Solar Empire".&lt;/p&gt;
&lt;p&gt;I had already tried the former digital delivery client by Stardock, &lt;i&gt;Stardock Central&lt;/i&gt;, to get "Galactic Civilizations II" and knew about their wonderful no-DRM, no copy protection, constant updates and great quality policy.&lt;/p&gt;
&lt;p&gt;Well, Impulse delivers the same experience. The old login I used with Stardock Central still worked and gave me access to the games I had already bought. In fact, a couple of minutes after installing Impulse, it was already updating my copy of GalCiv2. &lt;img src="/BabilRes/emoticons/smile.gif" width="15" height="15" alt=" :)" /&gt; While the updating and installing interface is pretty nice, the actual shop browsing happens through a wrapped browser interface. Anyway, after placing the order via web interface, Impulse reloads your user stats and displays the newly bought game in the "My Games" tab.&lt;/p&gt;
&lt;p class="centered"&gt;&lt;img src="/public/Uploads/lorenz/games/sins_solar_empire/impulse_interface.png" width="640" height="535" alt="Downloading Sins of a Solar Empire via Impulse." /&gt;&lt;/p&gt;
&lt;p&gt;Downloading the game is very fast and installing takes only a couple of minutes (remember to set Impulse's preferences to "ask for prompt" before installing, or it will put the game in the standard &lt;code&gt;C:\Program Files&lt;/code&gt; folder).&lt;/p&gt;

 &lt;p&gt;&lt;span class="more-link"&gt;&lt;a href="/lorenz.aspx/sins-of-a-solar-empire-review"&gt;More...&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/ry2DmxPU9a0" height="1" width="1"/&gt;</description>
            <author><![CDATA[Lorenz]]></author>
            <pubDate>Sun, 26 Apr 2009 16:29:33 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/lorenz.aspx/sins-of-a-solar-empire-review]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/lorenz.aspx/sins-of-a-solar-empire-review</feedburner:origLink></item>
        
        
                
        <item>
            <title><![CDATA[Sommer Update]]></title>
            <link>http://feedproxy.google.com/~r/klopfensteinnet/~3/elPn5B3kreE/sommer-update-2009</link>
            <description>&lt;p&gt;&lt;div style="width: 250px; border: 6px; float: right"&gt;&lt;a href="/download.aspx?file=clemens%2fterremoto2009.jpg"&gt;&lt;img src="/public/Uploads/clemens/terremoto2009_small.jpg" width="250" height="555" alt="Unser Vicolo mit den neun Erdbebenbögen von 1832" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;i&gt;Unser Vicolo mit den neun Erdbebenbögen von 1832.&lt;/i&gt;&lt;/div&gt;

Die gute alte "&lt;a href="/clemens.aspx/movies-night"&gt;Geschichte der Nacht&lt;/a&gt;" (gedreht 1978) ist immer noch unterwegs: soeben in &lt;b&gt;Amsterdam&lt;/b&gt;, am 21. Februar im Kino Rialto (dank Hans Beerecamp vom NCR Handelsblatt) und jetzt bald in &lt;b&gt;Brüssel am 24. Mai&lt;/b&gt;, im "Le Ptit-ciné" (dank Stefanie Bodien).&lt;/p&gt;

&lt;p&gt;Ab &lt;b&gt;18. September&lt;/b&gt; gibt es eine grosse Retrospektive meiner Filme im Filmmuseum &lt;b&gt;München&lt;/b&gt;. Da soll auch der neue Film von mir und unserem Sohn Lukas Tiberio "&lt;i&gt;The It.Aliens&lt;/i&gt;" uraufgeführt werden (Kuratorin: Claudia Engelhardt).&lt;br /&gt;
Details später.&lt;/p&gt;

&lt;p&gt;Desweitern: mein Umbrien-Roman (anstatt eines Tatort-Drehbuchs geschrieben) wird hoffentlich bald die endgültige Form erhalten haben, möglicher Titel: "&lt;i&gt;Pozzorotto und die Leichtigkeit des Schweins&lt;/i&gt;" und in einem Jahr ist wiederum bei Maxe Sommer und Stella Barmettler eine neue Bilderausstellung geplant im &lt;a href="http://www.hausderkunst.ch"&gt;Haus der Kunst&lt;/a&gt; Solothurn. Möglicher Titel: "&lt;i&gt;Tempelsucht&lt;/i&gt;".&lt;/p&gt;

&lt;p&gt;Zuguterletzt weise ich gerne auf die Eröffnung des "&lt;a href="http://www.ilgrotto.com/"&gt;Grottino&lt;/a&gt;" unserer Freunde Annelie Büchner und George Meyer-Goll hin: ab &lt;b&gt;1. Mai&lt;/b&gt; führen sie hier in der Nähe Bevagnas eine kleine Kneipe und ein Bed &amp; Breakfast...&lt;/p&gt;

&lt;p&gt;...und auf die Ausstellung der neuesten Bilder von &lt;b&gt;Markus Dulk&lt;/b&gt; bei &lt;a href="http://www.silviasteinergalerie.ch"&gt;Silvia Steiner&lt;/a&gt; in Biel. Eröffnung am &lt;b&gt;25. Mai&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;Einen schönen Sommer wünscht allen,&lt;br /&gt;
C.K.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/klopfensteinnet/~4/elPn5B3kreE" height="1" width="1"/&gt;</description>
            <author><![CDATA[Clemens]]></author>
            <pubDate>Sun, 19 Apr 2009 14:35:58 +02:00</pubDate>
            <guid isPermalink="true" isPermaLink="false"><![CDATA[/clemens.aspx/sommer-update-2009]]></guid>
            
        <feedburner:origLink>http://www.klopfenstein.net/clemens.aspx/sommer-update-2009</feedburner:origLink></item>
        
        
                
    </channel>
</rss>
