Robert Cemper · Jun 21, 2018 go to post

You can also create your own conversion function like this:

Class SQL.ext [ Abstract ]
{
ClassMethod fromUTC(ts As %TimeStamp) As %TimeStamp [ SqlName = fromUTC, SqlProc ]
{
 quit $ZDT($ZDTH($ZDTH(ts,3),-3),3,1,2)
}
}

Then you simply use

 SELECT SQL.fromUTC(CreationTime) FROM Table

to get the conversion​​​​​​​

Robert Cemper · Jun 21, 2018 go to post

You try to upload a file and JS Code a the same time during your SUBMIT action.
so your &js< ...> lands every 32000 characters inside your file.

&js<..> is just a hidden WRITE and allows javascript syntax checking inside the <.. >

example:

&js<alert('Unable to create user.');> 

is identic to 

Write "alert('Unable to create user.');",!

So your concept doesn't work that way
You would require a second independent JS routine in a browser to call for progress using CSP hyperevent.

Robert Cemper · Jun 20, 2018 go to post

method %ProcessError should output the real error but what you see is the result of ZT "JGTW"

Method %ProcessError(
fun As %String,
msgid As %Integer) [ Final ]
{
Use ..Gateway.GatewayDevice 
If fun="Y9" Do ..%ReadObjects(..Gateway) Quit
Set error=$zobjexport(12)
Set x=$$$ERROR($$$RemoteGatewayError,error)   
Use ..Gateway.CurrentDevice
Zt "JGTW"
}

 

Your error lands in the highlighted line. But as the method is FINAL you can't overload it.
Your original class System.Object might be a less restricted copy.

In addition, I see ZTRAP command this may explain why Try / Catch didn't react as expected.  

Robert Cemper · Jun 20, 2018 go to post

I was unable to identify the class System.Object you inherit for your proxy object.

But the methods you call are all available in  %Net.Remote.Proxy

so verify the definition of System.Object
or change your class to

Class writetofile.WriteFile Extends  %Net.Remote.Proxy  ProcedureBlock ]

I think you fail in %OnNew() in ..%Constructor(..)
I might be worth for testing to replace

Quit ..%Constructor(p0,"writetofile.WriteFile",0)

by 

Try {
     set obj=..%Constructor(p0,"writetofile.WriteFile",0)
}
Catch erroor  {.....   set obj=""}

Quit obj
Robert Cemper · Jun 20, 2018 go to post

you miss a check in your code

Set conn ##class(%Net.Remote.Gateway).%New()  // No error here
Set tSC conn.%Connect("127.0.0.1""55000""NETTEST"// No error here
 IF 'tSC  ...........  // check if connection was succesful
Set api ##class(writetofile.WriteFile).%New(conn) //Here comes the error
set strFile "d:\temp\example.txt"
set strInput "Hello world"
set ret api.FilePut(strFile,strInput)
Set tSC conn.%Disconnect()

Your connection may have failed, so next call will fail too, 

Robert Cemper · Jun 18, 2018 go to post

looking into %SYS code for  ^ERRORS(  was disappointing. 
WRC might have a better advice.

Robert Cemper · Jun 18, 2018 go to post

Yeah, I meant that.
You still may try from SMP>Administration>CSP Gateway Mgmt > Event Log to detect something.
Warning: I did this recently and found 4 years of log over  I don't know how many upgrades.
 

Robert Cemper · Jun 18, 2018 go to post

Was it the same machine?
+ a clean shutdown in 2015 ? 
Mounting your DB from Terminal "%SYS" may give you a better error message.

%SYS>d ^DATABASE
 
 1) Create a database
 2) Edit a database
 3) List databases
 4) Delete a database
 5) Mount a database
 6) Dismount a database
 7) Compact globals in a database
 8) Show free space for a database
 9) Show details for a database
10) Recreate a database
11) Manage database encryption
12) Return unused space for a database
13) Compact free space in a database
14) Defragment globals in a database
 
Robert Cemper · Jun 18, 2018 go to post

Did you take a look to ALL available namespaces? (I mean really checking the global)
there is ^ERRORS  in every namespace.
Since if your CSP is offroad  ^ERRORS can be too.

Robert Cemper · Jun 18, 2018 go to post

