« first day (2749 days earlier)      last day (2193 days later) » 

2:00 PM
BackgroundWorker is pre-Tasks and certainly pre-async/await, so you probably can't await on both the queue and the CancellationToken.
 
Thanks. The queue is a Kafka queue if that matter. The waiting for a new message is not blocking. If you're interested here is some simple example code to clarify my situation:

https://paste.ee/p/aCFA3
In my opinion it would have been very useful if BackgroundWorker.CancellationPending was an Observable
 
@DoubleTrouble Well, BackgroundWorker is an API from 2005 that is pretty much obsolete.
 
Oh, what are the modern alternatives?
 
Check me on this. Service References aren't something that should be used nowadays, right?
 
Tasks, mainly. They run asynchronusly. The can send updates via IProgress and be canceled via CancellationTokens (similar to the CancellationPending - it's still the task's job to quit).
 
2:12 PM
I'm taking over a file parsing/processing app from a prior dev, can someone take a look at this and tell me if I'm right in thinking this might be a bit overdone? The app is meant to watch a filesystem for adds and then call the Add method to kick off processing. This is supposed to happen in near-realtime.

https://gist.github.com/rjhoffmann/25c0de1f85fe0c449457b732dc22f5e2
 
Hello. Anyone know if it's even possible to setup a DirectoryServer with c#?
 
It works as is, but I've never done anything with system.threading before, so I don't know how to evaluate it.
 
The fuck is a directory server?
 
Point me in the right direction is basically what I'm saying.
 
Hmm, is it possible to add an attribute to the ViewBag on every view in my application, without having to do so manually in every controller in the application? I need ViewBag.currentUser on pretty much every page.
 
2:15 PM
Well there is a thing called LDAP (Lightweight Directory Access Protocol) which handles for example users on the domain
 
I'm starting a new web application project that will need to talk to our backend api. Is WCF something I should avoid using?
 
I want to create my own directory
 
stackoverflow.com/questions/5453327/… looks relevant to my interests...
 
@AvnerShahar-Kashtan Thank you @AvnerShahar-Kashtan for your advice
 
@Slipfish Well, if it weren't all double-spaced it might be a little more readable
also the while(true) isn't.. ideal
 
2:20 PM
I looked at the while(true) for a while, it breaks when the file is finally read. I'm thinking of putting an upper limit on attempts though.
 
if the point is to stay running, it's a service
if it's a service, there are better ways of keeping it up
if it's supposed to just check 3 times, better to not use while(true)
just seems hacky to me
 
It's a service, the service kicks off a FileSystemWatcher that calls the Add method linked when a file is created.
I guess the idea was to guard against any waiting, this is meant to process hundreds of files a minute.
Thus all the Task.Run calls I guess?
 
2:37 PM
Is it possible to create an anonymous type that has all the same properties of another type, plus some additional properties? Something like var x = new { foo = 23 }; var y = x + new { bar = 42 };. Then y is equivalent to new {foo = 23, bar = 42}
 
Not that I'm aware of
That's a very dynamic typing sort of thing
We don't hold with that sort of malarkey around these parts.
 
I ask because DisplayFor lets you specify html attributes by passing in an anonymous type with the attributes you want to change. I have a Display Template for my user type, which ideally would take the anonymous type passed in via DisplayFor, and add an alt text attribute on top of that.
I'm not sure display templates can access the arguments you pass in to DisplayFor to begin with, so maybe this is just straight up impossible even if I could glue anonymous objects together
Rather, it's possible to pass in the type to the display template, not necessarily possible to concatenate types
 
what is T in generics?
 
@TusharTyagi Don't tell me you don't know what the GAC is.
 
@erotavlas The normal name for a type parameter, you mean?
 
2:52 PM
I mean, you're having trouble with assembly references, you should know the GAC first and foremost.
 
