Nueva publicación

検索

Pregunta
· 6 jun, 2025

Shared code execution speed

Let's suppose two different routines use one and the same chunk of code. From the object-oriented POV, a good decision is to have this chunk of code in a separate class and have both routines call it. However, whenever you call code outside of the routine as opposed to calling code in the same routine, some execution speed is lost. For reports churning through millions of transactions this lost speed might be noticeable. Any advice how to optimize specifically speed?
P.S. Whenever someone is talking about the best choice for whatever, I am always tempted to ask: "What are we optimizing?". Optimizing speed here.
P.P.S. I did notice that some classes speed is very different comparing with old style utilities, while doing largely the same, like exporting.

14 comentarios
Comentarios (14)3
Inicie sesión o regístrese para continuar
Artículo
· 6 jun, 2025 Lectura de 2 min

Converting Oracle Hierarchical Queries to InterSystems IRIS: Generating Date Ranges

If you're migrating from Oracle to InterSystems IRIS—like many of my customers—you may run into Oracle-specific SQL patterns that need translation.

Take this example:

SELECT (TO_DATE('2023-05-12','YYYY-MM-DD') - LEVEL + 1) AS gap_date
FROM dual
CONNECT BY LEVEL <= (TO_DATE('2023-05-12','YYYY-MM-DD') - TO_DATE('2023-05-02','YYYY-MM-DD') + 1);

In Oracle:

  • LEVEL is a pseudo-column used in hierarchical queries (CONNECT BY). It starts at 1 and increments by 1.
  • CONNECT BY LEVEL <= (...) determines how many rows to generate.
  • The difference between the two dates plus one gives 11, so the query produces 11 rows, counting backwards from May 12, 2023 to May 2, 2023.

Breakdown of the result:

LEVEL = 1  → 2023-05-12
LEVEL = 2  → 2023-05-11
...
LEVEL = 11 → 2023-05-02

Now the question is: How do you achieve this in InterSystems IRIS, which doesn’t support CONNECT BY?

One solution is to implement a SQL-style query using ObjectScript that mimics this behavior. Below is a sample CREATE QUERY definition that accepts a STARTDATE and a number of DAYS, and returns the descending list of dates.


✅ InterSystems IRIS: Implementing a Date Gap Query

CREATE QUERY GET_GAP_DATE(IN STARTDATE DATE, IN DAYS INT)
  RESULTS (GAP_DATE DATE)
  PROCEDURE
  LANGUAGE OBJECTSCRIPT

  Execute(INOUT QHandle BINARY(255), IN STARTDATE DATE, IN DAYS INT)
  {
    SET QHandle("start") = STARTDATE
    SET QHandle("days")  = DAYS
    SET QHandle("level") = 1
    RETURN $$$OK
  }

  Fetch(INOUT QHandle BINARY(255), INOUT Row %List, INOUT AtEnd INT)
  {
    IF (QHandle("level") > QHandle("days")) {
      SET Row = ""
      SET AtEnd = 1
    } ELSE {
      SET Row = $ListBuild(QHandle("start") - QHandle("level") + 1)
      SET QHandle("level") = QHandle("level") + 1
    }
    RETURN $$$OK
  }

  Close(INOUT QHandle BINARY(255))
  {
    KILL QHandle
    QUIT $$$OK
  }

You can run the above CREATE QUERY in IRIS System Management Portal, or through a tool like DBeaver or a Python/Jupyter notebook using JDBC/ODBC.


🧪 Example Usage:

To generate the same result as the Oracle query above, use:

SELECT * FROM GET_GAP_DATE(
  TO_DATE('2023-05-12', 'YYYY-MM-DD'),
  TO_DATE('2023-05-12', 'YYYY-MM-DD') - TO_DATE('2023-05-02', 'YYYY-MM-DD') + 1
);

This will output:

GAP_DATE
----------
2023-05-12
2023-05-11
...
2023-05-02
(11 rows)

🔁 Advanced Usage: Join with Other Tables

You can also use this query as a subquery or in joins:

SELECT * 
FROM GET_GAP_DATE(TO_DATE('2023-05-12', 'YYYY-MM-DD'), 11) 
CROSS JOIN dual;

This allows you to integrate date ranges into larger SQL workflows.


Hope this helps anyone tackling Oracle-to-IRIS migration scenarios! If you’ve built alternative solutions or have improvements, I’d love to hear your thoughts.