Hi Eduard,
I did something similar in past
only difference:

  • used #q1c1#  to make sure placeholders are embedded and don't conflict  with the real text
  • my table was in HTML with default row visibility HIDDEN
    only with actual content, it was set to VISIBLE.
    This allowed also to skip rows and have not only uniform rows
    and I could also play with styles.
Robert Cemper · Jun 17, 2018 go to post

Whatever OS you use you will need some driver-like code to control the state of the connection at HW level.

Next COS may listen on a TCP or UDP port or poll the driver on a regular base.
Dependent on the intelligence of the driver it may even start an appropriate sessiom from the command line. 
Or run a call-in to Caché over the published interface.

But it is always some code external to Cache´to handle the HW. 

Robert Cemper · Jun 16, 2018 go to post

Hi Ben,

from the hacker's toolbox:

Parameter MAXSTACK = 15;
Trigger TUpdateFoobar [ Event = INSERT/UPDATE, Foreach = row/object, Time = AFTER ]
{
  Try {
    // get value of Foobar
    NEW fb
    SET fb= {Foobar}
    IF $STACK > ..#MAXSTACK {
     // just for debugging
     wwrite "***",$STACK
         // INSERT value into embedded Primary Environments
         &sql(UPDATE ContainerObj (InnerObj_Foobar) 
              VALUES (:fb)
              WHERE %ID=:{ID})
    }
} Catch tError {
Do LOG^%ETN
Throw tError
}
}

You have to find out by "hacking"  a suitable value for MAXSTACK related to your application.
Inside the looping Trigger, there is no chance to identify the first run of the loop.

If you know a %variable (e.g. %BenMax) you may use it as well.
You only have to make sure it is initialized outside your trigger.  

IF $i(%BenMax) > ..#MAXSTACK {

With SQL you can initial %BenMax by a static (independent of row) WHERE Condition 

 INSERT ..... WHERE my.BENMAX()=1 and ....

The ClassMethod BENMAX may look like this:

ClassMethod BenMax(As %Integer = 1 ) As %Integer [ SqlName = BENMAX ]
{       set %BenMax=$s(n:n,1:1) quit 1    }
Robert Cemper · Jun 16, 2018 go to post

Congratulations!

That's real engineering. Getting control over the engine without modifying it.

yesyesyes

Robert Cemper · Jun 15, 2018 go to post

David,
I digged a little bit following your hint into Eclipse.

menu Windows / Prefernces (by user !) presented this image  


and this is the content of storage_location 

