#Tips & Tricks

0 Followers · 317 Posts

Pieces of experience in InterSystems Technology which solve some particular problem in elegant or unusual way.

Article John Hotalen · Oct 4, 2016 1m read

How to parse a URL in Caché:

Let's pretend you are working on a project where you may be retrieving a URL for some purpose and you have the need to be easily able to parse apart that URL to get the various components that make up the URL.

Here's how to do that:

Note:  This example assumes you have a variable named sURL that contains some url (i.e. http://www.intersys.com/main.csp?QUERY=abc#anchor) and you will be creating an array of the URL component pieces, where the array will be named aComponents.

In your class/routine, add the following code:

Do ##class(%Net.URLParser).Parse(sURL,.aComponents)

8
0 1949
Article Ben Spead · Aug 25, 2016 4m read

Background

Caché 2016.1 introduced some very powerful JSON features.  Unfortunately, the syntax used in the 2016.1 release is going to be changed in the 2016.2 release to bring it closer to Caché ObjectScript syntax.  This will mean that code that works in 2016.1 may not be forwards compatible.   See this announcement and this article for more details about the changes.

11
0 2112
Article Sylvain Guilbaud · Oct 4, 2016 6m read

This sample class will add parameter DSINTERVAL to each class containing the parameter DSTIME

To execute it from a Terminal :


SAMPLES>d ##class(adm.param).add(,,1)
[SAMPLES] parameter DSINTERVAL=5 added to class DeepSee.Study.CityRainfall (via adm.param)
[SAMPLES] parameter DSINTERVAL=5 added to class HoleFoods.Transaction (via adm.param)
[SAMPLES] parameter DSINTERVAL=5 added to class News.DeepSee.NewsArticle (via adm.param)
DSINTERVAL parameter was added to 3 classes
6
1 1100
Article Evgeny Shvarov · Aug 31, 2016 1m read

Hi!

Sometimes you see that call to DeepSee cube building method:

w ##class(%DeepSee.Utils).%BuildCube("CubeName")

does nothing.

Here are my 2 cents on possible reasons.

1. Run DeepSee Reset method in certain Namespace:

NAMESPACE> w ##class(%DeepSee.Utils).%Reset()

and try again.

2. Make sure, that all the indices in your base class for the cube are rebuilt, rebuild them and run it again:

w ##class(%DeepSee.Utils).%BuildCube("CubeName")

Hope this will save some time for you, and will be helpful as was to me.

2
0 445
Article John Hotalen · Sep 29, 2016 1m read

Checking if Directory or File Exists:

Outlined below is an example of how to check if a directory exists:

Set directoryName="c:\temp\nosuchdir"

/* Check for existence of a directory - Return Value:  0 - directory does not exist;  1 - directory does exist  */

Set directoryExists=##class(%File).DirectoryExists(directoryName)

If ('directoryExists)  // do the processing for when a directory does not exist


Outlined below is an example of how to check if a file exists:

1
0 3308
Article Eduard Lebedyuk · Sep 26, 2016 2m read

We're developing Ensemble PoC and one day our frontend developer (who doesn't have Ensemble production running) said that Populate just doesn't cut it and he needs to see the real data. He needed only one object, but the problem was - it's a big object. Still, I checked ids of everything related and wrote this command (parts omitted, but you get the idea):

1
0 779
Article Bob Binstock · Sep 9, 2016 2m read

as described in How to post an article from Word or Google Docs, you can use the Paste from Word button to paste content you have copied from a Word or Google Docs document into a Developer Community post.

this worked well for me pasting from Word 10 documents, and retained most (though not all) of my Word formatting. i did have one problem, however, and wanted to pass on my workaround.

0
0 384
Article Daniel Kutac · Sep 8, 2016 2m read

This short article was motivated by a problem of one of my customers. They use Ensemble to integrate many systems, some of them use just plain files.

So they naturally selected File Outbound Adapter to write into target file. Things were running smoothly for years, until recently, when the volume of data being written to the file reached large size of tens of megabytes. The operation took around half an hour to complete, causing timing problems where subsequent operations within the process had to wait, and third party system was not happy to wait so long.

2
0 841
Article Bob Binstock · Sep 7, 2016 6m read
Mirror Outage ProceduresCaché mirroring is a reliable, inexpensive and easy to implement high availability and disaster recovery solution for Caché and Ensemble-based applications. This article provides an overview of recommended procedures for dealing with a variety of planned and unplanned mirror outage scenarios. (For detailed information about mirroring and a wide range of mirror-related procedures, see Mirroring 101.)A Caché mirror typically consists of two Caché instances on physically independent hosts, called failover members. (A mirror can also be configured with a single failover
0
1 1196
Article John Murray · Sep 2, 2016 1m read

I was recently troubleshooting a problem on a Linux (RHEL) instance of 2016.1 at a site. For policy reasons their sysadmins wanted to update the Caché installation so it used network accounts for its cacheusr and iscagent users and groups instead of the locally-created ones that had been set up during original install of Caché.

To do this they ran various commands including chown

Afterwards non-root users couldn't obtain a terminal session using the csession command. Instead they receive this message:

cache: Permission denied

2
0 712
Article Eduard Lebedyuk · Aug 9, 2016 2m read

Process-private Globals  can be used as a data global in storage definition. That way, each process can have its own objects for the class with ppg storage. For example lets define a pool, which can:

  • add elements to a pool (ignoring duplicates)
  • check if an element exists in the pool

Here's the class:

2
0 990
Article Evgeny Shvarov · Jul 27, 2016 1m read

Hi, Community!

You know, that when we build hierarchies in DeepSee dimension all the members of lower level should be the part of one member of the higher level.

If not you'll get some empty results in MDX queries with this hierarchy.

With Time dimensions the obvious valid hierarchy is Year->Month->Day, cause every Month consists of one Year and every day consists of one month. 

3
0 449
Article Timothy Leavitt · Jan 5, 2016 1m read

(Possibly?) little-known fact: It's possible to use $ListBuild on the left hand side of the equals sign in a set command to extract multiple list values at once:

set $ListBuild(several,individual,variables) = list

For example:

USER>kill
 
USER>set colors = $ListBuild("red","orange","yellow")
 
USER>set $ListBuild(r,o,y) = colors
 
USER>write r,!,o,!,y,!
red
orange
yellow

See for reference: http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls…

4
0 483
Article John Murray · Mar 17, 2016 2m read

Here are a few tips that might be useful to people who are running applications in an environment that's configured to use InterSystems mirroring.

  • If you configure an ECP connection to a Caché instance that is a mirror member databases then the ECP connection should also have mirroring enabled (tick the mirroring box when defining the connection). More details here. You may also need to increase the number of ECP connections each end accepts, to cater for the way both members of a mirror pair get involved in ECP negotiation.
0
0 581