BlackNet
BlackNet
CC#
Created by BlackNet on 8/11/2023 in #help
❔ Problem updating ui component in razor page using blazor app
reverted to .net 7 and it works as it should
8 replies
CC#
Created by BlackNet on 8/11/2023 in #help
❔ Problem updating ui component in razor page using blazor app
it just doesn't work in .net 8
8 replies
CC#
Created by BlackNet on 8/11/2023 in #help
❔ Problem updating ui component in razor page using blazor app
figured out this stupid issue
8 replies
CC#
Created by BlackNet on 8/11/2023 in #help
❔ Problem updating ui component in razor page using blazor app
the timer gets disposed immediately after loading the page, doesn't even tick once
8 replies
CC#
Created by BlackNet on 8/11/2023 in #help
❔ Problem updating ui component in razor page using blazor app
private List<ProgressRecord>? ProgressRecords { get; set; }
private class ProgressRecord
{
public string Name;
public int Total;
public int Encoded;
}

PeriodicTimer periodicTimer = new(TimeSpan.FromSeconds(10));

protected override void OnInitialized()
{
UpdateProgress();
RunTimer(); // fire-and-forget
}

async void RunTimer()
{
while (await periodicTimer.WaitForNextTickAsync())
{
await InvokeAsync(() =>
{
UpdateProgress();
StateHasChanged();
});
}
}

public void Dispose()
{
MyLogger.LogError("Disposed");
periodicTimer?.Dispose();
}
private void UpdateProgress()
{
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("redis");
ProgressRecords = new List<ProgressRecord>();

IDatabase db = redis.GetDatabase();
var endpoints = redis.GetEndPoints();
var s = redis.GetServer(endpoints[0]);
var keys = s.Keys(pattern: "*").ToArray();

foreach (var key in keys)
{
MyLogger.LogInfo($"Data found! {key}");
var hashFields = db.HashGetAll(key);
var encoded = (int)hashFields[0].Value;
var total = (int)hashFields[1].Value;
ProgressRecords.Add(new ProgressRecord { Name = key, Total = total, Encoded = encoded });
}
}
private List<ProgressRecord>? ProgressRecords { get; set; }
private class ProgressRecord
{
public string Name;
public int Total;
public int Encoded;
}

PeriodicTimer periodicTimer = new(TimeSpan.FromSeconds(10));

protected override void OnInitialized()
{
UpdateProgress();
RunTimer(); // fire-and-forget
}

async void RunTimer()
{
while (await periodicTimer.WaitForNextTickAsync())
{
await InvokeAsync(() =>
{
UpdateProgress();
StateHasChanged();
});
}
}

public void Dispose()
{
MyLogger.LogError("Disposed");
periodicTimer?.Dispose();
}
private void UpdateProgress()
{
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("redis");
ProgressRecords = new List<ProgressRecord>();

IDatabase db = redis.GetDatabase();
var endpoints = redis.GetEndPoints();
var s = redis.GetServer(endpoints[0]);
var keys = s.Keys(pattern: "*").ToArray();

foreach (var key in keys)
{
MyLogger.LogInfo($"Data found! {key}");
var hashFields = db.HashGetAll(key);
var encoded = (int)hashFields[0].Value;
var total = (int)hashFields[1].Value;
ProgressRecords.Add(new ProgressRecord { Name = key, Total = total, Encoded = encoded });
}
}
8 replies
CC#
Created by BlackNet on 8/11/2023 in #help
❔ Problem updating ui component in razor page using blazor app
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Encoded (seconds)</th>
<th>Total (seconds)</th>
</tr>
</thead>
<tbody>
@foreach (var progress in ProgressRecords)
{
<tr>
<td>@progress.Name</td>
<td>@progress.Encoded</td>
<td>@progress.Total</td>
</tr>
}
</tbody>
</table>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Encoded (seconds)</th>
<th>Total (seconds)</th>
</tr>
</thead>
<tbody>
@foreach (var progress in ProgressRecords)
{
<tr>
<td>@progress.Name</td>
<td>@progress.Encoded</td>
<td>@progress.Total</td>
</tr>
}
</tbody>
</table>
8 replies
CC#
Created by shamb on 8/4/2023 in #help
✅ Sanity check: output issues that I do not understand.
what's your input?
10 replies
CC#
Created by shamb on 8/4/2023 in #help
✅ Sanity check: output issues that I do not understand.
when i run it it works as expected
10 replies
CC#
Created by shamb on 8/4/2023 in #help
✅ Sanity check: output issues that I do not understand.
@shamb and what's the issue again?
10 replies
CC#
Created by BlackNet on 7/25/2023 in #help
❔ HttpClient.PostAsync hangs and times out if firewall is turned on
i guess firewall doesn't like ipv6
5 replies
CC#
Created by BlackNet on 7/25/2023 in #help
❔ HttpClient.PostAsync hangs and times out if firewall is turned on
using DOTNET_SYSTEM_NET_DISABLEIPV6=1 enviroment variable fixed it
5 replies
CC#
Created by BlackNet on 7/25/2023 in #help
❔ HttpClient.PostAsync hangs and times out if firewall is turned on
alright, figured it out, httpclient is using ipv6
5 replies
CC#
Created by BlackNet on 7/24/2023 in #help
✅ Problems with deserializing json
but when compiled for linux it didn't
26 replies
CC#
Created by BlackNet on 7/24/2023 in #help
✅ Problems with deserializing json
what's wierd is that it worked locally
26 replies
CC#
Created by BlackNet on 7/24/2023 in #help
✅ Problems with deserializing json
when i compiled it not as an aot it works
26 replies
CC#
Created by BlackNet on 7/24/2023 in #help
✅ Problems with deserializing json
¯\_(ツ)_/¯
26 replies
CC#
Created by BlackNet on 7/24/2023 in #help
✅ Problems with deserializing json
ahead of time compilation xD
26 replies
CC#
Created by BlackNet on 7/24/2023 in #help
✅ Problems with deserializing json
i will have to use the System.Text.Json source generator
26 replies
CC#
Created by BlackNet on 7/24/2023 in #help
✅ Problems with deserializing json
it's an AOT console application
26 replies
CC#
Created by BlackNet on 7/24/2023 in #help
✅ Problems with deserializing json
oh fuck, i guess i found out the reason
26 replies