go to post Stuart Stinson · Sep 14, 2022 External Servers have nothing to do with external language servers. We're supposed to call them "External Servers", but they were called "External <Language> Servers" during development (where <Language> is shorthand for <Java | .NET | Python>). The habit of using the old terminology is hard to break.
go to post Stuart Stinson · Sep 14, 2022 The $system.external interface is documented in Using InterSystems External Servers (not "external language servers", which are extensions to editors like VSCode).
go to post Stuart Stinson · Sep 12, 2022 Thank you! It looks like %set and %get were documented at one time, but got lost in the move to $system.external. These methods work differently in each language. For example, here's how to build and access a 2-dimensional string array in DotNet, Java, and Python (you can run each example in the Terminal): //================================================================ // DOTNET //================================================================ set arr = $system.external.getDotNetGateway().new("string[2,3]") for x=0:1:1 {for y=0:1:2 {set chr=$CHAR(65+(x*3+y)) do arr.%set(x,y,chr) }} do arr.%set(1,1,"x") // change value(1,1) from E to X for x=0:1:1 {for y=0:1:2 {write !,"("_x_","_y_")="_arr.%get(x,y)_" " }} kill arr //================================================================ // JAVA //================================================================ set arr = $system.external.getJavaGateway().new("String[2][3]") for x=0:1:1 {for y=0:1:2 {set chr=$CHAR(65+(x*3+y)) do arr.%get(x).%set(y,chr) }} do arr.%get(1).%set(1,"X") // change value(1,1) from E to X for x=0:1:1 {for y=0:1:2 {write !,"("_x_","_y_")="_arr.%get(x).%get(y)_" " }} kill arr //================================================================ // PYTHON //================================================================ set gw = $system.external.getPythonGateway() set arr = gw.new("list") for x=0:1:1 {do arr.append(gw.new("list")) for y=0:1:2 {set chr=$CHAR(65+(x*3+y)) do arr.%get(x).append(chr) }} do arr.%get(1).%set(1,"X") // change value(1,1) from E to X for x=0:1:1 {for y=0:1:2 {write !,"("_x_","_y_")="_arr.%get(x).%get(y)_" " }} kill arr
go to post Stuart Stinson · Sep 7, 2022 Just thought I should mention that there is a way to use legacy gateway code completely as-is, by using the Recast proxy generator rather than $system.external syntax. This was developed for Ensemble productions, but it should work for any code that uses the old proxy generator (he says, sticking his foot in his mouth again. No, I haven't actually tried it, but...) To generate Recast proxy classes, set the following global: set ^%SYS("Gateway","Remote","Recast",namespace)=1or set ^%SYS("Gateway","Remote","Recast")=1then re-import all the proxy classes. The first global governs Recast behavior for one namespace only while the second global governs Recast behavior for all namespaces that don't have their own setting. The import utility will automatically mark all the old-style proxy classes as out-of-date and re-import all the classes in the inheritance hierarchy.All of the proxy classes have to be regenerated together. The Recast generator creates drop-in replacements for the old proxies, but it actually uses the new dynamic proxy technology under the hood, so they can't be mixed with the old Caché-style proxy classes. This still begs the question of how to deal with arrays using $system.internal. I think you can round-trip just about any object by using inverse proxies on the .NET side. Can't go into that now because I'm supposed to be enjoying my vacation and my wife is giving me that look.
go to post Stuart Stinson · Sep 7, 2022 You're absolutely right. I should have tried it before commenting, but I got lazy (mostly because I'm supposed to be on vacation this week). I can't see a way around it without changing the .NET code.
go to post Stuart Stinson · Sep 6, 2022 The "old code" you've posted should work without changes. The main difference between the Object gateway and $system.external is in how you create the proxy. For example, to connect and create a "test" object: set gateway = $system.external.getDotNetGateway()do gateway.addToPath(myPath_"\DotNetGatewaySamples.dll") set test = gateway.new("remote.test.Person") Once you've created the proxy, it should work just as it always has.
go to post Stuart Stinson · Apr 28, 2021 The $system.external interface is documented in Using InterSystems External Servers (not "Language Servers").
go to post Stuart Stinson · Apr 14, 2021 That's right. For more information, see Support for pyodbc Python ODBC Bridge in Using the InterSystems ODBC Driver. We are also planning to implement the Python Database API in an upcoming release.
go to post Stuart Stinson · Jun 15, 2020 This is really excellent! Where did you get the graphics? Can we use them?
go to post Stuart Stinson · Sep 10, 2019 Excellent article!One quibble: it is actually possible to use fields like departure_time and stop_name as subscripts. Those fields will be imported as string subscripts, which can contain any character (including nonprinting characters). For example, the following code works fine, and automatically imports departure_time as a string subscript: # stoptimes -> [stop_id] -> [trip_id] -> [stop_sequence] -> [departure_time]=None for row in reader: iris.set(None, "stoptimes", row[3], row[0], row[4], row[2])
go to post Stuart Stinson · May 29, 2019 The %JSON Adaptor and Formatter classes are now documented in a new chapter of Using JSON (see Using the JSON Adaptor). The chapter owes a lot to an earlier version of this article (from which I stole adapted most of the examples). Thanks, Stefan!
go to post Stuart Stinson · Jan 14, 2019 Congratulations! You're the first person to notice that since I wrote the Python book ten years ago. Yes, I copied those entries from the Perl book and forgot to change the function names. Obviously "Perl binging" is not a typo.I'll probably fix the old Python book just as I finish writing the new Python book, covering the upcoming InterSystems IRIS Native API for Python. So please look forward to a new book and a brand new set of typos! With your help, perhaps we can catch them a bit sooner this time...