Hi Tosh,

it seems your path is not correctly setup as the process is not able to identify the underlying C binding libraries. I assume you are using the 64-bit version of Python. Also I want to point out that we currently only support Python 3 up to version 3.3 as later versions introduced quite significant changes in string handling. We are working on supporting versions beyond 3.3 at the moment.

HTH,

Stefan

While it is true that Generics are not supported by the Java Gateway I would like to provide a little more guidance on why that is the case and how to deal with this not uncommon situation.

The Java Gateway (and the dotNet Gateway by the way) allow you to interface between ObjectScript and another language environment and obviously there are concepts in one language foreign to the other. Our approach to the Gateways is to support basic structures and concepts which are similar in both languages or easily translated between them. A "complete" approach would not only take very long to implement, would be hard to verify for correctness and because of the rules you had to apply not easy to understand. It would defeat the basic rule "power through simplicity".

Generics is a case which is not easily mapped and therefore not supported. Of course you can come up with ideas how to support such a concept with what the server-side environment has to offer, but keep in mind what I wrote above.

 Every time you encounter such a situation you find yourself in a situation where the Java API you would like to call from our side of the fence is too complex and properly includes functionality you don't want to interact with in its entirety.

The Facade pattern allows you to easily work around this challenge. Build a basic API around the functionality you want to interact with on the Java side and import your handwritten entry point. This makes the interface much more manageable for the gateway and all the participating parties as the contract between Java and ObjectScript is very clear with this pattern.

Hope that helps,

Stefan 

I am not sure if I got the question right. If you already have a Zen or Zen Mojo application and would like to add a login page, I strongly recommend to develop the login page as a separate CSP/ZEN or Zen Mojo page. From my experience Zen Mojo is too heavy just to build a single simple login page (as it is designed for a complete SPA - single page application), so CSP or ZEN is recommended. If you are starting from scratch I usually recommend to pick a modern framework like Angular you feel comfortable with and communicate via JSON/REST to the backend. Responsiveness is usually achieved by a mix of picking UI libraries that are responsive by default (e.g. Bootstrap) and your own responsive CSS implementation. If you require a native application for mobile devices on iOS and Android (e.g. to interact with the camera) you have to be a bit more specific. But your options are either a native application (Swift or Java) or a hybrid (e.g. via Cordova or Ionic). The communication channel always is JSON/REST, so you have to start by designing your REST interface first, no matter what your web client looks like. At least for the majority of the use cases. Please let me know if you require additional information. HTH, Stefan

Interesting thought Sebastian.

We haven't run dedicated benchmarks on this topic, but I can provide some guidelines.  You have to acknowledge that creating a dynamic object or a dynamic array is the most expensive part of your code style compared to just using plain variables. You are instantiating an object.

If you run a simple benchmark like the following you can observe a difference:

ClassMethod TestAll()
{
    set iterations = 1000000
    
    set start = $P($H,",",2)
    for i=1:1:iterations {
        do ..TestDynamicObject()
    }
    set time = $P($H,",",2) - start
    w "Dynamic Object test case took "_time_" seconds",!
    
    set start = $P($H,",",2)
    for i=1:1:iterations {
        do ..TestVariables()
    }
    set time = $P($H,",",2) - start
    w "Variable test case took "_time_" seconds",!
}

ClassMethod TestDynamicObject()
{
    set do = {}
    set do.setting1 = "value"
    set do.setting2 = "value"
    set do.setting3 = "value"
    set do.setting4 = "value"
    set do.setting5 = "value"
    set do.setting6 = "value"
    set do.setting7 = "value"
    set do.setting8 = "value"
    set do.setting9 = "value"
    set do.setting10 = "value"
}

ClassMethod TestVariables()
{
    set setting1 = "value"
    set setting2 = "value"
    set setting3 = "value"
    set setting4 = "value"
    set setting5 = "value"
    set setting6 = "value"
    set setting7 = "value"
    set setting8 = "value"
    set setting9 = "value"
    set setting10 = "value"
}

The result on my local machine looks like this:

USER>do ##class(User.DOAPerf).TestAll()
Dynamic Object test case took 13 seconds
Variable test case took 0 seconds

So there is a significant difference IF your code is called often enough to actually make the overhead noticeable. In the above example I called each method 1 million times. If your code is not called that often you will not observe a difference.

As a general advice I would not nest the dynamic objects or dynamic arrays when used as you describe it, as this increases the number of object creations.

Long story short: Stick with variables in performance-critical parts of your application. In other parts of your application you can use dynamic objects or dynamic arrays as temporary objects for sure, just make sure you only nest them when absolutely required. Passing complex structures between method calls with dynamic objects can be very elegant.

