misoproject/dataset

url option doesn't work on fetch

merrittholmes opened this issue · 3 comments

When using Cloud9 IDE I get the following error when trying to use the url example on quickstart in a node.js server listening:

TypeError: undefined is not a function
at Object._xhrSetup.xhr (/var/lib/stickshift/5ddc9e2f362649b9988fccacda5341cc/app-root/data/365215/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2258:95)
at Function.Dataset.Xhr (/var/lib/stickshift/5ddc9e2f362649b9988fccacda5341cc/app-root/data/365215/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2286:32)
at _.extend.fetch (/var/lib/stickshift/5ddc9e2f362649b9988fccacda5341cc/app-root/data/365215/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2242:15)
at _.extend.fetch (/var/lib/stickshift/5ddc9e2f362649b9988fccacda5341cc/app-root/data/365215/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:1029:21)
at IncomingMessage. (/var/lib/stickshift/5ddc9e2f362649b9988fccacda5341cc/app-root/data/365215/main.js:18:12)
at IncomingMessage.EventEmitter.emit (events.js:85:17)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete as onMessageComplete
at Socket.socket.ondata (http.js:1690:22)
at TCP.onread (net.js:403:27)

This is my code:

// Include http module.
var http = require("http");
var Miso = require("miso.dataset");
var port = process.env.PORT;
var ip = process.env.IP;
var data = [
{ color : "red", r : 255, g : 0, b : 0 },
{ color : "blue", r : 0, g : 0, b : 255 },
{ color : "green", r : 0, g : 255, b : 0 }
];
http.createServer(function (request, response) {
request.on("end", function () {
var ds = new Miso.Dataset({
url : 'http://subsidyscope.com/bailout/tarp/csv/',
delimiter : ','
});
ds.fetch({
success : function() {
//console.log("Available Columns:" + this.columnNames());
//console.log("There are " + this.length + " rows");
},
error : function(){
console.log(data.length());
}
});
response.writeHead(200, {
'Content-Type': 'text/plain'
});
response.end("Available Columns:");
});
}).listen(port);

I should add I have tried moving the data locally, using your example data set too but I get the same issue each time.

iros commented

I can't access this url anymore.
Can you replicate in a jsFiddle? Thanks

iros commented

Closed due to no response.