Tuesday, August 23, 2005


Reading a recent post in I decided to implement as a proof-of-concept an algorithm using regular expressions to convert a decimal numeral representing an amount of money, to a verbal from in Greek text.

So to make it more obvious the problem was to convert 1,234,567.89 Euros to the string "One Million, Two Hundred Thirty Four, Five Hundred Sixtyseven Euros and Eightynine Cents" (only that the text should be in Greek and not English as I typed here to make the concept clear for everyone).

The algorithm I came up with is not the best that I could do but is enough as a proof of concept. Do not be alarmed if it seems too long at first glance. It's just the code comments that make it so long.

Here it goes:
You can also find this at the relevant blog article in here (in Greek).

Saturday, August 6, 2005

MetaBlogAPI for CS 1.1

I wanted to test w.Bloggar and BlogJet today for posting in a CS 1.1 blog. MetaBlogAPI comes as a separate download from CS 1.1 so I tried to find and get it. Believe me I had a real hard time!

After an hour or so of googling around for it, a friend from finally pointed me to it.

Here it is:

If you need it, go get it…

The other versions found in various posts in are usually older versions and will just give you a "Method not found: System.Collections.ArrayList COmmunityServer.Blogs.Components.Weblogs.GetWebLogs(CommunityServer.ComponentsUser,  Boolean, Boolean, Boolean). (EGetRecentError)" error message.

I wish they had a more standard place for it on the web than just a form post…

Friday, August 5, 2005

CS default language problems

I run into an issue today regarding Community Server 1.1 (CS 1.1).
I changed the default language in communityServer.config from en-US to el-GR, only to get a runtime error.

The change:

<Core defaultLanguage="el-GR">

The error:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

Source Error:
Line 49: message = FindControl("Message") as Literal;
Line 50: if(message != null)

Line 51: message.Text = string.Format(ResourceManager.GetString("DisplayUserWelcome_AlternateUserWelcome"), CSContext.Current.SiteSettings.SiteName);

Source File: C:\Documents and Settings\rousso\My Documents\Visual Studio Projects\CS\1.1\50615src\src\Controls\User\AnonymousUserControl.cs    Line: 51

Stack Trace:

[FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.] System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args) +1232

System.String.Format(IFormatProvider provider, String format, Object[] args) +65
System.String.Format(String format, Object arg0) +47
System.Web.UI.Control.EnsureChildControls() +100
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Page.ProcessRequestMain() +1499

After meddling around a a little bit I pin pointed the problem to a translation error.

I turns out that the Greek language resource files located in /Languages/el-GR/Resources.xml were not properly (if at all) converted to reflect changes in code between version 1.0 and 1.1 of CS.

This line was the problem:
<resource name="DisplayUserWelcome_AlternateUserWelcome">Καλώς ορίσατε στο {0} {1}resource>

There, two String.Format arguments are obviously expected. On the other hand, line 51 of AnonymousUserControl.cs, only passes one (see source error above).

Removing the second placeholder from the format string solves the problem:
<resource name="DisplayUserWelcome_AlternateUserWelcome">Καλώς ορίσατε στο {0}resource>
The same stands for fr-FR (French) language resources I checked. Probably for others too.

If you can read Greek see my relevant posts in Also if you are looking to solve the same problem for the Greek (Hellenic) language see these posts in where you can get the corrected translation for Greek text and buttons (it is attached to the post).