Compiling PlayN Flash samples - java

I've been following this guide to get playn up and running in eclipse indigo. Hit some major bumps along the way (the largest being swithing to gwt 2.3) but I've managed to get it compiling the as files. The problem is when it starts to create the swf I get this flash compilation error:
C:\Users\ted\AppData\Local\Temp\1351877287607-0\testsgameflash.as(145): col: 220 Error: Incorrect number of arguments. Expected no more than 1.
function $replace_0(this$static,from,to){var regex;if(from<256){regex=toPowerOfTwoString(from);regex='\\x'+'00'.substring(regex.length)+regex}else{regex=String.fromCharCode(from)}return this$static.replace(RegExp(regex,'g'),String.fromCharCode(to))}
C:\Users\ted\AppData\Local\Temp\1351877287607-0\testsgameflash.as(146): col: 131 Error: Incorrect number of arguments. Expected no more than 1.
function $replaceAll(this$static,regex,replace){replace=__translateReplaceString(replace);return this$static.replace(RegExp(regex,'g'),replace)}
It looks like it is casting the value as 'RegExp' instead of creating a new instance of RegExp. I'm not sure where the mess up is and I just wondering what I can do to fix it and get everything compiled

Related

Reason and fix for "Error: Could not find or load main class Anne" on Scala Getting started tutorial

I'm just starting out with Scala and have been following its Getting Started instructions. The second part of the instruction involves pulling the hello-world template by running the sbt new scala/hello-world.g8 command.
My problem is that it keeps on giving me this error:
Error: Could not find or load main class Anne
Caused by: java.lang.ClassNotFoundException: Anne
I'd like to know the reason for this, as well as any possible fix I might use.
The following is my insight and attempts on fixing this problem.
Insight:
1. I might have a problem with java installation/scala/sbt installation that needs this class Anne since even with other sbt commands like sbt sbtVersion I get the same error
Attempts:
1. Change command to retrieve from full url:
sbt new https://github.com/scala/hello-world.g8
2.(Edit): Previously I thought the repository scala/hello-world.g8 did not exist and tried getting from other repositories with no luck and with the same error as above. However it was pointed out below that the repository actually exists in this url https://github.com/scala/hello-world.g8, thanks Dmytro Mitin.
I was looking into the incorrect account (sbt) instead of (scala)
(Edit): Day 2
3. Uninstall/Reinstall sbt -- still getting the error
4. Checked if java running properly by compiling sample code and running ( successful )
I was actually running the command in Visual Studio Code's bash terminal. I tried running it with cmd and everything's now working fine.

Mojo Scoring Java Error using h2o.mojo_predict_df

I have used H2O for about a year now to build and score models but have never used MOJO to do this. This is something I am currently wanting to do and I came across the function h2o.mojo_predict_df to score out my models which will drastically increase runtime as well as allowing me to update my h2o without the worry of my models not scoring in a later version of h2o.
So I have downloaded my .zip from MOJO and corresponding .jar file, let's say they sit in the folder
C:\Folder\Test\Model.zip
C:\Folder\Test\h2o-genmodel.jar
Now am I trying to run it through, lets say my R data frame is called Data then I am using:
h2o.mojo_predict_df(frame = Data,
mojo_zip_path = "C:/Folder/Test/Model.zip",
genmodel_jar_path = "C:/Folder/Test/h2o-genmodel.jar")
However, this produces the error:
Error in safeSystem(cmd_str): SYSTEM COMMAND FAILED (exit status 127).
I am not quite sure what this is. My experience is java is limited. I tried on a different machine and got a completely different error:
"Error: Could not create a Java Virtual Machine".
Error: A fatal exception has occurred. The program will exit.
Unrecognised option : - 1.
Error in safeSystem(cmd_str) : SYSTEM COMMAND FAILED (exit status 1).
I'm not sure why they got different errors. The code ran was exactly the same.
Any help would be appreciated!
As nathan mentioned in the comments the error is due to a bug in Stacked Ensemble Mojo which can be tracked here: 0xdata.atlassian.net/browse/PUBDEV-6026

Strange Shader Loading Error LWJGL 3

