authStateChanges with .map()? - firebase

Hi guys, I’m trying to understand how authStateChanges().map(——) works. Does authStateChanges return some value and send it to map? which then passes through the function of returning the Userid or Null.
sorry if this is a basic question, I just can’t quite seem to understand how map() works and what’s going on in this code.

Related

In R, how to do named entity recognition?

I have looked at this guide https://lincolnmullen.com/projects/dh-r2/nlp.html and this youtube video https://www.youtube.com/watch?v=0lpQludiI-0 which both use the same method. When I try and replicate the results from the biography example in the first link, all I get as the output of
entities(bio_doc, kind = "person")
is
character(0)
This was the same result when I used a different input string as well. I saw this thread Efficient Named Entity Recognition in R and they got the same result as well (character(0)). I see that it went unanswered, so I was wondering if perhaps someone now has an answer to it? Has this method just been deprecated? I would very much appreciate anyone's insight.

Firestore Document get request promise doesn't resolve. How do I solve this problem?

Summary
I am using react-native-firebase in my project, and I am running pure react-native (No Expo). However, on putting a get request to any document on Firestore never gives a response. That is, in a try-catch block, neither does it resolve, nor does it get rejected, it keeps on going forever and ever.
(And yeah, I know about promises and I am using await/async so its not about waiting for the promise to complete, in fact, the main thing is that promises are not getting resolved/rejected)
The main issue is that this problem comes randomly, its not like it fails every time, it does it randomly. On close observation, I also observed that this happens mostly when I am constantly doing get requests, for example, I have a query which checks for the latest version in a document, now whenever I reload the app, this get query is made, and on 2-3 frequent reloads, this query never resolves.
I can do all other Firebase stuffs, like checking authentication, setting documents data, deleting, modifying editing etc. But this doesn't work out
A Bit of Background Story
This is my first project in react-native and react-native-firebase. In the past, I have been working on Ionic, and native Android (Java). I never faced this issue there. I have been searching on the internet a lot, and a few solutions that I got were mainly for the Firebase Web SDK, and not for react-native-firebase.
I found one solution, about resetting user from the Authentication console, but that never worked either. I am putting forward the link which I found (for reference, as my problem is quite similar to this, and mainly differs in the fact that I use react-native-firebase, and not the Firebase Web SDK).
https://github.com/firebase/firebase-js-sdk/issues/533
Code Samples
Get Queries (Few Code Samples which I am using)
let updateData = await firebase.firestore().doc('Updates And Errors/Updates').get();
var expensesDoc = await firebase.firestore().doc(`NewExpenses/${dateToday}`).get()
Expected Output
All Get queries should function at all times.
Actual Output
Get Queries only work when they are not called frequently. (I know its quite weird)
Have you tried using regular promise (then/catch) syntax? I have personally noticed some promise inconsistencies while using the react-native-firebase library with redux-saga's call as well (it simply didn't work, just like you mentioned). To solve my issue, I simply wrapped all the requests in functions that return a new, actual promise, which somehow worked. Still a mystery why though.
Example:
function get (query) {
return new Promise((resolve, reject) => {
query.get()
.then(data => resolve(data))
.catch(err => reject(err))
})
}
// Later use:
await get(firebase.firestore().doc('yourDoc'))
If you ever find a proper solution, please let me know, as this code obviously smells.

How to catch PCL_ERROR from RANSAC?

I am trying to use SAC_SEGMENTATION from PCL right now. Sometimes I will get an error like this:
[pcl::SampleConsensusModelPlane::optimizeModelCoefficients] Not enough inliers found to support a model (0)! Returning the same coefficients.
How can I catch this error in my code? Unfortunately I could not find much on Google so I was hoping to see if anyone has tried something similar before.

Why is it watson "Try it out" chat mapping the answer to Irrelevant?

In my dialog flow I have an node triggered by an #app_question intent that answers with a question about a person's location - "Where's your location?", then, I've created a child node that is triggered by an entity #app_location inside of which I have #app_location:americas, #app_location:other.
Watson is answering correctly in the Try it out chat, when I say I'm in america, it outputs the correct answer, but "Irrelevant" appears in the node box. Should I worry about that, is that standard or I am doing something wrong?
ps: I was using Jump to, but received an error. If I'm supposed to use Jump To, I can copy and paste the error here.
Below are screenshots:
If anyone can help, thanks a lot!
Conversation will always try to determine what the intent is, even if you are not interested in it at that time. The try it out is just showing you what it tried to figure out what the intent was. Not that it would do anything with it.
As you are looking for an entity and not an intent it should be fine.

Getting document height with Dart?

I'll say upfront that I feel like a total newb asking this. I've scoured the Dart docs, and googled this as much as I can. No answers. Been writing in JS for a while. Trying to get a handle on Dart.
How do you get the height of the document?
window.document.height
and
document.height
work just fine in the Dartium console.
However, when used in my code, I get this thrown
NoSuchMethodException : method not found: 'get:height'
What am I doing wrong here? And if you please, why is it wrong? What am I misunderstanding about the structure?
Thanks
I'm still trying out dart, but you can use a future to get the computed height of the body:
document.body.rect.then((ElementRect value){
print(value.offset.height);
});
This should work.
The document doesn't contain any "height" in the publics neither in the Attributes map.

Resources