Eduard Lebedyuk · Aug 14, 2018 go to post

I believe it's enough to have [Final] keyword set in deployed mode to give a developer a hint that this class should not be extended.

Well, it's mainly for developers who can't take a hint.

If you want to enforce this behaviour, I would add a check into each method as a first line , something like

if $this.%ClassName(1)'="My.Class" quit $$$ERROR(50000,"don't extend this class")

Good idea.

You can also try to add a method-generator, I believe when you have a deployed class with method generator it will not be able to compile a subclass without method generator's source (though I'm not sure).

At first it didn't work - method generator by default works while deployed. Then I added a class check to generator.  Compilation was now failing, but other methods were actually compiled so I was able to call them. Finally I worked out this solution:

Class Package.Final [ Final ]
{

ClassMethod ANoExtend() [ CodeMode = objectgenerator, Final, ForceGenerate, Private ]
{
    quit:%class.Name="Package.Final" $$$OK
    quit $$$ERROR($$$GeneralError, "No extending")
}

ClassMethod ProtectedMethod() As %Status [ Private, ForceGenerate, GenerateAfter = ANoExtend ]
{
        // code
    quit $$$OK
}
}

This way each protected method should be recompiled but only after method-generator which always fails in subclasses. This way no code gets generated.

Eduard Lebedyuk · Aug 14, 2018 go to post

ReadOnly database could be made Read-Write. I assume developer has complete access to Cache and underlying OS.

meta data of class definition is included in the read only database

It is.

Eduard Lebedyuk · Aug 13, 2018 go to post

I don't have a %request.

Checked again and my suggested approach only works on production start, not host start, sorry.

I have a function which actually run "write $USERNAME" and if I run it from Studio returns the username!

$username returns current user, which for Ensemble job is correctly _Ensemble. You can try to query audit database for that info I guess.

Eduard Lebedyuk · Aug 13, 2018 go to post

Username would be _Ensemble because Ensemble switches users.

Tried OnInit, available context is not enough there:

Method OnInit() As %Status
{
    break
}

And here's the break:

break
 ^
<BREAK>zOnInit+1^Demo.Workflow.WFMetric.1
ENSDEMO 7e1>zw
 
%Ensemble("ArchiveFlags")=""
%Ensemble("ArchiveFlags","Demo.Workflow.WFMetric")=""
%Ensemble("ArchiveFlags","Demo.Workflow.WFMetric","iCfg")=0
%Ensemble("Config","%ModIndexFlag")=1
%Ensemble("ConfigName")="Demo.Workflow.WFMetric"
%Ensemble("Debug","TraceCat","My Terminal Output")=0
%Ensemble("Debug","TraceCat","My Terminal Output","user")=1
%Ensemble("Debug","TraceCat","user")=1
%Ensemble("DoTrace")=2
%Ensemble("JobKey")=10548
%Ensemble("LogSystemTrace")=0
<Private variables>

Thought about $zparent but it didn't help too:

ENSDEMO 7e1>w $system.Process.UserName($zparent)
CSP Gateway
Eduard Lebedyuk · Aug 13, 2018 go to post
set c=##class(%Dictionary.ClassDefinition).%OpenId("Deployed.Class")
set c.Final=0
write c.%Save()

And after that compiling subclasses would be possible.

Eduard Lebedyuk · Aug 13, 2018 go to post

Deploying does not prevent user from removing Final keyword.

Deploying only prevents user from easily modifying source code.

Eduard Lebedyuk · Aug 13, 2018 go to post

Final keyword can be removed and the class extended.

To clarify, I want to deploy a class that the user would be unable to extend while having access to the system.

Eduard Lebedyuk · Aug 13, 2018 go to post

As I said

they are not as reliable as audit database.

First one may not work at all, try safe get: $g(^CacheTemp.EnsUsername($job)).

Second one wouldn't work outside of CSP/ZEN context. Check that %request exists and is an object before calling GetCookie method.

Eduard Lebedyuk · Aug 10, 2018 go to post

Audit database contains correct username:

You can also get Username by these two ways:

  • write ^CacheTemp.EnsUsername($job)
  • write %request.GetCookie("Username")

But they are not as reliable as audit database.

Eduard Lebedyuk · Aug 8, 2018 go to post

