« first day (3145 days earlier)      last day (1786 days later) » 

12:18 AM
Morning O/
it's Monday!
 
 
3 hours later…
3:11 AM
Folks, when I call IEnumerable.Where(...) or IEnumerable.Except(...), does that create separate new collections for the results?
 
3:21 AM
Morning everyone...
@NickAlexeev Lazy execution/Deferred Execution, you get a sperate reference but it works on the original object every time you enumerate on it and filters it.
IF you are smart and don't just take strangers on the internet for their word, I suggest an exercise, create an IEnumerable, preferably just a list going from 1 to 10, put a filter on it, say Val>5, print the result, Add 11 to the original list and then enumerate the filtered object
 
 
1 hour later…
mr5
4:47 AM
hello folks
o/
 
5:47 AM
helloes
 
GoOoOoOoOoOoOoOoOoOoOoOd Mornin' squirrelerinos!
 
squeek
Talking about squeeks, have you played divinity original sin?
 
I can proudly proclaim:
No!
 
Heresy
I recommend it
really cool game
but you need the Pet pal talent since minute 1
 
hi, can someone know why this doesnt work? the getall never comes back, i dont know where im missuing the await
 
mr5
5:56 AM
Has there any game yet that can beat the fun of playing DOTA 2?
 
@mr5 DotA auto chess :b
@HéctorÁlvarez Sadly, I don't really have to much time playing video games anymore :<
 
mr5
@Squirrelintraining ohh I've played a couple of times of that. Was fun!
@tahtoh you have error at line 11
 
Mornin'
 
@Squirrelkiller 07
 
mr5
line number is relative to paste.ofcode editor
 
5:59 AM
But that's jsut the contructor
 
mr5
@tahtoh also, where are you setting the HttpClient's base address?
 
in my editor i have no erros
im sending it
 
Have you tried debugging?
 
in the line
yeah
76
 
Set breakpoint -> F11 through every line
 
5:59 AM
it goes to the get
and never comes back
 
mr5
here's the error
 
mr5
Your HttpClient seems to be different to what I am using (.NET Core)
 
@tahtoh Have you put a breakpoint into GetAsyncAll? Which line is the one you can't get over?
 
it gets here
HttpResponseMessage response = await client.GetAsync(_defaultRoute);
then the application continues its cycle
but doesnt go into
if (response.IsSuccessStatusCode)
 
6:03 AM
@anand_v.singh I enjoyed this more than I'd want to admit :)
 
Ah I see. Well where's that call supposed to go?
 
my webapi controller
which has this action
 
And is he rally recieving and answering?
 
[HttpGet]
public ActionResult<IEnumerable<Cars>> Get()
{
var result = _repository.GetAll();
if(result == null)
{
var message = "Cars List not found";
return NotFound(message);
}
return Ok(_repository.GetAll());
}
 
6:05 AM
@tahtoh ctrl + k it up please :)
 
You should debug that
 
it works
 
also that
 
but when i do it
from the ui
it doesnt get to it
 
!!tell tahtoh format
 
6:06 AM
@tahtoh Format your code - hit Ctrl+K before sending and see the faq
 
!!echo Squirrelkiller thank you ♥
 
So it works on your machine, but not on the server?
 
Squirrelkiller thank you ♥
 
@Squirrelkiller the webapi alone works yes
 
that was not my questio. Ok let's do this from the beginning.
Given the state where it doesn't work.
 
6:10 AM
@Squirrelintraining I mean you did admit it... But yeah as long as that puts a smile on peoples faces
 
Where is your WebApi hostet, and where is the UI hosted. Which framework does hte UI run on?
Btw I'll now commence the XY-ing
 
webapi projet on .netcore
its local
 
oh
 
6:12 AM
i get what you are getting into @Squirrelkiller
 
I sure hope so because I actually have work to do^^
self-hostet? IIS?
 
yes
 
Single project for both api and UI?
that was not a yes/no question
self-host OR IIS
 
@tahtoh Are you sure you are able to connect to the service and then it's failing?
 
self host
 
6:15 AM
One application hosting both api and UI? Or one application each?
 
thats what i found its hosting just the ui
 
@Squirrelkiller lies!
 
Ich lese alles!
 
Ich nicht!
 
ok @Squirrelkiller i think this is the problem
will try to resolve it
thanks for the hints
 
6:23 AM
morning 0/
 
Hi guys
public static IEnumerable<EnumDto> GetEnumDetails(this Enum enumName)
        {
            return Enum.GetValues(typeof(enumName)).Cast<EnumDto>().ToList();
        }
I'm having an error here
 
Do I really have to ask?
 
mr5
6:42 AM
@AppleCiderYummy are you sure that's the exact code you have? Cuz it's clear you are casting two different type names here
 
Working in programming one would Assume no workplace Injuries, just spent last 15 minutes dislodging cactus thorns from my left hand.... smh!!!
 
@Squirrelkiller Just don't
:D
@anand_v.singh gg wp
 
I want to get all the enums id and member name and put them in a list
I have this
sampe
public enum FruitEnum { [Display(Name="apple")]Apple=0, ...}
 
@AppleCiderYummy There is a great answer for this in a SO question.
1783
A: How to loop through all enum values in C#?

JaredParYes you can use the ‍GetValue‍‍‍s method: var values = Enum.GetValues(typeof(Foos)); Or the typed version: var values = Enum.GetValues(typeof(Foos)).Cast<Foos>(); I long ago added a helper function to my private library for just such an occasion: public static class EnumUtil { public s...

Just combine that with intcastings and ToStrings and other black magic and you are read.
 
ohayou
 
6:52 AM
Heyho Proxo
 
Thank you for that @Squirrelintraining it is very helpful
but I need to put an enum value type as a extension method signature
 
@AppleCiderYummy No broblem!
 
Because I want to create a usage like this.
 
@AppleCiderYummy Well that you can figure out by urself IMHO :)
 
can I show you my full code? @Squirrelintraining
 
7:01 AM
@Squirrelintraining HIIIIER KOMMT DU SONNE! fire wings in the background
 
I need to use the enumName
 
@HéctorÁlvarez hier*
 
but I'm having error if I put it inside the GetValues<enumName>()
 
@Squirrelintraining Thanks
 
@HéctorÁlvarez No broblem
 
7:02 AM
I don't speak germanovka
 
But rammsteinnovka
 
All I know came from Rammstein and Alarm Fuhr Cobra
 
@AppleCiderYummy what enum name?
 
'morning.
 
7:03 AM
@Hypersapien Too much salt :P
 
because I want to create a sample usage like this. var customEnumValues = UnitOfMeasurement.GetNamesAndValues() @Squirrelintraining
 
Proof yet again that programmers would make horrible cooks
 
But the problem is, my enum is a value type not a reference type
 
@HéctorÁlvarez I was in a club on friday that had a "Rammstein Night" all night only rammstein
 
7:05 AM
As much as I like Rammstein, that would be too much for me
 
@Squirrelintraining seems fitting, considering the night was called "Rammstein Night"
 
I know right
Totally confusing
 
what should I do? :/
 
Cry :D
I g2g
gl
 
@AppleCiderYummy The issue is that you're trying to add an extension method as a static method, to a type, not an instance.
 
7:07 AM
Start with the assumption that you can get anywhere from anywhere.
If you're in a labrynth and there's a wall in front of you, try a different way
You don't have to always tear down walls to get to your destination
 
@Neil lets agree to disagree
:p
 
@AvnerShahar-Kashtan I don't get it sir
 
@AppleCiderYummy why do you want it that way?
 
@Wietlol it must get tiresome beating down all those walls by hand after a while
 
7:12 AM
If I have an enum, say UnitOfMeasurementEnum, I can't add an extension method called GetValuesAndNames and call UnitOfMeasurementEnum.GetValuesAndNames(), because that would be a static method on the enum type.
 
@Neil I automated it
 
I could add an extension method to an instance - UnitOfMeasurementEnum.Meters.GetDescriptionAndThings().
 
I understand @AvnerShahar-Kashtan I thought it is possible hehe
 
@Wietlol you can't automate "getting from one place in the labrynth to another", which would be the meta-equivalent of writing a program that can write any program you want
but if you have, feel free to let me know.
 
it depends on what you understand with "wall"
 
7:16 AM
@AvnerShahar-Kashtan But you could do UnitOfMeasurementEnum.Kilometers.GetValuesAndNames()
 
