Month: December 2013

Shorter epi prefix for EPiServer:Property

Posted on Updated on

Declaration of a property output in Page.aspx. This is one the most common code through the whole solution.

<EPiServer:Property runat="server" PropertyName="ContactsArea"></EPiServer:Property>

I like to make repetitive markup to be smaller and have:

<epi:Property runat="server" PropertyName="ContactsArea"></epi:Property>

In your web.confing instead of

<add tagPrefix="EPiServer" namespace="EPiServer.Web.WebControls" assembly="EPiServer" />
<add tagPrefix="EPiServer" namespace="EPiServer.Web.WebControls" assembly="EPiServer.Web.WebControls" />
<add tagPrefix="EPiServer" namespace="EPiServer.Framework.Web.WebControls" assembly="EPiServer.Framework" />

you put:

<add tagPrefix="epi" namespace="EPiServer.Web.WebControls" assembly="EPiServer" />
<add tagPrefix="epi" namespace="EPiServer.Web.WebControls" assembly="EPiServer.Web.WebControls" />
<add tagPrefix="epi" namespace="EPiServer.Framework.Web.WebControls" assembly="EPiServer.Framework" />

VMWare różne

Posted on

Gdy nie da się uśpić wirtualki (nie da się nawet Power off) bo “insufficient memory”, to trzeba po prostu wyłączyć system (wirtualkę) od środka poprzez Power off.

Kindle

Posted on

Send books to your kindle email address.

To immediately download books send to your email, go back to list of all books->press Menu->Sync & Check for Items.

All the small things.

Posted on

Equals()

Często widzę że ktoś porównuje stringi za pomocą Equals:

// Bad code readability
cultureInfo.Name.Equals("en")

Jest to dla mnie nie czytelne. Czy jest jakiś powód dla którego to nie powinno być po prostu:

cultureInfo.Name == "en" 

To chyba ma sens kiedy np. chcesz użyć case insensitive (lub innego typu StringComparison).
Ja do porównywania stringów preferuję string.Compare() (jest też string.CompareOrdinal()). String.Compare() ma więcej możliwości niż Equals().

Internationalization (I18N)

Posted on

Internationalization (sometimes shortened to “I18N , meaning “I – eighteen letters -N”) is the process of planning and implementing products and services so that they can easily be adapted to specific local languages and cultures, a process called localization . The internationalization process is sometimes called translation or localization enablement. Enablement can include:

  • Allowing space in user interfaces (for example, hardware labels, help pages, and online menus) for translation into languages that require more characters
  • Creating print or Web site graphic images so that their text labels can be translated inexpensively
  • Using written examples that have global meaning
  • In .NET all strings are Unicode (thanks to authors) so we don’t have to deal with other encodings.

Source

XmlSerializer

Posted on

var stringBuilder = new StringBuilder();
var stream = new StringWriter(stringBuilder);
var serializer = new XmlSerializer(typeof(TellusSettings));

serializer.Serialize(stream, defaultWebsiteSettings.TellusSettings);

File.WriteAllText(@"C:\temp\web.txt", stringBuilder.ToString());