Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 26 16:58

    axkr on master

    JUnit tests (compare)

  • May 25 18:58

    axkr on master

    Clean up Range() function (compare)

  • May 25 18:32

    axkr on master

    markdown CorrelationDistance more rules Bessel introduec F#mapXXX()functions and 11 more (compare)

  • May 25 06:23

    dependabot[bot] on maven

    (compare)

  • May 25 06:23

    axkr on master

    Bump classgraph from 4.8.146 to… (compare)

  • May 25 06:23
    axkr closed #525
  • May 25 04:16
    gitpod-io[bot] commented #525
  • May 25 04:16
    dependabot[bot] labeled #525
  • May 25 04:16
    dependabot[bot] labeled #525
  • May 25 04:16
    dependabot[bot] opened #525
  • May 25 04:16

    dependabot[bot] on maven

    Bump classgraph from 4.8.146 to… (compare)

  • May 24 23:26
    HannesWell commented #193
  • May 24 04:58

    dependabot[bot] on maven

    (compare)

  • May 24 04:58

    axkr on master

    Bump RoaringBitmap from 0.9.27 … (compare)

  • May 24 04:58
    axkr closed #524
  • May 24 04:17
    gitpod-io[bot] commented #524
  • May 24 04:17
    dependabot[bot] labeled #524
  • May 24 04:17
    dependabot[bot] labeled #524
  • May 24 04:17
    dependabot[bot] opened #524
  • May 24 04:17

    dependabot[bot] on maven

    Bump RoaringBitmap from 0.9.27 … (compare)

TiMauzi
@TiMauzi
And then getVariablesArray(calcExpr);
Since I need the string representation anyway, I think the effort is similar, no?
Axel Kramer
@axkr
If you use regex it might be slower:
TiMauzi
@TiMauzi
Good to know, thanks for the hint!
I'll try your approach later, then :)
TiMauzi
@TiMauzi

@axkr In https://github.com/axkr/symja_android_library/blob/d1e78f694be9b7b0bea4abbacbd924c8512adc38/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/F.java#L3907 there is the following part of the code:

        String autoload = ".\\Autoload";
        if (FEConfig.PARSER_USE_LOWERCASE_SYMBOLS) {
          autoload = ".\\AutoloadSymja";
        }
        File sourceLocation = new File(autoload);

Symja creates a file here. Since I'm writing an Elasticsearch plugin, creating files doesn't seem to be allowed. Is there a way of using Symja without addtional files being implicitly created by ExprEvaluator?

Axel Kramer
@axkr
@TiMauzi can you please try something like this for automatically loading init scripts:
Axel Kramer
@axkr
try {
          String autoload = ".\\Autoload";
          if (FEConfig.PARSER_USE_LOWERCASE_SYMBOLS) {
            autoload = ".\\AutoloadSymja";
          }
          File sourceLocation = new File(autoload);
          final String[] files = sourceLocation.list();
          if (files != null) {
            for (int i = 0; i < files.length; i++) {
              if (files[i].endsWith(".m")) {
                File sourceFile = new File(sourceLocation, files[i]);
                FileFunctions.Get.loadPackage(EvalEngine.get(), sourceFile);
              }
            }
          }
        } catch (java.security.AccessControlException acex) {
          // no read access for current user
          acex.printStackTrace();
        } catch (RuntimeException ex) {
          ex.printStackTrace();
        }
TiMauzi
@TiMauzi

@axkr Following output if I place this test right in front of the part of my plugin that crashes when executed:

[2021-05-14T00:21:32,244][WARN ][stderr                   ] [TIM] java.security.AccessControlException: access denied ("java.io.FilePermission" ".\AutoloadSymja" "read")
[2021-05-14T00:21:32,245][WARN ][stderr                   ] [TIM]       at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
[2021-05-14T00:21:32,246][WARN ][stderr                   ] [TIM]       at java.base/java.security.AccessController.checkPermission(AccessController.java:1036)
[2021-05-14T00:21:32,246][WARN ][stderr                   ] [TIM]       at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:408)
[2021-05-14T00:21:32,246][WARN ][stderr                   ] [TIM]       at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:747)
[2021-05-14T00:21:32,247][WARN ][stderr                   ] [TIM]       at java.base/java.io.File.list(File.java:1131)
[2021-05-14T00:21:32,247][WARN ][stderr                   ] [TIM]       at org.elasticsearch.index.search.CommutingQuantumScorer.score(CommutingQuantumScorer.java:96)
...

(The last method before I skipped the rest is the method I placed the test in.)

