# syntax error, not javascript?

**URL:** <https://talk.observablehq.com/t/syntax-error-not-javascript/1271>\
**Category:** Uncategorized\
**Created:** [October 2, 2018, 5:32pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271 "2018-10-02T17:32:24Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![shi-yan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/shi-yan/32/1098_2.png) [@shi-yan](https://talk.observablehq.com/u/shi-yan)\
**Post date:** [October 2, 2018, 5:32pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/1 "2018-10-02T17:32:24Z")

</div>

Is the cell supporting standard javascript? I get syntax error a lot without further explanation.

some example:

```
k = 2
k = k +1

console.log('a');

document.createElement(''div").innerHTML='fef'
```

---

<div class="post-metadata">

**Author:** ![shi-yan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/shi-yan/32/1098_2.png) [@shi-yan](https://talk.observablehq.com/u/shi-yan)\
**Post date:** [October 2, 2018, 5:33pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/2 "2018-10-02T17:33:44Z")

</div>

How does this website handle security? allowing people to embed code is a phishing threat, right?

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [October 2, 2018, 5:35pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/3 "2018-10-02T17:35:22Z")

</div>

Please see this introduction:

> **[Introduction to Code](https://beta.observablehq.com/@mbostock/introduction-to-code)**
>
> An Observable notebook by Mike Bostock.

Cells are typically JavaScript expressions or blocks. So to define a cell _k_ whose value is two, you’d say:

```auto
k = 2

```

Or if you wanted it to have the value three, you could say:

```auto
k = {
  let k = 2;
  k = k + 1;
  return k;
}

```

Similarly to create your DIV, you could say:

```auto
{
  const div = document.createElement("div");
  div.innerHTML = "fef";
  return div;
}

```

Or more idiomatically:

```auto
html`<div>fef`

```

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [October 2, 2018, 5:37pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/4 "2018-10-02T17:37:15Z")

</div>

Regarding security, notebook code is sandboxed and run on a separate domain (a subdomain of [observableusercontent.com](http://observableusercontent.com)) per user. Notebooks can display arbitrary content within the body of a notebook, but they can’t access private data or privileged endpoints.

---

<div class="post-metadata">

**Author:** ![shi-yan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/shi-yan/32/1098_2.png) [@shi-yan](https://talk.observablehq.com/u/shi-yan)\
**Post date:** [October 2, 2018, 5:58pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/5 "2018-10-02T17:58:23Z")

</div>

Thank you!

perhaps, you could make that “syntax error” message clickable and link to the above document. or put a clickable question mark linking to the document?

also the scratchpad should have a link to that document under “introduction”?

---

<div class="post-metadata">

**Author:** ![RandomFractals](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/randomfractals/32/759_2.png) [@RandomFractals](https://talk.observablehq.com/u/RandomFractals)\
**Post date:** [October 2, 2018, 6:13pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/6 "2018-10-02T18:13:15Z")

</div>

more about sec. on this site in this thread until observable devs put out a proper official cors faq:

> [@HTTPRequest Origin="null"](https://talk.observablehq.com/t/httprequest-origin-null/121/15):
>
> I think the main issue with the way observable sets up origin for code cell is that unlike the notebook itself, which has [https://beta.observablehq.com](https://beta.observablehq.com) origin, code cell frames are pinned to custom user static content. See origin request header generated from a fetch() cell call: Therefore, even if you have control over the server hosting a data API you’d like others to use on observable, you can’t simply add [beta.observable.hq.com](http://beta.observable.hq.com) to the ‘Access-Control-Allow-Orig…

I think it’s a good approach for now, not for devs trying to extend this platform, but good enough for avg devs trying this platform without creating too many sec holes to shoot observable int the foot

---

<div class="post-metadata">

**Author:** ![shi-yan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/shi-yan/32/1098_2.png) [@shi-yan](https://talk.observablehq.com/u/shi-yan)\
**Post date:** [October 3, 2018, 1:20am UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/7 "2018-10-03T01:20:57Z")

</div>

I’m thinking about loading large data from my dropbox account. That could be dangerous, right?

---

<div class="post-metadata">

**Author:** ![RandomFractals](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/randomfractals/32/759_2.png) [@RandomFractals](https://talk.observablehq.com/u/RandomFractals)\
**Post date:** [October 3, 2018, 2:51pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/8 "2018-10-03T14:51:12Z")

</div>

define large

I’ve done some large data munging in this collection, loading data from github (not recommended since github is mainly for code repos)

> **[Chicago Crimes](https://beta.observablehq.com/collection/@randomfractals/chicago-crimes)**
>
> 2018 Chicago Crimes EDA / An Observable collection by Taras Novak

would be interested to learn about your large dataset and if loading it from dropbox integrates well with observable cors

the only danger of loading large data in observable notebooks is your notebook will become unresponsive and browsers like FF Quantum complaint about that really well if you don’t sanitize, trim, compress, chunk or pipe your data properly on notebook load. I am sure you’ve seen many of those clunky prototypes on this site

I’d suggest you convert your data to Apache Arrow format or similar flat array structure rather than just dumping megs of csv in a notebook and trying to load and parse that. Start here:

> **[Using Apache Arrow JS with Large Datasets](https://beta.observablehq.com/@randomfractals/apache-arrow)**
>
> An Observable notebook by Taras Novak.

---

<div class="post-metadata">

**Author:** ![RandomFractals](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/randomfractals/32/759_2.png) [@RandomFractals](https://talk.observablehq.com/u/RandomFractals)\
**Post date:** [October 4, 2018, 4:55pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/9 "2018-10-04T16:55:25Z")

</div>

is this also you or just some other guy taking dropbox for a spin on observable? 🙂

> **[002 - DMT Dropbox Tool](https://observablehq.com/@potofcoffee2go/002-dmt-dropbox-clerk)**
>
> Dropbox Interface An \[observable collection\] which describes a \[Data Management Toolbox\] using \[Javascript classes\].This notebook implements an interface to \[Dropbox\]. version: Is just roughed in - only gets the Dropbox file list so far import...

---

<div class="post-metadata">

**Author:** ![shi-yan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/shi-yan/32/1098_2.png) [@shi-yan](https://talk.observablehq.com/u/shi-yan)\
**Post date:** [October 4, 2018, 5:30pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/10 "2018-10-04T17:30:08Z")

</div>

a large data could a pretrained deep learning model, for example, 300mb or so.

I forgot from where I saw an example of loading large data from dropbox. it could be google’s collab, or the [https://iodide.io/](https://iodide.io/) project.

---

<div class="post-metadata">

**Author:** ![RandomFractals](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/randomfractals/32/759_2.png) [@RandomFractals](https://talk.observablehq.com/u/RandomFractals)\
**Post date:** [October 4, 2018, 5:37pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/11 "2018-10-04T17:37:09Z")

</div>

yeah, 300 megs is too large for any web site, observable included, unless you chunk, pipe and stream it via http2 for data viz on the client. don’t even go there, unless you know what you are doing. can be done. see dask, mapd, cassandra, hadoop, spark, torch, tensorflow, big data and such to build your back-end for that kind of massive data analytics 🙂

---

<div class="post-metadata">

**Author:** ![shi-yan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/shi-yan/32/1098_2.png) [@shi-yan](https://talk.observablehq.com/u/shi-yan)\
**Post date:** [October 4, 2018, 5:50pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/12 "2018-10-04T17:50:32Z")

</div>

i’m thinking of using ipfs or webrtc. I really like the idea of observable. but comparing it with jupyter, it lacks raw gpu access and a filesystem for large data.

---

<div class="post-metadata">

**Author:** ![RandomFractals](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/randomfractals/32/759_2.png) [@RandomFractals](https://talk.observablehq.com/u/RandomFractals)\
**Post date:** [October 4, 2018, 5:54pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/13 "2018-10-04T17:54:51Z")

</div>

I think observable is on par with Jupyter notebooks at this point. what you are lacking is the proper data streaming/ml back-end and no front-end framework can give you that today due to massive dataset you want to load, parse and tackle. it’s best done on the server side, yes via direct compute on GPU, and even Py is not best at that. Do take a look at mapd to start with and forget dropbox 🙂 Good luck!

p.s.: you can do GPU compute on the client with webasembly and webgl on the front-end on observable, but that’s mostly for rendering and light math compute.

---

<div class="post-metadata">

**Author:** ![shi-yan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/shi-yan/32/1098_2.png) [@shi-yan](https://talk.observablehq.com/u/shi-yan)\
**Post date:** [October 4, 2018, 6:30pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/14 "2018-10-04T18:30:24Z")

</div>

to be honest, I’m more interested in observable itself. I have been thinking what a better jupyter would be. to me, jupyter is not social enough.

but from a startup engineering point of view, relying on a backend for gpu computing is very costly. for most of the time when people browse a jupyter notebook, they don’t actually do any compute. they spend most of the time reading and consuming the text content. but I think both google’s collab and some nvidia solution will assign a gpu attached vm for each opened notebook at a cost of $2 per hour?

I think it makes lots of sense to move compute to the clients. most of the users would have enough gpu power to do lots of things, like for example deep learning inference.

perhaps, a better way could be a gpu virtualization solution where one vm can be shared with many end users. I found out this solution [http://www.rcuda.net/](http://www.rcuda.net/), but it doesn’t seem to be open sourced and its client is native, there is no javascript client yet.

---

<div class="post-metadata">

**Author:** ![RandomFractals](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/randomfractals/32/759_2.png) [@RandomFractals](https://talk.observablehq.com/u/RandomFractals)\
**Post date:** [October 4, 2018, 6:37pm UTC](https://talk.observablehq.com/t/syntax-error-not-javascript/1271/15 "2018-10-04T18:37:29Z")

</div>

good points. yeah, I think observable is getting better with every new release. Myself and other active devs on this forum that have experience with both Py and JS notebooks have been pushing to make it a better more social and collabo friendly JS notebooking platform for devs, but please keep in mind it’s only for front-end.

Google collab and kaggle are still best places to run DL/ML algos to fine-tune things and even though you can now embed image recognition sets in Android apps and web apps with tensorflow, avro and others, I think short-term platforms like observable will stay point and click and stream heavy data algos results from back-end gpu processing for years to come.

I might be wrong on that, but that’s my crystal ball read. Mapd (I think they renamed recently) is one platform and incorporates apache arrow and other things for you to do what you attempt to do with ‘large’ data sets that are easy approachable for avg devs. Cassandra is my pick for wide-column DB, the rest is sort of up to you to swing it to the browser without killing it and waiting for megs of data to load. http2 has made some good progress on that front. Webassembly can help with some final data recalibration on the front-end, but I would not push it further than that.

Hope that helps

🤗
