検索

Pergunta
· Nov. 7, 2024

What is the quickest way to get back into iris lite terminal after a 'halt'?

I hit halt in Iris lite terminal within VS Code and was exited out to PS prompt.  I was just curious what the best way / recommended way to get back into an InterSystems lite terminal would be?  Perhaps it is just to start a new InterSystems lite terminal from a the options listed previously in this post https://community.intersystems.com/post/how-run-objectscript-commands-vs....  I was just curious if there was a way to kick it off again from the PS prompt?

2 Comments
Discussão (2)2
Entre ou crie uma conta para continuar
Pergunta
· Nov. 7, 2024

Existing protections against XSS attacks on CSP pages ?

Is there any mechanism already implemented in IRIS to prevent XSS exploits ? 

This case happen when user input html/javascript content into fields and submit the page. If saved content is rendered as is, it's going to be executed by anyone visiting the page.

What I am looking for : 

  • Built-in protection mechanisms that can be enabled globally (eg: per web application) or per CSP page. Something similar to a web application firewall.
  • Functions to call manually that can detect such content in fields or sanitize them (remove unwanted content). I could implement such functions myself but don't want to re-invent the wheel or to take the risk to be not covering all the cases.
4 Comments
Discussão (4)2
Entre ou crie uma conta para continuar
Pergunta
· Nov. 7, 2024

IRIS Docker template not copying files

Using the Basic template for InterSystems IRIS development environment with Docker: github

If I use the Dockerfile_mini file and COPY a backup, the file shows up.

COPY ./20241104_1448.cbk /home/irisowner/dev 

ARG IMAGE=intersystemsdc/iris-community
FROM $IMAGE

WORKDIR /home/irisowner/dev
COPY ./20241104_1448.cbk /home/irisowner/dev
...

However if I use the Dockerfile with the additional features, the file is copied (via logs) but not on the container filesystem.

Is this a bug?

2 Comments
Discussão (2)1
Entre ou crie uma conta para continuar
Artigo
· Nov. 7, 2024 8min de leitura

Flexible Python Runtime para IRIS en Windows Server

Escribo esto para compartir algo que me pasó anoche: ¡¡¡IRIS 2024.3 ya no viene con Python por defecto!!!

¡Eso significa que hay que instalarlo uno mismo como usuario! 😅 La ventaja es que puedo elegir mi versión de Python 😁🤭💃 Pero el problema es que, al principio... no sabía qué hacer 😥. Al revisar la comunidad (me gusta mucho más que la documentación oficial, lo siento equipo de documentación de InterSystems 😓), encontré el siguiente enlace:

https://docs.intersystems.com/iris20242/csp/docbook/DocBook.UI.Page.cls?...

¡Hola, equipo de documentación de InterSystems, buen trabajo! ¡Me encantan los ejemplos! 😊

¡Vamos juntos!

1. Descargad Python de https://www.python.org/downloads/

OK, vamos a probar Python 3.12

2. Ejecutad el instalador de Python.

3. Haced clic en Personalizar instalación.

4. Haced clic en Siguiente hasta llegar a la pantalla de Opciones avanzadas.

5. Seleccionad la opción Instalar Python para todos los usuarios (debe poder utilizarlo también el usuario que ejecuta los procesos de IRIS)

Debo decir que este paso es muy importante 😱, porque no lo marqué en mi primera instalación y parece que causó que el Python integrado no funcionara 🤐

6. Haced clic en Instalar.

Ok... parece que eso es todo para la parte de instalación de Python 😁 Vamos a revisar la ruta para ver qué se ha instalado 😀

 

 

 

Ok, vamos a pasar al Portal de Gestión del lado de IRIS 😉

7. En el Portal de Gestión de InterSystems IRIS, id a Administración del sistema > Configuración > Configuraciones adicionales > Memoria avanzada.

8. En la página de Configuraciones de memoria avanzada, en la fila de PythonRuntimeLibrary, haced clic en Editar.

9. Introducid **C:\Program Files\Python312\python3.dll**.

«¡¡¡No escribáis la ruta entre comillas!!! ¡¡¡No escribáis la ruta entre comillas!!! ¡¡¡No escribáis la ruta entre comillas!!! », Esto es lo que encontré como error cuando seguí el "Ejemplo en Windows" y puse comillas dobles alrededor de la ruta... 😭😭😭. ¡Las instrucciones son muy confusas! 😭😭😭

