« first day (3755 days earlier)      last day (1176 days later) » 
00:00 - 14:0014:00 - 00:00

12:18 AM
[mr5] Ululu :3
\[**[Not Li](https://discord.gg/PNMq3pBSUe)**] Ich bin fire

Ich bin det-töt
[Not Li] (ik that's not the actual German but it sounds like that)
[mr5] Latin Spanish is the best imo
 
12:37 AM
 
 
5 hours later…
5:19 AM
[kesarling] Anyone there? Need a lil design help
[kesarling] As in, can't understand the structure of a model I might need in the project
[kesarling] The model is supposed to have different Parameters which are to be read real-time.
[kesarling] However, the Parameters can also be added (or removed) later as per needs.
[kesarling] Do I make a separate class for the Parameters? (Parameter is in itself, a class)
 
 
2 hours later…
7:03 AM
Sounds like your DTO needs a nullable property
Good morning
 
[kesarling] good morning!!
 
 
2 hours later…
9:31 AM
[kesarling] Hey, anyone there?
[kesarling] My code is not adding values to the database
[kesarling] something seems wrong
[kesarling] Can anyone take a look?
 
Call .SaveChanges?
 
[kesarling] I have
[kesarling] Can Async make a difference?
 
Not if you application doesnt crash at exactly that moment
Show me your call
 
[kesarling] what code would you like to see?
 
The code updating the entities
 
9:41 AM
 
Botler doesnt relay images
 
[kesarling] It ain't an image
[kesarling] but okay,
[kesarling] I'll log on
[kesarling] just a sec
[kesarling] stupid botler
 
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
using AdminPortal.Web.Data;
using AdminPortal.Web.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace AdminPortal.Web.Pages.Assets
{
    public class CreateModel : PageModel
    {
		private readonly AssetDbContext assetDbContext;

		[BindProperty]
		public Asset Asset { get; set; }

		public CreateModel(AssetDbContext assetDbContext, Asset asset)
There you go
That's better
@Squirrelkiller you there man?
 
gotta get me a coffee while I have 5 minutes without the cat on my lap lol
 
[kesarling] :mweh:
[kesarling] arrgh
 
9:47 AM
Did you check whether or not Asset gets populated correctly?
 
[kesarling] How would I do that?
[kesarling] This is why I live discord. The other day, I just showed Roel my screen and he figured out the problem in under a sec
 
I wouldn't look at your screen anyway, since I have enough work stuff to look at :P
 
[kesarling] lol
[kesarling] I gotta turn this in by Friday man
 
Friday man, the little brother of florida man
 
[kesarling] :wat:
 
9:51 AM
The checking is done by either adding Console.Logs or debugging^^
 
[kesarling] nope. That ain't JS
 
Good point. Console.WriteLine it is.
 
[kesarling] hmm
 
Oh. I gotta write a new generally helpful extension method real quick.
 
[kesarling] And what would it do?
 
9:52 AM
You'll see in a sec
 
[kesarling] Relay codes I assume?
[kesarling] okie doke
 
Oh wait it doesn't work
Damn
I wanted to write Console.Log to accept objects an ToString them for me.
One of the very, very few things I like in javascript
 
[kesarling] Errm, anyways, now the code is firing an error
[kesarling] Please come to discord man. This is so easy
 
After adding Console.WriteLine?
 
How the hell do we paste images here?
 
9:57 AM
You need to fix that error
 
phew
 
wtf kinda error is that
Is that some MVC thingy I'm too Blazor to understand?
 
@Squirrelkiller Again, this is razor
 
Razor Pages, yeah. Very annoying framework.
You haven't answered my question though
2 mins ago, by Squirrelkiller
After adding Console.WriteLine?
 
nope
It just popped up after are re-ran the code instead of refreshing the page
 
10:03 AM
[kesarling] Does foreach need an IEnumerable, or an IList?
 
foreach technically needs none of those
It only needs the receiving object to have a GetEnumerator method.
@d4rk4ng31 That is a good thing, as now your problem is not "why doesn't it change the database?"
 
10:24 AM
[kesarling] I got the problem
[kesarling] I had deleted a database
[kesarling] How do I create one now?
 
lol
I bet Lee knows how to make the EF migration create the DB if it doesn't exist
Did you go code first or DB first?
 
[kesarling] I have absolutely no idea
[kesarling] 😅
[kesarling] I guess I created the DB after I did all that
[kesarling] So I went code first
[kesarling] At least hoping so
 
Then you...should know how to recreate it, right?
 
I have some questions about interfaces in C#.
1. What does an interface do?
2. When do you use an interface?
3. What is the difference between a C# interface and an Application Programming Interface (API)?
 
1: an interface is a type of which you cannot make instances... much like an abstract class
 
10:33 AM
When you either have several classes doing/representing the same thing and you want something else to use that thing without having to think about which class it is, or you have a library and an application and the library should do something ofr the application but you don't want to concretely instantiate the library so the library just adds an interface to the DI and the apllication uses that interface without knowing the implementation.
 
@Wietlol Thanks, although that answers what an interface is, not what an interface does.
 
2: an interface is often used to describe the api of a certain type, you can provide multiple (different) implementations
it can also be used as marker interface to describe the instances
it can also be used as code module that you can add to classes
 
Both C# interface and API are the same concept, just that an API you only ever see from the outside (like via swagger or intellisense), while a C# interface you write yourself so you can also see it from the inside.
 
I never use interfaces, so maybe knowing the answers to questions 1, 2, and 3 will let me know when to use it.
 
@BlackPanther then an interface does nothing
it only provides information to the compiler and other things
it does nothing by itself
I always use interfaces...
 
10:36 AM
[kesarling] Finally!!!!
[kesarling] Got the error
 
but that is mostly because that is the default in my stuff
 
Library example: My apllication pulls an ITeamRepository from DI. What it doesn't know is that a library that manages the database puts a dbcontext called TeamDbAccess into DI that implements ITeamRepository.
 
@Squirrelkiller This is very good and clear:
> When you either have several classes doing/representing the same thing and you want something else to use that thing without having to think about which class it is,
@Squirrelkiller So you use an interface when you want to share functionality between classes or structs?
 
Yes, that is one reason.
 
> or you have a library and an application and the library should do something ofr the application but you don't want to concretely instantiate the library so the library just adds an interface to the DI and the apllication uses that interface without knowing the implementation.
 
10:38 AM
Keep in mind, it's literally the concept it's named from: An interface. You use it to interface with something.
 
@Squirrelkiller why would you want to instantiate a library? A library is just a set of helper methods which are of course static.
 
Nah
A library is any dll that is not an application
(Well technically every dll is by definition a library....)
 
@BlackPanther a library is a collection of code components
it could be functions, it could be classes, it could be anything
ofcourse, in C#, for the time being, you can only have top level classes
so a library is a collection of classes
> A utility class is just a set of helper methods which are of course static.
A better utility class is a singleton class with non-static methods
 
Take this: I have an application. It's called Teambuilder.
Teambuilder is an asp.net core project in my solution. It has a WebApi with controllers, a SignalR hub, models, and services.
Services use repositories to access data.
That data is in a database. But the Teambuilder application doesn't know that. It just uses an interface to access the data, called ITeamRepository. Of course there is an actual object being used, but the application doesn't know what class it is.
There is a library called TeambuilderServer. It manages the database, and provides objects to the application by adding it
You could build a Razor component and put it in a library, so @d4rk4ng31 could use it in that Razor Pages application there.
 
@Wietlol So there are three use cases?
 
10:45 AM
at least 3
probably more but cant think of them atm
 
I have another library literally called TeambuilderLibrary that defines just the interfaces and models. Both backend and frontend use that library, with each having their own services to implement those interfaces.
So in my application when I do "go to implementation" I always get two options: Website|WebApi
 
@Squirrelkiller That's great to know. But for an API such as a Web API don't you also write it your self, or are you talking about APIs that you consume in your app?
@Wietlol Let me rephrase this:
> 2: an interface is often used to describe the api of a certain type, you can provide multiple (different) implementations
 
Yeah I meant APIs you consume^^ You're right, a Web API you also write yourself. Although the thing you write is more than just an API, it's the implementation too.
@BlackPanther Correct
 
2: an interface is often used to describe how to communicate with a certain type, you can provide multiple (different) implementations of how to communicate with an interface
 
nope
 
10:50 AM
Is how I rephrased what you said correct
 
it is used to describe the communication with the certain type
 
Well, an interface is by definition used to describe how to communicate with something
 
but you can provide multiple different implementations of the backing behavior
you dont provide different ways of how to communicate
that is the point of the interface at this moment
to unify the ways of communication
 
@Wietlol Right, because different implementations of an interface have different functions, and functions communicate with the type whose function is being called. I think to understand what an interface is I should start thinking of a function (or more accurately a method) as a message.
 
the parameters/arguments of a function would be the message
the function would be the procedure
if i recall OOP correctly
 
10:56 AM
@Wietlol This answers my question "What does an interface do?"
 
not entirely...
one example where this isnt the case is public interface RandomAccessList (taken from Java)
 
> it is used to describe the communication with the certain type
 
it is an empty interface, no members, no nothing
now what would be the use case of an empty interface?
 
and you can provide multiple (different) implementations of communications with a certain type.
@Squirrelkiller I'm hearing this for the first time
 
> you can provide multiple different implementations of the backing behavior
you dont provide multiple implementations of communication
 
11:00 AM
@Wietlol What do you mean by "backing behavior"?
@Wietlol Yeah, that's more accurate
 
Here's a real world example, even though we scrapped the implementation of it now because corporate reasons:
Our company does insurance comparisons.
We have 3 teams for 3 different types of insurance: Health, Life, and Property.
Each team builds their own application.
I am part of team#4: Our application does every type of insurance.
But how can we do the work of all the teams together? Well, the teams make libraries with their business logic, and we just use those libraries and display the results.
I must admit it was a genius idea.
Unfortunately, after years of back and forth, we now directly reference the libraries in our application. So the original concept is dead.
 
@Wietlol According to Wikipedia:
> In computer programming, a subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
 
Correct
And in C# we call subroutines either functions or methods, although functions are usually called pure methods here.
 
@Wietlol Even if there are no arguments and parameters, calling a function still communicates with the type whose function is still called
 
In asm they're still called subroutines: jsr/rts = Jump/Return SubRoutine
A C# interface is what the .h or .hpp file is for C/C++
Those are basically interfaces
 
11:07 AM
The type calling the function of another type is the sender, hence passing arguments. Where as the type whose function is being called is the receiver since it receives arguments passed to its parameters.
 
@BlackPanther but the function itself is not a message
@Squirrelkiller I would have to disagree with you on that one
you cant do polymorphism just by describing stuff in the .h file
 
@Squirrelkiller I see. Is an interface like a communication protocol then?
> A communication protocol is a system of rules that allow two or more entities of a communications system to transmit information via any kind of variation of a physical quantity. The protocol defines the rules, syntax, semantics and synchronization of communication and possible error recovery methods. Protocols may be implemented by hardware, software, or a combination of both. en.wikipedia.org/wiki/Communication_protocol
 
i suppose
 
> Protocol, in computer science, a set of rules or procedures for transmitting data between electronic devices, such as computers. In order for computers to exchange information, there must be a preexisting agreement as to how the information will be structured and how each side will send and receive it britannica.com/technology/protocol-computer-science
@Squirrelkiller This is very intuitive, thanks.
@Squirrelkiller Why use an interface to access the data when a DbContext instance can be used to access the data in the database directly?
 
@Wietlol Good point. The .h file still provides an interface of how to use the corresponding .c file though (Ha I used C so you can't bring polymorphism!).
@BlackPanther Basically, yes. It's just the next level from things usually called protocol. Http is a protocol that tell us there are methods called GET/POST/PUT/DELETE/PATCH that can take data in several forms and return a number and potentially data. C# interfaces also tell you that, just not on a networking level.
@BlackPanther I didn't know I'd stay with EF in the beginning. I could change the database, without changing the interfaces. Could use another webservice for example. Maybe @Squirrelintraining would have hosted that one himself and my WebAPI just used that one.
 
11:25 AM
@Squirrelkiller Why u ping meh?
Cant u see I is working?
You repo monsta
 
I don't care :P
Just needed an excuse to bait you back into chat
 
I see everything 👀
 
How's the new cat?
 
Oh didn't I tell you?
She couldn't come after all </3
The vet is afraid she might suffocate on the flight over here
 
@Wietlol Nothing
 
11:37 AM
wat
 
@Squirrelkiller This is much easier to understand, and also to maintain I bet :). When a new person joins the team they have to understand that set up that uses interfaces.
 
Hello eveyone
 
Welcome
 
@Squirrelkiller From Java, functions are methods that don't belong to a class. Where as methods are functions that belong to a class. I'm not sure what pure methods are.
@Squirrelkiller really. That's good to know. I though an interface was a type that most if not all programming languages have
 
mr5
11:45 AM
Why is this IIS weird af.
All I did was put/create a Solution filter and it completely changes the server configuration.
Can't find the "ShopApp" in .vs/config/applicationhost.config though
Alright. New solution filter means it would have its own .vs folder.
 
I have no idea about IIS express lol
 
@Wietlol This is a good example. To use implementation 1 of the IAbbreviationResolver interface, do you use the syntax IAbbreviationResolver implementation1 = new AbbreviationsDotCom();?
 
I always use full iis
 
@Wietlol And To use implementation 2 of the IAbbreviationResolver interface, do you use the syntax IAbbreviationResolver implementation2 = new GoogleAbbreviationResolver();?
 
mr5
The ugly thing about this is that .vs folder is not meant to push in repo therefore, cloning this repo and running it on localhost needs a reconfiguration.
 
12:01 PM
launch isnt supposed to be in the .vs folder though
 
mr5
How do I tell IIS not to look at .vs for its configuration?
 
@Squirrelkiller Knowing that Http is like a C# interface is very useful. When defining a C# interface I will think like this "there are methods called GET/POST/PUT/DELETE/PATCH that can take data in several forms and return a number and potentially data". This should also help me know when to use interfaces, and if there are need or if they would be useful.
@Squirrelkiller In the DbContext you can change the database, but if you wanted to change EF itself then I see why you would use an interface to access the database instead of accessing the database directly using an instance of the DbContext class.
 
I always think of it as a console on a wall with machines behind it. The console has a button labeled "Do stuff". I press it, stuff happens. No idea how it happens though.
Then maybe it has a keyboard with an input field, and when I type it the text goes on a big screen above. No idea how it works, it just does.
The machines behind the wall do everything. I just work with the console.
 
mr5
I guess IIS is the same as apache web server
In apache ws, it's easier to configure the domain, port my server would be running to.
 
@BlackPanther yet they exist...
@BlackPanther kind of, yes
you could also then put the creation into a factory, and delegate out which implementation to choose from
you could also create a new implementation that just invokes multiple others
 
12:26 PM
@Wietlol If the IAbbreviationResolver interface defines a method that includes an implementation body, I'm guessing that that method does not need to be implemented in the AbbreviationsDotCom and GoogleAbbreviationResolver classes, and so the method with an implementation body in the interface cannot be accessed from the IAbbreviationResolver implementation1 = new AbbreviationsDotCom(); interface and the IAbbreviationResolver implementation2 = new GoogleAbbreviationResolver(); interface?
@Wietlol What is the difference between IAbbreviationResolver implementation1 = new AbbreviationsDotCom(); and AbbreviationsDotCom obj = new AbbreviationsDotCom();?
 
@BlackPanther not sure what you mean by that
@BlackPanther the only real difference is that in the first case, the compiler will only look for methods available by IAbbreviationResolver and in the second case, it also looks for methods available by the AbbreviationsDotCom
in this case, there is no difference
but the AbbreviationsDotCom could have more members, for example, which url to use or stuff like that
in that case, you also have access to those members in the second case
 
@Wietlol Let me rephrase that. In the code paste.ofcode.org/JcGWdbC54aDzXVrhPmDgwq the method Test in the interface IAbbreviationResolver does not need to be implemented in the classes AbbreviationsDotCom and GoogleAbbreviationResolver because the method Test has already been implemented in the interface which contains it, right?
 
yes
this way, you can provide code to a class as a module
if you would remove the Resolve method, then your interface is suddenly not an "API" interface anymore but instead a code module
 
@Wietlol ... And therefore when you use the syntax IAbbreviationResolver implementation1 = new AbbreviationsDotCom(); and IAbbreviationResolver implementation2 = new GoogleAbbreviationResolver(); you cannot access the method Test because the method Test is not implemented in the classes AbbreviationsDotCom and GoogleAbbreviationResolver, right?
 
well... that is just C# devs being absolute idiots
you can invoke the method, but the compiler wont accept it in the normal way
 
mr5
12:41 PM
Does anybody know what is Okta? Is it some "client" / "implementor" of OAuth?
 
you have to explicitly state that you get the method from the interface
 
mr5
I have explicitly state the I did not get the method from the interface
 
english?
C# allows you to implement a method from a supertype and hide it from the API
 
@Wietlol Wait, so in the first case the compiler only looks for methods available in IAbbreviationResolver, but in the second case the compiler looks for methods available in both AbbreviationsDotCom and IAbbreviationResolver?
 
12:46 PM
@Wietlol If Test is implemented in the interface then why would the compiler look for methods available in both AbbreviationsDotCom and IAbbreviationResolver? Is it because of inheritance, i.e. Test is inherited by AbbreviationsDotCom?
 
in this example, we have an interface that acts as a provider of stuff
also, we have a child interface that acts as a provider of names
the original Get() method is hidden by the INameProvider so you can only invoke GetName()
 
mr5
@Wietlol doesn't VS warn/recommend you to use string instead of String?
 
C# devs decided that default implementations must be hidden by child types for absolutely no good reason whatsoever
so that is why it cant find the Test method
@mr5 no, because I switched it around
I prefer consistency over ancient rituals of heresy
so types are written in PascalCase
there is no distinction between primitive types and other types
 
@Wietlol If you override Test in AbbreviationsDotCom or GoogleAbbreviationResolver, the implementation body in Test is overriden by the implementation body in AbbreviationsDotCom or GoogleAbbreviationResolver, but if you use the new keyword then is the signature/identifier for Test overriden/replaced in AbbreviationsDotCom or GoogleAbbreviationResolver?
 
the only exception is dynamic because why not?
 
12:50 PM
[Squirrel in Training] KGoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos!
 
@BlackPanther new is even another level of idiocy... better stay away from that
 
I never used it and I see absolutely no reason to understand where it could even be considered a rational thought
 
[Squirrel in Training] WHY DO DATES IN JAVASCRIPT SUCC BALLS?!
 
12:52 PM
[Squirrel in Training] thanks for the mroal support
 
to be fair, I have the same feeling about DateTime in C#
 
@Wietlol Is supertype a base class. I'm not that familiar with advanced OOP in Java.
 
supertype is a parent type
subtype is a child type
so Subtype : Supertype
 
@Wietlol An interface implementing an interface? Now I've seen it all. What is this example for?
 
hierarchy
take a look at IEnumerable -> ICollection -> IList
IEnumerable is just something you can enumerate over (loop over)
ICollection is an IEnumerable and has a size and you can probably add and remove stuff from it
 
12:57 PM
Oh your latest example is for this:
13 mins ago, by Wietlol
C# allows you to implement a method from a supertype and hide it from the API
 
IList is an ICollection that is also in-order, you can get stuff by index or the first and the last, etc
 
@Wietlol If you added the public keyword to the original Get() method then it wouldn't be hidden right?
 
it is public by default... iirc
 
@Wietlol default implementations?
 
dang it, stop pinging
 
1:00 PM
@Wietlol right, I'll stick with the override keyword
@Botler JavaScript in general is just weird.
@Wietlol I thought method declarations in C# interfaces are private by default, or maybe I'm thinking of C# structs.
 
> dang it, stop pinging
continues to ping twice
 
You know what, I think I'll shoe horn interfaces into my workflow until using them is second nature.
 
it will probably be a pain for data classes though
for example, the Definition class doesnt implement an interface
but for processor classes, an interface is definitely worth it
 
Those code examples you pasted, do they expire?
40 secs ago, by Wietlol
but for processor classes, an interface is definitely worth it
I'll keep this ^ in mind
But properties in interfaces can also be implemented?
 
yes
not default implemented
for absolutely no good reason whatsoever again...
C# devs are a bit silly from time to time
 
1:07 PM
What do you mean by:
28 secs ago, by Wietlol
not default implemented
 
you cant implement them inside the interface
you have to implement them in the class
there is absolutely no reason for the declaration in the class as well
just having it in the interface should be sufficient
 
Can a web API action read a simple type value from json body as a parameter without making a class only for one property,
ArchiveObject(Guid id)
and the request contains : {"id":"the GUID"}
 
I would recommend still having the class even if it is possible to bodge it
 
why?
 
because of Direct Mapping
and if it is the root, then just for forwards compatibility
 
1:24 PM
I didn't know it could go that deep
 
in simple terms, if there is a reason for an object... there must be a reason for an object
so if you have {"id":"the GUID"}, you are probably better off with a class
 
1:43 PM
No, the reason only is for clarity, and not bloating the URL with business info, in my example the id is 'signerId' and it's a critical operation
 
00:00 - 14:0014:00 - 00:00

« first day (3755 days earlier)      last day (1176 days later) »