Question Rubens Silva · Apr 15, 2020

Hello,

Recently I have been required to work with a method called ExportToStream.

The situation asks me to export a UTF-8-encoded JSON as a XML to be imported on old releases. Here's how I attempted to fulfill this request:

do $System.OBJ.ExportToStream("path/to/my/json/file.json", .stream,,,"UTF8")

The file is indeed encoded as UTF-8 and although the XML header denotes that it has been exported as UTF8:

<?xml version="1.0" encoding="UTF8"?>

The body content seems to differ:

"text": "Condição de pagamento sujeito a análise de crédito: "
10
0 1114
Question Rubens Silva · Mar 27, 2020

Hello,

We're considering adopting the ZPM solution as a way to manage many of our customer updates. However in order to do so we need to know a few things.

  • Is ZPM client compatible with Caché 2017.x versions?
  • Can we configure a self-hosted registry that doesn't require a GitHub repository link?
  • Could the ZPM client zip and upload the whole package (all classes, routines, includes) instead of downloading it from a Github link?
  • Can we declare a module that specifies classes themselves instead of their package counterpart? e.g. My.Class.CLS instead of My.PKG.
1
0 296
Announcement Rubens Silva · Mar 16, 2020

Hello all!

As we ObjectScript developers have been experiencing, preparing an environment to run CI related tasks can be quite the chore. This is why I have been thinking about how we could improve this workflow and the result of that effort is IRIS-CI.

See how it works here.

Quickstart

1.Download the image from the Docker Hub registry:

docker pull rfns/iris-ci:0.5.3
  1. Run the container (with the default settings):
docker run --rm --name ci -t -v /path/to/your/app:/opt/ci/app rfns/iris-ci:0.5.3
0
1 418
Question Rubens Silva · Mar 9, 2020

Just like the title says, I'm attempting to find a way to create a web application that instead of serving CSP files, it uses a dispatch class.
I searched for clues in the documentation, but the CSPApplication tag seems to be exclusively for CSP file-based applications.
I'm trying to avoid implementing a workaround such as using the Invoke tag to call the Security.Applications to generate the web application but I might be forced to do so, even though it's unpleasant if I had to say...
So, is there an official way to execute this task?

22
0 746
Question Rubens Silva · Jan 31, 2020

Hello.
I'm trying to export a XML stream containing some files that are supposed to have been written using UTF-8, but I'm facing some broken encoding issues.
You can see below that I'm indeed viewing a UTF-8 encoded and which is inside the CSP folder and encoded correctly (although displaying it on Studio would not display it correctly as the file is not using BOM and that's intentional).

7
0 862
Question Rubens Silva · Nov 12, 2019

Pretty straight forward.
I'm tempted to hard-code ISO-8859-1 inside my VSCode extension when working with CSP because this seems to be the encoding used by default, but I need to know if there's any other possible configuration. So can you share your experience when working with CSPs? Like issues with encoding, discoveries regarding it, workarounds etc.
Also, can someone tell me if it's possible to work with UTF-8 encoded CSP files using Atelier without breaking the encoding of the output file?

3
1 893
Article Rubens Silva · Oct 8, 2019 2m read

Hello again and welcome to the next tutorial on this series: Part 5 - Errors. Here we are going to learn how Frontier handles unexpected errors and how we can force them.

  1. Core concepts
  • Getting started
  • Creating a simple request
  • Query parameters
  • Aliasing query parameters
  • Changing output format
  • Rest query parameters
  • Inferring object instances
  • Using literal notation
  • Seamlessly mixing instances with literals
  • Returning streams
  1. Handling payloads
  • ​​How it works
  • Making it useful
  • Unmarshalling payloads into instances
  • Using the unmarshaller to EDIT an existing object
  1. Using the SQL API
0
0 389
Question Rubens Silva · Sep 6, 2019

Hello,

I had an issue when using the method Exists, I noticed that if you provide a directory for this method it returns 1. This is really misleading, because sometimes the input could be a directory and the only way to predict this is to also test if the file is a directory.

I didn't tested using the Attributes method, but I supposed that this means could also be a solution for that issue. But still, I expected the Exists method to return 1 for files and 0 for directories, since there's also method called DirectoryExists already.

write ##class(%File).Exists("/InterSystems")
1
4
0 557
Article Rubens Silva · Jul 25, 2019 2m read

Hello everyone, it took some time but I'm finally getting things done again. Phew! But for now, allow me to introduce a tool that I've been using frequently.

I call it Forgery.

This description has been taken from my GitHub repository, also available on OpenExchange:

Forgery is a server-side utility that allows executing simulated HTTP request by forging calls to REST applications. This makes Forgery ideal for using together with test suites that need to call the API via HTTP but could face issues with license usage and its grace period.

0
2 451
Question Rubens Silva · Nov 9, 2017

Hello.
We're about to implement an application that could use WebSockets intensely so before we head to that direction we need to figure out about how some few things work. That being said, anyone care to give me some enlightenment?

  • What's the criteria for a new session to be created when using WebSockets?
  • What's the factor for calculating how many licenses to would be used when SharedConnection  is enabled for WebSockets?
  • Is there a way to use session in a way that it would optimize the license usage for a single user?
1
0 351
Article Rubens Silva · Oct 13, 2017 2m read

