Failed calling executeUserFunction with error {"instanceTree":null,"maxTreeDepth":0} - autodesk-forge

After upgrading of Autodesk Forge Viewer from v6.5 to v7.11 new console error start to appear every time when DWG loaded:
Failed calling executeUserFunction with error {"instanceTree":null,"maxTreeDepth":0}
LMV../src/logger/Logger.js.Logger._reportError # viewer3D.js:75372
(anonymous) # Hyperlink.js:857
Promise.catch (async)
HyperlinkTool.loadHyperlinksF2d # Hyperlink.js:854
HyperlinkTool.loadHyperlinks # Hyperlink.js:805
HyperlinkTool.activate # Hyperlink.js:622
ToolController.activateTool # viewer3D.js:83795
Autodesk.Extensions.Hyperlink../extensions/Hyperlink/Hyperlink.js.HyperlinkExtension.load # Hyperlink.js:192
loadExtensionLocal # viewer3D.js:26330
(anonymous) # viewer3D.js:26245
Promise.then (async)
loadExtension # viewer3D.js:26228
(anonymous) # viewer3D.js:62886
setTimeout (async)
LMV../src/gui/GuiViewer3D.js.GuiViewer3D.createUI # viewer3D.js:62874
createUI # viewer3D.js:62737
(anonymous) # viewer3D.js:62749
setTimeout (async)
onSuccessChained # viewer3D.js:62744
_ref2 # viewer3D.js:33850
onParse # viewer3D.js:49394
According to stacktrace it fails to execute function specified in a string variable:
function userFunction(pdb) {
var hyperlinkExists = false;
pdb.enumAttributes(function(i, attrDef, attrRaw) {
var name = attrRaw[0];
if (name === 'hyperlink') {
hyperlinkExists = true;
return true;
}
});
return hyperlinkExists;
}
With disabled Autodesk.Hyperlink extension it works well without any errors. Is it a bug that is not fixed yet? It would be good to have a sample DWG with hyperlinks, because it's not clear how to test hyperlinks as well.

With disabled Autodesk.Hyperlink extension it works well without any errors. Is it a bug that is not fixed yet?
Yes it's a known issue - before that's fixed be sure to have the Hyperlink switched off with:
new Autodesk.Viewing.GuiViewer3D(container, {disabledExtensions:{hyperlink:true}})
Stay tuned to our official blog for release notes of upcoming versions - this should get fixed soon...

Related

NFT: trying to run create_collectibles scripts throws execution reverted error : This is from Patrick Collins Youtube tutorial

Below is the snip of the script: Using Brownie in VS Code
Error: "Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually."
from brownie import AdvancedCollectible, accounts, config
from scripts.helpful_scripts import get_breed
import time
STATIC_SEED = 123
def main():
dev = accounts.add(config["wallets"]["from_key"])
advanced_collectible = AdvancedCollectible[len(AdvancedCollectible) - 1]
transaction = advanced_collectible.createCollectible(
STATIC_SEED, "None", {"from": dev, "gas_limit": 50000}
)
print("Waiting on second transaction...")
# wait for the 2nd transaction
transaction.wait(1)
time.sleep(35)
requestId = transaction.events["requestedCollectible"]["requestId"]
token_id = advanced_collectible.requestIdToTokenId(requestId)
breed = get_breed(advanced_collectible.tokenIdToBreed(token_id))
print("Dog breed of tokenId {} is {}".format(token_id, breed))
I think this has already been answered here. To summarize it, you probably have vrf_coordinator version error. Try the rinkeby's values from the official docs.
I had the same issue. But Patrick is correct, I did not have any Link tokens inside of my newly created contract on Rinkeby network...So I commented out most of the lines of the code in create_collectible.py to import and apply the fund_advanced_collectible() function once more on my contract:
from helpfulscripts import fund_advanced_collectible
def main():
dev=accounts.add(config['wallets']['from_key'])
advanced_collectible= AdvancedCollectible[len(AdvancedCollectible)-1]
# transaction=advanced_collectible.createCollectible(STATIC_SEED,"None", {"from": dev})
# transaction.wait(1)
# time.sleep(35)
# requestID=transaction.events["requestedCollectible"]["requestID"]
# tokenID=advanced_collectible.requestIDToTokenID(requestID)
# breed=get_breed(advanced_collectible.tokenIDToBreed(tokenID))
# print('Dog breed of {} is {}.'.format(tokenID, breed))
fund_advanced_collectible(advanced_collectible)
With a reminder of the function definition of fund_advanced_collectible from helpfulscripts.py:
def fund_advanced_collectible(nft_contract):
dev=accounts.add(config['wallets']['from_key'])
link_token=interface.LinkTokenInterface(config['networks'][network.show_active()]['link_token'])
link_token.transfer(nft_contract, 100000000000000000,{"from":dev})
Once the transaction was confirmed, I could verify in https://rinkeby.etherscan.io/address that my contract had 0.1 Link and so when executing your code again, the error disappeared...

