« first day (2026 days earlier)      last day (2916 days later) » 

5:03 PM
@Failsafe If you are referring to my last message, I meant the federated stuff on Microsoft's websites. But yes I have been playing with .net core. I've not had a chance to dive back in since coming back from my trip though, so last I touched it was still rc2.
using beta 6 or 7 in production somewhere too
 
Anyone know of an extension or plugin that will modify Project settings based on custom build configuration selection?
I should probably be more specific with that question. I'm looking to modify ClickOnce deployment settings.
 
Guys, there's an issue with this query. It doesn't display any of my offers
var offersToShow = AppState.CurrentMemberSelectedOffersAll.AsEnumerable().Where(x=>x.EndDate < DateTime.Now.AddDays(2));
I want to show all offers that are expired or are expiring in less than 2 days
 
5:18 PM
Do you enumerate it?
Deferred execution and all that
 
enumerate which part?
 
The result
 
no I don't enumerate offersToShow
offersToShow should be a collection
 
Also as Amy noted earlier you should probably precalculate "two days from now"
 
precalculate, why?
 
5:20 PM
Less work
 
It should be two days from current date no?
end dates are different for each offer
 
var cutoff = DateTime.Now.AddDays(2);
var offersToShow = AppState.CurrentMemberSelectedOffersAll.AsEnumerable().Where(x=>x.EndDate < cutoff);
What do you see in the debugger?
 
ok one sec, making that change and redeploying the app will take a min or two
 
Redeploying? You can't run it locally?
 
This is for Xamarin app :/
Okay so cutoff is showing 5/5/2016 with current time here
lol
I see the issue thanks Mike
I do need to enumerate
 
5:28 PM
You can just call ToList() on it
That forces evaluation
 
cool thank you
 
np cheers
 
0
Q: Comparing an Entity

GregI've got an entity that I build, I take an instantiated entity and a modified entity. This allows me to hold the initial data, to compare against the modified data. The question, is what would be the ideal approach? Should I implement IEquatable as an override on Object.Equals or implement ICo...

 
@Greg can't you just compare id's ?
although I admit i aint read the question
 
@wadry No, because I need to see what changes were made to the same entity.
To parse those individual changes to the database.
 
5:34 PM
writing your own ORM?
 
@mikeTheLiar, maybe I'm doing it wrong since I am getting 0 offers
There should be a few offers I think
 
@Greg this is ORM territory ... surely your change tracker should be able to tell you that
 
@KendallFrey No, a logging mechanism.
@wadry Except this legacy project is SqlDataReader.
 
@KalaJ times like this is when a debugger is really useful. I'd like to know what AppState.CurrentMemberSelectedOffersAll.AsEnumerable().Count() is
 
yeah me too. I guess I can separate it out like the way you did it
 
5:36 PM
@Greg ouch I wrote like 20 lines of code to do that (log / audit changes) with EF ... as long as you don't have any lazy loading you can always just get the db version again and compare each property
 
@wadry Yeah, I know...
 
It's not very clear what you're trying to do. If you're simply testing for equality, use object.Equals.
 
you can prob use some reflection to do it recursively on any type
depends what you need though ... do you just need the changes or could you just log the fact that the update code was called with the new values?
 
I can't imagine what situation would warrant the use of IComparable
 
@KendallFrey I want the value, ObjectA in State 1, ObjectA in State 2. What changed between those two states.
 
5:38 PM
That's not equality then
you need to write something new
 
@KendallFrey But I do create ObjectA in State 1 and then create ObjectB to capture State 2
 
I'm going to have to agree with Kendall. I'm not entirely sure what you're trying to do but it doesn't sound like equality
 
You're doing a pretty poor job of expressing yourself
 
@KendallFrey hey, at least he hasn't told you to molest yourself with a sandwich
 
which I would do gladly
 
5:41 PM
Auto-erotic mastication
 
I'm comparing changes made to a product, so I want the previous results before they're updated.
 
@Greg could you do what EF does, create a proxy when the object is pulled from the db and then track the changes in the proxy
or is the code too fragmented for that?
 
user47589
back, what'd i miss
 
So you want the difference between two states?
 
@Greg basically diffing two objects amirite?
 
5:42 PM
@Amy Greg is confusing us
 
Yes.
 
user47589
Can I have some confusion as well?
 
@mikeTheLiar I masticate furiously every day.
 
It's not confusing ... we already established that greg wants what's changed on an Entity during an update so he can log it
 
@Amy oh, and Kala apparently doesn't have a debugging environment
 
5:43 PM
basically EF's change tracker
 
user47589
@mikeTheLiar come again?
 
or any other ORM's change tracker for that matter
 
@Amy jeez, so quickly?
 
In essence, yes @wadry. I'm glad you got it, I technically could do it by utilizing dynamic. But that doesn't seem ideal.
 
user47589
@mikeTheLiar lol
 
5:44 PM
!!dynamic
 
@Greg Is the proxying option out?
 
how would dynamic help
 
@mikeTheLiar Using dynamic in C# is like grabbing a tiger by the coffee cup.
 
user47589
Dynamic won't help.
 
@KendallFrey dynamic never helps
 
5:45 PM
@wadry For this project, yes.
 
dynamic is the opposite of help
 
            dynamic instantiated = original.GetType().GetProperty(property.Name).GetValue(original, null);
            dynamic modified = userChanges.GetType().GetProperty(property.Name).GetValue(userChanges, null);
 
More like die-namic amirite
 
dynamic only helps itself the selfish bitch
 
@Greg wait what
 
user47589
5:45 PM
@Greg using dynamic provides you with zero benefit.
 
@Greg ok then we fall back to comparing property states, unless you simply refactor the object so it tracks itself abut still exposes the same proprties (effectively implement change tracking setters)
 
@Greg how is that better than not using dynamic?
 
@KendallFrey it reeks of desperation.
 
user47589
@greg just ignore whatever wadry says until he changes his name to Darth Wadyr
 
// please work
 
5:46 PM
// please clap
 
Then you can add a new property to the object (read only) that contains a dictionary or something of changes and just grab that during your update code
 
// vote for Pedro
 
@Greg am i making sense?
 
So much feedback, so quickly.
 
user47589
!!doge feedback,sense,Pedro
 
5:47 PM
@Amy you can't even get the typo right and i'm not even using it yet lol
 
         wow
               such feedback
                           very sense
many Pedro
 
@wadry Hm, that seems like a lot of extra work but that could work.
 
user47589
@wadry how does one get a typo right when typos are incorrect by definition?
 
@Amy rigth
 
@Amy this is why ponies should not use a computer
 
user47589
5:49 PM
lol
 
amy plz
 
@Greg well that way all this "new logic" is basically just self contained in the entity
 
@Amy should I kick him for this heresy?
 
bsaically how EF proxies work without proxying the object
@mikeTheLiar pls
 
user47589
@mikeTheLiar thumbs up
 
5:51 PM
hmmm
 
hooves up
 
user47589
damn
 
user47589
i missed that.
 
missed what?
I obviously missed it too
 
You discussed me.
 
5:54 PM
no i didn't
 
Guys a question, If you get equally good jobs one in North Carolina, other in San Diego. Which one will you choose?
 
@Obviously apples and oranges man.
 
Haha how?
 
@mikeTheLiar, count is 4
 
Well North Carolina is a state. San Diego is a city
 
5:56 PM
@Obviously I won't choose. You will.
 
@KalaJ can you get the dates of those 4 items?
 
oh the city is charlotte
 
yes I can
 
user47589
no way I'm going to NC, not with all the anti-LGBT nonsense bullshit still going on
 
I saw one expiring 6/30/2016
another 5/30/2016
one expiring 5/5/2016
 
5:57 PM
Cost of living is a huge factor as well
 
this means those two should at least show up
 
I really like San Diego but cost of living and taxes sucks
 
Is the date compare wrong format?
 
NC is cheap, houses are cheap
 
@KalaJ disregard I'm dumb
 
5:57 PM
But I just dont like south
 
@Amy nc?
 
user47589
@Sippy North Carolina
 
ooo
 
when the DNS just drops the package - it might be a Tuesday
 
@mikeTheLiar, I mean to say the ones that are not expiring soon and are expired (for up to 2 days) should be shown?
Does that make sense :S
 
6:00 PM
x.EndDate < cutoff where EndDate is less than 2 days from now. None of the values you posted are less than two days from now
6/30/2016 is almost 2 months from now. 5/30/2016 is a little less than a month.
5/5/2016 is two days from now. Not less than two days.
 
Yes that's right
oh I think I meant enddate is greater than two days
 
I think I just gave myself a concussion from facepalming too hard.
 
user47589
lol
 
lol noo I'm sorry
 
user47589
rofl
 
6:03 PM
what I did above, I don't want them to show
those are the ones I want to filter out
lol
 
user47589
squirts @KalaJ with a squirt gun
 
!!headdesk
 
haha
 
6:05 PM
Thanks guys :)
 
user47589
^^
 
!!knut
 
@KalaJ that's just for you ^
 
awww
 
6:10 PM
!!trump
 
@KendallFrey That didn't make much sense. Use the !!/help command to learn more.
 
i sense a problem
ve must deel vit it
 
trump has been ousted
 
user47589
what about trump?
 
I know I should stop giving him the attention he so desperately craves but the schadenfreude is too compelling
 
6:30 PM
Anybody here use MEF as a means of configuration?
 
MEF for config seems odd
unless you're trying to load different types of config - but it's still only loading assemblies
 
!!Trump
 
@Sidney That didn't make much sense. Did you mean Drumpf?
 
@KendallFrey ^ Better?
 
@ReedCopsey, do you think xml is a better way to do it?
 
6:31 PM
yes
!!help trump
 
@KendallFrey trump: User-taught command: That didn't make much sense. Did you mean Drumpf?
 
@Nathvi depends on what you're configuring
 
!!help Drumpf
 
@Nathvi Command drumpf does not exist. Did you mean: trump
 
damnit XD
 
6:32 PM
but typically something that doesn't require compilation and is easy to parse - XML, JSON, etc - is nice
 
@Nathvi you're welcome to add something.
 
@ReedCopsey, but isn't type safe :(. I like compile time errors
 
!!drumpf
 
@KendallFrey That didn't make much sense. Maybe you meant: trump
 
perfect
 
6:33 PM
@Nathvi Me too - which is why I use type providers to do it :)
but configuration, if you're compiling it in, can just be hard coded - no need to load it in that case
 
@ReedCopsey, isn't that only in f# :p?
 
@Nathvi Yeah - so use an F# library ;)
built right into VS....
 
!!learn trump "That didn't make much sense. Maybe you meant: drumpf"
 
@KendallFrey Command trump learned
 
better
infinite loopz plz
 
6:35 PM
@ReedCopsey, I'll have to check out the #f type providers
 
!!drumpf
 
@ReedCopsey, I'm curious as to how a type provider can be better than a hand written type provider... Or how it's even possible to infer anything meaningful with it.
 
@nathvi you can use a JSON type provider, for example
and you'll get compile time errors if you format it wrong or change types of things
because it turns it, at compile time, into types foryou
 
@CapricaSix no pls
!!forget drumpf
 
6:39 PM
@KendallFrey Command drumpf forgotten.
 
that's my most commonly used emoji according to swype
 
@ReedCopsey, correct, but the type provider for #f is much more general than just JSON or XML type providers, isn't it? You don't have to hand write the code to represent the data, or at least, that's how I understand it.
 
I wish C# had F# type providers :(
stupid JSON generated classes...
 
@Nathvi You can just use the FSharp.Data JSON type provider - it's just a library
you don't need to write code to represent it- it turns the JSON into code for you
that's the point
there's built in ones for CSV, XML, JSON in FSharp.Data
 
we have an error coming out of our proprietary deployment environment... and nobody knows how to fix it...
 
6:42 PM
@Codeman Stop using proprietary deployment environments :p
 
@ReedCopsey, Ok, so it's not really used for building strong types from general data representations.
 
@Codeman - Did you try turning it off and then back on again?
 
though, you do work for a company famous for always doing their own thing, and sticking to it, even when it's crap
@Nathvi Yes, it can be
it effectively gives you types based off the generic data - so you can feed it a json file, and it'll give you usable, named types automatically
 
@ReedCopsey it's generally pretty great but this error is weird
 
@ReedCopsey, gotcha. But that leaves the question, how does the interpretation of that data happen? I assume you can overwrite the default interpretation?
 
6:44 PM
@Codeman - What is teh error?
 
@Nathvi you SHOULDN'T
 
@Nathvi that's what a type provider is - it's a library used by the compiler to do that interpretation
there are some options you can pass in, but you can't "change" it (unless you want to write your own TP)
(other than the settings/options provided)
 
@TravisJ we do some pretty naieve string replacement for a few things. it's not finding a string. I don't know where that string is supposed to live and I can't find another example
 
but - it makes it trivial to build a library that reads your file and supplies nice, clean types
 
@ReedCopsey, that sounds like a really powerful tool!
 
6:45 PM
just make a simple mapping function into a record, and you're done
yeah - it's one of the killer features of F#
 
@Codeman - Is it regexing html? :P
 
where C# doesn't have anything even remotely similar
 
!!tell travisj zalgo "he comes"
 
@travisj "͙̯͕͙͕̤̲̤̥͈̮͇̬̱̦̀̃̈ͥ̂̒̎̅̓̍ͬ̋͂͊̀̕͡ḣ͙̫̥͈̻̳̙̫̲̫̺̦̹̬̺͇̜ͤ́̔̆̂̔͆̋ͨ͐̅͑̄̕͟e̸ͨ͑̃̐͗̏ͧͦ̽ͫ͆‌​͚̠̥̳̞̰͉̳͉̳͍̠͙̼̹̻̼̰̳̕ ̑̆̂̓͒̾ͯ̈́͂͑͆̒͑ͣͥ̊̎͏̞̭͙͕͖̝̟̼̬̕͠͡c̖̗̟̟͚͈̭͕̯͔̃͐̿̂̍ͩ͜͞ǫ̶̛̗̩͕̲̖̱̞͙ͬ̄ͯ̉̋ͨͯ͌̂̆̉ͧm̋̀͛̈̐‌​ͯ͒ͦ́͏͝͏̷̱̭͍̲̬̮̩͡ẽ̸̵̛̩͙̟̹̱̭͚̪̝̱̉͗͗͟ͅş̵̬̲̜̬̳̥͔̣͔̳̦̭̺̦͎̄̒̀̌ͯ̊̒̀ͯ̋͋̈̽ͦ̚͟͝"̢̢͊̈̋͗ͤͭ́‌​͎͔̘̝̞͇̼̬̭̠ͅ
 
@ReedCopsey, and there's no way to leverage the f# code in c#? :(
 
6:46 PM
there are a lot of C# shops that use it to wrap parsing into types - 10 LOC can give you a nice, clean record
yeah - make a library
 
@mikeTheLiar :D
 
and then call it - it's just .NET
 
I wonder if something already exists... time to google
 
what do you mean?
 
@ReedCopsey - So if those types are defined during runtime after parsing JSON (am I understanding that part right?) then how do you get "clean types" in the environment? It seems like there would be no way to get IntelliSense there because the definition wouldn't exist yet.
 
6:49 PM
you'd have to do it yourself - it's pretty much going to be specific to your config schema (that's the point)
@TravisJ The type provider does it at compile time, not runtime'
so you get types, from code executed by the TP, at compile time
 
@ReedCopsey - Kind of like a pre-fetch?
 
mmm
easier if you try it ;)
makes more sense
 
@ReedCopsey sounds like what automapper does
its a nuget package designed to transform data objects
 
nah - completely different
 
but it can do projections in sql statements too
 
6:54 PM
that's really a different animal
that's more a way to use reflection to map across things with less typing
 
ah ok ... i missed most the conversation (was cleaning my GPU)
 
@Nathvi here - this is pretty much working code
namespace MyCoolLibrary

open FSharp.Data
open System.IO

type Configuration = { Foo : int ; Bar : float }

module Configuration =
    type JsonConfig = JsonProvider<"config.json">

    let LoadConfig () =
        let data = File.ReadAllText "runtime/path/to/config.json"
        let config = JsonConfig.Parse(data)

        { Foo = config.Root.Foo ; Bar = config.Root.Bar }
you could then just call, from C#:
var config = MyCoolLibrary.Configuration.LoadConfig();
and you'll get an immutable, strong typed view of the configuration
but - if you change the data in config.json - it'll break at compile time
 
@ReedCopsey, that is freaking awesome
 
ie: if you remove "Foo" or "Bar", or change them to a string, etc
yeah - type providers are one of the nicest features of any language I've seen
 
!!!!
 
6:56 PM
@ReedCopsey newtonsoft.json does similar
 
that code should work - just add a new F# Library project, add FSharp.Data via nuget
 
@ReedCopsey, thank you Senpai.
 
@wadry Nope - you get errors at runtime with newtonsoft
 
can map json to objects in 1 line
 
this is compile time "checked"
 
6:56 PM
or you can map to dynamic if you need that
 
no- - dynamic makes it even more runtime bound
and less type safe
he wants it type safe at compile time
 
@ReedCopsey what runtime errors?
I do this all the time with my OData layer stuff
receive a json request map to an object dump to SQL db
 
dynamic dyn = UseNewtonsoftToParseJsonToObject();
var value = dyn.Foo; // Boom if "Foo" isn't in json
 
virtually no code at all
@ReedCopsey yeh for config stuff you want to map to a strong type
 
user47589
...
 
6:58 PM
there is no way to read from config in C# and have type safety at compile time
 
which you can annotate to determine what's not nullable and so on
 
C# doesn't support that ;)
 
var config = JsonConverter.DeserialiseObject<ConfigType>(configString);
 
@wadry why are you suggesting dynamic so much today?
 
user47589
i think dynamic is his new love
 
6:59 PM
I didn't suggest earlier
 
@wadry If the file changes - you will never get compile time checking from that
 

« first day (2026 days earlier)      last day (2916 days later) »