Skip to content
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • Wow [[ trigger warning ]]

    The Lounge database com json code-review
    7
    0 Votes
    7 Posts
    0 Views
    S
    no any reason? diligent hands rule....
  • 0 Votes
    9 Posts
    35 Views
    J
    Richard is spot on with his reply. Mine was more theory. Take it as a compliment. Sometimes I just chat theory when I recognize the poster because I trust they take it and run with it. It's still the same principle, but just needs to be called from within the context of an Array.prototype.map callback. There are a couple ways to go about this. 1 You can still use an async IIFE anyway. IIFE is a functional/JavaScript concept that stands for Immediately-Invoked Function Expression and is pronounced iffy. It does exactly what it says and can be put anywhere. It's a quick and dirty way to call async code from a sync routine as well. 2 You can make the map callback itself async. However, this means you'd also have to deal with sync/async issue still.... just "one level" higher so to speak. Array.prototype.map iterates, much like IEnumerable in C#. In JavaScript, async/await is essentially syntax sugar for promises. Makes life easier and for cleaner code. But it also means you can interchange them and loop through your nested map like this: // this level needs a promise.all too results.map(async person => { // loop all films for each person await Promise.all(arr.map(async filmURL => { const filmName = await getFilmName(filmURL); })); }; Keep in mind though, this simply shifts the requirement for async up one nested level. The parent map would still have to be called within the context of a promise or async/await still. Same exact syntax. Keep in mind though, using Promise.all is old. It works, but no cool points for using it. As a side note, this is mainly for educational purposes. An API shouldn't be called in a loop. Redesigning the API, using GraphQL, streaming the data, etc. should all be considerations to rethink the approach of opening web requests in a loop. Buttttt.... if you need a loop-like concept, you'd be better off with generators. For example, if you used generators, you'd be able to pull off something like this. Just trying to whet your appetite. :) for await (const filmName of getFilmNames()) { // so fancy and clean } Anywho, the super short answer is just go with #2 and don't forget to use promise.all on the outer nest too. :laugh: Jeremy Falcon
  • Windows is now written in Rust

    The Lounge asp-net com graphics json performance
    14
    0 Votes
    14 Posts
    0 Views
    J
    GKP1992 wrote: Most companies add Most? Certainly none that I have worked at. No one even mentioned it at any of those companies. In comparison many companies ask about things like unit testing and many explicitly make it a feature when posting jobs. No one has ever mentioned it in an interview.
  • 0 Votes
    6 Posts
    18 Views
    R
    Ok, a few months late admittedly. I'm not a fan of all this functional style boostrapping in ASP.NET core. I find the whole thing obfuscated and difficult to work with and often grapple just to do something simple like config or logging. Anyway, I have this in my code: services.AddHttpClient((serviceProvider, httpClient) => { var opts = serviceProvider.GetRequiredService>(); httpClient.BaseAddress = opts.Value.BaseUrl; }) So, if you just want to get access to config, I think you can just retrieve it from the service provider given as the second parameter to the lambda, no BuildServiceProvider() required. Regards, Rob Philpott.
  • 0 Votes
    5 Posts
    1 Views
    S
    Its gross to me. Feels like we're trying to turn C# into Perl. Hogan
  • 0 Votes
    4 Posts
    18 Views
    Richard DeemingR
    You need to look at the code that's running on your server. As far as I'm aware, there's no magic tool that would convert a URL like "/items/1" into a request to load a JSON file called "items", get the "items" property from the root object, find the entry with id === 1, and return just that object. You must have code running which does that, which you (or someone else) has written. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • 0 Votes
    2 Posts
    0 Views
    N
    Coming News: Usage of Reddit API dropped 70% in some weeks M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
  • 0 Votes
    6 Posts
    21 Views
    R
    Brian Knittel wrote: stumbles In the event that you are a spammer (not BK of course) or are experienced in successfully loading hidden links and payloads (again, not BK), please ignore this action verb reference and move :cool:n.
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • Google, google ... :sigh:

    The Lounge python com json lounge
    6
    0 Votes
    6 Posts
    0 Views
    J
    ok yeah that is true.
  • 0 Votes
    1 Posts
    7 Views
    No one has replied
  • RestSharp Returning HTML

    The Lounge json csharp html visual-studio security
    5
    0 Votes
    5 Posts
    0 Views
    J
    Gary Whitcher 2023 wrote: The same exact code that run perfectly well on my PC, returns HTML on another PC Just noting that the tag in the header does nothing to guarantee the response body. You didn't say anything about what the content is so can only guess. One possible explanation that I have seen multiple times is that an error occurred. So it returns an error message - as html. Another possibility is you are not running the code you think you are on the other PC. If it fact the html looks right (not an error but has json type attributes somehow) then you can modify the code to return something in addition and then see if that shows up when you install on the other PC. If not you know your install is not working.
  • 0 Votes
    2 Posts
    0 Views
    N
    The Verge wrote: With Chrome 113 web apps may get more access to your graphics card Kind of mandatory[^] Maybe if they left the internet alone, the continous need of everytime more hardware would be a bit smaller? Second thought... so now they will get more data in the same amount of time? Can one read what is in the graphic card without being the app producing that data? EDIT: Yeah I know that's what every "screen recorder" does, but I didn't mean in that way, but in an "interpreted" way M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
  • 0 Votes
    2 Posts
    8 Views
    J
    That question is way too broad. Can you use libraries - yes. Which one is best - that is why they hire architects to understand the domain, to design the enterprise, to determine needs, to research existing solutions and then to design features.
  • 0 Votes
    2 Posts
    0 Views
    N
    I think I need to see the meaing of "most trusted" in the vocabulary of the author M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
  • Network Subsystem is down in Xamarin

    The Lounge json mobile sysadmin debugging help
    4
    0 Votes
    4 Posts
    1 Views
    R
    Check the port number of the "Access Point" and see if it's different from "7254".
  • 0 Votes
    2 Posts
    0 Views
    N
    v1 - CodeProject[^] M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
  • 0 Votes
    2 Posts
    0 Views
    N
    Not to forget the common sense limitations of some people at high positions of MS :doh: M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
  • 0 Votes
    4 Posts
    4 Views
    Richard DeemingR
    You can't use the same collection navigation property to represent the requests where the user is the sender and the requests where the user is the target. You also can't use the RequestId property as the foreign key to the users table - you're not creating a one-to-one relationship, so the request ID and the user ID will be different. public class User { ... public List SentRequests { get; set; } public List ReceivedRequests { get; set; } ... } ... protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasOne(m => m.SenderUserRef) .WithMany(t => t.SentRequests) .OnDelete(DeleteBehavior.Restrict); modelBuilder.Entity() .HasOne(m => m.TargetUserRef) .WithMany(t => t.ReceivedRequests) .OnDelete(DeleteBehavior.Restrict); } "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer