go to post Vitaliy Serdtsev · May 26, 2017 And if so? d ##class(%Net.Remote.Utility).RunCommandViaZF($$$FormatText("dir /A-D /B /S %1",$$$quote("C:\InterSystems\Atelier")),.tFileName,,,$$$NO) s f=##class(%Stream.FileCharacter).%New() s f.Filename=tFileName while('f.AtEnd) {w f.ReadLine(),!} s f="" d ##class(%File).Delete(tFileName)
go to post Vitaliy Serdtsev · May 26, 2017 Anything with this flag can change or be removed with no warning. There are a few comments: Let's say that the developers changed something in new versions of the DBMS. Is this a problem? It is enough to check Caché Recent Upgrade Checklists, where usually there is a ready list of changes that may affect existing user code, for example. Note that this can apply to absolutely any member of a class, and not even marked as [Internal]. Suffice it to recall the recent story with JSON support. For a class does not exist flag [Internal], the warning is only on the level of comments. As for the other members of the class, according to the documentation this flag is for other purposes, namely: Internal class members are not displayed in the class documentation. This keyword is useful if you want users to see a class but not see all its members. proof In any case, the final choice for developer.
go to post Vitaliy Serdtsev · May 25, 2017 Does this example need to handle this? Correct, of course, to close the device: #include %systemInclude #dim cDev As %String = $IO ; see "dir /?" and RunCommandViaZF() d ##class(%Net.Remote.Utility).RunCommandViaCPIPE(...,.dev,.con) /* ... */ c:($get(dev)'="") dev:"I" u cDevAlso, do you not worry that its an internal class? No, since for me internal ≠ deprecated. However, given the openness of the source code, you can make own similar method, thereby to protect yourself from possible issues in the future.
go to post Vitaliy Serdtsev · May 25, 2017 $ZF() do $zf(-1,"pkzipc.exe -extr -over=all [and etc.]")Instead of pkzip, you can use 7z, rar, gzip32 etc.
go to post Vitaliy Serdtsev · May 24, 2017 <...> but maybe there's a better solution? Yes, of course. E.g. (for Windows x64): #include %systemInclude ; see "dir /?" d ##class(%Net.Remote.Utility).RunCommandViaCPIPE($$$FormatText("dir /A-D /B /S %1",$$$quote("C:\Program Files (x86)\Common Files\InterSystems")),,.con) ; string -> array d ##class(%ListOfDataTypes).BuildValueArray($lfs($e(con,1,*-2),$$$NL),.array) zw array
go to post Vitaliy Serdtsev · May 24, 2017 Pass-through if No DDL Mapping is FoundE.g.:CREATE TABLE Person (Name varchar(50), FavoriteColors %Collection.ListOfDT)CREATE TABLE Person (Name varchar(50), FavoriteColors %List)CREATE TABLE Person (Name varchar(50), FavoriteColors %ListOfDataTypes)
go to post Vitaliy Serdtsev · May 24, 2017 I would recommend instead of Google Translate use the service Yandex TranslateDirect link to a machine translation of the article from Yandex Translate.The quality of the translation in my think here are better.
go to post Vitaliy Serdtsev · May 24, 2017 The solution to this issue (and not only it) is described in the second part of the article in my blog (in Russian):$(REST - CSP - (-HyperEvents) + EasyUI + File Upload). Part 2The entire article consists of five parts.
go to post Vitaliy Serdtsev · May 20, 2017 And what this bill says is the documentation (What Is Caché?)?
go to post Vitaliy Serdtsev · May 17, 2017 Refine your version $zv. Perhaps in older versions there were bugs that were then fixed.Simple test:Class my.children Extends %Persistent{Property p1;Relationship parent As my.parent [ Cardinality = parent, Inverse = children ];Method %OnConstructClone( object As %RegisteredObject, deep As %Boolean = 0, ByRef cloned As %String) As %Status [ Private, ServerOnly = 1 ]{ s i%p1 = object.p1 _ " cloned" q $$$OK}}Class my.parent Extends %Persistent{Property p1;Relationship children As my.children [ Cardinality = children, Inverse = parent ];ClassMethod Fill(){ ;d ##class(my.parent).Fill() d ..%KillExtent() f i = 1:1:3 { s p = ..%New() s p.p1 = "parent["_i_"]" f j = 1:1:2 { s c = ##class(my.children).%New() s c.p1 = $$$FormatText("children[%1,%2]",i,j) d p.children.Insert(c) } d p.%Save() } zw ^my.parentD w !,"_______",!! f i = 1,3 d ..%OpenId(i).%ConstructClone($$$YES).%Save() ; or so - the result is the same ; f i = 1,3 d ..%OpenId(i).%ConstructClone($$$NO).%Save() zw ^my.parentD}Method %OnConstructClone( object As %RegisteredObject, deep As %Boolean = 0, ByRef cloned As %String) As %Status [ Private, ServerOnly = 1 ]{ s i%p1 = object.p1 _ " cloned" q $$$OK}}USER>w $zvCache for Windows (x86-64) 2017.2 (Build 672U) Wed May 10 2017 20:43:42 EDTUSER>d ##class(my.parent).Fill()^my.parentD=3^my.parentD(1)=$lb("","parent[1]")^my.parentD(1,"children",1)=$lb("","children[1,1]")^my.parentD(1,"children",2)=$lb("","children[1,2]")^my.parentD(2)=$lb("","parent[2]")^my.parentD(2,"children",3)=$lb("","children[2,2]")^my.parentD(2,"children",4)=$lb("","children[2,1]")^my.parentD(3)=$lb("","parent[3]")^my.parentD(3,"children",5)=$lb("","children[3,2]")^my.parentD(3,"children",6)=$lb("","children[3,1]") _______ ^my.parentD=5^my.parentD(1)=$lb("","parent[1]")^my.parentD(1,"children",1)=$lb("","children[1,1]")^my.parentD(1,"children",2)=$lb("","children[1,2]")^my.parentD(2)=$lb("","parent[2]")^my.parentD(2,"children",3)=$lb("","children[2,2]")^my.parentD(2,"children",4)=$lb("","children[2,1]")^my.parentD(3)=$lb("","parent[3]")^my.parentD(3,"children",5)=$lb("","children[3,2]")^my.parentD(3,"children",6)=$lb("","children[3,1]")^my.parentD(4)=$lb("","parent[1] cloned")^my.parentD(4,"children",7)=$lb("","children[1,2] cloned")^my.parentD(4,"children",8)=$lb("","children[1,1] cloned")^my.parentD(5)=$lb("","parent[3] cloned")^my.parentD(5,"children",9)=$lb("","children[3,2] cloned")^my.parentD(5,"children",10)=$lb("","children[3,1] cloned")
go to post Vitaliy Serdtsev · May 10, 2017 The next question is, what hashing algorithm is Cache using to create the hash?CRC32I will need to replicate that in JavaScript, or come up with some other hash approach.Localization for Client-side TextI assume $mvv(58) is set by the system when its installed? But can't find any information on that at the moment.$mvv(58) - Default Language for a session either user defined or CSP based.PS: Look at the source code %occMessages.inc - there's a lot of tasty there ;) or read the article in my blog, but it's in russian language :(
go to post Vitaliy Serdtsev · Feb 3, 2017 The only single problem here – there is no direct support for importing from .JSON files even for recent versions of Caché/Ensemble with builtin JSON support in the kernel.See %Library.DynamicAbstractObject:%FromJSON(), %ZEN.Auxiliary.jsonProvider:%ConvertJSONToObject(), %ZEN.Auxiliary.jsonProvider:%ParseFile(), %ZEN.Auxiliary.jsonProvider:%ParseJSON()Given:test.json: {"a":"test","b":[1,2,3,4]} s file=##class(%Stream.FileCharacter).%New() s file.Filename="C:\test.json" s file.TranslateTable="UTF8" d ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(file,,.obj) d obj.%Print() Output:-----------------a: "test"b: [1] 1 [2] 2 [3] 3 [4] 4
go to post Vitaliy Serdtsev · Feb 2, 2017 It seems to me that in this case is not well suited %SerialObject.Will be easier to use %List.
go to post Vitaliy Serdtsev · Feb 2, 2017 > Can I make a serial class always computed?Yes, of course.Class CS.Serial Extends %SerialObject [ NoExtent ]{Property Year As %Integer;Property Month As %Integer;}Class CS.Persistent Extends %Persistent{Property data As CS.Serial [ SqlComputeCode = {set {*} = ##class(CS.Persistent).dataGetStatic()}, SqlComputed, Transient ];ClassMethod dataGetStatic() As %List{ quit $lb(2017,1)}}Output:^CS.PersistentD=1^CS.PersistentD(1)=$lb("")ID data1 $lb(2017,1) 1 Rows(s) Affected
go to post Vitaliy Serdtsev · Feb 2, 2017 It all depends on what you wish to achieve.For example:Class CS.Serial Extends %SerialObject{Property Year As %Integer;Property Month As %Integer;Method %MyGetSerial() As %List [ ServerOnly = 1 ]{ q $lb(i%Year,i%Month)}}Class CS.Persistent Extends %Persistent{/// Property is triggered computedProperty data1 As CS.Serial [ SqlComputeCode = {set {*} = ..dataGetStatic()}, SqlComputed ];/// Property is always computedProperty data2 As %List [ SqlComputeCode = {set {*} = ##class(CS.Persistent).dataGetStatic()}, SqlComputed, Transient ];/// data getter method in SQL contextClassMethod dataGetStatic() As %List{ s s=##class(CS.Serial).%New(), s.Month=1, s.Year=2017 q s.%MyGetSerial() ; or q $lb(2017,1)}}---------select ID,data1,data2,data1_Month,data1_Year from CS.PersistentID data1 data2 data1_Month data1_Year1 2017,1 2017,1 1 20172 2017,1 2017,1 1 20173 2017,1 2017,1 1 2017
go to post Vitaliy Serdtsev · Jan 25, 2017 Try to use high level interface to work with sockets: %IO.Socket, %IO.SocketCommon.Look on %SYSTEM.INetInfo.Connected() [aka $ZUTIL(189)] or you can use tools of OS [for example see source code %SYSTEM.INetInfo.CheckAddressExist()]