Eduard Lebedyuk · Dec 25, 2018 go to post

Thanks for the info, Fabian.

I myself am a fan of Ubuntu  structure, do you know how to get that automatically on other OSes, primarily CentOS?

Eduard Lebedyuk · Dec 24, 2018 go to post

While spawning a process on Windows can be (and usually is) costly, linux offers better performance in that regard.

Additionally ImageMagick offers two C APIs: High-level and Low-Level they could be used to write a callout library, which would likely offer the best performance.

Eduard Lebedyuk · Dec 20, 2018 go to post

Great game!

Does not work, as object with that ID does not exist

zw ##class(OPNLib.Game.ConwayLifeGame).Test()
 
These are the settings for the test:
{"ID":1,"From":0,"To":200,"Iterations":200,"InitialConfig":5,"Rows":80,"Columns":150,"Vector0":"1,1","VectorN":"100,40"}
Press any key to continue... (Ctrl-C to stop)"0 "_$lb($lb(5002,"zCreateFromStatus+8^%Exception.StatusException.1 *tInfo(1,""code"")",,,,,,,,$lb(,"USER",$lb("^zCreateFromStatus+8^%Exception.StatusException.1^1","e^zThrowIfInterrupt+7^%Exception.StatusException.1^1","e^zTest+12^OPNLib.Game.ConwayLifeGame.1^2","e^^^0"))))/* ERROR #5002: Cache error: zCreateFromStatus+8^%Exception.StatusException.1 *tInfo(1,"code") [zTest+12^OPNLib.Game.ConwayLifeGame.1:USER] */

I added this code after read and it works:

If ..%ExistsId(pTest.ID) {
set g = ##class(OPNLib.Game.ConwayLifeGame).%OpenId(pTest.ID)
} else {
set g = ##class(OPNLib.Game.ConwayLifeGame).%New()
}
Eduard Lebedyuk · Dec 19, 2018 go to post

Check Dir method of %Net.SSH.SFTP class, it returns directory contents, including sub-directories.

Eduard Lebedyuk · Dec 19, 2018 go to post

If you're using InterSystems IRIS try this connection string (replacing values with appropriate):

"Driver=InterSystems ODBC Driver;Host=127.0.0.1;Port=56772;Database=USER;UID=myUsername;PWD="

and for Caché/Ensemble try (driver name could be InterSystems ODBC):

"Driver=Cache ODBC Driver;Host=127.0.0.1;Port=1972;Database=USER;UID=myUsername;PWD="

If the problem persist, check Audit log.

Eduard Lebedyuk · Dec 16, 2018 go to post

Thank you, Dmitry, I used Process Monitor to get relevant error:

Turns out dependent DLLs should be in bin folder or current folder, but not in callout library folder.

Eduard Lebedyuk · Dec 16, 2018 go to post

when you get the error <DYNAMIC LIBRARY LOAD>, you should look at cconsole.log (or messages.log for IRIS), where you may find code of error.

Thank you. Got this error

Error loading dll (c:\users\eduard\eclipse-c-workspace\helloworld\debuglib\libhelloworld.dll) is 126

It is possible that you build it for 32bit, but uses in 64bit instance.  In this case, you will get the error with code 139. if you got other code, you can google it.

I can get it to work if I compile it without a few lines, so I'm sure it's 64bit.

Eduard Lebedyuk · Dec 15, 2018 go to post

ObjectScript method:

WRITE $SYSTEM.SQL.CONVERT(expression,convert-to-type,convert-from-type)

is equal to SQL Convert function.

Eduard Lebedyuk · Dec 13, 2018 go to post

If that doesn't work too, try

SELECT 1

If it fails - connection/config problems.

If it succeeds it's something else.

Eduard Lebedyuk · Dec 12, 2018 go to post

%ObjectToJSON writes stream to current device. You need to write to stream:

set oMetadata = ... /// metadata is from ADT message which is dynamic object
set stream = ##class(%Stream.GlobalCharacter).%New()
set tSC = ##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONStreamFromObject(stream, oMetadata)
quit:$$$ISERR(tSC) tSC
set request = ##class(Ens.StreamContainer).%New(stream)
set tSC = ..SendRequestAsync(..JSONOperation,stream,0,,..MetadataContext)  /// send the stream to operation 