TiMauzi
@TiMauzi
I found out that Elasticsearch doesn't want people to have any FilePermission. That's why I asked if there is any way to not letting Symja create some file
Axel Kramer
@axkr
@TiMauzi If you don't need any scripts, do you need an option to simply skip the autoload part?
TiMauzi
@TiMauzi
What kind of "scripts" do you mean?
formulaEvaluator.eval("deMorganDisCon = {x_ || y_ :> !(!x && !y)}");
formulaEvaluator.eval("deMorganConDis = {x_ && y_ :> !(!x || !y)}");
Something like this? ^-^' @axkr
If you mean this, then it might hurt a bit but I might be able to solve it in another way.
Axel Kramer
@axkr
I meant "script" packages which could be automatically loaded on startup like this one: https://github.com/axkr/symja_android_library/wiki/context
TiMauzi
@TiMauzi
Oh you mean that >>I<< want to use external files? Then no
In this case I don't need any scripts
I just need the basic symja functionalities @axkr
TiMauzi
@TiMauzi
@axkr So you mentioned an option to skip the autoload part, is there any I'm not aware of? :O
Axel Kramer
@axkr
no I have to introduce it.
I think I will simply skip the part and do some logging like this:
private static final Logger logger = LogManager.getLogger(F.class);

...

...
      try {  
...

...
        } catch (java.security.AccessControlException acex) {
          // no read access for current user
          logger.warn("Cannot read packages in autoload folder:", acex); 
        } catch (RuntimeException ex) {
          logger.error(ex); 
        }
TiMauzi
@TiMauzi
That looks reasonable :)
TiMauzi
@TiMauzi

@axkr Also, part of Symja seems to need the RuntimePermission "shutdownHooks":

[2021-05-14T17:52:09,382][WARN ][stderr                   ] [TIM] java.lang.ExceptionInInitializerError
[2021-05-14T17:52:09,382][WARN ][stderr                   ] [TIM]       at org.matheclipse.core.expression.F.<clinit>(F.java:599)
[2021-05-14T17:52:09,383][WARN ][stderr                   ] [TIM]       at org.matheclipse.core.eval.ExprEvaluator.<clinit>(ExprEvaluator.java:133)
...
[2021-05-14T17:52:09,391][WARN ][stderr                   ] [TIM] Caused by: org.apfloat.ApfloatConfigurationException: Error setting property "cleanupAtExit" to value "true"
[2021-05-14T17:52:09,392][WARN ][stderr                   ] [TIM]       at org.apfloat.ApfloatContext.setProperty(ApfloatContext.java:1025)
[2021-05-14T17:52:09,392][WARN ][stderr                   ] [TIM]       at org.apfloat.ApfloatContext.setProperties(ApfloatContext.java:1270)
[2021-05-14T17:52:09,392][WARN ][stderr                   ] [TIM]       at org.apfloat.ApfloatContext.<init>(ApfloatContext.java:331)
[2021-05-14T17:52:09,392][WARN ][stderr                   ] [TIM]       at org.apfloat.ApfloatContext.<clinit>(ApfloatContext.java:1388)
[2021-05-14T17:52:09,393][WARN ][stderr                   ] [TIM]       ... 28 more
[2021-05-14T17:52:09,393][WARN ][stderr                   ] [TIM] Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "shutdownHooks")
[2021-05-14T17:52:09,393][WARN ][stderr                   ] [TIM]       at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
...

I assume it is caused by the property cleanupAtExit. Is it possible to not let it being set to true?

Axel Kramer
@axkr
@TiMauzi my environment is different from yours. Can you test, if the ApfloatContextcan be changed here:
by adding a line
ctx.setCleanupAtExit(false);
TiMauzi
@TiMauzi
Okay, give me a second
Just a question, you mean in my own code, right?
Because I don't have any ApfloatContext object there
Since it's implicitly created by ExprEvaluator
Axel Kramer
@axkr
Oh, I'd thought you already used a modified Symja version?
TiMauzi
@TiMauzi
No, not at all
Axel Kramer
@axkr
Ok then lets add in your code this test:
ApfloatContext ctx = ApfloatContext.getContext();
      ctx.setNumberOfProcessors(1);
      ctx.setCleanupAtExit(false);
