How to run cesiumjs - javascript

I followed some instructions,so cesium running locally
and then did hello world example like this
But I cannot see anything when i clicked open in browser. I failed constantly
I don't know what can i do.

From your images, it looks like your Cesium development server is running on port 8080. However, your web browser is simply viewing the local HTML file through its filesystem path (C:\Users\GSY\...) and not through the server. You need to serve your HTML file through http://localhost:8080/ and enter the path to the HTML file relative to where you started the server from. For example, if you started the server in C:\Users\GSY\Desktop, you should try URL http://localhost:8080/helloworld/hello1.html.
I have no idea what your filesystem setup actually is, so you'll need to adjust the URLs based on your system and where you installed things.
However, based on a very quick glance at the Cesium JS quickstart page, you haven't set up your environment properly with an API token, and at any rate you haven't instructed the page to show anything, so it's not surprising the page is blank. I strongly suggest reading through the quickstart examples and looking at the API documentation to understand how to use this tool.

Related

Make a game written in Javascript available online

I've just finished a simple game in Adobe Animate using the HTML5 Canvas. I now have .fla, .html and .js files. Can I now put these somewhere on my website to make the game available to play? If so, where? If not, what else do I need? Thanks.
Clicking on the HTML file opens it in a browser, but I can't interact with it.
Thanks.
You're stepping in to a whole new world of hosting and deployments. To have a functioning website you need:
A host server
A domain name
Web files (which you have)
The host server will serve up your web files and allow incoming traffic from the web.
The domain name is optional, but helps with visibility. Without it you'll have to connect directly to the IP address of the host server.
I'd recommend finding a host like HostGator, GoDaddy, or Amazon S3 if you want to host a static website. It can be pretty intimidating at first, but you'll need to put in the time reading documentation to fully understand the process.
Alternatively, if you just want to get it running locally and not on the internet you can install a simple http server on your machine. I use NodeJS so I'll test with http-server alot. Hope this helps!

What is the meaning of "serving html files from a web server, and not open using the file:// protocol" while testing TensorFlow.js on local machine?

I'm trying COCO-SSD Object detection model from TensorFlow.js on the local machine and it's not working as expected as shown on Codepen, even though code is exactly the same. In the Google Codelabs, there is a caution message and I'm pasting it here as-it-is.
Caution: If you are running locally, instead of another site like
Codepen.io or similar, ensure you are serving the files from a web
server and not just double clicking the index.html to open using the
file:// protocol.
Link: https://codelabs.developers.google.com/codelabs/tensorflowjs-object-detection#3
I'm opening it as an html file with file:// protocol. I don't understand what is meant by "serving html files from web server" here. I'm also familiar with Nodejs, so please feel free to guide me if it has something to do with that here. Thank you.

Keep getting ERR_HTTP2_PROTOCOL_ERROR when saving to file

The Problem:
I edit an asset file such has .js or .css via my code editor Sublime Editor 3. I then save those files to the server via an SFTP plugin on sublime. Then when I refresh the live website to view changes from my chrome browser (I have a plugin that flushes the browser cache so I see new changes.) I sometimes get a error on the chrome console that reads:
net::ERR_HTTP2_PROTOCOL_ERROR 200
Where the browser is not served the requested file. When I check my log file for Apache I see the following:
[alert] 657967#657967: *188534 pread() read only 7497 of 7498
My server is setup with Nginx running as a Web Server and Reverse Proxy for Apache.
How can I make it so that Nginx does not fail server the requested files even though they were just edited. Maybe sending back cache until it updates the new changes. Please advise because it is driving me nuts and I have no idea how to overcome it.
My workflow for JavaScript consists of me writing code and refreshing the live site to view web console on chrome. I need to be able to view the changes I made from the server via browser. I don't like local environments. I tried to google this topic many times with no luck so any help would be much appreciated.

Why is server not loading the models properly? (error 404)

For a school project I am trying to create a face recognition tool. To create this I used this tutorial.
The code runs fine in Visual Studio code with live server (running live server is a key but I can't figure out why this is so important)
But now I'm trying to put my work on a real server (server is granted to us by school). But when I upload all the files to my school server the console says it couldn't find the right models. The link the console tries to fetch the files from seems right so I'm confused and can't figure out what the problem is.
Code that loads the models:
Promise.all([
faceapi.nets.tinyFaceDetector.loadFromUri('./models'),
faceapi.nets.faceLandmark68Net.loadFromUri('./models'),
faceapi.nets.faceRecognitionNet.loadFromUri('./models'),
faceapi.nets.faceExpressionNet.loadFromUri('./models'),
]).then(startVideo)
Server build-up:
Console error log:
Have another check that the file path you have provided is correct. For example, it may work locally with just ('./models'). But check if the school server requires you to provide the root file path. Let me know if this works.
I would recommend a generic approach to this issue, for didacting reasons.
You can to use ProcMon from Microsoft SysUtils. It can monitor any application for file system activity like reading directories or files. I recommend to use it to check where your application is actually reading from and where those paths are pointing to.

Why can't Js load image files from my web service directory?

I have a domain www.foo.com and wish to host a JAX-RS/Maven/Jersey web service there. Currently, I'm packaging the Java code into a .war file and deploying it on an Apache Tomcat 8.0 web server for testing on my local machine.
In /apache8/webapps/ROOT/index.html (localhost:8080/) I have script tags within which an XMLHttpRequest object makes a get request to localhost:8080/apiIndex/webapi/resource - which searches a resource folder in my web service directory that contains 150 or so images. The the full path names to those images are returned to my Js code, and that Js code attempts to create images out of them to be drawn to a canvas.
The problem is, I'm getting a network error saying that Js can't find/load the images.
How do I map an index.html file to my domain from within my web service directory, so that when I forward requests from my domain to port 8080 of my server I can access those images from code within my web service package? Is this the reason the Js code in the tomcat webapps folder can't load the images from my API's src/java/resources folder?
First of all: /apache8/webapps/index.html does not sound like something that's mapped to localhost:8080. I'd rather expect the / (root) webapplication to be deployed under /apache8/webapps/ROOT (and the index.html file within that folder).
I'm assuming that your web application with the images is deployed under /apache8/webapps/apiIndex. If that generates, as you say "the full path names" of your images, that can't be found: What are those full path names, and where do you expect them to be? Do you get 404 error codes or something else - like 500? Please post URLs and your expected places in the folder.
(this is posted as an answer instead of a comment because I hope that the initial description help you find the root of your problem yourself, while the second part is effectively asking for more information)
Edit: Following your comment: IMHO your webservice should rather return a http or https reference to an image, rather than a file reference. If anything else, you might need to prefix it with file:///home/... in order for the browser to consider getting it. However, if your browser shows a http document, it might not even cross that domain and embed local file resources for security reasons: Why would any webserver reference material on your local disk?
Have your images somewhere where you can reference them through http and the problem should be solved.

Categories