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.

Lua: Why changing value on one variable changes value on an other one too? -


i think running code excactly mean. want register 5 names register(people). loop 5 times , in each loop have variable newperson supposed save information person , added people register. in example names of people being registered simplicity. problem in end people turn have same name: "petra". playied bit can't reasonable reason behaviour. appreciated!

local people={} local person={     name="johan",     lastname="seferidis",     class="b" } local names={"markus", "eva", "nikol", "adam", "petra"} --people register   i=1, 5 --register 5 people     local newperson=person     local name=names[i]     field=1, 3 --for each field(name, lastname, class)         if field==1 newperson["name"]=name end --register name     end     people[i]=newperson end  print("first person name: " ..people[1]["name"]) print("second person name: "..people[2]["name"]) print("third person name: " ..people[3]["name"]) 

the big thing @ hand here lua variables "containing" table in fact contain reference table. copying variables containing tables copy the reference table, , represent same table in example:

a={"x","y","z"} b=a b[2]="q" print(a[2]) -- returns q , not y. why seen doing: print(a,b) -- returns table: 0xxxxxxx 0xxxxxxx indicating it's same table 

if want copy of table, you'll need resort http://lua-users.org/wiki/copytable


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 -