Robert Cemper · Feb 25, 2025 go to post

slightly shorter using Julian Date

USER>set hours=-3 write $zdt($zdth(hours*3600+$zdt($h,-2),-2))

Sorry, I just couldn't resist

Robert Cemper · Feb 25, 2025 go to post

From Ensemble.inc:
 

#define TRACE(%arg)             $$$catTRACE("user",%arg)
#define sysTRACE(%arg)          $$$catTRACE("system",%arg)
#define catTRACE(%cat,%arg)     Do:$$$DoTrace ##class(Ens.Util.Trace).WriteTrace(%cat,$$$CurrentClass,$$$CurrentMethod,%arg)
#;
#define DoTrace                 $S($D($$$EnsJobLocal("DoTrace")):$$$EnsJobLocal("DoTrace"),1:##class(Ens.Util.Trace).DoTrace())
#;
#define EnsJobLocal         %Ensemble
#;
. . . . 
Class Ens.Util.Trace [ Abstract, ClassType = "", ProcedureBlock, System = 4 ]
{
ClassMethod DoTrace()
{
	Set tJobConfigName=$$$JobConfigName
	Quit $G($$$ConfigTrace(tJobConfigName),0)||(""'=$G($$$JobTraceDevice))||$$$IsTerminalDevice($IO)
}

Robert Cemper · Feb 21, 2025 go to post

Never tried it for long time , but $system.CSP.Shell() might be a starting point
$system.CSP.*  seems to have some more useful methods.

Robert Cemper · Feb 20, 2025 go to post

I followed this rules with (1,1) as base
Starting any other point than (1,1) simply shortens the spiral.
now I reached 259

I really dislike the result as it is composed so unfriendly
just to save same bytes that nobody asked for.

Robert Cemper · Feb 19, 2025 go to post

I see a general problem in interpretation of the "spiral" 
so I took some drawing for aquadratíc and a rectangular matrix. 

  1. depending on the starting point you have to take a pre-designed direction
  2. if you hit the diagonal you have to turn right
  3. you have to invalidate the row/column you just were on
  4. proceeding to invalid points is not allowed.
  5. start a the central point is an immediate termination as it has no direction to proceed

The diagonal came to my mind thinking how to NOT increase the imaginative radius of the spiral.
The related subscripts for the diagonale points of an n*m are found as (-n/2+x,-m/2+y) 
The pink subscripts are obviously (n/2,m/2) and might be just virtual.   

As subscripts start with 1 and first  piece position  is also 1
some more adjustment of coordinates is required

I haven't written any useful line yet.

Robert Cemper · Feb 16, 2025 go to post

Just at a  2nd view also N=3 has that problem.
StarMiddleTop   (1,2) has the same Problem as MiddleRight (2,3)
Not all characters of the matrix show up in the result.
it shows DEFGHABI but  DEFGHABC looks similar correct according to published rules
Is this expected behavior? 

2cents more

Robert Cemper · Feb 16, 2025 go to post

The clockwise logic is simple for a  3*3 matrix
though starting with 4*4  there is some rule missing on how the handle a dead end
Starting at a corner (1,1) or similar is trivial. 
BUT:  starting at any other point may create a rathole or miss some boxes 

        Set matrix($Increment(matrix)) = "C,O,D,E"
        Set matrix($Increment(matrix)) = "U,C,H,G"
        Set matrix($Increment(matrix)) = "M,U,F,O"
        Set matrix($Increment(matrix)) = "S,I,F,L"

Start (1,1) is in the example but
Start (1,2) runs ODEGOLFISMU what is the next to (2,1) ?  (1,1)  or (2,2) or ??
worse with Start(2,2) already the first according to description could be
up (1,2) or right (2,3) or left (2,1)  leaving dead ends clockwise.
And this is only with N=4  larger grids may create multiple lost cells.
Clockwise spiral is just not detailed enough for a UNIQUE result to collect ALL cells
A rule how to handle / skip already consumed cells might improve.
Just as I type a non straight spiral solution to (2,2) consuming the full matrix
might be CUISMUCODEGOLFFH
 I fail to imagine grids >5*5
  

Robert Cemper · Feb 13, 2025 go to post

2 options:

set mylist = ""
for i = 1:1:5 {
    set item = "item"_i
    set mylist = mylist_$ListBuild(item)
}
zw mylist
kill mylist
for i = 1:1:5 set $li(mylist,i)="item"_i
zw mylist
Robert Cemper · Feb 6, 2025 go to post

As a first step I would search Journals to find the Globals affected
if they are not in IRISTEMP/CACHETEMP or PPG of if Journal is switched off.

In order to separate routine calls (abc^myroutine) from real ^globals
Though journal just shows Process Ids, no routine names.

Robert Cemper · Feb 6, 2025 go to post

Great idea.
Though it requires to run the whole application repeatedly.
Eventually need to fix transactions broken by <PROTECT> 

Robert Cemper · Feb 4, 2025 go to post

After un-install of my own python versions
PY was still there in a different hidden and protected version unknown for me.
I detected it using regedit 
C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\ 
I fail to explain where it came from (pre-installed win ?? )
Manual killing it and reinstallation of an official Python distribution fixed it.
BIG THANKS for your advise and help- 

Robert Cemper · Feb 4, 2025 go to post

Merci,
As noted I'm back to python 3.9.13.  sys.path looks correct
the problem persists
message log shows:

(17064) 1 [Generic.Event] Python library failed to LoadLibraryEx :126 C:\Program Files\Python313\python3.dll

NTFS error 126 indicates also a problem in DLL registry.
I used an official 64bit installer. Probably Pre-WIn11 design.

Robert Cemper · Feb 3, 2025 go to post

Your file format doesn't fit, but you are close.
UDL Header is missing, also leading blanks in the lines as you have no labels.
And you have to switch to namespace %SYS and back to make it work.

ROUTINE DisplayDB[Type=INT]
 new $namespace
 zn "%SYS"
 set db=##class(Config.Databases).DatabasesByServer("",.dbList)
 for i=1:1:$LENGTH(dbList,",") {
   set dbName= $PIECE(dbList,",",i)
   write dbName,!
 }
 quit
Robert Cemper · Feb 1, 2025 go to post

Try this from %Library.Routine: 
https://docs.intersystems.com/iris20243/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25SYS&CLASSNAME=%25Library.Routine#Delete
with flag=2

classmethod Delete(rtnname As %String, flag As %String = 0, supressbackup As %Boolean = 0, nsp As %String = $namespace) as %Status

Delete the routine rtnname. If the rtnname is not fully qualified we will resolve this into a fully qualified name first and then proceed with the rest of the delete. For example if you specify 'test' and there is a 'test.mac' it will resolve to this, if there was only a 'test.obj' it will resolve the name to this. The parameter flag specifies how much to delete. The options are:

  • 0 - Delete entire routine, for a MAC routine this will delete MAC, INT, OBJ. For an INT routine it will delete INT and OBJ, for a INC routine it will only delete the INC, for a BAS routine it will delete the BAS and the OBJ code.
  • 1 - Delete just the named routine, for example for a MAC routine it will only delete the MAC and it will leave the INT and OBJ if present.
  • 2 - Delete all the source code but leave any OBJ code.
Robert Cemper · Jan 28, 2025 go to post

I think SQL is correct. 
The. problem is caused by INSERT or UPDATE

  • for UPDATE NVL takes an existing field from a record and handles NULL
  • for INSERT there is just no existing record to take a field from

NVL() is not a synonym for $GET() we know from ObjectScript

Robert Cemper · Jan 23, 2025 go to post

Take a look into OpenExchange  there are 669 packages using Docker
Which means at least 90% of them are running on the latest free Community Versions down loaded.
I bet there are enough examples that fit your needs
 

Robert Cemper · Jan 22, 2025 go to post

something like this ?

| COL    | VAL |
| ------ | --- |
| codRep |        401,       428,       428,       464,       472 |
|  Abril |     100000,    180000,    160000,         0,         0 |
| Agosto |     100000,    350000,    200000,     90000,         0 |

then this is the SQL statement
 

SELECT 'codRep' "COL", list($JUSTIFY(codRepresentante,10)) "VAL"
   FROM Ped.MetasRepresen where ano=2024
Union All
SELECT ' Abril', list($JUSTIFY(vendasAbril,10)) 
   FROM Ped.MetasRepresen where ano=2024
Union All
SELECT 'Agosto', list($JUSTIFY(vendasAgosto,10))
   FROM Ped.MetasRepresen where ano=2024
Robert Cemper · Jan 22, 2025 go to post

I understand that you want to have full control of your version
Increment and Decrement eventually also more than just +1,-1
so VERSIONPROPERTY is a dead herring.
BUT: You can achieve this in combination with a little SQL method.

Property RowVer As %Integer [
   SqlComputeCode = { if $i({*},$g(%IncDec)) },
   SqlComputed,
   SqlComputeOnChange = (%%INSERT, %%UPDATE) ];
ClassMethod IncDec(step As %Integer = 0) As %Boolean [
      SqlName = IncDec, SqlProc ]
{
    set %IncDec=step quit 1
}

Now you can set the increment to any %Integer of your choice.
e.g.  -1 decrement by 1, 1 increment by 1,  0 leave it

How to use it:

INSERT OR UPDATE pck.myTable
    SET name='Omer'
    WHERE pck.IncDec(-2)=1
    AND .... any other conditions ....

the IncDec SQLmethod is used as a static method
it doesn't reference any row dependency
So it is executed once before any row related processing. 
if you omit it then row_version is not changed 
 

Robert Cemper · Jan 22, 2025 go to post

the posted link is limited to HS licensed users only 

HERE is an official public link: VERSIONPROPERTY
It does basically the same as my previous SqlComputeOnChange example
hidden and with less typing  

Robert Cemper · Jan 21, 2025 go to post

I feel deeply honored and congratulate all other winning contributors!
🌟🌟🌟🌟🌟🌟🌟

Robert Cemper · Jan 21, 2025 go to post

what you see as \x.... is the hex image of a $LB("SERVERA.FOO.BAR.ORG/STAGE", ......)
try ZZDUMP of any $LB()  and you see length + type + content
\t is the misinterpretation of length x\09
my guess it's the hex_dump of some object 

Robert Cemper · Jan 21, 2025 go to post

Calculated doesn't do it.
BUT; 
[ SqlComputed, SqlComputeOnChange = (%%INSERT, %%UPDATE)  ]