Using the DAML Ledger API from a language other than Java or JavaScript - daml

I would like to write an application that interacts with the DAML ledger but as of the SDK 0.11.3 the only documented bindings are for Java and JavaScript.
Is there a way to use the Ledger API from other languages?

The Ledger API is a set of services exposed through gRPC, which uses Protocol Buffers as its own interface definition language.
The bindings documented as part of the SDK build on top of the code generated from gRPC to offer more features and a more idiomatic API.
You can still use gRPC directly to generate the code necessary to interact with the Ledger API. As of gRPC 1.15.1, supported languages (and/or platforms) include:
C++
Java
Python
Go
Ruby
C#
Node.js
Android Java
Objective-C
PHP
Dart
The following are the first steps common to all languages to create an example project. If you already have a project and would like to add bindings in a language for which bindings are not available, skip to step 4.
Create a new directory for your project and cd into it
mkdir daml-project && cd daml-project
Create a directory for your DAML models and put a model into it. For now an empty model will do (you can put a model of your choosing at a later time).
mkdir daml && echo -e "daml 1.2\nmodule Empty where" > daml/Empty.daml
Create a project descriptor (da.yaml file) with the following contents:
project:
sdk-version: 0.11.3
name: daml-project
source: daml/Empty.daml
version: 2
Run the following command to add the Ledger API gRPC service definitions to your project:
da add ledger-api-protos
At this point the directory protobuf should have been added to your project. You can use these files to generate bindings to the Ledger API in one of the languages supported by gRPC.
The procedure on how to generate the code for your target language is described by the gRPC official documentation.

Related

How load custom .net dll with accoreconsole.exe in Design Automation with all AutoCAD DLL's

I have created a AutoCAD custom .net dll for the desktop version which had some operation.
Adding multiple empty drawing documents.
Opening the existing drawing document and copying the required blocks in the newly created drawing document.
Performing some operation on them, discarding all the unnecessary drawing documents and saving one of them as an output drawing document.
I had a query regarding opening the existing document and adding the empty document using Design Automation API but I couldn't achieve it with Design Automation.
As I explored I found that only AcCoreMgd.dll and AcDbMgd.dl are allowed with accoreconsole.exe.
Load custom .net dll inside accoreconsole.exe
DLL's used by AutoCAD custom .net project for desktop version are (AcCoreMgd.dll,AcCui.dll,AcDbMgd.dll,AcMgd.dll,AcTcMgd.dll,AdUIMgd.dll)
I wanted to use all the above DLL's with Design Automation for AutoCAD.
Will you please let us know how we can use desktop versions like support in Design Automation for AutoCAD?
It is not possible to add other modules when working with Design Automation or AccCoreConsole. Please note AcCoreConsole is a Headless part of AutoCAD in other words no UI libraries are permitted. Following are the libaries that a crx app should bind.
Where XX - module version of AutoCAD release for more details
If you are developing a .NET module, you need to use following Nuget
ac1stXX.lib
acdbXX.lib
acdbmgd.lib
AcDbPointCloudObj.lib
acgeXX.lib
acgiapi.lib
acismobjXX.lib
AcMPolygonObjXX.lib
AcSceneOE.lib
axdb.lib
rxapi.lib
acbrXX.lib
acgexXX.lib
AdImaging.lib
AdIntImgServices.lib
AecModeler.lib
AsdkHlrApiXX.lib
acapp_crx.lib
AcCamera.lib
accore.lib
AcFdEval.lib
AcPublish_crx.lib
Why do you need to open mutilple documents ?, you can insert multiple blocks from different drawings in to Host drawing. Make modifications, save and send to your Server.

Difference between "use JSON" and "use JSON -support_by_pp"?

Looks to me, the later one has more functionalities. But could not find specific doc for it. No "support_by_pp" found by grep under the perl lib directory as well.
Can someone please point it out for me?
Check perldoc JSON
The JSON module has two backends: a pure Perl backend (PP) and a C backend (XS). Some features are only available in the PP backend, but -support_by_pp makes some of these features available even when using the XS backend.
To find out which version you're using, check JSON #Backend Module Decision

How to package a Windows Runtime component for distribution?

