Going through JavascriptMVC 'rapid start' tutorial getting a 403 error - javascriptmvc

I'm getting started with JavascriptMVC, going through the rapid start todo sample application. I'm getting a 403 error on the first step. Here is my code:
todos.html
<html>
<head></head>
<body>
<ul id='todos'></ul>
<input id='editor' />
<script type='text/javascript'
src='.../steal/steal.js?todos/todos.js'>
</script>
</body>
</html>
todos.js
steal('jquery/class',
'jquery/model',
'jquery/dom/fixture',
'jquery/view/ejs',
'jquery/controller',
'jquery/controller/route',
function($){
});
Any thoughts on what could be causing this error? I figure I must be able to access to the repository because it is 403 error, but I don't understand why there should be any authorization problem.

As long as this is your 'root/todos/' directory, use this:
<!DOCTYPE html>
<html>
<head></head>
<body>
<ul id='todos'></ul>
<input id='editor'/>
<script src='../steal/steal.js?todos/todos.js'></script>
</body>
</html>
I think you have an extra dot inside:
<script src='.../steal/steal.js?todos/todos.js'></script>

Related

How to add a bundle file ( created using ejs ) that renders in ejs node app?

I have a react/node app and i am using ejs like so:-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>EJS Is Fun</title>
<!-- CSS (load bootstrap from a CDN) -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body { padding-top:50px; }
</style>
</head>
<body class="container">
<header>
Hi header here !
</header>
<main>
<div class="jumbotron">
<h1>This is great</h1>
<p>Welcome to templating using EJS</p>
</div>
</main>
<footer>
HI footer here.
</footer>
</body>
</html>
I would like to add a script tag which basically added the main entry point of the react app. how do i do this ?
Basically when webpack loads the document on npm run start (i'am using create-react-app) the js bundle file are automatically added to the html document. similarly how can i add these bundled files to my ejs file ?
P.S.
Webpack in dev mode does't really generate any physical files.
the node and react are running on on different ports.

Cannot render css for cesium viewer from local server

I am trying to render the basic cesium viewer from a local development server using node.js with express (cesium 1.57 downloaded via npm). The page loads correctly when the CSS is loaded from cesium's servers, but not when I try to load it locally from my node_modules folder. I'd like to have the files server side so I can eventually change the display and certain sandbox settings for the infoboxes to suit the app I'd like to build.
This works:
index.html:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>mapsTest</title>
<script src="/scripts/Cesium.js"></script>
<link href="https://cesiumjs.org/releases/1.57/Build/Cesium/Widgets/widgets.css" rel="stylesheet" />
<!-- <link type=text/css href='/styles/widgets.css'></link> -->
</head>
<body>
<div id="cesiumContainer" style="width: 100%; height:100%"></div>
<script>
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhYzhjNjk0My04MzNjLTQyZTItOWRkOS1lZmQxYjE2YzM4NDYiLCJpZCI6MTAyMTYsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NTU5NjMzNjB9.DSk7rCttQeOvYyCnuesEtoiA8OUSGwitJaiBUUeqlxw';
var viewer = new Cesium.Viewer('cesiumContainer');
</script>
</body>
</html>
While this doesn't work:
index.html:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>mapsTest</title>
<script src="/scripts/Cesium.js"></script>
<!-- <link href="https://cesiumjs.org/releases/1.57/Build/Cesium/Widgets/widgets.css" rel="stylesheet" /> -->
<link type=text/css href='/styles/widgets.css'></link>
</head>
<body>
<div id="cesiumContainer" style="width: 100%; height:100%"></div>
<script>
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhYzhjNjk0My04MzNjLTQyZTItOWRkOS1lZmQxYjE2YzM4NDYiLCJpZCI6MTAyMTYsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NTU5NjMzNjB9.DSk7rCttQeOvYyCnuesEtoiA8OUSGwitJaiBUUeqlxw';
var viewer = new Cesium.Viewer('cesiumContainer');
</script>
</body>
</html>
app.js: setting up the routes for getting the local css file
app.use('/styles', express.static(__dirname + '/node_modules/cesium/Build/CesiumUnminified/Widgets'));
app.get('/styles/widgets.css', function(req, res) {
res.sendFile(__dirname + '/node_modules/cesium/Build/CesiumUnminified/Widgets/widgets.css');
});
I've tried copy and pasting the code that is pulled from the cesium css link into my local copy of widgets.css, though it still doesn't work, so I am wondering whether this has something to do with how node/express loads css files? There are no errors in the firefox or chrome consoles when I load the page.
I think you might just be missing rel="stylesheet" in the link there.
Also type="text/css" is missing the double-quotes.

Angular2 Visual Studio 2017 MVC: Uncaught TypeError: System.config is not a function

I am building Angular2 web application through Visual Studio 2017 ASP.NET MVC
All the basic configuration I did.
But when I am trying to build app then it is throwing an error.
Error:
I am surprised some time application run successfully and sometimes it throws this error.
Following this link to do quick setup
package.json, tsconfig.json and systemjs.config.js
copied from quickstart
_Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<script src="/node_modules/core-js/client/shim.min.js"></script>
<script src="/node_modules/zone.js/dist/zone.js"></script>
<script src="/node_modules/systemjs/dist/system.src.js"></script>
<script src="/system.config.js"></script>
<script>
System.import('app').catch(function (err) { console.error(err); });
</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>#ViewBag.Title - My ASP.NET Application</title>
#Styles.Render("~/Content/css")
#Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="container body-content">
#RenderBody()
<hr />
<footer>
<p>© #DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
#Scripts.Render("~/bundles/jquery")
#Scripts.Render("~/bundles/bootstrap")
#RenderSection("scripts", required: false)
</body>
</html>
Index.cshtml
#{
ViewBag.Title = "Home Page";
}
<app-root>Loading...</app-root>
You need to resolve the path to your script with Url.Content():
<script src="#Url.Content("~/node_modules/core-js/client/shim.min.js")"></script>
<script src="#Url.Content("~/node_modules/zone.js/dist/zone.js")"></script>
<script src="#Url.Content("~/node_modules/systemjs/dist/system.src.js")"></script>
<script src="#Url.Content("~/system.config.js")"></script>
This way you ensure it is always resolving to the root of your applications path and not some fubfolder if your Route changes to /controller/action/something.

