Posts

Migrate to php7 in Mac os Sierra with Apache Configurations

Image
Mac os Sierra defult comes with Apache as well as php 5.. Fi you want to start apache with defult settings The following articles gives short as well as comprehesive guideline. https://jason.pureconcepts.net/2016/09/install-apache-php-mysql-mac-os-x-sierra/ https://medium.com/@JohnFoderaro/how-to-set-up-apache-in-macos-sierra-10-12-bca5a5dfffba However , I wanted to setup firebase integration with laravel and it requires php 7. ( kreait/firebase-php ^ 4.0 ) You can eassy install php 7 using homebrew. brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php brew unlink php56 brew install php70 Thin you can check the version as follows . $ php --version But if you have enabled defult php in Mac Os , you will see  it will return 5.6 In order to chanage this you have to edit the httpd.conf file of apache.  Stop apache -    sudo apachectl stop move to etc/ apache2. -    cd /etc/apache2 backup httpd.con...

Firebase Cloud Functions Triggers with Two varibles

Image
 Although firebase functions document not mentioned about how many varible values can be exhist in firebase onWrite() tirgger , I have used it upto 2 levles without any issue.  For an exaplen in the blow code , I have consider the change in list under the userId ,, The value will be wrriten under the varible of user.  exports.testFunctionName = functions.database.ref('/user-list/{user}/{pushId}').onWrite(( change,context) => {             const original =  change.after.val();             var pushId=context.params.pushId;                 var userId=context.params.user; ...

Covert firebase to Node Express Rest API

Image
 Firbase hosting and functions provide nice solution to develop a REST api .The following video from firebase provide more infromation than our simple REST API. https://www.youtube.com/watch?v=LOeioOKUKI8 I thought of detail the process  in to more depth. First , you need to go to desired folder and install firebase tools. You should have npm for do that. Then create a firebase account and project with desired name. After that, you have to use the command firebase init. The online authentication will be proceed there after .You have to copy and paste the URL displayed in the console to the web browser. Then there we have to create the local project with firebase hosting and firebase functions. In the project you can see the functions folder ,which used to create the functions. In order to use the express, you need to use express npm packge. Move to functions folder and then run npm install express, then firebase-functions. If you are using firebase datab...

How to user firebase Orderby Wisely

Image
There are number of ways  firebase order by can be used.Ferfer the following example.  It can be user as a where clause  to select values based on child attribute.You dont need to select items within the for loop.  todoRef.orderByChild("title").equalTo("test 1").once('value').then(function(snapshot) {     snapshot.forEach(function(childSnapshot) {         var todoID=childSnapshot.key; }) }).. We can use it as fallow,,

Use node which-country

Image
I  need to take the users country based on the geo-codinates provided by the mobile application. whlile doing some reaserch in node which-country , I found that ituseful,but need to pass value wisely.  https://www.npmjs.com/package/which-country  var whichCountry = require('which-country'); // pass it as  [latitudes,logitudes] var userCountry = whichCountry([6.795019389999998,79.88569332999997]); console.log('test userCountry :'+userCountry);  //return null // pass it as [logitudes,latitudes] var userCountry = whichCountry([79.88569332999997,6.795019389999998]); console.log('test userCountry :'+userCountry);  //return LKA I test the application with the given code of me in the test packges given by them. https://github.com/vkurchatkin/which-country/blob/master/package.json AUS -22.000825,132.889122 BLR 52.337547,24.080529 CAN 57.255393,-106.712553 CYP 35.315045,33.681395 DZA 23.184085,7.117638 ITA 39.926747,9.017427 JPN 43.771243,142.76...

Stripe Testing With 1 Day Plan - Subscription Not Cancel Automatically

Image
We normally use Stripe one day plan to test the scenarios. However we found a unexpected behavior  with stripe when we are using stripe one day plan. We created a subscription with the test card " 4000000000000341 " which make the payment unsuccessful when try to charge. According to dunning rules subscription have to cancel after 2 attempts. " It's likely that the Subscription hasn't cancelled because it doesn't have enough time to cancel as you have a daily Subscription. You see when a new invoice is created for a Subscription, it resets the retry logic (basically setting the retries back to zero).  For a daily Subscription you can't have more than 1 retry as it wouldn't give the retry logic enough time to carry out the final condition (i.e cancel the Subscription).  "

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory Different

Image
 This is a common error I found when I upgrade from node 8.8 to node 10.1 within my mac osx seirra. > node build.js || nodejs build.js xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance node 10.1 is not a stable release and I had to backdate it with the stable version. In addition, to fix the issue I had to run few commands to identify the location of command line tools. https://stackoverflow.com/questions/18533761/find-out-the-path-location-to-command-line-tools-for-xcode?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa /usr/ bin / clang -- version Apple LLVM version 9.0.0 (clang-900.0.39.2) Target: x86_64-apple-darwin16.7.0 Thread model: po...