I have built a WinRT component (.winmd) for use by both JavaScript and XAML Windows Store apps. When including and referencing the loose .winmd file output in a JavaScript client, I see this build warning:
Microsoft.AppXPackage.Targets(808,9): warning APPX1707: No implementation file was provided for the .winmd file 'myRuntimeComponent.winmd'. To generate registration information in the app manifest, specify the 'Implementation' metadata on the .winmd reference item in the project file.
I can't find any documentation on this error or how to include implementation metadata.
When running the JavaScript client, this exception is thrown when a class method exported from the .winmd is called:
0x80040154 - JavaScript runtime error: Class not registered
Note that I am referencing the loose .winmd file in the client application project, rather than referencing the Visual Studio project that builds the .winmd. My use case is distributing the .winmd output, not the full source for the .winmd component - source distribution is not an option.
Also note that when the Windows Runtime component is referenced as a project reference, the JavaScript client builds and runs correctly. The C# XAML client runs correctly with either a project reference or a reference to the loose .winmd.
It seems as if some registration information is not being generated in the client application build when a loose .winmd is referenced.
How can I build and distribute a loose Windows Runtime component for use by both JavaScript and managed clients?
A WinRT component built with C# or VB produces a .winmd that contains both metadata and implementation. A component built with C++ provides separate .winmd and .dll files, and the DLL is what contains the details to register the component.
Apparently, as the warning indicates, you need to edit the project file with something like the following to point to the DLL:
<Reference Include="component">
<HintPath>component.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Implementation>component.dll</Implementation>
</Reference>
Alternatively you might want to look into Extension SDKs. See the below link for how to package your component as an easy to consume Extension SDK in VS:
http://msdn.microsoft.com/en-us/library/jj127119.aspx

Building Windows Store app programmatically

We have a requirement of creating several Windows 8 apps for tablets. There is a common solution and news apps are created by passing different resource to the same code.
For Mobile it was a cakewalk - Used the Microsoft.Build.Evaluation.Project class to get the xap file.
But for Surface, building from code does not give the direct appx output, while building using MSBuild gives appx as the output.
I tried several methods to avoid calling MSBuild from C#(by creating a Command Process) like creating a zip file - myapp.appx - and then signing it using this c++ code. It didn't workout because of an extern reference and I gave up.
Then I tried to use SignTool.exe by creating a Command Process in C#. That too failed.
So, I am wondering if there is any way to build an appx directly from C# without MSBuild.
The reason why I am trying to avoid MSBuild is to get a status from the build process, which Microsoft.Build.Evaluation.Project.Build() provides.
First try adding a pfx key to your project and then try the build via Microsoft.Build.Evaluation.Project.Build() again. The pfx is required from what I read:
See Candy's answer here:
MSBuild target to create the .appx package
So then the trick would be to use SignTool to get the pfx in the first place and update the project with that pfx, but first see if the above works.

Generating JUnit reports from the command line

I have a test setup for a cloud system that uses a mixture of python for process level control and junit for internal state inspection. Essentially, I bring up several VMs to server as the cloud and then a junit VM which is a member of the cloud but drives tests and checks internal state. Our existing cloud management stuff is driven by python and I would like to maintain this.
I have a working setup that will run the JUnit command line via
java -ea -cp <classpath> org.junit.runner.JUnitCore <tests>
but this does not produce an report file. I know that ant is capable of producing an xml report, but I do not want to involve ant in this process (I have enough moving parts already).
Is there a way to launch junit from the command line such that it produces a report?
Ideally, I would have the junit tests produce xml reports, the python tests produce xml reports, and then merge them together for consumption by our CI system.
Update: The command line execution must support Windows, Linux, and Mac. We are not allowed to ship an external ant, although packaging an internal ant might be an option.
The JUnit library does not have any XML output options. To achieve such a thing, you'll need to write your own RunListener, which listens for the output and will in your case write the XML file.
However, to get the XML file in the correct format so that it can be read by CI system, I think it would be far easier to just use ant, either via the command line using a build.xml (JUnitReport), or using the java api: How can i use Apache ANT Programmatically.
EDIT: Initially, we had four options:
Use ant from the command line
Use ant programmatically (using the Java API)
Use the XMLJUnitResultFormatter directly with JUnitCore
Create a custom RunListener which produces the correct XML output.
Given the restrictions added by the OP, we can't use ant from the command line, which eliminates 1.
After looking more closely at the Ant JUnit task, it seems to be impossible to use this with JUnitCore (adding a TestListener), because ant uses the name of the test class directly, so you can't do a bridge class. From XMLJUnitResultFormatter.java
private void formatError(String type, Test test, Throwable t) {
...
nested.setAttribute(ATTR_TYPE, t.getClass().getName());
String strace = JUnitTestRunner.getFilteredTrace(t);
Text trace = doc.createTextNode(strace);
nested.appendChild(trace);
}
This eliminates 3.
Invoke Ant programmatically, via the Java API. I can't find any recent documentation on this. This seems to be hard.
So, finally, I would do 4, a custom RunListener, using the code from XMLJUnitResultFormatter as a base. And then, I'd publish it on github.com, so this question could be answered properly :-)