#Equinox secure storage version 1.0
#Fri May 25 19:54:27 CEST 2018
/com.intersystems.atelier.connmgr/ENS/port=\t,NTc3NzQ\=
/com.intersystems.atelier.connmgr/ENS/ssl=\t,ZmFsc2U\=
/com.intersystems.atelier.connmgr/2016-2/user=\t,cmNlbXBlcg\=\=
/com.intersystems.atelier.connmgr/2016-2/pass=org.eclipse.equinox.security.windowspasswordprovider64bit\tw+5qObI6N8Y\=,FVLqyPMCkoqq6Q7jjl0Wyw\=\=
/com.intersystems.atelier.connmgr/ENS/host=\t,bG9jYWxob3N0
/com.intersystems.atelier.connmgr/2016-2/ssl=\t,ZmFsc2U\=
/org.eclipse.equinox.secure.storage/verification/org.eclipse.equinox.security.windowspasswordprovider64bit=org.eclipse.equinox.security.windowspasswordprovider64bit\tvhjCbjyiXyI\=,kN4AlU0D0lskPVn+ZkduJBzTJLtNI69y
org.eclipse.equinox.security.preferences.keyFactory=PBEWithMD5AndDES
/com.intersystems.atelier.connmgr/2016-2/port=\t,NTc3NzI\=
/org.eclipse.equinox.secure.storage/windows64/encryptedPassword=\t,QVFBQUFOQ01uZDhCRmRFUmpIb0F3RS9DbCtzQkFBQUFITms3N0Z1ZTVVZTZuY1JuZUpLT0pnQUFBQUFRQUFBQVJRQnhBSFVBYVFCdUFHOEFlQUFBQUJCbUFBQUFBUUFBSUFBQUFMejUrdHB5MnVhUXVmWGIxNloyYm9kZGpNWFliNEFRdHBickJodnlwU0pPQUFBQUFBNkFBQUFBQWdBQUlBQUFBTHFOWmFFNUhnWTdBNytjRFhoQ1d5NVdIajJGcVJkVWNJTjVhS2l1NkVlQVlBRUFBSnRlODlWYWVkSFdLREh0OHY1aFhrc1NyL2RwaFVoWFV3V2RJNDdraXFhZk9RdVowK3ZVdUk4bzJFOUNwL2JtS2Q5YVc3WG9mN0YrQlBjOWhja0R1UXRWbzB3QkRuQkM4SW5MTWh1L2haVTNHRmhGODQxUEZSZHhOeDlVMmRjU0tFcXZtZEpVSXlQbjJZWWlEUWpMV2JnVEZ0Z1NlajVVV1RldUxPWEFUaXRSMDBqM1hTWjB0ZmlDK2ZlVE8rVEtIa3VkTnZXZGNBNS9UQ2gydDhOUEVWRHljd2F6WjVkK3IyOVdjS1BjVlNNaXFUTVZMR1FFdlB3M1ZPTUhhSVVUNTR4SEVOV3dncndJZ0J2S0JVU3NHVVVNSER2dE44MUJUNUEvVnc1TVR6VmMyNWkwUk4wandtRzUvSWJyaHhVSy81STFwanhaL0czRFJ1eGlZZWhpQkREM3JRTzdPSE5lVlRxdmk0bSt2cUxoQlUxYi9LcVNqSkNFMktLa2RGby9vaDRMeGJscHdhcHFOa09maURLZi8yVmpnTkd1UTRyVEJnVEIxSUpBRFA0TExZMWJyeUttV0dicE5adG1xRDBpVURCc3BQQ3FmOUh0L1BBSHV3a1lNUTFBQUFBQUkyS2RnYjVSajhXYmxSd0xXdGZZZndodmJ4eDFDR2tZYy9UNWI2eThLZFdrOUJSdTV6VzRneC9WTjVwemRTaVl0UjZnZVVBQmdHSkE0OVI3YXg5amxRPT0\=
/com.intersystems.atelier.connmgr/ENS/user=\t,cmNlbXBlcg\=\=
/org.eclipse.equinox.secure.storage/recovery/org.eclipse.equinox.security.windowspasswordprovider64bit/org.eclipse.equinox.security.internal.recovery.question2=\t,cHJlZmVycmVkIGJhbmQ\=
/org.eclipse.equinox.secure.storage/recovery/org.eclip
se.equinox.security.windowspasswordprovider64bit/org.eclipse.equinox.security.internal.recovery.question1=\t,bW90aGVyJ3MgbmFtZQ\=\=
/com.intersystems.atelier.connmgr/ENS/pass=org.eclipse.equinox.security.windowspasswordprovider64bit\tp9QyPCw3qvU\=,ZefLoWUenz48mT11jp1crA\=\=
org.eclipse.equinox.security.preferences.cipher=PBEWithMD5AndDES
/com.intersystems.atelier.connmgr/2016-2/host=\t,bG9jYWxob3N0
org.eclipse.equinox.security.preferences.version=1
/org.eclipse.equinox.secure.storage/recovery/org.eclipse.equinox.security.windowspasswordprovider64bit/org.eclipse.equinox.security.internal.recovery.password=org.eclipse.equinox.security.recoveryModule\tA0LP4JVoFdk\=,SzaccA06wSF+uh0AtcUhHwSgaGG6D2zZ1NOTJsm/ulkjaBmWAppasPrnkWJgOJb6C5insCpZcCyHKNPOOSKLXb1kuxkPDHo++9aEGbFxlbpmCO4p483ToK25KXgV0E+Gj5u4EPsHpsYvb4L4wAtyeESf0gZnbxKim3YqsFrim1SEuZKGoZH3QjYWxM0auPlFwnvgyK6RwfyznDbHvvWTtl4G3Hq4B1X3+cbqOdrkanDCjYFsQ2eutlddFe52AId+kqg1TplQL51PQFILIxHjg2LRmp2Qol321Oex7Oqk1iiddZmTeY/ToBTEzJCCdr1JbGIY5Pi3XJ3NRGyRF0rAsYC46+m6T3NmJsNid6I/V3t5BaOvFsxxfjfs9XXJ25RRWY6OiHbkp/dwsMaEMjy0zkEI3B4qvXOc7Gbf5wGyR9dXsqLEv2LzlDDY8Ne/kWU2v6J6S59EdU8\=
 

