.NET culture names

I have searched the web a lot of times in need of a culture name for a specific language and culture, but I have never been able to find a complete list on the net.
I have compiled a list, and here it is for my own, and hopefully other people's use.

Language/countryCulture name
Afrikaans (South Africa) af-ZA
Albanian (Albania) sq-AL
Arabic (Algeria) ar-DZ
Arabic (Bahrain) ar-BH
Arabic (Egypt) ar-EG
Arabic (Iraq) ar-IQ
Arabic (Jordan) ar-JO
Arabic (Kuwait) ar-KW
Arabic (Lebanon) ar-LB
Arabic (Libya) ar-LY
Arabic (Morocco) ar-MA
Arabic (Oman) ar-OM
Arabic (Qatar) ar-QA
Arabic (Saudi Arabia) ar-SA
Arabic (Syria) ar-SY
Arabic (Tunisia) ar-TN
Arabic (U.A.E.) ar-AE
Arabic (Yemen) ar-YE
Armenian (Armenia) hy-AM
Azeri (Cyrillic, Azerbaijan) az-AZ-Cyrl
Azeri (Latin, Azerbaijan) az-AZ-Latn
Basque (Basque) eu-ES
Belarusian (Belarus) be-BY
Bosnian (Cyrillic, Bosnia and Herzegovina) bs-BA-Cyrl
Bosnian (Latin, Bosnia and Herzegovina) bs-BA-Latn
Bulgarian (Bulgaria) bg-BG
Catalan (Catalan) ca-ES
Chinese (Hong Kong S.A.R.) zh-HK
Chinese (Macao S.A.R.) zh-MO
Chinese (People's Republic of China) zh-CN
Chinese (Singapore) zh-SG
Chinese (Taiwan) zh-TW
Croatian (Bosnia and Herzegovina) hr-BA
Croatian (Croatia) hr-HR
Czech (Czech Republic) cs-CZ
Danish (Denmark) da-DK
Divehi (Maldives) div-MV
Dutch (Belgium) nl-BE
Dutch (Netherlands) nl-NL
English (Australia) en-AU
English (Belize) en-BZ
English (Canada) en-CA
English (Caribbean) en-CB
English (Ireland) en-IE
English (Jamaica) en-JM
English (New Zealand) en-NZ
English (Republic of the Philippines) en-PH
English (South Africa) en-ZA
English (Trinidad and Tobago) en-TT
English (United Kingdom) en-GB
English (United States) en-US
English (Zimbabwe) en-ZW
Estonian (Estonia) et-EE
Faroese (Faroe Islands) fo-FO
Filipino (Philippines) fil-PH
Finnish (Finland) fi-FI
French (Belgium) fr-BE
French (Canada) fr-CA
French (France) fr-FR
French (Luxembourg) fr-LU
French (Principality of Monaco) fr-MC
French (Switzerland) fr-CH
Frisian (Netherlands) fy-NL
Galician (Galician) gl-ES
Georgian (Georgia) ka-GE
German (Austria) de-AT
German (Germany) de-DE
German (Liechtenstein) de-LI
German (Luxembourg) de-LU
German (Switzerland) de-CH
Greek (Greece) el-GR
Gujarati (India) gu-IN
Hebrew (Israel) he-IL
Hindi (India) hi-IN
Hungarian (Hungary) hu-HU
Icelandic (Iceland) is-IS
Indonesian (Indonesia) id-ID
Inuktitut (Latin, Canada) iu-CA-Latn
Irish (Ireland) ga-IE
Italian (Italy) it-IT
Italian (Switzerland) it-CH
Japanese (Japan) ja-JP
Kannada (India) kn-IN
Kazakh (Kazakhstan) kk-KZ
Kiswahili (Kenya) sw-KE
Konkani (India) kok-IN
Korean (Korea) ko-KR
Kyrgyz (Kyrgyzstan) ky-KG
Latvian (Latvia) lv-LV
Lithuanian (Lithuania) lt-LT
Luxembourgish (Luxembourg) lb-LU
Macedonian (Former Yugoslav Republic of Macedonia) mk-M K
Malay (Brunei Darussalam) ms-BN
Malay (Malaysia) ms-MY
Maltese mt-MT
Maori mi-NZ
Mapudungun (Chile) arn-CL
Marathi (India) mr-IN
Mohawk (Mohawk) moh-CA
Mongolian (Cyrillic, Mongolia) mn-MN
Norwegian, Bokmål (Norway) nb-NO
Norwegian, Nynorsk (Norway) nn-NO
Persian (Iran) fa-IR
Polish (Poland) pl-PL
Portuguese (Brazil) pt-BR
Portuguese (Portugal) pt-PT
Punjabi (India) pa-IN
Quechua (Bolivia) quz-BO
Quechua (Ecuador) quz-EC
Quechua (Peru) quz-PE
Romanian (Romania) ro-RO
Romansh (Switzerland) rm-CH
Russian (Russia) ru-RU
Sami, Inari (Finland) smn-FI
Sami, Lule (Norway) smj-NO
Sami, Lule (Sweden) smj-SE
Sami, Northern (Finland) se-FI
Sami, Northern (Norway) se-NO
Sami, Northern (Sweden) se-SE
Sami, Skolt (Finland) sms-FI
Sami, Southern (Norway) sma-NO
Sami, Southern (Sweden) sma-SE
Sanskrit (India) sa-IN
Serbian (Cyrillic, Bosnia and Herzegovina) sr-BA-Cyrl
Serbian (Cyrillic, Serbia and Montenegro) sr-SP-Cyrl
Serbian (Latin, Bosnia and Herzegovina) sr-BA-Latn
Serbian (Latin, Serbia and Montenegro) sr-SP-Latn
Sesotho sa Leboa (South Africa) ns-ZA
Setswana (South Africa) tn-ZA
Slovak (Slovakia) sk-SK
Slovenian (Slovenia) sl-SI
Spanish (Argentina) es-AR
Spanish (Bolivia) es-BO
Spanish (Chile) es-CL
Spanish (Colombia) es-CO
Spanish (Costa Rica) es-CR
Spanish (Dominican Republic) es-DO
Spanish (Ecuador) es-EC
Spanish (El Salvador) es-SV
Spanish (Guatemala) es-GT
Spanish (Honduras) es-HN
Spanish (Mexico) es-MX
Spanish (Nicaragua) es-NI
Spanish (Panama) es-PA
Spanish (Paraguay) es-PY
Spanish (Peru) es-PE
Spanish (Puerto Rico) es-PR
Spanish (Spain) es-ES
Spanish (Uruguay) es-UY
Spanish (Venezuela) es-VE
Swedish (Finland) sv-FI
Swedish (Sweden) sv-SE
Syriac (Syria) syr-SY
Tamil (India) ta-IN
Tatar (Russia) tt-RU
Telugu (India) te-IN
Thai (Thailand) th-TH
Turkish (Turkey) tr-TR
Ukrainian (Ukraine) uk-UA
Urdu (Islamic Republic of Pakistan) ur-PK
Uzbek (Cyrillic, Uzbekistan) uz-UZ-Cyrl
Uzbek (Latin, Uzbekistan) uz-UZ-Latn
Vietnamese (Vietnam) vi-VN
Welsh cy-GB
Xhosa xh-ZA
Zulu zu-ZA

Enable MSDTC network access

I was developing a database layer using TransactionScope in .Net 2.0, and when opening the second connection I got the following error:

The partner transaction manager has disabled its support for remote/network transactions

This means that you need to enable network access on both the server/client that is running the application, but also on the database server(s) that you are connecting to. To do this you need to do:


First verify the "Distributed Transaction Coordinator" Service is
running on both database server computer and client computers
1.      Go to "Administrative Tools > Services"
2.      Turn on the "Distributed Transaction Coordinator" Service if it is not running

If it is running and client application is not on the same computer as
the database server, on the computer running database server
1.      Go to "Administrative Tools > Component Services"
2.      On the left navigation tree, go to "Component Services > Computers > My Computer"
3.      Right click on "My Computer", select "Properties"
4.      Select "MSDTC" tab
5.      Click "Security Configuration"
6.      Make sure you check "Network DTC Access", "Allow Remote Client", "Allow Inbound/Outbound", "Enable TIP"
7.      The service will restart
8.      You might have to restart the computer(s)

Enable CLR SQL Server 2005

I cant remember each time I have to turn this on how to do it, so here's a little blog for myself :)

Solution: Enable the server option 'clr enabled'


EXEC sp_configure 'show advanced options' , '1';
go
reconfigure;
go
EXEC sp_configure 'clr enabled' , '1'
go
reconfigure;
-- Turn advanced options back off
EXEC sp_configure 'show advanced options' , '0';
go

 

.NET generics performance

You may wonder if the nice features of the generics List lacks in performance.

I wondered the same, so I decided to make a small and not very thorough test.

            ArrayList items = new ArrayList();
            for (int x = 0; x < 1000000;x++ )
            {
                items.Add("string" + x.ToString());
            }

            List<string> list = new List<string>();
            for (int x = 0; x < 1000000; x++)
            {
                list.Add("string" + x.ToString());
            }

            DateTime before = DateTime.Now;
            ArrayList wanted = new ArrayList();
            foreach (string str in items)
            {
                if (str.ToLower().EndsWith("0"))
                {
                    wanted.Add(str);
                }
            }
            DateTime after = DateTime.Now;
            Console.WriteLine("Time elapsed: {0} milliseconds", after.Subtract(before).TotalMilliseconds);

            before = DateTime.Now;
            List<string> wanteds = list.FindAll(delegate(string str) { return str.ToLower().EndsWith("0"); });
            after = DateTime.Now;
            Console.WriteLine("Time elapsed: {0} milliseconds", after.Subtract(before).TotalMilliseconds);
            Console.WriteLine("Press enter to continue");
            Console.ReadLine();

As you can see, I try to do the same things twice. The first time, I loop through an ArrayList with 1,000,000 string in it, to find those that ends in a 0. The strings that match are added to a new ArrayList.

The second time I do the same, just this time I am using the generics List, and the FindAll.

The performance difference are not great, but its there, and surprisingly it is in favour of the generics List.

On my computer, the first example gives the output:
Time elapsed: 890,625 milliseconds

and the second one:
Time elapsed: 765,625 milliseconds

which gives approximately 15% increase in performance, but that is only with one million items in the lists.

I summed it up in the following table, i could not move above 1 million items on my computer since I only have 2 GB of ram :)

