Anyone had trouble running the code samples provided with EaselJS 1.0.0? I tried running HelloWorld, it failed; but I found if I made the following two changes it seemed to work:
1) Body Onload
<body onload=init();> <!-- WORKS -->
<body onload="init();"> <!-- DOES NOT WORK -->
2) Script tag
<script src="easeljs-NEXT.js"></script> <!-- WORKS -->
<script src="../lib/easeljs.combined.js"></script> <!-- DOES NOT WORK -->
Fix #2 deserves a small explanation -- using search in Finder I find no file named easeljs.combined.js.
Maybe this will help the next person who dives into EaselJS sample code. Feel free to let me know if I'm missing something.
Required to wrap HTML in comments like this above? Preview suggested so.
I am suspicious that your first example doesn't work as shown. Do you have an example handy?
As for the second one, where are those scripts coming from? You would have had to manually include either/or. If you copied example code from GitHub, the lib/ folder lives outside the examples/ folder, so it has to be relatively referenced a directory up.
Related
I have a github site, an RStudio project, generating web pages for a course,
https://github.com/friendly/psy6136
It is set up with a `docs/' folder and github action to deploy to my site https://friendly.github.io/psy6136
It has always worked flawlessly. But not today.
I recently re-built the site and pushed some updates. I get an error,
https://github.com/friendly/psy6136/actions/runs/3885227416
I have no idea how to figure out where / what the problem is. The only thing I can see is the diff for the most recent commit, but nothing there strikes me as unusual.
Questions:
What can I do to find where the problem arises from what I can see in this error report?
RStudio uses a large collection of JS & CSS files to render the site as static HTML. Is there anything I can look at here that might show up as a cause of this error?
Follow-up:
Following this question, GitHub pages are not updating
I slightly edited my index.Rmd file, re-built the web pages (rmarkdown::render_site(encoding = 'UTF-8')) and pushed again. I got the same error report.
A solution:
I don't know why, but I finally got it to deploy by removing one line from
the header of my schedule.html file and moving the CSS contents inline.
<link rel="stylesheet" type="text/css" target="_blank" href="assets/styles.css">
Note added later:
Now I know why: A stupid error-- the file styles.css was missing the lines
<style type="text/css">
...
</style>
I'm still perplexed that the GitHub error report contains essentially no information to determine why a failure to deploy occurs.
I am trying to load coffee script inside a sample.coffee file along with the coffee-script.js file and perform some simple operations on the HTML. But i am not able to load the sample.coffee file.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="sample.coffee" type="text/coffeescript"></script>
<script src="coffee-script.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
Here is the coffeescript code inside sample.coffee
message = "Welcome to Coffeescript"
alert message
I referred the blog http://forgivingworm.wordpress.com/2010/09/27/running-coffeescript-in-browser/
I trying to run this in MVC4 project on .cshtml. So I am running under MS world.
I am not sure if this is possible or not? any insight into this would be greatly appreciated.
I am able to solve this issue by using the CoffeeSharp http://tomlokhorst.github.com/CoffeeSharp/ It gives handler for .coffee files also converts the coffeescript to javascript on the browser.
Also I am able to compile the coffeescript to javascript during the build event itself which solves deployment and performance related issues.
I dont think this will work like you tried it.
You will need something like requirejs and the coffeescript loader
at https://github.com/jrburke/require-cs.
However I would strongly discourage this and rather have it compiled before loading into the browser (require.js is encouraged though). You might find grunt.js helpful for "building" your app before deploying.
That html works fine for me. I used the coffee-script.js found here: https://cdn.rawgit.com/jashkenas/coffeescript/1.11.1/extras/coffee-script.js and my sample.coffee is:
x = ->
alert("hi")
x()
If you open the Javascript console, do you see any errors?
I am brand new to NancyFX and currently enthralled by its low-ceremony approach to web application development. Throwing myself in at the deep-end, I also want to use CoffeeScript and investigate the benefits of Sass.
The Set-Up
To enable this combination I have created a new Empty Web Application using the VS2010 template (found in the Nancy Accessories project). I have then used the VS PackageManager to Nancify my application and add the SassAndCoffee support:
PM> Install-Package Nancy
PM> Install-Package Nancy.SassAndCoffee
So far so good. I then created an ~/Content/scripts folder and in there I have placed a file called home.coffee containing the following line of CoffeeScript.
alert "Hello Nancy!"
Now things start to get a bit fuzzy. I want to run this script on the client so I create an view called ~/Views/home.sshtml (and associated NancyModule with Get["/"] route - not shown). The view's html looks like this:
<head>
<title>Hello Nancy</title>
<script type="text/javascript" src="/content/scripts/home.js"></script>
</head>
<body>
<p>Hello #Model.User</p>
</body>
</html>
The view works just fine but the link to the home.js file just returns a 404: Not Found.
I am hoping that somehow Nancy will magically work out that I need my CoffeeScript compiled to JavaScript when it looks for the referenced home.js file and finds the home.coffee instead. This didn't work - so much for inspired guesswork.
If I change the script tag above to point to the existing home.coffee instead then the file is found but processed as a normal JavaScript file giving errors concerning the lack of tiresome ceremony namely: "unexpected string"
The Question
Now you know my set-up and simple requirements, here then is my question:
How do I get CoffeeScript to 'just work' using the NancyFX framework?
Thank you
Update
Steven Robbins (below) has answered this question by pointing to the demo code. But just in case you don't want to pull MBs of source from GitHub, here are the lines required to get things going. First add a class called Bootstrapper.cs to your project. Now add the following code (it worked like a charm for me):
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
StaticConfiguration.DisableErrorTraces = false;
Hooks.Enable(pipelines, new InMemoryCache(), container.Resolve<IRootPathProvider>());
}
}
The SassAndCoffee project doesn't hook into the static content bit in Nancy, it (or something similar) may in the future, but at the moment it's just a separate pipeline hook.
If you take a look at the sample project on github:
https://github.com/NancyFx/Nancy.SassAndCoffee/tree/master/src/Nancy.SassAndCoffee.Demo
That should show you how to get it going.
Can someone explain what happens after the java code is converted to Javascript by the GWT compiler?
how will the compiled javascript reach the client browser and when does this happen.
Well from your server, you serve a html page which should contain a tag that points to your compiled javascript.
Example of what the script tag would look like
<script type="text/javascript" language="javascript" src="http://example.com/js/project/project.nocache.js"></script>
The GWT compiler generates output files as described here.
At a very high level. There is a very tiny loader file (the .nocache.) which you should include in a script tag in your page. This file's only job is to determine the correct compiled application code files to request from the server. This load happens asynchronously after the nocache script has loaded.
I have started Gwt last week. And I was trying to create application without using sample app. So initially i have typed following line in html file(Application Name-loginAppGwt, package- LoginAppGwt)
<script type="text/javascript" language="javascript" src="LoginAppGwt/LoginAppGwt.nocache.js"></script>
but it was not loading the gwt module. When i changed it to
<script type="text/javascript" language="javascript" src="loginAppGwt/loginAppGwt.nocache.js"></script>
It was working fine.
But in one of the application which i have created using sample application of gwt, there was written(application name- testingApp, packagename- test)
<script type="text/javascript" language="javascript" src="testingapp/testingapp.nocache.js"></script>
So , my doubt is where this name comes from like in my application loginAppGwt was correct but in sample application testingapp was correct??
Thanks in advance.
Module name can be manipulated via <module rename-to="newname">. Then the path would be newname/newname.nocache.js
Check if your example had something similar in it's module descriptor.
Update:
Loading of JS scripts is affected by filesystem case-sensitivity because scripts are loaded from files. However, GWT-RPC is handled by servlets and is always case sensitive. This is important because, GWT-RPC urls are prepended with package name which seems to be derived from first part of script name in a host file (I just tested this).
So while the main script would be loaded on case-insensitive filesystems regardless of the script name case, the GWT RPC would only work if package names are equal.