Looks like the additionalViewData object gets turned into a ViewDataDictionary by the time it makes it to my display template. Maybe I could extend ViewDataDictionary with a method that lets me add additional key/values to it. Then in my display template I could do @Html.DisplayFor(m => m.Name, ViewData.PlusAttribute("title", "whatever"))
 
@KendallFrey yeah I tried to pass it a Type but it wont allow me
 
huh?
 
Type test = ....
mygenericMethod<test>()
 
@erotavlas An index out of bounds exception.
 
2:54 PM
I don't know the type until runtime
 
generics happen at compile time, so that can't work
 
that sucks
 
@KendallFrey it can work
but only with reflection
 
You'd need reflection to do that
 
it should work easier than with reflection imho
 
2:55 PM
@erotavlas That's a compiler error.
 
myGenericMethod<T>() T here should be a variable of type Type
imho
 
And a compiler warning, for not complying with dot net notation.
 
it says 'test' is a variable but it used like a type
that's right compiler warning
 
@erotavlas What's the question then?
 
what do I put inside the <> brackets
 
2:56 PM
Come you just gave yourself the answer, read carefully.
I trust you buddy, you can do it.
 
what are those .... in your example?
in simple terms, you are only allowed to do this kind of thing with compile-time knowledge
 
@Wietlol Irrelevant. He already has the answer there.
 
so, your types should be known at compile time
 
I tried <typeof(test)> ?
 
@erotavlas which evaluates as...?
 
2:58 PM
you cant know a value of a variable at compile time except if it is a literal or the result of a compile-time-invoked function
 
@Wietlol We're agnostic about the value in this example (Unless I missed something).
 
well in this case I don't know it for sure....its a plug in based app and I read the types from a folder
 
i see
could be a questionable approach, but still
@erotavlas you could try searching how to invoke the method via reflection
then you can explicitly set the value of the generic type parameter
 
We've still not found out what th put inside the <>
 
nothing, its not possible if it requires knowing it at compile time
 
3:02 PM
@erotavlas You don't, you need some kind of dynamic typing
 
I don't know....sounds too complicated
 
Well, back up a bit
Why are you trying to late-bind generics?
 
yeah that's a good question lol
because I was trying to serialize a concrete object using DataContractSerizlizer but it wouldn't serialize it as the concrete type...it keeps serializing the abstract class which has no DataMembers defined in it
 
why are you serializing by compile time knowledge?
that sounds stupid
 
so as a workaround I decided to make my serializer method a generic so I could pass the exact type into it
 
3:04 PM
deserializing, I can see
serializing, no way
 
well I have these plug in loaded in memory...I need to serialize their settings back to xml
 
Normally when I serialize I know the type at compile time
 
Sounds like a lot of Xs for the single Y.
How did you design your serializer to be able to be able to serialize an unknown object?
 
well I know the type I'm serializing...otherwise another option is to cast it as the type before serializing.....but I couldn't figure that out
 
@KendallFrey then you havent done a lot of serialization in combination with polymorphism right?
 
