Flex 4.7 Accessing another Application Storage Directory - actionscript-3

Is it possible to access another .air application storage directory? Because when I do the following:
private var _installerFile:File = new File("app-storage:/");
var appDir = new File()
appDir = _installerFile.resolvePath("../../..");
I just want to go up from my storage directoy into the App Data and then inside another App directory.
Thanks for the help,
David

Related

Error reading credential file from location in xamarin.forms while connecting to Cloud Firestore

I am developing a mobile application in xamarin.forms. I will use Google CloudFirestore as Cloud Database. When I want to connect to the database, I get the following error:
One or more errors occurred. (Error reading credential file from location D:\ yemekbagisiyapbucak.json: Could not find file "/D:\ yemekbagisiyapbucak.json"
Please check the value of the Environment Variable GOOGLE_APPLICATION_CREDENTIALS)
public static FirestoreDb db;
path = "D:\\yemekbagisiyapbucak.json";
Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);
db = FirestoreDb.Create("yemekbagisiyapbucak");
At first, please make sure the .josn file is in the path you set. var path = Path.Combine(FileSystem.AppDataDirectory, "yemekbagisiyapbucak.json"); get different path on different platforms.
So you can debug it and check the value of the path, and then copy the .josn file to the path.
If you need more information, please check the following link:Connecting to Google cloud firestore in a cross platform mobile app (xamarin c#)

Samba server does not show all folder/files unless few are deleted

I have Samba 4.14.5 installed on RHEL8.
If I create a few subfolders and then create say 500 files/folders there , about 350 show up. But all can be accessed if I give the complete adress in the windows
explorer.
If I create 350, then all show up. If I create the 351st
folder, then one gets ramdomly invisible but it can be accessed if I
give the complete address in the windows explorer.
If I delete the 351st dir, then the other 350 show up correctly.
If I create another subfolder, maybe 200 will show up, so this is ramdom.
The servers is an EC2 instance and the mount is an EFS.
Config in samba.conf
[global]
realm = SAMPLE.ORG
workgroup = EXAM
security = ads
kerberos method = secrets and keytab
template homedir = /home/%U
idmap config * : backend = tdb
idmap config * : range = 10000-199999
idmap config EXAM : backend = sss
idmap config EXAM : range = 200000-2147483647
load printers = no
machine password timeout = 0
log level = 4
[data-robo]
comment = AWS EFS share drive
browseable = Yes
read only = No
write list = #group1,#group2
public = No
path = /data/robo2
valid users = #group1,#group2
force directory mode = 777
Thanks,
Just adding I see this same behavior with a CentOS 8 Stream samba 4.16.4 server sharing NFS mounts from a VAST appliance. I do not see it when sharing an NFS mount from another CentOS 8 Stream box. I also do not see it when sharing the VAST NFS mounts on a CentOS7 samba server running 4.10.16.
So the solution for us for now is to share the VAST NFS mounts only from a CentOS7 samba server. I assume the same would be true for EFS

How to access environment variables from JSON file?

I am using firebase authentication in my nextjs app. I have stored my service account credentials in a file called secret.json. I wanna hide those credentials in my next.config.js file. How can I access those credentials in the secret.json file? Maybe this will be the same approach not only for nextjs apps but also for other apps. What is the common way to achieve that or is there any specific way for nextjs app?
You might consider storing your private key as an environment variable, which Next.js has built-in support for. You can then avoid the risks of exposing your secrets in next.config.js and services like Heroku and Vercel make it easy & secure to store your env vars in production.
To initialize Firebase on your server, you need just 3 things from your secret.json file:
project_id
client_email
private_key - store this as an env var (e.g., FIRESTORE_PRIVATE_KEY)
You can then use the firebase-admin package to initialize Firebase on your server:
import { cert, initializeApp } from 'firebase-admin/app'
const serviceAccount = {
projectId: 'my-project',
clientEmail: 'myServiceAccount#my-project.iam.gserviceaccount.com',
privateKey: process.env.FIRESTORE_PRIVATE_KEY,
}
const credential = cert(serviceAccount)
initializeApp({ credential })
Saving the private_key as its own env var will also avoid problems arising from attempting to save/parse the entire Firestore json as an env var (e.g., ENAMETOOLONG error) and not require you to do any string manipulation.

PupeeteerSharp Does Not Work in ServiceFabric Stateless Service

I am developing web crawler which could render Javascript websites and so I decided to use PupeeteerSharp, a .NET port of popular Node.JS headless Chrome browser Pupeeteer API. I am running Service Fabric's local development cluster on Windows 10 development machine and have one stateless service in my solution.
I've created Data folder under Service project's PackageRoot folder and put .local-chromium folder contents there (contains chrome.exe executable) so it deploys as independent data package of service.
I've also placed this XML config line in ServiceManifest.xml file:
<DataPackage Name="Data" Version="1.0.0" />
So far it looks good and headless browser content is copied to SFCluster Data package directory properly.
Then in my Stateless Service code I try to call Pupeeteer chromium executable as follows:
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true,
ExecutablePath = _chromiumPath // #$"{context.CodePackageActivationContext.GetDataPackageObject("Data").Path}\.local-chromium\Win64-706915\chrome-win\chrome.exe"
});
using (var page = (await browser.NewPageAsync()))
{
Response renderResponse;
try
{
renderResponse = await page.GoToAsync(webPage.AbsoluteUri, timeout);
if (renderResponse.Status != System.Net.HttpStatusCode.OK)
{
return new RenderResult(RenderStatus.OtherFailure);
}
// other code
}
catch (TimeoutException)
{
return new RenderResult(RenderStatus.Timeouted);
}
In this line: using (var page = (await browser.NewPageAsync())) my code (Thread) simply hangs without returning, in Debug console I see many thread exits, but no exception occurs. I was previously getting System.IO.FileNotFoundException when I was fixing some other errors regarding appropriate copying of chromium folder contents, but now these errors are gone so it seems that code find .exe but somehow cannot start headless mode of PupeeterSharp.
Does that mean that I cannot simply run external .exe chromium binary with Service Fabric's Native Application Model? Should I use Docker and Linux containers instead?

Windows Store app local folder data lost when running WACK?

My first Windows Store App is almost ready to be uploaded. It passed the Windows App Certification Kit test on my machine. However if I "build packages to upload to Windows Store", it fails the test due to "Crashes and hangs". I found out that the WACK deletes my package folder before running the test, and because the app needs to load data from there upon start, it will probably not find it and thus hangs.
My questions are:
What happens to the files in my Local folder (i.e. C:\Users\...\AppData\Local\Packages\packageName\LocalState) when the app is packaged?
If I need to read and write data from files upon app start, where should I keep these files?
Thank you a lot for your time!
I am using Visual Studio 2013 Update 2, WACK 3.4.
Here is some code that runs when my app starts, I try to deserialize an existing file in the Local folder:
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
StorageFolder demoFolder = await localFolder.CreateFolderAsync("Demos", CreationCollisionOption.OpenIfExists);
StorageFolder gameRecordFolder = await demoFolder.CreateFolderAsync("GameRecords", CreationCollisionOption.OpenIfExists);
string filename = gameRecName+".xaml";
StorageFile gameFile = await gameRecordFolder.GetFileAsync(filename);
GameRecord g;
using (Stream fileStream = await gameFile.OpenStreamForReadAsync())
{
XmlSerializer serializer = new XmlSerializer(typeof(GameRecord));
g = (GameRecord)serializer.Deserialize(fileStream);
}