国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

首頁(yè) 數(shù)據(jù)庫(kù) mysql教程 Architecture FAQ for Localization and Globalization Part 2

Architecture FAQ for Localization and Globalization Part 2

Jun 07, 2016 pm 03:44 PM
faq for

http://www.codeproject.com/Articles/29362/Architecture-FAQ-for-Localization-and-Globalizatio Architecture FAQ for Localization and Globalization Introduction (B) What are satellite assemblies? (A) How do we generate Satellite assemblies? (

http://www.codeproject.com/Articles/29362/Architecture-FAQ-for-Localization-and-Globalizatio

Architecture FAQ for Localization and Globalization


Introduction

(B) What are satellite assemblies?

(A) How do we generate Satellite assemblies?

(A) What is AL.EXE and RESGEN.EXE?

(I) What is the use of resource manager class?

(A) What precautions do we need to take while deploying satellite assemblies?

(A) Can you explain the fundamentals of “GetGlobalResourceObject” and “GetLocalResourceObject” functions?

(A) Can we sign a satellite assembly?

(I) Can you explain collation sequence in sql server?

(A)How do we define collation sequence for database and tables?

(A)Can we change the order in a select query with a specified collation sequence?

(A) Can you list best practices for globalization and localization?

References

Other Interview question PDF's

Introduction

You can see the part 1 of the article at:-?LocalizationGlobalizPart1.aspx???

When we see around, architectures mainly discuss about loose coupling , scalability , performance etc etc. Many architecture forget one of the important aspects in software is making application globalized. Depending on project some application would not really want to have multi-language based websites , but i am sure many will. So in this article we will go through a series of FAQ which will give you a quick start on making application multi-language based.

Lately i have been writing and recording videos heavily on design patterns , UML and many architectural stuff you can visit?http://www.questpond.com?for design pattern and UML videos.

You can read my previous articles on design patterns and UML in the below links:-

Part 1 – Design patterns Factory, Abstract factory, builder, prototype, shallow and deep copy, and singleton and command patterns

SoftArchInter1.aspx??

Part 2 – Design patterns Interpreter, Iterator, Mediator, Memento and observer patterns

SoftArch2.aspx?

Part 3 – Design patterns State, Stratergy, Visitor, Adapter and fly weight pattern

SoftArch3.aspx?

Part 4 Design patterns Bridge, Composite, Decorator, Facade, COR, Proxy and template pattern

SoftArch4.aspx

Loosely coupled architecture using

IOCDI.aspx?

You can download by architecture interview question book from?

http://www.questpond.com/softArchi.zip.zip??

?



(B) What are satellite assemblies?


(A) How do we generate Satellite assemblies?


(A) What is AL.EXE and RESGEN.EXE?


In the previous question, you have seen how we can use resource files to store data according to the localized languages. However, when you actually go for deployment you will not like to also install the “resx” or “txt” files. It is definitely not a good deployment practice to install data, which can be easily modified. In short some how we should install this in a binary format so that no end user can change it. That is why Microsoft introduced satellite assemblies.
Satellite assemblies are assemblies, which do not contain source code. They only contain resource files. You can create a satellite assembly using rsgen.exe and al.exe. They are in binary DLL format, which makes it easier to ship it during deployment. So finally, during deployment you do not need to ship the resx files but only the compiled satellite DLL.
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.15: - resgen.exe and al.exe in action


The above diagram will give you a complete picture of how to generate Satellite assembly. You can see from the above figure we need two exe resgen.exe and al.exe. Once you made your resx file or text file, you should first convert in to a “.resource” files. This is done by using the resgen.exe. Below is the command snippet for resgen.exe where LoginScreen.aspx.el.resx is the resx file and output is Greek. Resources file. If you do not provide the output file name it will generate “LoginScreen.resources”.

Resgen LoginScreen.aspx.el.resx Greek.Resources

You can also generate resx files from txt file using resgen.exe below is the code snippet for the same:-

Resgen MyLanguage.txt MyLanguage.resx

The above command snippet will generate a MyLanguage.resx using MyLanguag.txt file. You can make a DLL using resource files and not resx so you should make this conversion.
Now once the resource file is generated its time make the compiled assembly of the same so that it can be shipped during deployment. This is accomplished by using the assembly linker tool al.exe provided by Microsoft. Below is the command code snippet for the same.

