Embedded C Parse Server migration serverURL - linux

I want to try to change embedded c linux ParseClient to point to my heroku hosted parser url but I couldn't find any command like Parse.serverURL = "http:parse.herokuapp.com/parse" like iOS, Androind, and etc. in this example https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#using-parse-sdks-with-parse-server

In the latest version 1.0.4 of the sdk there is a new initialize method that also takes a serverUrl.
ParseClient parseInitializeWithServerURL(const char *applicationId, const char *clientKey, const char *serverURL);
It seems like everything should work, but the issue for this is still open on github so I'm not entirely sure. You can follow it here.

Related

Can't load Features.Diagnostics

I'm creating a web client for joining Teams meetings with the ACS Calling SDK.
I'm having trouble loading the diagnostics API. Microsoft provides this page:
https://learn.microsoft.com/en-us/azure/communication-services/concepts/voice-video-calling/call-diagnostics
You are supposed to get the diagnostics this way:
const callDiagnostics = call.api(Features.Diagnostics);
This does not work.
I am loading the Features like this:
import { Features } from '#azure/communication-calling'
A statement console.log(Features) shows only these four features:
DominantSpeakers: (...)
Recording: (...)
Transcription: (...)
Transfer: (...)
Where are the Diagnostics??
User Facing Diagnostics
For anyone, like me, looking now...
ATOW, using the latest version of #azure/communication-calling SDK, the documented solution, still doesn't work:
const callDiagnostics = call.api(Features.Diagnostics);
call.api is undefined.
TL;DR
However, once the call is instantiated, this allows you to subscribe to changes:
const call = callAgent.join(/** your settings **/);
const userFacingDiagnostics = call.feature(Features.UserFacingDiagnostics);
userFacingDiagnostics.media.on("diagnosticChanged", (diagnosticInfo) => {
console.log(diagnosticInfo);
});
userFacingDiagnostics.network.on("diagnosticChanged", (diagnosticInfo) => {
console.log(diagnosticInfo);
});
This isn't documented in the latest version, but is under this alpha version.
Whether this will continue to work is anyone's guess ¯\(ツ)/¯
Accessing Pre-Call APIs
Confusingly, this doesn't currently work using the specified version, despite the docs saying it will...
Features.PreCallDiagnostics is undefined.
This is actually what I was looking for, but I can get what I want by setting up a test call asking for the latest values, like this:
const call = callAgent.join(/** your settings **/);
const userFacingDiagnostics = call.feature(Features.UserFacingDiagnostics);
console.log(userFacingDiagnostics.media.getLatest())
console.log(userFacingDiagnostics.network.getLatest())
Hope this helps :)
Currently the User Facing Diagnostics API is only available in the Public Preview and npm beta packages right now. I confirmed this with a quick test comparing the 1.1.0 and beta packages.
Check the following link:
https://github.com/Azure-Samples/communication-services-web-calling-tutorial/
Features are imported from the #azure/communication-calling,
for example:
const {
Features
} = require('#azure/communication-calling');

fuse_js_1.default is not a constructor | Fuse.js in Typescript

i have a little API in express js with Typescript - Node 14 and i'm using fuse js to search a list of packages in the database. (the file name is server.ts)
This is how the ts code looks:
const fuse = new Fuse (list, options)
and compiles fine but when i deploy the code in the server show an error
... fuse_js_1.default is not a constructor ...
so i go to the server.js result file and the code is like this
const fuse = new fuse_js_1.default(list, options)
if i remove .default word, the code looks like this new fuse_js_1(list, options) the code runs fine and works!!
Is there a way to force Typescript not to compile this line? or remove the .default automatically? I accept your comments and ideas thanks :)
Sorry, bag english :/
I found the problem, change
import Fuse from "fuse.js"
to
const Fuse = require("fuse.js")
:)

Google Translate V2

I've used Google Translate for years with excellent results. Now, Google has deprecated my version and now employs Google.Cloud.Translation.V2.
The Nuget Install-Package Google.Cloud.Translation.V2 -Version 2.0.0 installs, but causes the dreaded yellow screen saying is can't find one thing after another, and also System.Net.Http version conflicts. Manually edit Web and Machine configs, and on and on.
Also, Google samples reference things with undefined namespaces. i have the Google credentials json file.
I really don't want to change Environment vars in a production environment.
Bottom line? I'm in agreement with hundreds of folks saying that this is a nightmare.
With Nuget, it's usually easy to install, reference and run. Not so here. Google's primers on this are unnecessarily verbose and impossible, at least for me, to follow. This should be Nuget, reference, code.
I think I'm up to about 100 folks with the same problem. Aaaargh!
Ideas?
OK, figured this out and while the instructions are all over the board, the process is not.
This is for C#.
You need an account at Google that enables Google.Cloud.Translation.V2.
Once enabled, you'll need a json credentials file. Download it and save it.
The instructions show how to use the Package Manager Console to allow these to work.
In your translate class, add these:
using Google.Cloud.Translation.V2; //PM> Install-Package Google.Cloud.Translation.V2 -Version 2.0.0
using Google.Apis.Auth.OAuth2; //PM> Install-Package Google.Apis.Oauth2.v2 -Version 1.50.0.1869
Then this (the encoding can be whatever you need):
//usage:
var translated = TranslateText("en", "ar", "Happy Translating");
public string TranslateText(string srclang, string destlang, string trns)
{
var utf8 = new UTF8Encoding(false);
var client = TranslationClient.Create(GoogleCredential.FromFile(path to json credentials file));
var result = client.TranslateText(
text: trns,
targetLanguage: destlang, // ar
sourceLanguage: srclang, // en
model: TranslationModel.Base);
// or model: TranslationModel.NeuralMachineTranslation);
return utf8.GetString(utf8.GetBytes(result.TranslatedText));
}
Result: سعيد الترجمة

ag-grid-community vs ag-grid-enterprise new Grid

I have a Node client-side application with the latest ag-grid version.
I was using ag-grid-community without any issues with this require line
const {Grid} = require('ag-grid-community');
and this new
new Grid(agGridDiv, agGridOptions);
but if I change the require to
const {Grid} = require('ag-grid-enterprise');
the new fails with exception 'Grid is not a constructor'
How can I fix this? I have tried various changes such as new Grid.Grid etc but nothing seems to work.
For latest 23.1.1 version this page:
// ECMA 5 - using nodes require() method
const AgGrid = require('ag-grid-enterprise');
Another way to follow this guide, it all depends on which repository you download the dependencies from.
import {Grid, GridOptions} from '#ag-grid-community/core';
import {LicenseManager} from '#ag-grid-enterprise/core';
// or
const {Grid, GridOptions} = require('#ag-grid-community/core');
I used core and it worked for import.
For old version:
Grid, like everything else, needs to be imported from ag-grid-community.
1) ag-grid-enterprise is pure additive functionality for ag-grid-community.
2) You will use ag-grid-enterprise via the ag-grid-community api not explicit. Use ag-grid-enterprise for LicenseManager only.
Off-topic:
I would recommend starting with the old version, since the source code of the new version is minified and it will be more difficult for you to understand many nontrivial nuances.

Hide status bar in UWP

I have used below code to hide status bar in UWP. When I run the app in development mode in my computer the status bar is not shown in windows phone. I deployed the app in Windows Store, after downloading the app, I see the status bar appears in my app.
Here is my code:
var isAvailable = Windows.Foundation.Metadata.ApiInformation.IsTypePresent(typeof(StatusBar).ToString());
if (isAvailable)
hideBar();
async void hideBar()
{
StatusBar bar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
await bar.HideAsync();
}
The question is, why the above code shouldn't work in windows store?
Also, I have the link to my app App link in windows store, but when i search for exact key word in windows store, my application is not shown in windows store, but clicking in link would appear my app in window store.
Thanks!
Checking for the Contract, rather for the type StatusBar works fine for me.
private async Task InitializeUi()
{
// If we have a phone contract, hide the status bar
if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
{
var statusBar = StatusBar.GetForCurrentView();
await statusBar.HideAsync();
}
}
You have to use FullName instead of ToString():
...
ApiInformation.IsTypePresent(typeof(StatusBar).FullName);
...
This code won't work because after .Net Native compilation (which Store does) typeof(StatusBar).ToString() will not return the literal type name as you expect, but will return something like "EETypeRVA:0x00021968". Use literal string instead (you aren't going to rename StatusBar, right? ;) or use IsApiContractPresent or typeof(StatusBar).FullName (as was already advised).
P.S. The same issue can be reproduced without publishing, just run it using Release configuration.
Could it be that when you compile in Release and with the .NET Native toolchain, the type info gets discarded and so you're not passing the string you think you're passing? Maybe you can try hard-coding the full type name?
In Windows 10 the command is
Window.Current.SetTitleBar(null);

Resources