Google ReCAPTCHA v2 placeholder element must be an element or id

I've had google recaptcha v2 running from last few months but now suddenly it stopped working on my live site (https://blisspot.com/signup). Its working fine on dev site (https://dev.blisspot.com/signup) though. I'm using git to deploying changes which makes me certain that there is no difference between dev and live site code.
I've already tried different solutions suggested in similar posts but non of them is working. I've also tried different api keys but error remains same. Is it possible that google may have banned my domain? Any suggestions would be much appreciated.
$$('.g-recaptcha').each(function ($el) {
if ($el.retrieve('recaptcha-loaded', false)) {
return;
}
$el.empty();
grecaptcha.render($el, {
sitekey: $el.get('data-sitekey'),
theme: $el.get('data-theme'),
type: $el.get('data-type'),
tabindex: $el.get('data-tabindex'),
size: $el.get('data-size'),
});
$el.store('recaptcha-loaded', true);
});
Here is stacktrace.
recaptcha__en.js:212 Uncaught Error: reCAPTCHA placeholder element must be an element or id
at VM214 recaptcha__en.js:212
at Object.render (mootools-core-1.4.5-…at-nc.js?c=1160:959)
at core.js?c=1160:961
at Elements.Elements.forEach (<anonymous>)
at Function.forEach (mootools-core-1.4.5-…at-nc.js?c=1160:220)
at Elements.Elements.each (mootools-core-1.4.5-…at-nc.js?c=1160:337)
at Object.render (core.js?c=1160:952)
at signup:562
at condition (mootools-core-1.4.5-…t-nc.js?c=1160:4352)
at defn (mootools-core-1.4.5-…t-nc.js?c=1160:4366)
(anonymous) # recaptcha__en.js:212
(anonymous) # mootools-core-1.4.5-…at-nc.js?c=1160:959
(anonymous) # core.js?c=1160:961
(anonymous) # mootools-core-1.4.5-…at-nc.js?c=1160:220
each # mootools-core-1.4.5-…at-nc.js?c=1160:337
render # core.js?c=1160:952
(anonymous) # signup:562
condition # mootools-core-1.4.5-…t-nc.js?c=1160:4352
defn # mootools-core-1.4.5-…t-nc.js?c=1160:4366
load (async)
addListener # mootools-core-1.4.5-…t-nc.js?c=1160:3904
addEvent # mootools-core-1.4.5-…t-nc.js?c=1160:4369
(anonymous) # mootools-core-1.4.5-…t-nc.js?c=1160:4620
addEvent # mootools-more-1.4.0.…at-nc.js?c=1160:106
(anonymous) # signup:558

using session$onsessionend to disconnect rshiny app from the mysql server

