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.

javascript - how to stop recursion and/or restart the current function with updated variables -


i've got 2 arrays updating , each other based on criteria (it way longer describe suspect solution is).

what end function calls within while loop. can imagine, causes ridiculous amount of recursion.

here's example (keeping short)

 var buildarray=firstfunction(new array(), existingarray)  function firstfunction(thisarray, existingarray){      for(test1=0; test1<existingarray.length; test1++){          if(existingarray[test1][3]=='2'){            secondfunction(thisarray, existingarray, test1);         }      }  function secondfunction(thisarray, existingarray, t1){        for(test2=0; test2<thisarray.length; test2++){           if(thisarray[test1]<=existingarray[test2][1] || thisarray[test1]>existingarray[test2[0]){             // bunch of stuff existingarray, existingarray has changed, whole process needs start again beginning!!!      return firstfunction(new array(), existingarray);                // check value isn't in 'thisarray'    var check= new array(existingarray[test1]);   else if (jquery.inarray(check, thisarray==-1){          // value isn't in new array, add         thisarray.push(check);        // thisarray has changed. need restart the second function        secondfunction(thisarray,existingarray);      }     }  }  } } 

i hoping

return secondfunction(thisarray, existingarray); 

would reset , restart function, apparently isn't happening.

is there way stop current function , loops , restart updated variables?

i not trying yo do, based on fact return stop execution in secondfunction, , thisarray never changed, can add loop firstfunction:

function firstfunction(thisarray, existingarray){     var restart = true;     while(restart)     {         restart = false;          for(test1=0; !restart && test1<existingarray.length; test1++){              if(existingarray[test1][3]=='2'){                if(secondfunction(thisarray, existingarray, test1))                {                 restart = true;                }             }          }     } 

and in secondfunction instead of returning array return true:

  if(thisarray[test1]<=existingarray[test2][1] || thisarray[test1]>existingarray[test2[0]){     // bunch of stuff existingarray, existingarray has changed, whole process needs start again beginning!!!  return true; 

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 -