« first day (2110 days earlier)      last day (2844 days later) » 

6:00 PM
I can't figure out how to parse this date "07/26/2016 11:25:00 AM CST" using "MM/dd/yyyy hh:mm:ss tt 'CST'"; why the actual hell isn't it working?
 
does the 'CST' part at the end make any difference?
If you remove it I mean
 
@NorthbornDesign what about it isnt working?
what's the code you wrote?
 
I've never seen the single-quote part in a format string before
 
user47589
using single quotes inside a format string is only needed when the text inside the quotes matches a format.
 
i don't think single quotes are needed
 
6:03 PM
@TomW I'm just trying to avoid the timezone identifier
One sec.
 
by 'avoid' what do you mean?
 
user47589
if you can dodge a timezone modifier, you can dodge a ball
 
When you gaze long into a void, a void also gazes into you.
 
6:04 PM
Trace.WriteLine(DateTime.ParseExact(value, "MM/dd/yyyy hh:mm:ss tt 'CST'", CultureInfo.InvariantCulture));
Where value = "07/26/2016 11:25:00 AM CST"
 
user47589
@RyanTernier 's fiddle works
 
Yep, it does...
 
But what about his violin?
 
What the actual fuck?
 
@NorthbornDesign is CultureInfo.InvariantCulture a IFormatProvider?
 
user47589
6:07 PM
@NorthbornDesign what version of .Net are you using?
 
user47589
@Michael yes it is
 
@Michael Yea, but I've since used null
 
user47589
IIRC passing null is the same as using the Invariant culture
 
@NorthbornDesign It's a common fact computer systems like me. It seems whenever one of my devs have an issue and I come by, it's automagically fixed. Maybe PC's are scared of me, or maybe my unbridled manliness causes them to fall in line.
 
user47589
6:09 PM
the only thing i can think of is you have some hidden unicode characters in your string preventing a match
 
Amy is most likely correct. THere could be one of those ugly spaces... that aren't spaces... but look like spaces and make non-developers really angry when dev's say "that's not a space"
 
user47589
i suggest turning the input string into an array of characters and inspecting the result
 
@RyanTernier My beard touches my nipples, my manliness is beyond unbridled.
@Amy I'm dumping it to hex, and checking.
 
user47589
oh myyyy
 
Just an array of characters? i'd turn it into hex and examine each one. If that yielded nothing then run a hash check against each characters ensuring the MD checksum is correct, then turn it into ASCCI => Unicode and run it through another parser. DATES MUST BE VALID.
 
user47589
6:11 PM
array of characters should be sufficient. the invisible unicode chars will show up
 
you're no fun :(
 
user47589
i know
 
Beard wars again?
 
!!urban beard
 
@mikeTheLiar Beard Any opposite sex escort taken to an event in an effort to give a homosexaul person the apperance of being out on a date with a person of the opposite sex.
 
6:14 PM
YOU MIGHT BE CALLED A NON-BREAKING SPACE, BUT SO HELP ME FUCK I'LL BREAK YOU YET!
 
wtf.
I think @NorthbornDesign Found the problem
 
Thank you folks.
 
Doesn't it feel good to let out? SCREAM it from the mountains. YOU DAMN NON-BREAKING SPACE! DAMN YOU TO HECK.
 
user47589
 
I used to curate a bunch of spreadsheets that made their way into a master data store
 
6:16 PM
@RyanTernier Why the minced oaths?
 
The random non-latin crap that ended up in those...
 
@RyanTernier why did you buy 12 loaves of bread?
 
This place made me and my programmer buddy laugh nops.co.uk
Funnily enough his gf did not get it
 
inetpub and Grill
 
6:22 PM
What's with CDN's just giving a 404
have had to change one cdn twice in two weeks
 
user47589
my company blocks some CDNs
 
fuck you
 
user47589
that's blocked :)
 
@TomW that's an appropriate image
 
@Amy I bet if you query this the answer will be that it's "for security"
 
6:26 PM
Ah yes, good ole "This XML file does not appear to have any style information associated with it. The document tree is shown below."
 
user47589
yeah
 
Truly classic
 
There is on lib I don't want to pay for as it's a company project not mine, so using the free CDN
OR MAYBE i SHOULDN'T HAVE SAID THAT OUT LOUD
oops caps
 
Do you and I have the same understanding of what a CDN is?
 
a content distributor network, that hosts js and css files
 