And it seems like the 15% speed increase continues. 

Number if items ArrayList List<string>
1000 0 0
10000 15,625 0,000
100000 93,750 78,125
1000000 890,625 765,625

But what happens if the objects are a bit more complex than just strings?

            int count = 2000000;
            ArrayList items = new ArrayList(count);
            for (int x = 0; x < count; x++)
            {
                Servant s = new Servant();
                s.Name = "Jane"+x.ToString();
                s.Age = x % 2 == 0 ? 19:18;
                s.Sex = x % 2 == 0 ? SexFlag.Female : SexFlag.Male;
                items.Add(s);
            }

            List<Servant> list = new List<Servant>(count);
            for (int x = 0; x < count; x++)
            {
                Servant s = new Servant();
                s.Name = "Jane" + x.ToString();
                s.Age = x % 2 == 0 ? 19:18;
                s.Sex = x % 2 == 0 ? SexFlag.Female : SexFlag.Male;
                list.Add(s);
            }

            DateTime before = DateTime.Now;
            ArrayList wanted = new ArrayList();
            foreach (Servant s in items)
            {
                if (s.Sex == SexFlag.Female && s.Age > 18 && s.Age < 25 && s.Name.ToLower().EndsWith("0"))
                {
                    wanted.Add(s);
                }

            }
            DateTime after = DateTime.Now;
            
            
            Console.WriteLine("Time elapsed ArrayList: {0} milliseconds, found {1} items", after.Subtract(before).TotalMilliseconds,wanted.Count);

            before = DateTime.Now;
            List<Servant> wanteds = list.FindAll(delegate(Servant s) { return s.Sex == SexFlag.Female && s.Age > 18 && s.Age < 25 && s.Name.ToLower().EndsWith("0"); });
            after = DateTime.Now;
            Console.WriteLine("Time elapsed List<string>: {0} milliseconds, found {1} items", after.Subtract(before).TotalMilliseconds,wanteds.Count);

And the results:
 

Number if items ArrayList List<Servant>
1000 0,000 0,000
10000 0,000 0,000
100000 46,875 46,875
1000000 484,375 390,625
2000000 968,750 812,500

That is all nice, it seems like the generics have an advantage over the plain old way of doing things, but what about CPU usage? How does that sum up?

I ran the test with the more complex objects a few times, and monitored the CPU usage, my test results was simple, it seems like the dont differ much, but then again my testing tools is my eyes, so i can be greatly wrong :)

But considering my tests, it seems like a safe assumption to say that generics have no negative performance impact what so ever, it on the other hand gives a performance boost, when your lists are very large.