In this sample I am using a node module called ‘ ExcelJS‘. This will stream the data to the file instead of big data in memory (if we are keeping large amount of data in memory, we may get `JavaScript heap out of memory` exception ) this will write to the file
Install the module using npm
npm install exceljs --save
then in the node application just import the module
const Excel = require('exceljs'); const options = { filename: 'myfile.xlsx', useStyles: true, useSharedStrings: true }; const workbook = new Excel.stream.xlsx.WorkbookWriter(options); const worksheet = workbook.addWorksheet('my sheet'); worksheet.columns = [ { header: 'Id', key: 'id' }, { header: 'First Name', key: 'first name' }, { header: 'Phone', key: 'ph' } ] var data; for(let i = 1; i<= 10; i++){ data = { id: i, 'first name': "name "+i, ph: "012014520"+i }; worksheet.addRow(data).commit(); } workbook.commit().then(function() { console.log('excel file cretaed'); });
we can use the same module in typescript also
refer : exceljs
Visit https://firebase.google.com/docs/cloud-messaging/android/client for more details
1) Create your app and add it as a project in firebase https://console.firebase.google.com/
2) Add your projects package name while creating the project
3) Download the google-services.json (will be downloaded automatically) and save it in your app module (while opening the project in project tab)
4) Add the classpath dependency in project level gradle and apply plugin dependency in app level gradle
5) Add the firebase dependency for fcm to support cloud messaging
6) In your Manifest create two services which extend
public class MyFirebaseMessagingService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); } }
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService { @Override public void onTokenRefresh() { super.onTokenRefresh(); String refreshToken = FirebaseInstanceId.getInstance().getToken(); Log.d("refreshToken", "onTokenRefresh: " + refreshToken); } }
Add these two services in your manifest
<?xml version="1.0" encoding="utf-8"?> <manifest package="com.example.sanket.pocfcm" xmlns:android="http://schemas.android.com/apk/res/android"> <application ...> <activity ...> </activity> <service android:name=".MyFirebaseMessagingService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT"/> </intent-filter> </service> <service android:name=".MyFirebaseInstanceIDService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> </intent-filter> </service> </application> </manifest>
7) You can test notifications from the notification console of your app https://console.firebase.google.com/project/<YOUR_PROJECT_NAME_HERE>/notification
GitHub is an online repository. Many people find it very confusing to use GitHub, so I’ve decided to share my experience of using it on Linux Ubuntu.
So in this post we will discuss:
1. How to set up and clone repo to your local machine avoiding message: Permission denied (publickey).
2. How to transfer all changes you are making INTO Github
3. How to get those changes FROM GitHub
My way could not be the most efficient one, but it works for me.
How to setup up GitHub to your local machine ?
So for the first part, you need to download Git and set your SSH key. Thanks to the GitHub documentation, step by step guide is here:
http://help.github.com/linux-set-up-git/
How to clone your repo to your local machine ?
(in git terminology it’s called “checkout“)
First you need to find your repo address. It can be find on your GitHub repo page:
Copy the address in the box (git@github.com……/….git)
Open the terminal and go to the folder where you want to have your git to be located.
Type command:
git clone ADDRESS YOU COPIED
Here is my output:
How to transfer all changes you are making INTO Github ?
(in GitHub it is called Push)
There are 3 steps to transfer your changes to GitHub:
a. You need to add files —> git add .
(“.” means all the files, no worries, it will add everything that was changed.)
b. You need to Commit you changes –> git commit -m “Message you want to see near your commit”
c. Push your changes to the server –> git push
My output:
On the repo I now see that README file has my commit message (I changed only README.txt):
How to get those changes FROM GitHub ?
git checkout
git pull
These commands will bring all the new stuff from GitHub to your machine.