$get works as fast as global could be read. Some ideas:

  1. You can use ^PERFMON to see how these two globals are read - from disk or from memory. To do that collect 2 reports - with only ListGlobal load and only StringGlobal load and compare Physical reads.
  2. Are both globals the same size?
  3. How's globals size relative to global buffer?
Eduard Lebedyuk · Aug 8, 2018 go to post

You can to change default file I/O from GB18030 to UTF8.

To do that, execute do ^NLS and choose:

2) Select defaults
2) I/O tables
4) File

And choose UTF8 there. After that, your I/O table should look like that:

I/O table              Current default
---------------------  --------------------
....
4) File                UTF8 (*)

After that, restart Cache and delete/reimport faulty files in Atelier

Note that this action (changing NLS defaults) can be disruptive to existing Cache applications.

Eduard Lebedyuk · Aug 8, 2018 go to post

Let's see Cache locale.

Open Cache terminal and execute:

zn "%SYS"
do ^NLS

There, choose 1) Display current locale and copy the output (should be two screens) here.

Eduard Lebedyuk · Aug 7, 2018 go to post

If you're sure that your id bigger ids are generated later, you can only get the first id from index and after that iterate the data global directly:

set FromDateH = (+$h-1)
set id = ^TestI("StartDateIDX",FromDateH,id)
for {
    set id=$order(^TestD(id),1,dat)
    quit:id=""
    //dat=$lb("a","b","c","d","e")
}

Also you can use three-argument form of $order to iterate and get data in one command.

Finally, consider checking work-heavy system with %SYS.MONLBL to verify what lines consume more  time.

Eduard Lebedyuk · Aug 5, 2018 go to post

InterSystems Cloud Manager can deploy to Azure. First Look for ICM is a step by step guide to run InterSystems IRIS in a cloud.

Generally you need to run ICM locally (or on some preexisting server)  and then specify a configuration of what you want. ICM would then provision the servers, install InterSystems IRIS, etc.

Eduard Lebedyuk · Aug 4, 2018 go to post

There are many ways to launch InterSystems IRIS.

If you want to launch it on AWS you can do it one of the following ways.

  1. Provision a EC2 instance with SUSE/RHEL/Ubuntu AMI and install InterSystems IRIS on Linux. Here's the guide. Quickstart.
  2. Provision a EC2 instance with SUSE/RHEL/Ubuntu AMI, install Docker and run InterSystems IRIS  in a container. Documentation. First Look.
  3. Use InterSystems Cloud Manager to provision AMI and run InterSystems IRIS. Documentation. First Look.

What to choose?

  • If you need to run a lot of or a variable number of servers choose 3.
  • If you're unfamiliar with Docker choose 1.
  • If you're familiar with Docker (or want to become familiar with it) choose 2.
Eduard Lebedyuk · Aug 2, 2018 go to post

Application code opens transaction somewhere but does not commit or rollback it.

Check  <code>  elements, maybe there's a TSTART there somewhere.

Eduard Lebedyuk · Jul 29, 2018 go to post

Setting the credentials on the Operation did not work.

Do you redefine request object in your own code? It really should and does work. Please consider posting an example.

Eduard Lebedyuk · Jul 26, 2018 go to post

Depending on PDF type (character-based) using GZIP file stream may provide additional size advantages.

Eduard Lebedyuk · Jul 24, 2018 go to post

It would be easier to start and finish the transaction in one method (or rather one request to a BO).

Why not send the request to BO containing a list of UPDATES to perform and BO would automatically wrap them in a transaction, returning either a success or error and the position of failed UPDATE statement? Even better send list of some struct and construct statements in BO.

While workarounds are possible (1 Job for BO + indefinite timeout + FIFO on caller part) it would probably be a bad idea.

Eduard Lebedyuk · Jul 23, 2018 go to post

Have you tried setting autocommit off and calling COMMIT/SET TRANSACTION NAME/ROLLBACK manually?

I think that would get the results you need.

Eduard Lebedyuk · Jul 23, 2018 go to post

1: How can the httprequest object be viewed in Ensemble?

You can use DEBUG=2, to see the output you need to start your BH in Debugging mode.

Another option would be to install Debugging proxy such as Fiddler and specify ProxyServer/ProxyPort settings in your BH.

Finally, you can install packer sniffer such as WireShark and see the raw packets.

These options are discussed more in detail in my series of articles Debugging Web: part1, part2.

2: How is the Adapter password set?

No need to write code for that, just set Credentials setting in your BH.