TiMauzi
@TiMauzi
Alright, I'll be back in a moment
Axel Kramer
@axkr
if possible after the initialization of ExprEvaluator
TiMauzi
@TiMauzi
Okay, at the moment I'm trying it before the ExprEvaluator. I'll try the other version after that
Axel Kramer
@axkr
I'll be away for some minutes
TiMauzi
@TiMauzi
Take your time :)
First result after placing the test before the ExprEvaluator initialization:
[2021-05-14T18:23:42,388][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [TIM] fatal error in thread [elasticsearch[TIM][search][T#1]], exiting
java.lang.ExceptionInInitializerError: null
        at org.elasticsearch.index.search.CommutingQuantumScorer$1.run(CommutingQuantumScorer.java:93) ~[?:?]
        at java.security.AccessController.doPrivileged(AccessController.java:312) ~[?:?]
        at org.elasticsearch.index.search.CommutingQuantumScorer.score(CommutingQuantumScorer.java:90) ~[?:?]
...
Caused by: org.apfloat.ApfloatConfigurationException: Error setting property "cleanupAtExit" to value "true"
        at org.apfloat.ApfloatContext.setProperty(ApfloatContext.java:1025) ~[?:?]
        at org.apfloat.ApfloatContext.setProperties(ApfloatContext.java:1270) ~[?:?]
        at org.apfloat.ApfloatContext.<init>(ApfloatContext.java:331) ~[?:?]
        at org.apfloat.ApfloatContext.<clinit>(ApfloatContext.java:1388) ~[?:?]
        ... 26 more
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "shutdownHooks")
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:?]
        at java.security.AccessController.checkPermission(AccessController.java:1036) ~[?:?]
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:408) ~[?:?]
        at java.lang.Runtime.addShutdownHook(Runtime.java:212) ~[?:?]
        at org.apfloat.ApfloatContext.setCleanupAtExit(ApfloatContext.java:901) ~[?:?]
        at org.apfloat.ApfloatContext.setProperty(ApfloatContext.java:1016) ~[?:?]
        at org.apfloat.ApfloatContext.setProperties(ApfloatContext.java:1270) ~[?:?]
        at org.apfloat.ApfloatContext.<init>(ApfloatContext.java:331) ~[?:?]
        at org.apfloat.ApfloatContext.<clinit>(ApfloatContext.java:1388) ~[?:?]
        ... 26 more
fatal error in thread [elasticsearch[TIM][search][T#1]], exiting
...
TiMauzi
@TiMauzi
And a similar error if I place it after ExprEvaluator calcEvaluator = new ExprEvaluator(false, (short) 100);:
[2021-05-14T18:30:37,109][WARN ][stderr                   ] [TIM] java.lang.ExceptionInInitializerError
[2021-05-14T18:30:37,109][WARN ][stderr                   ] [TIM]       at org.matheclipse.core.expression.F.<clinit>(F.java:599)
[2021-05-14T18:30:37,110][WARN ][stderr                   ] [TIM]       at org.matheclipse.core.eval.ExprEvaluator.<clinit>(ExprEvaluator.java:133)
...
[2021-05-14T18:30:37,120][WARN ][stderr                   ] [TIM] Caused by: org.apfloat.ApfloatConfigurationException: Error setting property "cleanupAtExit" to value "true"
[2021-05-14T18:30:37,120][WARN ][stderr                   ] [TIM]       at org.apfloat.ApfloatContext.setProperty(ApfloatContext.java:1025)
...
[2021-05-14T18:30:37,122][WARN ][stderr                   ] [TIM] Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "shutdownHooks")
...
[2021-05-14T18:30:37,124][WARN ][stderr                   ] [TIM]       ... 31 more
[2021-05-14T18:30:37,133][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [TIM] fatal error in thread [elasticsearch[TIM][search][T#1]], exiting
java.lang.NoClassDefFoundError: Could not initialize class org.apfloat.ApfloatContext
        at org.elasticsearch.index.search.CommutingQuantumScorer$1.run(CommutingQuantumScorer.java:95) ~[?:?]
        at java.security.AccessController.doPrivileged(AccessController.java:312) ~[?:?]
...
@axkr So there is not much of a difference whether I place the ApfloatContext test before or after ExprEvaluator
Axel Kramer
@axkr
This seems to come from the apfloat library:
Can you open an issue where and ask how to set the properties to avoid that error, because I don't find a properties file in the apfloat's JAR itself.
TiMauzi
@TiMauzi
@axkr Although I'd like to take your advice and creating a modification of Symja meanwhile... Though, it would be more elegant of course if I could use an original version at some point :)
Axel Kramer
@axkr
Yes of course. You can contribute your changes back with a pull request to Symja if you create a fork on github.
TiMauzi
@TiMauzi
Mhm that might be a good idea... Although I usually use my university's gitlab, I can of course create my symja fork on github :)