you see, you have 2 kinds of walls
a... well... wall
 
Oh you already wrote that..
Sorry :D
 
and that thing that trump promised
 
@Squirrelintraining Yeah, but if you did that to get the values and names of all UnitOfMeasurements, not just Kilometers, it would be confusing.
 
@AvnerShahar-Kashtan True, but it would work
 
7:17 AM
UnitOfMeasurements.All.GetValuesAndNames()
 
@Wietlol .AsOneTrueEnum()
 
.Value
 
Just picturing myself writing all those extension methods, and the last callback being return null; //hehe
My mouth opened slowly as I grinned. It was one of those moments I'll treasure
 
maybe I'll just create multiple static methods like this
    public static IEnumerable<EnumDto> GetUnitOfMeasurementNamesAndValues()
    {
        var values = GetValues<UnitOfMeasurementEnum>();

        return values.Select(value => new EnumDto { MemberId = value.GetHashCode(), MemberName = value.GetDisplayName() }).ToList();
     }
 
Why not something like EnumHelper.GetNamesAndValues<T>() where T : Enum?
 
7:23 AM
I'll that advice @AvnerShahar-Kashtan
 
It's just like the GetValues<T> you already have.
(Also, using C# 7.3, you can add the generic Enum constraint to make sure you aren't passed in a non-Enum type)
 
GetValues<UnitOfMeasurementEnum>().AndNames()
 
I tried this @AvnerShahar-Kashtan
public static IEnumerable<EnumDto> GetNamesAndValues<T>() where T : Enum
        {
            var values = GetValues<T>();

            return values.Select(value => new EnumDto { MemberId = value.GetHashCode(), MemberName = value.GetDisplayName() }).ToList();
        }
But I can't find it on my enum
UnitOfMeasurementEnum.
can't find the GetNamesAndValues method
 
the function wont be an extension function
just a regular static function
 
Oh I understand
something like this EnumExtensions.GetNamesAndValues<UnitOfMeasurementEnum>();
 
7:30 AM
Yes.
 
or use static imports
and simply do GetNamesAndValues<UnitOfMeasurementEnum>();
 
If you use static imports, give the method a better name.
 
^
 
That's what I dislike about static imports. A lot of times, a method name makes sense in the context of the type it's defined in, it's part of its full name.
With static import, you lose that context.
So yeah, Cos or Abs are meaningful enough without the Math prefix. But Parse? Not so much.
 
can you not do a static import for every namespace except the last?
 
mr5
7:33 AM
How about Body.Abs?
 
@mr5 Why? How else would someone interpret Abs method?
Thought everyone used that
 
Another question guys, what is the bad side of using static method?
is it bad?
 
mr5
I'm talking about the buffed abdomen of human body. From where I came from, when you say abs, we automatically assume you're referring to six-pack abs
 
@AppleCiderYummy It might sting you with electricity.
 
@AppleCiderYummy it's just another tool in the toolbox. And like every tool in the toolbox, you don't attempt to use it for everything
 
7:36 AM
Aw @HéctorÁlvarez is it figuratively? or literary? haha
 
I understand @Neil thanks for that
 
@AppleCiderYummy sure
 
mr5
@Neil lol
 
thank you guys, @Squirrelintraining @AvnerShahar-Kashtan @Neil @Wietlol @HéctorÁlvarez
 
7:37 AM
Literally, I have a static class that I use to avoid people touching my screen with their hands. You know they leave fingerprints and stuff I dislike so I load up the static class and they get a nice zap when they try to reach for it.
 
@AppleCiderYummy Nothing wrong with static methods. But you'll have to consider how to fit it with OOP concepts. Static methods are methods on a type, not an instance.
 
hahaha that's static electricity @HéctorÁlvarez
 
How did you know? static Electricity() is actually the name.
 
Thanks for that @AvnerShahar-Kashtan and also I didn't know this is possible EnumHelper.GetNamesAndValues<T>() where T : Enum now I know
 
They're often abused when you say "oh, I just want everyone to be able to get to this method", which usually indicates that the writer doesn't have clear understanding of OO or any other methodologies, and this leads to tightly coupled code, dependencies that shouldn't be dependnecies and many other proven, known problems.
@AppleCiderYummy It's pretty new. Not generic constraints themselves, but specifically the ability to constrain a generic type parameter to be an enum type.
 
7:39 AM
I understand. Now there is saying, "too much is bad"
 
yep, I suppose you really only get into trouble when you try to use a static method which has a state or you try to make non-static methods work like static methods
 
On a serious note, for me static classes were very comfortable to use, then I used them and soon enough suffered the consequences. It's the kind of thing I learned by doing and not by actually reading somewhere.
 
people coming from backgrounds like VB tend to use a lot of static methods
@HéctorÁlvarez Not to say you came from that background, just making an observation
 
@Neil Damn right I didn't, I came in this direction, not from. I started with Java and PHP, moved to C# and JS/jQuery, then eventually landed in no-man's code here.
 
I clearly understand now. If I'm not mistaken, I read somewhere that static method is anti pattern
 
7:42 AM
Well don't let that gibberish confuse you, Singleton is actually a design pattern based on static stuff.
 
singletons can get you into trouble
 
Just don't abuse it. There are moments where it's fine, others when it's not. Generally you don't judge it by "Should I use static names here?" but rather "Is it gonna hurt me to make this static in exchange for the time I'll save thinking an actual way to do it?"
 
using a lot of static methods is considered a code smell - meaning it isn't necessarily bad by itself, but that it's usually an indicator of actual problems.
 
You end up with your entire program being dependent on that singleton
any class like that is bad, singleton or otherwise
 
Like components that are too tightly coupled, static singletons that can't be replaced easily, methods used by too many components that grow to fit too many use-cases, etc.
 
7:44 AM
1866
Q: What is so bad about singletons?

Ewan MakepeaceThe singleton pattern is a fully paid up member of the GoF's patterns book, but it lately seems rather orphaned by the developer world. I still use quite a lot of singletons, especially for factory classes, and while you have to be a bit careful about multithreading issues (like any class actuall...

 
I don't mind using factories which reuse instances
 
The top answer there mostly applies to static singletons, though.
 
at least the factory instance is non-static
and you also don't have any clue that the instance is being reused in theory
 
If I have a dependency injection framework which injects a service, there's no problem with that service being a singleton - in fact, many of my services are singletons. But as far as its consumer it concerned, there's no difference in usage between a singleton and a multi-instance service.
For things like your EnumExtensions.GetNamesAndValues, static methods are usually just fine. These are entirely technical methods that revolve around the nitty-gritty mechanics of the type system and framework. You won't really have much cause to replace and switch it around.
But if, for instance, you had MyDataRepository.GetItems() as a static method used anywhere that needed that, you would be setting yourself up for trouble.
 
@AvnerShahar-Kashtan It's a non-issue because switching one service for another is trivial with DI
it sort of eliminates the problem of creation of an instance, and all the baggage that comes with this
 
7:52 AM
@AvnerShahar-Kashtan Can you elaborate on this?
 
any class calling MyDataRepository.GetItems() would be necessarily and directly dependent on MyDataRepository
whereas with DI, you're only dependent on the interface, which can be switched out easily
 
Morning#
 
also the method would strongly seem to suggest that it is stateful and stateful and static is bad
 
mr5
The service lifetime is already determined upon registration right? Do you know any frameworks where this can be configured in the parameter injection? Perhaps, like an attribute added to the service as parameter itself.
 
most DI frameworks let you provide parameters
 
7:56 AM
@mr5 Do you mean that the service can determine its lifetime? Mark my service to be registered as a singleton automatically?
That kinda goes against the point of separating the concern of managing the lifetime from the service to the DI repository.
 
@Neil isn't DI meant to actually make this transparent? If I'm not mistaken you can simply register a new type and it should automagically choose for you later.
 
mr5
@AvnerShahar-Kashtan no. I mean upon registration like: .RegisterSingleton<IService>(), .RegisterTransient<IService>(), ...
 
@HéctorÁlvarez It makes the initialization and assigning of the instance transparent
you still need to establish an interface so you know how to use it
 
Oh wait you mean swapping the interface and not the registered object.
 
I don't think creating a second implementation of an interface is automatically handled, or if it is, the one it chooses is somewhat arbitrary
the interface stays the same, you change the implementation
 
8:00 AM
@Neil Not arbitrary, usually. The last one to be registered is the current one, which makes sense, because it allows you to override previous registrations, for instance in a unit test project.
 
@AvnerShahar-Kashtan I guess that'd make sense
 
Also, depending on the DI platform, multiple registrations of the same interface can be retrieved at runtime - say, resolving IEnumerable<IPlugin> to get all plugins registered, not just the last one.
 
Right, that makes sense to me, otherwise DI hold little real value here.
 
mr5
I'm kind of imagining a situation where multiple registration of the same interface would be problematic, like, there would be a missing signature with its parameter.
 
Although I haven't seen any platform that lets me select all the registered components
 
8:05 AM
the creation of an object has always been problematic in OOP
since often, you won't use an object where it is created
and that's kind of the point of inheritance many times
 
mr5
I'm thinking it could be solved by a named attribute:
ViewModel([ServiceName("FirstService")] IService service)

and in the registration part:

.RegisterSingleton<IService>("FirstService");
.RegisterTransient<IService>("SecondService");
 
DI kind of eliminates that problem entirely
 
@Neil I don't quite understand this.
 
mr5
Bekræft din email (Danish)
Can you guys confirm is this is an appropriate translation of "Confirm your email"?
Any Danish here?
 
When I used DI it didn't change anything for me regarding using it on creation or not.
All I did was request Unity an instance I could use to handle my issue without instatiating and configuring it myself.
 
8:13 AM
question... Do you have any kind of documentation for projects you work on?
 
@HéctorÁlvarez if you use DI, you're in the scenario of "not using an object where it is created"
 
mr5
@Proxy we only have specs
 
what kind of specs?
 
you need an instance of something to use, and you care not how it is implemented
If you also care how it is implemented, then your class is tightly coupled with that class
but usually that's not the case
 
@Neil Right, so how does DI eliminate this problem exactly? AFAIK you load the dependency lazily and wait there until someone calls you to use it, then you pick the one you need and call the caller to inject it.
 
8:16 AM
@HéctorÁlvarez You provide general rules on how to select an implementation, and whatever class needs it, it doesn't have to perform any logic in that regard
 
morn
 
Nor do you need to create factories and/or singletons in order to generalize that creation logic everywhere you need it
Using an instance of Repository and creation of MyDataRepository with 3+ parameters are entirely and completely separated in your program
that's what DI does for you
 
Wait I think we're discussing 2 different things.
I mean 2 people can't argue and agree all the time for so long.
 
DI = Dependency Injection
 
Let me quote real quick...
> since often, you won't use an object where it is created
and that's kind of the point of inheritance many times
DI kind of eliminates that problem entirely
 
8:19 AM
In what way are you creating an object when you have an implementation of Repository interface in your class?
 
I thought you meant DI eliminates the problem of not using an object when it is created.
 
no.. clearly you intend on using the class..
you just don't know/don't care how it is created
"you won't use an object where it is created" => "creation of an object and its usage are separate"
 
Oh god that explains it
 
sorry if I was unclear
 
mr5
8:21 AM
@Proxy technical specification of the project. It includes the estimates, cost, and technologies to be used.
 
It was like that literature class: "The sky is blue --> The author meant he was happy and he also likes strawberry juice"
 
Fortunately, I wasn't in that class
 
how "big" is the document?
also does it provide any overview about the application and functionality? @mr5
 
mr5
@Proxy nope. it only describes the behavior of each module
how big? it depends on the number of feature it has.
 
can you elaborate a bit?
the thing about each module
well if you want to :)
 
