Get version number from play store xamarin android - web-scraping

i've tried all the solution with HtmlAgilityPack
newVersion = doc.DocumentNode.SelectNodes("//div[#itemprop='softwareVersion']")
.Select(p => p.InnerText)
.ToList()
.First()
.Trim();
also i've tried this dcsoup
var doc = client.GetAsync("https://play.google.com/store/apps/details?id=" + AppInfo.PackageName + "&hl=en_CA").Result.Parse();
var versionElement = doc.Select("div:containsOwn(Current Version)");
all the method return empty string
i noticed there is a changes of page play store and does not show the version number

Related

Firestore Pagination query on collection group data

Description: I want to implement infinite scroll in React-Native with firebase and i want to paginate on collection group data for instant result in my app. Error is shown in screenshot.
My code:
var ref = firestore().collectionGroup('user_posts').orderBy('time_stamp', 'desc').limit(5);
ref.get().then(snapshot => {
var posts = []
var lastVisible = snapshot.docs[snapshot.docs.length - 1];
this.setState({ last_Visible: lastVisible });
});
var next = firestore().collectionGroup('user_posts').orderBy('time_stamp', 'desc')
.startAfter(this.state.last_Visible)
.limit(5);
next.get()
.then(FirestoreDocumentSnapshot => {
var lastVisible = FirestoreDocumentSnapshot.docs[FirestoreDocumentSnapshot.docs.length - 1];
this.setState({ last_Visible: lastVisible });
})
Please help, what i am doing wrong?
From a first look at the error and your code it seems like either the fields that you are referring to are empty, or the lastVisible should be an even number.
Try checking that you don't have empty fields in your docs and try removing the -1 from lastVisible.
Here you can check the proper way to use startAfter() which is the cause of your issue.
As you're sorting by time_stamp, you should specify that field in the query like so:
.startAfter(this.state.last_Visible.data().time_stamp)
Here is an example from the official documentation. (From the language tabs choose Node.js)

React Native RSS Feed reader issue

I am using React Native and trying to read and then parse an RSS Feed. I am following this tutorial:
https://getsiphon.com/docs/build-a-youtube-browser/
I am using a bit of the code, but trying to use a different RSS Feed. For example:
https://fivejs.codeschool.com/feed.rss
Here is the specific code I am having trouble with:
getNews() {
var url = "https://fivejs.codeschool.com/feed.rss"
fetch(url)
.then((response) => response.text())
.then((responseText) => {
const doc = new DOMParser().parseFromString(responseText, "text/xml");
var items = doc.getElementsByTagName('item');
var objs = []
for (var i = 0; i < items.length; i++) {
objs.push({
title: items[i].childNodes[0]
})
}
console.log("yay! made it here")
console.log("objs length: ", objs.length)
console.log("objs: ", objs[0])
})
.catch((error) => {
console.log('Error fetching the feed: ', error);
});
}
Everything is fine up to the point where I am console logging out the objs array. In other words I see the yay! made it here message and I also see the objs.length message (25). Once it gets to the next part I do not see the first item in the array.
As a note, I am building my code and running it in a iOS simulator using Xcode. I am not sure if the debug output console has anything to do with it, but I can't imagine it would since it does output the other messages. I even tried to console.log the items[i].childNodes[0] in the for loop and didn't get any results.
Not sure is this would help you but following the same tutorial for my own project i had to check two main points to make everything work:
Check the labels on your XML, sometimes this will mess up your parsing.
Inside the loop you can select another property. For example, in my case trying to parse a blog rss, i got "Item" (like 12 items) and inside that i get "Title" so i did this:
var item = doc.getElementsByTagName('item');
for(i=0; i < item.length; i++){
var title = item[i].getElementsByTagName('title');
console.log(title[0].textContent);
}
With this you can create an element (maybe a dictionary?) and then push it inside your array.
I hope this helps you in some way.

AngularFire extending the service issue

