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.

iphone - Intermittent JSON parser failure for unescaped control character -


functionality in iphone app searches twitter text. code straightforward, pass url string twitter api, , parse result. although half time json parser fails errors unescaped control character '0x0'. code , full error message below.

    - (void)grabdata:(nsstring *)searchterm {      nsstring *urlstring = [nsstring stringwithformat:@"http://search.twitter.com/search.json?q=%@&rpp=25",searchterm];       nsurl *url = [nsurl urlwithstring:urlstring];       nslog(@"created url:%@",url);       //setup , start async download      nsurlrequest *request = [[nsurlrequest alloc] initwithurl:url];      nsurlconnection *connection = [[nsurlconnection alloc] initwithrequest:request delegate:self];      [connection release];      [request release];     }      - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data {       // store incoming data string      nsstring *jsonstring = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding];       //nslog(@"did receive data %@",jsonstring);       //create dictionary json string      nsdictionary *results = [jsonstring jsonvalue];       // build array dictionary easy access each entry      nsdictionary *tweets = [results objectforkey:@"results"];              // loop through each entry in dictionary     for(nsdictionary *tweet in tweets) {      // user string tweet      nsstring *tuser = [tweet objectforkey:@"from_user"];            nslog(@"tweet %@",tuser);           }      } 

error message console, 50% of time, other 50% works expected.

2010-12-20 21:22:02.022 twittersearch[47362:207] created url:http://search.twitter.com/search.json?q=red&rpp=25 2010-12-20 21:22:02.361 twittersearch[47362:207] -jsonvalue failed. error trace is: (     "error domain=org.brautaset.json.errordomain code=5 \"unescaped control character '0x0'\" userinfo=0x4d6a130 {nslocalizeddescription=unescaped control character '0x0'}",     "error domain=org.brautaset.json.errordomain code=3 \"object value expected key: profile_image_url\" userinfo=0x4d6a200 {nsunderlyingerror=0x4d6a170 \"unescaped control character '0x0'\", nslocalizeddescription=object value expected key: profile_image_url}",     "error domain=org.brautaset.json.errordomain code=3 \"expected value while parsing array\" userinfo=0x4d6a240 {nsunderlyingerror=0x4d6a1e0 \"object value expected key: profile_image_url\", nslocalizeddescription=expected value while parsing array}",     "error domain=org.brautaset.json.errordomain code=3 \"object value expected key: results\" userinfo=0x4d6a310 {nsunderlyingerror=0x4d6a2d0 \"expected value while parsing array\", nslocalizeddescription=object value expected key: results}" ) 

the didreceivedata method can called multiple times data delivered. in method, should append each incoming chunk nsmutabledata class variable (not process it).

the processing of complete data should done in connectiondidfinishloading method.

the error happening because trying parse partial block of data.


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 -