How to generate the HTML file using Plotly Kotlin - kotlin

After using the sample code want to generate the HTML for the plot plot.makeFile() throws the below exception even passed a custom path still there are errors in generating the HTML file using
implementation("kscience.plotlykt:plotlykt-core:0.2.0")
Exception in thread "main" java.lang.NoSuchMethodError: java.nio.file.Path.of(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
at kscience.plotly.PlotlyHeadersKt$systemPlotlyHeader$1.invoke(plotlyHeaders.kt:39)
at kscience.plotly.PlotlyHeadersKt$systemPlotlyHeader$1.invoke(plotlyHeaders.kt)
at kscience.plotly.HtmlKt.toHTML(html.kt:34)
at kscience.plotly.FileExportKt.makeFile(fileExport.kt:53)
at kscience.plotly.FileExportKt.makeFile$default(fileExport.kt:49)
at UndefinedKt.main(Undefined.kt:30)
at UndefinedKt.main(Undefined.kt)

The method used here is introduced in Java 11: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#of(java.lang.String,java.lang.String...)
You need to use JDK 11 or newer to run it. If I remember properly, newer versions won't even work with something below JDK 11. So just use newer JDK. If for some reason you are not able to do so, please open an issue here: https://github.com/mipt-npm/plotly.kt/issues. We can roll back to 1.8 bytecode.

Related

Can't install byte-buddy-agent on java 9

Byte buddy says that it works with java 9, there is even code for it: ByteBuddyAgent.install(ForJigsawVm.INSTANCE)
I use simple ByteBuddyAgent.install() that should check all possibilities (including java 9/jigsaw), but it fails.
I'm doing something wrong? Or it doesn't support java 9 yet?
The support for Java 9 is still experimental but the recent versions of Byte Buddy support attachment on recent ea builds of Java 9:
Instrumentation instrumentation = ByteBuddyAgent.install();
Make sure that you are:
Running a recent version of Byte Buddy.
Running a recent version of Java 9.
Do however note that Byte Buddy cannot yet process Java 9 class files due to ASM not supporting it. If you require it, use the byte-buddy-dep package and explicitly add a dependency to ASM in version 6.0_ALPHA. Doing so, allows you to use Byte Buddy on Java 9 with close to no limitations (I am still evening out some edges).

BadPaddingException when decrypting with PDFBox

In the past, I have tried to decrypt PDFs using PDFBox using the following code:
if (doc.isEncrypted()){
doc.openProtection(new StandardDecryptionMaterial(password));
doc.setAllSecurityToBeRemoved(true);
}
(Note that I don't use doc.decrypt(password) because the Javadoc for decrypt() says that openProtection() should be used instead, although why it's not just deprecated is beyond me).
Anyway, this has worked fine for quite a while. However, lately I seem to be getting the following exception:
java.io.IOException: javax.crypto.BadPaddingException: Given final block not properly padded
at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:118)
at javax.crypto.CipherInputStream.read(CipherInputStream.java:236)
at javax.crypto.CipherInputStream.read(CipherInputStream.java:212)
at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:316)
at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptStream(SecurityHandler.java:421)
at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:390)
at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptObject(SecurityHandler.java:365)
at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.proceedDecryption(SecurityHandler.java:196)
at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.decryptDocument(StandardSecurityHandler.java:158)
at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1598)
<Stack trace continues with my call to openProtection()>
How can I fix this problem?
This is a known issue, which appears to have been introduced as a result of a Java update. At the time of this writing, a fix for this is in review to be included in version 1.8.8, so just upgrade to version 1.8.8 or later and this problem will go away.

Class not found error for com.sun.tool.javac in OSGI

I am porting an old Java code base to OSGI. In the old code base there is dynamic code generation used. Example a string is compiled to generate Java classes using
com.sun.tools.javac.Main.compile.
I was reusing the same code and added com.sun.tools.javac in etc/custom.properties -> org.osgi.framework.system.packages.extra:= com.sun.tools.javac.Main of Karaf.
During runtime I get the exception java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Could anyone please help me out with some suggestions to overcome the problem.
I don't know Karaf but why do you use := instead of just = in the property setting? Also, the property value is a list of package names, not type names. So the interesting package is "com.sun.tools.javac".

Dojo DEPRECATED dojo.moduleUrl

Hellow I have one project and while running it I got some warnings:
DEPRECATED: dojo.moduleUrl() use require.toUrl -- will be removed in
version: 2.0
but where is no "moduleUrl" uses in my project, does anybody know how to fix it ? Thanx
You don't say what version of Dojo you are using, but I assume it is 1.9. According to a quick scan dojo.moduleUrl() is used in the dojox section about 40 times. dojo.moduleUrl itself is reporting that it is deprecated.
I would expect that when Dojo 2.0 comes out all the dojox widjets will be upgraded accordingly and your worries will be at an end.
Update: Just noticed a similar answer has been posted while I've been thinking of mine :-)
Some code in the dojox package still uses this function. Are you using anything from the dojox package?
If you want to find out what code is calling it, use the uncompressed dojo files and put a breakpoint in dojo/_base/kernal on ~line 282 (depending on version). When the breakpoint is hit, look at the call stack.
This message is only a warning and not an error, so your code isn't broken.

gecko in vb.net, objectreference needs objectinstance?

I want to implement a Webbrowser in my vb.net (2008)-project, however, I don't like the inbuilt IE.
I also remembered that is was kind of easy to implement a mozilla-tool like the gecko-webbrowser in the past...
It was kinf of more complicated than I remember, as I had to dwnload xulrunner and Skybound.Gecko.dll which both probably have to be included in any publishing of the finished project... I also defined x86 as target CPU and made all the needed steps to use a GeckoWebBrowser within my Application. I also called Skybound.Gecko.Xpcom.Initialize(My.Application.Info.DirectoryPath & "/xulrunner") before compiling it.
However, when I try GeckoWebBrowser1.navigate("http://...") (The element was inserted with this name per designer) the IDE tells me that an objectreference is not set to a objectinstance as if GeckoWebBrowser1 isn't defined yet... but the GeckoWebBrowser1.Created attribute is giving back true.
Does anybody know why it isn't working yet?
I have the same error in my solution. Try to use GeckoFX assembly. I use 15 version dll and error fix.
https://bitbucket.org/geckofx/geckofx-16.0/downloads