I obtained this code from R Shiny Gallery here:http://shiny.rstudio.com/gallery/reactive-poll-and-file-reader.html
function(input, output, session) {
# Create a random name for the log file
logfilename <- paste0('logfile',
floor(runif(1, 1e+05, 1e+06 - 1)),
'.txt')
# ============================================================
# This part of the code writes to the log file every second.
# Writing to the file could be done by an external process.
# In this example, we'll write to the file from inside the app.
logwriter <- observe({
# Invalidate this observer every second (1000 milliseconds)
invalidateLater(1000, session)
# Clear log file if more than 10 entries
if (file.exists(logfilename) &&
length(readLines(logfilename)) > 10) {
unlink(logfilename)
}
# Add an entry to the log file
cat(as.character(Sys.time()), '\n', file = logfilename,
append = TRUE)
})
# When the client ends the session, suspend the observer and
# remove the log file.
session$onSessionEnded(function() {
logwriter$suspend()
unlink(logfilename)
})
# ============================================================
# This part of the code monitors the file for changes once per
# 0.5 second (500 milliseconds).
fileReaderData <- reactiveFileReader(500, session,
logfilename, readLines)
output$fileReaderText <- renderText({
# Read the text, and make it a consistent number of lines so
# that the output box doesn't grow in height.
text <- fileReaderData()
length(text) <- 14
text[is.na(text)] <- ""
paste(text, collapse = '\n')
})
# ============================================================
# This part of the code monitors the file for changes once
# every four seconds.
pollData <- reactivePoll(4000, session,
# This function returns the time that the logfile was last
# modified
checkFunc = function() {
if (file.exists(logfilename))
file.info(logfilename)$mtime[1]
else
""
},
# This function returns the content of the logfile
valueFunc = function() {
readLines(logfilename)
}
)
output$pollText <- renderText({
# Read the text, and make it a consistent number of lines so
# that the output box doesn't grow in height.
text <- pollData()
length(text) <- 14
text[is.na(text)] <- ""
paste(text, collapse = '\n')
})
}
If you look closely at the code above, you will see this segment:
# When the client ends the session, suspend the observer and
# remove the log file.
session$onSessionEnded(function() {
logwriter$suspend()
unlink(logfilename)
})
I want to tweak that code in my shiny app to disconnect my MySQL server from my shiny app. Like this:
session$onSessionEnded(function() {
dbDisconnect(con)
})
I want to do this to ensure this warning message: "Unable to connect to database: Too many connections"
Would that ensure connections are freed up for other users? (I had a problem with my app because so many users were on and did not disconnect, leaving no available spot on the server.)

How to enable automatic code reloading in Rails

