Question Eduard Lebedyuk · May 18, 2016

In MySQL I have the following table:

CREATE TABLE `info` (
   `created` int(11)
);

And it is linked (via JDBC SQL Gateway) to Cache table mysql.info.  `created` field stores unix timestamp. So when I execute  this SQL in SMP:

SELECT created FROM mysql.info

I receive the following output (which is expected):

created
1435863691
1436300964

But I want to to display `created` field converted to ODBC timestamp format. To do that I call this SQL procedure

Class mysql.utils [ Abstract ]
{
/// Unix timestamp to ODBC
ClassMethod uto(unixstamp As %Integer) As %TimeStamp [ SqlName = uto, SqlProc ]
{
    set startday = $zdh("1970-01-01 00:00:00",3)
    set endday = (unixstamp \ (60 * 60 * 24))
    set endtime = (unixstamp # (60 * 60 * 24))
    set totalday = endday + startday
    quit $zdt(totalday _ "," _ endtime, 3)
}
}
3
0 1067
Article Eduard Lebedyuk · Apr 25, 2016 6m read

Introduction

If you manage multiple Caché instances across several servers, you may want to be able to execute arbitrary code from one Caché instance on another. System administrators and technical support specialists may also want to run arbitrary code on remote Caché servers. To address these needs, I have developed a special tool called RCE.
In this article, we will discuss what are the typical ways of solving similar tasks and how RCE (Remote Code Execution) can help.

What possible approaches are available?

1
1 3331
Question Eduard Lebedyuk · Apr 10, 2016

Here's my code (download):

Class Utils.Generators [ Abstract ]
{

ClassMethod B()
{
    s ^a = 1
}

ClassMethod A() [ CodeMode = objectgenerator, GenerateAfter = B, PlaceAfter = B ]
{
    k ^a
    do ..B()
}

Now, obviously for it to work I need method B compiled and ready to use before compiling method A().

I test it with the following code:

Yet, I receive the following compilation error:

Compilation started on 04/10/2016 18:39:04 with qualifiers ''
Compiling class Utils.Generator
ERROR #5002: Cache error: <CLASS DOES NOT EXIST>A+2^Utils.Generator.G1 *Utils.Generator
  > ERROR #5490: Error running generator for method 'A:Utils.Generator'
ERROR: Utils.Generator.G1.int(A+2) : <CLASS DOES NOT EXIST>
ERROR: Utils.Generator.cls(A) of generated code
    > ERROR #5030: An error occurred while compiling class 'Utils.Generator'
Compiling routine Utils.Generator.1
Detected 1 errors during compilation in 0.006s.
2
0 1040
Question Eduard Lebedyuk · Mar 28, 2016

Hello.

For debugging purposes I  sometimes need to display stack information to the current device or save it (to a global for example).

There is this snippet offered in documentation:

ClassMethod StackToDisplay()
{
    For loop = 0:1:$Stack(-1) {
        Write !, "Context level:", loop, ?25, "Context type: ", $Stack(loop)
        Write !, ?5, "Current place: ", $Stack(loop, "PLACE")
        Write !, ?5, "Current source: ", $Stack(loop, "MCODE")
        Write !
    }
}
11
0 1849
Question Eduard Lebedyuk · Mar 20, 2016

Here's the screenshot of the sidebar widget "Related conversations":

 

The question turn-key export of data for XML-enabled class currently has 2 answers, 0 comments for the post and 1 comment for an answer. I think it would be more informative to display one of these metrics in the widget:

  • Number of answers and comments for post and comments for answers
  • Number of answers and comments for post
  • Number of answers

Instead of the current value of number of comments for post.

2
0 297
Article Eduard Lebedyuk · Feb 19, 2016 12m read

Suppose you have developed your own app with InterSystems technologies stack and now want to perform multiple deployments on the customers' side. During the development process you've composed a detailed installation guide for your application, because you need to not only import classes, but also fine-tune the environment according to your needs.
To address this specific task, InterSystems has created a special tool called %Installer. Read on to find out how to use it.

9
4 4738
Article Eduard Lebedyuk · Feb 5, 2016 11m read

Class Queries in InterSystems IRIS (and Cache, Ensemble, HealthShare) is a useful tool that separates SQL queries from Object Script code. Basically, it works like this: suppose that you want to use the same SQL query with different arguments in several different places.In this case you can avoid code duplication by declaring the query body as a class query and then calling this query by name. This approach is also convenient for custom queries, in which the task of obtaining the next row is defined by a developer. Sounds interesting? Then read on!

17
7 7817
Question Eduard Lebedyuk · Dec 16, 2015

Hello.

I want to store a mailbox in Caché, persistently.

Does anyone have some code for downloading all messages from mailbox into Caché? And maybe automatic syncing after download? I know, there is  %Net.POP3 but maybe someone has already done that.

Thank you.

12
0 1489