Dmitry Maslennikov · Mar 26, 2017 go to post

you should look at XSLT, it can help transform xml as you need

ClassMethod SplitXML() 
{

    for item="market","product" {
        set params("path")="/doc/"_item
        
        Set tSource=##class(%Dictionary.CompiledXData).%OpenId(..%ClassName(1)_"||XML").Data
        
        Set tXSL=##class(%Dictionary.CompiledXData).%OpenId(..%ClassName(1)_"||XSL").Data

        // Transform the source according to the XSL
        Set tSC=##class(%XML.XSLT.Transformer).TransformStream(tSource,tXSL,.tOutput,,.params)
        If $$$ISERR(tSC) Quit
        
        write !!
        // Output the result to the screen
        Set tSC=tOutput.OutputToDevice()
    }
}

XData XML
{
<?xml version="1.0"?>
<doc>
<header></header>
<product><test>1</test></product>
<market><test2>2</test2></market>
</doc>
}

XData XSL
{
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:param name="path"></xsl:param>

<xsl:output method="xml" indent="no"/>
 
<xsl:template match="/">
    <xsl:copy-of select="$path"/>
</xsl:template>
    
</xsl:stylesheet>
}

will output like below

USER>d ##class(Test).SplitXML()


<?xml version="1.0" encoding="UTF-8"?><market><test2>2</test2></market>

<?xml version="1.0" encoding="UTF-8"?><product><test>1</test></product>
Dmitry Maslennikov · Mar 26, 2017 go to post

you can do it with ccontrol tool

Syntax:
    ccontrol create <instance name> <parameters>
Description:
    Create an instance's entry in the Cache registry.
Parameters:
    directory=<installation directory name>
    versionid=<version identifier>
Example:
    ccontrol create mystuff directory=/usr/cachesys versionid=2008.2.0.357.0
Dmitry Maslennikov · Mar 23, 2017 go to post

It is not so simple as would appear in the first time. Because you can have some mentions to old package in a source. In studio only possible to rename some class with refactoring feature. Unfortunately, this feature is not documented, or I have not found.

Dmitry Maslennikov · Mar 23, 2017 go to post

Hi, I would not recommend thinking seriously about Caché in windows server core container, I think it is too early, yet.

Dmitry Maslennikov · Mar 15, 2017 go to post

Alexey, yes, it is very easy to build a little application just in one container. I don't see any problem, to use any supported technologies as well. Even also possible some load balancing from docker, which also good for microservices. I'm going to show some example with application in the next article soon.

Dmitry Maslennikov · Mar 15, 2017 go to post

I think in this case better to use property ReplyTo, which will be used in mail clients as an address for response.

Dmitry Maslennikov · Mar 14, 2017 go to post

$zf(-1) can only return status code from called process

To get some output result, you should redirect this output to some file, and read result from this file after executing.

set status=$zf(-1, "find /tmp -name *.tmp > /tmp/result.log")
set fs=##class(%Stream.FileCharacter).%New()
set fs.Filename="/tmp/result.log"
set result=fs.Read()
Dmitry Maslennikov · Mar 14, 2017 go to post

Stay tuned, I'm going to write next about it. In this article, we did a basic image. Wich will be as a source FROM for next images with some our application.

Dmitry Maslennikov · Mar 10, 2017 go to post

In Caché there is no any such classification for errors. Developer should decide it depends on his own tasks and needs.

Dmitry Maslennikov · Mar 10, 2017 go to post

%-variables, stored in local memory of the current process.

Process-private globals, implicitly stored in database CACHETEMP. 

It means, that when you use %-variables, you limited by the memory of your process, (which can be increased programmatically by the way). While Process-private global works exactly as simple global and limited only by free size on the disk. 

And also you should remember that you can not store objects in global variables, even if it is Process-private one.

Access to process-private variables also could be a bit slower than %-variables.

this port is from internal Apache which was installed by default with Caché. And should be used only in development.

For production, or pre-production, you should use some external WebServer, IIS (if you use Windows), Apache or Nginx. You can find more information about configuration all of this webservers, in the documentation.

I would recommend looking at HAProxy, I've used it only for HTTP, with about 10 ECP application servers. But while it can work with binary protocols as well, I think it should be useful. Quite easy to configure and monitor it.

I've been working with Caché now a bit less than before. But anyway I see that Atelier very slow, I'm typing much faster, then it can show what I wrote. And still exists some highlighting errors, which I've already described earlier.

Why do you ask about Postman here? 

For Postman does not matter which server do you use. Please go to their documentation, where you can also find some video tutorials.

Because, your UrlMap define only GET method, If you need more, you should add it to the same or any other methods.

And with CRUD, you should not put delete/insert inside URL, just use different HTTP methods with the same URL.

Dmitry Maslennikov · Feb 28, 2017 go to post

Why do you think it should be in this part of the documentation. It usual procedure. Almost everything possible to do programmatically, so, you can write a script for it. And there are lots of ways ho to do it. As for me, I think the bast way is to use Installer manifest.

Dmitry Maslennikov · Feb 28, 2017 go to post

Restoration database from the backup is only to restore database file CACHE.DAT. If you want to see this new database on that server, you should configure this server.

Dmitry Maslennikov · Feb 28, 2017 go to post

If you would look carefully to your code, you would see this place

all HTML should be between &html< and >

But in your code, some of HTML outside of this command.

Dmitry Maslennikov · Feb 27, 2017 go to post

Looks like you forgot to define web application for your REST Service.  Please look at the documentation. And at this part:

Each subclass that has its own entry point must have its own CSP web application. You define the CSP web application and specify its security for on the Management Portal’s [Home] > [Security Management] > [Web Application] page, which you can access by clicking System AdministrationSecurityApplications, and Web Applications. When you define the CSP web application, you set the Dispatch Class to the name of the custom subclass of %CSP.REST and specify the first part of the URL for the REST call as the name of the application.

Dmitry Maslennikov · Feb 25, 2017 go to post

Studio uses language from Regional Settings. Even when system's language is English, but you can use your regional settings (clock, number formats etc). And you can change to use default language inside Studio.

Dmitry Maslennikov · Feb 24, 2017 go to post

When you export and import this class to another namespace(s), you will have multiple different copies. I think much better to have the same class in all namespaces. You can do it with package mapping. And here you have two ways create a mapping in the each namespace where you need access to this class, or create special namespace %ALL, and configure mapping which will be available in all namespaces (except DOCBOOK and SAMPLES).

Dmitry Maslennikov · Feb 24, 2017 go to post

Since 2011.1 version was added %vid to achieve some paging functionality. Some more details.

SELECT *, %vid FROM (SELECT ....) v WHERE %vid BETWEEN 5 AND 10
Dmitry Maslennikov · Feb 23, 2017 go to post

Looks like, you call this service in the wrong way. I would suggest, that you call it by URL http://localhost:57772/csp/samples/REST.DocServer.cls while you should use this URL http://localhost:57772/csp/samples/docserver/namespaces But before you should activate application /csp/samples/docserver, for details look at the documentation.

Dmitry Maslennikov · Feb 16, 2017 go to post

As the last argument, you should use routine or classmethod, not command. 

csession CACHE -U"%SYS" "##class(%SYS.System).InstanceGUID()"