chrisglasier
04-02-2010, 01:39 PM
I have a PC and have made an application that uses Json via Ruby File class for its data. The app works fine on PC's but not on Mac's. Does anyone have any experience tracking down the cause of such incompatibility?
Thanks
chrisglasier
04-03-2010, 01:51 AM
Having substituted the Json stuff with arrays the app now works on both. This is not a solution but a start on pinpointing the problem. Btw the Json stuff has been validated.
A1ien51
04-05-2010, 02:08 AM
If you showed code, it would be easier for us to spot problems.
Eric
chrisglasier
04-05-2010, 02:25 AM
Thanks but the code is very big and complex. It works just fine on a PC, but my colleague on a Mac cannot get it to work, although he has got similiar code going, we still cannot find any trend and wondered if anyone could give us some tips where to look.
Here are two examples of Json.
config
{"animate":200,"cellheight":20,"columns":5,"folder":"Components","header":"Animated","height":268,"left":629,"menucolumns":2,"menutrail":[["0",40],["3",40]],"nametrail":[["Backstop",0],["Start",0],["Work",0],["Projects",20,null]],"stripetop":103,"top":266,"width":380,"colwidth":62.4,"devicetrail":[],"select":["Single"]}
nameset
{"Backstop":{"Type":"Backstop","Genus":"Backstop","Name":"Backstop","Forelink":["Start"]},"Start":{"Type":"Grouping","Genus":"Start","Name":"Start","Backlink":["Backstop"],"Forelink":["Work"]},"Work":{"Type":"Grouping","Genus":"Work","Name":"Work","Backlink":["Start"],"Forelink":["Projects"]},"Projects":{"Type":"Grouping","Genus":"Projects","Name":"Projects","Backlink":["Work"]}}
The app is a plugin for Sketchup, so the files are read by Ruby and then passed to a webdialog where Javascript takes over.
Any pointers gratefully received!
chrisglasier
04-06-2010, 01:06 AM
I think the problem maybe something to do with this:
function rubyStart(){
window.location = "skp:send@"+0;
}
function rubyReceive(ret) {
ret = ret.split("qq");
nr = parseInt(ret[0]);
json = ret[1];
switch(nr){
case 0 : config = JSON.parse(json); break;
case 1 : nset = JSON.parse(json); break;
case 2 : mset = JSON.parse(json); break;
case 3 : words = JSON.parse(json); break;
case 4 : numbers = JSON.parse(json); break;
case 5 : help = JSON.parse(json); break;
}
nr += 1
if(nr < 6){
window.location = "skp:send@"+nr;
}
else{
.... generates display
"skp:send" calls a ruby callback that reads the file (e.g config.json) and sends it and the number back. (Ruby has an array of file names)
I used to do this in one hit with an array but changed it to ping pong as I remember some differences of synchronousness. But it still doesn't work.
All works just fine on a PC and the ruby transfers appear to work fine on both.
I think what I describe is at the root of the incompatibility, but I'm not sure. I am hoping it will jog some memories of something similar happening to members here.
Thanks
JSON has nothing to do with the Operating System. You should rather tell us which browsers do you use on PC and on MAC.
chrisglasier
04-08-2010, 12:27 PM
Thanks for the reply.
Sketchup web dialogs use IE on PCs and Safari on Macs. No choice.
Could be a problem of the application for Safari, then. It looks like the parser does not work in safari. Hard to say why, without seeing the codes... Have you tried installing Firefox on Mac and test the application?
chrisglasier
04-08-2010, 12:43 PM
Yes my colleague in London is the one with Macs; I will ask him to comment directly
Thanks
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.