MEF 2 - What is the equivalent of AddExportedValue? - mef

In MEF, you could specify what instance you wanted to satisfy a Shared export with 'AddExportedValue'.
DataSet dataset = new DataSet();
container.AddExportedValue<MyDataSet>(dataset);
I can't find the analog in MEF 2. Could someone please send me in the right direction.

The equivalent is ComposeExportedValue:
container.ComposeExportedValue<MyDataSet>(dataset);

Related

There is a way to use lsp4e for calling language server methods directly?

I'm new to the lsp4e & lsp technologies and as far as I have seen the framework provides almost everything for working with eclipse. However there is a way to use this features at will? i.e I would like to use the LS to get all the functions on a file, I think this will be done with textDocument/documentSymbol but how can I get this using the lsp4e framework?
NOTE:
I checked for SymbolKind and seems it was not the one I was looking for however that input helped me finding a sample of DocumentSymbol
DocumentSymbolParams params = new DocumentSymbolParams(
new TextDocumentIdentifier(documentUri.toString()));
CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> symbols =
languageServer.getTextDocumentService().documentSymbol(params);
I checked for SymbolKind and seems it was not the one I was looking for. However that input helped me finding a sample of DocumentSymbol
DocumentSymbolParams params = new DocumentSymbolParams(
new TextDocumentIdentifier(documentUri.toString()));
CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> symbols =
languageServer.getTextDocumentService().documentSymbol(params);

Osisoft pi data archive- How to create piServer collective

I am writing a c# application that uses OSIsoft AFSDK dll (2016 version). My application should define PI server collective and send data to this collective.
But what I'm trying to figure out is:
using C# code, how to define a PI data archive servers as a collective? and how to configure one of them to be the primary server?
I've been searching for code examples and couldn't find any code.
Can anyone post an example or a reference to such an example?
you can add a new Collective to the Known Servers Table using the next code snippet:
using OSIsoft.AF.PI;
PIServers myPIServers = new PIServers();
PIServer newPIServer = myPIServers.Add("NewPIServer");
Then you can access to PI Collective information using:
PICollective collective = newPIServer.Collective
You can consult the Live Library:
https://techsupport.osisoft.com/Documentation/PI-AF-SDK/Html/T_OSIsoft_AF_PI_PIServers.htm
And also there's a very good forum for anything regarding OSIsoft PI: https://pisquare.osisoft.com/
Hope it helps!

Store tMap flow data into HashMap

I have a scenario where i want to store data to HashMap after processing in tMap component.
my flow is as follow :
tFileInputExcel------>tMap------>tJavaRow/tJavaFlex
In tJavaRow, i want to store all my data into a HashMap.
Any help on this.
Additionally to Philipps answer, I would like to add that you could use the tHashMap components. Usually those are deactivated when Talend is installed and you need to activate them first.
Then it is very easy using them, just add the components as you are used to do. You would save creating code.
It's not difficult to do this but it'll be less obvious to the "reader" of the code than the usage of the components.
For readability I'd recommend a tJavaFlex component over the tJavaRow. Assuming the Flow "toHashMap" exits your tMap with the fields "myKey" and "myValue", the code in the tJavaFlex would look like this:
Start code:
HashMap myAwesomeMap = new HashMap<>();
Main code:
myAwesomeMap.put(toHashMap.myKey, toHashMap.myValue);
End code:
/*
whatever you want to do with the aggregated data. You'll probably want to save it to the globalMap in any case.
*/
globalMap.put("myAwesomeMap", myAwesomeMap);

Powershell script automation Visio: How to randomly more dynamic glue to another shape?

I am trying to automate Visio by using powershell script.
I have a visio shape "Start" --"x shape" pointing to "BeginX" and targeting to "PosX" (therefore having a dynamic end).
I do not manage to randomly move the dynamic.
$begin = $connect.CellsU("BeginX").GlueToPos($shape,1);
$end = $connect.CellsU("EndX").GlueToPos($rect,0);
Is there a way to randomly auto move the existing connector to the end of shape?
Please and thanks...
I prepared these simple vba macro and gif animation for display behavior of dynamic connectors
CJP!
Please read more about GlueToPos method in MS Visio Cell.GlueToPos Method (Visio)
You need use 3 arguments (Shape, x-coordinate, y-coordinate) in this method !
Dynamic connector is feature based on Visio application core, which generated this connector behavior ! If open Behavior window for dynamic connector
You can find there a lot of settings, such as Style, Reroute and Appearance. I did some experiments with dynamic connectors, connectors route unpredictable.

GenericMapCellLabelProvider cannot be resolved to a type

I have been doing some EFM databinding as a part of learning the eclipse modelling framework and one thing that didn't work with window builder was data binding with a TableViewer in th sense that it was fine for reading the data, but not for when you wanted to edit the data. so I am following Tom Shindl's on how to do it...the trouble is with this piece of code:
tableViewerColumn.setLabelProvider(
new GenericMapCellLabelProvider(
"{0}",
attributeMap
)
);
it says that GenericMapCellLabelProvider cannot be resovled...but when I use the GenericMapCellLabelProvider, it can be resolved, could someone help explain why this might be? I don't 'think I am missing any dependencies or packages etc..