Murphy
Murphy
CC#
Created by Zil on 7/5/2023 in #help
Looping a query bad practice? Good alternative?
you could iterate through your list and building a single query up from that and then running that one query. like instead of running multiple queries of
select * from table where id = 1
select * from table where id = 1
and
select * from table where id = 2
select * from table where id = 2
... you could use a build up a query like
select * from table where id in (1,2,...)
select * from table where id in (1,2,...)
and run that.
4 replies
CC#
Created by Zil on 7/5/2023 in #help
Looping a query bad practice? Good alternative?
Doing a bunch of small queries can be slower than doing a single query where you could extract your needed data from one result. With small, simple queries, the overhead is generally from sending the query to the server and receiving the result rather than the actual processing of the query so it's usually better to combine what you can and send only one query and receive only one result. It's hard to say without more info because it really depends on the query and your design goals.
4 replies
CC#
Created by Murphy on 7/1/2023 in #help
❔ NuGet dependency Hell
but you can absolutely use ef core 3.1 with .net framework - it's supported
15 replies
CC#
Created by Murphy on 7/1/2023 in #help
❔ NuGet dependency Hell
lol yea this solutions a total mess. legacy app mishmash with a bunch of precariously configured dependencies it's awful. I touch one thing it all comes down.
15 replies
CC#
Created by Murphy on 7/1/2023 in #help
❔ NuGet dependency Hell
no, .net 4.7.2, I added <dependentAssembly> <assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" /> <bindingRedirect oldVersion="3.1.0.0" newVersion="3.1.32.0" /> </dependentAssembly> to my app.config and It looked like it it's working now. I've just got a bunch of other similar loading errors I'm slogging through now. there's a bunch of ef dependencies that are like 5.0.0.0 & 7.0.0.0 after I updated from ef 3.1.30 to 3.1.32.
15 replies
CC#
Created by PetitKinder on 6/29/2023 in #help
❔ combobox with radioButtons
Not easily, without redrawing. This might help- https://www.codeproject.com/Articles/21085/CheckBox-ComboBox-Extending-the-ComboBox-Class-and and instead of using check box controls, use just radio button controls. Since they're in the same container, they should still work as expected.
8 replies
CC#
Created by Shiv on 6/29/2023 in #help
❔ What makes Blazor a SPA?
Yup.
27 replies
CC#
Created by Shiv on 6/29/2023 in #help
❔ What makes Blazor a SPA?
As long as you NavigateTo() routable components (components with @page "asdf") then the client-side router will keep you on the same 'page' without reloading.
27 replies
CC#
Created by Shiv on 6/29/2023 in #help
❔ What makes Blazor a SPA?
You don't have to use Blazor as an SPA. In fact, if you try to deal with more specialized authentication and extend the built-in Identity and try to use Blazor for your authentication-related pages, it's not really possible to keep everything in a single Blazor page. When a page with Blazor first loads, it'll do a regular web request and sets up the circuit to the server. That's the only 'actual' web request that happens, which is what makes it an SPA. So some of the function provided by the Identity managers won't work exactly as expected (ie SignInAsyc won't work) until you navigate while setting forceLoad to bypass client-side routing to set up a new circuit.
27 replies
CC#
Created by deem on 6/28/2023 in #help
✅ What is the best way to fix StackOverflow when methods are calling each other?
Now that I think about it, you're still going to run into issues since you're still going to be checking so deep into possible moves when you don't have to. When you're eliminating from your set of possible moves that will place a player into check, when you check the opponent's pieces' possible moves to see if they hit the player's king, skip the RemovesCheck() for those moves. It's irrelevant because you don't care if the opponents can actually perform the capture, only that they are threatening the king. It will cause a bunch of branching by essentially walking over every single possible move that could happen for the rest of the game after that one move. You'll very likely still run into stack overflows since the number of possible moves in a game is just so dang big.
20 replies
CC#
Created by deem on 6/28/2023 in #help
✅ What is the best way to fix StackOverflow when methods are calling each other?
When you clone the board in RemovesCheck(), you need to remember where the piece was originally before the move and exclude the move that would bring it back to the same place it was the next time you call AllPossiblitiesOfPlayer() inside the Check() method. That's where I'd start
20 replies
CC#
Created by deem on 6/28/2023 in #help
✅ What is the best way to fix StackOverflow when methods are calling each other?
It's more of an error in the logic of the algorithm and how youre checking for invalid moves rather than the code itself. You're not 'pruning your game tree' correctly. If you try to run through all possible moves, and only RemoveAt() the moves that fail the RemovesCheck() check, you'll run into an infinite loop. It's just harder to see since the 'loop' is split up with function calls. Consider a board with two kings and a white rook; call it state1. Lets say you try to run through all possible moves of the rook- the first move you validate with RemovesCheck() will attempt to make a new board, call it state2, and Move() the rook and then look for checks with Check() on that new board state. Well, now the Check() method will have to find all possibilities and one of those is going to be the same state you started with - state1. You'll just go back and forth infinitely without a way to remove that already checked move from the move list.
20 replies
CC#
Created by deem on 6/28/2023 in #help
✅ What is the best way to fix StackOverflow when methods are calling each other?
Ah, ok. You effectively have an infinite loop since youre trying to find every possible move first before you determine if there are invalid moves. There needs to be a ground case where the cycle of calls stops, but if you enumerate every possible move first, you'll never hit it. Think of one piece just moving back and forth, there are an infinte number of possible moves. You need to stop checking for possible moves once you find an invalid move.
20 replies
CC#
Created by deem on 6/28/2023 in #help
✅ What is the best way to fix StackOverflow when methods are calling each other?
It's kind of hard to help optimize just seeing this bit but why do you have to call AllPossibilitiesOfPlayer in Check? That sems like there will be a lot of computation when you only need to confirm that the other player's king is threatened? Seems like you're going to be doing a lot more work than needed. It seems like your approach is to brute force all possibilities and then see if one of those is invalid rather than just checking for invalid-ness in the first place.
20 replies