al.exe /out: el.dll /c: de /embed: greek.resources

In the /out switch you need to provide the output DLL name. /c you need to specify the culture of the resource file. /embed you need to specify all the resources which are present in the resource file. As said previously other than strings you can also put image files like GIF, BMP etc. So those physical resources you can specify in the /embed switch. You can specify more than one resource use “,” as a separator to specify more than one resource files.?
?

(I) What is the use of resource manager class?


Resource Manager Class helps us to read the resource files and get the values using key.?
First, you need to create the object of resource manager. You need to specify the resource name and the assembly in the constructor.

privateResourceManagerobjResourceManager = new ResourceManager("Globalization.resource",System.Reflection.Assembly.GetExecutingAssembly());

Once the resource manager is populated with details, you can then use the Get String function to get by key. For instance in the below code snippet we are using the “cmdAddNew” key to get the value for button “cmdAddNew”.

cmdAddNew.Text = objResourceManager.GetString("cmdAddNew");
?

(A) What precautions do we need to take while deploying satellite assemblies?


When we deploy the assembly, the folder structure has to very organized. Below table shows how the folder structure should be organized. Main Folder is the main application folder. All satellite assemblies should be deployed in the Main application folder with in there own respective folder. The respective folder is denoted by the culture code.
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.16: - Satellite Assembly folder structure


You can see from the above figure Hindi satellite assembly is deployed in hi folder, Greek satellite assembly is deployed in el folder and so on. If the program does not find resource file for a culture it uses the invariant culture satellite assembly. The above folder structure is a strict requirement when we deploy the satellite assembly. Any mismatch in the folder structure will lead to in appropriate results.
?

(A) Can we get a strongly typed resource class rather than using resource manager?


In the previous question, we had seen how resource manager class could be used to read the string from the resource file. However, there has been considerable improvement in VS.Net 2005 for resource support. You no more need to load using resource manager class. However, Microsoft has still kept it for backward compatibility. You can now get strongly types classes in your VS.NET intelligence as shown in the figure below.
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.17: - Strongly typed resource class


All belong to Resources namespace. Let us do a small sample and see how the strongly typed classes work in VS.NET 2005 and the simplicity, which they bring while implementing globalization in projects. Below is the screen shot of the project? It is a simple login screen with user id and password text boxes. User has options to select the language. Currently only two languages are provided English and Greek. Depending on the languages selected, the user id and password label values will be displayed.?
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.18: - Strongly typed project


Note: - In the globalization project you can get the project sample in “LoginScreenUsingStrongType.aspx”.


Below is the code snippet, which describes the various important divs of the code. First thing are the resource files. We have generated two resource files one for Greece with el and second is the general resource file which will be used when the regional code does not match.?
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.19: - Walkthrough for using the resources namespace


There are three important steps in the code:-

? First is set the culture information for the current thread with the new culture info object. Structure has the language code, which is currently selected in the drop down.
Thread.CurrentThread.CurrentCulture = new CultureInfo (structure);

? We set the same culture to the Resource class.
Resources.Resource.Culture = Thread.CurrentThread.CurrentCulture;

? Now we are all set to use the value.
lblUserId.Text = Resources.Resource.lblUserIdResource1.ToString ();

blPassword.Text = Resources.Resource.lblPasswordResource1.ToString ();

Note: - You can get the same from globalization folder in “LoginScreenUsingStrongType.aspx”. Try to add a new language and most of the fundamentals will be clear.


(A) Can you explain the fundamentals of “GetGlobalResourceObject” and “GetLocalResourceObject” functions?


These two functions belong to the Http Context object. Using it you can get the object reference of the resource object. For instance you can see from the below code snippet we have reference to the Global resource object and we are trying to get the value for “l(fā)blUserIdresource1” key.

lblUserId.Text=HttpContext.GetGlobalResourceObject("Resource", "lblUserIdResource1").To String();
Note :- In the same globalization folder there is “LoginScreenUsingGetGlobal.aspx” which demonstrates how “GetGlobalResource” works.


One short note because “GetGlobalResourceObject” and “GetLocalResourceObject” operate from with in current HttpContext.It uses what the regional settings are sent from the browser end.
?

(A) Can we sign a satellite assembly?


Yes you can sign the satellite assembly using the /key file switch which takes “.snk” file as the input parameter.