Hello again and welcome to the next tutorial on this series: Part 4 - Sharing data across router methods.  Here we are going to learn how to share a object containing data that is available for read across every router methods.
You're required to complete at least the Part 1 before entering this one. Still, this is supposed to be a really short tutorial, since there isn't much to be said about data sharing.

0
0 555
Article Rubens Silva · Sep 27, 2017 4m read

Hello again and welcome to the Part 3 - Using the SQL API!
If you have been wondering about how to use SQL along with Frontier, you came to the right place. That's because since Frontier wraps the common Caché SQL API within it's own, you need to use the API provided from it. But you don't need  to worry about its learning curve, because the Frontier SQL API is really simple.
If you arrived here without checking the Part 1, I'd recommend you doing so, because Part 1 covers the essential for getting started with Frontier routers.

0
0 986
Question Rubens Silva · Sep 19, 2017

Hello all.
I think the forum experience is great as whole, but it could improve even more if we had somewhere to share our ideas. So that's why I'm creating a thread dedicated for that purpose. Maybe this way someone from InterSystems could catch something good?

11
0 470
Question Rubens Silva · Sep 4, 2017

Hello, I just noticed that the following query is not allowing when using cached queries.

The compiler will accuse the code about missing a closing quote.
Just so you know, if I use this query dynamically it works, so I guess it's related to the code linting.

Query T() As %SQLQuery [ SqlProc ]{SELECT TOP 3 JSON_OBJECT('lit':'Employee from','t':%TABLENAME,'name':Name,'num':SSN) FROM Sample.Employee}

The bold part is what is causing the error.

Version 2017.

4
0 453
Article Rubens Silva · Aug 9, 2017 9m read

Hello.
The idea of this post is to introduce Frontier: An abstraction layer that allows Rapid REST development.

REQUIREMENTS:

Why?

Have you ever found yourself dealing with repetitive tasks like mounting objects, serializing them and eventually handling multiple errors for multiple cases? Frontier can boost your development by making you focus on what really matters: your application.
 

Frontier is made to stop you from WRITE'ing by instead forcing your methods to return values.
It's designed to make you code clean, and you'll see the why pretty soon.

8
0 1750
Question Rubens Silva · Jul 27, 2017

Hello.
I'm having difficulties trying to figure (if possible) how to  create an URL that also matches query parameters.
I tried:
 <Route Url="/:namespace/test(\?id\=):id" Method="GET" Call="Test"/>
 <Route Url="/:namespace/test?(id)=:id" Method="GET" Call="Test"/>
 <Route Url="/:namespace/test?id=:id" Method="GET" Call="Test"/>

But none of these worked.

Is it possible when using %CSP.REST or am I restricted to using route parameters?
Thank you.
EDIT:
 

5
0 2552
Question Rubens Silva · Jul 12, 2017

Greetings, can someone give me some help? I'm trying to use job for a instance method, as it's described here but...
Anyway, I have a method like this:

Method PrepareInstance(path){set ..Tool = ##class(Tool).%New(path)do $System.Event.Signal($zparent)}

That is being called like this:

Method TestPurge() As %Status{job ..PrepareInstance(..GetTestDirectory("../fixtures/_/dummy-project"))::10set msg = $System.Event.Wait("",10)
}

But it fails because:

<METHOD DOES NOT EXIST>zTestPurge+1^UnitTest.Tool.1 *PrepareInstance
5
0 498
Question Rubens Silva · Jul 11, 2017

You might find it useful or not. It depends on what you can imagine it to be used with, like I had to.

Either way, I created a lib that can fetch environment variables from a file or from the OS where Caché is running.

Mostly know as dotenv. Many languages have it, so why not Caché?
The usage is pretty simple:
If you want to use OS env vars exclusively, just use the method:

##class(DotEnv.Parser).FromOS()

Otherwise, if you want to specify a .env file containing your variables to complement the OS ones use the method:

##class(DotEnv.Parser).FromPath("/path/to/file")
3
0 521
Question Rubens Silva · Jun 12, 2017

Here's my issue. I've been using Sample.* globals and packages mapped to another development namespace to realize unit tests. So when I ran it, I notice that I forgot to start a transaction in order to be able rollback it to it's original data.
I assumed that I should use transactions since I was manipulating it's data but I didn't want it to be persisted.

1
0 411
Article Rubens Silva · May 22, 2017 3m read

EDIT: This article has been updated with up-to-date information about the Port project, which now includes a tutorial for basic usage.
The Port project is something that I've introduced more than two years ago but I hadn't enough room to elaborate a tutorial on how to use it till now.


First, the motivation:

5
2 775
Question Rubens Silva · May 12, 2017

Hello.
I would like to know if there's a way to batch a certain amount of writes done inside a job and display it sequentially on the main process.
My idea is to prevent the main process from freezing while displaying the batched data. The main process's device could be

the terminal or the Studio output.

%Studio.Debugger does something close to that when printing the output from the debug target process.
$System.Event.Signal($zparent) doesn't signals the parent if a device is open. So I can't create the batch buffer along, because I can keep the buffering device open and notify the main process.

11
0 725
Question Rubens Silva · May 9, 2017

Greetings.
I'm trying to do some experiments using the Atelier REST API, but I noticed a bug that I simply can't bypass.

When requesting the Atelier server asking for an array of docs, it seems to fail when using it with multiple formats.
Like: [ "RCWWW015.int", "Class.cls" ]
While this method does return the class's source code, it fails when fetching the routine.
Like this:

1
0 341