« first day (3648 days earlier)      last day (1300 days later) » 

12:02 AM
is there anyone that has a problem if i remove the C# birthday event?
 
 
8 hours later…
7:39 AM
I know I wouldn't
 
 
2 hours later…
mr5
9:33 AM
Jack, tumbleweed
 
10:27 AM
Well duh, it's sunday
 
10:43 AM
Is there anyone here that doesn't use MVVM and why?
 
Depends, in what context
TIME TO BUILD ANOTHER PROJECT ON .NET 5
 
 
1 hour later…
12:03 PM
What are you building
 
12:21 PM
An API which can get shipping labels from multiple providers for my system
 
12:38 PM
Ok, nice, so I guess u started the project and voila, SWAGGER is already in place, unless you are doing GRPC I guess.
 
No I had to set up swagger, although it's not very hard so it only took a few minutes
Mainly because I just copied it from my last project which is similarly structured. Also has a self-building and publishing SDK for consumers of the API
Just for fun, this is going to be the 2nd .net 5 project which will go into production before GA release of .net 5
The first one is currently processing about 30k requests per "day" (bear in mind a day is really just between about 8am and 4pm)
Ah fuck I've got a 3 way many to many relationship
 
1:03 PM
Did you find a way to print faster?
 
Nah, I ended up just throwing it on a backgroud thread
 
that works
 
1:17 PM
hey all! anyone has experience using .net Identity? I've been using it for a while but what I'd like to do it log in as other users to see what they see on their dashboards - this would give me an easy insight of any bugs that happen when 'using the service for real' (there are always some!!)
since all the passes are hashed (phew!) I obviously don't know them - is there an easy way to log in without authenticating for password?
 
The only experience I have with it is it's a bit crap
Like it works fine, it's just a pain in the arse to use
 
it takes away a lot of work though which is good
unless you're using another framework
 
1:33 PM
@Wietlol What is the C# birthday event about?
 
The chat room is 10 years old I believe at some point this month
But it's set up I think as an event which fires every day during the month, which for people who leave their browsers open overnight, means there's a notification every day about it
 
@ntohl Wow, that's very useful. I'm using Linux right now though so can't use Visual Studio. Any idea if the same can be done in Rider or Visual Studio Code?
 
Rider has it too I believe
 
@CaptainObvious Cool, what day of this month is it?
@CaptainObvious I see. What happens on that day? Anything special?
 
Next thursday it appears
Probably nothing at all will happen
We might have a little more activity than usual, but who knows
 
1:39 PM
@CaptainObvious I thought there might be celebrations? Like a real world birthday. Maybe wietbot can do something different on that day
 
Regarding the C# interactive:
Aaaand now rider has froze
Yep, that's about right
 
@CaptainObvious that's awesome, do you mind sharing the link
 
@CaptainObvious Is this C# interactive like Python's REPL?
 
@kudzanayi It's an internal thing, so no can do. Also it's only useful if you have the SDK and a valid user token, neither of which you can get
 
Oh, that's cool
 
1:43 PM
Unless you get a job working for me that is
 
@CaptainObvious This event that raises a birthday notification every month for the month of October, is it the same Event type in C# that has a producer and subscriber?
Or is it something different? I want to know how it works under the hood.
 
Eh? Nah it's just something that's a feature of Stack's chat rooms.
Oh I have no idea, it's Stack so it's probably some hodgepodge of crap which hasn't been touched for a decade or so
 
@CaptainObvious hmm, I think Stack Overflow was built using C#, so maybe that feature of Stack's chat rooms uses the Event type. Just guessing.
 
I have a combobox column inside datagridview called items name and it's read items from db, I need to make 2nd column in datagridview to showing ID while items is selected?
my code for first items name column is :
com.Connection = con;
con.Open();
com.CommandText = "select * from Goods";
com.ExecuteNonQuery();
DataTable dt7 = new DataTable();
SqlDataAdapter da7 = new SqlDataAdapter(com);
da7.Fill(dt7);
ComboColumn.DataSource = dt7;
ComboColumn.DisplayMember = "Name";

con.Close();
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{





int i = 0;

com.Connection = con;
com.CommandText = "select ID from Goods where Name = '" + row.Cells[dataGridView1.Columns["GoodID"].Index].Value = + "' ";
con.Open();
com.ExecuteNonQuery();
SqlDataReader dr;
dr = com.ExecuteReader();
while (dr.Read())
{



string id = (string)dr["ID"].ToString();


}
con.Close();
 
@CaptainObvious Where do I send my resume? XD
 
1:56 PM
jobs@/dev/null
 
straight to File 13?
 
You wouldn't want to work here anyway. Because of the horrible tech stack (which is entirely my doing)
Unless you like working on Winforms VB.net projects on .Net Framework which work together with WPF projects, .net FX APIs, .net core APIs, etc, etc
 
I was just messing around, I'm already employed
 
I figured, but I just thought I'd mention how retarded this system is
 
It shouldn't take drastically long to restructure
 
2:01 PM
Until a couple of weeks ago every projects which makes up part of this one system (which there's about 20-something projects) all relied on a single VB.net class library
(now they rely on a C# class library :D)
 
baby steps
 
It took me 5 years to build it up
 
a headache today could prevent a migraine tomorrow
 
And in fairness I've been working on replacing components with newer ones. Like last year I replaced a couple of old winforms vb.net projects with a single .net core c# web app (which also does some additional stuff that other projects did too
Ahah yes, there was one major thing we had fun with earlier this year. All of our data was stored in binary formatted files
We decided to move to Json serialised instead. That was fun.
 
If you don't mind me asking, what is the elevator pitch for what you do? Just so I have an idea of what you're dealing with.
 
2:06 PM
Uh
Warehouse management and order fulfillment system (primarily) for a major UK ebay seller, but which is also moving into third party logistics for other companies
 
interesting
 
The key things it's built around is warehouse operative efficiency and same day despatch
Basically everything that happens in the system is realtime, to enable afap turnarounds
 
Have you seen the new celluveyor?
 
Which means knowing exactly what is going on with the 20 or so users in the warehouse, the 5000 or so orders currently in the system, and all the stock that is in the warehouse
Looks like a cool idea, but the throughput is too slow
 
I was looking at it and it doesn't seem that energy efficient
 
2:14 PM
Instead of sorting parcels just in time, why not sort them ahead of time?
 
Maybe it reduces the amount of equipment required
 
But it's slooooow
That's something I don't really have to deal with though in fairness. I send the carriers a load of stuff which isn't sorted in any way because there's no benefit for me to do that. I sort everything on my end for picking in the warehouse and ensuring that stuff which will be going out together gets packed together
It's a sort of unique advantage I have in this sort of context. I'm developing warehouse management and fulfillment software, which isn't uncommon. Except the software houses who develop these things don't have a real warehouse to run their software in to see if it actually makes sense
We've tried a few third party systems but they're all a bit shit in various ways
The downside is that the warehouse I "test" in is a real functional warehouse and thousands of real customers are waiting on their parcels which are running through this system, so I can't fuck it up too much
 
@CaptainObvious Is it only you developing you lead a team?
 
Just me. Over time it's either been me or me and 1 other person, but at the moment it's just me
Oh shit I was going to post my latest setup after moving the office around
 
2:29 PM
yep, so if you mess up, then every one is looking at you, 5000 orders, and a null reference exception - I think i'll just go on holiday and switch off my phone :-)
@CaptainObvious Thats sweet. I got some old Lenovo i5 from I don't know when, have to wait ages for the emulator to respond - iv learnt patience. Great setup
 
Thanks. It's what I've been working with for a while and it's been very effective for me. Haven't really changed anything about it in ages aside from the height of the leftmost screen. And I have plenty of power at my fingertips too
 
 
3 hours later…
5:47 PM
Can someone help me understand how exactly the line of code that declares an interface instance and the line of code that calls the member works in the following?
interface ISampleInterface
{
    void SampleMethod();
}

class ImplementationClass : ISampleInterface
{
    // Explicit interface member implementation:
    void ISampleInterface.SampleMethod()
    {
        // Method implementation.
    }

    static void Main()
    {
        // Declare an interface instance.
        ISampleInterface obj = new ImplementationClass();

        // Call the member.
        obj.SampleMethod();
    }
}
What I mean is, ISampleInterface obj = new ImplementationClass(); declares a class instance on the right. Is that class instance then implicitly converted to the interface instance ISampleInterface named obj?
When you call the member obj.SampleMethod();, how come you can call the method SampleMethod through the interface instance ISampleInterface even though the declaration of the interface ISampleInterface only contains the signature for the method SampleMethod?
 
an interface is just a contract
the rules of `ISampleInterface` say:
- an instance of this interface must have a method called `SampleMethod` (with no parameters and returns void)
the compiler and runtime will figure out which implementation is used
based on the type of the instance
 
@Wietlol Thanks, I understand that. But I don't understand how declaring an interface works, and how calling a member of an interface works.
 
do you understand what the code means though?
 
@Wietlol Yes, I understand everything before this part:
        // Declare an interface instance.
        ISampleInterface obj = new ImplementationClass();

        // Call the member.
        obj.SampleMethod();
 
what do you understand from it?
or at least... what do you think it means?
 
6:00 PM
@Wietlol A test? I'll give my understanding.
interface ISampleInterface
{
void SampleMethod();
}
Means we are declaring a contract stipulating a method SampleMethod that must be implemented when the contract is implemented by a class or struct.
 
fair enough
 
In other words, that is a declaration for a contract that contains a definition (i.e. a signature) for a method.
class ImplementationClass : ISampleInterface
{
    // Explicit interface member implementation:
    void ISampleInterface.SampleMethod()
    {
        // Method implementation.
    }
Means that the class ImplementationClass implements said contract, and so must implement all members defined in that contract that do not have a default implementation.
We use an explicit interface implementation so that the implemented member can only be called from the interface instance, not the class instance.
@Wietlol I'm stuck here:
static void Main()
    {
        // Declare an interface instance.
        ISampleInterface obj = new ImplementationClass();

        // Call the member.
        obj.SampleMethod();
    }
 
yes, so what do you think the main method means? (the two statements in the body of the main method in particular)
 
@Wietlol Because I'm thinking that in the line ISampleInterface obj = new ImplementationClass();, new ImplementationClass() creates a class instance, and the assignment operator implicitly converts the class instance ImplementationClass to an interface instance ISampleInterface. That's what I think the first statement means. Is this correct?
 
there is no conversion though
the instance (of type ImplementationClass) is also an instance that satisfies the contract
no conversion is needed
 
6:09 PM
@Wietlol So then how do we end up going from the class instance ImplementationClass to the interface instance ISampleInterface?
 
think of it as interface IAnimal and class Dog : IAnimal
the dog already is an animal
we dont have to biologically alter the dog to become an animal
but an animal shelter can work with any animal (except maybe dinosaurs)
your main method says "I want an object named "obj" and it must be at least an ISampleInterface"
the "at least" is very important here
in most compilers, that type is called the "upper bound type" of the variable
it doesnt have to be the exact type
anything that extends or implements the type (or the type itself) are all allowed on the right hand side of the assignment
 
@Wietlol Is the reason the instance of type ImplementationClass satisfies the contract that ImplementationClass implements every aspect of that contract (i.e. all members of that interface)?
 
mostly because the class said they implement the interface
the compiler will actually make sure all members are implemented
just having the members is not sufficient
you need the class x : ISampleInterface
 
@Wietlol Can I think of the statement ISampleInterface obj = new ImplementationClass(); as get the contract from the class instance ImplementationClass(), or in other words, the assignment operator obtains the contract tied to the class instance, and assigns it to the variable obj?
 
the contract is a... concept, it doesnt actually exist
 
6:20 PM
@Wietlol I see, this is where the compiler makes sure all members are implemented
 
just like "IAnimal" doesnt exist
the dog exists, which "is" an animal
you cant get the animal out of the dog
 
@Wietlol I know, I was just trying to find a way to understand the declaration of an interface instance
 
i find the comment pretty confusing though
because an "interface instance" doesnt really exist
 
@Wietlol Does new ImplementationClass(); declare an interface instance at the same time it declares a class instance?
@Wietlol Which comment?
 
again, there is no interface instance, there is no animal, it is a concept, not an object
so "// Declare an interface instance.", imho, is a very poor choice of words
not sure where you got it from
 
6:24 PM
@Wietlol Okay, got it. But there is a class instance, right?
 
yep
 
it is from the official C# documentation:
https://web.archive.org/web/20200721121043/https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interface
@Wietlol so if there is no interface instance, what exactly is being declared by the statement ISampleInterface obj = new ImplementationClass();?
 
a variable with upper bound type ISampleInterface
where the value is a new instance of ImplementationClass
 
@Wietlol By this message do you mean that new ImplementationClass creates a class instance that is an ISampleInterface?
 
yep
it is both an ImplementationClass and an ISampleInterface
 
6:34 PM
@Wietlol This message too, says that new ImplementationClass creates a class instance that is an ISampleInterface?
@Wietlol Wow, great! Thanks
@Wietlol Doesn't at least indicate a lowerbound, not upperbound?
 
depends on the direction
in most language designs, the inheritance tree goes from up to down
so, an upper type is the parent type
and a lower type is a child type
so an upper bound must be a type of equal or lower
 
@Wietlol Does the variable with upper bound type ISampleInterface mean anything that is more derived than ISampleInterface? Is that what you mean?
 
it must be an ISampleInterface or a subtype of it
so, you can assign it with invoking a function with a return type of ISampleInterface as well
 
@Wietlol Yes, subtype (or child) means more derived, or in other words, lower than it in the inheritance tree. I think we are using different terminology here
@Wietlol That's good to know.
 
also, you dont have to ping every time ;)
 
6:43 PM
My bad, I forgot it's just us. Bad habit.
@Wietlol Just to confirm, the reason that new ImplementationClass creates a class instance that is both an ImplementationClass and an ISampleInterface is because of the declaration class ImplementationClass : ISampleInterface?
 
yep
the concrete type is ImplementationClass
which is also the type you get from obj.GetType()
but it inherits everything from all of its supertypes (including ISampleInterface)
so it is an "is a" relation
 
Right so basically that's what class ImplementationClass : ISampleInterface? is telling the compiler?
@Wietlol I think Java uses the concept of super and sub types, where as C# uses base class and derived class. They mean the same thing.
 
ye
I am more of a Java person, so I usually use their naming... but it mostly represents the same in C#
their type systems are nearly identical
 
...i.e. class ImplementationClass : ISampleInterface? is telling the compiler tells the compiler that the instance of the class ImplementationClass is the interface ISampleInterface?
@Wietlol Could have fooled me.
@Wietlol That means I don't have to spend much time learning Java's type system.
Now back to this
static void Main()
    {
        // Declare an interface instance.
        ISampleInterface obj = new ImplementationClass();

        // Call the member.
        obj.SampleMethod();
    }
@Wietlol I now understand that ISampleInterface obj = new ImplementationClass(); declares a class instance which is an interface (i.e. the interface ISampleInterface), so because ImplementationClass is ISampleInterface, we can assign that class instance to the variable of type ISampleInterface. Is this correct?
 
6:58 PM
stop ping!
but yes, that is correct
 
:) bad habits die hard
@Wietlol great, now on to the next.
 
-_-
 
This one:
        // Call the member.
        obj.SampleMethod();
 
what about it?
 
ImplementationClass is the interface ISampleInterface. So calling obj.SampleMethod() is the same as calling ISampleInterface.SampleMethod() but because ImplementationClass is ISampleInterface, therefore ISampleInterface is also ImplementationClass. So calling ISampleInterface.SampleMethod() calls the method:
void ISampleInterface.SampleMethod()
    {
        // Method implementation.
    }
in the class instance ImplementationClass?
Correct?
 
7:04 PM
not really
> therefore ISampleInterface is also ImplementationClass
that is not always correct
all dogs are animals, but not all animals are dogs
 
@Wietlol True. So how do you think about/understand the method call obj.SampleMethod();?
 
it invokes the SampleMethod as declared by the concrete type of the obj
 
@Wietlol Yes, but how does it invoke the implemented member SampleMethod when obj is the interface ISampleInterface?
 
because obj's concrete type is not ISampleInterface
the concrete type or runtime type is whatever type the object itself is
which you can get by doing obj.GetType()
in your case, that is the ImplementationClass
it is set when you do the new operation
 
@Wietlol so invoking a method of an interface using the syntax ISampleInterface.SampleMethod() invokes the member of the concrete type?
 
7:14 PM
yep
 
@Wietlol I think I get what this means, sort of. Because you said that an instance of the interface ISampleInterface doesn't exist. You cannot invoke SampleMethod that is declared in the interface as a signature without an implementation. Therefore ISampleInterface.SampleMethod() invokes the method SampleMethod of the concrete type ImplementationClass.
 
ping
 
By concrete type, you mean an existing type, or in other words, a type that has been instantiated.
My apologies, I needed to refer to an old message of yours.
 
ye, the concrete or the runtime type is the type that has been instantiated
invoking methods always asks that runtime type for the implementation
 
Got it - you can only invoke methods of a runtime (i.e. concrete/instantiated) type.
But what about if the interface method SampleMethod had a default implementation, how does invoking that default implementation work?
Something like:
interface ISampleInterface
{
    void SampleMethod()
    {
      // Method implementation
    }
}

class ImplementationClass : ISampleInterface
{

    static void Main()
    {
        // Declare an interface instance.
        ISampleInterface obj = new ImplementationClass();

        // Call the member.
        obj.SampleMethod();
    }
}
 
7:26 PM
then it will invoke that default implementation
because the Implementation class does not override that behavior
 
In this case, SampleMethod is not implemented in the concrete type, so you cannot invoke it through the concrete type?
 
if the Implementation class did override that function, the overridden function is invoked
keep in mind, the concrete type inherits the members of the interface
so, even though it is not in your source code, the runtime type does have the SampleMethod function
 
@Wietlol But I thought you can only invoke members of a type that has been instantiated (i.e. you can only invoke members of a concrete type)?
 
you dont invoke a type
you invoke a function
 
> so invoking a method of an interface using the syntax ISampleInterface.SampleMethod() invokes the member of the concrete type?
 
7:30 PM
^ still correct
> keep in mind, the concrete type inherits the members of the interface
 
@Wietlol mistake, corrected it
Does obj.SampleMethod(); just invoke the member where ever it is implemented? That could be the default implementation in the interface or the implementation in the implementing class?
 
yep
 
Thanks, I think I will stick with this explanation, as it is straightforward rather than the whole concrete type vs non-concrete type:
> Does obj.SampleMethod(); just invoke the member where ever it is implemented? That could be the default implementation in the interface or the implementation in the implementing class?
@Wietlol Okay, the runtime type does have the SampleMethod method but in the second case which has a default implementation, it is not called, rather the default implementation of SampleMethod is called. Got it.
Is this a mistake?
> if the Implementation class did override that function, the overridden function is invoked
Do you mean to say:
if the Implementation class did override that function, the overriding function is invoked
?
 
yes, sorry
the overriding function indeed
 
I'm catching on :)
One thing I don't get is this:
> invoking methods always asks that runtime type for the implementation
 
7:45 PM
it is called single dispatch, but it is a very difficult topic
 
Does this mean that only methods of a concrete type can be invoked?
Just to be sure, can you invoke members of a non-concrete type too?
 
@BlackPanther in simple terms, yes
@BlackPanther technically, no, but those are inherited
 
Great, so then when the interface has a default implementation for the SampleMethod method, if only methods of concrete types can be invoked, then how come that ISampleInterface.SampleMethod invokes the default implementation of the SampleMethod method which was implemented in the non-concrete type ISampleInterface?
 
> keep in mind, the concrete type inherits the members of the interface
 
8:01 PM
Remind me, is it just the implemented members that it inherits from the interface, or all members declared in the interface?
 
it inherits the implementations
 
@Wietlol So rather than saying that the default implementation of SampleMethod in ISampleInterface is invoked, since the type whose method is called must always be a concrete type, is it more accurate to say that the SampleMethod method inherited by the concrete type (ImplementationClass) is actually invoked, not the default implementation of SampleMethod defined in the ISampleInterface?
 
i suppose
but the difference is very... little
 
That's good. The first less rigorous explanation is easier to digest.
> it inherits the implementations
For a base class and a derived class. Is this also true?
I think I'll find that out soon, but I was just thinking what happens to the non-implemented members in a base class?
In terms of being inherited or not.
> it inherits the implementations
And this is why the compiler doesn't show an error asking you to implement members that have a default implementation.
 
8:29 PM
Thanks for the excellent explanations and answers to my questions. I'll ping you later :). God speed!
 

« first day (3648 days earlier)      last day (1300 days later) »