Article
· Mar 19, 2019 9m read
A Tutorial On WebSockets

Intro

Most server-client communication on the web is based on a request and response structure. The client sends a request to the server and the server responds to this request. The WebSocket protocol provides a two-way channel of communication between a server and client, allowing servers to send messages to clients without first receiving a request. For more information on the WebSocket protocol and its implementation in InterSystems IRIS, see the links below.

9 7
3 5.3K

At least three different ways to process errors (status codes, exceptions, SQLCODE etc is given in ObjectScript. Most systems have status, but for a range of reasons exceptions are more convenient to manage. You spend some time translating between the various techniques dealing with legacy code. For reference, I use several of these excerpts. It is hoped that they will also support others.

4 2
2 1.5K

Hi Developers!

Often when we develop some library, tool, package, whatever on InterSystems ObjectScript we have a question, how we deploy this package on the target machine?

Also, we often expect that some other libraries already installed, so our package depends on them, and often on some particular version of it.

When you code on javascript, python, etc the role of packages deployment with dependency management takes package manager.

So, I'm pleased to announce that InterSystems ObjectScript Package Manager available!

13 19
4 2.8K

$LIST string format and %DynamicArray and %DynamicObject classes

IRIS, and previously Cache, contain several different ways to create a sequence containing a mixture of data values. A data sequence that has been available for many years is the $LIST string. Another more recent data sequence is the %DynamicArray class, which along with the %DynamicObject class, is part of the IRIS support for JSON string representation. These two sequences involve very different tradeoffs.

$LIST String Format

11 4
8 2.6K

Hi Developers!

As discussed in previous parts of Package Manager stories to turn your IRIS application into a deployable package you just need to introduce the module.xml file into the root folder of the repository and describe all the resources.

I’m pleased to introduce you to a new project template on Open Exchange which contains examples of how to make different types of resources of your InterSystems IRIS application a part of the ObjectScript package and so make the deployable ObjectSctipt package.

Let's see how you can describe your application resources using this template project as an example.

See the details below.

4 2
7 463
Article
· Mar 28, 2019 2m read
ObjectScript error handling snippets

ObjectScript has at least three ways of handling errors (status codes, exceptions, SQLCODE, etc.). Most of the system code uses statuses but exceptions are easier to handle for a number of reasons. Working with legacy code you spend some time translating between the different techniques. I use these snippets a lot for reference. Hopefully they're useful to others as well.

22 5
19 3.1K

Hi Developers!

Often I find questions on how to install IRIS, connect to IRIS from IDE, setup the environment, compile, debug, maintain the repository.

Here below possibly the shortest way to set up all the environment and start development with ObjectScript on InterSystems IRIS.

Prerequisites

Make sure you have Git, Docker, and VSCode installed

Install Docker and ObjectScript extensions into VSCode

Sign in or Create an account on Github

Here we go!

5 9
5 1.3K

Hi Developers!

When you prepare your modules for ZPM (InterSystems Package Manager) it expects the certain directory structure for ObjectScript source files.

ObjectScript in your source folder need to be stored by types in the following subfolders. E.g. if you have the source folder named as /src the structure should be as follows:

/src

/cls - for classes

/inc - for include files

/mac - for mac files

/int - for interpretable files

2 0
1 681

Hi guys!

Was coding today with InterSystems IRIS in a docker container and decided to share with you the commands you may find useful in everyday coding.

# docker-compose build

command to build a container. Remember, it is useful if you have dockerfile in the repo.

if the build is successful call the following to launch it:

# docker-compose up -d

Find IRIS management portal on:

localhost:port/csp/sys/%25CSP.Portal.Home.zen?$NAMESPACE=%25SYS

where the port is what you set in docker-compose.yml - 52775 in this case.

Run the following if you want to launch a terminal session inside IRIS container:

# docker-compose iris iris session iris

gfhj gj 


sdfdsfsdf





USER>

And run the following to shut down the container:

# docker-compose down

Troubleshooting

5 4
4 594
Article
· Aug 21, 2019 2m read
ToolBox-4-Iris

Hello everyone,
After some work with IRIS we want to share our ToolBox-4-Iris with you.

What is this about?

The ToolBox-4-Iris is an API for IRIS with a collection of handy and useful tools - features that are not available in IRIS, but greatly simplify application development. To save time and effort on the "typical tools" that every developer needs. This includes additional classes, individual methods or even more efficient macros, which are described in the respective packages.

Content

11 3
1 378

Object Synchronization is a feature that has been around for a while, since Caché days, but I wanted to explore a bit more how it works. I've always thought that database automatic synchronization is complex by nature but, for some particular scenarios shouldn't be so hard. So I considered a very simple use case (OK, perhaps the typical one, I'm not discovering anything... but if it's common and it works, it's good wink ).

6 1
2 447
Article
· Aug 1, 2019 3m read
Nested set model for ObjectScript

In many projects I was faced with storing hierarchical data (tree) in classes.
By tree, I mean such data, where each node has a parent node — an object of the same class.
Many examples of such data can be given. For example, a catalog in the online store. Suppose that this online store sells books, in this case, the category tree might look like this:

6 1
1 870
Article
· Jul 25, 2019 1m read
Disabling an Ensemble Production

I'm not saying that this is in anyway "best practices," but I'm in a peculiar situation where I need to restrict users from starting a "retired" Ensemble Production in a namespace that's been renamed. It's still an "Ensemble-activated" namespace; we need to keep it available for Ensemble Message Viewer access ... fortunately, only for a little while.

It's a bit of a hack ...

Open the Production class in Studio and add the following classmethod:

2 6
1 387
Article
· Jul 26, 2019 3m read
Dynamic SQL to Dynamic Object

Hello community! I have to work with queries using all kinds of methods like embedded sql and class queries. But my favorite is dynamic sql, simply because of how easy it is to manipulate them at runtime. The downside to writing a lot of these is the maintenance of the code and interacting with the output in a meaningful way.

7 7
1 901
Article
· Jul 1, 2019 2m read
Transaction suspencion

It’s often useful to make changes inside the current transaction, that would not be rolled-back if transaction is rolled-back. For example to do some logging.

This can be achieved by using global that is mapped to temporary database -- IRISTEMP. All globals that start with ^IRIS.Temp* are mapped to IRISTEMP by default. Problem with such approach is that IRISTEMP is cleaned on InterSystems IRIS restart, so this log is lost.

What else you can do is -- suspend transaction temporarily, do the logging, and then resume the same transaction.

2 8
1 456
Article
· Jun 10, 2019 2m read
GitHub now supports ObjectScript

Hey developers,

I have great news for you. A few days ago, GitHub was updated with the latest version of linguist project, which is being used to recognize source code types in repositories. It helps to determine which programming language had been used in every file of the repository. Repository statistics section shows the results of this module work.

Also, you can search across all available GitHub repositories for any chosen language.

6 3
1 706
Article
· Jun 10, 2019 1m read
more usefull Object Dump

During testing your code you are often confronted with the need to examine
the actual content of an object. Either using ZWRITE or $system.OBJ.Dump()
you get a picture of simple properties as "--- attribute values ---"
while "--- swizzled references ---" are more confusing than informative
and with "--- calculated references ---" you are just left in the lurch.

This small helper class allows you to dump an object to terminal or
e.g in background to some stream for later review.
By default, you see just properties with content,

16 0
1 907

PHP, from the beginning of its time, is renowned (and criticized) for supporting integration with a lot of libraries, as well as with almost all the DB existing on the market. However, for some mysterious reasons, it did not support hierarchical databases on the globals.

Globals are structures for storing hierarchical information. They are somewhat similar to key-value database with the only difference being that the key can be multi-level:

2 1
4 797

Hi guys!

Portrait of Madame X, Gustave Caillebotte.

One of the features I like in InterSystems ObjectScript is how you can process array transformations in a specific method or a function.

Usually when we say "process an array" we assume a very straightforward algorithm which loops through an array and does something with its entries upon a certain rule.

The trick is how you transfer an array to work with into a function.

One of the nice approaches on how to pass the information about an array is using $Name and Indirection operator.

Below you can find a very simple example which illustrates the thing.

3 2
1 537
Article
· Apr 1, 2019 3m read
Closures in ObjectScript

After many sleepless nights it's a pleasure to announce the newer, better, moderner ObjectScript compiler which implemented pretty much everything you ever wanted to have in modern ObjectScript:

  • Design objective of this new compiler is to parse reasonable subset of current ObjectScript syntax which will look readable for stranger, and not scare them with 1 letter syntax. The good start for compiler was the old-good COS Guidelines from here https://github.com/intersystems-ru/cos-guidelines
  • For reasons we mentioned above we do not parse 1 letter syntax. It's declared evil;
  • We do not handle dotted syntax for the same reason - modern syntax with {} is proper replacement for dotted syntax blocks;

But we not only parse the modern ObjectScript syntax, we have implemented finally the long-standing request which we always dreamed about. Closures!

9 9
3 721
Article
· Mar 31, 2019 20m read
How to write the home address right?

How Tax Service, OpenStreetMap, and InterSystems IRIS
could help developers get clean addresses

Pieter Brueghel the Younger, Paying the Tax (The Tax Collector), 1640

In my previous article, we just skimmed the surface of objects. Let's continue our reconnaissance. Today's topic is a tough one. It's not quite BIG DATA, but it's still the data not easy to work with: we're talking about fairly large amounts of data. It won't all fit into RAM at once, and some of it won't even fit on the drive (not due to lack of space, but because there's a lot of junk). The name of our subject is FIAS DB: the Federal Information Address System database - the databases of addresses in Russia. The archive is 5.5 GB. And it's a compressed XML file. After extraction, it will be a full 53 GB (set aside 110 GB for extraction). And when you start to parse and convert it, that 110 GB won't be enough. There won't be enough RAM either.

2 0
2 472
Article
· Mar 2, 2019 6m read
Belated - Advent of Code 2018 Day 1

I know it's late, but I really love the advent of code theme each year to find some project ideas to go out and code something and push myself.

I had the intentions of completing the AOC 2018 before the new year, but I've got 2 young kids (1yo and 4yo), so most nights I just want to sleep.

I've been looking at this on my half hourly commute each day before and after work.

So whilst doing this, I found not many people had posted what they had done and in previous years.

0 2
0 210
Article
· Feb 8, 2019 2m read
Client Websockets based CSP

The Caché / Ensemble standard distribution contains in namespace SAMPLES
a nice example of a CSP page consuming WebService as a Client.
I have modified it not only to display the replies but to feed them back into a Global.
I used the classic Hyperevent to achieve this. The replies end up as a log in global^WSREPLY.
When there is no input anymore the page closes and goes away.

There are 2 versions with visible and hidden display during operation.
dc.WSCSP.reverseVerbose.cls and dc.WSCSP.reverseHidden.cls

11 0
0 469

Recently I needed a classmethod that returns annotation value based on a name of a activity.

As doing it at runtime seemed inefficient, I wrote compile-time utility that iterates over all business process activities and generates relevant code.

This code could be used in a variety of situations when you need to iterate over business process activities, just add it as a secondary superclass to your BPL processes.

1 2
1 364