Saturday, October 10, 2009

Thursday, August 27, 2009

Using CultureInfo for Globalization/Localization of an Asp.Net Applictation

Globalization is the process of making the application able to handle different culture and regions, while localization is the process of customization of the application for a specific culture and region.

You use resource files (.resx) to localize the resources in your application. You use classes in System.Globalization namespace to make your application culture aware.
The main class in Systme.Globalization namespace is the CultureInfo class. It contains many methods and properties to identify different cultures and configure your application to use a specific culture.

You use System.Threading.Thread.CurrentCulture and System.Threading.Thread.CurrentUICulture to configure your application to use a specific culture setting.

So how do you set which culture to use with your application?

The System.Threading.Thread.CurrentCulture property is used to set a specific culture for the application. This property mainly defines how the application will format the datetime string and currency. So if you are manipulating datetime and currency in your application and want you application to correctly format them based on the use's culture then you need to set the System.Threading.Thread.CurrentCulture property.

The System.Threading.Thread.CurrentUICulture property is used to set a neutral culture for the application. This property mainly defines what resource files to use for your application. Say for example, for English user you want display content in your site in English and for French users you want to display your sites in French. So you create different resource files for different languages and set this property and your application will automatically select correct resource file to used based on the culture setting.

There are three types of Culture your application can use. One is InvariantCulture, second is NeutralCulture and the last one is SpecificCulture.

InvariantCulture actually means culture agnostic. You use InvariantCulture when you want to compare strings, display or compare dates in culture agnostic way. By default it uses the en-US culture.

NeutralCulture is actually a language specific culture without regard to the country specific datetime and currency formats. You use this culture to determine which language specific resource file your application will use. You can specify NeutralCulture with two lower case characters identifying the language. For example, 'en' for English, 'fr' for French, 'es' for Spanish.

SpecificCulture is the language and country specific culture which determines the language to use with your application and also the datetime and currency format to use with your application. You specify the specific culture with two lower case characters identifying the language and two upper case characters identifying the country separated by hyphen. For example, 'en-US' for English (US), 'en-GB' for English (UK), 'fr-FR' for French(France) etc.

So while setting the culture to use with you application, you set the CurrentCulture property to a SpecificCulture and the CurrentUICulture property to a NeutralCulture.

Let's see an example to set the culture for an application.

In the above two lines, you are telling your application to use English as the culture. As said before, CurrentCulture property will determines which format to use for displaying datetimes and currency while the CurrentUICulture will determine which resource files to use while displaying strings in your application. You can see that the CurrentCulture property is set to "en-US" which a specific culture for English for United Status, while the CurrentUICulture property is set to "en" which is a neutral culture.

Tuesday, August 4, 2009

Brainvilla: One more library in Bangalore

Good news for all the book lovers in the CV Raman nagar and Kagadaspura area in Bangalore. Just yesterday I came across this library called Brainvilla at 6th Cross, Kagadaspura. It is just started and a small library offering Books and toys. One can borrow books and toys for 15 days and also can buy them as they have all the new copies of books and toys.

The library claims to have almost 2500 books (and counting) on almost all topics like fiction, self-help, reference, children's books. Although I am quiet disappointed as they don't have computer and IT related books as Bangalore is IT city and almost majority of the readers will be Software professionals.

They have 3 different plan availbale in 3 different categories where minimum is a one month plan for Rs. 149. However, I found the tariff at little higher compared to other library like British Library at Kasturba Road. One can opt for a monthly plan which is minimum or a six month or a yearly plan. All this plans are available in Silver, Golden and Platinum categories where one can borrow two books, two books and one toy, two books and two toys respectively.

Currently their website is under construction but once it is up they are also planning to take orders from the website and give home delivery of the books. That is really cool service they are providing as not many libraries deliver book at doorsteps.

If you are searching for a library in bangalore then here is the list of all libraries apart from Brainvilla in Kagadaspura.

Update: their website is up and now you can book your books/toys online also. They also offer home delivery/pickup options.

Wednesday, July 1, 2009

A Little time at RTO office

Just now I came from RTO where I went to take a written test to get a learner's license. And I spent there four hours without taking the test. Now you imagine. Not everybody spent four hours to get their driving license. So on average, I think people might be spending two hours. Based on the rush I can say there were more than 500 hundred people for various reason. I did little calculation on how much productivity we are loosing just at various RTOs in India.

500 people spent average 2 hours per day: 500 * 2 = 1000 Man-Hours
5 Working days per RTO: 2000 * 5 = 5000 Man-Hours
52 weeks: 10000 * 52 = 260000 Man-Hours
There are 1019 RTOs in India: 1019 * 260000 = 26,49,40,000 Man-Hours.

Now, not all the RTOs are as busy as the one where I went ( I went Indiranagar RTO in Bangalore). But there might me many RTOs which are more busy then this one like in Mumbai, Delhi and Kolkata. So I think that 500 people visiting RTO everyday on average is a reasonable guess. Now just guess all this people earn atleast Rs. 100 per day. Meaning Rs 12.50 Per hour.

26,49,40,000 * 12.5 = Rs. 3,31,17,50,000/-.

That is more than 3 billion or 331 crore Rupees. This is the amout of money India looses every year just at RTOs. There are many other government offices in India where people spend considerable amount of time daily getting one or other things done. Just imagine.

Wednesday, June 24, 2009

Web Hosting

Well, in setting up this blog I did a considerable search on how to setup a blog. So thought I would write something about it here.

First things first. You need to have a domain name and a hosting provider. Both can be the same company or different companies.

The advantage of having the same company as your domain name provider and hosting provider is, it is easy to setup your site then if they are from different companies. The disadvantage is that if the company goes down or suddenly disappears you loose both your domain name and hosting space. You also need to take care of your renewals because if some company can became a nightmare for you if you don't renew in time then they may block both your hosting space and domain name. And domain name is actually your brand and you don't want to loose it. So be careful.

The above disadvantage is not there if you have domain name from one company and hosting space from another company. But in this case, once your hosting account is setup, you need to change name servers from your domain name account. So managing domain name account and hosting account may become cumbersome.

I hope this helps anybody who wants basic information on hosting their sites.

Tuesday, June 23, 2009

My First Blog Entry!

Well, so I have setup my blog and this is my first entry. Earlier I used to blog at From now onwards I will post on this site but I will keep that blog alive. Welcome to my new blog!!