I doubt that without hijacking your (Windows ?) account this can NOT be misused.
 

Robert Cemper · Jun 15, 2018 go to post

Ruslan,

After execution, the JOB Command sets system variable $ZCHILD

$ZCHILD contains the ID of the last child process that the current process created with the JOB command. If your process has not used JOB to create a child process, $ZCHILD returns 0 (zero).

$ZCHILD being set does not mean that the job was successfully started. It only means that the process was created and the parameters were passed successfully.

Now you have the OIID in hands to apply to $System.Process.Terminate(bgjob) as suggested already by  Vitaliy Serdtsev

Robert Cemper · Jun 14, 2018 go to post

It's one of the rather hard to follow rules in XML that converted me into a fan of JSON

Robert Cemper · Jun 14, 2018 go to post

Alex,
add Parameter  

Parameter XMLTYPE = "A_CHILD";

to one of your child classes
inherited comment is somewhat vague:

/// This parameter provides the default XMLTYPE for the class. If it is
/// empty then the class name will be used to construct a default XML type.
/// 
/// The default XMLTYPE is used when naming and referencing this type
/// in a schema and the schema context did not provide an XML type name.

documentation  is more precise:

For an XML-enabled class or a property that is based on an XML-enabled class, the XML type is determined as follows:
If the class has a value for the XMLTYPE parameter, that is used as the type name.
Otherwise, the
short class name is taken as the XML type name.

so you would have 2 different classes with the same type:  CHILD
that's not allowed in an XML schema they have to be unique.

Robert Cemper · Jun 14, 2018 go to post

suggested OTHER WAY.

Run Cache locally and connect to the server over ECP.
So Atelier does a local access and the rest follows your rules.
So your standards are observed.
Managing this config might be some extra effort.

Robert Cemper · Jun 14, 2018 go to post

This is not Eclipse. What's your expectation?
JAVA is not a language used in Caché

Robert Cemper · Jun 14, 2018 go to post

OK, There wasn't much echo so far.

The workaround was to encode the Description (and limit it for indexing) according to the language used.
The encoding is basically the position in the list of allowed/used characters or character groups.
If we use also numbers and interpunctuation it has to go into our list.

Instead of %String the descriptions are stored in a serial class:

Class DC.ArticleSort Extends (%SerialObject)
{
Property Language As %String [ InitialExpression = ];
Property Description As %String(MAXLEN = "");
Property Sort As %String(COLLATION = "EXACT", MAXLEN = 300) [  SqlComputed,
       ,
SqlComputeCode = { Set {*} = ##class(DC.ArticleSort).Encode({Language},{Description}) }
      ,
SqlComputeOnChange = (Description, Language) ];
ClassMethod Encode( Lang As %String, Desc As %String(MAXLEN="")) As %String(MAXLEN=300)
{ ...replace valid characters by binary postion value ..  }
}

It's obvious that for English and your installed NLS no encoding is required.
For triplets or doublets like in Hungarian, you need several runs  to encode

The Query itself has a minor change

SELECT TOP 10 ArtNr,DescHU_Description FROM DC.Article
      WHERE DescHU_Description %STARTSWITH 'BE'
      ORDER BY DescHU_Sort

The encoding is definitely not fast but change frequency is not an issue here and change happens
by typing in descriptions on the keyboard.
Query performance is supported by this index construct:
     Index IdxHU On DescHU.Sort [ Data = (ArtNr, DescHU.Description) ]; 
So the query plan just iterates over this index.
 

Robert Cemper · Jun 13, 2018 go to post

class %SQL.Statement has a special property named %SchemaPath for this case.

property %SchemaPath as %String(MAXLEN="");

%SchemaPath provides a list of schema names for resolving unqualified names during statement preparation. By default, its value is null; to set its value, use a comma-delimited list of schema names

Robert Cemper · Jun 12, 2018 go to post

Check if in your Browser Cookies are enabled.

I just killed my license just by disabling cookies. And getting a new session for every click.

Robert Cemper · Jun 12, 2018 go to post

I agree with you!

But you know, 
reinventing the wheel is mostly much more fun than applying some existing tool and READING the user guide. laugh
Especially in the software business.
It's like hunting a rabbit or going to the butcher or even to the restaurant or order by web.