go to post Eduard Lebedyuk · May 12, 2023 Recently I wrote a snippet to determine which Business Host took to long to stop: Class Test.ProdStop { /// do ##class(Test.ProdStop).Try() ClassMethod Try() { set production = ##class(Ens.Director).GetActiveProductionName() set rs = ..EnabledFunc(production) if rs.%SQLCODE && (rs.%SQLCODE '= 100) { write $$$FormatText("Can't get enabled items in %1, SQLCode: %2, Message: %3", production, rs.%SQLCODE, rs.%Message) quit } while rs.%Next() { set bh = rs.Name set start = $zh set sc = ##class(Ens.Director).EnableConfigItem(bh, $$$NO, $$$YES) set end = $zh set duration = $fn(end-start,"",1) write !, $$$FormatText("BH: %1, Stopped in: %2, sc: %3", bh, duration, $case($$$ISOK(sc), $$$YES:1, :$system.Status.GetErrorText(sc))), ! if duration>60 { write !, $$$FormatText("!!!!!!! BH: %1 TOOK TOO lONG !!!!!!!", bh),! } } } Query Enabled(production) As %SQLQuery { SELECT Name , PoolSize FROM Ens_Config.Item WHERE 1=1 AND Production = :production AND Enabled = 1 } } It stops BHs one by one, measuring how long it took to stop each one. I would recommend you try to determine which items are taking too long to stop. Export production before running this code to avoid manually reenabling all the hosts.
go to post Eduard Lebedyuk · May 10, 2023 set sda3 = ##class(HS.SDA3.Container).%New() do sda3.InitializeXMLParse(.stream) while sda3.GetNextSDA(.type, .obj) { // process? }
go to post Eduard Lebedyuk · May 8, 2023 Are you using default Apache on Windows? Try to set ThreadsPerChild and ThreadLimit to 100 in <IRIS>\httpd\conf\httpd.conf and restart IRIS (or at least the webserver). After that 100 processes should be able to start (under appropriate load).
go to post Eduard Lebedyuk · Apr 29, 2023 Check this article. One of the most simple options - a CSP utility method which outputs all objects as a response. Just add this to any part of your code: set %response.ContentType = "html" do ##class(%CSP.Utils).DisplayAllObjects() return $$$OK
go to post Eduard Lebedyuk · Apr 28, 2023 Yes, either enable OS authentication for passwordless login or pass user/password as first two lines of the script.
go to post Eduard Lebedyuk · Apr 26, 2023 Check Ens.Config package - it has all production elements as structured tables/classes.
go to post Eduard Lebedyuk · Apr 24, 2023 I think it would be easier to write ndjson->json converter. Something like this: ClassMethod nd2json(file, dir) { set dir = ##class(%File).NormalizeDirectory(dir) quit:'##class(%File).Exists(file) $$$ERROR($$$GeneralError, "File " _ file _ " does not exist") if '##class(%File).DirectoryExists(dir) { do ##class(%File).CreateDirectoryChain(dir) quit:'##class(%File).DirectoryExists(dir) $$$ERROR($$$GeneralError, "Directory " _ dir _ " does not exist and creation failed") } set stream = ##class(%Stream.FileCharacter).%New() do stream.LinkToFile(file) while 'stream.AtEnd { set json = stream.ReadLine($$$MaxStringLength) //set out = ##class(%File).TempFilename("json", dir) // random order set out = dir _ $tr($j($i(count), 4), " ", 0) _ ".json" // if the order is important set outStream = ##class(%Stream.FileCharacter).%New() do outStream.LinkToFile(out) do outStream.Write(json) do outStream.%Save() kill outStream } }
go to post Eduard Lebedyuk · Apr 24, 2023 Before set sc=conn.PrepareW(hstmt,sql) add: set sql = $zcvt(sql, "O", "UTF8") It will make the string UTF8 encoded. Docs.
go to post Eduard Lebedyuk · Apr 24, 2023 Enabling OS authentication may be an option, but that's a global setting and not (easily) configurable per-user. But is there a way to configure OS authentication for one user only?
go to post Eduard Lebedyuk · Apr 24, 2023 Use caution with auto-play: Auto-playing GIFs can be distracting and annoying for some users, so use caution when deciding to have your GIFs auto-play. Consider giving users the option to play or pause the GIF. I think that's only videos.
go to post Eduard Lebedyuk · Apr 17, 2023 ISC's Interoperability business rule editor has some quirks; it does not allow the passing of variables by reference to custom methods Interesting. Can you post sample code please?
go to post Eduard Lebedyuk · Apr 17, 2023 Now, why isn't $ZOBJREF() in the documentation? What's the use case for this function? Here's some (autotranslated) info about thesefunctions. Also $zobjref accepts only integers, so you can pass just the part before @: set a={} set b={} set obj1=$zobjref(1) set obj2=$zobjref("1@Sample.Person") zw Results in: a=<OBJECT REFERENCE>[1@%Library.DynamicObject] b=<OBJECT REFERENCE>[2@%Library.DynamicObject] obj1=<OBJECT REFERENCE>[1@%Library.DynamicObject] obj2=<OBJECT REFERENCE>[1@%Library.DynamicObject] There's also no guarantee that the object would be the same i.e.: set a={"a":1} set b={"b":1} set aoref = ""_ a kill a set c={"c":1} set obja=$zobjref(aoref) zw obja > obja={"c":1} ; <DYNAMIC OBJECT>
go to post Eduard Lebedyuk · Apr 14, 2023 Depending on the fidelity you need, something like this would work: set str = "abc def! xyz" set punctuation = "'!""#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~" set strNoPuncuation = $tr(str, punctuation, $j("", $l(punctuation))) set strDedupeWhitespaces = $zstrip(strNoPuncuation,"<=>P") set out = $lfs(strDedupeWhitespaces, " ") Another approach. Simpler and likely faster but it will merge sentence ends without whitespace afterwards: set str = "abc def! xyz" set strNoPuncuation = $zstrip(str,"*P",," ") set strDedupeWhitespaces = $zstrip(strNoPuncuation,"<=>P") set out = $lfs(strDedupeWhitespaces, " ") Check $translate, $zstrip. If you want more fidelity/features check %iKnow.Stemming package.
go to post Eduard Lebedyuk · Apr 14, 2023 Replace Set tSC1 = tStream.Write(dynObject1.%ToJSON()) with: Do dynObject1.%ToJSON(tStream)
go to post Eduard Lebedyuk · Apr 12, 2023 I recommend you to check this article, but here's a summary: 1. Calculate a list of BHs which need a restart (not sure why you need regexp, all BHs are in Ens_Config.Item table): SELECT %DLIST(Name) bhList FROM Ens_Config.Item WHERE 1=1 AND Enabled = 1 AND Production = :production AND ClassName %INLIST :classList -- or some other condition 2. Restart them all at once instead of one by one: for stop = 1, 0 { for i=1:1:$ll(bhList) { set host = $lg(bhList, i) set sc = ##class(Ens.Director).TempStopConfigItem(host, stop, 0) } set sc = ##class(Ens.Director).UpdateProduction() }
go to post Eduard Lebedyuk · Apr 12, 2023 Why not map packages (also maybe use %ALL namespace to map to all namespaces at once)?
go to post Eduard Lebedyuk · Apr 12, 2023 1. Do you need to restart several BHs at once or do you need to restart them one by one? 2. How long does it take currently and what's your goal timing-wise?