go to post Eduard Lebedyuk · Mar 30, 2017 What is "productdescription"? How do you access it now? Use this code to switch namespaces: new $namespace set $namespace = <Other namespace> do stuff Docs for $namespace, zn.
go to post Eduard Lebedyuk · Mar 29, 2017 From the class documentation on OSUserName: Operating system username of process. Username given to the process by the operating system when the process is created. When displayed, it is truncated to 16 characters. Note that the real O/S username is only returned when connecting to UNIX or VMS systems; For Windows, it will return the O/S username for a console process, but for telnet it will return the $USERNAME of the process. For client connections, it contains the O/S username of the client. This field is truncated at 16 characters. _Ensemble is a Caché user under which all Ensemble jobs are run. If you need to understand the context under which the service runs execute in a BS: do $zf(-1,"set > vars.txt") to output all environment variables to a file.
go to post Eduard Lebedyuk · Mar 29, 2017 There is no Cache function to do that. But as PDF contains readable "postscript" parts you can use regexp to search for relevant information. Stack. Article. It's not guaranteed to be precise though. Here's my article about using LibreOffice for work with documents. I've also used ghostscript and postscript to work with pdf from Caché and it's all fairly straightforward. Also, here's the code I wrote (execute is defined here) to add footer to every page of a PDF file using ghostscript: /// Use ghostscript (%1) to apply postscript script %3 /// Upon source pdf (%4) to get output pgf (%2) /// Attempts at speed -dProvideUnicode -dEmbedAllFonts=true -dPDFSETTINGS=/prepress Parameter STAMP = "%1 -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=%2 %3 -f %4"; ClassMethod stampPDF(pdf, psFile, pdfOut) As %Status { set cmd = $$$FormatText(..#STAMP, ..getGS(), pdfOut, psFile, pdf) return ..execute(cmd) } ClassMethod createPS(psFile, text) As %Status { set stream = ##class(%Stream.FileCharacter).%New() // For cyrillic text set stream.TranslateTable = "CP1251" set sc = stream.LinkToFile(psFile) quit:$$$ISERR(sc) sc do stream.WriteLine("<<") do stream.WriteLine(" /EndPage") do stream.WriteLine(" {") do stream.WriteLine(" 2 eq { pop false }") do stream.WriteLine(" {") do stream.WriteLine(" gsave") do stream.WriteLine(" /MyFont 12 selectfont") do stream.WriteLine(" 30 70 moveto (" _ text _ ") show") do stream.WriteLine(" grestore") do stream.WriteLine(" true") do stream.WriteLine(" } ifelse") do stream.WriteLine(" } bind") do stream.WriteLine(">> setpagedevice") quit stream.%Save() } /// Get gs binary ClassMethod getGS() { if $$$isWINDOWS { set gs = "gswin64c" } else { set gs = "gs" } return gs } Ghostscript can be used to get a number of pages in a PDF file. Here's how.
go to post Eduard Lebedyuk · Mar 28, 2017 In my case I need everything in the url as one argument. But that's also useful for some use cases.
go to post Eduard Lebedyuk · Mar 28, 2017 Thank you. That helped. Class Try.REST Extends %CSP.REST { XData UrlMap { <Routes> <Route Url="(.*)" Method="GET" Call="GET"/> </Routes> } ClassMethod GET(href) { w "OK" s ^dbg($i(^dbg)) = $g(href) q 1 } }
go to post Eduard Lebedyuk · Mar 28, 2017 Can documentation be expanded to include information about SQL search. I always forget&rediscover where things are and especially how they are related
go to post Eduard Lebedyuk · Mar 27, 2017 Check UserAction method of %Studio.Extension.Base class. You can call CSP pages from there.
go to post Eduard Lebedyuk · Mar 27, 2017 In your BO try: Set result = ..Adapter.FTP.MakeDirectory(.path) Adapter is EnsLib.FTP.OutboundAdapter and FTP is %Net.FtpSession. I would subclass the adapter and add MakeDirectory method there, with code pointing to the FTP method and status conversion.
go to post Eduard Lebedyuk · Mar 25, 2017 It's a valid sample. You just can't write directly into ZEN context. Well, you can, obviously, but that causes errors.
go to post Eduard Lebedyuk · Mar 25, 2017 You can use RESTForms. It supplies converting object-to-JSON and JSON-to-object.
go to post Eduard Lebedyuk · Mar 24, 2017 1. https certificate would apply to the cache and csp sites defined under IIS. It would apply to everyrhing really.2. Not sure about html landing page being a security threat. That depends on your setup. Do you embed http parts in your (future) https pages?I'd recommend as a first step to install let's encrypt certificate - it's free and easy.Then force http->https redirect on your iis server.After that check how your html landing page behaves.
go to post Eduard Lebedyuk · Mar 24, 2017 I think the issue of compilation order specification is more at fault here. Full compile from scratch (on a new instance) or a full recompile should work without errors every time. If it's not, set DependsOn keyword strategically.
go to post Eduard Lebedyuk · Mar 24, 2017 I'm not raising exceptions, but rather do logging. Here's the article.
go to post Eduard Lebedyuk · Mar 24, 2017 Thank you! That's very useful. Is there a way to return real implementation class? For example, consider these classes: Class App.Use { ClassMethod Test() { w 1/0 } } and: Class App.Use2 Extends App.Use { } If I call: do ##class(App.Use2).Test() I get the following CLS source line: App.Use2:Test+1 Yet, the relevant code is actually implemented in App.Use:Test+1 One approach I see is checking %Dictionary.MethodDefinition recursively till I find a method definition, but there's bound to be many problems multiple inheritance.