Robert Cemper · Oct 29, 2021 go to post

that's correct.
I see the need to understand the potential and the possibilitiies to apply if appropriate.
Actually, we do this with SQL and it is totally normal  [hopefully]
It should be as normal also for Embedded Py

Robert Cemper · Oct 29, 2021 go to post

In past, I have seen so many "re-invented wheels" on COS that were mostly kind of remakes of
existing packages or solutions. Though this is impressive from a coding point of view,
it is just a waste of energy from point of view of a project AND its maintenance.
I had similar experiences with SQL that was refused by "experienced" programmers
insisting on horrible $ORDER() / $QUERY() constructs almost un-supportable, to gain
a few microseconds of performance on a weekly report. 
The deeper reason: nobody explained it and trained them.
That's the behaviour to avoid. 

Robert Cemper · Oct 29, 2021 go to post

some hints.

  • use the opportunity to separate data from code. So you have already a new IRIS.DAT with all globals
  • create a fresh IRIS.DAT to be used just for routine (classes, ... )
  • now you should have a clean start of your IRIS instance
  • check if the globals are visible as expected, but neither classed not routines.
  • now open 1 Studio on Caché and 1 on your target IRIS namespace
  • next you can move all classes, routines, ... by drag&drop from Caché Studio to IRIS Studio
  •  
  • this last step could also be an XMLExport of all code and XML input but you miss eventually required adjustments.
Robert Cemper · Oct 28, 2021 go to post

I followed the first 3 sessions and just can strongly recommend following it.
To my opinion, it is MUST to follow them for anyone developing in IRIS in the future.

Robert Cemper · Oct 28, 2021 go to post

you set content-type application/x-www-form-urlencoded
BUT
is your content really urlencoded ?  
If NOT, decoding it may create some chaotic nonsense and definitely no XML

Robert Cemper · Oct 28, 2021 go to post

It's definitely not me.
As you seem to have not much background on IRIS you are probably on the wrong forum.
It's neither the place for  PHP nor MySQL
 

Robert Cemper · Oct 27, 2021 go to post

code sniplet:

set test="CONcatenate".url=""
for i=1:1:$l(test) s url=url_"%"_$zhex($a(test,i)) 

write
i=11
test="CONcatenate"
url="%43%4F%4E%63%61%74%65%6E%61%74%65"
Robert Cemper · Oct 26, 2021 go to post

Hi @Vic Sun , @Akshay Pandey :
Just to complete this discussion.

From Terminal I could run Py also from a JOB, and over CPIPE without problems.
From Studio Output all this FAILS.
Which makes clear that the process behind Studio is far away from being a normal
IRIS/Caché process and just good for editing and compiling.  FullStop.
I would even assume that running COS commands was not planned but rather an accident that happened 20 yerars ago.
 

Robert Cemper · Oct 26, 2021 go to post

I spent quite a while on the subject of python. Also the asynchronous $ZF(-2) + error log

write $zf(-2,"C:\Users\cemper\AppData\Local\Microsoft\WindowsApps\pythonw3.9.exe <c:\temp\in.py 1>c:\temp\5out.txt 2>c:\temp\5er.txt")

And the error from WINDOWS was always: the program can not be executed
A further reason to use
Embedded Python!

in.pyw is simply

print("success")
exit()

 

Robert Cemper · Oct 26, 2021 go to post

Just an idea:
I assumed that you use a local installation of IRIS
Is this correct ? 
Or does it run on some instance separate from your local WIN.
whoami is equivalent to echo %USERDOMAIN%\%USERNAME%

write $zf(-1,"hostname > c:\temp\hostname.txt")

may clarify this.
If it's not the same machine you need a PY installation this server

Robert Cemper · Oct 25, 2021 go to post

thanks for the clarification.   I had a similar experience with node.js before.
But was not so certain to know the reasoning.
yes
 

Robert Cemper · Oct 25, 2021 go to post

you can do it from SMP > SystemOperation > Databases > .....
or from Terminal, Namespace %SYS

%SYS>do ^DATABASE
 
 
 1) Create a database
 2) Edit a database
 3) List databases
 4) Delete a database
 5) Mount a database
 6) Dismount a database
 7) Compact globals in a database
 8) Show free space for a database
 9) Show details for a database
