Archive for January 13th, 2013
“Origin null is not allowed by Access-Control-Allow-Origin” was the error I was getting when looking at a local html/JS powered page on my desktop, and I tried to do a getJSON request in jQuery.
It’s a well known problem – but also quite annoying, mainly because the fixes were generally of the form “change your endpoint to have a callback”, or “modify your code so it does X, even though that means you have to change Y and Z too”.
So I looked around, and was about to default back to my old plan of dumping everything into an array when I realised that because my JSON is constant, I can just have it as an excessively long string, and use parseJSON to parse it.
And so I ended up with something like this:
data.js consisted solely of
And my main file had
But it worked. And with only an extra line (the extra script/data.js line – possibly even a net drop since I got rid of the success function), I’m calling it a success.
Then again, it’s 12:30 in the morning after the facebook hackathon (which was pretty awesome, even if MathJax broke during my demo because I forgot to include the $ signs for inline math).
Also, JSONLint is my new favorite utility – not only does it validate your JSON, but it also pretty-print formats the long string into a form that looks a lot nicer to save.
As part of the Blackberry Playbook promo, I have to publish an app on the BlackBerry App World store.
Ripple was somewhat easy to get up and running. Except for the fact that it didn’t like the launch on Playbook option – it was checking some variable that wasn’t set, so it ended up trying to push C:\path\to\bar\file\undefinedfile.bar. It really concat-ed the term ‘undefined’ into the file path.
So I had to manually install it using the blackberry deploy tool. BlackBerry has a dedicated page, but in short:
PS C:\Program Files\Research In Motion\BlackBerry WebWorks SDK for TabletOS 184.108.40.206\bbwp\blackberry-tablet-sdk\bin> .\blackberry-deploy -installApp -password password -device ip.address.of.playbook C:\path\to\bar\file
Another interesting/odd thing is that I had to sign the app to get it to install on the Playbook. Simply packaging it wasn’t enough – it rejected it with a “app author doesn’t match debug token author” error. (And the other interesting thing I found out was that it appears to upload your app to the BlackBerry servers to get signed. At least, when my connection dropped out for a bit, I got a “www.rim.com” error.)