I hope somebody can help me here, because I am trying to solve this already for hours now :)
I have a Firestore-collection "hochzeiten" with a timestamp-field "datum_ablauf".
The LowCode-plattform Flutterflow offers the possibility to use "Custom Functions" - and with this I want to get the value of the field "datum_ablauf" when handing over the DocumentReference to the function. So the template of the function (the part I can't really change) looks like this:
import 'dart:math' as math;
DateTime dateAblaufFromWeddingGEHTNED(DocumentReference currWedding) {
Well - I tried a lot and nothing worked, but here is my latest try:
currWedding.get().then((snapshot) {
DateTime datum = DateTime.parse(snapshot['datum_ablauf'].toDate().toString());
return datum;
});
Sadly I always get NUl, whatever I try.
Has somebody a hint for me?
Thanks!
Related
I tried mocking NavigationParameters and it is setting GetNavigationMode() as NULL. Is there any better way to mock an extension method?
Didn't work out for me. But your reference helped me to find a solution, that compiled (maybe it is a version issue, I use Prism 7.1:
var navParams = (INavigationParametersInternal)new NavigationParameters();
navParams.Add("__NavigationMode", NavigationMode.New);
This was bugging me for a while as well, and I finally found something that is at least a workaround. This issue shows that you can actually add internal parameters to the NavigationParameters, it just doesn't show up in intellisense. My test code ended up looking something like:
var navParams = new NavigationParameters();
navParams.AddInternalParameter("__NavigationMode", NavigationMode.Back);
Hope this helps!
As noted by #thomas-kison, the AddInternalParameter api no longer seems to exist. A search through the Prism repo only brings up the issue referenced by #batesiiic in their answer.
To add to #thomas-kison's answer by addressing #esteban-chornet's question, what I've found is that this solution will work by passing in the INavigationParametersInternal argument as INavigationParameters:
// arrange:
var navParams = (INavigationParametersInternal)new NavigationParameters();
navParams.Add("__NavigationMode", NavigationMode.Back);
// act:
_myCoolPageViewModel.OnNavigatedTo(navParams as INavigationParameters);
// assert whatever should happen in OnNavigatedTo given a NavigationMode of NavigationMode.Back
Hope this helps someone out!
I'm currently developping a multi languages application using the tap-i18n package. I wonder how I can translate errors.
I can grab the code and then display a custom message that I would have written to the translation file before.
But I saw on this post there is a better way of doing this with another i18n package.
Does anyone know if there is way of doing something like with tap-i18n ?
EDIT : For now I'm doing something like this :
Meteor.call('createNewUser', newUser, function (error, ret)
{
if (!error)
displayError(TAPi18n.__('success'), TAPi18n.__('new_user_success'), TAPi18n.__('ok'), "btn-success btn-lg", "success-popup");
else
{
switch (error.error)
{
case 403:
displayError(TAPi18n.__('danger'), TAPi18n.__('new_user_already_exist'), TAPi18n.__('ok'), "btn-danger btn-lg", "danger-popup");
break;
default:
displayError(TAPi18n.__('danger'), TAPi18n.__('new_user_error'), TAPi18n.__('ok'), "btn-danger btn-lg", "danger-popup");
break;
}
}
});
My answer might be a bit off-topic, but do you mean application errors? If so, you shouldn't really return that to the users, as this could constitute a security flaw, giving them too much information.
From OWASP: https://www.owasp.org/index.php/Error_Handling
Thus, you might want to handle the errors, and give the users exactly what you want them to know.
Just include the error messages in your translation, and proceed as with normal strings to translate.
I hope this is of some help :).
EDIT:
I understand now what you mean. As far as I know, there's no such option, as there is with just-i18n. As a suggestion for unbloating the code a bit, you could use a helper function such as:
function t(keyToTranslate){
return TAPi18n.__(keyToTranslate)
}
And in the code:
displayError(t('danger'), t('new_user_already_exist'), t('ok'), "btn-danger btn-lg", "danger-popup");
A bit naive suggestion, but there's no functionality to map the errors in this package, as far as I know. The way you're handling it seems correct to me.
I have started to use Stackmob as a backend for a simple app I am building.
In stackmob I have set a relationship between two schema's and want to use '.fetchExpanded' to grab all of the data from stackmob, see this fiddle (will need to view the console to see the output):
http://jsfiddle.net/mcneela86/65Rax/
.fetchExtended(1);
The same code works using the '.fetch' instead of '.fetchExpanded'.
Has anyone come across this before?
Would really appreciate any help.
Ok, I found a work around for this.
Instead of using '.fetchExtended(1);' I will just use '.fetch();' and when I am defining the model I will change the following:
var Bike = StackMob.Model.extend({
schemaName: "bikes"
});
to:
var Bike = StackMob.Model.extend({
schemaName: "bikes?_expand=1"
});
This seems to remove the need for '.fetchExtended(1);'
Hope this helps someone else.
as I probably do not describe the problem in the right terms, I was not able to get an answer with google. Please excuse!
In the following code, I would like to replace 'hardcoded' identifier COMMENT with the variable editedField. How to do that?
var editedField:String = event.dataField;
if (model.multipleProcessingData[i][editedInformationProductNO].COMMENT != null{
...
}
Make sure you wrap this in try/catch block for NPE's, as you'll eventually find one with this many [] accessors.
A better, more OOP, would be to have an accessor function on your model that you can pass your data to:
model.getEditedField(i, editedInformatioNProductNO, editedField)
This will make it easier to troubleshoot and add good error messages to your app if things don't turn out like you expected.
var editedField:String = event.dataField;
if (model.multipleProcessingData[i][editedInformationProductNO][editedField] != null{
...
}
I hope someone here can help me, i been trying to create an placeable actor that will be player controller, but when I try to add it via the "Actor Classes" windows, there is nothing there.
class BallBall extends KActorSpawnable
placeable;
defaultproperties
{
Begin Object Name=StaticMeshComponent0
StaticMesh=StaticMesh'EngineMeshes.Sphere'
bNotifyRigidBodyCollision=true
HiddenGame=TRUE
ScriptRigidBodyCollisionThreshold=0.001
LightingChannels=(Dynamic=TRUE)
DepthPriorityGroup=SDPG_Foreground
End Object
}
I'm really deseperate with this, any help really apreciated. Thanks in advance.
Solved my own question, looks like my class was correct, i was just searching int the wrong place, i though i would be located directly down Actor, but it was located under Actor, -> DynamicSMActor -> KActor -> KActorSpawnable -> BallBall