Setup angular4 with firebase authenticate

Source from https://coursetro.com/posts/code/31/How-to-Make-an-Angular-Firebase-Chat-App

Go to firebase home page https://console.firebase.google.com/project/kindergarden-management/overview.

click “Create New Project“. Give it a project name such as “mychatapp” and click “Create Project“.

Click on Add Firebase to your web app, then copy the config, this will be in your app module of angular. There are 2 more option you can create, on android app & ios app.

https://www.gstatic.com/firebasejs/4.1.3/firebase.js

// Initialize Firebase
var config = {
apiKey: “AIzaSyA5LwuidkA8ubv24Vw2VaJ7lIgn39_OOKU”,
authDomain: “kindergarden-management.firebaseapp.com”,
databaseURL: “https://kindergarden-management.firebaseio.com”,
projectId: “kindergarden-management”,
storageBucket: “”,
messagingSenderId: “1015344435370”
};
firebase.initializeApp(config);

  • Click on left menu Authentication: -> Sign in method
  • Then choose facebook, turn it on, enter fb appId and secret

https://kindergarden-management.firebaseapp.com/__/auth/handler

  • Then go back to facebook, create new app login in product left menu.
  • Copy rule from firebase’s database menu.
  • {
    “rules”: {
    “.read”: “auth != null”,
    “.write”: “auth != null”
    }
    }
Posted in AngularJs | Leave a comment

Learn Typescript on .Net core

https://www.typescriptlang.org/docs/handbook/asp-net-core.html

Posted in AngularJs | Leave a comment

Twig Templating Engine in OpenCart

OpenCart uses Twig templating in their template folder opencart\catalog\view\theme\default\template\common\home.twig.

If you still see the old page before you changed. The reason of this is twig generated all php file inside the folder opencart\system\storage\cache. So you should simply remove all of these file inside this cache.

Posted in OpenCart | Leave a comment

Install Opencart ecommerce

Install very easy with some steps:

Step 1: go to Home page of opencart https://www.opencart.com/index.php?route=common/home, then click Download to get the latest package to install.

Step 2: Read the install.txt inside the package above, you need to copy all files inside folder upload into your php site. Here is opencart.

Step 3: Go to the page and setup the database.

Finally, will see the ecommerce opencart.

 

 

Posted in OpenCart | Leave a comment

Setup git in visualStudio 2015

Here is example git on github working with Visual Studio.

Step 1: Go to your github, if you don’t have an account, please create it because it allows you upto 1GB each repositories. Here is i created repository Moms

Step 2: Open your project into Visual Studio 2015, right click on solution and choose Add Solution to Source Control.

Step 3: Open Team Explore by press Ctrl+M or click on View->TeamExplorer.

Step 4: Now what you need is pasting the link of your github repository into the server link then clicking on the Publish button.

How to clone a gitHub repository into Visual Studio:

Just copy your git repository url into TeamExplorer on Clone tab. Ensure you provide the empty folder for git local.

How to check in your changes from machine to github repository:

Step 1: right click on solution, click on the commit menu.

There will be a screen asking you to enter the comment and then click on Commit All.

Next screen requires you Sync to Pull your code from repository then push your code to repository.

Source reference: https://www.infragistics.com/community/blogs/dhananjay_kumar/archive/2016/07/21/step-by-step-working-with-github-repository-and-visual-studio-2015.aspx

Posted in Source Control | Leave a comment

Request Permission at Run time

When i was upgrading from api 19 Android KitKat, one of an error i got is “Exception java.lang.SecurityException: getDeviceId: Neither user 10129 nor current process has android.permission.READ_PHONE_STATE”. Here is what i trace and fix following up these steps from site https://developer.android.com/training/permissions/requesting.html

Reason: in old api lower than 23, they accept app to set some dangerous permission inside AndroidManifest.xml of android project<uses-permission android:name="android.permission.READ_PHONE_STATE"/>, but now it’s not affect on new one and don’t allow that line then it become useless.

Solution: if you are writing for and admin app, not a social app. You can define setup processing before rolling out the app to user, just go to Settings->Applications->Choose the app and give it all permissions.

For social app: we need to add these line of code inside the Activity working on.

Step 1: Check permission, show the popup request if not. Remember add

int constant REQUEST_READ_PHONE_STATE so that we can reuse this flag in request callback.

int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE);

        if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, REQUEST_READ_PHONE_STATE);
        } else {
            //TODO
        }

Step 2: Handle call back when you request permission inside the Activity

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {
        case REQUEST_READ_PHONE_STATE:
            if ((grantResults.length > 0) && (grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
                //TODO
            }
            break;

        default:
            break;
    }
}

Posted in Android | Tagged | Leave a comment