running html version of playn - playn

I have playn installed on eclipse (http://code.google.com/p/playn/wiki/GettingStarted#Running_via_Eclipse), i loaded the sample programs and they load file, the java one runs fine. But for html
I right click the showcase-html > google > compile
I don't get any errors:
Compiling module playn.showcase.Showcase
Compiling 1 permutation
Compiling permutation 0...
Compile of permutations succeeded
Linking into C:\Users\(my path)\playn-samples\showcase\html\target\playn-showcase-html-1.0-SNAPSHOT\showcase
Link succeeded
Compilation succeeded -- 12.208s
then
run as > web application
I get a url in the development tab:
http://127.0.0.1:8888/Showcase.html?gwt.codesvr=127.0.0.1:9997
when I run this it hangs my browser
when I run this:
http://127.0.0.1:8888/Showcase.html
it says "GWT MODULE MAY NEED TO BE (RECOMPILED)" on a popup and loads nothing.
Any idea what might be wrong?

I don't recommend using Eclipse to compile and test the HTML5 backend of a PlayN game.
Develop and test using the Java backend, and when the time comes to build the HTML5 version, use the Maven command line to build and test it. It is far more reliable.
However, if you insist on testing the HTML5 backend in Eclipse, you have to be careful. What you've done above is to first compile the Java code to JavaScript (by using Google -> Compile) and then overwritten the compiled JavaScript with GWT devmode stubs (when you used Run as -> Web application).
Instead, you should use Google -> Compile, and then expand playn-showcase-html -> target -> playn-showcase-html-1.0-SNAPSHOT and right click on Showcase.html and select Open With -> Web Browser. EDIT: You'll need to run the generated code in a webserver to avoid crosssite scripting issues.
You never want to use GWT devmode (Run as -> Web application) to test the HTML5 backend of your game, because GWT devmode is pathologically slow for running high-performance code like an HTML5 game.

Related

How can you make a client-side javascript pages with scala.js and sbt's ScalaJSBundler?

I'm using scala.js to create javascript code to be run in a browser, served up by an akka-http server. I had it mostly working using mill as my build tool, but then wanted to switch to sbt so I could use the ScalaJSBundler plugin for npm dependencies and packaging. Using sbt, when I do a fastOpt to compile my scala.js code, javascript code is created slightly different than what mill created and it now includes require statements (which the mill build didn't) such as
var $i_react = require("react");
When this code is run in my browser require comes up as undefined. Also variables I have exported in scala.js come up as undefined. I thought this was because the code being created was for ModuleKind.CommonJSModule (set via the sbt setting scalaJSModuleKind), but when I try to change that to ModuleKind.ESModule the build fails with:
scalaJSModuleKind must be set to ModuleKind.CommonJSModule in projects where ScalaJSBundler plugin is enabled
I'm new to javascript (and scala.js). What am I doing wrong? How should this be done?
Thank you!
As described in the Getting Started of scalajs-bundler, you should serve the result of webpack/fastOptJS to the browser, instead of fastOptJS. This is necessary because the latter is emitted as a CommonJS module, unsuitable for the browser, but then processed by Webpack to produce the former, a bundle suited for the browser, also containing the npm dependencies.

How to automatically reload .NET Core project in Visual Studio 2019

