ZXing crash in MaterDetailPage - xamarin.forms

I have a Xamarin Forms project with a lateral menu using the MasterDetailPage. In iOS all works OK, but in Android the app crash when I push the ZXingScanner. However, when I use it from a 'Main Page' works ok too.
ZXingScannerPage pagina = new ZXingScannerPage();
pagina.OnScanResult += (result) =>
{
try {
pagina.IsScanning = false;
Device.BeginInvokeOnMainThread(async() =>
{
var code = result.Text;
await App.Current.MainPage.Navigation.PopModalAsync();
await App.Current.MainPage.DisplayAlert("Scanned", code, "OK);
});
} catch (Exception ex) {
Debug.WriteLine("Error " + ex.Message);
}
};
await App.Current.MainPage.Navigation.PushAsync(pagina);
Is there any way to fix this?

The same issue happened to me. Please check this
link. Make sure that there are no unwanted NuGet packages installed in your solution. Also make sure that you are using the stable version of packages. If the issue is persisting even after this, I suggest you to create the same project from the scratch. It solved my issue.

Related

How to get prompts from Question Answering .NET

i'm struggling with Language studio question answering, as QnA maker it will be deprecated i decided to move to language studio, now i get answer from my KB but im not able to get all propts like QnA maker do: with QnA make this code snippets works fine but for Qustion answering not.
foreach (QnaMakerPrompt qnaMakerPrompt in queryResult.Context.Prompts)
{
message = $"{qnaMakerPrompt.DisplayOrder} - {qnaMakerPrompt.DisplayText}";
card.Actions.Add(new AdaptiveSubmitAction()
{
Title = message,
Data = qnaMakerPrompt.DisplayText,
});
}
I found this class that I think is right for me but it doesnt work
https://learn.microsoft.com/en-us/dotnet/api/azure.ai.language.questionanswering.knowledgebaseanswerprompt?view=azure-dotnet#applies-to
this is what i've done i get response from my KB but not showing all the promps
Uri endpoint = new Uri("URL");
AzureKeyCredential credential = new AzureKeyCredential("KEY");
QuestionAnsweringClient client = new QuestionAnsweringClient(endpoint, credential);
string projectName = "STRING";
string deploymentName = "test";
QuestionAnsweringProject project = new QuestionAnsweringProject(projectName, deploymentName);
Response<AnswersResult> response = await client.GetAnswersAsync("String", project);
foreach (KnowledgeBaseAnswer answer in response.Value.Answers)
{
await turnContext.SendActivityAsync(MessageFactory.Text(answer.Answer.ToString(), answer.Answer.ToString()), cancellationToken);
}
Hope someone can help me, thank you a lot

Firebase ShortDynamicLink not completing task

Following is how I'm creating dynamic link
//Buiid dynamic link
DynamicLink dynamicLink = FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse("https://www.chefcookrecipe.com/"))
.setDynamicLinkDomain("chefcookrecipe.page.link")
// Open links with this app on Android
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder().build())
.buildDynamicLink();
String dynamicLongUri = dynamicLink.getUri().toString();
Toast.makeText(Edit_Recipes.this, dynamicLongUri, Toast.LENGTH_SHORT).show();
The same url:"https://www.chefcookrecipe.com/" is what I set as Deep link URL in firebase, and https://chefcook.page.link is my domain in firebase.
I'm getting the long link correctly. However, when I tried to generate short link with the following code
shortLinkTask.addOnCompleteListener(this, new OnCompleteListener<ShortDynamicLink>() {
#Override
public void onComplete(#NonNull Task<ShortDynamicLink> task) {
if (task.isSuccessful()) {
// Short link created
shortLink = task.getResult().getShortLink().toString();
Uri flowchartLink = task.getResult().getPreviewLink();
Toast.makeText(Edit_Recipes.this, shortLink, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(Edit_Recipes.this, "null", Toast.LENGTH_SHORT).show();
}
}
});
I always get null. Please help I don't know what I'm missing.
I ran into same error couple of months ago. I spent all day finding what was wrong.
As long as it is reaching the conditional (if-else) statement, Your code is completely correct and nothing wrong at all.
Solution
It is usually a typographical error.
Calm yourself.
Make sure that both Deep link URL and Domain name are the same.(This is where the error usually lies). Do a copy and paste instead of typing.
I saw this issue, Don't use emulator, use real device.

Flyway: Using both custom and Java Callbacks

If I specify
flyway.callbacks=com.myclass.CustomCallBack
it gets called fine, but I notice it seems to suppress the SQL callback functionality. Is there any way to have both? I notice there's a SqlScriptFlywayCallback, but that's one of your 'internal' classes....
Currently the only way is to refer both to the internal class and your own. Please file an enhancement request in the issue tracker.
As a simple workaround, you can initialize the SqlScriptFlywayCallback as Axel suggested. Here's how I did it, given an initialized instance of flyway:
DbSupport dbSupport;
try {
dbSupport = DbSupportFactory.createDbSupport(flyway.getDataSource().getConnection(), false);
} catch (SQLException e) {
throw new RuntimeException("Could not get connection to database");
}
final FlywayCallback runSqlCallbacks = new SqlScriptFlywayCallback(
dbSupport,
flyway.getClassLoader(),
new Locations(flyway.getLocations()),
new PlaceholderReplacer(flyway.getPlaceholders(),
flyway.getPlaceholderPrefix(),
flyway.getPlaceholderSuffix()),
flyway.getEncoding(),
flyway.getSqlMigrationSuffix()
);
flyway.setCallbacks(
runSqlCallbacks,
new MyCallback(...));

Unable to dowload file using generic handler

I am using a generic handler to download csv/excel files. It was working fine until yesterday. Today suddenly it stopped working on deployment on IIS 7.5 (though he same code works well in visual studio debugging mode). Here is my code:
ASPX: This is a content page
<input type="button" class="btn-primary" id="btnDownload" title="Download" value="Download" onclick='return downloadReport(this);' data-toggle="modal" data-target="#myModal" navurl='<%: ResolveUrl("~/Handlers/DownloadData.ashx") %>' />
JS:
function downloadReport(btn) {
//I am using a kendoUI combo box and kendo js + also using bootstrap for design & modal popups & also i have applied bundling to kendo & bootstrap files. They seem to be working fine without any conflicts as all their api's are working.
var $mod = $("#masterModal");
$mod.modal('show');
//window.location = "Handlers/DownloadData.ashx?rtp=" + combobox.val();
window.location.href = $(btn).attr("navurl") + "?rtp=" + combobox.val();
setTimeout(function () {
$mod.modal("hide");
}, 2000);
return false;
}
Master Page:
I am including the js file containing the above method just before end of body tag.
<script src='<%: ResolveUrl("~/Scripts/DataUploader.js") %>'></script>
</body>
</html>
Handler: In handler Process Request Method
HttpResponse response = this._context.Response;
HRReportData hrData = new HRReportData(ConfigMaster.DbProvider, ConfigMaster.ConnectionString, ConfigMaster.DBSchemaName);
ReportDataManager rdm = null;
ExcelPackage xlPackage = null;
try
{
rdm = new ReportDataManager();
DataSet ds = rdm.GetReportData(hrData, report_Type);
if (ds != null && ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
xlPackage = new ExcelPackage();
ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets.Add(report_Type.ToString());
worksheet.Cells["A1"].LoadFromDataTable(ds.Tables[0], true, TableStyles.Light1);
response.ClearHeaders();
response.ClearContent();
response.Clear();
response.ContentType = "application/octet-stream";
response.AppendHeader("content-disposition", "attachment; filename=" + report_Type.ToString() + ".xlsx");
xlPackage.SaveAs(response.OutputStream);
response.Flush();
//response.Close();
//response.End();
}
}
}
catch (Exception ex)
{
//LogError.MethodLevelError(Convert.ToString(Session["Username"]), ex);
if (!(ex is System.Threading.ThreadAbortException))
{
//Other error handling code here
}
}
finally
{
if (xlPackage != null)
{
xlPackage.Dispose();
xlPackage.Dispose();
}
}
Bundle config:
bundles.Add(new ScriptBundle("~/Kendo/kendo").Include(
"~/Scripts/jquery-1.11.3.min.js",
"~/Kendo/js/kendo.all.min.js"
// "~/Scripts/DataUploader.js"
));
bundles.Add(new ScriptBundle("~/bootstrap/bootstrap").Include(
"~/bootstrap/js/holder.js",
"~/bootstrap/js/ie10-viewport-bug-workaround.js",
"~/bootstrap/js/ie-emulation-modes-warning.js",
"~/bootstrap/js/bootstrap.min.js"
));
All above code works well in debugging mode and was working well in deployment mode as well. Don't know what has changed that it suddenly stopped working and I am unable to find out any reasons :(
Behaviour on deployment: Instead of staying on same page and downloading file it navigates to Handler and a blank screen is displayed. No file is downloaded.
Behaviour in debuuging mode OR when run using vs2012 express: It stays on same page and downloads the file as expected.
Somebody please help me on this.
All the above code works 100% fine. There is absolutely no mistake in it. I found the reason that it was not working was that the web.config in the published folder was not updated/overwritten by someone and since the work is in beginning phase I have not yet added support for Exception handling/error logging hence the handler error (due to accessing keys used in config files) were not noted & in debug/dev environment the config file was correct hence the error never occurred.
Anyways the code can be useful to anyone who wish to download the files using generic handler. However kindly note that above code is in basic stage and needs to be updated for:
1) user request validation -parameter validation
2) user session validation
3) security implementations
4) exception handling
5) logging

Trying to create VB.Net Integration for EdgeJS

I have created this project, which is basically an attempted clone of this project but converted from C# to VB using SharpDevelop 4.4 and then built using VS 2015
My issue can be found on GitHub here, but here's the error I'm getting when I run my NodeJS project:
My bit of code in my NodeJS project that isn't working:
var WriteCrapVB = edge.func('vb', function () {
/*
Function(input)
Console.WriteLine("Hello from .NET")
Return Nothing
End Function
*/
});
var hello = WriteCrapVB(null);
hello(null); // prints out "Hello from .NET"
When running this C# it does work:
var WriteCrapCS = edge.func('cs', function () {
/*
async (input) =>
{
return (Func<object,Task<object>>)(async (i) => {
Console.WriteLine("Hello from .NET");
return null;
});
}
*/
});
var hello = WriteCrapCS(null, true);
hello(null, true); // prints out "Hello from .NET"
I have basically tried to use this guide to create this project.
I've tried various things to fix this bug, each as unhelpful as the previous one. I'm hoping someone with greater .NET knowledge than I can point out a glaringly obvious mistake!
Please help this poor soul from going bald from hair tearing!
facepalm
Root namespace must be blank.

Resources