1 nuevo comentario
Comentarios (1)2
Inicie sesión o regístrese para continuar
Artículo
· 6 jun, 2025 Lectura de 6 min

Diseñar e implementar APIs REST en InterSystems IRIS a partir de especificaciones OpenAPI

​En el artículo anterior, Generación de Especificaciones OpenAPI, vimos qué es OpenAPI, por qué es útil para documentar los servicios REST y cómo generar un archivo de especificación en formato .yaml o .json. También exploramos cómo IRIS permite crear automáticamente esta documentación a partir del código existente, siguiendo el enfoque code-first.

Pero, ¿qué sucede si partimos del archivo OpenAPI en lugar del código? En otras palabras, ¿si primero definiéramos el comportamiento de nuestra API y luego generáramos las clases necesarias para implementarla en IRIS? Este método, conocido como enfoque specification-first, permite diseñar un servicio de manera clara y coherente, incluso antes de escribir la lógica de aplicación.

En este artículo veremos cómo utilizar este enfoque para construir una REST API completa en Intersystems IRIS a partir de una especificación OpenAPI 2.0.

Primer paso: construcción del archivo OpenAPI

El archivo OpenAPI 2.0 es un documento en formato JSON (o YAML) en el que se describen todas las API de la aplicación: las rutas disponibles (endpoints), los métodos HTTP soportados (GET, POST, PUT, DELETE...), los parámetros aceptados, las respuestas esperadas y mucho más.

Para construir correctamente este archivo, es fundamental conocer la estructura definida por el estándar OpenAPI 2.0
Algunos recursos útiles para profundizar son:

A continuación, se muestra un ejemplo sencillo de archivo openapi.json que define una API con un endpoint GET /hello:

{
  "swagger": "2.0",
  "info": {
    "title": "API example",
    "description": "Example of openAPI file",
    "version": "1.0.0"
  },
  "produces": [
    "application/json"
  ],
  "consumes": [
    "application/json"
  ],
  "paths": {
    "/hello": {
      "get": {
        "summary": "Sample greeting",
        "description": "Returns a greeting message",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "hello"
      }
    }
  }
}

Segundo paso: generación de las clases de la interfaz REST

Una vez creado el archivo de especificación, es posible utilizar una de las herramientas de gestión de APIs de InterSystems IRIS para generar automáticamente las tres clases principales que constituyen un servicio REST:

  • Clase de especificación (.spec)
    Subclase de %REST.Spec, que contiene la especificación OpenAPI 2.0 del servicio REST.
  • Clase de dispatch (.disp)
    Subclase de %CSP.REST, responsable de recibir las solicitudes HTTP y de invocar los métodos apropiados en la clase de implementación.
  • Clase de implementación (.impl)
    Subclase de %REST.Impl, contiene la implementación de la lógica de los métodos REST.

En este artículo se muestra cómo generar el servicio REST utilizando el servicio /api/mgmnt/.

Generación de las clases utilizando el servicio /api/mgmnt

  1. Utilizar Postman (o una herramienta similar) para crear un mensaje de solicitud HTTP como sigue:
    • Para la acción HTTP, seleccionar POST.
    • Para la URL, especificar una URL en el siguiente formato, usando la <baseURL> de tu instancia: https://<baseURL>/api/mgmnt/v2/namespace/myapp Donde namespace es el espacio de nombres en el que se desea crear el servicio REST y myapp es el nombre del paquete en el que se desea crear las clases. Ejemplo: http://localhost:1888/api/mgmnt/v2/myNamespace/Greetings  
    • En el cuerpo de la solicitud, pegar la especificación OpenAPI 2.0 de tu servicio web en formato JSON.
    • Especificar el tipo de contenido del cuerpo como JSON (application/json).
    • Como método de autenticación, usar Basic Auth e introducir como username y password las credenciales de un usuario con permisos de lectura/escritura sobre el espacio de nombres indicado.
  2. Enviar el mensaje de solicitud.
  • Caso de creación del servicio REST: si la llamada tiene éxito, InterSystems IRIS crea las clases .disp, .impl y .spec en el paquete del namespace especificado, y en Postman se recibirá el siguiente mensaje de confirmación:  { "msg": "New application myapp created" }
  • Caso de actualización del servicio REST: si la llamada tiene éxito, se recibirá el mensaje: {"msg": "Application lombardia.GUIConvenzioni.OMRREST updated"} Además, InterSystems IRIS regenerará completamente las clases .disp y .spec en el paquete especificado, y actualizará la clase .impl, conservando el código previamente implementado en ella. Atención: cualquier modificación manual realizada a la clase .disp será sobrescrita cada vez que se actualice la especificación, por lo que no se recomienda modificarla directamente.