I've been looking at the documentation for Synchronized Arrays https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-extending-the-services and https://www.firebase.com/docs/web/libraries/angular/guide/extending-services.html#section-firebasearray
I'm using Firebase version 2.2.7 and AngularFire version 1.1.2
Using the code below, I'm having trouble recognizing $$removed events.
.factory("ExtendedCourseList", ["$firebaseArray", function($firebaseArray) {
// create a new service based on $firebaseArray
var ExtendedCourseList= $firebaseArray.$extend({
$$added: function(dataSnapshot, prevChild){
var course = dataSnapshot.val();
var course_key = dataSnapshot.key();
console.log("new course");
return course;
},
$$removed: function(snap){
console.log("removed");
return true;
}
});
return function(listRef) {
return new ExtendedCourseList(listRef);
}
}])
.factory("CompanyRefObj", function(CompanyRef) {
//CompanyRef is a constant containing the url string
var ref = new Firebase(CompanyRef);
return ref;
})
.factory('CourseList', function (localstorage,$rootScope,ExtendedCourseList,CompanyRefObj) {
var companyID = localstorage.get("company");
$rootScope.courseList = ExtendedCourseList(CompanyRefObj.child(companyID).child("courses"));
)
If I run this code, only the $$added events will be triggered. To simulate the remove events I use the web-interface at Firebase to display data, where I press the remove button and accept the data being deleted permanently.
Additionally, if I delete the $$removed function, the extended service still won't synchronize when a record is deleted.
If I modify my code to use the $firebaseArray instead of extending the service (as seen above) both add and remove events will be recognized.
.factory('CourseList', function (localstorage,$rootScope,$firebaseArray,CompanyRefObj) {
var companyID = localstorage.get("company");
$rootScope.courseList = $firebaseArray(CompanyRefObj.child(companyID).child("courses"));
)
Finally, are there any bad practices I've missed that can cause some of the extended functions to not work?
Solved
$$added: function(dataSnapshot, prevChild){
var course = dataSnapshot.val();
var course_key = dataSnapshot.key();
//Modified below
course.$id = course_key;
//End of modification
console.log("new course");
return course;
}
After posting about the issue at firebase/angularfire github I received an answer that solved my issue. When $$added got overridden by the code provided, the $firebaseArray also lost its internal record $id.
Adding this line of code: course.$id = course_key; before returning the course, made AngularFire recognize when the record was removed from the server.

Get middle name from Facebook API by the .NET Middleware

I try to get some basic data from Facebook API, by using the .NET Middleware (I'm using ASP.NET 5, but I think it's similar in older versions) for authentication by facebook.
I have no problems with first name, last name and so on, but I'm stuck to get the middle name, here is my code snippet:
app.UseFacebookAuthentication(options =>
{
options.AuthenticationType = "Facebook";
options.SignInAsAuthenticationType = CookieAuthenticationDefaults.AuthenticationType;
options.AppId = facebookAppId;
options.AppSecret = facebookAppSecret;
options.Scope.Add("user_birthday");
options.Scope.Add("email");
options.Notifications = new Microsoft.AspNet.Security.Facebook.FacebookAuthenticationNotifications()
{
OnAuthenticated = async (ctx) =>
{
var token = ctx.AccessToken;
var firstName = ctx.User["first_name"];
var middleName = ctx.User["middle_name"];
var lastName = ctx.User["last_name"];
}
}
}
I tried to add "middle_name" to the scope, but it throw a error from FB:
Invalid Scope: middle_name
You should add middle name in scope. Like this.
options.Scope.Add("middle_name");
First name and last name might be the implicit values you are getting, for middle name you have to add it to scope to get the value.
And you should add this to scope to corresponding facebook App, that you have created ( I mean you are using corresponding app key/secret, that facebook App).

EF Code First: How to select data included changes before SaveChanges?

I can't explain the code. Look at different behavior:
var project = DB.Project.Find(1000111);
project.MustLinkToMF = false;
// Includes id = 1000111; MustLinkToMF = false; - From Cache?
var projects1 = DB.Project.Select(p => p).ToList();
// Doesn't contain 1000111! - Not From Cache?
var projects2 = DB.Project.Where(p => p.MustLinkToMF == false).Select(p => p).ToList();
DB.SaveChanges();
How to get cached data, included my changes?
How Can I get projects2 using one simple query before SaveChanges?
Thank you!
You can navigate through entities in the first level cache:
ctx.ChangeTracker.Entries().Where(x => x.State == EntityState.Modified).Select(x => x.Entity).OfType<T>()
Just replace EntityState.Modified for what you want.
See an example here: https://weblogs.asp.net/ricardoperes/entity-framework-code-first-get-entities-from-local-cache-or-the-database

Resources