Tips & Tricks

Syndicate content 21 

Hi Dev Community,

My team is currently working on a project where we need to post pdf documents to a 3rd party REST API.

The API specifies a field in the JSON request message to contain the 'physical content' of the file as an array of bytes, example of the JSON request as follows - data truncated for readability purposes:

{
    "CaptureSource":2,
    "RecipientID":"ID34",
    "Document": {
        "Guid":"5D847A4E9CC1485382DC4A5F5DC80D6C",
        "EventDate":"2019-01-14T13:23:46",
        "FileExtension":"pdf",
        "FileContent":"JVBERi0xLjQNCiXi48/TDQoxIDAgb2JqDQogIDw8DQogICA......"

      },
    "ActionRequired":false,

Last answer 5 days ago
0   1 2
0

comments

122

views

0

rating

I'm sure most of you have already familiar with the possibility of using GZIP in InterSystems products. But, the problem is that GZIP working only with one file or stream, and it does not support folders. When you work in Unix systems, there is a possibility how to solve it, using tar compress tool which goes with every Linux system from out of the box. But what to do if you have work on Windows as well, which does not have it. 

I am pleased to offer you my new project isc-tar, which will help you do not care about operating system, and deal with tar files anywhere.

Last comment 18 March 2019
+ 6   4 2
212

views

+ 6

rating

Let's imagine you have only SQL. You need some table where you should increment value in some property when you update this line.

We have the table

CREATE TABLE "test" (
  "identifier"   VARCHAR(200) NOT NULL,
  "value"        INTEGER,
  PRIMARY KEY ("identifier")
)

Last answer 6 March 2019 Last comment 6 March 2019
+ 1   0 4
106

views

+ 1

rating

I successfully got everything in this guide to work:  https://community.intersystems.com/post/ensemble-rabbitmq-java-client-qu...

I am now using the information I gained from this guide along side with this guide:

https://www.rabbitmq.com/tutorials/tutorial-one-spring-amqp.html

 

I am running into an issue though. In the RabbitMQ guide I just posted, they have a "Receive message" functionality. I use that alongside with the SendMsg from Ensemble method in the InterSystems guide. The issue I have is the message I receive looks like "[B@2c421093(byte[21])" instead of "Hello from Ensemble!"

Last answer 4 March 2019 Last comment 5 March 2019
0   0 2
62

views

0

rating

Hi Community!

When you run  IRIS container out-of-the-box and connect to it via terminal e.g. with:

docker-compose exec iris bash

You see something like:

root@7b19f545187b:/opt/app# irissession IRIS

Node: 7b19f545187b, Instance: IRIS

Username: ***

Password: ***

USER>

And you enter login and password every time.

How to programmatically setup docker-compose file to have IRIS container with OS authentication enabled? And have the following while entering the terminal:

root@7b19f545187b:/opt/app# irissession IRIS

Node: 7b19f545187b, Instance: IRIS

USER>

Last answer 2 March 2019 Last comment 4 March 2019
0   0 4
64

views

0

rating

Are you ready for the next Advent of Code this year?

Just a few days left, the first puzzles will unlock on December 1st at midnight Eastern Time.

Not sure if I will manage to find time to solve those puzzles as quickly as last year, but hope some of you will do. We still have our leaderboard, you can join 130669-ab1f69bf.  So, we will see who the best.

Last comment 8 December 2018
+ 2   0 3
245

views

+ 2

rating

Mirroring 101

Caché mirroring is a reliable, inexpensive, and easy to implement high availability and disaster recovery solution for Caché and Ensemble-based applications. Mirroring provides automatic failover under a broad range of planned and unplanned outage scenarios, with application recovery time typically limited to seconds. Logical data replication eliminates storage as a single point of failure and a source of data corruption. Upgrades can be executed with little or no downtime.

Deploying a Caché mirror does, however, require significant planning, and involves a number of different procedures. And like any other critical infrastructure component, the operating mirror needs ongoing monitoring and maintenance

Last comment 8 December 2018
+ 7   2 10
2898

views

+ 7

rating

The goal of this “DeepSee Troubleshooting Guide” is to help you track down and fix problems in your DeepSee project.

If the problem can’t be fixed by following the guidelines, you will at least have enough information to submit a WRC issue with DeepSee Support and provide all the evidence to us, so we can continue the investigation together and resolve it faster!

Please NOTE: If you are unfamiliar with the consequences of a given action or command, please don’t run it as it might have an effect on your production system.  In this case contact DeepSee Support for further assistance. 

The easiest way to follow this guide is by starting on the left and make your way to the Action column on the right.

Last comment 29 November 2018
+ 10   0 15
1060

views

+ 10

rating

In this post I show strategies for backing up Caché using External Backup with examples of integrating with snapshot based solutions. The majority of solutions I see today are deployed on Linux on VMware so a lot of the post shows how solutions integrate VMware snapshot technology as examples.

Caché backup - batteries included?

Caché online backup is included out of the box with a Caché install for uninterrupted backup of Caché databases. But there are more efficient backup solutions you should consider as systems scale up. External Backup integrated with snapshot technologies is the recommended solution for backing up systems including Caché databases.

Are there any special considerations for external backup?

Online documentation for External Backup has all the details. A key consideration is

Last comment 16 November 2018
+ 12   1 5
4000

views

+ 12

rating

EnsLib.HL7.Message.cls provides many API methods for manipulating an HL7 message.  RemoveSegmentAt(), for example, can be used to remove a segment by path or index, but only one segment at a time.   There may be times that you'll need to remove all segments within a group or even many groups of segments from the HL7 message.  Surely you can iterate through each segment in each group and remove them one by one, but there's a much easier way. 

 

With just one command, like below, you can remove all OBX segments in an ORU_R01 message (msg):

Set tSC = msg.SetValueAt(,"PIDgrpgrp(1).ORCgrp(1).OBXgrp()","remove")

 

Or, with just the following command, you can easily remove all PR1 and ROL segments within a specific group in an ADT_A01 message (msg)

Last comment 14 November 2018
+ 2   0 2
777

views

+ 2

rating

Hi All,

Actually, I'm developing few restful API's. I want to create a authentication tokens and display it on my login restful API. If I'm using CSP sessionId, how can I validate the session Id's in another or continues restful API's. else, is there any other approach to handle this task. 

My Primary goal is, I have to integrate 2 different front end applications. One is Zen framework another one is web pages from Python. 

If any lead, it would be appreciated. 

Thanks,

Arun Kumar Durairaj. 

0   0 1
0

answers

0

comments

102

views

0

rating

This article will provide tips and tricks on customizing Ensemble business hosts with configurable settings.

Ensemble production Settings are configurable values that control the behavior of a production and its hosts.

The documentation for adding and removing Settings and specifying categories and controls for Settings is provided at the link:

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=EGDV_prog#EGDV_prog_settings

“To provide new settings for a production, a business host, or an adapter, modify its class definition as follows

Last comment 9 October 2018
+ 5   1 7
1402

views

+ 5

rating

This code snippet determines the day of the week associated with a date. The class method "test" takes a date as a string in "mm/dd/yyyy" format, and returns an integer corresponding to a day of the week:


Class cartertiernan.getDayfromDate Extends %RegisteredObject
{
    classmethod test(date) as %Integer {
        //Set date = $ZDATE(date) //  Looks like: mm/dd/yyyy
     
        Set monthList = $LISTBUILD(0,3,3,6,1,4,6,2,5,0,3,5) // (Jan,Feb,Mar,Apr,...)
        Set centuryList = $LISTBUILD(6,4,2,0) // first two digits divisiable by 4, then subsequent centuries. EX (2000, 2100, 2200, 2300)
        Set dayList = $LISTBUILD("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") // Index goes from 0-6
         
        Set day = $PIECE(date,"/",2) // get the day 
        Set monthVal = $LIST(monthList,($PIECE( date,"/",1 ))) // get the month value
        Set first2DigsYear = $PIECE( date,"/",3 ) \ 100 // get the last 2 digits of the year
        Set last2DigsYear = $PIECE( date,"/",3 ) # 100 // get the first 2 digits of the year
         
        // Used for DEBUG perpouses
        /*write !,"day: ",day
        write !,"Month: ",monthVal
        write !,"last2: ",last2DigsYear
        write !,"first2: ",first2DigsYear
        write !,"cen Val: ",$LIST(centuryList,(first2DigsYear # 4) + 1),!!*/
         
        // Look here for formula explination (its the "Basic method for mental calculation")
        // http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week
        Set dayOfWeekVal = ( day + monthVal + last2DigsYear + (last2DigsYear\4) + $LIST(centuryList,(first2DigsYear # 4) + 1 ) ) # 7
     
        Quit dayOfWeekVal
    }
}

Here's a link to the code on GitHub

(originally posted to CODE by Carter Tiernan, 6/18/14)

Last comment 20 September 2018
0   0 2
130

views

0

rating

In this series of articles, I'd like to present and discuss several possible approaches toward software development with InterSystems technologies and GitLab. I will cover such topics as

+ 7   2 4
0

comments

623

views

+ 7

rating

Hi everyone!

I want to share four functions with you. I hope that you can use it at some time.

DNI: the initials of the type of national identity document, is composed of different series of numbers and letters. That proves the identity and personal data of the holder, as well as the Spanish nationality. Example: 94494452X

NIE:  The NIE or foreigner identity number is a code for foreigners in Spain.


In this page you can generate examples of DNI or NIE https://generadordni.es/

The first function calculates the letter of  a DNI number

Last comment 29 April 2018
+ 3   0 4
439

views

+ 3

rating

NOTE:  This content was originally presented at the InterSystems Global Summit in 2014, however related topics often come up on the Developer Community so I have decided to turn this into an article for easier reference and discussion.  However, much of the content was pulled directly from the presentation slides so the article format resembles that of a PPT deck more than paragraphs.

Introduction

Teams that deal with many environments (e.g. for development, testing and production) multiplied by many systems (e.g. billing app, hr app, support app) can face a number of changes

+ 4   1 4
0

comments

412

views

+ 4

rating

Problem:

Caché prints to printers in a manner somewhat different from other Windows applications.  Caché sends the data directly to the GDI Printer, without the usual interface.  This is because the GUI interface can only be shown on a system desktop session and not in web browser and terminal sessions.  Some printer drivers have problems with this method of printing.

Is this the problem you are having

+ 3   1 8
1139

views

+ 3

rating

Hi!

It is often necessary to run some external command such as a python program or a shell script from inside Caché/Ensemble. There are three ways of doing this:

  • $ZF(-1) - Runs the command and waits for it to finish.  
  • $ZF(-2) - Runs the command and don't wait for it to finish.
  • Using CPIPE device - Runs the command and opens a device for you to read its output or (exclusive or here!) write to its input.

$ZF(-1) is normally more interesting because it allows you to recover the return code of the program you are calling. If that is important to you, that is the way to go. But while the program is running, your Caché process will be hung and you won't be able to stop the instance cleanly until it is finished. Normally, for short processes, this is totally acceptable

Last comment 20 February 2018
+ 8   1 7
1139

views

+ 8

rating

Zen report can create PDF document (https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GRPT_xslfo_pdf_config ). Store your images in the table. Pass session id to the Zen report. Zen report will select images using SQL. The <img> element will insert images to the report:

<img width="100%" src="!@ImageName" contentHeight="scale-to-fit" contentWidth="#(..ImageWidth)#" style="position:absolute" content-type="image/jpg"/> 

Do the following (See the attachment image_to_pdf_using_zen_reports.doc for details):

+ 2   0 1
0

comments

253

views

+ 2

rating

Here is a snippet that I learned yesterday

You can define an index on a collection property but when I tried to use it, I failed. I was using

     Select ….. where …. :xx %INLIST collproperty

But this will not use an index, but the equivalent syntax

     SELECT .. WHERE ... FOR SOME %ELEMENT(collproperty) (%VALUE=:xx)

will use the index 

Check out

     http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

 

Dave

Last answer 2 February 2018
+ 1   1 2
125

views

+ 1

rating

Does anyone NOT use a debugger? I can't remember the last time I did. It's not because I don't dislike them, I just don't need to use them. The main reason for this is because I have a certain development methodology that either produces less bugs, catches them at a unit test level, or makes tracking them down much easier.

Here are my tips...

1. Write your own COS cheat-sheet.

This is mainly for anyone that is new to COS. One of the biggest bug hazards is not knowing how certain commands and functions work. Take the time to play with a language and try out all of its variances. The process of then documenting your own cheat-sheet will cement the knowledge and provide a quick reference review tool. Not only will you become more productive, but you will certainly write less of those avoidable bugs.

2. Switch on track variables in Studio

Last comment 5 January 2018
+ 14   1 4
794

views

+ 14

rating

Hello everyone,

 

From now till the 25th of december each day 2 programming problems to sharpen your programming skills.

http://adventofcode.com/

 

Theme this year:

The night before Christmas, one of Santa's Elves calls you in a panic. "The printer's broken! We can't print the Naughty or Nice List!" By the time you make it to sub-basement 17, there are only a few minutes until midnight. "We have a big problem," she says; "there must be almost fifty bugs in this system, but nothing else can print The List. Stand in this square, quick! There's no time to explain; if you can convince them to pay you in stars, you'll be able to--" She pulls a lever and the world goes blurry

Last comment 26 December 2017
+ 5   0 10
786

views

+ 5

rating

Caché will not change the cryptographic settings in an existing TLS configuration when you upgrade.  This means that unless you've updated them yourself, you're still using the values from the very first version you started using SSL in.  

If you've upgraded since creating your TLS configurations, take a moment to look at the enabled protocols and ciphersuites to make sure you've enabled all the versions you want, and disabled the old versions you don't want.  You can your find existing TLS configurations in the management portal under System Administration -> Security -> SSL/TLS configurations.

The default ciphersuite string has changed to include new options and is now: ALL:!aNULL:!eNULL:!EXP:!SSLv2  If you're still using the old default (TLSv1:SSLv3:!ADH:!LOW:!EXP:@STRENGTH) you may want to change to the new string, as the old one does not include new ciphersuites which some sites require

Last comment 28 November 2017
+ 4   0 2
291

views

+ 4

rating