And your JSONOperation should be able to accept messages of Ens.StreamContainer class.

I just checked Ens.BusinessService:SendRequestAsync signature and it's:

Method SendRequestAsync(pTargetDispatchName As %String, pRequest As %Library.Persistent, pDescription As %String = "") As %Status
So maybe the last line should be just:

 set tSC = ..SendRequestAsync(..JSONOperation, stream)

Finally, use %ZEN.Auxiliary.altJSONProvider instad of %ZEN.Auxiliary.jsonProvider. It's faster.

Eduard Lebedyuk · Dec 11, 2018 go to post

At the very least changes in:

  • Query elements of any class
  • ClassMethods with [SqlProc] modifier

May require a query purge.

Eduard Lebedyuk · Dec 11, 2018 go to post

It could be easier just to log what client serves to a server in a form and do the same in objectscript.

Eduard Lebedyuk · Dec 10, 2018 go to post

Try this:

set test = 2

set sc=req.Get("/api?city=baltimore&postall_code=212", test)

it would display response error.

Also please post:

write $System.Status.GetErrorText(sc)
Eduard Lebedyuk · Dec 10, 2018 go to post

Try this.

1. Stop caché.

2. In  cache.cpf write correct remote license server

[LicenseServers]
LOCAL=host,port

where port usually is 4001

3. Start instance

Instance should start and show correct license information.

Eduard Lebedyuk · Dec 10, 2018 go to post

The benefits are:

  • You only need one license key for many servers
  • Server can consume however much licenses it needs, up to a specified max limit.

Use it for multiserver deployments.

Eduard Lebedyuk · Dec 9, 2018 go to post

Submitted code is not public by default.

Players get different inputs for puzzles.

All timings are calculated from the moment the puzzle is published, not the moment you start working on it.

Assuming fastest coder would publish the code, finding it and rewriting it is going to take time.

Moreover fastest solutions usually use, let's say, advanced language-specific concepts, so starting from scratch could often go even faster.

Eduard Lebedyuk · Dec 9, 2018 go to post

Are you talking about %SQL.Util.Procedures:CSVTOCLASS?

I've used it many times and it works with masked delimiters just fine.

Can you post an example?

Eduard Lebedyuk · Dec 3, 2018 go to post

%INLIST assumes a list structure and you're passing a string.

There are two ways so solve it:

1. Store list structure right from beginning. To do that define your property as:

Property mylist as %List(MAXLEN="") [InitialExpression = {$lb("route1", "route2", "route3"}];

and in your method you don't need $listbuild as you already have a list structure in your property, so replace:

set routeList = $LISTBUILD(mylist) 

with

set routeList = yourObj.mylist

2. If you already have a lot of comma-delimited strings, you can convert them to list. In this case property stays the same, but replace:

set routeList = $LISTBUILD(mylist) 

with

set routeList = $ListFromString(mylist)

I recommend first approach.

Also read the docs about $list functions. It is one of the core Cache concepts.

Eduard Lebedyuk · Dec 3, 2018 go to post

*** Do you see any drawback or issues with this? Can there be any other impact due to this?

This is absolutely not a recommended approach.

Here's how you can do it.

  1. Create your own class MyString that extends %String and specifies MAXLEN parameter (I recommend 5000 or 10000, but something specific in any case).
  2. Use %Dictionary package to iterate over all your persistent classes. In there:
    • open each class
    • iterate over its properties
    • change %String type if found to MyString
    • save class
  3. Recompile modified classes.
Eduard Lebedyuk · Dec 2, 2018 go to post

It reads up to 1000000 characters, not stopping on line terminator.

I want x variable to contain only one line from file.

Eduard Lebedyuk · Nov 29, 2018 go to post

Check LIKE documentation:

ESCAPE Clause
ESCAPE permits the use of a wildcard character as a literal character within pattern. ESCAPE char, if provided and if it is a single character, indicates that any character directly following it in pattern is to be understood as a literal character, rather than a wildcard or formatting character. The following example shows the use of ESCAPE to return values that contain the string '_SYS':

SELECT * FROM MyTable
WHERE symbol_field LIKE '%\_SYS%' ESCAPE '\'

So in your case:

SELECT ID, CompanyName
FROM Table1
WHERE CompanyName LIKE '%\%%' ESCAPE '\'