Compiling code from within IntelliJ - ceylon

I've managed to compile and execute Cyelon code in the 'Walkthrough' repository, by right clicking a function and choosing 'Run functionName'.
I've also tried creating my own Ceylon-project (named POSTtoFile) and seeing if I could execute a 'Hello World' function from there. I couldn't. I guess I have to create some sort of build configuration for my project, but I don't know what to fill into these form fields:
The Installing Ceylon IDE for IntelliJ guide is completely silent on this question. It would be neat if it had included a section named 'making your first Ceylon'-project. It's embarrasing to know that all previous readers of that document must have known that stuff in advance. So here I am! The single exception.
In the 'Ceylon module' drop down, there is a single option, named module default "unversioned". I tried choosing that one and then clicking 'Run' -> 'Run POSTtoFile'. I got this output:
"C:\Program Files\Java\jdk1.8.0_121\bin\java" -Dceylon.system.repo=C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\repo -Didea.launcher.port=7536 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3.3\bin" -Dfile.encoding=windows-1252 -classpath "C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\lib\ceylon-bootstrap.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.redhat.ceylon.launcher.Bootstrap run --run "" default/unversioned
ceylon run: Module default/unversioned not found in the following repositories:
C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\repo
C:\Users\Jon\Auchitect\POSTtoFile\modules
C:\Users\Jon\.ceylon\cache
https://modules.ceylon-lang.org/repo/1
[Maven] Aether
[NPM] npm
Process finished with exit code 1
EDIT:
As can be seen in the screenshot below, I have no toolbar in the bottom of the IntelliJ window, and I see no tool window named 'Ceylon problems':
As to your other questions:
The 'modules' folder is empty
IntelliJ seems to do work when I click Build>Rebuild Project. This is the output:
These are my version numbers:
When I put the folowing code in my main.ceylonfile:
shared void hello() {
print("Hello , World!");
}
(sorry, stack overflow won't format this as code, even though I have 4 spaces in front of each line)
I get the green arrow to the left of the function hello, but then I can't click on it. It says 'Nothing here':
EDIT 2:
I tried moving the source code file (main.ceilon) from the root directory (POSTtoFile) to the source directory (POSTtoFile/source).
Then I clicked Run -> Run 'POSTtoFile'.
This gave me the following new output:
"C:\Program Files\Java\jdk1.8.0_121\bin\java" -Dceylon.system.repo=C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\repo -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3.3\bin" -Dfile.encoding=windows-1252 -classpath "C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\lib\ceylon-bootstrap.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.redhat.ceylon.launcher.Bootstrap run --run "" default/unversioned
ceylon run: String index out of range: 0
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658)
at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:53)
at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:105)
at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:101)
at ceylon.modules.Main.execute(Main.java:69)
at ceylon.modules.Main.main(Main.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.modules.Module.run(Module.java:308)
at org.jboss.modules.Main.main(Main.java:487)
at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:292)
at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:547)
at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:423)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:108)
at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:38)
at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.redhat.ceylon.launcher.Bootstrap.runVersion(Bootstrap.java:162)
at com.redhat.ceylon.launcher.Bootstrap.runInternal(Bootstrap.java:117)
at com.redhat.ceylon.launcher.Bootstrap.run(Bootstrap.java:93)
at com.redhat.ceylon.launcher.Bootstrap.main(Bootstrap.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Process finished with exit code 2
This is the content of main.ceilon:
shared void hello() {
print("Hello , World!");
}
EDIT 3:
After changing the content of main.ceilon to this:
void hello() {
print("Hello, World!");
}
hello();
I get this output when doing Run -> Run 'POSTtoFile':
and now all of a sudden I have the Ceylon problems button in the bottom toolbar! It says I have three problems:
incorrect syntax: no viable alternative at token end of file.
missing declaration or argument name.
not an annotation constructor: hello
I don't understand why I get errors, though, as my code is straight out of the Tour of Ceylon.

Agreed, the documentation lacks a "Getting started with IntelliJ" section, I'm going to fix that this week.
Here are the steps needed to run a simple project in IntelliJ.
Create a new project via File > New > Project and choose the Ceylon category.
Click Next and choose whether you want to compile/run your project on the JVM, on JS or both:
Click Next twice, enter a name for your project and click Finish. Your project is now ready to host new Ceylon code:
In the Project view, you can see a few existing files and folders:
.ceylon contains internal configuration that can be reused by the CLI tools, you shouldn't have to modify it directly most of the time.
modules is the output directory where Ceylon modules will be compiled.
resource contains resources
source contains source modules
To add Ceylon code to this project, you can either put files directly under the source folder to add them to the default module, or create a new module and add source files to this module. In both cases, .ceylon files must be in the source folder, not directly in the project folder.
To add a file to the default module, right-click on the source folder and choose New > Ceylon File/Declaration, enter a name (for example run) and click OK.
To create a new module, right-click on the source folder and choose New > Ceylon Module, enter a name like my.ceylon.example, adjust the version if you don't like 1.0.0, set the runnable unit name to something like run and click OK. New folders will be created (my/ceylon/example), along with a module descriptor (module.ceylon), a package descriptor (package.ceylon) and your runnable unit (run.ceylon).
At this point, a tool window titled Ceylon Problems should be present in the bottom tool bar, indicating that the IDE is now aware that the project contains Ceylon code and is correctly configured:
Now that the project is set up, it's time to actually add code :). Open run.ceylon and add the following code:
shared void run() {
print("hello");
}
A green arrow will appear in the left gutter, click on that arrow to run or debug the run function:
Click on Run 'run', this will automatically create a run configuration, build the project and print hello:
Regarding your last error:
incorrect syntax: no viable alternative at token end of file.
Just like Java and its main() method, when you declare a runnable function in Ceylon, you don't have to actually call it manually. The Ceylon runner will do it for you (either the IDE or ceylon run when you use the CLI). Ceylon only accepts toplevel declarations, not statements, so this code triggers a parse error when it's found at the root of a file:
hello();
This is a bit misleading if you've already tried the web IDE because the web IDE automatically wraps your code in a run function under the hood, so the above statement would never be a toplevel statement.

Related

The configName must be a non-empty string in KNIME

I am trying to see configuration page of the KNIME node which i just published to my KNIME analytics tool.
Getting error "Error while creating node dialog for 'Readadwords': The configName must be a non-empty string" where Readadwords is my node dialog class which i created in eclipse.
Either in my Nodemodel or Nodedialog there is not a single config and i have defaulted it some or other string value.
Can some one help me where to look to fix my error and also please let me know if i can debug my knime plugin from eclipse rather than doing it in Analytics tool.
Debugging is explained in their developer guide, this page is the most relevant for that.
When you save your settings you have not specified the key for your config, that is what this error message is about. Like in this place assuming "" were used instead of "colName", I would expect a similar error message.
Issue is KNIME is not picking up the changes i have done to the code and i had to change version in plugin.xml file then it started working after copying new jar file to dropins folder of KNIME

How do I solve 'Web Compiler found an error in compilerconfig.json'?

On trying to re-compile all files in a solution, using Visual Studio 2017, I get this uninformative error message:
Web Compiler found an error in compilerconfig.json
To begin with, there is more than one compilerconfig.json file in the solution.
Secondly, there is no indication whatsoever of what the error is, where it occurs (line number, for instance).
Any ideas how I can go about solving this?
In Visual Studio's Solution Explorer, right-click the compilerconfig.json file and click "Task Runner Explorer". In the left pane you will see "compilerconfig.json/all files", right-click on it and then click on "Run". You will see the details of the execution which, in my case, included the useful information about how to correct the error.
I was able to solve this issue for myself by using individual file compiling, instead of "All files".
I was getting a "Compiling successful!" message, but that didn't seem true because my compile file didn't contain my change. So here's what I did:
Open Window > Task Runner Explorer. In your left column, there is a task for "All Files". That's fine. Ignore it.
Compile your SCSS files individually. Do this by right clicking on each SCSS file in that list, and then Bindings > After Build. (Or add the task to whatever event you prefer. I chose After Build.)
Open any SCSS file in your project and add a test. I added something like #TEST2 {color: hotpink;} to my SCSS file.
Now when you save, your compiling takes a few seconds longer. Now open main.css and see if your change (#TEST2) exists in the file.
I just went through this and didn't find an easy way but I got past it.
My issue turns out to be a missing input file that was supposed to be compiled.
Method of attack:
Try to compile each compilerconfig.json file (right-click -> Web Compiler -> re-compile all files)
repeat until you find the file in question
Remove all data from this file and add entries in one at a time (or scan it to make sure your files are there, which ever fits your situation)
The root problem is that the Web Compiler didn't install successfully. I had the same problem as described in the other answers and went down a rabbit hole to figure out why I couldn't compile. Turns out I had to help the tool install itself. See this comment for details:
https://github.com/madskristensen/WebCompiler/issues/390#issuecomment-475427735
Once I did the steps listed in that comment, I able to both compile files again and was explicitly told by the tool which line of my SCSS had an error.
For an information:
I got the same error in VS2019 webcompiler. And I found a solution ie;
Project should be open as a "Web Site".
Do not open as a folder. This simple thing is solved my issue.

C++ Builder - Project x.exe raised exception class ELUInvalidResLibrary with message 'Invalid resource

I'm using C++ Builder 2009 project which I'm trying to internationalize using korzh localizer plugin.
When I run my application and try to Initialize the language menu, I get an Exception of:
Project abc.exe raised exception class ELUInvalidResLibrary with message 'Invalid resource file format "C:\path\to\exe\abc.exe"'.
I find the resource reference to the executable seems a bit goofy. Any ideas?
Progress Update:
I have another project which is translating properly. So I referneced it. I noticed I was missing the abc_klr.res file in the project, so I added it and it got me past that exception on the LocalizerOnFly->Init(), but I get a similar exception when trying to change the language. The difference is the executable is no longer referenced and instead I get a "" as the resource reference... Below is a screen shot:
So my problem was fixed in two steps:
Add the resource file to the project then rebuild.
Clean the project and deploy directory of any translation related
files, then refresh the language files.
Things are groovy again.

ZIP Embedding throws error

I want to embed a ZIP-file into my AS3/Air-application (with Flash Builder) and open it via FZip. For embedding, I use this code:
[Embed(source='../bin/art/resources.zip', mimeType="application/octet-stream")]
public static const rsClass:Class;
When I try to save the project the program chrashes and throws an error:
"Workspace is being build" has encountered a problem. During "Workspace is being build" an internal error has occured. (this is just a bad translation, not original) Java heap space
I click OK, the internal error appears:
The error "Disc space too low" has appeared. Look into the Readme-File at "Run Eclipse" you will find information [...] It is recommended to end the workbench. Do you want to end the workbench? yes/no
In an earlier version of this post I said, that the program doesnt start. That is not true. Only saving causes this error. Because of the saving errors, an earlier version of the program is started, but without errors. When I try to make a bytearray out of the zip, it causes an error (initial content not found), but I suppose the zip doesnt load, so this is not unusual.
you should NOT embed this ZIP but load it instead, you can add to the AIR package any files/folders.
To do it:
in Flash IDE go to "AIR for Android Settings" or "AIR for iOS Settings" and at the bottom of the dialogue box you have "Included files:" field then add folder or file you need,
for FlashDevelop what ever will be in bin folder will be packaged in air as described here
In Flex it will be the src folder and in the export wizzard you can select which files to include like described here.
Edit also you should consider for very large files following idea:
don't include big files (or just basic elements) and download big files and save on user device e.g. on sdcard, and then load it from there.
best regards

How to package a HTML/Metro App for deployment outside Visual Studio 2012

Does anyone know how to package an app for deployment of a HTML/JS Metro Application outside Visual Studio. I keep hearing reference to a "Store" Menu Item, but I am using Visual Studio 2012 RC Ultimate Edition, and there is no such Top level Menu Item.
I've also tried using the command line tool with a given manifest file (the one built automatically within a build) to create an appx file, but get some esoteric error message at the end of the packaging.
Update: Command line error message
MakeAppx pack /d .\Release\AppX /p generic.AppX
The package path (/p) parameter is: "generic.AppX"
The content directory (/d) parameter is: ".\Release\AppX"
Enumerating files from directory ".\Release\AppX"
Packing 52 file(s) in ".\Release\AppX" (content directory) to "generic.AppX" (p ackage name).
Using ".\Release\AppX\AppxManifest.xml" as the manifest for the package.
Adding ".\Release\AppX\images\splashscreen.png" to the package as a payload file. Its path in the package is "images\splashscreen.png".
Adding ".\Release\AppX\images\logo.png" to the package as a payload file. Its path in the package is "images\logo.png".
Adding ".\Release\AppX\images\smalllogo.png" to the package as a payload file. Its path in the package is "images\smalllogo.png".
Adding ".\Release\AppX\images\storelogo.png" to the package as a payload file. Its path in the package is "images\storelogo.png".
.........{Cut for brevity's sake}.........
MakeAppx : error: Package creation failed.
MakeAppx : error: 0x8007007b - The filename, directory name, or volume label syntax is incorrect.
Update: Figured It out (Sort of)!
I dont know what happened, but I create a blank XAML/C# Metro App. When you right click on the project, you get a Store option. It still wasnt showing up on my HTML/JS Metro app project, So i created a clean HTML/JS Metro Project....and there it was, a "Store" Option.
So I opened my current, non-working project again, right clicked on the project and there it was, the "store" option. I don't know if this was a 2012 RC bug, but I will leave this question here just in case someone else runs into this.
it is under the "Project" menu.
like you had said, it might be a bug. VS2012 is still buggy at the moment.
I hit this issue too, don't know the reason, but file mapping works for me, try call:
makeappx pack /v /o /f mappingfile.txt /p yourapp.appx
Content of mappingfile.txt:
[Files]
"App.xaml" "App.xaml"
"AppxManifest.xml" "AppxManifest.xml"
"folder\file.ext" "folder\file.ext"
"***.***" "***.***"