Upgrade do Wordpress 2.8 i problem z kodowaniem polskich znaków [PL]

I’m sorry if you are an English spoken reader but this post is published in Polish. The reason for that is it describes a problem with encoding of some Polish characters after upgrading to Wordpress 2.8, so a problem that only Poles should be interested in.
This blog is still supposed to be maintained in English so please do not get discouraged.

Dziś postanowiłem zrobić upgrade swojego fotobloga z Wordpress 2.6.1 na 2.8. Wszystko poszło sprawnie ale okazało się, że kodowanie polskich znaków totalnie się posypało – zamiast nich kwadraciki i krzaczki.

Pomimo mocnego zaplecza, przyznam, że zabawa z kodowaniem znaków totalnie mi nie odpowiada. Miałem już kiedyś problem z ukraińską stroną znimky.net, która stała się nieczytelna po zmianie MySQL z 4.0 na 4.1. Po długich bojach problem został rozwiązany poprzez dodanie poniższych 3 linii kodu PHP po ustnawieniu połączenia z bazą danych:

mysql_query("SET character_set_results=\"utf8\"");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES \"utf8\"");

Zacząłem szukać ale nie znalazłem zbyt wiele…

Continue reading ‘Upgrade do Wordpress 2.8 i problem z kodowaniem polskich znaków [PL]‘

Robust generation of XML documentation comments for C#

Writing comments is something you need to get used to; sooner or later you will understand it’s worth writing comments. Haven’t you find yourself in a sitation where you don’t understand what a couple of lines of YOUR OWN code do? I have…

XML documentation comments are also important, particularly for public members/methods. Even if your project doesn’t require generating full XML documentation of the code, using Intellisense can be much more effective if it summarizes the method you are trying to use. If you want to generate XML documentation for C# in the twinkling of an eye you MUST install Roland Weigelt’s GhostDoc plugin for Visual Studio. Let me cite the author:

Continue reading ‘Robust generation of XML documentation comments for C#’

Code snippets have changed on dobrzanski.net

Following my friend’s post I decided to change the plugin for highliting code snippets on this blog from Google Code Prettifier to Google Syntax Highlighter for WordPress.

This tool is much better – now code looks more fancy and you can always show/copy to clipboard the very code (without additional characters that need removing). If you’re running a blog where you publish fragments of code – don’t wait and install this tool now!

The only problem that change introduced was I had to change all old posts so that code is picked up by this plugin. It took an hour but was worth it.

Reblog this post [with Zemanta]

Terminal server has exceeded maximum number of allowed connection – how to kill open sessions?

When you RDC (connecting remotely using Remote Desktop Connection) to a server and get “Terminal server has exceeded maximum number of allowed connection” message there’s still light at the end of the tunnel.

Solution (tested on Windows 2003)

RDC to another server in the same workgroup as the one you cannot access and go to Administrative Tools / Terminal Services Manager.

Continue reading ‘Terminal server has exceeded maximum number of allowed connection – how to kill open sessions?’

Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform Delete for XXX —> NHibernate.Exceptions.GenericADOException: could not delete collection

The beginning of the stack trace I got today looked as below:

2009-05-19 11:01:45,078 ERROR [5232] XXX - Speaker already deleted: Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform Delete for Speaker ---> NHibernate.Exceptions.GenericADOException: could not delete collection: [XXX#XXX][SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'SpeakerId', table 'XXX.dbo.lnk_Session_Speaker'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
   ...
   at SpeakerProxy3e9fd3b0e82745c2b91b8a353acaa93d.DeleteAndFlush()

Background

I had three tables and classes representing them: Session / app_Session, Speaker / app_Speaker, and SessionSpeaker / lnk_Session_Speaker.

Continue reading ‘Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform Delete for XXX —> NHibernate.Exceptions.GenericADOException: could not delete collection’

Adapt your blog for mobile devices

Wordpress blog with WordPress Mobile 3.0
Image by Wesley Fryer via Flickr

Since I received Nokia e51 I’ve been browsing web pages with Opera Mini. This is a decent browser which makes reading pages easier but it can’t do all. The best case is when not only the browser cares to display the page best it can, but also the owner of the page does so, i.e. only important content is downloaded so that the page is lighter and loads faster (which is important if you are not having a free WI-FI connection).

Continue reading ‘Adapt your blog for mobile devices’

C# 3.0 Pocket Reference: Instant Help for C# 3.0 Programmers

For those who work with C# I’d like to recommend a book which is a kind of summary of knowledge on C# 3.0. The book is quite short (and small by the way – yet pocket reference) but it covers lots of details on C# and describes what’s new in C# 3.0. Everything in short and simple, with code snippets.

I read this book as a first step towards TS: Microsoft .NET Framework – Application Development Foundation. Basically, I’ve started wondering if passing this exam is not a good step in my .NET career and this is the entry point.

Anyway this book is not a C# bible, but it can really help as a knowledge reresher.

Recommended.

Reblog this post [with Zemanta]

C#, decimal.toString(), and how to get rid of trailing zeros

Today I spend A LOT OF time on trying to display a percentage – string representation of a decimal but without trailing zeros, e.g. 15.1% instead of 15.10%.

In the application I already had NumberFormatInfo for displaying monetary values and percentages. An object of that type was defined as follows:

NumberFormatInfo nfi = new NumberFormatInfo();
nfi.PercentDecimalDigits = 2;
// some additional settings for nfi
// (including monetary and numeric attributes)

Continue reading ‘C#, decimal.toString(), and how to get rid of trailing zeros’

Skype for free on Nokia E51 mobile with Fring

Fring Skype for free on Nokia E51 mobile with Fring
Image via Wikipedia

One of nice features of Nokia E51 is it has Wi-Fi modem embedded. That gives you a lot of opportunities. I was particularly interested in Skyping my friends from my mobile.

First I checked Skype homepage in order to find out if there’s a version compatible with E51. There’s not… but on Skype forum I read that installing version for Nokia N95 might do. Only then did I read the official description of Skype lite.

Continue reading ‘Skype for free on Nokia E51 mobile with Fring’

How to manage trunk/branches/tags in the project while bug fixing and regular development?

Recently I’ve come across some problems on managing trunk/branches/tags. As a result of manual merging two branches I’ve ended up with hours spent on editing conflicts and checking the system. It’s obvious this was not a good sign as new bugs might have been introduced.

I’ve decided to organise the way the revision control system is used. Below you can find descriptions of two most common scenarios.

Continue reading ‘How to manage trunk/branches/tags in the project while bug fixing and regular development?’