Hi,
I create a cache class program. Its compile it. But how to run it?
Please send one sample program with output
InterSystems ObjectScript is a scripting language to operate with data using any data model of InterSystems Data Platform (Objects, Relational, Key-Value, Document, Globals) and to develop business logic for serverside applications on InterSystems Data Platform.
Hi,
I create a cache class program. Its compile it. But how to run it?
Please send one sample program with output
At the Global Summit several folks had mention that they developed their own production monitor. I am looking to create a monitor similar to eGate that we only display those Services/Processes/Operations that are in trouble, and those Errors that are showing up in the Event Log. Does anyone have any examples of this?
Thanks
Scott Roth
The Ohio State University Wexner Medical Center
Hello Cache experts,
Has anyone tried using Cache object script to check windows service is running or windows service installed or not on same computer or remote computer ? basically i am trying to develop cache program which will check "windows service" running or installed on current computer or remote computer. Based on the status of this windows service, i want to write some business logic in our application. Any suggestions will be more welcome
Hello, guys.
We have recently created a syntax highlighting for COS for Atom text editor. You can find it on https://github.com/intersystems-ru/atom-language-cos
Installation:
~/.atom/packages/ Window: Reload in Command line)It's been few days since the release, so please if you find a bug, let us know through creating an issue or forking and making a pull request.
P.S. After it gets more or less usable, we will use this syntax as a basis for GitHub highlighting for COS.
We are creating a package (written in Caché Object Script) that will provide access to an external DB (MySQL). Because applications that use our package will be run from machines with various, potentially unexpected, operating systems, we’d like to establish a connection to the external DB without using DSNs (we’ve heard that setting up DSNs on certain non-Windows machines can be cumbersome and problematic).
Does anyone know of way to create a connection to an external DB without using a DSN?
Several years ago, long before Developer Community Portal was launched, I published a series of Caché tricks at one of Czech web sites. In this article, I’m posting translated version of one of them.
Suppose you, or someone else created a useful method or routine, that was producing some computation that you’d like to benefit from, but the routine was writing output to process principal device.
You would like to use the data, but you need it not written to a device, but assigned to a variable. And, for any reason, you can’t modify the code. What can you do?
While Studio and Atelier are useful development interfaces, there are occasionally situations where a quick edit needs to be made to code and only terminal access is available. A useful set of tools to do this are the zload, zprint, zinsert, zremove, and zsave commands. These are abbreviated to zl, zp, zi, zr, and zs respectively. While each of these commands has its own page in documentation, this article will synthesize that information with examples to provide instruction for their combined use.
I have the following problem:
So how do I force classes with method generators to recompile when "u" qualifier is present?
Hello, everyone!
I opened one project and there I found such lines as
$$Export^%occXMLExport(filename,"-d /diffexport",InternalName)
Do DecomposeStatus^%apiOBJ(sc,,"d")
The problem is I can't go to their definition and find them in documentation. It says that they don't exist on the server. However, the project works and these routines execute.
How can I import them into my project?
Hello, guys!
I want to get access to the folder where all files of the namespace are stored using COS. I found a way to get access to class files and found a folder where all csp, html, css etc files are stored.
However, is there any folder which contains all files(even .mac and .int)?
Or, probably, there is a method which gives all files content?
I've been trying to write a method to compare two local variables, which may be arrays, for "equality" - that is, to see if they have all the same subscripts (if they're arrays) and values. This is the best I've come up with so far - are there any better/simpler approaches out there?
/// the same values at those subscripts.Hello!
In Caché there is a way to print all current variables using write command without arguments:
But is there a way to get a list of this variables? I am looking for something that would return value like $LB("Einstein", "Mozart") for this case.
Thanks!
Hi!
Here is the question in Russian Forum regarding roots extracting.
In Caché ObjectScript we use exponentiation operator (**) to raise an exponent to power. F.e. let's raise 3 to power of 3:
USER> write 3**3 27
And we use the same operator to extract the root.
USER> write 27**(1/3) 2.999999999999999963
And 2.999999999999999963 is not 3, obviously.
How to extract roots properly in Caché ObjectScript?
I am testing application code and want to simulate error conditions.
I am trying to use the following to define a custom error with a class method.
$SYSTEM.Status.Error($$$GeneralError,"Any text here")
My class method code looks like this....
set RunStatus=$System.Status.Error($$$GeneralError,"DXL Testing Run Error")
Class compile fails because the $$$GeneralError is unknown.
ERROR: DBMS.Reports.TaskPage.1(5) : MPP5610 : Referenced macro not defined: 'GeneralError'
TEXT: set RunStatus=$System.Status.Error($$$GeneralError,"DXL Testing Run Error")
I expect I need to include something to enable
Hello,
I am still a beginner with COS and am struggling with these concepts. While digging through the official documentation will eventually tell you everything you need to know, getting started is nevertheless not an easy feat...
Is it possible to create a "lists/array/multidimensional 101" page for beginners? And, for instance, its interaction with $data, what it means to use "as list of something" or "as array of something", how to walk lists, how to add/remove elements, how to extract sublists etc?
At this moment, for me, this is all very confusing, and I think such a page would help me
Hello!
Are there any short ways of serializing COS entity to the string? I am searching for something like .$toJSON() , but I need Caché 2013.* support.
The one way I supposed to work is to use $listbuild:
set str = $LISTTOSTRING($LB(1,2,3,",",5))
set list = $LISTFROMSTRING(str,",")
zw list
list=$lb("1","2","3","","","5")
But the problem is that $listbuild does not escape delimiters, and it is not possible to deserialize serialized string. The structure I need to serialize may contain any characters.
Are there any short ways to do this in Caché to avoid writing custom parser?
Order is a necessity for everyone, but not everyone understands it in the same way (Fausto Cercignani)
Disclaimer: This article uses Russian language and Cyrillic alphabet as examples, but is relevant for anyone who uses Caché in a non-English locale.Please note that this article refers mostly to NLS collations, which are different than SQL collations. SQL collations (such as SQLUPPER, SQLSTRING, EXACT which means no collation, TRUNCATE, etc.) are actual functions that are explicitly applied to some values, and whose results are sometimes explicitly stored in the global subscripts. When stored in subscripts, these values would naturally follow the NLS collation in effect (“SQL and NLS Collations”).
We have noticed that when compiling with Atelier (either Atelier itself or sending the code through the REST interface) that the build will fail if all brackets '() {} []' are not closed. This includes brackets opened in comments.
For example, this will fail:
class myclass
{
//if someVar {
}
I do not know if this issue has been fixed or if this issue has been brought up, but it has been a nuisance over here.
Hello!
I have a WebSocket application which spawns new process using JOB command.
Sometimes WebSocket connection can be terminated, and in the meantime I need to hold spawned process alive until it can be associated with the new WebSocket connection. (Do not suggest serializing process state here instead please)
Technically, in Caché WebSocket connection is represented by the class, which executes in its own process. This process is terminated when the connection is lost. In this case the JOBbed process does not terminates (thanks Edward), but it rely on $ZPARENT variable.
Is it possible to hold
Hi, Community!
Last weekend we held the Final of InterSystems Contest on Caché, DeepSee and iKnow under the aegis of IT Planet Student Championship in Ekaterinburg. BTW, this year we had more than 1,400 participants in InterSystems Contest.
One of the tasks for the final was to solve T9 Spelling problem with Caché ObjectScript and use the minimum code.
Problem description:
The Latin alphabet contains 26 characters and telephones only have ten digits on the keypad.We would like to make it easier to write a message to your friend using a sequence of keypresses to indicate the desired characters.
I am just trying to make a quick hand off HTTP production.I have the class built and compiled onto the server and the production is running as a service.When the production is called (by an inbound job) I can see that the HTTP.InboundAdapter is being used successfully and the stack continues all the up to ProcessInput where OnProcessInput is called in Ens.BusinessService.
NewBie's Corner Session 4 The Plus Sign and Concatenation Operators
Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.
Click on the Caché Cube in your system tray and select Terminal to try out the commands.
Plus Sign (+) operator
Typically, the Plus sign (+) adds two numbers together. This is true in COS (Caché ObjectScript), but COS uses it in other ways as well.
Set the variable X to a value of +12
Set the variable X to the value of +"ABC"
Here, the Set command sets the variable X to +"
NewBie's Corner Session 2 Variables Set and Write commands
Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.
Session 2 – Click on the Caché Cube in your system tray and select Terminal to try out the commands.
Variables
Like other computer programming languages, Caché uses Variables and the values they represent to control programming. Variables are elements that represent data values. Manipulating and interrogating variables is at the root of programming.
Hi,
If you want to import data from a mySQL export file (exported with mysqldump), you will find here a little script that could help.
Only the INSERT commands in the sql file are executed into Caché. Indices are not computed for better performance.
%NOINDEX, %NOCHECK and %NOLOCK are generated on each INSERT line.
Currently, the file can not contain a "),(" pattern inside the values part of the INSERT command. If this is the case, the line is skipped. This feature may be implemented in the extractValuesList method.
Feel free to improve it as needed.
Often when debugging COS code you get an error message such as '<UNDEFINED>test^routine *test' so the first thing you want to do is to take a look at this code and see what it is doing. From the command line you can:
ZLOAD routine ZPRINT test
Which means splitting the $zerror information into the routine name and the line and adding the zload/zprint commands. Also you often want to view the lines above the one where the error happened as this gives you some context of how you got to this line, using ZPRINT you could 'ZPRINT +1:test' but that may display hundreds of lines.
Since 2013.1 you can
I have some logging code that outputs task status information to a log file. I would like to make the log available for reading while it is open for writing. The file is opened using the "L" option (Lock):
Open tLogFile:"WASL" Set tLogOpen=1
My intent was to prevent multiple processes from accidentally writing to the file and having messy output. Unfortunately, if the process is taking longer than expected, one can not simply open the log file to figure out what is going on because the "L" lock prevents the file from being opened for reading as well as writing.
Is there a simple way to enforce a
Hi!
Want to share with you code snippet of try catch block I usually use in methods which should return %Status.
{
try {
$$$TOE(sc,StatusMethod())
}
catch e {
set sc=e.AsStatus()
do e.Log()
}
Quit sc
}
Here $$$TOE is a short form of $$$TROWONERROR macro.
Inside macro StatusMethod is any method you call which will return %Status value. This value will be placed into sc variable.
In case of sc contains error execution will be routed to try catch block. You can wrap any Status methods calls in your code if you need to catch the errors coming from them.
In try catch block I
I am using java gateway imported/proxy classes and JG business service. I need to load a dll at run time.
I use System.loadLibrary/System.load when in java. I’ve tried $ZF(-3,” C:\Windows\System32\pteidlibj.dll”) and $ZF(-4,1,"C:\Windows\System32\pteidlibj.dll") but I’m getting <DYNAMIC LIBRARY LOAD> error.
How can I load a dll at run time using COS?
Hello,
It is time for me to eat my own dog's food and start implementing unit test running with coverage :) I will be inundating IRC with questions at this point, but I have a more general question first.
In this tutorial, it is supposed that your unit tests are exported as XML first... But that's not very practical. Is there a way, instead, to run all tests from a given project without having this export?
My first thought on how to do this would be to:
Hello,
Still related to the unit test with coverage support project, one goal is to make that package available to everyone.
One possible way I already know of is that all fully qualified class names (ie, the package + the class name) start with %, which mean that on installation all classes will end up in the %SYS namespace, but this requires that the install be done as a user with the necessary privileges to write to %SYS.
This is rather convenient in my situation, sure; but is there another way which does not require such privileges?