Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

internationalization - Performance of Java enums -


i thinking using enum type manage i18n in java game i'm developing curious performance issues can occur when working enums have lots of elements (thousands think).

actually i'm trying like:

public enum text {   string1,   string2,   string3;    public string text() {     return text;   }    public string settext() {     this.text = text;   } } 

then load them can fill fields:

static {   text.string1.settext("my localized string1");    text.string2.settext("my localized string2");    text.string3.settext("my localized string3");  } 

of course when i'll have manage many languages i'll load them file.

what i'm asking is

  • is obect allocated (in addition string) every element? (i guess yes, since enums implemented objects)
  • how right element retrieved enum? static @ compile time? (i mean when somewhere use text.string1.text()). should constant complexity or maybe replaced during compiling phase..
  • in general, approach or should forward else?

thanks

found , adapted nice mix of enums , resourcebundle:

public enum text {   yell, swear, beg, greet /* , more */ ;    /** resources default locale */   private static final resourcebundle res =     resourcebundle.getbundle("com.example.messages");    /** @return locale-dependent message */   public string tostring() {     return res.getstring(name() + ".string");   } } 

# file com/example/messages.properties # default language (english) resources yell.string=hey! swear.string=§$%& beg.string=pleeeeeease! greet.string=hello player! 

# file com/example/messages_de.properties # german language resources yell.string=hey! swear.string=%&$§ beg.string=biiiiiitte! greet.string=hallo spieler! 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -