elastic4s 6.2.2 HttpClient issues - elastic4s

Recently I found out that elastic4s TcpClient is deprecated and going to be removed in 7.x versions.
I tried to migrate to HttpClient and faced the following issue; suppose we have a following insert operation:
val client = HttpClient(ElasticsearchClientUri(elasticUri))
def insert(ent: MyEntity): Future[Either[RequestFailure, RequestSuccess[Nothing]]] =
client.execute {indexInto(myIndex) doc ent}
This raises compile error:
Error:(27, 49) could not find implicit value for parameter exec:
com.sksamuel.elastic4s.http.HttpExecutable[com.sksamuel.elastic4s.indexes.IndexDefinition,U]
Could someone please explain what is HttpExecutable and how it should be initialized?
PS: elastic4s version is 6.2.2

Ok, it was my fault actually...
I imported ElasticApi._ instead of ElasticDsl._ and it caused this issue.
So in total there is no issue at all

Related

Upgrading to maven-plugin-plugin 6.3.4 results in com.thoughtworks.qdox.parser.ParseException: syntax error

After upgrading maven-plugin-plugin from 3.6.0 to 3.6.4, I am getting a the following exception while the build creates the maven-plugin-descriptor:
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.4:descriptor failed: syntax error #[60,84] in file:/xyz/Foo.java
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
...
Caused by: com.thoughtworks.qdox.parser.ParseException: syntax error #[60,84] in file:/xyz/Foo.java
at com.thoughtworks.qdox.parser.impl.Parser.yyerror (Parser.java:1963)
at com.thoughtworks.qdox.parser.impl.Parser.yyparse (Parser.java:2085)
at com.thoughtworks.qdox.parser.impl.Parser.parse (Parser.java:1944)
at com.thoughtworks.qdox.library.SourceLibrary.parse (SourceLibrary.java:232)
This is running with Maven 3.8.6.
The code compiles file - it's only when running through the org.apache.maven.plugins:maven-plugin-plugin:3.6.4:descriptor
Turns out this was related to using a restricted identifier (var, yield, record) as a method parameter. The underlying qdox parser seems to be more picky than the Java compiler in the regard.
Running Sonarlint on the file helped identify the issue. They provide a nice description in their java:S6213 rule.

Why is my if statement not working: Unexpected ! after ||

My text editor and php says unexpected ! after the || someone know this bug ? This is very weird
foreach($data as $pile->data)
if(!is_float($data) || ! is_int($data))
die('Pile::sort() invalid $pile data');
I use VS code as text editor and
PHP 7.2.24-0ubuntu0.18.04.2 (cli) (built: Jan 13 2020 18:39:59) ( NTS )
Sometimes, old versions are unable to distinguish multiple scenarios and spaces if added intentionally.
first of all, use this modified code.
foreach($data as $pile->data)
if((!is_float($data)) || (!is_int($data)))
die('Pile::sort() invalid $pile data');
Otherwise, please try to update to the latest version or do perform multiple checks. If the issue is still there, please do contact the official tool sport or read the official documentation.
I already had this error, I had to update my editor and download the last version of Wamp.
Not sure why but it worked for me. Maybe you should try it
I updated my php and now this is working.

sendKeys(CharSequence[]) error

I have installed java JDK1.8.0_05. I am using selenium 2.50.0. I have entered below code:
username.sendKeys("Ashok");
and I got the error as below.
The type java.lang.CharSequence cannot be resolved. It is indirectly
referenced from required .class files
- The method sendKeys(CharSequence[]) from the type WebElement refers to the missing type CharSequence
Can anyone help me on this issue?
change your jre to 1.6 will be ok

OWL API V5 read ontology from local file

