go to post Robert Cemper · Feb 18, 2019 By XML bit I understand you have some myfile="<mynode>anytext</mynode>" or similar in handsso this should cover your needs:USER>set sc=##class(%XML.TextReader).ParseString(myfile,.reader)USER>zwrite @reader.GlobalName^||CacheTemp=1^||CacheTemp(1,1)=$lb("element","","mynode","mynode",0,1)^||CacheTemp(1,2)=$lb("chars","anytext","")^||CacheTemp(1,3)=$lb("endelement","","mynode","mynode")or is the content of myfile something else ??
go to post Robert Cemper · Feb 12, 2019 First, CACHETEMP doesn't maintain a Journal. (could be a minor advantage) .Second, CACHETEMP follows a different storage strategy as it is kept in memory (global buffers) as long as affordable.While for the other DBs data (global buffer blocks) get written to disk as soon as possible it is the opposite for CACHETEMP.Third, CACHETEMP is common to all namespaces.Forth, CACHETEMP is cleared at every restart and total empty after. I doubt that this could be useful in an ECP setup.
go to post Robert Cemper · Feb 12, 2019 to my understanding, there is no technical limit.Though I believe to remember that it used to be ~16.000 some time in past.Class SYS.Database maps to ^SYS("CONFIG","IRIS","Databases",<DBNAME>) and has NO limit theresimilar Namespaces are stored in SYS("CONFIG","IRIS","Namespaces",<NSPCE>) an are covered by %SYS.Namespace If there is any limit it must be related to internal memory structures. (gmheap ??)
go to post Robert Cemper · Feb 12, 2019 Use either $ZF(-1,...) or $ZF(-100, ... )or CPIPE to talk to your OS on command level.detals here:Execute Server Commands from Caché / Ensemble / IRIS
go to post Robert Cemper · Feb 8, 2019 see my 2 alternative solutions to use external adaptersClient for WebSockets based on CSPClient for WebSockets based on Node.jsand thanks again for the inspiration.It was just in time for a business project.
go to post Robert Cemper · Feb 6, 2019 In addition to the reply from @Evgeny Shvarov :INT is highly important to identify error locations.eg. <DIVIDE>label+5^routinename refers to the location in routinename.INT
go to post Robert Cemper · Feb 5, 2019 Out of curiosity, I have built a more exotic solution that is easier to understand. (At least for me)I don't like so much this protocol upgrade stuff and encrypting and simulation of a browser.My personal workaround:start browser over ZF(-1, "start chrome http://.................my csp......")the page gets my request passed with the URL. very simple just as a Hashthe page does all the WS stuff via JavaScriptthe reply is returned using Hyperevent #call(....) It works fine and is rather "classic CSP" style.
go to post Robert Cemper · Feb 5, 2019 OK.I tried it and found: sock.Open( does not accept "/ws/v2/?&token=<token>" only the server nameUSER>set sock = ##class(%IO.Socket).%New()USER>do sock.Open("localhost/csp/samples/Web.SocketTest.cls",8080,5,.sc) //// >>> Timeout/// but this worksUSER>do sock.Open("10.10.12.87",57772,5,.sc) zw scsc=1USER>zw socksock=<OBJECT REFERENCE>[2@%IO.Socket]+----------------- general information ---------------| oref value: 2| class name: %IO.Socket| reference count: 2+----------------- attribute values ------------------| (%Attached) = ""|(%CurrLineTerminator) = ""| AtEnd = 0| CharEncoding = "Native" <Set>| Host = "10.10.12.87"| InputBufferSize = 32767| IsOpen = 1 <Get>| IsSingleByte = ""| KeepAliveInterval = 0| LineTerminator = $c(10)| LocalInterface = ""| Name = "|TCP|57772|20242"| OutputBufferSize = 32767| Port = 57772| Remote = "2019-02-05 10:33:35.212|10.10.12.87:57772"| SSLConfig = ""| TCPReceiveBuffer = 0| TCPSendBuffer = 0| TranslationTable = "RAW" <Set>+----------------- swizzled references ---------------|i%DisconnectHandler = ""|r%DisconnectHandler = ""+--------------- calculated references ---------------|DefaultFlushOnWrite <Get>| IsCharacter <Get>+-----------------------------------------------------USER>Now you have the connection BUT no server to take care of it as you see:USER>do sock.WriteLine("/csp/samples/Web.SocketTest.cls",1,.sc) zw scsc=1USER>write sock.ReadAny(32000,5,.rSC) zw rSCHTTP/0.9 404 Stream Not FoundContent-Type: text/html; charset=utf-8Date: Tue, 05 Feb 2019 10:45:16 GMTExpires: Tue, 05 Feb 2019 11:45:16 GMTrSC=1Investigating the browser it became clear what's going on:- you begin with HTTP to start your WebSocketServer- an then initiate the WS connection.This is the output from TcpTrace: >>>>> GET /csp/samples/websocketdemo.csp HTTP/1.1 >> .......<<<<< HTTP/1.1 200 OK << Date: Tue, 05 Feb 2019 10:55:01 GMT << Server: Apache <<<<...>>>>> GET /csp/samples/Web.SocketTest.cls HTTP/1.1 >> ... >> Upgrade: websocket<<<<< HTTP/1.1 101 Switching Protocols << Upgrade: websocket << Connection: Upgrade << Sec-WebSocket-Accept: That's my point: With the actual approach starting the requres WS Server is missing.
go to post Robert Cemper · Feb 4, 2019 To me, this looks like your port doesn't like WS as initial connection protocol but expect the switch from HTTPS -> WSS or the port is just wrong.several suggestions for the investigation to get it moving:#1) verify your server from a normal web page (e.g. based websocketdem.csp in Samples) especially the port !!!!#2) If you have control over your server then skip SSL and get running over HTTP -> WS first. You can add this once it works.#3) If you have no server just use Caché / SAMPLES / Web.SocketTest.cls I found it very useful to have control over both ends and now I own several variants for testing.Staying tuned
go to post Robert Cemper · Feb 4, 2019 YES! you can!Just extend the method (just some example)ClassMethod exmple(inout As %String) As %String [ SqlName = Example, SqlProc ]{ do prepare^myMumps(inout) set return=$$return^myMUMPS() ;;; or whatever is required return "Echo:"_return }
go to post Robert Cemper · Feb 4, 2019 #1) if it is a Caché Backup you need an Installation of Caché to restore it.#2) if it is a CACHE.DAT file you also need an installation of Caché and mount this as an additional DataBase.Without the installation of Caché it's a thrilling exercise to high-level experts. Not really advisable.try to have the same processor type { big / little endian :== (Intel/AMD) or not } as the original Caché instances. This saves some headache.Forget about SQL Server. Caché is far more efficient and advanced technology!
go to post Robert Cemper · Feb 4, 2019 #1)You need to get %Net.HttpRequest in hands to set your property Content Type.#2)instead of PutURL(...) you have to use method SendFormDataURL(....) of EnsLib.HTTP.OutboundAdaptermore details in docs here:Creating Custom HTTP RequestsIf you use the more common methods of the HTTP outbound adapter (such as Get), the adapter automatically creates and sends an HTTP request, which can include either form data or a request body. In special cases, you may want to create a custom HTTP request so that you can specify details such as proxy authorization or a different character encoding.To send the custom request, use the SendFormDataArray() method of the HTTP outbound adapter as described in “Calling HTTP Commands” in the previous chapter. Then see the chapter “Sending HTTP Requests and Reading HTTP Responses” of Using Internet Utilities.
go to post Robert Cemper · Feb 1, 2019 $ZDATETIME($NOW(),3) should fit. You then have the Seconds too.
go to post Robert Cemper · Jan 27, 2019 at first sight, I miss in this piece of codeClassMethod GetPage() As %String) [ ZenMethod ]{ quit %session.Data("currPage") }andvar pageNo = zenPage.GetPage() ;
go to post Robert Cemper · Jan 26, 2019 I'd personally prefer that $LB(var) also follows the elementary rules of COS.Though I have no hope on any ProdLog on this subject
go to post Robert Cemper · Jan 26, 2019 as pointed out by Alexander Koblov already:you can create a $LB() od $LB(undefined) and it's all the same set a=$LB() zzdump a 0000: 01 or write $d(undefined) 0 set a=$lb(undefined) zzdump a 0000: 01 Your coincidence of NULL, null, Null, nuLL, .... is just an optical eye-catcher without syntactical relevance in COS
go to post Robert Cemper · Jan 24, 2019 You could use the feature that any Classmethod may also serve as Stored Procedure.Like this: Class User.Remote{ClassMethod Echo(inout As %String) As %String [ SqlName = Demo, SqlProc ]{ return "Echo:"_inout }}And then you may call your Procedure like this: getting backSELECT DEMO('hello WORLD') getting back Echo:hello WORLDAll you have to care for is to return something.what happens inside your ClassMethod is up to you and doesn't need to be related.
go to post Robert Cemper · Jan 21, 2019 As you have an installation of Caché you will also have the Documentation with it.I recommend "Using Caché ObjectScript" to start with ObjectScript.It is also public accessible https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCOSI also recommend having a look at the free online training library.The link is in the header of this forum: LEARNINGBrowse Catalog and search for O bjectScript BasicsAll details on individual commands, functions, system variables are again in your local instance or in thepublic reference on docs.intersystems.com
go to post Robert Cemper · Jan 20, 2019 My personal preference is to a have a solution NOW.And not wait for something that may take too long for me.just the most simple example to solve your issue with a ClassMethod: Class nodes.Select{ClassMethod Address1(town As %String = "") As %String{ set (list,id)="" for { set id=$o(^Customer(id)) quit:id="" if ^(id,"Address",1)=town set list=list_$lb(id) } return "["_$lts(list)_"]"}}