10. Haced click en guardar.

11. En la página de Configuraciones de memoria avanzada, en la fila de PythonRuntimeLibraryVersion, haced clic en Editar.

12. Introducid 3.12.

13. Haced click en guardar.

 

Parece que la configuración está lista 😀 ¡Pasemos al terminal para la verificación final! 😊

14. Desde el Terminal, lanzad Python integrado y verificad que `sys.path` ahora incluya los directorios de paquetes de Python 3.11.

do ##class(%SYS.Python).Shell()

import sys
sys.path

quit()

 

15. Desde el Terminal, utilizad el método GetPythonInfo() de la clase %SYS.Python para ver la información de la versión de Python.

do ##class(%SYS.Python).GetPythonInfo(.info)

 

zw info

 

¡Se ve bien! 😀 Vamos a probar mi código.

He escrito una clase de utilidad para generar datos de prueba en JSON, ¡parece estúpido! 🤦‍♀️ Pero por favor, perdonadme, ¡todavía soy principiante en Python! 🤐

En mi clase, intento mezclar el uso entre scripts de objetos y Python 😁😁

¡Vamos, práctica, práctica y más práctica! 😆

Class Demo.utli.datagen Extends %RegisteredObject
{

ClassMethod obsGen() As %String [ Language = python ]
{
	#w ##class(Demo.utli.datagen).obsGen()
	import json
	#C:\InterSystems\IRISHealth\bin> .\irispip.exe install --target C:\InterSystems\IRISHealth\mgr\python\ iris
	#python -m pip install --target C:\InterSystems\IRISHealth\mgr\python\ iris
	import iris
	
	#Blood pressure: between 90/60 mmHg and 120/80 mmHg
	#Breathing: 12 to 18 breaths per minute
	#Pulse: 60 to 100 beats per minute
	#Temperature: 97.8°F to 99.1°F (36.5°C to 37.3°C); average 98.6°F (37°C)
	##gen bpsys 
	ranvalue=iris.cls("Demo.utli.datagen").resultValueGen("80-120")
	#print(ranvalue)
	ranvaluelist=ranvalue.split(',')
	bpsys=ranvaluelist[0]
	
	##gen bpdia 
	ranvalue=iris.cls("Demo.utli.datagen").resultValueGen("60-90")
	#print(ranvalue)
	ranvaluelist=ranvalue.split(',')
	bpdia=ranvaluelist[0]
	
	
	obs={'bpsys':bpsys,'bpdia':bpdia}
	#print(obs)
	
	return json.dumps(obs)
}

ClassMethod forTest() As %String [ Language = objectscript ]
{
	//w ##class(Demo.utli.datagen).forTest()
	set a={}.%FromJSON(..obsGen()) //from json tn dynamic object
	w a,!
	w "bpsys is "_a.bpsys_", bpdia is "_a.bpdia,!  // write the individual data
	set b=a.%ToJSON()	//from dynamic object to json
	w b,!
	
	// loop through the array using an iterator
	set iter = a.%GetIterator()
	while iter.%GetNext(.key , .value ) 
	{
		write !, ?5, "Key: ", key, ", Value: ", value, " type: ", a.%GetTypeOf(key)_" with value "_a.%Get(key)
	}
	w !
	return 1
}

ClassMethod labresultGen1() As %String [ Language = python ]
{
	#w ##class(Demo.utli.datagen).labresultGen1()
	import json
	import datetime
	#python -m pip install --target C:\InterSystems\IRISHealth\mgr\python\ iris
	import iris
	
	# init result
	initstr='{"labresults": [{"LabOrderNumber": "Lab24100001", "ItemNumber": "1", "ItemCode": "6690-2", "ItemCodeSystem": "LN", "ItemDesc": "Wbc", "ItemStatus": "F", "Value": "7.0", "Unit": "/nl", "RefRange": "3.8-11.0", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.552090", "UpdatedAt": "2024-10-21 16:49:01.552090"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "2", "ItemCode": "770-8", "ItemCodeSystem": "LN", "ItemDesc": "Neutros", "ItemStatus": "F", "Value": "68", "Unit": "%", "RefRange": "40-82", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.552090", "UpdatedAt": "2024-10-21 16:49:01.552090"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "3", "ItemCode": "736-9", "ItemCodeSystem": "LN", "ItemDesc": "Lymphs", "ItemStatus": "F", "Value": "20", "Unit": "%", "RefRange": "11-47", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.552090", "UpdatedAt": "2024-10-21 16:49:01.552090"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "4", "ItemCode": "5905-5", "ItemCodeSystem": "LN", "ItemDesc": "Monos", "ItemStatus": "F", "Value": "16", "Unit": "%", "RefRange": "4-15", "Abnormal": "H", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.552090", "UpdatedAt": "2024-10-21 16:49:01.552090"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "5", "ItemCode": "713-8", "ItemCodeSystem": "LN", "ItemDesc": "Eos", "ItemStatus": "F", "Value": "3", "Unit": "%", "RefRange": "0-8", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553096", "UpdatedAt": "2024-10-21 16:49:01.553096"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "6", "ItemCode": "706-2", "ItemCodeSystem": "LN", "ItemDesc": "Baso", "ItemStatus": "F", "Value": "0", "Unit": "%", "RefRange": "0-1", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553160", "UpdatedAt": "2024-10-21 16:49:01.553160"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "7", "ItemCode": "38518-7", "ItemCodeSystem": "LN", "ItemDesc": "Imm Gran", "ItemStatus": "F", "Value": "0", "Unit": "%", "RefRange": "0-2", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553160", "UpdatedAt": "2024-10-21 16:49:01.553160"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "8", "ItemCode": "789-8", "ItemCodeSystem": "LN", "ItemDesc": "Rbc", "ItemStatus": "F", "Value": "4.02", "Unit": "/pl", "RefRange": "4.07-4.92", "Abnormal": "L", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553296", "UpdatedAt": "2024-10-21 16:49:01.553296"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "9", "ItemCode": "718-7", "ItemCodeSystem": "LN", "ItemDesc": "Hgb", "ItemStatus": "F", "Value": "13.7", "Unit": "g/dl", "RefRange": "12.0-14.1", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553296", "UpdatedAt": "2024-10-21 16:49:01.553296"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "10", "ItemCode": "4544-3", "ItemCodeSystem": "LN", "ItemDesc": "Hct", "ItemStatus": "F", "Value": "40", "Unit": "%", "RefRange": "34-43", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553296", "UpdatedAt": "2024-10-21 16:49:01.553296"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "11", "ItemCode": "787-2", "ItemCodeSystem": "LN", "ItemDesc": "Mcv", "ItemStatus": "F", "Value": "80", "Unit": "fl", "RefRange": "77-98", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553296", "UpdatedAt": "2024-10-21 16:49:01.553296"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "12", "ItemCode": "mch", "ItemDesc": "Mch", "ItemStatus": "F", "Value": "30", "Unit": "pg", "RefRange": "27-35", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553296", "UpdatedAt": "2024-10-21 16:49:01.553296"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "13", "ItemCode": "mchc", "ItemDesc": "Mchc", "ItemStatus": "F", "Value": "32", "Unit": "g/dl", "RefRange": "32-35", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553296", "UpdatedAt": "2024-10-21 16:49:01.553296"}, {"LabOrderNumber": "Lab24100001", "ItemNumber": "14", "ItemCode": "plt", "ItemDesc": "Platelets", "ItemStatus": "F", "Value": "221", "Unit": "/nl", "RefRange": "140-400", "InputBy": "12", "InputOrg": "lab", "InputDateTime": "2024-10-21 16:49:01.553296", "UpdatedAt": "2024-10-21 16:49:01.553296"}]}'
	#print(initstr)
	
	# convert to dict
	initstrdic=json.loads(initstr)
	#print(initstrdic)
	
	# loop through the reslut
	labresults=initstrdic["labresults"]
	for result in labresults:
		# update the result
		x=datetime.datetime.now()
		result.update({"InputDateTime":x.strftime("%Y-%m-%d %H:%M:%S.%f")})
		result.update({"UpdatedAt":x.strftime("%Y-%m-%d %H:%M:%S.%f")})
		#print(result["RefRange"])
		ranvalue=iris.cls("Demo.utli.datagen").resultValueGen(result["RefRange"])
		#print(ranvalue)
		ranvaluelist=ranvalue.split(',')
		result.update({"Value":ranvaluelist[0]})
		result.update({"Abnormal":ranvaluelist[1]})
		#print(result)
	
	#print(labresults)
	# put the lab result list into dict
	labresultsdict={"labresults":labresults}
	return json.dumps(labresultsdict)
}

ClassMethod resultValueGen(range = "0-1") As %String [ Language = python ]
{
	import random
	#w ##class(Demo.utli.datagen).resultValueGen()
	# expecting the range is numeric which look like "3-17" with a dash seperator
	list1=range.split('-')
	lowerbound=int(float(list1[0]))
	uppderbound=int(float(list1[1]))
	#print(lowerbound)
	#print(uppderbound)
	if uppderbound==1:
		ranvalue=random.randrange(0, 2)
	else:
		a=lowerbound-2
		if a<0:
			a=0
		b=uppderbound+2
		ranvalue=random.randrange(a, b)
	rtstr=str(ranvalue)+','
	if ranvalue<lowerbound:
		rtstr=str(ranvalue)+',L'
	if ranvalue>uppderbound:
		rtstr=str(ranvalue)+',H'	
	return rtstr
}

}

 