Is there a way to do 'hot code reloading' with a Rails application in the development environment?
For example: I'm working on a Rails application, I add a few lines of css in a stylesheet, I look at the browser to see the modified styling. As of right now I have to refresh the page with cmd-r or by clicking the refresh button.
Is there a way to get the page to reload automatically when changes are made?
This works nicely in the Phoenix web framework (and I'm sure Phoenix isn't the only framework in this feature). How could a feature like this be enabled in Ruby on Rails?
I am using this setup reloads all assets, js, css, ruby files
in Gemfile
group :development, :test do
gem 'guard-livereload', '~> 2.5', require: false
end
group :development do
gem 'listen'
gem 'guard'
gem 'guard-zeus'
gem 'rack-livereload'
end
insert this in your development.rb
config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload
i have this in my guard file
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
## Note: if you are using the `directories` clause above and you are not
## watching the project directory ('.'), then you will want to move
## the Guardfile to a watched dir and symlink it back, e.g.
#
# $ mkdir config
# $ mv Guardfile config/
# $ ln -s config/Guardfile .
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
guard 'livereload' do
extensions = {
css: :css,
scss: :css,
sass: :css,
js: :js,
coffee: :js,
html: :html,
png: :png,
gif: :gif,
jpg: :jpg,
jpeg: :jpeg,
# less: :less, # uncomment if you want LESS stylesheets done in browser
}
rails_view_exts = %w(erb haml slim)
# file types LiveReload may optimize refresh for
compiled_exts = extensions.values.uniq
watch(%r{public/.+\.(#{compiled_exts * '|'})})
extensions.each do |ext, type|
watch(%r{
(?:app|vendor)
(?:/assets/\w+/(?<path>[^.]+) # path+base without extension
(?<ext>\.#{ext})) # matching extension (must be first encountered)
(?:\.\w+|$) # other extensions
}x) do |m|
path = m[1]
"/assets/#{path}.#{type}"
end
end
# file needing a full reload of the page anyway
watch(%r{app/views/.+\.(#{rails_view_exts * '|'})$})
watch(%r{app/helpers/.+\.rb})
watch(%r{config/locales/.+\.yml})
end
guard 'zeus' do
require 'ostruct'
rspec = OpenStruct.new
# rspec.spec_dir = 'spec'
# rspec.spec = ->(m) { "#{rspec.spec_dir}/#{m}_spec.rb" }
# rspec.spec_helper = "#{rspec.spec_dir}/spec_helper.rb"
# matchers
# rspec.spec_files = /^#{rspec.spec_dir}\/.+_spec\.rb$/
# Ruby apps
ruby = OpenStruct.new
ruby.lib_files = /^(lib\/.+)\.rb$/
# watch(rspec.spec_files)
# watch(rspec.spec_helper) { rspec.spec_dir }
# watch(ruby.lib_files) { |m| rspec.spec.call(m[1]) }
# Rails example
rails = OpenStruct.new
rails.app_files = /^app\/(.+)\.rb$/
rails.views_n_layouts = /^app\/(.+(?:\.erb|\.haml|\.slim))$/
rails.controllers = %r{^app/controllers/(.+)_controller\.rb$}
# watch(rails.app_files) { |m| rspec.spec.call(m[1]) }
# watch(rails.views_n_layouts) { |m| rspec.spec.call(m[1]) }
# watch(rails.controllers) do |m|
# [
# rspec.spec.call("routing/#{m[1]}_routing"),
# rspec.spec.call("controllers/#{m[1]}_controller"),
# rspec.spec.call("acceptance/#{m[1]}")
# ]
# end
end
I am using zeus instead of spring on this setup.
Run guard
Open localhost:3000 and you are good to go.
This should resolve your question, and have blazing reload times better than browserify.
I commented out guard looking at test directories if you want you can uncomment those lines if your are doing TDD.
CSS hot swapping and auto-reload when HTML/JS changes can be achieved with guard in combination with livereload: https://github.com/guard/guard-livereload
This gem would auto reload when you make changes to js elements(Not css or ruby files).
https://github.com/rmosolgo/react-rails-hot-loader
Never seen css hot code reloading in rails platform.

RoR Agile Web Dev 4 CSS not loading

I am new to RoR and I am following the Agile Web Development with Rails 4 book and I am to the point where we add CSS styling to the store front page (page 135 "8.1 Iteration C1: Creating the Catalog Listing").
However, I did exactly as the book stated but the CSS style is not being loaded when I load the page.
I did some research and from what I understand, everything is correct.
Does anyone see anything wrong or what I need to add?
I have tried everything here but nothing worked: Agile web development with rails” book: CSS not applied
UPDATE Looks like the application is using /assets/scaffold.css.scss for styling. If I go to this file a change colors, they reflect on the StoreControllers view!!?? What is wrong here??!!
I cannot figure out why the application is using the incorrect stylesheet...
BTW I also ran RAILS_ENV=production bundle exec rake assets:precompile and made sure the assets were included in public/assets/ folder
Here is my code:
Depot/app/assets/stylesheets/store.css.scss
.store {
h1 {
margin:0;
padding-bottom: 0.5em;
font: 150% san-serif;
color: #226;
border-bottom: 3px dotted #77d;
}
.entry {
overflow: auto;
margin-top: 1em;
border-bottom: 1px dotted #77d;
min-hieght:100px;
img {
width: 80px;
margin-right: 5px;
margin-bottom: 5px;
position: absolute;
}
h3 {
font-size: 120%;
font-family: sans-serif;
margin-left: 100px;
margin-top: 0;
margin-bottom: 2px;
color: #227;
}
p,div.price_line{
margin-left: 100px;
margin-top: 0.5em;
margin-bottom: 0.8em;
}
.price{
color: #44a;
font-weight: bold;
margin-right: 3em;
}
}
}
// Place all the styles related to the Store controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
Depot/app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Application</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body class=​'<%= controller.controller_name%>'>
<%= yield %>
</body>
</html>
Depot/app/controllers/store/store_controller.rb
class StoreController < ApplicationController
def index
#products = Product.order(:title)
end
end
Depot/app/views/store/index.html.erb
<% if notice %>
<p id= "notice" ><%= notice %></p>
<% end %>
<h1>Your Pragmatic Catalog</h1>
<% #products.each do |product| %>
<div class= ".entry" >
<%= image_tag(product.image_url)%>
<h3><%= product.title %></h3>
<%= sanitize(product.description)%>
<div class= "price_line" >
<span class= "price" ><%= product.price %></span>
</div>
</div>
<% end %>
Depot/app/assets/stylesheets/application.css
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
Depot/config/environments/production.rb
Depot::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
config.assets.precompile = ['*.js', '*.css', '*.css.erb']
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
end
Depot::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
config.assets.precompile = ['*.js', '*.css', '*.css.erb']
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
end
This solved it for me.
CSS is not loading in app
Be sure to test your CSS with something more obvious, like
color: red;
somewhere. The agile book is only aligning the text here. It could be easily missed.