Tercer paso: implementación de la lógica REST

Una vez generadas las tres clases (.spec, .disp, .impl), es momento de completar el servicio REST implementando la lógica de las operaciones.

Veamos un ejemplo concreto basado en la especificación mostrada anteriormente (que define un endpoint GET /hello).
Las clases generadas serán:

Clase Greetings.spec

Esta clase contiene la definición OpenAPI en formato JSON. No requiere modificaciones manuales, pero puede ser actualizada regenerándola mediante el servicio /api/mgmnt/ cada vez que se modifique la especificación.

Class Greetings.spec Extends Extends %REST.Spec [ ProcedureBlock ]
{

XData OpenAPI [ MimeType = application/json ]
  "swagger": "2.0",
  "info": {
    "title": "API example",
    "description": "Example of openAPI file",
    "version": "1.0.0"
  },
  ...
};
}

Clase Greetings.disp

Es la clase de dispatch la que conecta las rutas HTTP con los métodos de implementación. No es necesario (ni recomendable) modificarla, ya que se regenera cada vez que se actualiza la especificación.

Class Greetings.disp Extends %CSP.REST [ GeneratedBy = Greetings.spec.cls, ProcedureBlock ]
{

/// The class containing the RESTSpec which generated this class
Parameter SpecificationClass = "Greetings.spec";
/// Ignore any writes done directly by the REST method.
Parameter IgnoreWrites = 1;
/// Default the Content-Type for this application.
Parameter CONTENTTYPE = "application/json";
/// By default convert the input stream to Unicode
Parameter CONVERTINPUTSTREAM = 1;
/// The default response charset is utf-8
Parameter CHARSET = "utf-8";
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
  <Route Url="/hello" Method="GET" Call="hello"/>
</Routes>

ClassMethod hello() As %Status
{
    Try {
        Do ##class(%REST.Impl).%SetContentType("application/json")
        If '##class(%REST.Impl).%CheckAccepts("application/json") Do ##class(%REST.Impl).%ReportRESTError(..#HTTP406NOTACCEPTABLE,$$$ERROR($$$RESTBadAccepts)) Quit
        Set response=##class(Greetings.impl).hello()
        Do ##class(Greetings.impl).%WriteResponse(response)
    } Catch (ex) {
        Do ##class(%REST.Impl).%ReportRESTError(..#HTTP500INTERNALSERVERERROR,ex.AsStatus(),$parameter("Greetings.impl","ExposeServerExceptions"))
    }
    Quit $$$OK
}
}

Como se puede observar, esta clase mapea el endpoint /hello al método hello() presente en la clase Greetings.impl.

Clase Greetings.impl

Esta es la clase en la que se escribe la lógica de aplicación propiamente dicha. Es una subclase de %REST.Impl y se genera con métodos “vacíos” que deben ser implementados.

Class Greetings.impl Extends %REST.Impl [ ProcedureBlock ]
{
/// Returns a greeting message
ClassMethod hello() As %Status
{
  //write here your code..
}
}

Conclusión

Hemos visto cómo, a partir de una especificación OpenAPI 2.0, es posible construir una interfaz REST completa en InterSystems IRIS siguiendo el enfoque specification-first. Con unos pocos pasos, el framework nos proporciona una estructura lista para usar sobre la cual integrar nuestra lógica de negocio, permitiéndonos desarrollar APIs de manera clara, ordenada y escalable.

En el próximo artículo veremos cómo exponer efectivamente el servicio REST a través de una aplicación web de IRIS.

Comentarios (0)5
Inicie sesión o regístrese para continuar
Artículo
· 6 jun, 2025 Lectura de 3 min

Un coup de poids

image

Tel un coup de grâce, sans laisser aucune chance à l'adversaire, Kubernetes, plateforme open source, offre un univers de possibilités grâce à sa disponibilité (c'est-à-dire la facilité d'accès au support, aux services et aux outils). Cette plateforme permet de gérer les tâches et les services dans des conteneurs, ce qui simplifie grandement la configuration et l'automatisation de ces processus.