8:27 AM
@Neil Yeah I always wonder if it was this kind of teaching that lead people to think "People have rights --> The right to stab and shoot other people dead, thanks literature teachers"
 
you have something like an email module, and you describe what it does?
 
mr5
for example:
LoginScreen
- Username field: Max 20 characters
- Password field: Contains alphanumeric characters with a minimum of 8 characters and maximum of 100
- ...
 
As a matter of fact, teacher and cheater are anagrams of each other. coincidence? I don't think so.
 
mr5
But the description is usually detailed/longer than that
 
I was in a literature class where we were obliged to read this 19th century "fluid consciousness" crap that was hard to digest in under a week, and in the test, they asked what the name of the dog was.. and that would have been mentioned like, what.. once in its entirety..
It wasn't a major plotpoint whatsoever, but apparently it was supposed to just test the fact that we actually read it.. I read it and I didn't know that answer
 
8:30 AM
i see
 
Bad test. I don't think I ever had a literature test where minor plot points were ever asked.
 
well i do not okay :)
 
In college, anyway. I don't remember any highschool literature classes.
 
thanks @mr5
 
mr5
👍
 
8:33 AM
We occasionally used to have "reading comprehension" tests at school. I couldn't understand why we did them or what the point of them was, because it was like...the answer is literally written on this piece of paper you've given us, what is this testing
 
