#Code Snippet

6 Followers · 302 Posts

Code snippet is a programming term for a small region of re-usable source code, machine code, or text.

Question Yone Moreno · May 12, 2023

Good morning,

I was wondering:

Given the following scenario where we have a string where each two items are being splitted by "|" as follows: "squadName|initialLetter"

"Alfa|A|Bravo|B|Charlie|C|Delta|D|Echo|E|Foxtrot|F|Golf|G|Hotel|H|India|I|Juliett|J|Kilo|K|Lima|L|Mike|M|November|N|Oscar|O|Papa|P|Quebec|Q|Romeo|R|Sierra|S|Tango|T|Uniform|U|Victor|V|Whiskey|W|X-ray|X|Yankee|Y|Zulu|Z"

And we would need to generate a String structure like:
 

4
0 393
Question Yone Moreno · May 24, 2023

Hello,

We currently have the following scenario: We have a bussiness SOAP Operation, where we get a SAML String and we convert it into a %SAML.Assertion object correctly.

👩‍💻👨‍💻 We would need to send the SAML Assertion inside the SOAP Header to the Target System.

First of all thanks for reading, and thanks for answering.

We currently have opened Log Soap and we do not observe it being added to the SOAP Header, as you would observe in the following Log Soap:

1
0 294
Question Yone Moreno · May 22, 2023

Good afternoon,

first thank you from heart and mind, mind and heart; for reading, thinking, reflecting, responding, and above all explaining a possible solution and/or documentation to address this doubt.

We would need a way to get inside a SOAP Web Service the SAML Assertion, and then, send it directly to the endpoint throught a SOAP Operation.

Currently we have researched and developed how to get the SAML Assertion with the following code:

1
0 442
Question Punit · Apr 24, 2023

I have a %GlobalBinaryStream object that I'm trying to save as a local file after being received through a SOAP Web Service.

To do this, I created a %Stream.FileBinary object and wanted to set where the stream copied to this object would be saved by using either the DefaultStreamDir() ClassMethod or the NewFileName() ClassMethod. However, the documentation isn't very helpful on how to use these ClassMethods.

Right now, I have the below code:

4
0 330
Article Jeff Morgan · Oct 21, 2016 3m read

This article will describe and include an example of how to embed an external PDF file into an HL7 segment, specifically ADT_A01:2.3.1 OBX().  This can be useful when attempting to insert pictures or other external data into an HL7 message.  In this example, the name of the PDF file to be embedded is provided in the incoming HL7 message in OBX(1):ObservationValue field.

The basic stipulations for this example are as follows:

  1. Accept a PDF file
  2. Accept an HL7 message
  3. Using the name of the PDF file, embed the PDF data into the HL7 message
  4. Output the message to file

  

4
6 15851
Article Kyle Baxter · Jul 19, 2016 2m read

Date range queries going too slow for you?  SQL Performance got you down?  I have one weird trick that might just help you out! (SQL Developers hate this!)*

If you have a class that records timestamps when the data is added, then that data will be in sequence with your IDKEY values - that is, TimeStamp< TimeStampif and only if ID1 < IDfor all IDs and TimeStamp values in table - then you can use this knowledge to increase performance for queries against TimeStamp ranges.  Consider the following table:

9
1 30715
Question Yone Moreno · Dec 1, 2022

Hello, first of all thanks for your time and help.

We do send from a REST POST request using SoapUI software, an "Authorization Bearer".

POST http://[IP]:[Port]/aplicaciones/scs/informescctest/Servicios.SOAP.InformesCConcertadosv01r00.cls HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/xml
Authorization: Bearer eyJ0e[...]
SOAPAction: http://SCS.Servicios/InformesCConcertadosv01r00/ResultadosER7
Content-Length: 1871
Host: AAA
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

Our mission is to get it inside a SOAP Service.

The Service's ADAPTER is:

1
0 391
Discussion Eduard Lebedyuk · Nov 9, 2022

We're back with a code golf!

You will receive a string. Each word in the string will contain a number. This number is the position that word should have in the sentence. If the input string is empty, return an empty string. The output can only be in words, without the given numbers.

##Input "i2s T1his Te4st a3"

##Output This is a Test

13
0 692
Article Timothy Leavitt · May 12, 2016 6m read

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. In short, loops iterating over $ListBuild lists with $ListNext or over a local array with $Order are the fastest options.

As a motivating example, we will consider looping over the pieces of a comma-delimited string.

A natural way to write such a loop, in minimal code, is:

21
5 10113
Discussion Yone Moreno · Sep 13, 2022

To celebrate programming day, could we create solutions for a little challenge?

We have the following statement:

Given a string of words, return the length of the shortest word(s).

String will never be empty and you do not need to account for different data types.

Some test made in Java would be:

21
0 568
Question Bransen Smith · Oct 7, 2022

We have a handful of cases where we get reflex orders in an interface that contain multiple OBR segments. These are rare but when we get them, they are causing errors in down stream systems because we are unintentionally excluding OBR segments.

Questions:

At the DTL level - is it possible to iterate over this segment WITHOUT altering the underlying schema? If so what would that look like?

Ideally we would not like to alter the schema unless we have to. No matter what logic we attempt to write on the DTL level we are unable to read anything past the first OBR (because of our schema config). 

  

1
0 326
Article Timothy Leavitt · Oct 12, 2022 1m read

I just wrote up a quick sample to help a colleague load data into IRIS from R using RJDBC, and figured it's worth sharing here for future reference.

