Complete Guide Ionic 3 Firebase with cordova plugin firebase

Okay let’s start to integrate in our Ionic 3 app the Firebase Google Cloud Message with the cordova plugin firebase.
In the Ionic 3 we can found the native integration with this plugin. For the documentation click here.
It work with IOS 10 and IOS 11 and latest version of Android, i have tested it.

In this guide we can see:
Install cordova plugin firebase on Ionic app
Setting cordova plugin firebase on Ionic app
Setting Firebase Cloud Message

 

Install the Ionic Firebase module

We must to install the npm library and the cordova plugin so let’s start to execute this command:

Then we must to use it on our app, so let’s start to include it in our app.module.ts, import it and then add into “providers” section.

 

Setting cordova plugin firebase on Ionic app

Now we can use it in our app.component.ts, for the grant permission, registration of token.
This is a simplest installation, import it, add in the constructor, and then use this.firebase to attach at the event.

For IOS is very important the method “grantPermission”

Now we must to setting up the account on the firebase cloud messaage, so we can generate two files:
google-services.json (Android)
GoogleService-Info.plist (IOS)

We can add this file in the root directory, with the config.xml and package.json file.

Setting Firebase Cloud Message

To setting up the firebase account remind to this guide: https://engineering.hexacta.com/managing-push-notifications-with-ionic2-3698249c07a

Remember, is very important that you upload you APN CERTIFICATE IOS, if you not load it the notifications not work.
This guide: https://firebase.google.com/docs/cloud-messaging/ios/certs

 

If you have some question write me.

Aruba VPS Centos VMware – Come aumentare lo spazio hdd

Oggi vedremo come aumentare lo spazio (ripartizionare) dell’hard disk, una volta eseguito l’upgrade sul vostro vps aruba.

fdisk -l

parted /dev/sda/

Per creare una nuova partizione per lo spazio aggiunto, lanciare mkpart e rispondere alle varie richieste. Dapprima vi viene chiesto di scegliere il “type” fra” primary” ed “extended” (sceglieremo primary) successivamente viene chiesto il tipo di “File System” (ad esempio scegliamo “ext3” e confermiamo); successivamente viene richiesto l’inizio e la fine della partizione (nel nostro esempio se vogliamo creare una partizione che corrisponda con tutto lo spazio aggiunto, basta indicare come inizio il valore “end” della partizione con il numero più alto e con la dimensione massima per la fine).

A questo punto rilanciando print possiamo verificare che è stata creata la nuova partizione 3.

Ora non resta che creare il Filesystem nella partizione creata: dapprima uscire da “parted” digitando quit e quindi lanciare mke2fs per la partizione creata.

df -h /home/

vgdisplay vg

lvextend -L +2G /dev/mapper/vg-lv_root

resize2fs /dev/mapper/vg-lv_root

Per arrivare a ciò ho seguito due guide, la prima di Aruba e la seconda di linuxtechi, che vi riporto qui di seguito:

http://kb.cloud.it/computing/creare-e-configurare-un-cloud-server/ri-formattare-un-disco-fisso-espanso-linux.aspx
http://www.linuxtechi.com/extend-lvm-partitions/

LINQ on Nodejs With node-linq

In this days that i have some free time on my “drawing realtime app” project, i have added a managment of the object with the linq.

In c# i use even the linq, but in javascript this is the first time that i use it with success.
Because i have tested https://linqjs.codeplex.com/ some some some times ago but with big object is obviously slow, is even “client side”.

But now with nodejs i can use the linq “server side”, i have seen some library but in my opinion the best is node-linq created by the wearefractal.
Is fast, the docs are good (but they can insert more).

For example i have used it for extract all the action taken in a “drawing room”, for the date i have used timestamp:

var arrRoom = new LINQ(registerRoomAction).Where(function(roomAction) { return (roomAction.room == socket.room && roomAction.date > singleClient.lastupdate && roomAction.date < now); }).OrderBy(function(roomAction) {return roomAction.date;}).Select(function(roomAction) {return roomAction.data;}).ToArray();

 

So if you want to exract only an item you can use Single():

var singleClient = new LINQ(clients).Where(function(client) { return (client.username == username); }).Select(function(client) {return client;}).Single();

 

It is very fast and simple, if you use linq on c#, you are no problem to use it.

For some question you can contact me, i respond to you.