Adam Skurek · Nov 3, 2016 go to post

ClassMethod Max(args...)
{
    q:(+$g(args)<2) $lb($g(args(+$g(args))),+$g(args))
    s max=$g(args(1))
    for i=2:1:args { s:($g(args(i))]]max) max=$g(args(i)),maxI=}
    q $lb(max,$g(maxI,1))
}

Adam Skurek · Apr 13, 2017 go to post

Thank you, it seems to work.

$SYSTEM.OBJ.Export("WRC.Text.cls","C:\export.xml","/recursive=1")

Adam Skurek · Jul 24, 2017 go to post

Be careful when using ##Unique.

The problems with scope of generated "unique" variable can introduce weird bugs (in some cases it is not as unique as you would expect; WRC problems 879820 and 879901).

Citing ISC support from WRC 879820:

The problem is that the variable name created by ##Unique is only unique among the set of variables 
for that method. However, the variable itself is globally scoped. 

Since the variable name is globally scoped, I think the variable names should be unique for the 
entire class, not just for the method. I will report this to development. Please note, however, 
since the variable is globally scoped, using the preprocessor directive as you are here will leak 
information to any code that calls this class. To prevent this, you should NEW the variable prior 
to using it:
#define A(%x) NEW #Unique(new) SET #Unique(old)=%x 

Also ##Unique directives cannot be used in nested macros (macro calling another macro; WRC 879901).

Adam Skurek · Sep 28, 2017 go to post

I am trying to generate same output as http://php.net/manual/en/function.crypt.php crypt function (CRYPT_MD5 flavor).

So for example

$salt=crypt("2Ggaobjb","$1$1a2b3c4d$");

returns $1$1a2b3c4d$Y5tt50CQ12xW2saeYnI43, which is not same as pure MD5 hash (like $SYSTEM.Encryption.MD5Hash).

From documentation it seems that crypt creates derived hash based on MD5, but it is not the same.

Adam Skurek · Sep 28, 2017 go to post

Thanks, but unfortunately I am unable to find suitable DLL for Win64 with crypt function. I have found 32bit version (GnuWin32/crypt), but it does not work on 64bit environment.

Adam Skurek · Sep 29, 2017 go to post

Thank you. We are now using Java gateway and we want to replace this with something more native.  So it seems that writing own implementation in COS is the only option left. I was hoping that someone has already done that ;)

Adam Skurek · Jun 6, 2017 go to post
Class ITPlanet.Task2 [ Abstract ]
{
 
ClassMethod Main() As %String
{
q $tr($h,",")
}
 

}

*You may need to set your date and time settings to 2111-05-30 12:00:10  ;)

Adam Skurek · Jun 13, 2018 go to post

I've contacted WRC about this, and their answer is that there is no built-in way.

They offered a workaround of enabling unauthenticated access and checking AUTHORIZATION header manually.

Adam Skurek · Dec 8, 2018 go to post

Is it possible that you added index definitions after you filled the table with data?

If that is the case, then those indices are not built ("empty"), and so if the query uses them, then it returns no data. In such case you have to build your indices manually via ##class(MML.Cities).%BuildIndices().

Adam Skurek · Jul 30, 2020 go to post

s dyn={}
d dyn.%Set("asNumber",123)
d dyn.%Set("asString",123,"string")


w dyn.%ToJSON()

{"asNumber":123,"asString":"123"}