Failure to be able to access classes from imported libraries - datastax-enterprise

My research team wrote a script for loading some data from edn files into a Titan database. We are now attempting to migrate our work to a Datastax Enterprise Graph database. When we use :load on gremlin-server the script gets through the import statements but fails as soon as it hits any instance of a class from one of the imported libraries. For instance we import
import static us.bpsm.edn.parser.Parsers.defaultConfiguration;
import us.bpsm.edn.*;
import us.bpsm.edn.parser.*;
import us.bpsm.edn.printer.*;
and after the import we call
parser = Parsers.newParser(defaultConfiguration())
but gremlin returns "No such property: Parsers for class: Script2"
When running the commands one at a time we run into the same issue. Our initial thoughts are that we need to add the libraries to the right class path, but we have tried a few spots with little avail. When we switch from remote to local gremlin we are able to load the script, but don't have access to the graphs in system.
Any thoughts?

MFin, you're on the right track, essentially you will want to add the libraries to the class path on each of the nodes as well as locally.

Related

Is it possible to define things globally so that they don't have to be imported? (Dart)

I'd like to define things like extensions to my code that are always defined in a global scope so that they don't have to be imported, and always show up on intellisense.
Is this possible?
It doesn't seem possible to always implicitly import a set of symbols in every file.
There's no command-line option, and the language spec explicitly says that dart:core is the exception, under section 19.1 Imports:
The dart core library dart:core is implicitly imported into every dart library
other than itself via an import clause of the form import ’dart:core’; unless
the importing library explicitly imports dart:core. Any import of dart:core,
even if restricted via show, hide, or as, preempts the automatic import.
It would be nice if there was nothing special about dart:core. However,
its use is pervasive, which leads to the decision to import it automatically. [...]
However, it seems that you want extension methods to be accessible to IntelliSense in your IDE.
That is handled by the language server, which is part of the Dart SDK. There's an open issue for extension method auto-completion on the Dart SDK bug tracker: https://github.com/dart-lang/sdk/issues/38894.
A temporary workaround (by GitHub user Afur) is to create a library that would export all extensions in your project, with a special symbol that helps you automatically import that file.
For example, you'd create a file extensions.dart with the following contents:
export 'string_extension.dart';
export 'list_extension.dart';
abstract class Extensions {}
Then, in your code, you'd start typing Extensions, your IDE will suggest importing extensions.dart and voilà, your extensions are in scope.

Jenkinsfile shared libraries IDE support

Since my Jenkinsfile has almost 2000 lines of code(Scripted pipelines) it is obvious that it is better to refactor it to use shared libraries. The thing that stops me from that - is the way i have to import this libraries in the Jenkinsfile. Either using the #Library notation to import the global configured library or using library step to load library dynamically i loose code completion and possibility to CTRL+click the method\class\variable.
Am i missing something? How do you solve this issue? It is very frustrating to return 20 years back to search manually for some method through all code base instead of simply clicking it in the IDE to find it's implementation.
there are several things that you can do.
First of all if your libraries have .groovy extension then use class inside, for example:
class NotificationLib() {
}
then, here in your Lib class add the methods you are interested.
next step will be (all this assume that your pipeline and libraries are in same repository) to use #Library in pipeline, but also us import or new for the classes of your libraries
most probably you will need to have constructors in your Lib classes but that's fine.
Hope it helped.

Rascal slow at importing modules

I am running Rascal from the REPL and it seems like it takes a pretty long time to import some modules. For example import lang::java::\syntax::Java15; takes seconds to run.
I've also noticed cases where modules that depend on other modules don't appear to be reloaded if they are changed. For example:
program 1:
module A::A
....
program 2:
module B::B
import A::A;
...
REPL:
import A::A;
import B::B;
Now I've made some changes to A and B and I import B again. I would imagine the changes to A would get propagated to the new version of B (since it is importing A) but this doesn't seem to happen.
Why is importing this slow and is there a way to speed this up?
How does importing packages with dependencies in the REPL work?
Thanks!
We recently changed quite a bit about this part of the implementation. So could you tell us which version you are using?
Importing is slow right now because we have a bottleneck in the parsing infrastructure, as far as I can remember. Speeding it up; you can do by not using a console in Debug mode (i.e. use Run As...), using more memory for Eclipse also helps (I use 1.8Gb heap and an 80mb stack).
The REPL works in Eclipse by monitoring which modules have changed since running the previous command on the REPL. When a new command is entered, such as an import command, first all modules which have changed and the modules they depend on are purged, this produces an initial worklist for reloading, which is then executed in a fixpoint fashion to load the new modules (each module only once), then finally the command is executed.

how do I integrate hosebird client library to a Grails project?

My goal is to use the hosebird client provided by Twitter to stream tweets in my Grails project.
I'm really not sure how I will approach this, but I first tried including it in the dependencies in my BuildConfig.groovy like this:
dependencies {
compile 'com.twitter:hbc-core:2.2.0'
}
And then, when I tried to mimic the example code, FilterStreamExample.java, in my TwitterService.groovy, GGTS (the IDE) just shows me errors as I write these lines of code:
import com.google.common.collect.Lists
import com.twitter.hbc.ClientBuilder
import com.twitter.hbc.core.Client
import com.twitter.hbc.core.Constants
import com.twitter.hbc.core.endpoint.StatusesFilterEndpoint
import com.twitter.hbc.core.processor.StringDelimitedProcessor
import com.twitter.hbc.httpclient.auth.Authentication
import com.twitter.hbc.httpclient.auth.OAuth1
Obviously, this makes me unable to run the code because of the compile time error. It just tells that the error is something "Groovy was unable to resolve".
Can you tell what am I missing?
Is it just a groovy syntax error that I'm not noticing? I'm new to Groovy so please bear with me.
OR
Is the problem here is in the inclusion of the library in the dependencies?
My first aim is to be able to use the library this way as I have told it above (the BuildConfig way) before trying to make jars and put it in the src/java. Who knows, the compile time error will appear too. I just want to know if the current obstacle in the approach I did is easy to fix.
GGTS and STS don't parse BuildConfig.groovy - they get all classpath information from Grails. When you update BuildConfig.groovy with a new plugin or jar dependency, right-click on the project node in the tree on the left and select Grails Tools | Refresh Dependencies and GGTS will rebuild its classpath based on the current state of the app.

TimeSeries Forecasting in Java

I'm trying to run TimeseriesExample code for forecasting(predicting) future 6-months data by giving 2-months data in Java. I need to use WekaForecaster object. But I'm unable to import these two files:
import weka.classifiers.timeseries.WekaForecaster;
import weka.classifiers.timeseries.core.TSLagMaker;
Both of these showing error. I have imported following jar files:
weka.jar,
pdm-timeseriesforecasting-ce-TRUNK-SNAPSHOT.jar,
jcommon-1.0.14.jar ,
jfreechart-1.0.13.jar
But still above files not importing, which jar I'm missing?
You have to install first the timeseriesForecasting package before use it in your code.
The package(jar file) can be found in wekafiles folder in your user folder.
You must to use the Package Manager to do it.
Best,
Use the "package manager" (weka >=3.7) and install the timeSeries plugin. then add the weka-37.jar to your build path. Here some information about the plugin.
Weka TimeSeries plugin
By the way, I think that 2 month data is not enough to forecast 6 months.

Resources