Okay, I'm stuck. I have been trying to load a file with a serialized string from Aura's save feature and get into an object to work with it.
The file looks like this:
PkgState {timeOf = SimpleTime {yearOf = 2013, monthOf = February, dayOf = 13, hourOf = 15, minuteOf = 38}, pkgsOf = fromList [("a52dec",[0,7,4,6]),("aalib",[1,4,5,9]),("abs",[2,4,4,1]),("acl",[2,2,51,3]),("acsccid",[1,0,4,1]),("alsa-lib",[1,0,26,1]),("alsa-oss",[1,0,25,1]),("alsa-plugins",[1,0,26,1]),("alsa-utils",[1,0,26,1]),("alsaequal",[0,6,7]),("android-sdk-platform-tools",[16,0,1,2]),("android-udev",[1,6,1]),("anki-beta",[2,0,7,1]),("apache",[2,2,23,1]),("apr",[1,4,6,1]),("apr-util",[1,5,1,1]),("archey",[20121216,1]),("archlinux-keyring",[20130127,1]),("archlinux-themes-slim",[1,2,3]),("aria2",[1,16,3,1]),("asciidoc",[8,6,8,1]),("aspell",[0,60,6,1,1]),("aspell-en",[7,1,2]),("at-spi2-atk",[2,6,2,1]),("at-spi2-core",[2,6,3,1]),("atk",[2,6,0,1]),("attr",[2,4,46,2]),("aura",[1,1,3,0,1]),("autoconf",[2,69,1]),("autofs",[5,0,7,1]),("automake",[1,13,1,1]),("avahi",[0,6,31,5]),("babl",[0,1,10,1]),("bash",[4,2,42,3]),("bc",[1,6,8]),("beecrypt",[4,2,1,5]),("binutils",[2,23,1,3]),("bison",[2,7,1]),("blueman",[1,23,5]),("bluez",[4,101,1]),("bridge-utils",[1,5,1]),("bzip2",[1,0,6,4]),("c-ares",[1,9,1,1]),("ca-certificates",[20130119,1]),("ca-certificates-java",[20120608,1]),("cackey",[0,6,8,1]),("cairo",[1,12,12,2]),("cairo-perl",[1,82,2]),("caps",[0,9,6,1]),("cdparanoia",[10,2,4]),("cdrdao",[1,2,3,6]),("cdrkit",[1,1,11,2]),("chromium",[24,0,1312,70,1]),("chromium-pepper-flash",[11,6,602,167,1]),("cifs-utils",[5,9,1]),("cloog",[0,18,0,1])}
This has been cut down. I can parse it out manually (which would more then likely a pain). Is there some directly to start with this and get an object?
Or since Aura was written in haskell should I just use haskell?
Source: (StackOverflow)
I'm new to backbone and I'm trying to send and receive data from the server in Json format. It just won't work. Here's my code (BTW, I'm using backbone aura):
Collection
define(['sandbox', '../models/message'], function(sandbox, Message) {
'use strict';
var Messages = sandbox.mvc.Collection({
model: Message,
url: '/messagelist.php',
localStorage: new sandbox.data.Store('messages-backbone-require'),
parse: function(response){
return response.rows;
}
});
return Messages;
});
Model
define(['sandbox'], function(sandbox) {
'use strict';
var Message = sandbox.mvc.Model({
defaults: {
opened: '',
messageid: '',
phonenumber: '',
numbername: '',
text: ''
},
parse: function(data){
return data;
}
});
return Message;
});
View
define(['sandbox', '../models/message', 'text!../templates/incoming_messages.html'], function(sandbox, Message, incomingMessagesTemplate) {
'use strict';
var AppView = sandbox.mvc.View({
widgetTemplate: sandbox.template.parse(incomingMessagesTemplate),
events: {
'click .refresh': 'refresh'
},
initialize: function() {
this.$el.html(this.widgetTemplate);
sandbox.events.bindAll(this);
this.collection.bind('createMessageList', this.createMessageList);
},
createMessageList: function() {
// Will work with the received data here
},
render: function() {
var handle = 'h4';
this.$el.draggable({handle: handle});
this.createMessageList();
},
refresh: function() {
this.createMessageList();
}
});
return AppView;
});
Main
define(['sandbox', './views/app', './collections/messages'], function(sandbox, AppView, Messages) {
'use strict';
return function(options) {
var messages = new Messages();
new AppView({
el: sandbox.dom.find(options.element),
collection: messages
}).render();
messages.fetch({
data: {
type: 'incoming',
offset: 0,
offsetcount: 25
},
type: 'GET',
success: function() {
console.log(messages.models); // Shows an empty array.
}
});
};
});
I've check logs and it seems that the ajax request (collection.fetch()) is not firing or is not able to communicate with the server. How can I fix this?
Source: (StackOverflow)