Ultimately it was pretty simple, aside from IRIS not liking "." in column names; the workaround is to just rename the columns. Someone better at R than me could probably provide some generic approach. smiley

2
2 349
Discussion Yone Moreno · Sep 19, 2022

Hello, community

To celebrate that this week is "International Week of Deaf People 2022" , https://wfdeaf.org/iwdeaf2022/

Could we do a small challenge?

The statement is:

Task

Give you two strings: s1 and s2. If they are opposite, return true; otherwise, return false. Note: The result should be a boolean value, instead of a string.

The opposite means: All letters of the two strings are the same, but the case is opposite. you can assume that the string only contains letters or it's a empty string. Also take note of the edge case - if both strings are empty then you should return false/False.

3
0 304
Discussion Yone Moreno · Sep 13, 2022

Hello,

I was wondering if there is a way, or what is your recommended way to generate, or develop some kind of deep interest or even some joy, love, or excitement towards coding, programming, software developing. Specifically for people aged between 20 and 30 years old.

I am aware of some programming games like the following ones:

https://wintrmut3.itch.io/maelstromexe

https://theov.itch.io/automaton

https://importantlittlegames.itch.io/codemancer-ch-1

Also, there are some coding platforms with online exercises and/or challenges:

https://www.codewars.com/dashboard

https://codecombat.com/

5
0 272
Discussion Eduard Lebedyuk · Jul 1, 2022

Leet (or "1337"), also known as eleet or leetspeak, is a system of modified spellings used primarily on the Internet. It often uses character replacements in ways that play on the similarity of their glyphs via reflection or other resemblance. Additionally, it modifies certain words based on a system of suffixes and alternate meanings. There are many dialects or linguistic varieties in different online communities. Wikipedia

You'll have to translate a string into a LeetSpeak. As usual shortest solution wins.

##Input "Listen"

##Output 1|573n

##Note

8
0 669
Article Timothy Leavitt · Mar 17, 2021 3m read

I ran into an interesting ObjectScript use case today with a general solution that I wanted to share.

Use case:

I have a JSON array (specifically, in my case, an array of issues from Jira) that I want to aggregate over a few fields - say, category, priority, and issue type. I then want to flatten the aggregates into a simple list with the total for each of the groups. Of course, for the aggregation, it makes sense to use a local array in the form:

agg(category, priority, type) = total

Such that for each record in the input array I can just:

Do $increment(agg(category, priority, type))
10
4 1211
Question Yone Moreno · Apr 25, 2022

Hello, good morning

First thank you for your time in reading and answering our question.

We have been reading, inquiring, researching about how to make multiple dispatches from 1 Process of type "DICOM.BP.QueryProcess" to several target Operations.

We need some help to further develop this use case, and some advice 🧭, examples or recommendations

Currently we are using the basic example, the one that includes Ensemble, and this has DICOM Process which has a property by which from Web Production we write to which Operation it sends our FIND/QUERY/RETRIEVE messages:

The circuit is shown graphically:

1
0 322
Question Yone Moreno · Mar 28, 2022

Good morning,

We would appreciate your support:

Developing an integration to perform a "Query / Retrieve" circuit with DICOM medical imaging studies, we would need the following:

Options of invocation of the DICOM TCP service that has been published for this integration, alternatives to the command line option.

Specifically we have read: Receive DICOM document with an embedded PDF and metadata.

Adapting the example, we use the line:

./storescu -b VNAPRE -c ESBPRE@10.136.4.XYZ:19ABC ./embeddedpdf.dcm

By which we simulate the sending of a DICOM document with a PDF.

3
0 349
Question Yone Moreno · Apr 1, 2022

Good morning,

Thank you for taking the time to read and answer this question.

We need to find out how to display an EnsLib.DICOM.Document using LOGINFO, in the traces.

We have tried to use:

set writer=##class(%XML.Writer).%New()

set status=writer.OutputToString()

set status=writer.RootObject(..DocumentFromService)

set xml= writer.GetXMLString()

$$$LOGINFO("..DocumentFromService en xml: "_xml)

 

In the trace it informs us that the "RootObject" method for DICOM documents, the EnsLib.DICOM.Document, does not exist:

0
0 224
Question Yone Moreno · Mar 31, 2022

Good morning,

First of all, thank you very much in advance for reading and responding.

Also, thank you for any support, because it is a relief, support, contribution, help to have people with more understanding, knowledge and practice, reading, and thinking this doubt.

There is the following need:

Two 2 circuits are available:

1st DICOM Circuit of "Studio" ( Classic Service ).

Service: class: DICOM.BS.QueryService

Process: class: DICOM.BP.QueryProcess

Operation: class: EnsLib.DICOM.Operation.TCP

We test from the "Console" of the "Studio" by means of:

do ##class(DICOM.BS.QueryService).TestFind("102030")
0
0 285
Question Yone Moreno · Mar 28, 2022

Hello,

First of all thanks for your help

How would you recommend us to filter in the message viewer to find inside a property called "mensaje" of type "%XML.GlobalCharacterStream" which is inside a class called"Mensajes.Request.Laboratorio.peticionER7Request", the text "24642"?

We have tried:

It shows:

ERROR #5540: SQLCODE: Message -37: Unary function %EXTERNAL does not support sequence fields.

ORIGIN ELEMENT: %ZEN.Component.tablePane (resultsTable)
2
0 663