Hi i am trying to apply my custom symbol to a layer of data and i have instantiated it like this
ModelSymbol Scene ms1 = await ModelSymbolscene(new Uri("https://....."),100):
Service feature layer P1=....
Feature layer sfl=....
Sfl.renderer=new SimpleRenderer(ms1);
Even after i have instantiated it like this it still doesn't display the symbol and the symbol is in .dae format
Related
I've never used the windows media format 11 sdk before and I'm just trying to understand the documentation behind text. I don't understand the line where it says, "In order to use the function, you must pass it a pointer to the IWMHeaderInfo3 interface of a metadata editor object, reader object, synchronous reader object, or writer object". Where do these objects come from? And how do I get them from a video file path?
I wish there was some function like printAllAttributes(std::string videoFilePath) or something.
I've been working on cross contract calls and simulation testing. I gnereally have things working when I use function calls but I'm seeing a wasm execution error "HostError(ProhibitedInView { method_name: "promise_batch_create") when trying to use a 'view' to call a method that generates a cross contract call to get its information.
contract1 has a method (indirect_num_entries) that uses a cross contract call to a method (num_entries) in contract2 that returns acount (with no modifications)
const contract1 = new nearAPI.Contract(
account1, // the account object that is connecting
"example-contract.testnet",
{
// name of contract you're connecting to
viewMethods: ["indirect_num_entries"], // view methods do not change state but usually return a value
changeMethods: ["indirect_add_entry"], // change methods modify state
sender: account, // account object to initialize and sign transactions.
}
);
and for contract2
const contract2 = new nearAPI.Contract(
account2, // the account object that is connecting
"example-contract.testnet",
{
// name of contract you're connecting to
viewMethods: ["num_entries"], // view methods do not change state but usually return a value
changeMethods: ["add_entry"], // change methods modify state
sender: account, // account object to initialize and sign transactions.
}
);
All of that works correctly via the Javascript SDK for both adding and getting the number of entries.
However I ran into a problem while trying to create a simulation test and found that trying to use view on indirect_num_entries caused an error:
let x : u64 = view!(contract1.indirect_num_entries()).unwrap_json(); //error
caused the following runtime error:
An error occurred
Error: Querying [object Object] failed: wasm execution failed with error: FunctionCallError(HostError(ProhibitedInView { method_name: "promise_batch_create" })).
Playing around a bit I found that replacing the view! with a call! worked -- i.e.
let x : u64 = call!(root, contract1.indirect_num_entries()).unwrap_json(); // works
I also found that if I use the near-cli I see the same behavior i.e.
near call contract1 indirect_num_entries "{}" --accountI contract1 (works)
near view contract1 indirect_num_entries (errors)
whereas for views directly to the contract2 work just fine
near view contract2 num_entries (works)
let x : u64 = view!(contract2.num_entries()).unwrap_json(); // works
Is this as expected and view is only valid for methods that access (not modify) the local contract data and shouldn't be used for methods that issue a cross contract call? (Or am I doing something incorrectly?)
I can certainly imagine that there could be reasons for needing to use a call (e.g. perhaps the request for a cross contract call needs to be signed) but I don't recall anything/haven't found anything that seems to describes this. Is there a description or a explanation somewhere?
Thanks!
This article explains the issue
https://docs.near.org/docs/develop/contracts/as/intro#view-and-change-functions
view calls do not provide the same context as a change call
the reason is because view calls are unsigned. no sender has signed a transaction to make the call. this is useful, not requiring a signature, because some use cases are intended for casual browsing or frequent reading of data like browsing an NFT collection or rendering a dashboard
change calls require a signed transaction so they include context like sender and other details
cross-contract calls require gas and this gas should be charged to some account. without a signed transaction (in a view call) then there is no one to charge for this gas
this might make you wonder: "but don't view calls cost gas too?" ... yes, they do, and today the RPC node providers are subsidizing these calls but that may change in the future
In this link from MDN, it explains how to write a unit test for developing an addon for firefox. However, there are several segments that I don't understand and didn't find any useful result after searching google.
The first one, the following is a paragraph quoted from above link:
In a web page, you can perform Base64 encoding and decoding using the
btoa() and atob() functions. Unfortunately these functions are
attached to the window object: since this object is not available in
your main add-on code, atob() and btoa() aren't available either. So
we'll create a base64 module to expose these functions from the
platform (see Creating Reusable Modules).
What does "the platform" in the above paragraph mean? the "Services.jsm"?
Also in the following code:
const { atob, btoa } = require("resource://gre/modules/Services.jsm");
this makes atob and btoa as one of the Services that is available for other class? or make (constant variables)atob and btoa both reference to the Services.jsm?
The Second one:
what are these two lines of code do?
exports.atob = a => atob(a);
exports.btoa = b => btoa(b);
I understand the part
exports.atob
which enables atob function to be available from other classes outside the "base64.js".
but what does the following mean?
= a => atob(a);
I didn't find that javascript has "=>" operator!
From my understaning, the reason we create a base64.js is because atob and btoa can only be called if we have the window object. Therefore we can use Services.jsm to get a reference of the window object?
For "platform" in the paragraph you quoted they mean the set of functions which is not strictly Firefox browser code but rather implements basic, share functionalities. This usually lives in toolkit/modules in the mozilla-central repository. Services.jsm lives there as well so yes, that's part of the platform. Moreover, atob and btoa are both imported from Services.jsm.
The arrow => in exports.atob = a => atob(a); defines what's called an arrow function: it's a new, shorter syntax to define functions in JavaScript. This SO answer has many useful informations about it.
From my understanding, the reason we create a base64.js is because atob and btoa can only be called if we have the window object. Therefore we can use Services.jsm to get a reference of the window object?
That's almost correct: you need to export the function from the underlying platform as you don't have a window object there. If you had a window object, you would have just done window.atob or something like that. That call would have still called the same function you imported from Services.jsm.
So you're not using Services.jsm to get a reference to the window object, but rather directly importing the needed functions so that you don't need to have a window object.
In my Animate CC file I can handle the loading of external js files, but am struggling to understand how you access the functions in those external files from the timeline? For example, if my external script has:
function videoPlay() {
alert("Hello! I am some code!");
}
How would I call that function from a keyframe on the timeline?
this.videoPlay(); or _root.videoPlay(); does not work
videoPlay(); is the correct way to call the method. I had an issue elsewhere in the code where I did not implicitly call this. on a variable.
How do I troubleshoot the following error being thrown by a Microsoft AJAX JavaScript framework method? It is an automatically generated line of JavaScript from a custom User Control in a Web Forms App (Sitefinity 5 CMS)
Error Message:
Unable to get property 'FancyBlockDesigner' of undefined or null reference
Here is the JavaScript that is throwing the error:
Sys.Application.add_init(function() {
$create(SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner, null, null, {"Editor":"propertyEditor_ctl00_ctl00_ctl00_ctl00_ctl00_Editor","propertyEditor":"propertyEditor"}, $get("propertyEditor_ctl00_ctl00_ctl00"));
});
Rather than discuss the ascx and cs files that try to abstract this detail away from me, I want to know what this error means. If I understand the detail, the abstraction might make more sense.
"$create" function in ASP.NET Ajax creates an instance of JavaScript class. Microsoft had their own opinion on how to make JavaScript object orientated and as time had shown, their approach wasn't exactly perfect.
Anyhow, to try to explain what is happening, let me give a bit of an overview oh how it works. We start by a server side control which implements IScriptControl interface which mandates two members: GetScriptDescriptors and GetScriptReferences. The second one is pretty straightforward - it lets you register references to all JavaScript files that you control will require. The GetScriptDescriptors, on the other hand, let's you define all the instances of JavaScript classes you want to use as well as it lets you set their properties - initialize them, if you will.
What the autogenerated JavaScript code you've pasted says is basically that you have defined in GetScriptDescriptors that you will need an instance of type "SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner" where you want Editor property to be initialized. This code will go and look for a JavaScript constructor that looks like this:
function SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner(element) {
}
that most probably also has a prototype defined, something like:
SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner.prototype = {
}
Now, since the error you have posted states: "Unable to get property 'FancyBlockDesigner' of undefined or null reference", most probably one of the following is the problem:
You have not included the JavaScript file which contains the class (constructor + prototype) that I've talked about above
You have forgot to add the "FancyBlockDesigner" to the constructor (it seems that you do have other object, perhaps through MS Ajax namespaces - "SitefinityWebApp.Esd.TheLab"
You have not registerd the "SampleHtmlEditor" namespace. Make sure at the top of your JS file you have this: Type.registerNamespace("SitefinityWebApp.Esd.TheLab.SampleHtmlEditor");
So, short story long, the function with name "SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner" cannot be found.
Hope this helps,
Ivan