al /res:MyLanguage.resources /c:de /keyfile:MyLang.snk out:MyLanguages.resources.dll
?

(I) Can you explain collation sequence in sql server?


First, let us define collation.
Collation sequences are set of rules, which determine how the data is sorted and compared. Sorting rules can be defined with options with case-sensitivity, accent marks, kana character types, and character width.

Case sensitivity

If A and a, B and b, etc. are treated in the same way then it is case-insensitive. A computer treats A and a differently because it uses ASCII code to differentiate the input. The ASCII value of A is 65, while a is 97. The ASCII value of B is 66 and b is 98.

Accent sensitivity

If a and á, o and ó are treated in the same way, then it is accent-insensitive. A computer treats a and á differently because it uses ASCII code for differentiating the input. The ASCII value of a is 97 and áis 225. The ASCII value of o is 111 and ó is 243.
Kana Sensitivity
When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive.?

Width sensitivity

When a single-byte character (half-width) and the same character when represented as a double-byte character (full-width) are treated differently then it is width sensitive.
?

(A)How do we define collation sequence for database and tables?


You can create a database with language specific collation sequence. For instance in the below create statement tblCustomer is created by Latin language collation sequence.?

Create database tblCustomer collate Latin1_General_BIN

You can also create tables with particular collation sequence. Below is the create table syntax for the same.

Create table tblCustomer?
(
[CustomerCode] char(10) COLLATE Albanian_CI_AI_KS_WS NULL,
[EntryDate] [char] (8) COLLATE Korean_Wansung_Unicode_CS_AS_KS NOT NULL ,
[CustAbbrev] [char] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL?
)


(A)Can we change the order in a select query with a specified collation sequence?


Yes we can specify a collate sequence in the order by clause. That will change the sort according to the collation defined in the order by claused.


ORDER BY?
{
order_by_expression?
[ COLLATE collation_name ]?
[ ASC | DESC ]?
} [ ,...n ] ]


(A) Can you list best practices for globalization and localization?


Below are the best practices while developing international language support software:-
? Do not hardcode strings or user interface resources.
? Make sure your application depends on Unicode.
? Whenever you read or write data from various encoding make, sure you use the System. Text namespace. Many programmers assume ASCII data.
? While testing test it with actual international data and environments.
? Whenever we manipulate data, for instance numbers, dates or currency make sure that you are using culture-aware classes defined in System. Globalization namespace. Below is the table, which specifies in more detail about the functionality and the classes to be used to achieve the same.
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.20: - Functionality and classes used


? ????If a security decision is based on the result of a string comparison or case change operation, perform a culture-insensitive operation by explicitly specifying the CultureInfo.InvariantCulture property. This practice ensures that the result is not affected by the value of CultureInfo.CurrentCulture.?
? Move all your localizable resources to separate DLL’s.
? Avoid using images and icons that contain text in your application. They are expensive to localize.
? Allow plenty of room for the length of strings to expand in the user interface. In some languages, phrases can require 50-75 percent more space.
? Use the System.Resources.ResourceManager class to retrieve resources based on culture.
? Explicitly set the CurrentUICulture and Current Culture properties in your application. Do not rely on defaults.
? Be aware that you can specify the following three types of encodings in ASP.NET:?
? Request Encoding specifies the encoding received from the client's browser.
? Response Encoding specifies the encoding to send to the client browser. In most situations, this should be the same as request Encoding.
? File Encoding specifies the default encoding for .aspx, .asmx, and .asax file parsing.
?

(A) Why is the culture set to the current thread?


First, let me explain this question. If you look at the code snippet of how to set the culture info.

Thread.CurrentThread.CurrentCulture = new CultureInfo(strCulture);
It uses the current thread to set it. What does that mean? Let us drill down a bit, of how IIS handles request to understand this concept. When any user requests a resource from IIS like an ASPX page or any other resource. IIS services that request in his own thread. That means if 100 users have requested some resource from IIS he will serve every request in its own thread. In short, IIS will spawn 100 threads to service the 100 request. It is very much practically possible that you can have different locale in different threads. Therefore, when we set a culture we cannotset it for the whole application, as it will affect all the requests. So when we set a culture we set it to a particular thread rather to the whole application.


About the Author

Shivprasad?koirala


