Rechercher

Article
· Dec 5, 2024 1m read

QuinielaML - Predicción de la 27ª jornada de la Quiniela

¿Listos para una nueva jornada de la Quiniela? Esta jornada un día antes de lo habitual ya que el cierre de la jornada será el viernes y no el sábado como habitualmente. 

Esta jornada se compone de los partidos de la 16ª jornada de Primera División y la 18ª de Segunda División, veamos los partidos que forman parte de la misma:

Esta es la predicción para Primera División:

Y aquí tenemos la Segunda División:

Aquí tenemos la Quiniela de la jornada:

¡Suerte a todos esta jornada!

Discussion (0)1
Log in or sign up to continue
Article
· Dec 5, 2024 3m read

Gateway de Linguagem externa Java

Se vocês gostam de Java e têm um ecossistema Java ativo no trabalho e precisam incorporar IRIS, isso não é um problema. A Gateway de Linguagem Externa de Java fará isso sem complicações, ou quase. Essa gateway serve como ponte entre Java e ObjectScript no IRIS. Vocês podem criar objetos de classes Java no IRIS e chamar seus métodos. Só precisam de um arquivo JAR para fazer isso.

Connection diagram: proxy object <-> Gateway object <-> TCP/IP <-> External server <-> target object

A primeira coisa que vocês devem fazer é configurar o ambiente. Para começar a usar a Gateway de Java, certifiquem-se de ter o seguinte:

  1. InterSystems IRIS: Instalado e funcionando.  
  2. Java Development Kit (JDK): Instalado e configurado

O segundo requisito pode parecer simples, já que vocês já usam Java no trabalho, mas não é. Devido a essa questão, descobriu-se que vocês precisam usar a versão 11 do JDK no máximo. Isso significa que vocês devem mudar a versão no seu IDE, o que pode causar bastante complicações

O próximo passo é verificar se tudo está funcionando e tentar instanciar um objeto de uma classe do sistema Java. Para isso, é necessário iniciar uma conexão, criar um objeto proxy e chamar um método. Embora possa parecer que se requer uma grande quantidade de código, na realidade se resume a uma única linha:

write $system.external.getJavaGateway().new("java.util.Date").toString()

Isso imprimirá a data e hora atual na tela.

Para ir além, podemos criar nossa própria classe em Java:


public class Dish {
	private String name;
	private String description;
	private String category;
	private Float price;
	private String currency;
	private Integer calories;
	
	public void setName(String name) {
		this.name = name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public void setPrice(Float price) {
		this.price = price;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public void setCalories(Integer calories) {
		this.calories = calories;
	}
	
	public String describe() {
		return "The dish "+this.name+" costs "+this.price.toString()+
				this.currency+" and contains "+this.calories+" calories!";
	}
}

e chamar seus métodos do ObjectScript:

 set javaGate = $SYSTEM.external.getJavaGateway()
 do javaGate.addToPath("D:\Temp\GatewayTest.jar")
 set dish = javaGate.new("Dish")
 do dish.setCalories(1000)
 do dish.setCategory("salad")
 do dish.setCurrency("GBP")
 do dish.setDescription("Very tasty greek salad")
 do dish.setName("Greek salad")
 do dish.setPrice(15.2)
 write dish.describe()

Como resultado, obteremos uma string com a descrição do prato criado:

The dish Greek salad costs 15.2GBP and contains 1000 calories!

Em Português: O prato Salada Grega custa 15,2 GBP e contém 1000 calorias!

De qualquer forma, aprendam mais sobre o uso das Gateways na Documentação e boa sorte implementando esse conhecimento em seus projetos!

Discussion (0)1
Log in or sign up to continue
Digest
· Dec 5, 2024

Participate in the InterSystems "Bringing Ideas to Reality" Contest

Dear Community member,

We'd like to invite you to join our next contest dedicated to creating useful tools to make your fellow developers' lives easier: 

🏆 Bringing Ideas to Reality Contest 🏆

Submit an application that implements an idea from the InterSystems Ideas Portal that has statuses Community Opportunity or Future Consideration.

Duration: December 2 - 22, 2024

Prize pool: $14,000

Don't miss this amazing chance to challenge yourself, work alongside other developers, and earn fantastic prizes. Spread the word and invite your friends and colleagues to take part as well!

We’re excited to see your innovative solutions!

>> Full contest details here.

We're looking forward to your entries 😉

Question
· Dec 5, 2024

Creating an Operation to Connect to an OAuth 2.0 Server

I have created an OAuth Client and have created the credentials etc successfully.

I have tested using the curl command and have received the token back from the Server using the terminal.

I now need to create an Operation to use my client credentials to connect to the Server and receive the token back.

What adapter would I use as I am unable to link my client credentials and secret  - currently  I am using the EnsLib.HTTP.OutboundAdapter
 but I am not sure if this is the correct.

2 Comments
Discussion (2)2
Log in or sign up to continue
Question
· Dec 5, 2024

JSON Structure Parsing Issue

Hello All,

I am facing an issue where the vendor seems to be sending two structures of JSON messages, but only one of them seems to work in my code.
I need help in allowing both the JSON structures to parse into the engine.

Working Example:

{
    "data":
        {
            "idNumbers":
            [
                {
                    "type":"322","number":"123456"
                }
            ]
            ,"0":
            {
                "con_type":"210"
            }
        }
    ,"meta":
    {
        "secret_key":"","origin_url":"url.co.uk"
    }
}

Not Working:

Context: Extra Square Brackets causing extra arrays and con type sent inside the same array.
Error: Error in the Json/HL7 conversion/transformation block, Origin URL not authorized!
{
    "data":
    [
        {
            "idNumbers":
                [
                    {
                        "type":"322","number":"123456","id":"4155"
                    }
                ]
        },
        {
            "con_type":"210"
        }
    ],
    "meta":
    {
        "secret_key":"","origin_url":"url.co.uk"
    }
}

 

My current code:

<assign name="Valid URL" property="context.ValidOriginUrl" value="##class(Ens.Util.FunctionSet).Lookup(&quot;CUH.DCIQToEpic.OriginUrl&quot;,$NAMESPACE,&quot;&quot;,3)" action="set" xpos='200' ypos='450' >
</assign>
<assign name="Valid ContactType" property="context.ValidContactType" value="##class(Ens.Util.FunctionSet).Lookup(&quot;CUH.DCIQToEpic.ContactType&quot;,$NAMESPACE,&quot;&quot;,3)" action="set" xpos='200' ypos='550' >
</assign>
<assign name="Valid IDNumberType" property="context.ValidIDNumberType" value="##class(Ens.Util.FunctionSet).Lookup(&quot;CUH.DCIQToEpic.IDNumberType&quot;,$NAMESPACE,&quot;&quot;,3)" action="set" xpos='200' ypos='650' >
</assign>
<if name='Check OriginUrl' condition='context.JsonObjectIn.meta."origin_url"=context.ValidOriginUrl' xpos='200' ypos='850' xend='200' yend='2250' >
<true>
<if name='Check Contact Type' condition='(context.JsonObjectIn.data."0"."con_type"=context.ValidContactType)||(context.JsonObjectIn.data."con_type"=context.ValidContactType)' xpos='470' ypos='1000' xend='470' yend='2150' >
<true>
<if name='Check idNumber Type' condition='(context.JsonObjectIn.data.idNumbers.GetAt(1).type)=context.ValidIDNumberType' xpos='740' ypos='1150' xend='740' yend='2050' >
<true>

I need help/suggestions in getting the code modified to accept both the JSON structures.

6 Comments
Discussion (6)1
Log in or sign up to continue