Adding two seperate firebase projects for a single app - firebase

I want to implement e-commerce apps on IOS and Android. I can divide the apps into two parts less secured, more secured. I can say more secure is a case of accepting payments in the app.So for this purpose, I want to have separate login systems for entering into the app and making payments.I am using Firebase Authentication and in that Password Authentication.So at the start of the project if we want to use Firebase(for Authentication, Database)we need to add google-services.json for Android App and GoogleService-Info.plist for IOS App. But now I want to add two firebase projects for a single app. How is it possible?

Use multiple firebase projects in single application
Simply can access multiple projects through FirebaseApp configure.
Configuration
let secondaryOptions = FirebaseOptions(googleAppID: "your google app id",
                                           gcmSenderID: "your gcm id")
    secondaryOptions.apiKey = "your api key"
    secondaryOptions.projectID = "your projectid"
   
    secondaryOptions.bundleID = "your bundle id"
    secondaryOptions.databaseURL = "https://yourproject.firebaseio.com"
    secondaryOptions.storageBucket = "yourproject.appspot.com"
    secondaryOptions.androidClientID = "yourproject.apps.googleusercontent.com"
    secondaryOptions.deepLinkURLScheme = "myapp://"
    secondaryOptions.storageBucket = "yourprojectId.appspot.com"
    secondaryOptions.appGroupID = nil
FirebaseApp.configure(name: "secondary", options: secondaryOptions)
Usage
guard let secondary = FirebaseApp.app(name: "secondary")
else { assert(false, "Could not retrieve secondary app") }
let secondaryDb = Database.database(app: secondary)

in your firebase. open up a project and click on 'add another project'.
and then select app for IOS or Android. You are done.

Related

Close user sessions AXAPTA

im making a website who uses the Dynamics AX Business Connector to connect with AX, it´s working fine but sometimes the users don´t logout.
Here is my code:
Microsoft.Dynamics.BusinessConnectorNet.Axapta DynAx = new Microsoft.Dynamics.BusinessConnectorNet.Axapta();
try
{
DynAx.Logon(null, null, null, null);
//Execute some methods
DynAx.Logoff();
}
catch (Exception ex)
{
DynAx.Logoff();
}
and in ax i can see the users logged in. Again this happens sometimes, thats why i don´t know who may be.
Maybe Dispose() Method it's better?.
Thank you for taking your time to read this.
Logon/logoff works for me correctly, but if you're saying sometimes it doesn't, then the reason is most likely one of the following:
The business connector can be flaky. It's wasn't a Microsoft priority and eventually was depreciated.
Whatever is happening in your //Execute some methods section could be locking or preventing the logoff.
You may need to update your kernel to get an updated version of the business connector
In my AX2012R3 environment I can run the below PowerShell code over and over with success. This points me towards one of the above as a cause.
Add-Type -Path "C:\Program Files\Microsoft Dynamics AX\60\BusinessConnector\Bin\Microsoft.Dynamics.BusinessConnectorNet.dll"
$ax = new-object Microsoft.Dynamics.BusinessConnectorNet.Axapta
 
$ax.logon($null, $null, $null, $null)
$b = $ax.CreateAxaptaRecord("userinfo")
$array = New-Object System.Collections.ArrayList
 
$b.ExecuteStmt("select id from %1")
while($b.found){
$array.add($b.get_field("id")) | out-null
$b.next() | out-null
}
 
$array | Format-Table -AutoSize
$ax.Logoff()
$ax.Dispose()

While sending a service request (PHP Service) from Flex application, it is executing multiple service request to server. How can we avoid first call?

While sending a service request (PHP Service) from Adobe Flex application , it is calling multiple service request to server. How can we avoid first call ?
Please help me to resolve it.
First one is a blank service with operation => 5.
We can show blank service call via firebug (Browser -> Developer tool)
Sample Flex Code :
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:RemoteObject id="CustomerRo" destination="customerService" endpoint="<SERVER URL>"
showBusyCursor="false" source="customerService" concurrency="single" >
<s:method name="customerLogin" fault=""
result="method1_resultHandler(event)" />
</s:RemoteObject>
</fx:Declarations>
<s:Button click="button1_clickHandler(event)" label="Send" />
I believe the 5 is part of the AMF protocol and signals that a command operation is the next operation that should be expected by the server.
We need to do the following changes in flex application for avoid duplicate call from every request
    Add 'services-config.xml" to the application folder. (Ref : https://gist.github.com/hui/268372 )
    Add  configuration file path to Flex compiler, (Project->Properties->Flex Compiler)
       Example :  -locale en_US -services "C:\Location/services-config.xml"
    Change this attribute in code base of each modules
        