本站聲明
本文內(nèi)容由網(wǎng)友自發(fā)貢獻(xiàn),版權(quán)歸原作者所有,本站不承擔(dān)相應(yīng)法律責(zé)任。如您發(fā)現(xiàn)有涉嫌抄襲侵權(quán)的內(nèi)容,請(qǐng)聯(lián)系admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費(fèi)脫衣服圖片

Undresser.AI Undress

Undresser.AI Undress

人工智能驅(qū)動(dòng)的應(yīng)用程序,用于創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用于從照片中去除衣服的在線人工智能工具。

Clothoff.io

Clothoff.io

AI脫衣機(jī)

Video Face Swap

Video Face Swap

使用我們完全免費(fèi)的人工智能換臉工具輕松在任何視頻中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費(fèi)的代碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

功能強(qiáng)大的PHP集成開(kāi)發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺(jué)化網(wǎng)頁(yè)開(kāi)發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級(jí)代碼編輯軟件(SublimeText3)

熱門(mén)話題

解決kernel_security_check_failure藍(lán)屏的17種方法 解決kernel_security_check_failure藍(lán)屏的17種方法 Feb 12, 2024 pm 08:51 PM

Kernelsecuritycheckfailure(內(nèi)核檢查失?。┚褪且粋€(gè)比較常見(jiàn)的停止代碼類(lèi)型,可藍(lán)屏錯(cuò)誤出現(xiàn)不管是什么原因都讓很多的有用戶們十分的苦惱,下面就讓本站來(lái)為用戶們來(lái)仔細(xì)的介紹一下17種解決方法吧。kernel_security_check_failure藍(lán)屏的17種解決方法方法1:移除全部外部設(shè)備當(dāng)您使用的任何外部設(shè)備與您的Windows版本不兼容時(shí),則可能會(huì)發(fā)生Kernelsecuritycheckfailure藍(lán)屏錯(cuò)誤。為此,您需要在嘗試重新啟動(dòng)計(jì)算機(jī)之前拔下全部外部設(shè)備。

Win10如何卸載Skype for Business?電腦上的skype怎么徹底卸載方法 Win10如何卸載Skype for Business?電腦上的skype怎么徹底卸載方法 Feb 13, 2024 pm 12:30 PM

Win10skype可以卸載嗎是很多用戶們都想知道的一個(gè)問(wèn)題,因?yàn)楹芏嗟挠脩魝儼l(fā)現(xiàn)自己電腦上的默認(rèn)程序上有這個(gè)應(yīng)用,擔(dān)心刪除后會(huì)影響到系統(tǒng)的運(yùn)行,下面就讓本站來(lái)為用戶們來(lái)仔細(xì)的介紹一下Win10如何卸載SkypeforBusiness吧。Win10如何卸載SkypeforBusiness1、在電腦桌面點(diǎn)擊Windows圖標(biāo),再點(diǎn)擊設(shè)置圖標(biāo)進(jìn)入。2、點(diǎn)擊“應(yīng)用”。3、在搜索框中輸入“Skype”,點(diǎn)擊選中找到的結(jié)果。4、點(diǎn)擊“卸載”。5

JavaScript怎么用for求n的階乘 JavaScript怎么用for求n的階乘 Dec 08, 2021 pm 06:04 PM

用for求n階乘的方法:1、使用“for (var i=1;i

foreach和for循環(huán)的區(qū)別是什么 foreach和for循環(huán)的區(qū)別是什么 Jan 05, 2023 pm 04:26 PM

區(qū)別:1、for通過(guò)索引來(lái)循環(huán)遍歷每一個(gè)數(shù)據(jù)元素,而forEach通過(guò)JS底層程序來(lái)循環(huán)遍歷數(shù)組的數(shù)據(jù)元素;2、for可以通過(guò)break關(guān)鍵詞來(lái)終止循環(huán)的執(zhí)行,而forEach不可以;3、for可以通過(guò)控制循環(huán)變量的數(shù)值來(lái)控制循環(huán)的執(zhí)行,而forEach不行;4、for在循環(huán)外可以調(diào)用循環(huán)變量,而forEach在循環(huán)外不能調(diào)用循環(huán)變量;5、for的執(zhí)行效率要高于forEach。

如何避免JAVA中簡(jiǎn)單的for循環(huán)出現(xiàn)異常? 如何避免JAVA中簡(jiǎn)單的for循環(huán)出現(xiàn)異常? Apr 26, 2023 pm 12:58 PM

引言實(shí)際的業(yè)務(wù)項(xiàng)目開(kāi)發(fā)中,大家應(yīng)該對(duì)從給定的list中剔除不滿足條件的元素這個(gè)操作不陌生吧?很多同學(xué)可以立刻想出很多種實(shí)現(xiàn)的方式,但你想到的這些實(shí)現(xiàn)方式都是人畜無(wú)害的嗎?很多看似正常的操作其實(shí)背后是個(gè)陷阱,很多新手可能稍不留神就會(huì)掉入其中。倘若不幸踩中:代碼運(yùn)行時(shí)直接拋異常報(bào)錯(cuò),這個(gè)算是不幸中的萬(wàn)幸,至少可以及時(shí)發(fā)現(xiàn)并去解決代碼運(yùn)行不報(bào)錯(cuò),但是業(yè)務(wù)邏輯莫名其妙的出現(xiàn)各種奇怪問(wèn)題,這種就比較悲劇了,因?yàn)檫@個(gè)問(wèn)題稍不留神的話,可能就會(huì)給后續(xù)業(yè)務(wù)埋下隱患。那么,到底有哪些實(shí)現(xiàn)方式呢?哪些實(shí)現(xiàn)方式可能會(huì)

Python中的常見(jiàn)流程控制結(jié)構(gòu)有哪些? Python中的常見(jiàn)流程控制結(jié)構(gòu)有哪些? Jan 20, 2024 am 08:17 AM

Python中常見(jiàn)的流程控制結(jié)構(gòu)有哪幾種?在Python中,流程控制結(jié)構(gòu)是用來(lái)決定程序的執(zhí)行順序的重要工具。它們?cè)试S我們根據(jù)不同的條件執(zhí)行不同的代碼塊,或者重復(fù)執(zhí)行一段代碼。下面將介紹Python中常見(jiàn)的流程控制結(jié)構(gòu),并提供相應(yīng)的代碼示例。條件語(yǔ)句(if-else):條件語(yǔ)句允許我們根據(jù)不同的條件執(zhí)行不同的代碼塊。它的基本語(yǔ)法是:if條件1:#當(dāng)條件

6個(gè)實(shí)例,8段代碼,詳解 Python 中的 For 循環(huán) 6個(gè)實(shí)例,8段代碼,詳解 Python 中的 For 循環(huán) Apr 11, 2023 pm 07:43 PM

Python 支持for循環(huán),它的語(yǔ)法與其他語(yǔ)言(如JavaScript 或Java)稍有不同。下面的代碼塊演示如何在Python中使用for循環(huán)來(lái)遍歷列表中的元素:上述的代碼段是將三個(gè)字母分行打印的。你可以通過(guò)在print語(yǔ)句的后面添加逗號(hào)“,”將輸出限制在同一行顯示(如果指定打印的字符很多,則會(huì)“換行”),代碼如下所示:當(dāng)你希望通過(guò)一行而不是多行顯示文本中的內(nèi)容時(shí),可以使用上述形式的代碼。Python還提供了內(nèi)置

如何使用PHP開(kāi)發(fā)CMS中的FAQ和留言板模塊 如何使用PHP開(kāi)發(fā)CMS中的FAQ和留言板模塊 Jun 21, 2023 am 11:10 AM

隨著網(wǎng)站的逐漸發(fā)展,越來(lái)越多的企業(yè)和組織開(kāi)始將網(wǎng)站作為推廣和服務(wù)的重要途徑,而在網(wǎng)站中,F(xiàn)AQ(常見(jiàn)問(wèn)題)和留言板等模塊也成為了日常運(yùn)營(yíng)的必備模塊。本文將介紹如何使用PHP開(kāi)發(fā)CMS中的FAQ和留言板模塊。一、FAQ模塊數(shù)據(jù)庫(kù)設(shè)計(jì)FAQ模塊主要分為兩個(gè)部分:?jiǎn)栴}列表和答案列表。在數(shù)據(jù)庫(kù)中,我們需要分別創(chuàng)建問(wèn)題表和答案表,以及問(wèn)題和答案之間的關(guān)聯(lián)表。問(wèn)題表結(jié)構(gòu)

See all articles