Comentarios (0)1
Inicie sesión o regístrese para continuar
Artículo
· 6 jun, 2025 Lectura de 4 min

Customize Your Marathi Wedding Card Online

Customize Your Marathi Wedding Card Online – Lagnpatrika Templates

Weddings are an expression of love, tradition, and joy—especially in Maharashtrian culture, where every ritual holds emotional significance. One of the first and most essential steps in announcing your special day is through a beautifully crafted Marathi wedding card, or Lagnpatrika. At Crafty Art, we help you design this first impression with elegance and cultural authenticity, offering an intuitive way to customize your Marathi wedding card online using professionally designed Lagnpatrika templates.

A Blend of Tradition and Modern Design

Our online collection of Marathi wedding invitation card templates is deeply rooted in traditional values while also embracing modern aesthetics. Whether you're planning a grand Maharashtrian wedding or a simple, intimate ceremony, Crafty Art provides a wide range of styles—from traditional motifs like mangal kalash, peacocks, and turmeric leaves to minimalistic and elegant floral themes.

Each template is carefully designed by artists who understand the essence of Maharashtrian culture. You can choose fonts that resemble traditional script styles and select layouts that reflect religious and ceremonial importance. These elements ensure that your invite not only looks beautiful but also feels heartfelt and personal.

Easy Customization in Marathi and English

One of the biggest challenges faced when creating a digital Lagnpatrika is language integration. With Crafty Art, you can customize your wedding invitation in both Marathi and English with ease. Whether you want your invite to be entirely in Marathi for a traditional touch or bilingual for wider accessibility, we make it simple.

Our user-friendly platform allows you to edit names, wedding dates, venues, RSVP details, and more. You can even personalize the invitation with spiritual quotes, family names, and cultural blessings—all in your chosen language. There’s no need for any graphic design skills; just choose a template, edit the content, and your perfect invite is ready in minutes.

Unique Features for a Personal Touch

Crafty Art offers unique features to ensure your wedding card stands out:

  • Photo Upload: Add your pre-wedding photos, couple portraits, or even family pictures to the invite.
  • Color Palette Options: Match your card’s color scheme with your wedding theme—traditional saffron, rich maroon, elegant gold, or soothing pastels.
  • Music Integration: For digital invitations, you can embed soft instrumental music or a Marathi wedding song to give your invite an emotional tone.
  • Digital and Print Ready: Once customized, your Lagnpatrika can be downloaded in high-quality formats, ready for digital sharing via WhatsApp or email and suitable for professional printing.

Eco-Friendly and Cost-Effective

Creating your Marathi wedding card online is not only quick and easy—it’s also environmentally conscious. With digital invitations, you reduce the need for paper, printing, and physical delivery, helping to create a more sustainable celebration. It also significantly lowers your invitation costs while still allowing you to maintain elegance and quality.

Suitable for Every Wedding Function

Whether it's the main wedding ceremony, engagement (saka har), haldi, mehendi, sangeet, or muhurt, you can find and customize invitation templates for every occasion on Crafty Art. Our platform gives you the flexibility to maintain a consistent design theme across all your invites, adding harmony and aesthetic appeal to your entire wedding journey.

How It Works

  1. Browse Templates: Explore a wide selection of Lagnpatrika templates categorized by style and occasion.
  2. Customize Content: Use the easy editor to enter your wedding details, select fonts, and change colors or images.
  3. Preview Instantly: View your customized invitation in real time.
  4. Download or Share: Download the card for printing or send it digitally to your guests.

Why Choose Crafty Art?

Crafty Art Customize Marathi Wedding Invitation combines the richness of Marathi culture with the ease of modern technology. Our platform ensures you don’t need a professional designer or printer to get a beautiful wedding card. Every couple deserves a wedding invitation that reflects their story, values, and heritage—and that’s what we deliver.

From traditional aesthetics to modern simplicity, from paper-ready formats to social media sharing, Crafty Art supports every couple in creating an invitation that’s not just seen—but remembered.

Marathi Wedding Card Online | Lagnpatrika Templates | Customize Marathi Wedding Invitation

Comentarios (0)1
Inicie sesión o regístrese para continuar