Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I get started with Dataset? #206

Open
nunon opened this issue Jul 12, 2013 · 9 comments
Open

How do I get started with Dataset? #206

nunon opened this issue Jul 12, 2013 · 9 comments

Comments

@nunon
Copy link

nunon commented Jul 12, 2013

Hello,

I've followed the instructions as in http://misoproject.com/dataset/tutorials/quickstart and downloaded the development files locally.

However, all I get is a blank page...

Heres the code I'm using:

<title>Your Application Title</title>
<script src="development/miso.ds.0.3.0.js"></script>
<script src="development/lib/json2.js"></script>
<script src="development/lib/lodash.js"></script>
<script src="development/lib/moment.js"></script>
<script src="development/lib/underscore.deferred.js"></script>
<script src="development/lib/underscore.math.js"></script>
<script src="teste.js"></script>

And in teste.js:
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 }
];

var ds = new Miso.Dataset({
data : data
});

ds.fetch({
success : function() {
log("Dataset Ready. Columns: " + this.columnNames());
log("There are " + this.length + " rows");
log("Available Colors: " + this.column("color").data);
}
});

Can someone please explain me what I'm doing wrong? This seems a fantastic library and I'd really like to explore it.

Thanks in advance for any help.

@eepstein
Copy link

Want to put up a plnkr to show your code.

Is this in an html file that is pulling in the miso code?

Also, you are logging things - perhaps you want console.log() rather than just log() - so nothing will show in the page - open the console and take a look that way. Chrome is the browser I use for that.

@nunon
Copy link
Author

nunon commented Jul 12, 2013

Hi,

Sorry, I don't know what a plnkr is ;)
I have 2 files: an HTML and a Js file, exactly as in http://misoproject.com/dataset/tutorials/quickstart
I changed the log to console.log but nothing changed, I still get blank pages.
Thanks for your help!

@eepstein
Copy link

Google is your friend. Don;t know what something is? Search for it.
http://plnkr.co/
Do you know how HTML works? You're not emitting any markup so of course the page is blank.
Most browsers have some sort of dev tools. Within that there is usually a JavaScript console. That's where you'll find log messages. In Chrome on a Mac it's under View > Developer > JavaScript Console.

IF you want to show values via HTML you need some JavaScript <-> HTML framework. There are scads and scads of them: Dojo, jQuery, etc. Personally I opt for Angular and recommend it.

@eepstein
Copy link

Your questions isn't about Miso.Dataset. It's about JavaScript and HTML. There are many sites on the web to help you with those and many more, like StackOverflow, to answer these more general questions.

@nunon
Copy link
Author

nunon commented Jul 13, 2013

Hi,
Thanks for your explanation. The plunker I'm using is in http://plnkr.co/edit/YXDYSO?p=preview
The HTML isn't outputing anything directly but it contains a reference to teste.js that should log messages to the browser in case the dataset had been created.
The erors I get in my js file are:
ReferenceError: _ is not defined @ file:///.../development/miso.ds.0.3.0.js:758
TypeError: this._initialize is not a function @ file:///.../development/miso.ds.0.3.0.js:54

@eepstein
Copy link

So, first thing is that when developing it is recommended one not use the minimized (.min) version of libraries. Libraries are minimized to speed download when you deploy your "production" website, but they make debugging very challenging.

So, in your plunkr, rename teste.html to index.html. Also you can put the two script tags in the head element (or you can leave them in the body).

Take a look: http://plnkr.co/edit/RWAS3x

@nunon
Copy link
Author

nunon commented Jul 16, 2013

Ok, I made the changes to the HTML and changed the reference to the library to a production environment.

I still get the same errors:
miso.ds.0.4.1.js (linha 54)
ReferenceError: _ is not defined
this._initialize(options);

miso.ds.0.4.1.js (linha 54)
TypeError: this._initialize is not a function
this._initialize(options);

You may see the plunkr at: http://plnkr.co/edit/YXDYSO?p=preview

I also tested my own script (teste.js) and it's running.

@eepstein
Copy link

You are using the wrong miso javascript. The one you are referencing is PURE miso without Miso's dependencies. Miso depends on a bunch of other packages, including underscore.js, among others. Miso ships various flavors: minimized / non-minimized (as mentioned before), with dependencies / without dependencies. So there are 4 flavors just between those options. This is very common with JS libraries. So reference the correct Miso and try again. See the plnkr I forked from yours. Take a look. It works. See what's different.

@miguelpaz
Copy link

Note aside: Its so much fun to read this back and forth communication :)
El 16/07/2013 13:42, "eepstein" notifications@github.com escribió:

You are using the wrong miso javascript. The one you are referencing is
PURE miso without Miso's dependencies. Miso depends on a bunch of other
packages, including underscore.js, among others. Miso ships various
flavors: minimized / non-minimized (as mentioned before), with dependencies
/ without dependencies. So there are 4 flavors just between those options.
This is very common with JS libraries. So reference the correct Miso and
try again. See the plnkr I forked from yours. Take a look. It works. See
what's different.


Reply to this email directly or view it on GitHubhttps://github.com//issues/206#issuecomment-21059211
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants