go to post Eduard Lebedyuk · Jun 29, 2016 Based on Alexanders comment, I think this should work. <form method="post" action=""> <table> <tr><td><textarea rows="40" cols="200" name="submitstring"></textarea></td></tr> <tr><td><select name="decodeoption"><option>Decode</option><option>Encode</option></select><input type="submit"/></td></tr> <tr><td> </td></tr> <tr><td><h2>Result</h2></td></tr> <tr><td> <script language=Cache runat=server> Set tString = $Get(%request.Data("submitstring",1)) Set tAction = $Get(%request.Data("decodeoption",1)) If tAction = "Decode" { Set tString = $SYSTEM.Encryption.Base64Decode(tString) Set tOutput = $ZCONVERT(tString,"I","UTF8") } Else { Set tString = $ZCONVERT(tString,"O","UTF8") Set tOutput = $SYSTEM.Encryption.Base64Encode(tString) } Write tOutput </script> </td></tr> </table> </form> I added UTF8 conversion: Set tOutput = $ZCONVERT(tString,"I","UTF8") and Set tString = $ZCONVERT(tString,"O","UTF8")
go to post Eduard Lebedyuk · Jun 28, 2016 It may be useful as one of the metrics related to the code quality/monitoring.For example, my continuous integration system Cache GitHub CI tracks compile time for each commit, and if it suddenly grows, then the offending commit may be worth looking into. But if we add one other metric - "lines of code added", then some of the offending commits may be removed based on a now determinable fact that a raise in compilation time is caused by a project size increase.On the screenshot: compilation time (Length column) for some commits in a real-life project. Other usage - find classes longer than, for example, 500 sloc and separate them into several classes.
go to post Eduard Lebedyuk · Jun 28, 2016 Thanks.In regards to the documentation, I'd like to clarify that it refers to a database page accessible atSMP → System Operation → Databases, and not SMP → Menu → Configure Databases.
go to post Eduard Lebedyuk · Jun 24, 2016 Triggers are, unfortunately, not an option as MySQL table gets updated via backup (so it's DROP TABLE -> CREATE TABLE -> INSERT)
go to post Eduard Lebedyuk · Jun 22, 2016 OnStart gets executed before queries, see Ens.Director class, StartProduction method.Or you can execute EnableConfigItem on an item of a disabled production.
go to post Eduard Lebedyuk · Jun 21, 2016 You can close the cursor and open it again: ClassMethod Test() { &sql( DECLARE C1 CURSOR FOR SELECT TOP 10 ID INTO :id FROM Sample.Person ) &sql(OPEN C1) &sql(FETCH C1) Set first = $$$YES While (SQLCODE = 0) { Write id,! &sql(FETCH C1) If id=9 && first { Set first = $$$NO &sql(CLOSE C1) &sql(OPEN C1) &sql(FETCH C1) } } &sql(CLOSE C1) }
go to post Eduard Lebedyuk · Jun 21, 2016 REST service can be implemented in Caché itself, via %CSP.REST. Documentation.
go to post Eduard Lebedyuk · Jun 21, 2016 Zen Mojo is a set of classes that enable you to create web pages, suitable for either mobile devices or desktops.ZEN Mojo is a new and improved ZEN.
go to post Eduard Lebedyuk · Jun 21, 2016 If you are familiar (proficent) with ZEN use ZEN Mojo.If not, write HTML/JS/CSS client and REST server.That said, DeepSee would definitely be an easier solution to implement and more robust overall.
go to post Eduard Lebedyuk · Jun 21, 2016 Use DeepSee - Intersystems analytics technology. It can be embedded in transactional systems to enable users to make decisions based on real-time analysis of structured and unstructured data.There's a sample Patients cube in samples namespace.Here's how it can look for end user.
go to post Eduard Lebedyuk · Jun 21, 2016 Here's a good article on pagination I read recently. tl;dr other approaches than row numbering do exist.
go to post Eduard Lebedyuk · Jun 20, 2016 Replace full reference to a global with one zn. Consider the following code: Class Utils.Global { /// Do ##class(Utils.Global).Generate() ClassMethod Generate(NS = "SAMPLES", Count = 100000000) { New $namespace Zn NS Kill ^LAB For i=1:1:Count { Set ^LAB(i) = i } } /// Do ##class(Utils.Global).Test() ClassMethod Test(NS = "SAMPLES") { Set time = $p($h,",",2) Do ..Ref1(NS) Set time1 = $p($h,",",2) Do ..Ref2(NS) Set time2 = $p($h,",",2) Write "Full ref time ",time1-time,!,"ZN time ",time2-time1 } ClassMethod Ref1(NS) { Set PIDX="" For { Set PIDX=$ORDER(^[NS]LAB(PIDX)) Quit:PIDX="" } } ClassMethod Ref2(NS) { New $namespace Zn NS Set PIDX="" For { Set PIDX=$ORDER(^LAB(PIDX)) Quit:PIDX="" } } } When I run Do ##class(Utils.Global).Test() in a terminal I get the following results: Full ref time 38 ZN time 35 even better difference on smaller loops (10000000): Full ref time 3 ZN time 2 GitHub.
go to post Eduard Lebedyuk · Jun 18, 2016 Use EnableConfigItem method of Ens.Director class to enable/disable business hosts programmatically.It can possibly be called from OnStart method in production class, from where you can determine an environment (DEV or PROD) and enable/disable correct business hosts based on that.
go to post Eduard Lebedyuk · Jun 18, 2016 HTTP debug proxies can and do work with https traffic, for example Charles. You need to install the certificate for that, but it's definitely doable.
go to post Eduard Lebedyuk · Jun 16, 2016 Template is most probably a string, so the usual $find would work.
go to post Eduard Lebedyuk · Jun 16, 2016 Yes, both %Collection.ListOfDT and %Library.ListOfDataTypes classes implement LogicalToDisplay method. I recommend you read class documentation, or read the class definitions themselves, it's the easiest way of understanding of what goes on inside Caché classes.
go to post Eduard Lebedyuk · Jun 16, 2016 You can use any ODBC/JDBC database management software. I use DataGrip. It has code completion for table/field names and standard SQL syntax.
go to post Eduard Lebedyuk · Jun 16, 2016 If data is too big for a string then result would also be too big for a string. I think something like this would work:Create result streamFind positions of the beginning and the end of the first placeholder in the templateWrite template from the start to the beginning of the first placeholderCopy data stream into result streamRepeat 2-4 till you have no more placeholders (if there's more than one placeholder per template)Send result stream out via a soap webserviceIt can be done as one method with this signature ( so it would be possible to pass any number of data streams for one template):ClassMethod FillTemplate(Template As %String, Data... As %Stream.GlobalCharacter) As %Stream.GlobalCharacter {}
go to post Eduard Lebedyuk · Jun 14, 2016 Check if variable is defined beforehand and generate/use a new variable name if required: ClassMethod GetNewVarName() As %String { Set Name = "Temp" While $Data(@Name) { Set Name = Name _ $Random(100) } Return Name }