@TomW I think you seriously underestimate the number of people who simply will not read unless forced, and will not understand what is written if not pushed.
 
I understand that now
 
mr5
@Neil I feel you. The worst things are remembering the exact dates together with what events happened on that date.
 
@AvnerShahar-Kashtan You are so lucky.
 
It would have shaken my faith in reason itself as a pre-teenage child to have known what I know now, from work, about the reading ability of apparently fairly intelligent professional adults
 
8:37 AM
I had lots of question like that, my teachers had the false belief that in order to make sure someone knew 100% of the concepts you had to know the details by heart.
 
@mr5 I hated history in high-school. The memorization of dates and events. And then I somehow stumbled into studying history for my BA and discovered how fascinating it is when taught properly.
 
This was why I liked science subjects. If you understand it, you don't need to remember.
@AvnerShahar-Kashtan At least if asked to remember which year there was a war in the middle east, you can pretty much just pick any year
 
I enjoyed history, but only because I was interested in what happened
In history, I found they cared way too much about when it happened rather than the why
 
I particularly recall my first test about plants when I was a kid, we just learned about the parts of plants, something as simple as leaves, roots, etc. and the first question was "Latin name of the common rose" implying the little brown boxes with pointless information were more important than actually knowing plants breathe CO2 and spit O2 out.
 