I tried to automatically reload ASP.NET Core project as I do using Angular with Node or NPM.
When I change the code of the .NET Core project and save, I want the web page to be automatically refreshed in the web browser.
run this command in project console
dotnet watch run
same works for visual studio code
From Develop ASP.NET Core apps using a file watcher (for 3.0)
dotnet watch is a tool that runs a .NET Core CLI command when source
files change. For example, a file change can trigger compilation, test
execution, or deployment.
The link above contains a tutorial with two sample projects:
WebApp (an ASP.NET Core web API) and
WebAppTests (unit tests for the web API).
Alternatively, you can also this nuget package for runtime compilation.
I think that dotnet watch should work. See the documentation from the link as there are various options.
Add Microsoft.DotNet.Watcher.Tools to the tools section of the
project.json file
Run dotnet restore
Execute with dotnet watch run
You can use dotnet watch. Viz. Docs
I have created custom lunch profile to make it easyer to run in VS.
"Watch": {
"executablePath": "dotnet.exe",
"workingDirectory": "$(ProjectDir)",
"commandLineArgs": "watch run",
"launchBrowser": false,
"launchUrl": "http://localhost:5000/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
According to this requirement, we need to run .net core application just like Angular application, loading the pages and contents automatically without built and manual refresh.
I had done some research and experienced that auto-reloading is not possible in ASP.NET core project. However, we have got the success, in our solution we are using dotnet watch which monitors source files and if a file changes, shuts down the application that it started, rebuilds and publishes the project, and then restarts the application then we just need to refresh page manually in the browser to get the changes which made in application, we don’t require to build or start the project.
Steps to follow to use asp.net watch:
1) Create.Net core application.
2) Open a command Window in your Web project's folder
3) Type dotnet watch run
4) Open your browser and navigate to an API or Page
5) Make a change to source code
6) Save the file
7) Go back to the browser and refresh manually
8) You should see the change reflected
Use dotnet watch to recompile the source code. Use Browser Link with "Browser reload on save" from Visual Studio to reload all your browsers. https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BrowserReloadonSave
One of the tasks automatically created in VS Code environment for a ASP.NET Core project (web, mvc, etc.) is called "watch". To check this, from ".vscode" folder, open the file tasks.json and you will see 3 tasks configuration: "build", "publish" and "watch". By default, "build" is used in launch.json. You can then go in the "configurations" section of launch.json and look for "preLaunchTask", and there, you can change the task to "watch". And that's it. Hot reload will be active when you run your web application.
Regards.
You should think triple before going forward to this option. (1) It is a resource-consuming. As it necessitates auto-build, as pre-operation, of the modified project and sometimes the whole solution. (Imagine a medium to a huge Asp.net solution composed from many projects, get built for each modification performed !! how much time is left for programming ???!!) (2), as you know, the page reload consumes much time for the first launch after a successful build !!... Hence, the time you want to gain from this option you will be wasted multiple, especially CLR-based programming languages (e.g. .NET Core). And finally, (3) your project is expected to be in need to develop test samples that can be injected automatically in the view for a better automation process, imagine how difficult it is!
Instead, try to unit test your solution, and then, any next modification is expected to be superficial and low occurring.
If you disagree with my proposition, I suggest developing a visual-studio extension that better reload the target web page on-build rather than an on-save-changes event. Next, Ctrl + b will do the job!
Where to start?
I have developed a VSIX that watches folders to load automatically specific generated files outside the VS UI. check the source code you will have an idea about the project's files management. it revolves in the EnvDTE API, please have a look in this piece of code.
Also, check the source project from here
Follow the procedure indicated in the Microsoft's page.
Nuget package Microsoft. VisualStudio. Web. BrowserLink
Install NuGet Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
app.UseBrowserLink(); in the startup.cs page on the configure method.
and enter image description here
now when you change something on your code Ctrl + Maj + enter and everything is saved and actualized on your browser.

Netbeans Platform Installer and JOGL

I'm trying to build an application that uses both Netbeans Platform and JOGL. So far, it runs fine from within Netbeans, but once I try to create an application that can run externally, I get some problems. The application will start (judging from the splash screen), but a window never displays, and I never get an error message. As soon as I remove the JOGL module (leaving only straight Swing code), everything works fine.
Project Setup:
1 Library Module for JOGL, including the dll's (for Windows 7 64 bit only), in the library/modules/lib folder
1 Module for a window displaying a GLJPanel, rendering a simple image with an animator
1 Module with a simple form in Swing
Has anybody seen this before?
Edit: apparently the trick in this case (using native libs when building Netbeans Platform executables) is placing the native libs in the project's root folder.
If this were not about netbean platform executables, a more generic comment is to make sure the native libs (dlls) are picked up correctly. Try adding the
-Djava.library.path=/path/to/libs option when you run it.

Environment-dependent compilation properties in Flex/AIR

I'm building a Flex/AIR application that connects to a remote server, the URL of which changes depending on the environment (development/production, and possibly others). For now, this URL parameter is hardcoded in my root application MXML file but it means I have to change it everytime I build my app for a different environment.
Is there a way to externalize such a parameter so that when Flash Builder automatically builds my app (in development mode), it uses the development URL (http://localhost...) and when Flash Builder exports a release build, it uses the production URL (http://www.mycompany.com/myapp)?
Flex compiler supports something called Conditional compilation, you an read about it here: link. The problem is that it still doesn't give you an way to check if you're exporting a release build or building for debug. Probably the simplest way to achieve that is to use ANT for compilation of the release build and use the conditional compilation from there.

How is FlexBuilder compiling my app?

I'd like to see the command-line arguments that FlexBuilder is using to compile my application. This is so that I can build them into the ANT script I'm working on. Is there any way to view the command line compilation step?
The reason I'm asking for this is that when I compile my app using Ant/Flex SDK vs. FlexBuilder my app behaves differently.
So I figured out the answer.
First of all, you can get a better idea of how FlexBuilder compiles your app by adding a -dump-config=C:\myConfig.xml to the compile arguments in FlexBuilder. This outputs an xml file containing configuration settings used in the compilation step. You can also use this file as an argument to compc or mxmlc if you'd like. Read more about it
here...
But, here's what actually solved my problem. I was using the regular old Flex SDK installed on our integration server to compile my apps using Ant. This is the free SDK you can download from Adobe's site. I then took the FlexBuilder directory from my local machine and copied it up to the integration server and pointed my build script to use that version of the SDK (and changed my path env variable).
When I compiled using the FlexBuilder version of the SDK, all was well and the strange bugs I was seeing in my app disappeared.
Moral of the story, make sure you are using the same version of the SDK for your automated builds as you use to build locally.

Resources