in the current documentation example at the link:
https://github.com/owlcs/owlapi/blob/version5/contract/src/test/java/org/semanticweb/owlapi/examples/Examples.java
There is no example of how to load an ontology from a local file. There is only a way to load it from a string.
In the past when i used owl-api version 3
the following code worked perfectly:
OWLOntologyManager manager =OWLManager.createOWLOntologyManager();
File file = new File (path);
OWLOntology ont = manager.loadOntologyFromOntologyDocument(IRI.create(file));
however, in this version, the last line of the previous code:
manager.loadOntologyFromOntologyDocument(IRI.create(file));
returns this error:
Exception in thread "main" java.lang.NoSuchMethodError:
org.semanticweb.owlapi.util.SAXParsers.initParserWithOWLAPIStandards(Lorg/xml/sax/ext/DeclHandler;)Ljavax/xml/parsers/SAXParser;
at
org.semanticweb.owlapi.rdf.rdfxml.parser.RDFParser.parse(RDFParser.java:148)
at org.semanticweb.owlapi.rdf.rdfxml.parser.RDFXMLParser.parse(RDFXMLParser.java:62)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:173)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.load(OWLOntologyManagerImpl.java:954)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:918)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:859)
at glass.main.ontology_Test_main2.readOntology(ontology_Test_main2.java:49)
at glass.main.ontology_Test_main2.main(ontology_Test_main2.java:38)
Kindly note the attachment, a small test java project, link:
dropbox.com/s/3787a3gsk2bwc26/test.tar.gz?dl=0
Kindly what am i doing wrong, i m sure that this code
Kindly would you please provide the correct way to do it, and add it to the tutorial example in the link https://github.com/owlcs/owlapi/blob/version5/contract/src/test/java/org/semanticweb/owlapi/examples/Examples.java
Thanks very much for your time.
Sincere regards
You are very near to the solution:
final OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
final OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File("/home/galigator/myLocalDir/aura.owl"));
Just use new File instead of IRI.create
The reason of the problem was:
The previous versions that i was using:
I was using Hermit version 1.3.8.500 and OWL-API previous version 5.0.5 got modified it seems.
Solution: use the newer versions Hermit 1.3.8.510 and OWL-API 5.1.0.
I posted this answer in case someone else is using the previous version and got affected.
Sincere regards.

R - error installing caret package

> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()),
> versionCheck = vI[[j]]) : namespace ‘pbkrtest’ 0.4-2 is being
> loaded, but >= 0.4.4 is required
> Error: package or namespace load
> failed for ‘caret’
Caret was working fine until I tried to load Rcpp and it messed everything up.
I searched the answers for a similar problem with caret but the solutions posted did not seem to work on mine. I followed:
install.packages("caret", dependencies = TRUE)
But it did not work.
I would suggest you to check the R version. I updated the version to 3.5.1 and it works perfectly :)
Mac only – use updateR
Similar to installr, updateR is the package to help updating R on Mac OS.
The R code you will need are the following 5 lines:
install.packages('devtools') #assuming it is not already installed
library(devtools)
install_github('andreacirilloac/updateR')
library(updateR)
updateR(admin_password = 'Admin user password')
I have the same problem with my dynlm package. I get the same error. But as R states pbkrtest is required. This package isn't available under R 3.2.3.
However you can download the package online, look a bit further on this site, the question is already asked on stackoverflow and they gave a site where you can find the packages. Then write the following code:
install.packages("...",repos = NULL, type="source")
install.packages("pbkrtest", dependencies = TRUE)
In the first line, here I wrote the 3 dots you need to write the path to the file where you placed the pbkrtest-package.
I also faced the same problem with caret package and I could solve it as the following:
install.packages("lme4", dependencies = TRUE)
library(lme4)
methods(sigma)
install.packages("pbkrtest", dependencies = TRUE)
library(caret)
This worked for me!
Try
install.packages('DEoptimR')
and followed by
install.packages("caret", dependencies = TRUE)
I had the same issues. Both of these commands worked for me.
I faced the same error with caret and none of the above suggestions helped. My R version was 3.2 and current version is 3.4.
I installed the new version and the issue was resolved
I have faced this issue and tried many ways but followed r console about error thrown and started downloading packages one by one. steps noted down what i did for this. y r studio version is "R version 3.4.4"
First install.packages("caret"), install.packages("ggplot2"), install.packages("lattice"), install.packages("lava")..
then load library(ggplot2) then library(lattice) then library(lava) and then finally library(caret).
What i believe that caret have these packages dependency so once caret is installed ideally 'install.packages('caret', dependencies = TRUE)' should work but it was not working in my R version so i did the step as given above and it worked for me.
hope it may work if someone get this issue
I did try all the above mentioned ways to install and activate caret but none worked for me.
finally what I did was to go to my drive location where R libraries are located. I removed a folder called "caret" and then in R studio I run "remove.packeges("caret")" to remove the caret package.
then I reinstalled the package.
install.packages("caret")
library(caret)
it worked for me.
I'm in R 3.6.1 and got the same error today.
I used this code:
install.packages("caret",dep = TRUE)
install.packages("ggplot2")
install.packages("lattice")
install.packages("lava")
install.packages("purrr")
library(ggplot2)
library(lattice)
library(lava)
library(purrr)
library(caret)
And now it works fine for me. It's all about dependencies that you should install with caret.
Use this:
install.packages(c("ggplot2", "lattice", "lava", "purrr", "caret"))
library(c("ggplot2", "lattice", "lava", "purrr", "caret"))
If that doesn't work, create a folder (R_LIB in this case) on your computer (documents in this case) and include the folder location as follow:
install.packages(c("ggplot2", "lattice", "lava", "purrr", "caret"), lib = "C:/documents/R_LIB")
library(c("ggplot2", "lattice", "lava", "purrr", "caret"), lib = "C:/documents/R_LIB")

Resources