Article Timothy Leavitt · Jun 4, 2020 3m read AppS.REST - a new REST framework for InterSystems IRIS Over the past year or so, my team (Application Services at InterSystems - tasked with building and maintaining many of our internal applications, and providing tools and best practices for other departmental applications) has embarked on a journey toward building Angular/REST-based user interfaces to existing applications originally built using CSP and/or Zen. This has presented an interesting challenge that may be familiar to many of you - building out new REST APIs to existing data models and business logic. #API #Best Practices #Data Model #Framework #JSON #REST API #Security #InterSystems IRIS #InterSystems IRIS for Health #Open Exchange Open Exchange app 12 34 6 1.7K
Article Timothy Leavitt · Mar 24, 2020 5m read Unit Tests and Test Coverage in the InterSystems Package Manager This article will describe processes for running unit tests via the InterSystems Package Manager (aka IPM - see https://openexchange.intersystems.com/package/InterSystems-Package-Manager-1), including test coverage measurement (via https://openexchange.intersystems.com/package/Test-Coverage-Tool). #Continuous Integration #InterSystems Package Manager (IPM) #InterSystems IRIS #InterSystems IRIS for Health Open Exchange app 8 23 2 2K
Article Timothy Leavitt · Jan 15, 2020 9m read Robust Error Handling and Cleanup in ObjectScript Introduction and Motivation A unit of ObjectScript code (a ClassMethod, say) may produce a variety of unexpected side effects by interacting with parts of the system outside of its own scope and not properly cleaning up. As a non-exhaustive list, these include: #Best Practices #Error Handling #ObjectScript #Caché #InterSystems IRIS 19 7 6 1.5K
Article Timothy Leavitt · Dec 16, 2019 6m read Terminal tricks for fast display and fun formatting (Advent of Code 2019, Day 13) I've been having a blast with the Advent of Code puzzles this year - though I'll be heading into a busy span of time with family soon and will probably drop off toward the end. (At least, that's what always seems to happen - it's a good thing, though!) #Code Snippet #ObjectScript #Terminal #Caché #InterSystems IRIS 3 2 0 544
Question Timothy Leavitt · Mar 8, 2019 Quick way to check if an SSL/TLS configuration name is valid? Is there a quick way to see if an SSL/TLS configuration name is valid, short of switching over to %SYS and checking Security.SSLConfigs:Exists? #REST API #Caché #InterSystems IRIS 1 7 0 682
Question Timothy Leavitt · May 18, 2018 Datatype class for global reference Is there a datatype class with validation for global references? I can't find one in a brief scan of the documentation / class reference. #Object Data Model #Caché 0 4 0 468
Question Timothy Leavitt · Dec 11, 2017 Validating XML Problem:I want to be able to import XML (say, using %XML.Reader) to Caché objects permissively (ignoring invalid/unexpected tags/attributes), but also to validate the same XML and list any/all invalid tags/attributes that it contains. #Object Data Model #XML #Caché 2 3 0 1.4K
Question Timothy Leavitt · Jul 11, 2017 Utility to find differences between databases? Does anyone know of a utility to compare two databases (i.e., CACHE.DAT files) and find globals/subscripts that are different between them?If not, I'll write one and share it. #Caché #Databases #Globals #Deployment 1 6 0 882
Question Timothy Leavitt · Mar 15, 2017 Equivalent to $System.OBJ.MakeClassDeployed for routines? Is there an equivalent to $System.OBJ.MakeClassDeployed (see documentation) that has the same effect for routines, deleting the .mac/.int but not the .obj? #Caché 0 3 0 449
Question Timothy Leavitt · Jan 11, 2017 Web application with dispatch class (%CSP.REST) also serving static files Suppose I have a web application named "/my/api", with a dispatch class configured (a subclass of %CSP.REST), and I want to be able to respond to:GET /my/api/something/:idby loading an object with the specified ID and returning it as JSONGET /my/api/another-thing/data.js #REST API #Frontend #Caché 0 9 0 1.6K
Question Timothy Leavitt · Dec 5, 2016 Incorrect page title on profile "Answers" tab On my "Posts" page (https://community.intersystems.com/user/10056/posts), the title is "Posts (#)".On my "Comments" page (https://community.intersystems.com/user/10056/comments), the title is "Comments (#)".On my "Answers" page (https://community.intersystems.com/user/10056/answers), the title is "Evgeny Shvarov": #DC Feedback 0 3 0 224
Question Timothy Leavitt · Aug 17, 2016 What is the best pattern for reporting errors from an SqlProc? Given a complex method flagged with [ SqlProc ] so it is available as an SQL stored procedure, what's the best way to report a non-system error detected in that method - say, for example, an error %Status - so that the SQL query calling it fails descriptively? Is it best to create and throw an exception, or are there special % variables involved (like in a trigger)? I haven't been able to find an answer in the documentation. Thanks in advance! #SQL #Caché 0 2 0 448
Question Timothy Leavitt · Jul 8, 2016 Best way to compare two arrays for "equality" (same subscripts and values) I've been trying to write a method to compare two local variables, which may be arrays, for "equality" - that is, to see if they have all the same subscripts (if they're arrays) and values. This is the best I've come up with so far - are there any better/simpler approaches out there? #Code Snippet #ObjectScript #Caché 3 6 0 1.6K
Article Timothy Leavitt · May 27, 2016 1m read Workaround for "Smart Quotes" appearing in Ensemble editors in Atelier on Macs Some Mac users have noticed "smart quotes" or "curly quotes" appearing in the browser-based Ensemble editors within Atelier. Specifically, typing "" may result in the output “” instead of the normal double quote characters. 4 0 0 351
Article Timothy Leavitt · May 12, 2016 6m read Writing better-performing loops in Caché ObjectScript The topic of for/while loop performance in Caché ObjectScript came up in discussion recently, and I'd like to share some thoughts/best practices with the rest of the community. While this is a basic topic in itself, it's easy to overlook the performance implications of otherwise-reasonable approaches. #Best Practices #Code Snippet #Coding Guidelines #ObjectScript #Tips & Tricks #Caché 24 21 4 9.9K
Article Timothy Leavitt · Apr 11, 2016 1m read Subscription e-mails (digest) - links are wrapped across lines In the subscriptions e-mails I get (digested), the URLs are typically wrapped across lines, like: | Post link: | |http://community.intersystems.com/post/explanation-defaultdb-database-2 |01610 Direct unsubscribe link (content type): My mail client can't handle this, of course; the link doesn't work. (The actual link in this case is: https://community.intersystems.com/post/explanation-defaultdb-database-2... ) #DC Feedback 0 6 0 285
Article Timothy Leavitt · Mar 9, 2016 3m read Example: Connecting to a Caché web service from PHP There have been a few use cases recently within InterSystems where we've needed to connect to Caché-based web services from PHP. The first of these was actually the Developer Community itself, which uses web services as part of Single Sign-On with other InterSystems sites/applications. The following example demonstrates how to connect to a Caché-based web service (particularly, the web service in the SAMPLES namespace) from PHP, using password authentication. #Code Snippet #Frontend #SOAP #Caché 5 0 0 2.8K
Question Timothy Leavitt · Mar 2, 2016 What determines the value of $$$DefaultLanguage (used for localization) for a new Caché installation? Is the default language (i.e., $$$DefaultLanguage, which is used as the basis for localization with $$$Text/etc. at compile time) always "en" for new Caché installations, or could it be different? How is this determined? I don't see an option to select a language during Caché installation. Also, is there a supported/preferred API for setting the default language? Looking at %occMessages.inc, one option would be: #Compiler #Databases #Globals #Localization #Caché 0 3 0 574
Question Timothy Leavitt · Feb 11, 2016 Merging two %Objects (2016.1/2016.2) I'm revisiting some older projects that can benefit from the new JSON support and dynamic object capabilities in 2016.1 FT / 2016.2 FT. (Particularly, some of the really new features in the latest 2016.2 FT.) For the particular thing I'm working on, it would be very handy to be able to merge objects, similarly to https://api.jquery.com/jquery.extend/. The closest thing I've found so far (in 2016.2 only) is: Set o1 = {"a":1,"c":2}, o2 = {"b":1,"c":1} Write "o1: ",o1.$toJSON(),! #Caché #JSON 0 1 0 610
Question Timothy Leavitt · Feb 9, 2016 Property with SqlComputed and SqlComputeCode, but not Calculated or SqlComputeOnChange Looking at a property defined as follows: #Object Data Model #ObjectScript #SQL #Caché 1 4 0 803