OK vamos a probar en el terminal

 

Primero, cambio a mi espacio de nombres.

 

En segundo lugar, ejecuto el código:

 

Tiene buena pinta 😉, vamos a probar otra pieza

 

😁 no está mal, vamos a probar la última pieza.

 

Parece que funciona 😊

 

Gracias por leerlo 😚

Discussão (0)1
Entre ou crie uma conta para continuar
Anúncio
· Nov. 7, 2024

[Global Masters] Halloween Contest Results!

Thank you to everyone who joined our Spooky Stories Contest 👻 on Global Masters and shared your eerie tales with us! We loved diving into your mysterious, thrilling, and downright spooky stories. It was tough to pick just one winner, but we finally have a standout story to celebrate.

   

 And the winners are... 

🎉 Congratulations to @Robert Barbiaux and @Caro 
 Each of you has earned a spooky bonus of 500 points!

🏆Story by @Robert Barbiaux 

Twenty years ago, because of a software bug, I had to sort digital photos into the appropriate folders by eyeing them one by one, in the dead of the night. Those pictures came from a pathology lab macroscopy department, some of them are still haunting me and sending chills down my spine.

🏆Story by @Caro 

I once identified a bug in the codebase that had gone unnoticed for almost fifteen years. Looking at that old code felt like looking at the ghost of coders past. Truly spooky to imagine how it remained undetected for so long.

