Lorenzo Scalese · Aug 1, 2023 go to post

Another solution, 82 bytes:

/// ( -> -0.5/// ) -> 0.5ClassMethod IsValid(sAs%String) As%Boolean
{
 s z=0,s=$zstrip(s,"*E",,"()") f  s c=$a(s,$i(i)) ret:c<0 'z ret:$i(z,c-40.5)>00
}
Lorenzo Scalese · Aug 3, 2023 go to post

Variant 69 bytes:

ClassMethod IsValid(sAs%String) As%Boolean
{
1s c=$a(s,$i(i)) q:c<0 '$g(z) g:"()"'[$c(c) 1q:$i(z,c-40.5)>00 g 1
}
Lorenzo Scalese · Aug 3, 2023 go to post

Well done! Don't worry about your brain 😉  

; 67 bytes improvement by Julius Kavay1s c=$a(s,$i(i)) q:c<0 '$g(z) g:c=41-c+401q:$i(z,c-40.5)>00 g 1
Lorenzo Scalese · Aug 22, 2023 go to post

Hi @Guillaume Rongier !

Thank you!
Yes, I continue working on this project after writing this article.

I have to write a sequel.  
You can see a summary of the activity on this dashboard : 
 
And the detail for a CSP\REST here:

 

Lorenzo Scalese · Sep 27, 2023 go to post

Hi @Theo Stolker 

Thank you for your report!  I'll try these specifications.
Yes, we can discuss on Discord or using 'issue' on the GitHub page.

What operation did you do? (generate simple HTTP client or client production?)

Lorenzo Scalese · Sep 27, 2023 go to post

Hi @Theo Stolker ,

I just tested the "DID Manager" specification.

With the simple http client, I noticed a code generation issue with double-quoted HTTP status code. It's fixed.

I see a generated model like model.CompoundServicePropertiesserviceEndpoint empty. So, If we check the specification and we can see:

        serviceEndpoint:
          description: A map containing service references and/or endpoints.
          example: { 'auth': 'did:nuts:EwVMYK2ugaMvRHUbGFBhuyF423JuNQbtpes35eHhkQic/serviceEndpoint?type=auth' }
          type: object

It's a type object, but there is no schema defined, so we can't generate any properties in this case.
This is the same problem with the model model.OrganizationSearchResultorganization.

I also noticed external references in the specification file like :

        didDocument:
          $ref: '../common/ssi_types.yaml#/components/schemas/DIDDocument'

Indeed, this case is not supported. I haven't checked for all the specs, but I think the 2 cases noted are the cause for the empty models.

If we specify a URL, maybe it would be possible to download the external ref and load the definition (to analyze...).

Lorenzo Scalese · Sep 28, 2023 go to post

Thank you very much for your contribution @Theo Stolker .
Your pull request is merged and a new release on OEX has been published.  

I'm still wondering if there is a simple way to resolve external references, I'll check if something help with validator.swagger.io (this tools is already used by OpenAPI suite).  There is an option for external ref but I don't know yet what that implies, I have to test that.

Lorenzo Scalese · Sep 28, 2023 go to post

Finally, there is a solution @Theo Stolker .
If I parse by URL and send parameters "resolveFully=true" and "validateExternalRefs=true", the specification is fully resolved including external references.  I can't commit\push this update directly, because if a user puts a URL only accessible from inside his organization, It does not work.  It's not really a problem because the validator tools can be run locally in a container, but I have to update the documentation too.
I created the related issue 9 to follow the progression.  I can't continue anymore this morning.  I'll continue this evening.

Lorenzo Scalese · Oct 2, 2023 go to post

Hi @Robert Cemper ,

Stats very interesting to know.

I'm glad to read the French Community is reactive 😄.  

This weekend I've been working on integrating code from @Theo Stolker and bug fixes about openapi-suite.  I was very happy to have a contribution.  

I noticed all issues (tasks for improvement in fact) of a project currently in active development were opened, but already done.  With Kanban it's not enough to move an issue to "done status", we have to close explicitly.  I probably raised your stats with this repository journal-indexer.

Lorenzo Scalese · Oct 3, 2023 go to post

Hi @Raj Singh 

Just a suggestion:

Maybe identify "dark corner" candidates by checking if:

  • ipm install does not work
  • docker-compose build fails.

Send a notification to the owner and if there is no fix after a period (x months, to be determined) move the package to the "dark corner".  

Lorenzo Scalese · Oct 10, 2023 go to post

Hi @Luis Angel Pérez Ramos ,

Thank you very much for describing how to use JWT auth with IRIS web app.

How do you solve the problem with cross-origin for development?  (Basically we use the port 4200 in development mode)

I tested with the Parameter HandleCorsRequest = 1; in the dispatch class, also setup an Event class (%CSP.SessionEvents) to force the response header Access-Control-Allow-Origin to "*" but something was wrong.

The problem occurs the /login usage, not with others services in my route map

If you experienced the same problem, I'm interested in your solution :)

Thank you.

Lorenzo Scalese · Oct 10, 2023 go to post

Hi @Dmitry Maslennikov ,

Yesterday I experienced this kind of problem with web socket.
To limit the license usage, I did this : 

Class dc.journalindexer.WebSocket Extends%CSP.WebSocket
{

Method OnPreServer() As%Status
{
    Do%session.Login("wsuser",,1)
    Set..SharedConnection = 1; ... some lines of codeQuit sc
}

Method OnClientMessage(
	data As%String = "",
	closeAs%Integer) As%Status
{
    ; force logout and EndSession on disconnect from clientIf$Get(close) = 1 {
        Do%session.Logout()        
        Set%session.EndSession = 1Do..EndServer()
    }

	Quit0
}
}
Lorenzo Scalese · Mar 6, 2024 go to post

Technically this is not possible (I think). It can just send a message to the other process that decides to validate or not.

I needed this once (in abnormal situation), see this post 

Lorenzo Scalese · Nov 22, 2024 go to post

Hi @Davi Massaru Teixeira Muta ,

As far as i know, there is no lock log history.

This is understandable, as there would be a lot of them on heavily used systems.

If you can modify the application code, may be you can add log trace when this error happens.

With ^$LOCK you can retrieve the owner of a lock.

Example:

Lock +^my.global(1)
Write"Owner is : ", ^$LOCK($Name(^my.global(1)),"OWNER")
;Owner is : 5216

Even if you recover the PID, analysis can be difficult if the process no longer exists at the time you perform the analysis.  Maybe add something like this for logging (executed with a job):

/// Start this method in job ex:/// Job ##class(pkg.ClassName).TraceLock($Name(^my.global))ClassMethod TraceLock(lockname As%String) As%Status
{
    Set sc = $$$OKSet pid = ^$LOCK(lockname, "OWNER")
    If pid = "", $QLength(lockname)>0 {
        ; check if the node is fully lockedSet pid = ^$LOCK($QSubscript(lockname,0), "OWNER")
    }
    
    If pid = "" {
        ; no data ...Return sc	
    }
    
    Set key = $Increment(^debug.locktrace)
    
    Set^debug.locktrace(key, "from pid") = $ZParent; Just to keep a trace of the pid started this jobSet^debug.locktrace(key, "info") = $ZDateTime($Horolog, 3, 1) _ " The lock " _ lockname _ " owner is "_pid
    
    Set process = ##CLASS(%SYS.ProcessQuery).Open(pid)
    If$IsObject(process) {
        Set^debug.locktrace(key, "owner-UserName") = process.UserName
        Set^debug.locktrace(key, "owner-StartupClientIPAddress") = process.StartupClientIPAddress
        Set^debug.locktrace(key, "owner-StartupClientNodeName") = process.StartupClientNodeName
        Set^debug.locktrace(key, "owner-CurrentLineAndRoutine") = process.CurrentLineAndRoutine
        Set^debug.locktrace(key, "owner-Routine") = process.Routine
    }
    
    Return$$$OK; Exemple of result:;^debug.locktrace=1;^debug.locktrace(1,"from pid")=12964;^debug.locktrace(1,"info")="2024-11-22 12:25:25 The lock ^my.global owner is 5216";^debug.locktrace(1,"owner-CurrentLineAndRoutine")="";^debug.locktrace(1,"owner-Routine")="shell";^debug.locktrace(1,"owner-StartupClientIPAddress")="127.0.0.1";^debug.locktrace(1,"owner-StartupClientNodeName")="TRM:";^debug.locktrace(1,"owner-UserName")="_SYSTEM"
}

Hope this help.

Lorenzo.
 

Hi @Evgeny Shvarov !

I've just seen your message, I'll try to rebuild this project tomorrow, as I haven't had the opportunity to use it for a while.  I'm sure I've got a simple specification to test somewhere.

If you want, you can send me your specification by private message (discord) and I'll test it :)

Yes, that's it!
The methods generated in the “impl” class must return a %DynamicObject.  I think %WriteResponse accepts string, stream or %DynamicObject as parameters, but the most common usage is still %DynamicObject (The developer will always be free to modify according to his implementation) .  I'll put an issue on github for follow-up and fix it.  
edit: done in version 1.1.1