How to use vtk.js in angular8 - angular9

I try to use vtk.js in my angular cli application and added the vtk.js to my angular-cli.json.
ERROR in ./node_modules/vtk.js/Sources/Rendering/OpenGL/glsl/vtkVolumeVS.glsl
Module parse failed: Unexpected token (18:10)
You may need an appropriate loader to handle this file type....
How can I use a glsl loader in angular8 or angular9?

Related

Version conflict - Uncaught DOMException, the name "mwc-icon" has already been used with this registry. Custom Component

I'm trying to use Material Custom Component and also using some other components. But I have version conflict Uncaught DOMException.
Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "mwc-icon" has already been used with this registry.
Currently, I'm using the yarn package manager to handle custom-component versions.
Somewhere in your code, you're trying to register the same custom element more than once. Maybe you're importing a library twice?

Calling showOpenFilePicker : how avoid "must come from gesture" when calling class methods

Accessing the local filesystem a la: https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
If I inline all my code for the show(Open|Save)FilePicker API logic directly in my button event closure or call plain fn's then things work ok. However, if I define a class w/helper methods and call those from my event-handler, and those helpers call the file pickers, then I get this error:
Uncaught DOMException: Failed to execute 'showOpenFilePicker' on 'Window': Must be handling a user gesture to show a file picker.
I assume the the security system is looking at this to establish the gesture context - is there a way to re-establish this context with code running in my class?
Turns out the class methods were a red herring -- the issue has to do with async code and promises -- this is what looses the context and causes the error.
You need to make any calls to the FS without any promise chaining.

feathers-blob error dauria can no read property startsWith

I just started using feathers-blob for uploading files from a angular4 client using dropzone.
I followed the example but made an explicit service for the upload not tu blur up the app.js.
It compiles without error, but on execution i receive the following error, even i do NOT use multipart portion:
Info: error:
system/file-upload - Method: create: Cannot read property 'startsWith'
of undefined error: TypeError: Cannot read property 'startsWith' of
undefined
at Dauria.parseDataURI (/projects/esaas-2/esaas-server-basic/node_modules/feathers-blob/node_modules/dauria/dauria.js:27:17)
at Object.create (/projects/esaas-2/esaas-server-basic/node_modules/feathers-blob/lib/index.js:87:52)
at /projects/esaas-2/esaas-server-basic/node_modules/feathers-hooks/lib/hooks.js:101:31
at /projects/esaas-2/esaas-server-basic/node_modules/feathers-hooks/lib/hooks.js:85:16
I also made sure to use the same versions of feathers-blob and dauria and multer as in the sample and not the newer ones from the npm. Result is the same.
What am i doing wrong? Any help appreciated. Thanks
If you look into dauria's code you'll see where the problem comes from:
Dauria.prototype.parseDataURI = function(dataURI){
if(!( dataURI.startsWith('data:') )) throw new Error(
this.errors.MISSING_PREFIX
);
Which means that somehow the value that you pass to the caller dauria.parseDataURI(yourDataVariable) - the yourDataVariable value does not start with 'data:'.
I made a test on Node and I had the same error while trying to upload an image. I solved it by adding the string "data:image/jpeg;base64" followed by the 64 encoded image.

Trying to clean merged JS/CSS cache, but model "core/design_package" is a non-object

I have made a new PHP file at the root directory of Magento (next to index.php) and it contains this code:
require 'app/bootstrap.php';
require 'app/Mage.php';
Mage::getModel('core/design_package')->cleanMergedJsCss();
Produces this error:
Fatal error: Call to a member function getModelInstance() on a non-object
in /home/edpadev/public_html/stage/bsr/app/Mage.php on line 463
From my understanding, Magento should dig up that particular method in /app/code/core/Mage/Core/Model/Design/Package.php.
I cannot var_dump it since it cannot instantiate it, I just get the same error when trying to do that.
I am able to call our third-party cache module's observer model and use its methods, and use the simple Mage::app()->cleanCache();, but the core function above does not work, though that is how it appears in examples by other developers in Google search results.
Try this. You might need to setup the store
umask(0);
require 'app/Mage.php';
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of:

Getting below error when i run the jmeter script having Beanshell Post Processor as a child to a sampler.
ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method:
eval Sourced file: inline evaluation of: ``try { newuser=
vars.get("prevUsrResponse"); org.json.JSONObject userJSON= new o . . .
'' : Typed variable declaration : Class: org.json.JSONObject not found
in namespace
Below is the code written and run in jMeter 2.9.
newuser= vars.get("prevUsrResponse");
org.json.JSONObject userJSON= new org.json.JSONObject(newuser);
if(prevUsrJSON.has("User") && custJSON.get("User")!= null) {
org.json.JSONObject contactJSON = userJSON.getJSONObject("User");
contactJSON.put("UserType","Private");
}
vars.put("updatedUser", userJSON.toString());
${updatedUser} variable doesn't return the json(or any value) when used in the next sampler request.
There can be the following possible reasons:
You don't have the .jar which provides org.json.JSONObject class in JMeter CLASSPATH.
Download the jar i.e. from the Maven central repo
Copy it to JMeter's "lib" folder
Restart JMeter to pick the .jar up
You dont have the relevant import line. Add it to the beginning of your script:
import org.json.JSONObject;
You can also consider upgrading to JMeter 3.0 which comes with built-in JSON support and provides JSON Path PostProcessor to extract data from JSON responses. If you still want Beanshell - it is also possible, just use json-smart classes