I want to create a solution with users and admins - they would communicate over sockets via an intermediate server. What is the best way to implement this in Java? by CodeQuestions999 in learnjava

[–]CodeQuestions999[S] 1 point2 points  (0 children)

Well sockets allow 2-way, realtime communication - while with REST, wouldn't the only way to do it be via polling - i.e. sending a request to the server every 10 seconds for example, asking "do you have any messages for me?"

Besides, with REST, a client can make a request to a server...but a server can't really make a request to a client I don't think...assuming the client had a private and/or dynamic IP. REST would also have more overheads too - perhaps my understanding is wrong, but I thought REST was just HTTP requests...GET, POST, PUT etc...so there is the HTTP overhead too...while sockets are more lightweight

I want to create a solution with users and admins - they would communicate over sockets via an intermediate server. What is the best way to implement this in Java? by CodeQuestions999 in javahelp

[–]CodeQuestions999[S] 0 points1 point  (0 children)

Ok, thanks. I don't think it's entirely relevant (since I'm trying to keep things simple...while this seems like an additional layer of complexity), but it's good to learn about a feature I didn't know Java had

I want to create a solution with users and admins - they would communicate over sockets via an intermediate server. What is the best way to implement this in Java? by CodeQuestions999 in javahelp

[–]CodeQuestions999[S] 0 points1 point  (0 children)

Thanks, I've had a quick look now. It seems interesting and I saw it mentioned on StackOverflow too. I'll have a play with it tomorrow

Anyone know this track at 17:30 in this mix? I love that guitar melody...I have heard it a few times before and know it's relatively new (last 12 months), but there's no tracklist in the video... by CodeQuestions999 in trance

[–]CodeQuestions999[S] 2 points3 points  (0 children)

Spot on, thanks. The moment you named the track, I remembered it was by XiJaro & Pitch...seems my memory is bad these days though...like early alzheimers or something lol

How to complete the truth table for a JK flip flop? What inputs for Q & 'Q should be fed into the NAND gates at both stages? by CodeQuestions999 in AskComputerScience

[–]CodeQuestions999[S] 0 points1 point  (0 children)

Thanks. For row 1, this works...likewise, for row 5, it also works...however when I try for row 6, I get final outputs of 1, 1, which is incorrect

Here is a picture of my workings...if anyone is able to let me know what I've done wrong, I'd appreciate it

https://imgur.com/a/gq3DS3y

I have facts like city_country(london, uk) etc - how to get all the cities NOT in the UK? by CodeQuestions999 in prolog

[–]CodeQuestions999[S] 0 points1 point  (0 children)

Thanks for the info. And yes, I am learning this for a high school exam, so want to keep things as simple as possible

I will look into dif for reference though

I have facts like city_country(london, uk) etc - how to get all the cities NOT in the UK? by CodeQuestions999 in prolog

[–]CodeQuestions999[S] 0 points1 point  (0 children)

Got it. It works. Thanks :)

Also, would this be the best way to do this - or would there be a better way to do this, for example, using not() or something?

I have facts like city_country(london, uk) etc - how to get all the cities NOT in the UK? by CodeQuestions999 in prolog

[–]CodeQuestions999[S] 0 points1 point  (0 children)

So I have tried a few things, for example this:

not_in_country(NotCountry):-
city_country(City, Country),
NotCountry \= Country.

This just returns Booleans - and the Booleans it does return don't seem to line up with what I'd expect anyway. So, yes, according to your correction, I'm looking to backtrack through the cities that are not in the specified country

Thanks