6:27 PM
Crumpet Deliciousness Notification.
 
so they can be served to the client quickly?
 
@GrantHill This Crumpet is Delicious
 
Yes that sounds right. But why would you be able to get a paid product off it?
 
Consider yourself notified.
 
Thank you!
 
6:29 PM
hmm that I don't know rightly yet
let me ask my wizard friend tomorrow
 
I thought Tom was asking about the difference between a free CDN and a paid one.
 
@GrantHill No, I'm asking why @BrianJ can use one to avoid paying for something
 
Well I originally thought the lib was free, until the cdn stopped working then went to the dev's site and turns out there is no free version?
ok so this calculation looks off right?

07/19/2016 6:32 PM - 07/20/2016 12:00 PM = 0Days:17Hours:28Mins
should be 1day, 5hrs, 28mins
my calc is still off..
 
That would be right if the second was 12 AM
 
War
6:49 PM
im just gonna leave that mind destroyer here
 
user47589
haha! jokes on you! its blocked here
 
I don't get it
What am I supposed to do?
I'm on the first puzzle, something about Zhang Heng
 
So I used to play Pokemon Go... then the other day and this morning I see all these people with custom GPS apps on their phone. They sit down, dont' move, but "run" all over the world snatching up loads of pokemon without leaving their seat. So... I uninstalled :P
 
"Type answer here"
You haven't asked me a question
 
I know right!?
 
6:55 PM
Opinion poll: foo == true or foo ?? false
 
Elaborate please.
 
what is foo? Nullable<Boolean>?
 
@KendallFrey I prefer the latter only because the former looks redundant even when its not.
 
their instructions are abysmal
 
6:56 PM
the latter makes it clear that foo might be null
 
@MichaelEdenfield What about the reverse case? == false / ?? true
 
yes.
same thing.
 
War
@TomW i know right ... that was my thought!!!
 
if "null" is an option I prefer to be explicitly about using the nullable operator
 
!!foo
 
6:58 PM
just MHO but I don't like seeing == true or == false anywhere.. it just looks confusing
 
War
bar == true or foo ?? false <-- pointless
bar == foo ?? false         <--  basically just a cast so we can compare 2 boolean vals
 
@KendallFrey foo.GetValueOrDefault()
 
@War eh?
 
War
@KendallFrey was that not clear?
 
Well the part that confused me was how it is related to my code
 
War
7:03 PM
well it was a response to you basically asking for an opinion .. or were you responding to a poll in some way and i'm just confusing things?
I figured since you started that comment with "Opinion poll:" you wanted us to have / contribute our opinion in some way
that was mine
 
@Luggage meh. I prefer ?? to GetValueOrDefault most of the time but I can't say why.
 
I was asking for an opinion of two things, not some weird alternative (?)
 
War
uh ok ... what 2 things?
 
4
A: bool? compare with bool vs GetValueOrDefault vs ?? operator

dasblinkenlightThe language designers had two choices, as far as allowing bool? to participate in control expressions of control statements requiring a bool: Allow it, and make an arbitrary decision when it comes to null treatment Disallow it, forcing you to make a decision each time it is relevant. Note th...

 
9 mins ago, by Kendall Frey
Opinion poll: foo == true or foo ?? false
 
War
7:04 PM
ah ok ... i read it wrong
how you using the result ... for example ...
var result = foo == true;
or
if(foo == true)
if the latter I would just do if(foo)
 
@MichaelEdenfield yea, that's fine but if clarity to a future coder was important, than you can't beat .GetValueOrDefault()
 
I usually see it as a condition for something
if, while maybe
 
War
trouble with if(foo) is you need to give it a bool not a bool?
need to do if(foo ?? false)
 
@Luggage I find ?? perfectly clear and shorter.
 
War
^
 
7:07 PM
I actually stopped using c# daily about the time ?? came out.
or.. maybe.. i can't remember.
 
a quick google search indicates that ?? is faster if you want something other than default(T) in the null case, but GetValueOrDefault() with no parameters is faster if you want default(T) but I've never tested
 
War
@Luggage the problem with GetValueOrDefault is its not clear what that method actually does
microsoft have a habit of changing things
between .Net versions that could possibly return a different result over time
 
it's pretty clear to me, too, but IMO it somewhat breaks the "illusion" that the value is a primitive.
 
sure it is. it get a value, if there is one, or the default for the type. and one should know that the default for a bool is false, and for an int it's 0, etc.
 
