Question Eduard Lebedyuk · Feb 21, 2019 How do I convert timestamp to utc? I have a date in this format: "YYYY-MM-DD HH:MM:SS+HHMM" how can I convert it to UTC? write $zdth("2018-02-01 00:00:00+0600",3,5) >64680,0 write $zdt("64680,0",3,5) >2018-02-01T00:00:00+03:00 As you see, timezone is lost. Docs for $zdth in timeopt (5) state: Specify time in the form "hh:mm:ss+/-hh:mm" (24-hour clock). The time is specified as local time. The following optional suffix may be supplied, but is ignored: a plus (+) or minus (–) suffix followed by the offset of local time from Coordinated Universal Time (UTC) #Beginner #Caché 0 2 0 1.9K
Question Eduard Lebedyuk · Feb 21, 2019 SetIdentityInsert system-wide? SetIdentityInsert call controls the ability of the user to specify a value for the IDENTITY property when saving a new object, a value for the IDENTITY column or an explicit ROWID value in an SQL INSERT. If IDENTITY_INSERT is false and the user specifies an explicit IDENTITY or ROWID value when saving a new object or inserting a new ROW then an error condition is reported.Setting takes effect immediately and lasts for the duration of the process or until SetIdentityInsert is called again.My question is how can I change this setting system-wide? #SQL #Caché 0 2 0 289
Question Eduard Lebedyuk · Feb 18, 2019 "Pause" BPL business process on error I have a business process.if it has an error it dies, or if a have a catch all/fault handler the execution flow goes there.However, I want another behavior.If any error occurs I want the process to "Pause" (and alert me), so I can figure out what went wrong and resume from the last request.Here's an example of how it could work:If an error is caught, call BOBO defers responseBO sends alertFix BPManually resolve deferred responseI'm not set on the exact pause/resume mechanic but I hope it makes the general idea of what I want clear enough. Ideas? #Business Process (BPL) #System Administration #Ensemble 0 4 0 278
Question Eduard Lebedyuk · Feb 6, 2019 Populating test/initial data How do you populate and update test/initial data for you classes?CSV tables? Globals export? And how do you update test data?Here's one way I found useful for small projects. #Continuous Delivery #Deployment #System Administration #Caché 1 3 0 473
Question Eduard Lebedyuk · Feb 4, 2019 Consume data from websocket I want to consume external websocket api, URL looks like this: wss://site.com/ws/v2/?&token=<token> Checked with external tool (Simple WebSocket Client) that websocket works and I can consume the data.In Cache the relevant functionality is offered by %IO.Socket class. set sock = ##class(%IO.Socket).%New() set sock.SSLConfig = "MyEmptySSLConfig" set sock.TranslationTable="UTF8" do sock.Open("site.com/ws/v2/?&token=<token>","443", 10,.sc) However I get this error: #Frontend #SOAP #Caché 0 17 0 1.3K
Question Eduard Lebedyuk · Jan 26, 2019 NULL placeholder in $List functions? Today in docs I found this example using NULL: WRITE $LISTVALID($LB(NULL)),! simplified zzdump $LB(NULL) and NULL can be case-insensitive: zzdump $LB(null) seems the same as just: zzdump $LB() But if null variable is defined then list would contain value from variable. Case sensitive in that situation. Does anyone have any Idea what is this? Is NULL used anywhere besides as a list element? #Beginner #ObjectScript #Caché #InterSystems IRIS 0 5 0 330
Question Eduard Lebedyuk · Jan 24, 2019 Should a property be quoted in object context or not Let's say I have a property as a variable value: set propName="Country" Is there a method to determine, should I quote it to access the object, so would the correct code be: write obj."Country" or just simple write obj.Country is enough? #Beginner #Data Model #Caché #InterSystems IRIS 0 4 0 298
Question Eduard Lebedyuk · Jan 17, 2019 String or Stream in the same persistent property? I have a persistent class.I want to store one of the properties there as a stream or a string depending on a size.99% of values would be strings (less than $$$MaxStringLength characters) so I don't want to store everything as streams.What do you think of this approach?What's the best architecture to implement in this situation? #Beginner #SQL #Caché 0 4 0 541
Question Eduard Lebedyuk · Jan 9, 2019 Work with devices connected via RS422/RS485 I connected from InterSystems Cache to devices connected via RS232 (commonly known as COM-port).Can the same be done with devices connected via RS422/RS485 interfaces? #Interoperability #Caché 0 2 0 210
Question Eduard Lebedyuk · Dec 27, 2018 Pattern matching with '*' and '?' I have an in-memory list of items and I want to check which items match my pattern string.Pattern string is a comma-separated list of items and special symbols like '*' and maybe '?'.There's something similar in $system.OBJ.Compile, it accepts patterns: "*.data.*,Sample.*" - and it would compile 'Sample' package and all 'data' packages.For example: set list=$lb("abc", "c", "aaa", "bbb") set result = ..match(list, "a*,*b") zw result result=$lb("abc","aaa","bbb") #Beginner #Caché 0 7 0 693
Question Eduard Lebedyuk · Dec 16, 2018 Debugging callout library <DYNAMIC LIBRARY LOAD> I have a simple callout library: #define ZF_DLL #include #include #undef ERROR int GetRandom(double* random) { // Py_Initialize(); // Py_Finalize(); *random = 1.0; return ZF_SUCCESS; } int main(int argc, char **argv) { printf("Random: "); double random=0; GetRandom(&random); printf("%lf", random); return 0; } ZFBEGIN ZFENTRY("GetRandom","D",GetRandom) ZFEND I compile this code as a shared library and it works fine with: #Caché #Callout 0 4 0 476
Question Eduard Lebedyuk · Dec 5, 2018 How do I specify System Default Setting for Production setting Added new System Default Setting for Production (not Host) setting.However, Production setting is still the same. I have tried restarting Production and instance, to no avail.How do I specify System Default Setting correctly?Production: #Beginner #Ensemble #Interoperability 0 3 0 493
Question Eduard Lebedyuk · Dec 2, 2018 Read command to get a line longer than 32767 symbols I'm using this code to read a file, line by line.Most lines are shorter than 32767 symbols, but some are longer. No line is longer than $$$MaxStringLength and long strings are enabled.Is there a param to Open/Read command I can pass to increase Read limit?My code: #Beginner #Caché 0 3 0 254
Question Eduard Lebedyuk · Nov 16, 2018 Update existing objects from XML I have a XML enabled persistent class and a XML representation of some object of this class (object ID is available).How can I use XML Reader (or some other mechanism) to automatically update this object? #Beginner #Object Data Model #ObjectScript #XML #Caché 0 4 0 529
Question Eduard Lebedyuk · Aug 29, 2018 How to replace $lb elements with empty elements I have a list set list=$lb(1,$c(0),2) How do I replace $c(0) with an empty element? My list should look like this: set list=$lb(1,,2) I tried using $list but it either replaces the element with an empty string: set $list(list,2)="" zw list Resulting in: list=$lb(1,"",2) Or removes the element altogether: set $list(list,2,2)="" zw list Resulting in: list=$lb(1,2) #Beginner #Caché 2 2 0 362
Question Eduard Lebedyuk · Aug 28, 2018 Replace elements in $lb Let's say I have a list structure: set list = $lb("stri,ng", $c(0), 2) I want to replace all $c(0) elements with empty elements, so my list would look like: set list = $lb("stri,ng", , 2) What's the fastest way to do that? #Beginner #Caché 0 13 0 558
Question Eduard Lebedyuk · Aug 27, 2018 Return $lb from Java Gateway call I want to call java method and return $lb structure from it.JDBC jar seems to contain relevant class - com.intersys.jdbc.CacheListBuilder, but so far I only managed to return a string that looks like a list.Here's my java code: #Caché #Interoperability #Java #Ensemble 0 3 0 319
Question Eduard Lebedyuk · Aug 13, 2018 Forbid extending my class I have a class (to be deployed) and I want to forbid anyone from extending it.Is there any way to do that? #Caché #InterSystems IRIS #Security 0 21 0 535
Question Eduard Lebedyuk · Jul 6, 2018 Multi-line terminal commands Let's say I have this simple script file try.script write 1 write 0 I can execute it in a terminal (csession) by calling: csession cache < try.script And I get the following output: %SYS> 1 %SYS> 0 However I want to use a try catch block in my script: try { write 1/0 catch {} halt But as script is executed line by line, it's interpreted like this: #Beginner #Caché #Terminal 0 8 0 1.1K
Question Eduard Lebedyuk · Jun 25, 2018 ZEN reports - non latin PDF output How do I get non latin text in PDF mode for ZEN reports?Currently cyrillic test is rendered as ####: #Caché #ZEN 0 2 0 266