Call java function using XQuery in MarkLogic - xquery

Is it possible to call java function using XQuery in MarkLogic. ?
Please refer - https://stackoverflow.com/questions/65953901/calling-java-method-from-xquery
Example -
declare namespace math="java:java.lang.Math";
math:sqrt(2)

There's no way to directly call a Java function from MarkLogic XQuery. If the Java code is accessible through a web service, you can use xdmp:http-get and similar.
As noted by Martin, depending on what functionality you're trying to access, you might not need to use Java.

Related

Calling jar from XQuery

I have came across a situation where I have to call a jar with a string parameter and get the result. Is there any way i can able to do this? I came across a link where importing java:java.lang.Math namespace using Java function inside XQuery. This will help me to use library functions of Java. Is there any way I can call jar or customize function from XQuery?
MarkLogic doesn't have a way to directly call a Java method in a JAR file. The common practice is to have the required Java functionality available as a service, then call that from MarkLogic. For instance, you could set up Tomcat to host the functionality that lives in the JAR file.

Interacting with OptaPlanner through CLI instead of GUI

I am looking for a way to interact with OptaPlanner directly from the command line interface (CLI) without having to use the graphical user interface (GUI).
More specifically, I am looking to pass an XML file to the Employee Rostering function, and to get the solved XML back. Ultimately, I am looking to interact with OctaPlanner from my PHP application.
Any documentation for this?
Here is some what of an example of what I which to achieve:
http://www.c0940097.ferozo.com/applying-optaplanner-to-everyday-problems/
The UI is only for the examples. Take a look at CloudBalancingHelloWorld.java which solves without a UI.
Or, if you're looking for a more enterprise approach, use OptaPlanner Execution Server (also ASL), which exposes everything as REST api's.

FluentMigrator create index with custom operator

Can I express following PostgreSQL statement using Fluent Migrator:
CREATE INDEX index1 ON table1(column1 text_pattern_ops)
Can't seem to have a proper methods?
There is no straight forward way to do it using the Fluent interface. You could probably do it by executing direct native sql via the Execute function.

Call java method from the microsoft docx document

I want to call the one of java method of my java class file from the Microsoft docx type document?
Is there any simple and stable solution available for this ?If anybody having idea on this can you please share it with me?
Thanks in advance
Yatin Baraiya
Microsoft Language for MS docx is Visual Basic, you can't natively call java methods.
You could also execute a shell command to do what you want:
retValue = Shell("command", vbNormalFocus)
Found on How can I execute a shell command using VBA?
One way to do it would be to use IKVM to convert your Java code to a DLL, and to invoke that from say a VSTO Word add-in.
Another way would be to convert your Java code to a web service (SOAP or REST), and call that, either from a Word Add-In, or VBA (ie a Word macro). For SOAP, see for example http://jamesecampbell.blogspot.com.au/2012/11/how-to-consume-web-service-in-microsoft.html

Can I use an XLL add-in with SpreadsheetGear

I have a custom add-in that I need to use in SpreadsheetGear. Can I directly reference the XLL file, or is there a way of making an interface or wrapper to access it?
Thanks!
SpreadsheetGear has no APIs to interface with XLL files. There are APIs to create your own custom functions within SpreadsheetGear, so you could re-implement your custom functions using this API. I couldn't say whether it's possible to write some sort of wrapper around your XLL using SpreadsheetGear's Custom Function API.
For more information on our Custom Function API, see the SpreadsheetGear.CustomFunction namespace in our documentation (http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.6.0/SpreadsheetGear~SpreadsheetGear.CustomFunctions_namespace.html)
There's also a sample in the SpreadsheetGear Explorer Solutions for C#/VB (found in the "SpreadsheetGear 2010" folder under the Start Menu...assuming you have SG installed on your machine) that demonstrates building a simple custom function (under Calculations > Custom Functions).

Resources