From : < s:RemoteObject id="CustomerRo" destination="customerService" endpoint="< SERVER URL >" showBusyCursor="false" source="customerService" concurrency="single" >
        
To : < s:RemoteObject id="CustomerRo" destination="amfora" showBusyCursor="false" source="customerService" concurrency="single" >
[Note : Destination should be equal to < destination id="amfora" > in 'services-config.xml" ]

Give Google Service Account access to all my Google Analytics Accounts

My work email has access to around 100 analytic accounts. Is there anyway give a google service account to all of the analytics I have access to with out needing to manually add it to every account?
Working off of Eike's comment, it seems to be possible from Google Apps Scripts:
function listAccounts() {
var accounts = Analytics.Management.Accounts.list();
if (accounts.items && accounts.items.length) {
for (var i = 0; i < accounts.items.length; i++) {
var account = accounts.items[i];
var body =
{
permissions:
{
local: ['READ_AND_ANALYZE'] //or whatever permissions you need
},
userRef:
{
email: 'theemailaddressyouneed'
}
};
Analytics.Management.AccountUserLinks.insert(body, account.id);
}
} else {
Logger.log('No accounts found.');
}
}
You will have to add the "Advanced Google Service" resource: Google Analytics API.
When you run it, you will also need to allow as a user who actually has permissions to add users to GA accounts.
Edit: I forgot to add, this seemed to create a new project for me in the developer console. I got an error message the first time about the project not having the API enabled. Click details or go to the dev console and find this project and enable the Google Analytics API.

How to check from google analytics module if user gave permission for cookies on eu-cookie-compliance module

So I have google analytics module and eu-cookie-compliance module, both working fine. Now I'm trying to disable google analytics if user didn't give permission for cookies on eu-cokie-compliance. I know that cookie module has javascript function
Drupal.eu_cookie_compliance.hasAgreed()
But I have to check that from php code in google analytics. So when page first load google analytics will be disabled.
Any ideas how to make it work?
<?php
$cookie=$_COOKIE['cookie-agreed-sl'];
if($cookie==1 || $cookie==2)return true;
else return false;
?>
So i added that code to google analytics code but it always returnss false so google analytics cookie is newer set. I tried that code in some php file and there it works. How to fix it?
The eu_cookie_compliance logic can be found in the javascript file: js/eu_cookie_compliance.js contains eu_cookie_compliance_get_settings:
Drupal.eu_cookie_compliance.setStatus = function(status) {
var date = new Date();
date.setDate(date.getDate() + 100);
document.cookie = "cookie-agreed-"+Drupal.settings.eu_cookie_compliance.popup_language + "="+status+";expires=" + date.toUTCString() + ";path=" + Drupal.settings.basePath;
}
So you have to get this cookie using php.

import users to ASP.NET membership from a file

I have a site using ASP.NET membership. I also have an excel file with about 60 user records. How can I import the records into the membership database, without having to type all 60 into the ASP.NET Web Site Administration Tool.
Thank you
foreach (record in recordset) {
    if (!(Roles.RoleExists(record["Role"])) {
        Roles.CreateRole(record["Role"]);
    }
   
    if (Membership.GetUser(record["Username"]) == null) {
        System.Web.Security.MembershipCreateStatus status;
        Membership.CreateUser(record["Username"], record["Password"], record["Email"], record["RSecurityQuestion"], record["SecurityAnswer"], true, status);
        if (status == System.Web.Security.MembershipCreateStatus.Success) {
            Roles.AddUserToRole(record["Username"], record["Role"]);
        }
    }
}
I can't recall the code to create a recordset from an Excel file off the top of my head.
EDIT: Here is a good post on how to read/write excel files with ADO.NET
Here's three options for you
There may be an import data option in SQL Server Management Studio, you can use this (I just checked in SQL Server Express and it wasn't there but I'm certain it exists in the full version of Management Studio - can't check at the moment).
Use SSIS if you have it
You can do it old school and use Excel to build up a SQL string with references to the cells. Do this for the first row and then copy down. Copy all the statements into a query window and execute!
Choice 1
If you're lucky, Excel has a way to export the rows directly to your database (this depends on which Database you're using)
Choice 2
Write a program that iterates over each row in the excel table and inserts it manually into your database (again, process depends on which one)

Resources