10) Recreate a database
11) Manage database encryption
12) Return unused space for a database
13) Compact free space in a database
14) Defragment a database
15) Show background database tasks
 
Option? 2
Database directory? ?
 
1) c:\intersystems\iris\mgr\
2) c:\intersystems\iris\mgr\ens\
3) c:\intersystems\iris\mgr\ens\ensenstemp\
4) c:\intersystems\iris\mgr\enslib\
5) c:\intersystems\iris\mgr\irislib\
6) c:\intersystems\iris\mgr\irislocaldata\
7) c:\intersystems\iris\mgr\iristemp\
8) c:\intersystems\iris\mgr\user\
 
Database directory? 8 c:\intersystems\iris\mgr\user\
 
 1)* Directory:                      c:\intersystems\iris\mgr\user\
 2)* Block size (bytes):             8192
 3)* Mirror DB Name:
 4)* Mirror Set Name:
 5)  Current Size (MB):              11
 6)  Max size (MB), 0=Unlimited:     0
 7)  Expansion size (MB), 0=Default: 0
 8)  Resource name:                  %DB_USER
 9)  Preserve global attributes:     Nein
10)  Global journal state:           Ja
11)  New global collation:           IRIS standard
12)  New global growth block:        50
13)  New global pointer block:       16
14)  Read Only:                      Nein
15)* Encrypted:                      Nein
 
Field number to change?
Robert Cemper · Oct 25, 2021 go to post

this looks like "python" is not recognized in the spawned process
You may try a full reference "C:\......python.exe...."   

Robert Cemper · Oct 25, 2021 go to post

If this is your container from GitHub I had no problem on oct.22, ~22:00 (CEST)
BUT:
- I run all docker just from the Win CMD line
- docker system prune  -f      to clean away all old junk
- docker-compose build       no extra flags
- docker-compose up -d        works as expected
- docker-compose logs         to verify the startup

Robert Cemper · Oct 23, 2021 go to post

"know for a fact that is possible to have multiple statements within a single query"
I wasn't aware of such a feature over the decades.
So it might be wise to get in contact with your personal Sales Engineer or contact WRC

Robert Cemper · Oct 23, 2021 go to post

So put it in a Stored procedure and deposit the conditions in a table.
Could be a classical case to use indirection or eXecute 
Whether maintaining a table or 70000 different WHERE should be the same effort.
At that point: Why to use SQL DELETE at all ?

Robert Cemper · Oct 23, 2021 go to post

I like your PY solution. That's a promising aproach.
Especiallly now with Embedded Py

Robert Cemper · Oct 23, 2021 go to post

BUT:   if you intend to have tablename1,  tablename2,  tablename3, ...
you better wrap it in a ClassMethod and  project it as Stored Procedure 

Robert Cemper · Oct 23, 2021 go to post

what about simply using OR in  your SQL: 

DELETE FROM TableName WHERE ID = 2
                         OR ID = 3
                         OR ID = 4
                         OR <whaever condition>
                         OR <whaever other condition>
Robert Cemper · Oct 22, 2021 go to post

Ah, that's something different.
You require a conversion table by location + a time range when DST is to be applied! 
Location is a static thing to be defined once.
DST is a real challenge as it depends on the region and requires annual adjustment by location.
Including the chance that Europe may split up next year or drop it at all.
It might make sense to get it from an external government source by country.
it is definitely not included in any InterSystems product.   

Robert Cemper · Oct 22, 2021 go to post

as by docs.
By default $ztz shows you geographic offset of your server to Greenwich. No DST !
so for Madrid  "write $ZTZ"  => -60

Robert Cemper · Oct 22, 2021 go to post

I see 2 principal ways:

  • using $ZDateTime(), $ZDateTimeH() function to convert your timestamp to Posix Format and then add or subtract whatever seconds offset you require, with the advantage to easily cross day boundaries
  • or to use system variable $ZTIMEZONE to adjust the timezone of your actual process independent of the system's time zone by any number of minutes
Robert Cemper · Oct 21, 2021 go to post

I miss my code quality!
Satisfying these "rules" kept me more busy than the rest of the code