Archive for January, 2010

WPF: add localization via resx files

January 31, 2010

Developing localizable feature in old application wasn’t painless. 🙂
In Windows environment, thanks to .Net framework this feature is very easy.
WPF doesn’t miss the point (ehm locbaml?? ;)) so realizing localizable applications is very easy indeed.

Since I’m still a WPF newbie developer, I found old resx files is still the simple solution.
I run through this very helpfull post WPF Localization – RESX Option by Toad.

Here is a step-by-step summary:

  1. Added “Resource” folder to wpf project
  2. Added resx files, based on languages to support (ie: Resource.en-US.resx, Resource.it-IT.resx, … and Resources.resx of couse)
  3. Changed resx files from Internal to Public
  4. Added resource namespace in Window1.xaml:
    xmlns:resx="clr-namespace:WpfApplication1.Resources"
  5. Setted property’s binding to desidered controls:
    <TextBlock Text="{x:Static resx:Resource.SampleMessage}" />
  6. So standard Window1.xaml can result like this

    <Window x:Class="WpfApplication1.Window1"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:resx="clr-namespace:WpfApplication1.Resources"
     Title="Window1" Height="100" Width="300">
    <Grid>
     <TextBlock Text="{x:Static resx:Resource.SampleMessage}" />
    </Grid>
    </Window>
  7. To test different languages, pre_setting language in App class constructor:
    public partial class App : Application
    {
        static App()
        {
            Resource.Culture = new System.Globalization.CultureInfo("it-IT");
        }
    }

XAML binding let resource available in designer window:

Ta-daaa! 🙂

source: WPF Localization – RESX Option

Technorati tags: WPFLocalization

Object Relational Mapping’s theory

January 28, 2010

What is object relational mapping goal?
What (N)Hibernate‘s goal ? and Entity Framework goal?
and Linq2SQL? .netTiers? CSLA.NET? …

It’s good to know what is the goal of the tool we are using, what it offers and how it relates with other tools.
The document “Foundations of O/R Mapping” by  Mark Fussel may help you to better understand what is the right tool for your application. 😉

source: Hai voluto la bicicletta?

Technorati tags: ORM

How is your battery’s life (Windows7 tips&trisks)

January 24, 2010

A laptop’s battery doesn’t last at long.
In Windows7 Tips&Tricks you may found a command to check your battery’s health.
Look for Find out How Healthy Your Battery is on Your Laptop section.
I run the command  powercfg -enery via command prompt (via run as administrator) and got this response:

This laptop is 4 years old and this battery is the original one.
:O
Wait, there is no rocket science behind this result.
Simply I never used battery because I’m always running in ups safe energy environment;
more, this battery had only been charged (only full-charge) about 10 times (in 4 years!!!).

I know, these are too lucky conditions and this test doesn’t worth a penny. 😦

ps: powercfg’s report tells more about energy than only battery’s life: power management, ecc.
better look deep that report. 😉

source: Misurare le prestazioni della vostra batteria

Technorati tags: Windows7

GSM mobile eavesdropping…

January 21, 2010

Very interesting interview to Karsten Nohl, about mobile GSM eavesdropping.

Nohl: We showed that GSM, the widely used cell phone standard, is insecure, and explained how your neighbor might already be listening in on your calls. After GSM’s security was declared outdated several times before, we were the first to make tools available for people to verify its insecurities.

full interview here: Q&A: Researcher Karsten Nohl on mobile eavesdropping

source: Come intercettare le comunicazioni dei cellulari

Noop.nl: happy 2nd birthday

January 18, 2010

Noop.nl by Jurgen Appelo is a very good blog about Agile (development, management … and related 😉 ).
Today is its 2nd birthday.

One of my favourite post is TOP 100 blogs for developers, frequently updated;
latest post is Top 200 Blogs for Developers (Q3 2009). 😉

Other “TOP nnn” posts are updated, Top 20 Best Agile Development Books, Top 50 New Software Development Books and many others.

To celebrate this big event, he is giving away a few books about blogging.
Have a look on todays’ post about Noop’s birthday and join the tweet competition. 😉

Happy birthday to Noop … 🙂