Fitnesse on Linux with Jenkins

I've been trying to setup Fitnesse on a centos7 machine with Jenkins but ran into a few problems.
I have Jenkins using the Fitnesse plugin and starting an instance of Fitnesse which it does fine but then it cant seem to connect to the started Fitnesse server with an error message "Fitnesse server NOT started in 30000ms on URL: "
At First I thought it was a problem with localhost not being able to connect to it but I am able to connect on the centos machine using firefox and localhost: while Jenkins is also trying (and failing) to connect to it. So I used telnet to ping it and it produces the following:
Trying ::1...
Connected to localhost.
Escape character is '^]'.
HTTP/1.1 408 Request Time-out
Content-Length: 2131
Connection: close
Server: FitNesse-v20150424
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Error Occurred</title>
<!--[if lt IE 9]>
<script>
document.createElement('header');
document.createElement('nav');
document.createElement('section');
document.createElement('article');
document.createElement('footer');
</script>
<![endif]-->
<link rel="shortcut icon" type="image/png" href="/files/fitnesse/images/favicon.png" />
<link rel="stylesheet" type="text/css" href="/files/fitnesse/css/fitnesse_wiki.css" />
<link rel="stylesheet" type="text/css" href="/files/fitnesse/css/fitnesse_pages.css" />
<link rel="stylesheet" type="text/css" href="/files/fitnesse/wysiwyg/wysiwyg.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="/files/fitnesse/bootstrap/css/fitnesse-bootstrap.css">
<link rel="stylesheet" type="text/css" href="/files/fitnesse/question.mark/question.mark.css" />
<script src="/files/fitnesse/javascript/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="/files/fitnesse/javascript/fitnesse.js" type="text/javascript"></script>
<script src="/files/fitnesse/bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="/files/fitnesse/bootstrap/js/respond.js" type="text/javascript"></script>
</head>
<body class="error">
<nav class="navbar-fixed-top " role="navigation">
<div class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="/FrontPage"><span>FitNesse</span></a>
</div>
</div>
<ol class="page-actions btn-group">
<li class="expandall btn btn-xs">Expand All</li>
<li class="collapseall btn btn-xs">Collapse All</li>
</ol>
<ol class="breadcrumb">
<li>Error Occurred</li>
</ol>
</nav>
<header>
</header>
<article>
<center>The client request has been unproductive for too long. It has timed out and will now longer be processed.</center>
</article>
</body>
</html>
Connection closed by foreign host
So it looks like it actually IS conncting to Fitnesse, but Fitnesse isn't responding properly or something? Does anyone have any insight on the problem or possible solutions?
Are you setting up this pipeline job on a node?
It seems the Fitnesse plugin connects to Fitnesse from the master always. Hence, localhost will not answer, if fitnesse was started on a node.
For now, you will have to run fitnesse jobs only on the master.

input type="file" is not opening the file browser from Chrome Extension

I'm not sure if it's a bug or something simple that I just missed...
Here is a simple test case. The index.html is:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Test file input field</title>
</head>
<body>
<label for="file">File</label>
<input type="file" name="file" id="file"/>
</body>
</html>
The manifest is calling it inside a popup:
"popup": "index.html"
I was expecting to get the 'file browser' after clicking the 'file' button but it is vanish after 0.5sec.
(It's on Mac 10.6.8 and Chrome 14.0.835.186)
Any idea?
Thanks...
This is a bug, logged at http://crbug.com/98920

Resources