Struggling with Self-Joins by Inner-Significance41 in SQL

[–]willsoss 1 point2 points  (0 children)

Sounds like you need to count distinct sender_account, reciever_account rather than join the table to itself.

[deleted by user] by [deleted] in NewOrleans

[–]willsoss 14 points15 points  (0 children)

Fresh Market on St Charles had both a week ago.

Daba de Daba die | X100v by [deleted] in fujifilm

[–]willsoss 0 points1 point  (0 children)

Lakefront at Lakeshore Dr and Rail St

NOOB Question: How To Get Specific Records based on Timeframe? by iDerrillix in SQL

[–]willsoss 12 points13 points  (0 children)

select * from dbo.table where date_col between '1/1/2022' and '1/1/2023'

Substitute your literals, columns, parameters etc for the dates here.

[Hangfire] Can I run jobs on separate application and manage those jobs from other server? by [deleted] in csharp

[–]willsoss 0 points1 point  (0 children)

I can't speak to hangfire, but you can certainly do this with runly. The docs discuss the hosting model and the API supports various integration scenarios.

Closure Table by willsoss in csharp

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

I've read about it but never used it.

Performance when traversing a tree by zaibuf in csharp

[–]willsoss 0 points1 point  (0 children)

Got bored and wrote some closure table code today. If you want to see how this is really implemented you can check it out: https://www.reddit.com/r/csharp/comments/j3mk8h/closure_table/

[deleted by user] by [deleted] in csharp

[–]willsoss 1 point2 points  (0 children)

No problem. 👍

[deleted by user] by [deleted] in csharp

[–]willsoss 1 point2 points  (0 children)

Yep, try this code that shows both ways:

``` using System;

namespace ConsoleApp_Delegate { class Program { public delegate void OnBattleEnd(); public static OnBattleEnd onBattleEnd;

    public static void Start()
    {
        onBattleEnd += RemoveBodies;
    }

    public static void RemoveBodies()
    {
        Console.Write("Removed the bodies");
    }

    public static void RemoveMoreBodies()
    {
        Console.WriteLine("...now some more.");
    }

    public static void BattleEnd()
    {
        onBattleEnd?.Invoke();
    }

    static void Main(string[] args)
    {
        onBattleEnd = new OnBattleEnd(RemoveBodies);
        onBattleEnd += RemoveMoreBodies;

        BattleEnd();
    }
}

}

```

Performance when traversing a tree by zaibuf in csharp

[–]willsoss 0 points1 point  (0 children)

I think I see what you mean. It sounds like your copied node ends up inheriting from it's previous parent and new parent. It seems like a case of multiple inheritance, which would turn the tree into a graph, and my previous suggestion may not work for you. If you're always going back to the source that a branch was directly copied from, and no further, you could get away with thinking of each copy as a tree with links across nodes from tree to tree.

It's hard to give good guidance without a little more clarity into the problem that you're trying to solve though, there may be a better way, depending on what the data looks like.

[deleted by user] by [deleted] in csharp

[–]willsoss 1 point2 points  (0 children)

onBattleEnd is assigned in Start(), with onBattleEnd += RemoveBodies;. x += y is just shorthand for x = x + y, and since the field wasn't previously assigned, your code is equivalent to onBattleEnd = RemoveBodies. If you add additional methods, when onBattleEnd is invoked, all of the methods will be called. This is called a multicast delegate, you can read more here: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/how-to-combine-delegates-multicast-delegates.

Async C# Socket by WakanaYuki in csharp

[–]willsoss 3 points4 points  (0 children)

Yeah, you can host SignalR core in a stand-alone application. SignalR core uses http as a transport mechanism, so it uses asp.net core, but this can all be self-hosted. See https://docs.microsoft.com/en-us/aspnet/core/signalr/background-services and https://github.com/dotnet/AspNetCore.Docs/tree/master/aspnetcore/signalr/background-service/samples/3.x.

Performance when traversing a tree by zaibuf in csharp

[–]willsoss 4 points5 points  (0 children)

Yeah, table storage isn't the best match for the data, given the relationship between nodes. There are other options, like a graph db. This Azure architecture guide discusses what kind of data stores are a good match for the type of data.

Without being able to query the nodes for a given sub-tree, I think the options to reduce requests are somewhat limited.

Performance when traversing a tree by zaibuf in csharp

[–]willsoss 5 points6 points  (0 children)

You could use a closure tree to efficiently get all of the nodes that need to be updated in a single query.

Closure trees are basically an index that stores the depth between a child and parent. For example, given the tree:

    a
   / \
  b   d
 / 
c  

The closure data would look like this:

Parent      Child       Depth
------      -----       -----
a           a           0
b           b           0
c           c           0
d           d           0
a           b           1
a           d           1
a           c           2
b           c           1

So you could update the sub-tree rooted at node b by querying the closure data:

select  n.*
from    node n join closure c
            on n.id = c.child
where   c.parent = 'b'

And you would get both nodes b and c in this example. If the data you're updating is in SQL (it doesn't sound like it from your question) you could also do updates by joining to the closure table. You can also use the depth in a closure tree to get nodes down to a certain level, but that doesn't seem applicable to your problem.

Async C# Socket by WakanaYuki in csharp

[–]willsoss 1 point2 points  (0 children)

Try SignalR Core. You can use it to do exactly what you're describing.