I'm trying to run the Autodesk viewer-navigation.sample link on my machine but I get just a loading screen and nothing happens.
I think it's because I haven't loaded the model, I'm not sure I understand what it means to do:
To prepare the models, run the Initial Setup endpoint.
But when I navigate to http://localhost:3000/forge/initialsetup when the server is running I get: Cannot GET /forge/initialsetup
I did set in the Autoforge app the callback url to be http://localhost:3000/api/forge/callback/oauth
I also did run:
npm install
set FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM DEVELOPER PORTAL>>
set FORGE_CLIENT_SECRET=<<YOUR CLIENT SECRET>>
What else can be done to make it work?
As a temporary workaround, till we'll fix it, you could try either define a FORGE_BUCKET env variable:
set FORGE_BUCKET=someuniquename2d3d
or within source code (forge.js) change the line 45:
var ossBucketKey = process.env.FORGE_BUCKET || 'navigationsample3d2d';
by replacing the 'navigationsample3d2d' string with something like 'someveryuniquename2d3d'.
This should work.
Related
I'm working on a python app that needs to get the NTPSynchronized parameter from system-timedated. I'd also like to be able to start and stop the NTP service by using the SetNTP method.
To communicate with timedated over d-bus I have been using this as reference: https://www.freedesktop.org/wiki/Software/systemd/timedated/
I previously got this working with dbus-python, but have since learned that this library has been deprecated. I tried the dbus_next package, but that does not have support for Python 3.5, which I need.
I came across the pystemd package, but I am unsure if this can be used to do what I want. The only documentation I have been able to find is this example (https://github.com/facebookincubator/pystemd), but I can not figure out how to use this to work with system-timedated.
Here is the code I have that works with dbus-python:
import dbus
BUS_NAME = 'org.freedesktop.timedate1`
IFACE = 'org.freedesktop.timedate1`
bus = dbus.SystemBus()
timedate_obj = bus.get_object(BUS_NAME, '/org/freedesktop/timedate1')
# Get synchronization value
is_sync = timedate_obj.Get(BUS_NAME, 'NTPSynchronized', dbus_interface=dbus.PROPERTIES_IFACE)
# Turn off NTP
timedate_obj.SetNTP(False,False, dbus_interface=IFACE)
Here's what I have so far with pystemd, but I don't think I'm accessing it in the right way:
from pystemd.systemd1 import Unit
unit = Unit(b'systemd-timesyncd.service')
unit.load()
# Try to access properties
prop = unit.Properties
prop.NTPSynchronized
Running that I get:
Attribute Error: 'SDInterface' object has no attribute 'NTPSynchronized'
I have a feeling that either the service I entered is wrong, or the way I'm accessing properties is wrong, or even both are wrong.
Any help or advice is appreciated.
Looking at the source code, it appears that using the pystemd.systemd1 Unit object has a default destination of "org.freedesktop.systemd1" + the service name (https://github.com/facebookincubator/pystemd/blob/master/pystemd/systemd1/unit.py)
This is not what I want because I am trying to access "org.freedesktop.timedate1"
So instead I instantiated it's base class SDObject from pystemd.base (https://github.com/facebookincubator/pystemd/blob/master/pystemd/base.py)
The following code allowed me to get the sync status of NTP
from pystemd.base import SDObject
obj = SDObject(
destination=b'org.freedesktop.timedate1',
path=b'/org/freedesktop/timedate1',
bus=None,
_autoload=False
)
obj.load()
is_sync = obj.Properties.Get('org.freedesktop.timedate1','NTPSynchronized')
print(is_sync)
Not sure if this is what the library author intended, but hey it works!
I was trying to run some tests, but needed test data, so i created a generation file which created dummy html. When I attempt to run it though, it gives me a Reference Error: HTMLDivElement is not defined.
Is there something I need to import such that Node knows what HTMLDivElement is? I am not rendering anything, but just want correct data to pipe into follow on code.
I run my file through TSC, and then run it through node.
Sample Code:
const main = () => {
let root = new HTMLDivElement();
}
main();
Edit:
I was trying to just bypass it with: let root = document.createElement("div"); but node does not understand what document is, so I cant seem to get that running either as a fallback.
Indeed, Node.js doesn't come with a DOM implementation. If you want to run tests that use the DOM, you'll need to either load a Node.js-compatible DOM implementation such as jsdom, or if that doesn't meet your requirements, switch to a browser-based testing environment such as Selenium.
I'm using the admin-on-rest npm package starter project and trying to plug in a simple SSO Facebook login button using the FacebookAuth npm package. Every time I try to click the "Login" button, I get the following error:
FB.login() called before FB.init()
I'm using an .env file with the following variable: REACT_APP_FACEBOOK_APP_ID and setting it to the right value. I even did console.log() within my app and can see it output.
I checked and I'm only loading the FB SDK once, not multiple times (this was a common issue reported on other threads).
Ok, it turned out to be something pretty dumb, but something to point out nonetheless!
In my .env file, I had accidentally placed a semicolon (;) at the end of the declaration, like this:
REACT_APP_FACEBOOK_APP_ID = XXXXXXXXXXXX;
Apparently .env files do NOT like semi-colons. This was just very difficult to figure out from the error above.
So if any of you want to pull your hair out because of this issue, and you're using similar tech, check to make sure you're syntactically kosher EVERYWHERE variables are being declared.
the funny thing was i forgot to replace your-app-id with my app id:
<script>
FB.init({
appId: 'your-app-id',
autoLogAppEvents: true,
xfbml: true,
version: 'v8.0'
});
</script>
I am learning ExpressJs tutorial from https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/mongoose
Now I have created module for mongodb database and then create a file populatedb.js in the root directory. Now I am trying to connect to database using command (as describe at last on above link)
node populatedb mongodb://dbuser:dbpassword#ds133814.mlab.com:33814/local_library_tutorial
but terminal response nothing and there doesn't happen in database
My Brother.
I ran into the same problem, and when my search led me to your question i was even more sad when I saw no answer, however after searching around, I found an answer!
Make sure you replace the "dbuser:dbpassword" placeholders with actual data e.g "Elias:js44889" on your mongo url.
Also just make sure it's also the same as the one in app.js.
I think all should be fine as it was for me.
you must include the script in populatedb.js to get work done.
populatedb.js script link : https://raw.githubusercontent.com/hamishwillee/express-locallibrary-tutorial/master/populatedb.js
After inserting the script in populatedb.js file from above link, then run the following commands to populate data in mongoDB.
npm install async (if not installed async module)
node populatedb <your mongodb url>
sometimes you may get an error if you use the same collection name in all of your models, this happened to me until i realised what i was doing was wrong.
for example don't do this
const authorModel = mongoose.model('author', AuthorSchema)
const bookModel = mongoose.model('author', BookSchema)
if you do it un-expeectedly it will throw this error
OverwriteModelError: Cannot overwrite author model once compiled.
instead in the commandline for "windows users" write
node populatedb mongodb+srv://username:password#yourcluster.mongodb.net/yourdatabase
and in your models make sure that the collections are not the same
const authorModel = mongoose.model('author', AuthorSchema)
const bookModel = mongoose.model('book', BookSchema)
I also ran into the same issue as I am doing the same tutorial. What I did to resolve this issue is go to the populatedb.js link they provide in the first step of the "Testing - create some items" or you can download it. Once I clicked on the link, they provide test data that you can paste into the populatedb.js file you've created in the root of your project then:
npm install async --save
node populatedb <your mongodb url>
Script should run and you should see the results or items as it creates them.
Followed the MDN tutorial, Here is what I fixed:
username:Jeff ; password : 12345
app.js, change to:
var mongoDB = 'mongodb://Jeff:123#ds149732.mlab.com:49732/local_library';
Command Line prompt, change to:
node populatedb mongodb://Jeff:12345#ds149732.mlab.com:49732/local_library
Posting here because this answer is the result I found googling the problem.
Had the same problem, the error ended up being the password I have set for the admin on the database - special characters were encoded (there was a warning displayed which I apparently ignored) which caused me to not be able to connect.
I had this issue for a couple of days with the error
zsh: no matches found: <my mongodb url>
First, I double checked I had followed the instructions in Testing — create some items in the tutorial.
Then I changed my original mongodb URL in the terminal, removing the end.
My original mongoURL =
mongodb+srv://username:password#cluster0.9f24o.mongodb.net/myFirstDatabase?retryWrites=true&w=majority
My new mongoURL =
mongodb+srv://username:password#cluster0.9f24o.mongodb.net/myFirstDatabase
I ran this script while in my express-locallibrary tutorial folder.
node populatedb mongodb+srv://username:password#cluster0.9f24o.mongodb.net/myFirstDatabase
I'm not sure at this point if this means I need to change the link in app.js as well.
Hopefully this saves someone some time!
i am trying to use durandal.js for single page architecture,
i already have application where i am loading all pages in div = old approach for single page architecture,
what i want to do is when i click on page i need to open hotspa pages,
for now i write something like this . www.xyz.com#/details,
where # details is my durandal view page!
when i put <a> herf ....#/details, i got error like this :
http://postimg.org/image/hoeu1wiz5/
but when i refresh with same url, it is working fine, i am able to see view!
i do not know why i got this error
If you are using anything before version 2.0 of Durandal, you are getting this because in your Shell.js you are not defining router, or you have a bad definition of where the router module is, or possibly you are defining scripts in your index instead of 'requiring them' via require.js
1st - Check shell.js, at the top you should have a define function and it should say / do something like this, and should be exposing that to the view like so -
define(['durandal/plugins/router'], function (router) {
var shell = {
router: router
};
return shell;
};
2nd - Check and make sure the 'durandal/plugins/router' is point to the correct location in the solution explorer, in this case it is app > durandal > plugins > router. If it is not or if there is no router you can add it using nuget.
3rd - Make sure you aren't loading scripts up in your index or shell html pages. When using require.js you need to move any scripts you are loading into a require statement for everything to function properly. The 'Mismatched anonymous define() module' error usually occurs when you are loading them elsewhere - http://requirejs.org/docs/errors.html#mismatch