qt.webChannelTransport from sub-frame - qtwebengine

Is it possible to use the qt.webChannelTransport from a sub-frame? It seems like QWebEnginePage.setWebChannel only creates the qt.webChannelTransport object in the top frame. I've considered trying to inject scripts to handle cross document messages and then use the Qt WebChannel between the main frame and the qt application, but that seems like a total pain.

Related

VSCode ANTLR4 Plugin: Export Call Graph to JSON?

The vscode-antlr4 plugin for VisualStudio Code has a nice call-graph feature which visualizes (as a dendrogram) how grammar (and lexer) rules interact. You can save the graphic as SVG.
Is there a way to export the information as JSON? I wouldn't mind going into the plugin's code to find a way to do it.
My aim is to create reachability graphs for individual rules, i.e. graphs that show from which other rules a particular rule can be reached (transitively). The "calls" and "is-called" information from the call-graph feature would be a nice starting point.
The data for the call graph comes from a source context instance (for each grammar file there's a single source context to manage all details for it). See the function getReferenceGraph, which collects the relations into a map object. You can use that object to generate a JSON object from it. Or you create another function, taking this one as template, to generate the JSON directly, without the overhead required for the UI.

Using Zenject to wire up Mapbox SDK

I'm using the Mapbox SDK and RoadArchitect and trying to build some game initialization code that uses Mapbox to generate a list of vectors, then take that list of vectors and call functions in Road Architect to generate road GameObjects. In order to do this, I need to wait until Mapbox has finished it's work before I can run the code to generate roads. I extended the Mapbox MergedModifierStack as ObservedModifierStack and added a StackComplete event.
My current scene setup has 2 relevant GameObjects:
Map (Mapbox AbstractMap)
which contains (pseudo propery path, might not be 100% accurate): Map.VectorTileFactory.Factories[m].Visualizer.ObservedModifierStack .Modifiers[n].MyModifier
RoadArchitect GSDRoadSystem
Most of the objects in the Map hierarchy are ScriptableObject and all are added/configured through inspectors in the editor UI.
public class MyModifier {
public MyModifier (MyDataObject myDataObject) { ... }
}
public class MyObjectCreator {
public MyObjectCreator(MyDataObject myDataObject, ModifierStack modifierStack) {
...
modifierStack.StackComplete += OnStackComplete();
}
}
In My OnStackComplete event handler I am attempting to execute functions against GSDRoadSystem. I say "attempt" because I haven't been able to figure out how to wire everything up to be injected, short of rewriting large portions of the Mapbox code simply to decorate everything with [Inject], something I'm reluctant to do given the SDK is still in heavy development.
The main issue seems to be that MyModifier isn't having MyDataObject injected, I'm guessing because Mapbox/Unity is controlling the lifecycle (due to configuration through inspectors/editor), but I don't know how to get around or work with that through Zenject.
My other option is to mess around with the Unity messaging system, and passing the vector list in the message to MyObjectCreator which would locate the appropriate GSDRoadSystem through the Unity provided service locators. Not ideal, but given this is a one-time setup and the RoadArchitect processing is going to dwarf any extra time or memory that might take I'm okay with it, even if it is a bit inelegant, although I'd rather learn how to get Zenject to wire things up, if that is at all possible (maybe it isn't because of how Mapbox built things).
I do have a fairly extensive background working with DI (Autofac, Ninject, poor-man's, etc.) but this is my first foray into Unity3d. It's possible I'm allowing Unity to cloud things and the solution is obvious, but I'm not seeing it right now.
For objects that are not created by Zenject and are not in the initial scene, you need to manually inject them yourself. You can do this by first injecting DiContainer into one of your classes and then calling DiContainer.Inject or DiContainer.InjectGameObject on the object that was created by third party code.

How can I use multiple instances of a subvi (component) in subpanels without xcontrol?

I try to build modular, reusable code in labview.
I want to create a UI component that allows me to select one of the files or directories in a given directory.
I created a subvi that does this. So far so good.
I can use this subvi as a component in other vis, by putting it into a subpanel.
I want to have several of such subpanels with an "instance" of the subvi in my main vi.
I cannot do this. Labview opens the subvi in one subpanel and throws an error for opening it in another one.
How can I tell Labview to create a duplicate/new "instance" of the subvi that runs independently from the any other one?
I found out that xcontrol are probably a better approach to creating components, but they are not available to me, whether they solve the above problem or not.
Labview 2013
You need to configure the subvi to be reentrant.
This allows LabVIEW to allocate data space for each instance.
There are different types of reentrancy, I would stick with the pre-allocated option to start.
http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/reentrancy/

how to run the example of uima-text-segmenter?

I want to call the API of uima-text-segmenter https://code.google.com/p/uima-text-segmenter/source/browse/trunk/INSTALL?r=22 to run an example.
But I don`t know how to call the API...
the readme said,
With the DocumentAnalyzer, run the following descriptor
`desc/textSegmenter/wst-snowball-C99-JTextTilingAAE.xml` by taking the
uima-examples data as input.
Could anyone give me some code which could be run directly in main func for example?
Thanks a lot!
Long answer:
The link describes how you would set up the application from within the Eclipse UIMA environment. This sort of set-up is typically targeted at subject matter specialists with little or no coding experience. It allows them to work (relatively fast) with UIMA in a declarative way: all data structures and analysis engines (computing blocks within UIMA) are declared in xml (with a GUI on top of it), after which the framework takes care of the rest. In this scenario, you would typically run a UIMA pipeline using a run configuration from within Eclipse (or the included UIMA pipeline runner application). Luckily, UIMA allows you to do exactly the same from code, but I would recommend using UIMAFit (http://uima.apache.org/d/uimafit-current/tools.uimafit.book.html#d5e137) for this purpose instead of of UIMA, as it bundles lots of useful things and coding shortcuts.
Short answer:
Using UIMAFit, you can call Factory methods that create CollectionReader (read input), AnalysisEngine (process input) and Consumer objects (write/do other stuff) from (third-party provided) XML files. Use these methods to construct your pipeline and the SimplePipeline class to run it. To extract the data you need, you would manipulate the CAS object (containing your data) in a Consumer object, possibly with a callback. You could also do this in a Analysis Engine object. I recommend using DKPro's FeaturePathFactory (https://code.google.com/p/dkpro-core-asl/source/browse/de.tudarmstadt.ukp.dkpro.core-asl/trunk/de.tudarmstadt.ukp.dkpro.core.api.featurepath-asl/src/main/java/de/tudarmstadt/ukp/dkpro/core/api/featurepath/FeaturePathFactory.java?spec=svn1811&r=1811) to quickly access the feature you are after.
Code examples:
http://uima.apache.org/d/uimafit-current/tools.uimafit.book.html#d5e137 contains examples, but they all go in the opposite direction (class objects are used in the factory methods, instead of XML files - XML is generated from these classes). Take a look at the UIMAFit API to find the method you need, AnalysisEngineDescription from XML for example: http://uima.apache.org/d/uimafit-current/api/org/apache/uima/fit/factory/AnalysisEngineFactory.html#createEngineDescriptionFromPath-java.lang.String-java.lang.Object...-

CellTree suggestion - AsyncDataProvider add/remove/update

I have issues with GWT CellTree and at this point, I'm wondering if it's really ready for prime time. Maybe I'm not getting the default use-cases??
Most questions that have seen over the Web so far are related to CRUD operations with a CellTree but using a simple ListDataProvider such as GWT - Add and remove nodes in celltree.
In my case, I'm populating the nodes of a CellTree using an AsyncDataProvider.
The nodes are fetched on-demand using a RequestFactory service.
Given a selection, I would like to add child nodes, remove/update the current selection. The GWT TreeViewModel interface is way too basic in my opinion.
From my current understanding, the way to go would be to use a map of DataProviders, keep a reference of the underlying list returned by the remote call and likely a reference to the parent NodeInfo object.
For example to delete the current selection I'd probably do the following:
TreeViewModel model = cellTree.getTreeViewModel();
TreeViewModel.NodeInfo nodeInfo = model.getNodeInfo(selectionFromChangeListener);
CustomNodeInfo parent = ((CustomNodeInfo) nodeInfo).getParent();
parent.getUnderLyingNodeListFromDataProvider().remove(selectionFromChangeListener);
// maybe force refresh using dataProvider???
parent.getDataProvider().refreshDisplayAsInRepopulateData()
Any better suggestion? It looks like it's going to be a challenging task, unless I'm mistaken... It seems a bit overkill though. In Swing it would be very easy to achieve or even in most other Web Frameworks providing Tree widgets.
Would using the default Tree widget and replacing myself the icons with the "loading" image be a more straightforward thing? It looks like the basic Tree allows way more manipulations of nodes as TreeItems.
The CellTree widget seems to be based on the original code of FastTree.
The FastTree already have more or less what I need, without some kind of setUserObject method as in a Swing DefaultMutableTreeNode
For spinning icons, someone already investigated it in the past.
I guess that for now, I'll switch from CellTree to a customized version of FastTree and FastTreeItem.
Out of the box ability to have methods such as getParentItem, remove(current node or specific child node)?? Thank you very much sir...