3:07 PM
        public static string Serialize(object myObject)
        {
            var serializer = new DataContractSerializer(myObject.GetType());
            string xmlString = string.Empty;
            using (var sw = new StringWriter())
            {
                using (var writer = new XmlTextWriter(sw))
                {
                    writer.Formatting = Formatting.Indented;
                    serializer.WriteObject(writer, myObject);
                    writer.Flush();
                    xmlString = sw.ToString();
 
You're not even using T, why is it there?
 
crap forgot to remove that
 
@KendallFrey My thoughts exactly.
!!xy
 
In MVC, if you want to serve a 404 page, you can return HttpNotFound. Are there similar helper methods for other kinds of http codes? I want to return Forbidden if a user tries to navigate to a Delete page for a widget that he doesn't have permission to delete.
 
3:10 PM
i dont see where <test> shoud pop in
 
Or should I just not bother and return HttpNotFound for forbidden actions?
 
well that was when I was trying generics to solve my problem...so I scrapped that now
 
Fuck oracle, I'm going home.
 
"myObject.GetType()" will always get the lowest type (aka, the type where the "new" was called on)
 
So my next question id is it possible to cast an abstract type as a concrete object at runtime?
 
3:12 PM
You can't cast a type to an object in general
 
sure, but that makes very little sense
 
Can you be more specific?
 
Type type = ...; type.Cast(obj); no?
or something similar
maybe in C#, this is actually really stupid
 
well I think the problem is this

myObject.GetType()

in the serializer method above....its getting the abstract type...but I need it to recognize the concrete type
 
GetType() can never return an abstract type
 
3:13 PM
@erotavlas I don't believe you
 
it was just a theory
 
Give us facts
 
GetType() returns the lowest type, and the lowest type of an instance can never be abstract
 
geez I think your right
 
yay
sense
 
3:23 PM
you're*
 
is there something better than datacontract serializer?
I almost feel like converting to JSON instead of XML
 
@erotavlas JSON.NET
 
yeah that's a good one
 
Newtonsoft is flawless.
 
4:06 PM
why is my answer downvoted? https://stackoverflow.com/questions/49885226/open-locked-file-with-openxml-in-read-only-mode
I have fully tested my answer and I'm 100% sure that the code I provide works.It is a pity that no mandatory reason has to be given for a downvote
 
@GenericBot You have no answer there
 
Sorry but that's my answer, but there is something wrong I think, I'm this user stackoverflow.com/users/7973101/antoon-verroken but if I go to the chat I'm now GenericBot, It's incorrect.
I think I need to contact SO for that issue.
 
Oh No, I have my again logged in SO and go the chat and now I'm again an other user.
 
the shit is going on in here
@GenericBot forcing comments on down votes has been discussed ad nauseum, it's not gonna happen
People vote for whatever reason they vote for and that's the best you're gonna get.
 
@MikeTheLiar Thanks for the information
 
4:21 PM
I'm confused as to whether one or both of you are bots or are being operated by meatbags.
And now the user that GenericBot is claiming to be is here.
Is this universe A or universe 1?
 
Using ASP.NET MVC Core or MVC5, what's the benefit of using Display and Editor Templates?
 
Berenstain or Berenstein?
 
Now I'm here with the correct user, I have tried again for log in to chat, yes the previous message came from me (GenericBot and Natty - thats not me)
 
Wait, now you're saying you're all three of them?
Is Nelson Mandela alive in your universe?
 
Anyone got experience with setting up Elmah for emails in child apps?
 
4:27 PM
@MikeTheLiar bare and stained
 
Yummy
 
I'm getting double emailed for some reason. And if I change the section names, I get no emails whatsoever.
 
@AntoonVerroken Epic trolling man. Well done.
 
@JoeCuevas I use display and edit templates in my MVC project when I need to display/edit my User type. My User class has properties name, id, and email; but when it's displayed, I only want it to show the name. So I wrote a display template to do just that.
If I didn't have a display template, it would show all three properties. Not pretty.
When someone edits a user field, I don't expect them to know anything other than the name of the user; so I have an editor template that renders a dropdown list of the ~20 users registered in the system. The name of each select list item is the user's name, and the value is the user's id. If I didn't have this, the client would have to know the name, user id, and email of the user they wanted to enter.
I also have an editor template for an enum field, because the built-in editor for enums doesn't display the DisplayName of each option.
 
4:48 PM
@Kevin, Thanks for the clarification!
 
I only started using MVC a couple weeks ago, so there's probably a bunch of other use cases I haven't thought of
And/or the use case I've got is better solved with some different approach. Take my advice with a grain of salt.
 
5:25 PM
Is FormsAuthentication obsolete? I'm trying to set up a login site and I'm getting conflicting instructions from google
I'm using the default VS MVC site, but I'm not sure what the correct, best-practice way is of storing user details and ensuring that Request.IsAuthenticated returns true.
 
Does IEnumerable represent in-memory collection?
 
@MohamedElshawaf no
 
I was expecting "yes", then I ask, "So why it supports deferred execution?"
 
So List<T> is only the in-memory collection in .NET?
 
5:36 PM
What the heck are you talking about
 
hello frnds
i make a question very hard
can u help
 
Anything you have to new() up is gonna be in memory- that's what new does. An IEnumerable is going to have something in memory behind it (or it could be null, I guess).
 
@MikeTheLiar
 
Did you know that the sooner you ask your question, the sooner people can answer it
I think Sun Tzu first noticed that in History Times
 
don't tell me how to live my life
only mike can answer it
 
5:41 PM
@Grace do tell
 
About Sun Tzu or about IEnumerables?
 
SUn Tzu
 
@MohamedElshawaf No
 
InternetExplorernumerables
 
On this line: FormsAuthentication.SetAuthCookie(user.UserId, true);
I keep gettng "Object reference not set to an instance of an object. "
 
5:45 PM
something is null. what is it?
 
When he wasn't stating obvious things about war, Sun Tzu would always go around saying things like "Set the debugger and see if user is null"
It didn't make it into the history books for political reasons, but he said it.
 
SetAuthCookie is a static function. And I checked. UserId has a value.
 
Do you get a stack trace?
 
Why the fascination with sun tzu?
 
The last line in the stack trace is System.Web.Security.FormsAuthentication.SetAuthCookie(String userName, Boolean createPersistentCookie, String strCookiePath) which I assume is being called internally
 
5:51 PM
!!tell ndugger praise
 
@ndugger \[T]/
 
@MikeTheLiar I have a question for you
 
11
Q: FormsAuthentication.SetAuthCookie throwing NullReferenceException in async action

TomI am finding that FormsAuthentication.SetAuthCookie is throwing a NullReferenceException - Object reference not set to an instance of an object inside an async action on an azure website. I found the following: http://connect.microsoft.com/VisualStudio/feedback/details/743350/formsauthenticatio...

Is this your problem?
 
@ndugger Mike knows much, tells some. Mike knows many things others do not.
 
@MikeTheLiar will you marry me?
 
5:56 PM
@ndugger will you kill my wife so I can collect the insurance money first?
Wait
First
Are you cute?
 
I'm fat and sassy
 
.....are you a older white woman from Tennessee?
Do you make soups and breads?
 
On top or on the bottom?
Eh, doesn't matter
You look outdoorsy.
@ndugger your website is broke
How am I supposed to cyberstalk you like this?
 
6:05 PM
I can't fap to this.
!!giphy cant deal with it
 
@MikeTheLiar it's not broken; it redirects to rebecca.blackfriday
 
@ndugger be a wonderful person right now, that's not the one I'm talking about
 
6:36 PM
oh, I forgot about that one
yeah, that's been dead for a long time
azure is garbage
 
So when are we getting married?
 
@KendallFrey @MikeTheLiar Regarding those two messages, it was an error on SE side which caused that issue. I think @ndugger from this room was also affected by that issue. It has now been fixed by them.
(and cc @AntoonVerroken)
 
wtf lol
 
The logins were mixed.
 
That seems like a not-ideal situation.
 
6:39 PM
@MikeTheLiar You truly have a gift for accurate descriptions
 
To put it another way
That seems like a giant fucking bug
Like, MIB giant
 
just an giant ordinary bug, I hope
 
!!giphy sugar water
 
Not when I'm done with it
!!giphy like an edgar suit
 
wat
??
lmfao
 
RG is even worse when filtered through Cap someone.
 
did you watch the whole gif
i exited on like second one
im glad i went back and watched it
 
Wait, this is different from what it originally gave
When I viewed the gif on Lemon's site, it was different
 
@BhargavRao I was confused about how I ended up in a room and somehow sent a message that I never typed
 
6:45 PM
@ndugger I ended up in another room as well.
 
10/10 software
 
I just hope some other guy didn't end up in my account, and use mod tools weirdly
Nah, just dev-on-prod things.
 
7:02 PM
Jay Hanlon on April 26, 2018

Let’s start with the painful truth:

Too many people experience Stack Overflow¹ as a hostile or elitist place, especially newer coders, women, people of color, and others in marginalized groups.

Our employees and community have cared about this for a long time, but we’ve struggled to talk about it publicly or to sufficiently prioritize it in recent years. And results matter more than intentions.

Now, that’s not because most Stack Overflow contributors are hostile jerks. The majority of them are generous and kind. Sure, a few are…  just generous, I guess? But our active users regularly express thei …

 
lol, feeds
> StackOverflow is racist, because someone hurt my feelings on my jQuery question
 
It's just that jQuery is garbage.
 
Dude even gave his blog post a picture of some lego dude in a unicorn costume
I think he needs to take a break
Comments are disabled; typical.
 
I'm pretty sure that's a sex toy of some description.
@ndugger that's handicapped-phobic, shitlord
 
> but the answerer gets scolded for “encouraging ‘low-quality’ questions.”
heh, I do that
Especially these 100k+ rep tards that go around just copy/pasting shitty jquery snippets as their answers
 
7:11 PM
You do that but you just call it work
 
We don't use jquery here, poopface
 
Maybe you should start
It'd make it so much easier to leak your customers' credit card data.
 
> I’d like us to aim for something closer to what Jon Skeet told me about his experience attending a pride parade (as a cis straight dude)
ugh
can we delete stackoverflow
 
I'm curious as to what's so objectionable about that.
 
> We should be more like <name drop> when he went to <event that makes us sound good>
It's not the content, it's how it was presented
I fail to see what some random dude going to pride has anything to do with a professional programming Q&A site
 
7:15 PM
I feel like you might be missing the point of this blog post.
 
He is the point, probably
 
Also explains it in literally the next sentence.
@KendallFrey I think you might be on to something here.
 
I don't care what someones orientation or skin color is; it's a site about programming. It's completely irrelevant
 
You're doing a spectacular job role playing the tech bro who completely misses the fucking point.
 
@MikeTheLiar he talks about feeling included, but being included at pride has nothing to do with a programming website. It could have been any event that he went to, like a cooking class, or his nephews barmitzvah, but they chose pride because of their political agenda, and trying to make themselves seem cool and progressive
 
7:18 PM
I point you to my previous comment.
And careful with that edge.
 
What edge?
I'm simply saying that they're obviously taking a social stance to seem a certain way, when stack overflow has nothing to do with people's orientations, skin colours, gender, etc. I don't see a connection
 
You're active in what are probably the two most toxic areas of SO (here and JS) and you don't think it's relevant?
 
I haven’t found anyone in either rooms bashing people for their sexual orientation or gender
 
Let me know the next time trans people come up
Or how frequently it's implied that a lack of masculinity is somehow wrong
 
Meh. All culture is arbitrary.
 
7:24 PM
I’m probably one of the least masculine dudes in the js room. I’m not into a lot of the prescribed “manly” things these days
 
what kind of manly things are prescribed?
 
Cars, guns, lots of women, not takking about feelings, uhhhh
 
Probably something having to do with bench pressing different things.
 
Maybe I want to plant flowers in my yard, you know
 
7:43 PM
@ndugger Jhawins was literally just complaining that he couldn't call people gay without getting banned before he deleted it
So...
 
Yeah, but that's jhawins. We kind of all know that he, specifically, is toxic. But one bad apple doesn't justify their political stance. It'd be like one tweaker at the bus stop being used to justify my own bias
 
How can I set on a WebBrowser control the Document Mode when I use websites which doesn't tell the client to use a specific document mode?
 
@ndugger "not all SO members"?
 
more like, "Just Jhawins"
There's a reason I have him ignored
you're more than free to do so as well
 
7:59 PM
Question, are structs really useful?
as in, would you miss them if they were gone?
 
answer, yes
and no
 

« first day (2749 days earlier)      last day (2193 days later) »