GithubHelp home page GithubHelp logo

brminnick / hackernews Goto Github PK

View Code? Open in Web Editor NEW
260.0 10.0 37.0 409 KB

A .NET MAUI app for displaying the top posts on Hacker News that demonstrates text sentiment analysis gathered using artificial intelligence

License: MIT License

C# 100.00%
hacker-news xamarin xamarin-forms xamarin-android xamarin-ios cognitive-services microsoft-cognitive-services sentiment-analysis google-natural-language-api iasyncenumerable

hackernews's Introduction

MAUI

HackerNews

A .NET MAUI app for displaying the top posts on Hacker News.

This app demonstrates how to use IAsyncEnumerable + C# 8.0 to improve performance. Thanks to IAsyncEnumerable, the items are added to the list as soon as they're available making the app feel faster and more responsive.

This app also uses the Text Analytics API from Microsoft Cognitive Services to analyze the sentiment of each headline.

  • ๐Ÿ˜ƒ Headline is Happy
  • โ˜น๏ธ Headline is Sad
  • ๐Ÿ˜ Headline is Neither Happy or Sad

Hacker News Demo

hackernews's People

Contributors

azureadvocatebit avatar brminnick avatar dependabot[bot] avatar manutdkid77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hackernews's Issues

Question regarding `ConfigureAwait(false)`

Hi,

I have been trying to figure out a question of mine regarding:

try
{
await foreach (var story in GetTopStories(StoriesConstants.NumberOfStories).ConfigureAwait(false))
{
StoryModel? updatedStory = null;
try
{
updatedStory = story with { TitleSentiment = await _textAnalysisService.GetSentiment(story.Title).ConfigureAwait(false) };
}
catch (Exception)
{
//Todo Add TextAnalysis API Key in TextAnalysisConstants.cs
updatedStory = story;
}
finally
{
if (updatedStory is not null && !TopStoryCollection.Any(x => x.Title.Equals(updatedStory.Title)))
InsertIntoSortedCollection(TopStoryCollection, (a, b) => b.Score.CompareTo(a.Score), updatedStory);
}
}
}
catch (Exception e)
{
OnPullToRefreshFailed(e.ToString());
}
finally
{
IsListRefreshing = false;
}
}

Basically, my question is: Is it OK to use ConfigureAwait(false) here:

await foreach (var story in GetTopStories(StoriesConstants.NumberOfStories).ConfigureAwait(false))

?

The reason I'm asking is that IsListRefreshing is not necessarily set on the UI thread:

IsListRefreshing = false;

And I wonder whether one can set view model properties (used in data bindings) on non-UI threads. Is it or is it not?

Best regards!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.