how to include paho mqtt javascript library to an ionic app - ionic2

I want to connect to an mqtt server using my ionic2 app
so I followed this link and downloaded the paho-javascript library.
The zip file is in my downloads folder, as per the link above we just need to include the tag with src as "mqttws31.js" is the correct procedure to include an external js library to an ionic2 app??
I included the script tag in the index.html
to which location, i have to copy the mqttws.js

Related

amp build and deploy to personal server

Is it possible to build an amp custom component locally and deploy to my own server?
I tried gulp build and it generates some files in the dist folder but when I try to use that generated component file in a amp page, the scripts url changes on runtime to https://cdn.ampproject.org/v0/amp-my-widget-0.1.js which does not exist!!!

How to use Weasyprint with AWS Lambda? (Django & Zappa)

I have a simple Django app which has been pushed to AWS Lambda using Zappa.
This process has worked properly, with one exception : cannot load library 'pango-1.0': pango-1.0: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'pango-1.0'
I'm using Weasyprint to generate PDF files. Weasyprint needs Cairo and Pango.
I don't know how to get Pango to work on my AWS Lambda install.
What should I do to make it work ?
So, after asking around in multiple locations, I found out that I needed the static versions of all the libraries required by Weasyprint, and that I needed to push these in my zappa package.
Luckily, a github user has uploaded a working repo of the static requirements : https://github.com/Prasengupta/weasyprint_for_awslambda
So all I had to do was download it and extract all the folders at the root of my django app (the folders must be at the same level as the zappa_settings.json file).
I then just had to do a zappa update command to upload all these files to my AWS Lambda install, and it worked!
My Django app is now full of weird directories, but at least the whole thing works.

how do i add vendor javascript to ember-cli 2.2

This might be a silly question stemming from unfamiliarity. I'm rewriting a project that was previously using Ember 1.7 in Ember 2.3, using Ember-cli v2.2
Now, in the old project, there were a couple of libraries being included manually on the index.html file, put in the scripts directory and then compiled. For example, let's say the JS asset I want to include is offline.js.
I understand that Ember-cli uses Bower and can be used to install bower components, like Bootstrap or moment.js and such. What about custom JS? I've put the file in offline.js, included it in index.html but that doesn't do anything.
I don't think I understand how to add/import vendor assets at all; how do add, say offline.js to the project and have it available throughout the application?
You should add the offline.js file to the vendor folder at the root of the project, and then in your ember-cli-build.js file add the following line:
app.import('vendor/offline.js');
This adds the offline.js file to the vendor.js which is built by default. You can see more documentation at the Ember CLI website.

Is it possible to run an ember-cli app without an HTTP server?

I've been working on an ember app and I'm trying to create a production build so my manager can look at it, I ran
ember build --environment=production
but it when I open the index.html file I get a 404 error for my app.css and app.js files, this only happens when the files are not served by an HTTP server. Is it possible to run the files locally?
Not really, when using the file URI scheme file://path/to/your/app the relative paths used in index.html won't be resolved properly. It will also break the router even if you correct the paths manually.

HTTP Error 404 with jetty server

I have the following folder structure in my project.
> src/
>>main/
>>>webapp/
>>>>WEB_INF/
>>>>>pages/
>>>>>>js/
All my script files are located in js folder and my jsp page is located in pages folder.In order to include abc.js script in my jsp page I wrote the following line
<script type="text/javascript" src="/WEB-INF/pages/js/abc.js"></script>
But I got following error
"NetworkError: 404 Not Found - http://localhost:8080/WEB-INF/pages/js/abc.js"
I am using jetty server to deploy my project. For running it I am using
mvn jetty:run
If I am putting my script file directly in webapp folder and including script in following way then it is working perfectly fine.
<script type="text/javascript" src="abc.js"></script>
But I want to maintain folder structure of my project by putting all scripts in js folder.
Can somebody please tell me why jetty server is taking files located only in webapp folder?
I am using windows7
Your src is incorrect. Java Servlet specifications states explicitly that no document under WEB-INF directory will be available to the webserver. You need to place your JavaScript file outside of it.
Usually, you place jsp files inside of it, because they're not accessed directly. They're accessed through a Servlet or any other web development framework in Java.
If you want to maintain your folder structure, just put your js folder on the web archive root:
webapp/
js
WEB-INF/
classes/
lib/
pages/
web-xml
WEB-INF directory was designed exactly to prevent that users could access files they should not get access to, such as classes, lib directories, or web.xml deployment descriptor.