HTH,

Stefan

Embedding a JLNP file in a CSP page is the same as in a plain HTML page. You have to embed and load the JLNP file using something like the following snippet:

<script src="https://www.java.com/js/deployJava.js"></script>
<script>
    var attributes = {} ;
    <!-- Base64 encoded string truncated below for readability -->
    var parameters = {jnlp_href: 'your_applet.jnlp',
        jnlp_embedded: 'PCEtLSANCi8qDQogKiBDb ... bmxwPg=='
    } ;
    deployJava.runApplet(attributes, parameters, '1.8');
</script>

In order to figure out the value for the jnlp_embedded parameter you have to base64 encode the contents of your JNLP file. The JNLP file has to be accessible from the relative link provided by the parameter jnlp_href.

This tutorial explains how to embed JNLP files:

http://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/embe...

XEP for .NET does support both in-memory and TCP/IP connections. The client must be on the same machine for in-memory connections but can run remotely for TCP/IP connections. Long-term we will move away from in-process connections, but we haven't taken this step yet for XEP for .NET.

We consider support for .NET Core interesting and are currently evaluating support for it. But it is too premature to promise anything yet.

You are correct in your assumption, you have to work with streams to operate on arbitrarely large JSON. %ToJSON and %FromJSON work with streams. Here is an example how streams can work with %FromJSON to read a file:

        set fileStream = ##class(%Stream.FileCharacter).%New()
        $$$THROWONERROR(tsc,fileStream.LinkToFile(<pFile>))
       
        set jsonObject = ##class(%DynamicObject).%FromJSON(fileStream)

Hi Simcha,

you can easily retrieve the data that you are using in your layout (AlerTList in your case), by calling the function getSourceData() on your documentView component. Assuming the id of your documentView is 'mainView', the following code sample should work in your environment:

var view = zen('mainView');

var data = view.getSourceData();

console.log(data.AlerTList);

HTH,

Stefan

As I mentioned before the onevent method is not directly called for most events. The onevent method is only called for viewport changes by default.

Here is an example how you can register your own events. Everything happens in the homepage class.

Step 1) Subscribe to the onPageShow callback

Most pageManagers implement the onPageShow method to let you know when a certain layout has finished rendering. This is a complete documentView example:

<mojo:documentView
 id="mainView"
ongetdata="return zenPage.getContent('data',key,criteria);"
ongetlayout="return zenPage.getContent('layout',key,criteria);"
initialDocumentKey="login"
initialLayoutKey="login"
>
<mojo:jQM-1.4.3-PageManager onPageShow="zenPage.onPageShow(layoutkey,documentkey);">
<mojo:HTML5Helper/>
<mojo:jQM-1.4.3-Helper/>
<mojo:mojoDefaultHelper/>
</mojo:jQM-1.4.3-PageManager>
</mojo:documentView>

Step 2) Implement your logic

I'll just paste the code in here, as I have documented the methods individually:

/// Gets called when a certain layout has been rendered.
/// In this case we are registering additional events and
/// forward them to the onevent callback method in the template.
ClientMethod onPageShow(
    layoutKey,
    documentKey) [ Language = javascript ]
{
    if (layoutKey=='login') {
        zenPage.registerEventHandler('txt-user','keydown');
    }
}

/// Register an event to a layout object by key.
ClientMethod registerEventHandler(
    key,
    eventType) [ Language = javascript ]
{
    var element = zen('mainView').getItemByKey(key);
    element.$findElement('').addEventListener(eventType,new Function('evt','return zenPage.myCustomEventHandler("'+eventType+'","'+key+'");'),false);
}

/// Forward an event to the onevent method in the template.
ClientMethod myCustomEventHandler(
    evtType,
    key) [ Language = javascript ]
{
    var item = zen('mainView').getItemByKey(key);
    var template = zenPage.getTemplate();
    template.onevent(evtType,key,item.$findElement('').value,'mainView');
}

Zen Mojo does not provide a lot of special methods for this task. It involves some coding. 

Herman,

the adaptor approach works for many simple use cases but has issues of its own for more complex scenarios.

If the object graph is huge than the adaptor does a lot of work even if you are only interested in a few properties for some cases.

If you have to serve multiple front-end environments then you have to be able to present an object with multiple levels of details (e.g. native mobile, vs. mobile web vs. desktop web) which require you to do different levels of filtering.

As JSON is more and more used for backend communication as well, you have to be able to produce a verbose JSON output that includes all null values, which are very often omitted for front-ends.

There are many more reasons why you want more control about the projection. We are considering to deliver both approaches: an adaptor class (e.g. %JSON.Adaptor) and a projection method (something like %Compose, but probably with a different name).