« first day (3860 days earlier)      last day (1071 days later) » 

mr5
5:17 AM
@Freerey what happened m8
 
Good morning
@Freerey Just leave all the other servers
 
 
6 hours later…
mr5
11:12 AM
can't find it on nuget though
 
11:53 AM
@mr5 I just hate being borderline
 
12:19 PM
Hello, is anyone about to help with a WPF question please, the WPF room seems a bit dead.
I have a List<object> Items that a ListBox is bound to on the view.
I perform a search in a thread and update the Items with the result.
At some point I want to add an item to the existing list from the UI thread.
The item is added, but the view does not update.
I have read about using different threads and the dispatcher, but is it really needed, surely the Items list that is within the same ViewModel im adding a new one from doesnt need anything extra.
 
@matty357 in this specific case, is not about the UI thread. It's about the List<object> is not sufficient for notify the UI in case of add/remove. You should have ObservableCollection<object>.
if the thread is the problem, it will throw you an error about that
 
so in this case, is it not good enough to call;
OnPropertyChanged(nameof(Items));
After the change?
There isnt an option to Add to an ObservableCollection is there
 
I think it should be tho
how the bind look like? Is it TwoWay? And source trigger Notify?
 
TwoWay and PropertyChanged
Ive fixed it. I changed List<Items> to ObservableCollection as ntohl suggested. But earlier when I tried it, it said that .Add was not a method of ObservableCollection
Sorry, must have been staring at it too long
 
12:40 PM
you are right in that, ObservableCollection doesn't have AddRange
also I think without ObservableCollection, you would need replacing the whole List reference every time with the conjuction of OnPropertyChanged(nameof(Items)); would update the UI.
 
12:54 PM
AddRange is a function for List specific... while it should be in ICollection
List has a few more methods that they just refuse to put in higher level interfaces
or in interfaces at all...
 
Thanks very much, I must have been putting AddRange without realising because my head is tired ha.
 
1:22 PM
Ben Popper on May 11, 2021
There are requirements that make software engineers sweat. Massive distribution to thousands of nodes. High reliability and availability. Multiple distinct platforms. Rapid network growth. his is the world SpaceX’s Starlink program, which has set a goal to provide high-speed broadband internet to locations where access has been unreliable, expensive, or completely unavailable.
 
[Captain Obvious] Something looks.... different... about the question and answer pages
[Captain Obvious] Have they changed the font or something
 
mr5
check zoom level
 
[Captain Obvious] Zoom is fine
[Captain Obvious] Yeah apparently it's using Segoe UI
[Captain Obvious] I don't think it was befoire
 
1:37 PM
here is a little puzzle for y'all
I have a service (which we can identify by 'Identifier') which is registered in the service collection as Scoped
I also have a factory (which (partially) acts as a proxy to the service provider) which is registered in the service collection as Singleton
now... the factory does not understand that the services it needs to "make" are supposed to come from the scope and not from the main provider
how would I solve this?
first test succeeds
second test succeeds, but shows the problem
third test fails, the scoped service is always the same
 
mr5
2:31 PM
not really sure how scope service behaves. Haven't use it before.
that is a very confusing test case. can't wrap my head around that:
- service provider's scope is within the function bracket
- scope services is within the using's bracket
- singleton's scope is within service provider's lifetime
do you have a more confusing test case other than that
 
[kukkudu] hi
[kukkudu] i need
[kukkudu] I need a c# code help
 
@mr5 what is confusing about it?
that is how service providers work
 
[kukkudu] In my code show a null-reference exception error
 
mr5
@Wietlol it is confusing to me.
as I said, I can't wrap my head around with multiple scopes in your test case. it's not you, it's not your code, it's me.
 
ofc it is not me, how dare you assume I think such a stupid thing <Kappa>
 
mr5
2:43 PM
@kukkudu what does the error message says?
 
