How to setup tSNE for TensorFlow.js? - tensorflow.js

I am trying to run the simple tensorflow tfjs-tsne examples (https://github.com/tensorflow/tfjs-tsne) in my own html/js project. The tensorflow core seems to be loaded correctly (e.g. the tf.randomUniform call works), but as soon as I call tsne (e.g. tsne.tsne(data)) I get this error in the browser console:
"Uncaught TypeError: n.ENV.findBackend is not a function" - when included with script tags, or:
"TypeError: _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ENV.findBackend is not a function" - when included via yarn
What am I doing wrong in setting up this project?

The latest release of tSNE is from June 2018 and does currently not support the latest Tensorflow version (state: April 2019). There is already an opened issue on github and a statement from the author here.
You can downgrade your script to an older version of Tensorflow to use tSNE:
<script src="https://cdn.jsdelivr.net/npm/#tensorflow/tfjs#0.14.1"></script>

Related

MediaStreamTrackGenerator available in Chrome DevTools but not in react app

I want to use the experimental Insertable Stream for MediaStreamTrack API in my project, specifically, the MediaStreamTrackGenerator.
The compatibility chart says it's supported from Chrome 94, and I'm using Chrome 109 (on Windows) so I figured it would be okay.
However, when ran new MediaStreamTrackGenerator({kind: video}) in my local development version of my react app, I got the error:
'MediaStreamTrackGenerator' is not defined no-undef.
First thought this is a problem with my chrome version so I ran the same line in my devtools console, and it worked there.
Then I thought this is because my node, npm, or react version not supporting this feature, so I updated them all to the latest version and it didn't help.**
A weird detail is that this error only appears after I make changes in my code (and it hot-reloads) or that I open devtools for my react app.
Update: it seems like I just had to add windows. to it.

Fresh Nextjs app generates runtime errors

I'm trying to do a fresh install of nextjs on Windows (see command line screenshot) using gitbash and latest nodejs lts version (16.14.2). When running npm run dev everything seems to be in order.
However, after browsing to http://localhost:3000, I receive this:
I looked at Fresh NextJS App throwing errors before any changes but the version in that issue is next 11.1.1 whereas current is 12.1.4. At this point I'm pretty much stuck. =\
Turns out it was an issue with Chrome extensions. I disabled all of them and no longer received the error. One by one I re-enabled all of them but never found the source. =\

An unhandled exception occurred while processing the request. ASPNETcore and React

I made a new project in asp.netcore version 3.1 and react in visual studio. I get the following when I run the project:
I tried to delete node_modules and ran npm install, but it did not work. I have also tried to clone my friends github repo (which works on his computer) to mine computer to check if it is possible to run, but it does not work. Hoping for an answer as soon as possible.
I have done several projects in aspnet core and jquery. But it does not work to run a project in react, why do I get this error?

Uncaught syntax error with Moment.js

I'm starting a new Ionic project, and I'm trying to use Moment.js. However it's throwing an error that I'm struggling to figure out. I haven't changed anything in Ionic or Moment, but when I try to load the project it says:
Uncaught SyntaxError: Unexpected reserved word
And then when I look to the code where it's coming from, it's in the moment.js file. I've used this module multiple times before, and it hasn't given me any issue, but this is my first Ionic project. What am I missing?
The moment.js source file (in the src directory) is written in ES6. When they do their build it gets transpiled to ES5 and the moment.js file at the top level of the directly is the transpiled version. The minified versions (in the min folder) are also ES5.
I had the same issue because I pointed to the src version instead of the build versions of moment.js. I'm running successfully at the latest version now.

Build errors in VS13 in angular.d.ts and jquery.d.ts using TypeScript [duplicate]

I have a problem with Visual Studio 2013 generating too many errors when building a web application with typescript definition files. For example consider the following scenario:
Start a new Empty Web Application
Right click on project and select Manage Nuget Packages
Add jquery and jquery typings (the typings I downloaded are a couple of days old)
Build the project
Project builds successfully with more than 100 errors (errors, not warnings), all in jquery.d.ts, like the following:
',' expected.
'=' expected.
Identifier expected.
I get similar results when I do the same with angularjs instead of jquery.
Any ideas?
The most likely reason for this is that you are using an older version of TypeScript than the definition author.
The language is moving swiftly and some of the features in version 1.4 are particularly useful in definition files, so it is likely that you will need to upgrade to 1.4 so that your machine can understand these new features.
Download version 1.4 here.
I was having a similar issues like this but I was able to resolve the jQuery issues by downgrading my DefinitelyTyped version of "1.0.1" instead of "1.4.1". Also I'm currently running on Mac and hopefully this can help users who are experiencing issues on Mac.

Resources