I have recently made a project using LWJGL 3 but have run into a wall. I have looked all over but cannot seem to figure out why calling GL20.glShaderSource(shaderId, shaderCode) and then subsiquently GL20.glCompileShader(shaderId) returns an error. The error that I receive makes it appear as though lwjgl cannot discern the path to the shader files:
LWJGL Version 3.1.2 build 13
java.lang.Exception: ERROR COMPILING SHADER CODE: VERTEX SHADER FAILED TO
COMPILE WITH THE FOLLOWING ERRORS:
ERROR: 0:1: ERROR(#132) SYNTAX ERROR: "/" PARSE ERROR
ERROR: ERROR(#273) 1 COMPILATION ERRORS. NO CODE GENERATED
at com.wilby.model.ShaderProgram.createShader(ShaderProgram.java:47)
at com.wilby.model.ShaderProgram.createVertexShader(ShaderProgram.java:24)
at com.wilby.Renderer.initialise(Renderer.java:62)
at com.wilby.Game.initialise(Game.java:46)
at com.wilby.Game.loop(Game.java:23)
at com.wilby.Main.run(Main.java:27)
at com.wilby.Main.main(Main.java:16)
However it still makes this error even when the files do not need any prefix to reach it. Like I say, I am completely stumped.
The link to my project is here.
I found the solution. You have to read the file and use that as the string in the shader source method. Facepalm.

Weird JavaGuard error?

I am using JavaGuard to obfuscate one of my .jar files and got this error:
# ERROR - corrupt class file: me/project/main/Main.class java.io.IOException: Incompatible version number for class file
format: 52 / 0 at
net.sf.javaguard.classfile.ClassFile.read(ClassFile.java:160) at
net.sf.javaguard.classfile.ClassFile.create(ClassFile.java:116) at
net.sf.javaguard.GuardDB.addClasses(GuardDB.java:415) at
net.sf.javaguard.GuardDB.startObfuscate(GuardDB.java:274) at
net.sf.javaguard.GuardDB.obfuscate(GuardDB.java:243) at
JavaGuard.obfuscate(JavaGuard.java:322) at
JavaGuard.start(JavaGuard.java:179) at
JavaGuard.main(JavaGuard.java:146)
What can I do to fix this? My code compiles fine and the .jar export has no errors. I have no problems with my code or .java files.
It looks like you are compiling your code using Java 8, then using a version of javaguard that does not understand Java 8 class formats. The format: 52 in the exception message is the class format version, indicating Java 8. This Wikipedia entry lists the possible values and the corresponding Java versions https://en.wikipedia.org/wiki/Java_class_file
This is hardly surprising - the last javaguard release appears to be a 1.0 beta in 2002. You may need to use another tool
For the "//INTERNAL ERROR//" thing you can use Luyten decompiler; It'll get your code.
For the "# ERROR - corrupt class file: me/project/main/Main.class java.io.IOException: Incompatible version number for class file format: 52 / 0 at" error, you may want to use a newer version of proguard.
I had this problem (using proguard maven plugin) and got it resolved using the 5.3.2.

Error message when trying to write a xlsx.-file with R

I try to save some R-dataframes into .xlsx-files using the write.xlsx function of the xlsx package like this
write.xlsx(tab,file="test",sheetName="testsheet",col.names=TRUE,row.names=FALSE,append=FALSE)
whereas the object tab is a data frame, as prooved here
> class(tab)
[1] "data.frame"
When I run the code I get the following error message
> write.xlsx(tab,file="test.xlsx",sheetName="testsheet",col.names=TRUE,row.names=FALSE,append=FALSE)
Fehler in .jcall("RJavaTools", "Z", "hasField", .jcast(x, "java/lang/Object"), :
RcallMethod: cannot determine object class
and I have no particular idea what the problem could be.
PS: I'm running R 2.14.1 in the StatET 2.0 plugin in Eclipse 3.7 on a 64bit machine.
When you work in Eclipse, you can start R using either rj - a Java terminal, or RTerm - the native R terminal.
If you are using the rj terminal and something doesn't work, try the same thing with RTerm.
I have never tried to figure out why, but a few things don't work properly in rj. This includes all use of RCOM as well as printing of the return value of system().
I use rj by default because I like the way it deals with help (amongst other benefits).
But if things don't work, I try it in RTerm. One day I'll have some spare time and I'll take it up with the author.
PS. I want to stress that I absolutely love StatET in Eclipse. These oddities or rj are very minor inconveniences in the grand scheme of things.
From my experience these kind of errors are produced when the standard rj package is installed instead of the one supplied bij the StatET developer.
Check the installation guide here:
http://www.walware.de/goto/statet
If you would happen to be using Debian or Ubuntu, you can also use the repository from OpenAnalytics to install StatET and the correct rj packages in one go.
http://deb.openanalytics.eu/howto.html
I had same problem. Two codes work with my problem:
FIRST) Convert vector to dataframe:
library(xlsx)
data <- data.frame(c(1,2,3))
write.xlsx(data, file = "C:/Users/Name/Downloads/data.xlsx")
SECOND) Use another library:
`# Using openxlsx package
library(openxlsx)
dataD1 <- data.frame(c(1,2,3))
write.xlsx(dataD1, "C:/Users/Name/Downloads/dataD1.xlsx")
I hope you have solved your problem.

Categories