How to solve Failed to execute ‘send’ on ‘XMLHttpRequest’: Failed to load [filename]

So, the other day I was writing my AngularJS Routing Example for the WCG community and I suddenly got in a kind of trouble: I couldn’t seem to get it working!!!

My app’s critical point was that I was trying to deploy an app that included ng-view, to a browser.

By default, a browser doesn’t allow AJAX requests to files located on your local file system. This happens for security reasons. But, ng-view uses an AJAX request to load templates, so the options are:

  • Configuring your browser in order to allow local files access; (this link explains how to implement this action in Google Chrome)
  • Run your app in a local web server.
The first option is quite straightforward, so I’ll stick with the second one. I recommend users that don’t have locally a web-server, to go for an open-source solution, like http-server, which can be configured very easily.
I’m a Java lover and I have installed one distribution of Tomcat in all of my working instances, so the following demonstration is about running an Angular app to Tomcat:
  • Copy or move your app’s folder to Tomcat’s /webapps folder and execute:
  • Navigate to Tomcat’s /bin folder and execute the startup script:

  • Verify that Tomcat deployed your app:
  • Access your app from Tomcat, you should have a clear console now:
Cheers!

How to install Perl and cURL on Windows

Hello!

Perhaps you ‘ll never need Perl, but when you are about to do it, you obviously don’t want to mess with cygwin and stuff like that.
I actually found a simple solution to get it up and running in about 5 minutes, together with cURL installation, without configuring anything on your environment, but only running the .msi installers.

If you don’t actually know it, Strawberry Perl is the most stable version for Windows, so:

  • Visit Strawberry Perl site.
  • Download the version that matches your system (I’m on a 64-bit machine):
  • Run the installer.
The installer automatically places the Perl directory under the correspong Program Files folder (so, for me, it is under “Program Files”, but if you selected the 32-bit version of it, it should place it under “Program Files (x86)”.
It also adds the perl executables to your system path, by default.

  • Validate the successful installation of Perl, to your system: 
I suppose the only reason for someone to start using Perl in 2014, is related to web technology, i.e transfering data by using different protocols. An easy way to do that, is by using the cURL tool.
While on my investigation to do this without having to use cygwin or my cmd, I found this site, that also provides an .msi installer in a reliable way, like the one we ‘ve used for Perl (the highlighted version is what worked for me):

So, when the installation is finished, you just have to validate that you ‘re good to go:

Cheers!