Using signalR in Ionic 2 - ionic2

In angular I can use signalR, one of the requirements is to include the following script in index.html
<script src="signalr/hubs"></script>
In ionic 2, I get the following error:
Failed to load resource: net::ERR_FILE_NOT_FOUND
How do I use this with ionic 2?

Using full url seems to do the trick.

Don't use script tags in webpack builds. The location changes and the files is not found.
For signalR in ionic I suggest you use this module
https://www.npmjs.com/package/signalr-no-jquery

Related

Angular 5 build and Zone.js

Have the picture error after build my angular 5 app, i serve my app with a django view.
I added the zone.js dependencie in my angular package.json file but i get the same error.
this is my Github gists view and template, the view load all files in the static path. this works fine.
Regards
Solve, the error it's the order of the scripts load by my django view, the view load the scripts in the folders order, but most be the next:
inline
polyfills
scripts
main

Vue and Django Development Environment

I just started a new little project for learning purposes and I want to try out Vue js with Django (with DRF). I'm trying to use vue loader (webpack-simple template).
The problem is that I don't know how to synchronize npm run dev and python manage.py runserver. I don't know how to access a template that is rendered by django in webpack-dev-server.
I mean I have a template with django-template specific keywords like {% load static %} that is not handled by webpack-dev-server, obviously.
I know I can build it everytime npm run build, but that's kinda annoying and boring to wait for it everytime I want to make a little change.
In webpack, it's specified to run on a default index.html file, how can I make it work on the template that is actually rendered on 127.0.0.1:8000 with python manage.py runserver running? I know it doesn't make any sense to run 2 dev servers, but I don't know how to explain in other way.
Is there an alternative?
Thanks in advance for answers!
Run your Django server as normal. webpack shouldn't serve your files. It should just build them (use webpack development settings and webpack --watch) and let webpack put them in the static directory of your Django project, e.g.
// in your webpack config
output: {
path: path.resolve(__dirname, 'project/static/js')
}
That way Django can serve the files that are run through your webpack pipeline.
On top you can use the webpack live reload plugin and the live reload browser extension to auto-reload when your assets change.
When you are ready to commit your changes, build your files in production mode and commit the build files in the static dir.

Google App Engine - This app has no instances deployed

App Instances:
App Versions:
app.yaml:
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /my_uri
script: path.to.my.script.script.app
I created a Python Flask app with Google App Engine. I initially ran into some issues, so I re-deployed the app. This created a new version. After doing so, I deleted the previously existing version which had one instance deployed. The currently deployed version has no instances deployed, as you can see in the image at the link above.
When I submit a request to my-app-ID.appspot.com/my_uri, I get a 404 error:
Error: Not Found
The requested URL /my_uri was not found on this server.
I believe this is related to my app not having an instance deployed. Is that correct? If so, how would I remedy this?
If not, what could be causing the 404 issue?
Thanks everyone!
As your error message indicates gcloud app browse makes a request for the / url to your app.
From Request handlers:
When App Engine receives a web request for your application, it calls
the handler script that corresponds to the URL, as described in the
application's [app.yaml][2] configuration file . The Python 2.7
runtime supports the WSGI standard and the CGI standard for
backwards compatibility. WSGI is preferred, and some features of
Python 2.7 do not work without it. The configuration of your
application's script handlers determines whether a request is
handled using WSGI or CGI.
But your app.yaml file does not contain a handler with a matching url pattern (as / doesn't match /my_uri), so GAE doesn't know which app script to launch for that request, so it'll return 404.
So the first thing you have to do is to add in app.yaml a handler with a url pattern that matches a / request.
You may want to go through the Getting Started with Flask on App Engine Standard Environment guide. In there the recommended handler would be:
handlers:
- url: /.*
script: main.app
The above alone won't necessarily make your app work, there's plenty of other things that can go wrong. You should get familiar with the app's log viewer as that's essential for debugging your app. See Understanding request log fields
But before you even go to deployment on GAE, learn how to run and test your app locally. See Using the Local Development Server

ionic2 rc0 where to put all sass files?

In Ionic Beta 2 we have decentralized our sass/scss files to our components.
Now in RC0 the upgrade guide by Ionic team is not their finest work, unfortunately.
This is how my app.scss looks like, it imports all our decentralised sass file:
#import '../+user/user-list/user-list.component';
Now imaging above 100 fold. What do I do to upgrade to RC0?
Turns out imports work like before. Against Ionic RC0 Upgrade Documentation there is no need to change any of your imports inside your app.scss. All good.
#import '../+user/user-list/user-list.component';
Works.
You need not import your scss files in ionic RC0. All you need is to create an scss file with the name you use in .ts selector.
Eg:
#Component({
selector: 'registration',
templateUrl: 'registration.html'
})
In this case i have to create registration.scss for scss. Refer 36th point under Modifying your Existing Project in https://github.com/driftyco/ionic/blob/master/CHANGELOG.md#tab-inputconfig-7143

Ember guides todomvc tutorial

I am following the tutorial in the Ember guides simply copy/pasting code. When I reach this part of the tutorial I get errors on reloading the page including:
Failed to load resource file:///home/kwal0203/ember_development/ember_tutorial/js/libs/jquery.min.js
Failed to load resource file:///home/kwal0203/ember_development/ember_tutorial/js/libs/handlebars.js
Assertion failed: Ember Views require jQuery 1.7, 1.8, 1.9, 1.10, or 2.0 ember.js:394
Assertion failed: Ember Handlebars requires Handlebars version 1.0.0. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember. ember.js:394
Uncaught TypeError: Cannot read property 'COMPILER_REVISION' of undefined ember.js:23618
Uncaught TypeError: Cannot call method 'map' of undefined
Any help appreciated
It's almost clear why your app is not working, you are loading it using the file:// protocol. This makes your vital js files to not load at all resulting in the errors you get.
Failed to load resource file:///home/kwal0203/ember_development/ember_tutorial/js/libs/jquery.min.js
...
The simple solution to your problem is to serve all the app related files from the http:// protocol, this can be easy achieved using a simple webserver. If setting up a webserver is out of your scope then use a online editor like http://jsbin.com instead and load the js libraries from a CDN, then copy and paste all your code in the online editor and everything should work correctly.
If you have python installed on your system, another possibility to have your files served by a webserver could be the following:
$ cd /home/kwal0203/ember_development/ember_tutorial/
$ python -m SimpleHTTPServer
Now open your browser and visit: http://localhost:8000
Hope it helps.