I could never remember the dates
 
8:40 AM
@TomW Yeah, those are the easy ones. Ask about "On which year were no hostilities in evidence in the middle east", that would be a rough one.
And generations of kids finish high-school thinking that history is the memorization of dates. Such a pity.
 
I was always good in subjects where it was about understanding, not about memorization
 
Dates of wars and coronations of monarchs didn't seem to be too important when I learned history at school to be fair, it was a lot more contextual
 
mr5
@AvnerShahar-Kashtan I am following this political scientist, who is natively Filipino but graduated somewhere in Netherlands. His use of dates&events on his writing is very fascinating. I am learning a lot on our history because of that.
 
Most colleges tests I had in history let you bring the textbooks with you.
 
But then the frustration was just like
 
8:41 AM
It's not that dates aren't important - it's just that memorizing them isn't.
 
Can you shut up so that I can read
 
if anything, tell me when something happened in history in the context of something else relevant that happened not long past
 
Just like asking programmers to write code on a whiteboard in an interview, and tsk-tsking when they forget semicolons.
 
Writing that in March 18th, 1556, something happened
That's in my brain and out the other side.. I'd have already forgotten what date I wrote if I didn't have it written in chat
 
mr5
> tsk-tsking
how do you pronounce this?
 
8:44 AM
@mr5 It's pronounced "tsk tsk"
 
"tisk tisking"
 
I hate VB.NET and how its Module is similiar but not the same as a static class
 
@mr5 Flogging with reverb, or echo whip, depending on the distance between tsk instances.
 
mr5
it sounds like "chick chicking"
 
Task<Task<Ing>>
¯\_(ツ)_/¯
 
8:57 AM
@Wietlol You are tasking.
( ͡° ͜ʖ ͡°)
 
a task
 
Ok so I was going through this docs.microsoft.com/en-us/dotnet/csharp/programming-guide/…, If I understand correctly streaming would start pushing results while running the query in the background, but non streaming will wait for the query to complete and then make the results available, how is Except() in both and how to use the different versions of them??
 
@CaptainObvious Module actually makes more sense, because static classes aren't really classes, they're usually used as logical groupings of static methods - or, you know, modules.
 
Even GroupJoin, Join and Intersect fall into the same... Is this really confusing to you guys as well or did I f**k something up understanding these?
 

« first day (3145 days earlier)      last day (1786 days later) »