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.

python - sequence/stack diagam for recursive function -


for code below:

def printlist(l):     if l:         print l[0]         printlist(l[1:]) 

i can have sequence diagram this:

# non python pseudo code  printlist([1,2,3])    prints [1,2,3][0] => 1    runs printlist([1,2,3][1:]) => printlist([2,3])    => we're in printlist([2,3])          prints [2,3][0] => 2          runs printlist([2,3][1:]) => printlist([3])      => in printlist([3])            prints [3][0] => 3            runs printlist([3][1:]) => printlist([])            => in printlist([])                  "if l" false empty list, return none      => in printlist([3])            reaches end of function , returns none    => in printlist([2,3])      reaches end of function , returns none  => in printlist([1,2,3])    reaches end of function , returns none 

so question if change code to:

def printlist(l):     if l:        print l[0]        printlist(l[1:])        print l[0] 

how sequence diagram change, want understand happens during execution of code.

the print statement called after recursive calls hit "on way up". is, each of statements: "it reaches end of function , returns none" can changed "it prints current value of l[0], reaches end of function, , returns none", 3, 2, , 1 respectively.

like so:

printlist([1,2,3]) prints [1,2,3][0] => 1 runs printlist([1,2,3][1:]) => printlist([2,3]) => we're in printlist([2,3])     prints [2,3][0] => 2     runs printlist([2,3][1:]) => printlist([3])     => in printlist([3])         prints [3][0] => 3         runs printlist([3][1:]) => printlist([])         => in printlist([])             "if l" false empty list, return none         => in printlist([3])         prints [3][0] => 3         reaches end of function , returns none     => in printlist([2,3])    prints [2,3][0] => 2    reaches end of function , returns none => in printlist([1,2,3]) prints [1,2,3][0] => 1 reaches end of function , returns none 

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 -