Discussion Forums  >  Uncategorized

Replies: 7    Views: 936

peter
I hate code!
Profile
Posts: 95
Reg: Jan 21, 2011
netherlands
1,250
05/16/11 06:16 AM (14 years ago)

Quiz from Data URL parsing error

Keep getting the paring error (make sure that is it well-formed) and it's driving me crazy. I just made a Quiz screen and entered a Data URL pointing to a txt file. To be sure I am not messing up by using a wrong txt file I copied the sample file (this is how the text file will look like) in my texteditor (on Mac, or Notepad on Win) and placed it on the web. Error message still there. Console output reports a Trailing comma error, but that seems to be not the case. Two questions: 1) does anybody has any idea what is wrong here? 2) can somebody provide a dynamic php script as mentioned in the help PDF file (http://www.mysite.com/quizquestions.php), which should give me the guarantee that the output is well formatted. Thanks ! (BT v1.5, error on iPad device and in Simulator) Console output: 2011-05-16 14:59:33.295 cissp[2077:207] BT_downloader: downloadFile: http://cissp.opinternet.info/quiz/quiz1.txt 2011-05-16 14:59:33.296 cissp[2077:207] BT_screen_quiz: downloadFileStarted: starting download... 2011-05-16 14:59:33.394 cissp[2077:207] BT_screen_quiz: downloadFileInProgress: 100% 2011-05-16 14:59:33.394 cissp[2077:207] BT_fileManager: saveTextFileToCacheWithEncoding: screenData_0ACCFFCE9130E9619256255.txt encodingFlag: -1 2011-05-16 14:59:33.401 cissp[2077:207] BT_screen_quiz: downloadFileCompleted: Success 2011-05-16 14:59:33.401 cissp[2077:207] BT_screen_quiz: hideProgress 2011-05-16 14:59:33.401 cissp[2077:207] BT_fileManager: File does exist in cached directory: screenData_0ACCFFCE9130E9619256255.txt 2011-05-16 14:59:33.401 cissp[2077:207] BT_screen_quiz: parsing downloaded screen data. 2011-05-16 14:59:33.402 cissp[2077:207] BT_fileManager: readTextFileFromCacheWithEncoding: screenData_0ACCFFCE9130E9619256255.txt encoding: -1 2011-05-16 14:59:33.402 cissp[2077:207] BT_screen_quiz: parseScreenData 2011-05-16 14:59:33.402 cissp[2077:207] BT_screen_quiz: ERROR parsing JSON: ( Error Domain=org.brautaset.JSON.ErrorDomain Code=9 \Trailing comma disallowed in object\ UserInfo=0x7985980 {NSLocalizedDescription=Trailing comma disallowed in object}, Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \Expected value while parsing array\ UserInfo=0x7985a10 {NSUnderlyingError=0x79859d0 \Trailing comma disallowed in object\, NSLocalizedDescription=Expected value while parsing array}, Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \Object value expected for key: childItems\ UserInfo=0x7985a80 {NSUnderlyingError=0x7985a40 \Expected value while parsing array\, NSLocalizedDescription=Object value expected for key: childItems} )
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/16/11 09:14 AM (14 years ago)
Post the URL to your question bank, gonna be something simple.
 
peter
I hate code!
Profile
Posts: 95
Reg: Jan 21, 2011
netherlands
1,250
like
05/16/11 09:24 AM (14 years ago)
David, http://cissp.opinternet.info/quiz/quiz1.txt (see the console output :-)) Thanks !
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/16/11 09:46 AM (14 years ago)
I see. Looks like the sample is hosed! Funny. Just updated this file: http://www.buzztouch.com/applicationScreens/samplequestions.txt The problem was the comma trailing the last image element. Look closely and you'll see NO comma after the imageURLLargeDevice value. There are many cases where this would have worked but in most cases it would have errored (like in your case). No sense in going into a full-blow JSON tutorial but the idea is that you should not have a comma after the last element of an object (each question is an object). Use that, see if it works, probably will. IMPORTANT: Be sure to use the refresh button on the app's screen in the simulator so you are not trying to read the previous quiz data (the broken data).
 
peter
I hate code!
Profile
Posts: 95
Reg: Jan 21, 2011
netherlands
1,250
like
05/16/11 10:39 AM (14 years ago)
phew bad luck, I used the sample file to be safe, and now the sample file was causing the problem :-) Thanks for your support. If you have a spare moment, please look at my other question posted last week about RSS list and disappearing entries. I have nudged it a phew days ago, and will do again in a second (makes is easier to find)
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/16/11 12:45 PM (14 years ago)
Does this mean the Console is showing the same error as before, about the commas? If it is, the app is still reading the older file. In this case, it's probably still reading the previous quiz data it downloaded and saved on the simulators cache. Not sure how else to advise. RSS: Looked at this a bunch over the weekend.... can't seem to duplicate the problem yet. Sit tight on this mysterious thing (you're the only one that has ever mentioned it so it's going to be something strange too). You focus on getting your quiz dataURL working, we'll focus on the RSS icon thing.
 
peter
I hate code!
Profile
Posts: 95
Reg: Jan 21, 2011
netherlands
1,250
like
05/16/11 01:23 PM (14 years ago)
David, I think you misunderstood my previous post. The -bad luck- quote was addressed to myself. Bad luck for testing with a sample quiz which was incorrect. Nevermind, it's obvious english is not my native language :-) The data url is working now. The comma's are all in the right places and there were still some CRLF characters in the middle of an answertext files. It is hard to get the special characters all gone. So Quiz problem solved! By the way, is there an option to change the fontsize of the Questions (the questions are to long), and possibly change the size of the Answer buttons (some answers doesn't fit)? RSS: hope you can reproduce the RSS thing. I guess when downloading my code you should have the same behaviour. Anyway, goodluck...
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/16/11 10:28 PM (14 years ago)
Glad quizzes work. We just added Font size adjustments in the control panel for Questions and Answers (good idea!). You do not need to recompile to use these adjustments, the iOS software already allows adjusting sizes, the control panel didn't have the controls to do it. RSS thing, I found a possible reason early, no concrete solution yet. And, still havn't seen the behavior.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.