Posts

Impact of sampling and interpolation for time series

Image
  The raw data recorded when a change detected in the stream enables more realistic data recording comparison to time based sampling.Thus, sampling and interpolation required for most of the comparative analysis using time series, limit the usage of raw data for extended analysis. However, you might wonder how it can distort the realistic nature of the data (except the probable anomalies) and leading to false interpretation.Lets focus on our theme. For the analysis I am using fe w  selected variables from water quality dataset recorded from  Baffle Creek   and  Byrnett River .  First I will combine the two datasets into single dataset without sampling using panads merge function. The Pearson Correlation Coefficient (PCC) calculated for the combined dataset and the heat-map of the results given below. Figure 1 : PCC between variables in two un-sampled datasets From the results, it is obvious that the two datasets may have correlations in-between the variable inside the dateset, thus, no

Grab Google Analytics Data in remote account from Firebase Functions

Image
Although Google analytics Login is isolated from other Google services, you can easily access the analytics data from another service.  I am going to demonstrate how to retrieve google analytics data from firebase functions. You need to use googleAPI node package as an assistant. In coding, you have to use  JWT authentication in order to avoid async await issue in Google Cloud functions. Currently stable version of cloud functions is Nodejs 6. You have to download the service-account.json from Firebase or google cloud. In firebase, it is located at the following link. You have to generate a new private key. https://console.firebase.google.com/u/0/project/<project-id>/settings/serviceaccounts/adminsdk Make sure it contains the client email. That email need to be added in Analytics >>admin >> User Management Section as a user. https://analytics.google.com/analytics/web/ The code block in the batchGet fuctions will execute in firebase functions no

Google Cloud Scheduler using Firebase Functions

Image
Google recently released a beta version of Google Cloud Scheduler . It makes much easier to schedule a task in firebase. https://cloud.google.com/scheduler/docs/tut-pub-sub You should enable APIs before proceed. Sorry, you have to have a billable account for continue. https://cloud.google.com/scheduler/docs/quickstart gcloud config list  gcloud config set project <projectname> gcloud components update gcloud pubsub topics create cron-job . *** name of the pub sub cron-job gcloud pubsub subscriptions create cron-sub --topic cron-job After creating that , you have to go to shecdular https://console.cloud.google.com/cloudscheduler Select the project and create a scheduled task . In target select pub sub and give the topic as the same name given in pub-sub generation above (cron-job ). After creating the job you can define the code to execute in the firebase functions. The code in the firebases function will be like below for pub sub job name "cr

react-quill Integrate quill-image-resize-module

Image
React-qill  is a great free package which can be used for design editors. However, if you are using the image upload feature, there is a problem of integrating resize package. This was discussed in may treads and I was able to find the best approach integrate it with react-starter-app. https://www.npmjs.com/package/quill-image-resize-module If you use the following code, import Quill from ' quill ' ; import { ImageResize } from ' quill-image-resize-module ' ; Quill . register ( ' modules/imageResize ' , ImageResize); const quill = new Quill (editor, { // ... modules : { // ... imageResize : { // See optional "config" below } } }); The following error is common. TypeError: Cannot read property 'imports' of undefined var d = window.Quill.imports.parchment In order to overcome the issue , you have to update the node_modules/react-scripts/config/webpack.config.

xe.com api integrate with postman:authentication

Image
According to xe.com document we have to use the basic auth and they not provide information about the credentials. curl –i -u account_id:api_key "https://xecdapi.xe.com/v1/account_info/"  But in order to login you should provide the  Account ID   for username and the  Account API KEY   for password for login, which is given after creating the account. 

React JS Tabs Add and Close Tabs

https://ctxhou.github.io/react-tabtab/#add-close In order to use Tabtab we have to downgrade the version of the styled component  to 3.4.10 in order to use   "react-tabtab": "^1.8.2".

Firebase Storage - File upload to folder 403 Firebase Storage: User does not have permission to access

Image
When I was using firebase storage from the client side without admin sdk , I got the following error with the authenticated user, when I am uploading an image.   var temp = storage.ref().child("temp")                          .child(file.name);     temp.put(file)     .then(snap => { .... } Firebase Response  : Firebase Response  : FirebaseStorageError {code_: "storage/unauthorized", message_: "Firebase Storage: User does not have permission to access 'temp/50.png'.", serverResponse_: "{ ↵   "error": { ↵     "code": 403, ↵     "message": "Pe…n denied. Could not perform this operation" ↵   } ↵ }", name_: "FirebaseError"} The error is due to the issue in firebase storage rules. The document pages do not specify how to set permission to all the objects under the given folder . However , they have given an example, to resolve the issue. See the example at t