Feeling that eerie shiver? 👀💀
But it’s not just the winning stories that deserve attention! Here are some other very captivating entries from our participants:

Story by @Jason Neate 

In late October, as a student struggling to get a COBOL assignment to compile. I asked my tutor for help, but she was busy. Two days later, she sat down with me as I walked her through the code, explaining every stage. Mid-sentence, I froze, stunned. I turned to her, a look of horror in my eyes, and managed to stammer, “I.. I.. forgot a full stop. Slowly, I turned back to the screen, added the missing full stop, and hit "compile." It compiled. My tutor called it her “Fastest code review ever!”

Story by @Alessandra Carena 

I found the culprit behind our crashing app—a rogue print("Here!") statement buried in a function. Easy fix, right? I deleted it, saved, redeployed… but the logs still print “Here! Here! Here!”. A real nightmare! Finally, we discovered an old, hidden script on the test server, containing the original print("Here!"). We deleted it, refreshed the logs… silence at last. The bug was gone, but the horror lingers on.

Story by @Guillermo Velasco 

*Teams Notification Alert*

Story by @Vishal Pallerla 

Once, I rushed to fix a minor bug in the one of the tables in Prod SQL Server. I updated something using an update query UPDATE table SET column ='value'; I ran it forgetting the WHERE clause which updated entire table instead of just one record that was supposed to. My heart raced as I realized it and updated the data from back up, learning the hard way the importance of double-checking queries.

Story by @Danny Wijnschenk 

oops, i passed the *dead* line !

Happy Halloween, and stay tuned for more exciting activities!

P.S. Not a Global Masters member yet? Join the program here using your InterSystems SSO credentials.

1 Comment
Discussão (1)2
Entre ou crie uma conta para continuar