Tag: c#

  • GraphQL usage with REST Endpoints in .Net core 6.0

    GraphQL usage with REST Endpoints in .Net core 6.0

    0 Since I am new to GraphQL, I don’t really know how to call a REST Endpoint and query the fields accordingly. In particular, I want to fetch certain fields from the entire response of a GET API. What I have learnt is GraphQL sends a POST Request. How do I hit the GET endpoints…

  • Emulating signed integers using unsigned integers in C

    Emulating signed integers using unsigned integers in C

    11 In Jens Gustedt’s book Modern C, on page 59, he explains how signed integers can be emulated using unsigned integers. His example code shows how one can implement a comparison of two unsigned integers reinterpreted as signed integers: bool is_negative(unsigned a) { unsigned const int_max = UINT_MAX /2; return a > int_max; } bool…

  • GraphQL Hot Chocolate Stiching

    GraphQL Hot Chocolate Stiching

    0 I have 2 GraphQL servers + 1 that should stick them into one. I cannot get my head around the Stitching.graphql file and how it works. I tried the tutorials on the Hot Chocolate website and webinars but still no luck. Pokemon – is working on its own schema { query: PokemonQuery } type…

  • While debugging GraphQL.Client.SendQueryAsync line in the code, the program ends abruptly without any exception

    While debugging GraphQL.Client.SendQueryAsync line in the code, the program ends abruptly without any exception

    1 I am trying to consume a sample GraphQL api, just to learn it. For that I have created a .Net framework 4.8 based console application, its referencing GraphQL.Client, Abrstractions, Websocket, version 5.1.1.0, etc and Newtownsoft.Json version 13.0.0.0 When I try to debug it, the control disappears from the line graphQLClient.SendQueryAsync Please help me understand…

  • How can I multiply a INumber with an int?

    How can I multiply a INumber with an int?

    15 How should I implement the multiplication by int (z * 2) on the last line? public static TResult Test<TResult>() where TResult : INumber<TResult> { TResult x = TResult.AdditiveIdentity; TResult y = TResult.MultiplicativeIdentity; TResult z = x * y; TResult z2 = z * 2; // <— this gives the CS0019 error "The operator *…

  • What is _Nullable pointer in C?

    What is _Nullable pointer in C?

    6 What does _Nullable mean in following declaration? void foo(int *_Nullable ptr) gcc of version 11.4 doesn’t compile that code, because it treats _Nullable keyword as an argument name. Yet I see this keyword in man 7 pages: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html https://man7.org/linux/man-pages/man2/timer_gettime.2.html Godbolt c Share Improve this question Follow asked 11 hours ago Ержанов ЖалгасЕржанов Жалгас 6111…

  • How to multiply a INumber with an int?

    How to multiply a INumber with an int?

    7 How should I implement the multiplication by int (z * 2) on the last line. public static TResult Test<TResult>() where TResult : INumber<TResult> { TResult x = TResult.AdditiveIdentity; TResult y = TResult.MultiplicativeIdentity; TResult z = x * y; TResult z2 = z * 2; // <— this gives the CS0019 error "The operator *…

  • Dependent name in local class

    Dependent name in local class

    12 #include <type_traits> template<typename… Ts> void boo() { struct A { struct B {}; }; static_assert(std::is_class_v<A>); static_assert(std::is_class_v<A::B>); // compilation failure; need typename. } int main() { boo<int>(); } Why is A::B a dependent name and A is not? Can not see anything in standard about that. c++ language-lawyer Share Improve this question Follow edited 12…

  • subscription in Graphql shutting down

    subscription in Graphql shutting down

    1 I have a graphQL api I am trying to query . I added a server side function : public class Subscription1 { [SubscribeAndResolve] [Topic] [UseDbContext(typeof(ApplicationDbContext))] public IQueryable<Alert> OnAlertAdded([Service] ApplicationDbContext context, int clientId) { return context.AlertClients .Where(ac => ac.ClientId == clientId) .Select(ac => ac.Alert) .AsQueryable(); } } and I am using postman to get the…

  • std::enable_if_t works with gcc and clang but does not compile with msvc

    std::enable_if_t works with gcc and clang but does not compile with msvc

    8 I have a friend function template operator<< that works with both gcc and clang but not with msvc. #include <iostream> #include <type_traits> template< typename T, std::enable_if_t< T{1}, int> =0 > class Foo { template< typename Ar, typename R> friend Ar& operator<<(Ar& os, const Foo<R>& foo) { return os; } }; int main() { Foo<int>…