@War That seems unlikely
 
War
7:08 PM
not saying it will ... but who knows ... they did change the default for bools at one point I believe
 
I mean, I know it's a class, but it kinda looks like a primitive.
so I use operators over methods.
 
War
^
 
@War citation needed
 
War
exactly
 
in practice, ?? just calls GetValueOrDefault() anyway, so meh.
 
7:08 PM
@MichaelEdenfield does it? why?
 
a struct, but yes.. :)
 
@KendallFrey I'm not sure. but I have seen what is supposedly a decompiled ?? and it's basically:
foo.HasValue ? foo.GetValueOrDefault() : bar
 
foo ?? bar translates to foo.GetValueOrDefault(bar)
 
War
@KendallFrey we had to do a load of fixes on an old codebase when we converted from Nullable<bool> used in .Net 1.1 to 2.0 I htink was the situation (sorry i'm not specific) there was something baout .Net that was setting a default if you used certain logic on it
 
I also know that foo.Value also calls foo.GetValueOrDefault()
so it can throw I assume
 
7:10 PM
oh shit I missed that overload
 
I also prefer ?? because it works on anything that can be null, not just Nullable<T>
so to me it looks more consistant
 
I think foo ?? false is a special case where ?? might be less clear than usual.
but.. meh.
 
maybe.
but ?? always follows the pattern of "what's the thing I want to be the default value?"
 
yea. sold.
 
foo ?? false just means "if you didn't pick, I want false."
 
War
7:13 PM
^
 
both work.
 
War
exactly how i see that operator
 
I would not object to someone using GetValueOrDefault consistently in their new codebase.
but if it were something they inherited from me I'd want them to keep using ??
gotta love coding standards
 
@MichaelEdenfield I find == easier to read though, because I see "if there is a value and the value is true" rather than "if the value is true (if there is no value use false)"
 
@KendallFrey that is true, but there is a hidden catch, much like SQL's hidden catch.
 
7:15 PM
I see this used most often in conjunction with ?.
 
The problem with ?? is that it's harder to pronounce.
 
War
@KendallFrey but if the value is null and you do if(foo) it will throw an exception I think
 
foo == true requires you to recognize at a glance that foo might be null and null != true and, more importantly, null != false
 
@War it won't compile
 
War
this may be a way of saying "only if the value is true do I want to do this thing"
 
7:16 PM
@War if the value is nullable and you try if(foo) it won't compile
 
War
ah that's it
i knew there was some reason for the coales
 
I was under the impression ?? was new. Like 3 year old. I see it in articles from 2007.
 
An example of how I see it used is if (person.Children.FirstOrDefault()?.IsMale == true) // if the person's oldest child is a male
Most English speakers would say that a person with no children doesn't have their oldest child a male
 
== true hiss
 
@mikeTheLiar thus my asking for opinions
 
7:19 PM
Just use all variations throughout your code so that everyone is happy.
We like variety.
 
foo.HasValue && foo.Value
 
^ I actually use that sometimes.
don't hate me.
 
War
@Luggage uh its been around since .net 1.1 i think
could be wrong though
 
@mikeTheLiar gross
 
user47589
we won't hate you. instead we'll use our friendship on you
 
7:20 PM
@KendallFrey Says the man comparing boolean variables against literal values
 
War
@mikeTheLiar much clearer lol
 
user47589
@mikeTheLiar hey, its a free country
 
I didn't say it was good
 
@mikeTheLiar I hope you're being sarcastic
 
user47589
oh wait, he's canadian
 
7:21 PM
@KendallFrey yes
@Amy you ever notice that people only say "it's a free country" when they're doing something shitty?
 
user47589
@mikeTheLiar hmmm, but i'm not doing anything shitty
 
People never talk about how free the country is when they're following traffic laws or paying taxes.
 
8:12 PM
Anyone know of a way to specify custom errors depending on which environment is running?
I know there are 3 modes: On, Off, and RemoteOnly.

But I would like to dynamically set:
<customErrors mode="On" defaultRedirect="~/Error/Index"> for production environment.
And
<customErrors mode="Off"> for Development/Test Environments
 
Try using #ifdefs.
 
So If I could somehow do an If/Else statement in Global.asax to edit the XML tags
@GrantHill I dont understand what that is
 
Michael - use Build COnfigurations
 
@Michael don't do that
 
8:15 PM
In fact, forget the fact the you ever thought of it
 
@mikeTheLiar why?
 
Programatically editing config files at runtime is madness
 
all i want is a simple "on" or "off" lol
 
1 min ago, by Ryan Ternier
Michael - use Build COnfigurations
^ that
 
Ill look at that.
 
8:17 PM
downside: by default it only works when you "deploy" but there are VS extensions that also run the transforms on build
 
@Michael Having the CustomErrors as RemoteOnly suffices for many cases for error handling. This works only with localhost and nothing else.
Ultimately, build configurations will save you a lot of hassle in the future when you're dealing with custom configurations, API's, etc. that need to be specified per server/stack.
 
@RyanTernier but If I publish to a test server, that is remote, the I wont be able to debug
@RyanTernier but yeah these build configurations look helpful. i just need to learn about how the heck to use them
 
@Michael Sure you could. You have that build configuration setup so it would enable debugging. You'd just need to ensure your production configuration is set to no debugging
 
Hire someone to delete or add debugging statements as necessary.
 
Ugh, I have three methods that all do semantically the same thing, but have slightly different things. Naming things is hard.
 
8:22 PM
Did you mean "have slightly different names"?
 
@KendallFrey is it as bad as the code I have to work with sometimes?
GetUsers
GetUsersAsync
GetUsersThatAreDeleted
GetUsersThatAreDeletedAsync
GetUsersAsList
GetUsersAsListAsync
 
Lots of things have slightly different things.
 
my thing is a lot different than your thing
that's a good thing
 
[citation needed]
 
You can't prove that my thing isn't like your thing.
Maybe we have very similar things.
 
8:25 PM
We should create a object orientated language but instead of objects call them things
 
I'd be surprised if that wasn't part of some abandoned Smalltalk spec.
 
@mikeTheLiar "do slightly..." I guess
 
I find it very hard to read the word "ercatons" correctly.
 
@KendallFrey I'm honestly not trying to be a dick this time but that makes even less sense
 
According to this article in 2004, their thing is still emerging. That's not a good thing.
 
8:27 PM
I think Kendall was complaining that he had three methods that were very similar, but not similar enough to combine then.
 
@mikeTheLiar well ok then
Just venting
 
vent away man. welcome to SO -C# Style
 
I'll allow it
Just don't trigger anyone
Or mention panini
 
!!urban thing
 
@RyanTernier [thing](http://thing.urbanup.com/1208778) 'Thing' is a rather useful little word that can be substituted for most nouns or noun clauses. It's main uses are:

1. An object you can't remember or don't know the name of.

2. An interest or area of knowledge

3. A penis.

4. An engagement or appointment.

5. A romantic relationship.

6. Used in any variation on "there is this thing where ______" which is used as a filler.
 
8:28 PM
#3
 
!!urban the thing
 
@mikeTheLiar [The Thing](http://the-thing.urbanup.com/348492) John Carpenter's 1982 remake of the 1950's classic.
Set in the winter of 1982 at a research station in Antarctica where a 12-man team finds an alien being thats been frozen in the ice for over 100,000 years. Unfrozen, the creature unleashed havoc and terror as it changes into the form of whatever being it consumes, allowing it to get, undetected into the presence of it's next victim.
Great film
 
@RyanTernier oh good, you got the joke
 
@RyanTernier opp opp opp
 
user47589
"The Thing" from the alien's POV
 
I really wanted to know what the Thing's original form was
If it even had one
 
a penis, duh.
 
user47589
its a good read
 
@MichaelEdenfield it's so obvious in retrospect
 
user47589
8:30 PM
i dont think it had an original form.
 
Well according to UD, it could be a romantic relationship dressed up as a killer sociopathic clown. Would explain my last marriage...
 
Hey man, whatever floats your boat
 
user47589
usually that's water
 
user47589
i recommend using water
 
Space is better
 
8:31 PM
My ex-girlfriend had a weird fetish, she used to dress up like herself and act like a total fucking bitch all the time.
13
 
user47589
lol
 
I am recently put back on a WPF project after years away from WPF. Refresh my memory, is PropertyChange notification supposed to be able to work between model and ViewModel? We have model classes bound from the view (I have voiced my concerns already on this) and I want to get notifications from the model to cause properties to be checked on the viewmodel.
 
THat's awesome @mikeTheLiar
 
Getting YSOD The partial view '_UserManageFeedPager' was not found or no view engine supports the searched locations.

_UserManageFeedPager is definitely found... I see it. its right where it should be.
 
user47589
how are you trying to use it
 
8:39 PM
Is the partial view part of another view set (e.g. /Home/_UserManageFeedPager, and you are currently navigating to /Admin/SomePage) ?
 
        @Html.Partial("_UserManageFeedPager", Model)
 
In cases like that I think you have to specify the controller/viewset that the partial belongs to in the render method call.
 
nope, after some googling. The build action of the file properties needs to be set to Content. It was set to None.

Idk how anyone would ever figure that would without google
 
Odd that it was not set that way by default.
How did you create the partial page?
 
Yeah, I'm not sure what happened there
 
user47589
8:42 PM
I thought if you use @Html.Partial, you leave the _ out
 
_ is just naming convention
 
user47589
i know
 
user47589
Try changing it to @Html.Partial("UserManageFeedPager", Model)
 
@Amy I got it working by setting build action of the file property toContent. It was set to None.

But I will try removing the _ just to see if it actually works though
 
user47589
i thought the filenames started with _ by convention, but you didn't need the _ when referring to the view. its been a while since i used partials
 
8:45 PM
That's correct.
 
that seems very unnecessary. Its just a name .
 
_ refers to a partial view, i don't believe you need the _
 
No. It throws an exception
 
user47589
ok
 
well look at that :)
 
user47589
8:45 PM
nvm then :)
 
but when you reference the partial view, you do need to put the _ down
 
user47589
when life throws an exception, make exceptionade.
 
@(Html.Partial("_AdvisorDetails", Model)) for example
 
Idk.. anytime I reference the file by name I would assume i need to use the the exact file name
 
user47589
yeah
 
9:02 PM
I was watching the warcraft movie this morning on the train to work. Someone poked my shoulder "you're breaking the law. You shouldn't break the law in public. It's illegal to share movies that you don't own the copyright for. I know you're just downloading it, but letting me watch it is in turn sharing and you could get arrested". liek wtf.
 
Did you respond with silence?
 
I looked at him, raised my eyebrows and then went back to watching my movie. But I moved my phone so he could see it better
 
@RyanTernier hah
 
I should've started watching salad fingers
 
even better
 
10:00 PM
Dumb question.
 
Stupid answer.
 
there are no dumb questions. only dumb people.
 
I've got an object:

public class Sample
{
     public string AttributeValue { get; set; }
}

When I have a List<Sample>, why can't I do:

type.CollectionOfValues.AddRange(values.Select(value => new { value.AttributeValue }));
 
why are you using selectmany?
 
It was supposed to be a Select.
 
10:04 PM
and what is CollectionOfValues ?
 
List<string>
 
Do you just want value => value.AttributeValue?
 
because unless you somehow managed to make it a collection of anonymous types, that isn't gonna work.
get rid of the new
 
@MichaelEdenfield Even that won't work
Yes.
But when I do that, I get:
An exception of type 'System.NullReferenceException' occurred in rscAdmin.dll but was not handled in user code

Additional information: Object reference not set to an instance of an object.
 
Have you tried debugging?
Looks like something is null.
 
10:05 PM
well then you have a null reference somewhere :)
break up the code into pieces and find out where?
 
Yeah, for some odd reason I have a empty string.
 
empty string is not null
but you can add null to a List<string>, that's not your problem.
 
null strings are null.
 
But shouldn't that be allowed.
 
either values is null, or contains a null Sample
 
10:07 PM
Couldn't CollectionOfValues or type also be null?
 
@GrantHill yeah, I hadn't gotten there yet, I was starting with most likely :)
type.collection.AddRange(values.Where(v => v != null && !string.IsNullOrEmpty(v.AttributeValue).Select(v => v.AttributeValue));
 
Yeah, getting verbose but kind of what I was thinking.
 
10:30 PM
type.collection.AddRange(values.Select(v => v?.AttributeValue).Where(s => !string.IsNullOrEmpty(s)))
reads better imo
still verbose, but that's C# for ya ;)
 
Is there a way to get the next index out of string.IndexOfAny();? Like it returns the first index, but I want to use a while loop to get the next one untill it returns -1?
 
@KendallFrey Thanks :)
 
 
1 hour later…
11:59 PM
Hey, verbose means I'm less likely to break everything.
.....
Unintentionally that is :P
 

« first day (2110 days earlier)      last day (2844 days later) »