\[**[kukkudu](https://discord.gg/PNMq3pBSUe)**] private int counter = 0;
private void timer1_Tick(object sender, EventArgs e)
{
counter++;

int index = counter % files.Count(); // to avoid outOfIndex errors



m_objEditor.CGObject.AddNewItem(files[0].FullName, adimgseqposX, adimgseqposY, 0, 1, ref cgItemID);

string propertyName = "img::path";

string propertyValue = files[index].FullName;

int timeForChange = 1000;

string changeType = "";

m_objEditor.CGObject.SetItemProperties(cgItemID, propertyName, propertyValue, changeType, timeForChange);
 
mr5
oh God
behold the Kraken
 
"Object reference not set to an instance of an object"
@mr5 ^ is my bet
 
mr5
I'm expecting him to post the stack trace with the loc pointing out where it throws
string propertyValue = files[index - 1].FullName;
try that
 
[kukkudu] int index = counter % files.Count(); // to avoid outOfIndex errors
 
mr5
2:45 PM
oh
right
then prolly it's the files[0] that is null?
 
[kukkudu] Same error
[mr5] ohh
[mr5] do you know where the "Output" window is from the Visual Studio?
[kukkudu] Sorry😫😥
 
files is null
 
[kukkudu] I got output window
[mr5] oh right
[mr5] I forgot .Count() is an extension
[mr5] yeah prolly files is null at this point.
[mr5] for the output window, you can press the "Continue" button in VS again and again until VS gives up, and it will stop the debugging process. You can look at the output window and it will point you to the line of code where the error happens.
 
mr5
is it okay to fry a wet hotdog - straight out of ref
 
3:01 PM
\[**[kukkudu](https://discord.gg/PNMq3pBSUe)**] Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at CGEditor_WinForms.MainWindow.timer1_Tick(Object sender, EventArgs e) in E:\img slide project\Project4 with item button and code\CGEditor_WinForms\MainWindow.cs:line 1187
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntP
\[**[kukkudu](https://discord.gg/PNMq3pBSUe)**] private void button1_Click(object sender, EventArgs e)
{
string AdimgseqID = "";
int adimgseqposX = 50;
int adimgseqposY = 50;
if (m_strImagePath == null || m_strImagePath == string.Empty)
{

}
System.Windows.Forms.FolderBrowserDialog openFolder = new System.Windows.Forms.FolderBrowserDialog();
//System.Windows.Forms.DialogResult reopenFoldersult = openFolder.ShowDialog();
if (openFolder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
DirectoryInfo di = new DirectoryInfo(openFolder.SelectedPath);
[kukkudu] This is full code
 
mr5
another behemoth
make sure button1_Click gets called first before timer1_Tick
 
[kukkudu] How to call button_Click frist
 
mr5
put a break point on both methods
then run the program
click the button to run the button1_Click (assuming that button click delegate is assigned to that)
in your case, it's highly likely that timer1_Tick gets called first.
 
[kukkudu] Can you code this
 
mr5
so what you can do is start your timer1 at the end of button1_Click
no I cannot code that
only you can code that
 
3:12 PM
look at @mr5 understanding these behemoths, but being confused by my simple scope test :(
 
mr5
because your behemoth is enterprisey, and that needs a lot of focus, commitment, and sheer fucking will
 
:)
 
[kukkudu] I am coded that now start my timer1 at the end of button1_Click,Now the NullReferenceException error clear
[kukkudu] But show other error
[kukkudu] Now I can load my image sequence folder and show first image in my preview, But next when my next slide is show then shows a error.
[kukkudu] Error show this line
 
3:29 PM
meanwhile in my code, I just changed await (await (await to await (await (await (await
 
mr5
you know, local variables is a thing
 
I know, but chaining makes more sense here
 
Doubtful. Chaining makes code harder to read.

You'll regret that later on.
 
depends
 
Sure it depends...

If you never have any issues with that call, you're in the clear.
If you do have issues with the call, you'd wish you made it more readable.
 
3:36 PM
result = FindX()
    .OrElse(() => FindY())
    .OrElse(() => FindZ())
but... then async came along
 
Ok, that's a chopped line, and is readable, but when I see (in this chat): "await (await (await (await" all inline, that looks heinous.
 
result = await (await (await FindXAsync()))
    .OrElseAsync(async () => await FindYAsync())
    .OrElseAsync(async () => await FindZAsync())
I blame async
 
eh, too much going on in that first line for my liking.
 
me too
 
But, it's your code. Own it. lol
 
3:38 PM
I would have to provide extension methods for Task everywhere
gonna be fun...
where (fun == "not actually fun at all"))
 
mr5
you could simplify it to this: .OrElseAsync(FindYAsync)
 
That makes sense. I'm unfamiliar with "OrElseAsync", but I assumed if it's an awaitable call, everything else passed in doesn't need to be declared as async.
 
@mr5 I could, if C# would allow me, but no
I cant even change it to OrElseAsync(() => FindYAsync())
Task<T> is non-variant
 
mr5
Task.ContinueWith(t, .OnlyOnFaulted) == OrElseAsync()?
 
so, Task<MyObject> is not compatible with Task<Object> for example
and my chain is using a supertype compared to the methods, which return specific types
 
mr5
3:44 PM
oic.
 
I have so many issues with Task and async...
I should just stop using C# :(
 
mr5
await is supposed to be use declarative though
 
that is the issue with C#
they just whack a feature in it without thinking about how it integrates with other language features
 
mr5
I believe the reactive for C# have a solution to your problem
 
reactive?
in any case, they could just make a function T Await(this Task<T> task) and have it treated specially by the compiler
 
mr5
3:49 PM
I think this one: github.com/dotnet/reactive
 
1, this wouldnt introduce new keywords
2, this is syntax people already understand
3, this is syntax that respects chronological order
4, this is syntax that respects parsing groups
but no, they prefer to be enterprisey and introduce new keywords so C# is a "rich" language with many keywords
speaking of which... I should try to finish Kodian
 
mr5
But why should every method be async though?
Can it be written in sync and just wrap it with sync if it's still necessary?
hmm
 
because they are async methods
they do http calls or access a database
 
4:54 PM
[kukkudu] hi
 
mr5
@Wietlol
 
yes, but actually no
Task<String> A() => Task.FromResult(null);
Task<bool?> B() => Task.FromResult(null);
Task<List<int>> C() => Task.FromResult(null);
try with those
and then
object r = await A()
    .OrElseAsync(B)
    .OrElseAsync(C);
 
mr5
my take on that is I am expecting .OrElseAsync to accept an input the same from the output of its parent.
it looks like you should have named it .AndThenAsync instead?
 
5:09 PM
nope
it is OrElse
and the output can be any common supertype of both inputs
 
mr5
well you're out of luck because that's not how C# generic works
 
this is a more complete example
obj5 has compiler errors
 
mr5
5:32 PM
why not:
var obj5 = FindId()
	.OrElseAsync(FindName)
	.OrElseAsync(FindIsSilly);
@Wietlol
 
because again, compiler error
 
mr5
try it
why are you not using var
you chose to type those long ass types
 
no, I dont choose to
they get autocompleted
also, I tried it, still compiler error
 
mr5
wut
it's working one my end
 
screenshot?
 
mr5
5:46 PM
 
what is OrElseAsync now?
 
mr5
and here's the running program
had to put it in a difference file (where it cannot be reach by a sunlight)
dfuq is <R>?
 
then you are hiding errors :)
on obj5, FindId() returns a Task, which doesnt have OrElseAsync
 
mr5
ohhhhhhhhhhhhhhhh
lol
I do have my own OrElseAsync version 😂
and it gets mixed with yours
 
I see
 
mr5
5:56 PM
Task<T> OrElseAsync<T>(this Task<T> task, Func<Task<T>> func)
this mine
the .AndThen prolly is a good Task extension
with a different inputs and outputs that can be chained
 
what does your OrElseAsync do?
 
mr5
it executes the func if the current task fails
 
ah
basically implemented as:
if (task.IsFaulted)
    return func();
return task;
 

« first day (3860 days earlier)      last day (1071 days later) »