My drupal developer given a url like:http://feed.local/feed/services/rest/viewget/test.json
then am getting the out put as(when am browsing from chrome browser) below:
[{"nid":"133","node_title":"What is life really all about?"},{"nid":"139","node_title":"What went wrong?"}]
I am using sumitk tutorial that is how to develop iphone app using drupal as base system with titanium.
My problem is how can i parse the above in titanium .Can any one help.....
Or else If any one help me how can i use this in xcode........
You can use Titanium.JSON.parse
JSON.parse will help you, it is a function included by Titanium. Make sure you encapsulate it within a try {} catch(excp) {}
For example:
try
{
var data = JSON.parse('[{"nid":"133","node_title":"What is life really all about?"},{"nid":"139","node_title":"What went wrong?"}]');
}
catch (excp)
{
alert('JSON parse error');
}
Related
I am trying to load an mp3 files (according to the examples) but I am getting
Unable to load bg.mp3.
The request status was: 0 ()
The error stack trace includes: loadSound
I have referenced my problem to this Github issue https://github.com/processing/p5.js-sound/issues/141 but I am unable to find a solution.
Also, I am using Brackets editor which starts a local server and opens a new Chrome instance.
let mySound;
function preload() {
soundFormats('mp3', 'ogg');
mySound = loadSound("bg.mp3");
}
function setup(){
createCanvas(displayWidth,displayHeight);
mySound.setVolume(0.1);
mySound.play();
}
Strange, the Sound: Load and Play Sound example seems to work fine.
The error seems to point to on an XHR load error, but it's unclear why.
It's worth trying the full version of loadSound() including the error callback:loadSound(path, [successCallback], [errorCallback], [whileLoading]).
Hopefully the errorCallback details will help solve the problem
e.g.
let mySound;
function onSoundLoadSuccess(e){
console.log("load sound success",e);
}
function onSoundLoadError(e){
console.log("load sound error",e);
}
function onSoundLoadProgress(e){
console.log("load sound progress",e);
}
function preload() {
soundFormats('mp3', 'ogg');
mySound = loadSound("bg.mp3",onSoundLoadSuccess,onSoundLoadError,onSoundLoadProgress);
}
function setup(){
createCanvas(displayWidth,displayHeight);
mySound.setVolume(0.1);
mySound.play();
}
Also try to navigate to the web server Brackets launches and access the file manually.
(e.g. http://localhost:BRACKETS_HTTP_PORT_HERE/bg.mp3). If everything is ok (bg.mp3 is in the same folder as the index.html file), your browser should load and display the default audio playback controls.
It's worth noting there are many other http servers you could try, here a few examples:
if you're on OSX you can use Python's HTTP Server (python -m SimpleHTTPServer in python 2 or python -m http.server)
if you use node.js there' an http-server module (e.g. npm install http-server then http-server in your project folder)
Apache variants (depending on OS, MAMP/WAMP/XAMPP, etc.), though might be overkill
The quick fix for anyone having this issue is to use a Local web server. (mamp/xamp/local etc). Then reference it in the preload/setup
sound = loadSound('http://localhost/audio.mp3', loaded);
The documentation does state -
you will need the p5.sound library and a running local server
It looks like Vuepress is made for public docs, but we decided to add client and server security to protect some of the doc pages. But unfortunately although oidc-client (https://github.com/IdentityModel/oidc-client-js/wiki) works during dev, it throws exception when build.
I get ReferenceError: window is not defined and when I try to trick the compiler with const window = window || { location: {} }; I get TypeError: Cannot read property 'getItem' of undefined
Any idea how to make this work?
This was driving me nuts also. I discovered the component I was trying to add was looking at window.location in its code - this was triggering the error.
My understanding is that the build process has not access to Browser things like window etc.
As soon as I removed the window.location bit from my code things built just fine and all is well.
I am new in visualforce apex development, and I am trying to update object of salesforce but its throwing error: "Refused to set unsafe header "User-Agent"".
Please help me out.
I am trying the below code:
function updateAccounts(terrId,accId){
var acc=[];
var contact = new sforce.SObject("ObjectTerritory2Association");
contact.objectid = accId;
contact.territory2id = terrId;
acc.push(contact);
sforce.connection.sessionId = "{!$Api.Session_ID}";
if(terrId!="")
sforce.connection.update(acc);
else
sforce.connection.delete(acc);
}
</script>
Thank you.
I remember running into this problem. I don't remember the exact reason it was happening - something about being a Community User vs. a Salesforce user.
I recommend using JavaScript Remoting instead.
I am trying to get all running applications that have window interface, and I find the application list from the Force Quit Application Utility is pretty ideal.
But I don't know how to implement it, have tried NSWorkSpace, which gives me all the running app including a lot others.
So how to archive this function? Thanks for your help!!
I decide to use NSWorkspace.runningApplications still, but filter the results using Bundle URL field and ownsMenuBar with some pre-defined rules.
Little busy these days, but I will post my result after try as soon as possible. Here is a useful sample app: https://developer.apple.com/library/mac/samplecode/AppList/
Thanks, sayen, this worked great for me.
Here's the Swift code I used to force-quit After Effects:
let runningApps = NSWorkspace.sharedWorkspace().runningApplications
if let aeApp = runningApps.filter( { ($0.bundleIdentifier != nil) && ($0.bundleIdentifier! == "com.adobe.AfterEffects") }).first {
aeApp.forceTerminate()
}
Note that in Swift, the bundle identifier is an optional.
I use the datastore of parse.com to manage the data of my apps. I use javascript by the way. I establish my connection like this:
Parse.initialize("KRCjl8ZEgNIERgXcbhbh6kfsdeXReWfA9phOY1Ql","v5uW61qzYboq64zleielyi9876sx8se");
// A Collection containing all instances of category objects.
var categoryObject = Parse.Object.extend("categories");
var CategoryCollection = Parse.Collection.extend({
model: categoryObject
});
var collection = new CategoryCollection();
collection.fetch({
success: function(categoryList) {
alert("ok");
},
error: function(collection, error) {
for(item in error) {
alert(item +" = "+ error[item]);
}
}
});
The thing is that it worked yesterday, now when I browse to www.parse.com, it says that the certificate has expired. I think it has something to do with this issue.
Can anyone tell me please what I could do now.
Thanks,
enne
We had an SSL issue this morning that caused downtime. You can read our post-mortem here: http://blog.parse.com/2012/09/10/summary-of-the-september-10-parse-service-disruption/.
The issue was resolved this morning at 8:42am and everything should be working fine now.
If you have any other issues with Parse, feel free to check out parse.com/help
If you hit parse.com, you'll get an expired SSL cert error. That's why the API calls aren't working, same thing happening for my app. I can't imagine this happening in a professional context, but there it is. I've sent a message to support. Strangely, my tweet didn't show up on #ParseIt.
Same thing is happening for me. I don't think is your code - probably a problem on their site. Hopefully it'll get resolved soon.
Parse.com is still a buggy system but you can access your data through web interface like
https://www.parse.com/apps/ispect/collections#class/
Mention you and can access to your data.