« first day (1545 days earlier)      last day (3629 days later) » 

20:00
0
Q: Some Curious Behavior using Newtonsoft JSON

Spencer RuportI was tracking down a bug and I noticed that Newtonsoft JSON will append items to a List<> that's been initialized in the default constructor. I did a little more digging and discussed with some people on the C# chat and we noticed that this behavior doesn't apply to other collection types. Inste...

Pretty sure that's gonna get closed.
So the behavior as observed is
List: ObjectCreationHandling.Reuse
Collection: ObjectCreationHandling.Auto
ReadOnlyCollection: ObjectCreationHandling.Replace
Can you reflector it?
I don't have a copy of the dll handy
I don't either.
@Johan! :)
@TravisJ reflector what? JSON.NET?
20:05
oh sweet
it is on github
er
it's open source
yeah
@JohanLarsson - Was curios if u had some source code but its online :)
also ^
on crappy phone internet so did not wait for it to load
It seems that the converters are what are used to instantiate the json settings
still reading
it is way too cold to be a human
grow some f'n bear fur
20:09
agreed
my little gas fireplace can't keep up :(
:(
how cold is it by you @KendallFrey?
inside or outside?
-15C according to google
20:17
lol it's 50f here
!!cookmedinner
!!weather seattle, wa
she's useless
feels like -27C here
:(
oh btw
if anyone is interested in a job in Seattle, WA, I am looking for a replacement
no remotes unfortunately
!!weather kitchener
20:21
@KendallFrey Kitchener: -12.116C (261.034K), scattered clouds
what a silly name for a town
it sounds like a shitty adjective
better than Berlin, at least during WWI
Through the latter half of the 19th century and into the first decade of the 20th, the City of Berlin, Ontario, Canada, was a bustling industrial centre celebrating its German heritage. However, when World War I started, that heritage became the focus of considerable enmity from non-German residents within the city and throughout Waterloo County. == Overview == The fact that most of the original settlers of Berlin were not directly German but were Mennonites from Pennsylvania did not help, as their refusal to join the war effort (because of their pacifism) only increased tensions. The slow pace...
oh, hahahahahaha
20:42
github needs a find all references button
you need a git clone function :)
I think I might do a track day sometime soon... anyone ever do that before?
Design question time!
I have a Premise with contains a {Gas,Water,Electricity}Meter object (which actually just consists of a Meternumber, internal ID, and reference to the Premise). I want to keep track of the metercounter, but would like to show only the most recent metercounter on either my Premise or my Meter.
Can I do that via EF relations somehow?
It'd be nice if I could say myPremise.WaterMeter.CurrentCounter which would return the most recent counter
@Pheonixblade9 - go drink in the middle of the track at a nascar race?
@ton.yeung - Thanks. I actually didn't know that :) Still semi n00b to github
@TravisJ That's not a track, it's an oval
20:57
@SpencerRuport - Getting closer to it :)
Dang. 7+ on that question. w00t.
I am no C# expert, but doesn't my comment seem correct/ obvious here:
http://stackoverflow.com/questions/27849337/c-sharp-equivalent-ranking
@SpencerRuport - I might have an answer soon
It has been a pain lol
The DeserializeObject rabbit hole is deep
@AustinFrench That question is so confusing I have no idea if you are right
@AustinFrench Well, it doesn't really seem to be connected to the question
21:14
@KendallFrey and @BradleyDotNET
It seems to me it would be easy/ make sense to just load it into a class with the properties he needs so that he can enumerate the class and use things like if ! contains
Like I said, what he is trying to do is confusing enough to me that I cannot comment on the accuracy of your comment or the answer.
I think the general idea is fairly clear, but the code is baffling
@TravisJ - Do you have a link?
@SpencerRuport GitHub
I meant to the specific file where the DeserializeObject method(s) reside.
21:26
uh, somethingInternal
It's not too hard to find
not long ago I made the conscious decision to move to MVC after reading several "webforms is dead" articles out...now I see one that said ASP.NET MVC is dead
damnit....can stuff stop dying
@Skullomania - It's not.
@SpencerRuport - Yes, but that is just scratching the surface. Anyway, I believe I have it all sorted now.
@SpencerRuport Yeah, that's the one I was looking at
@Skullomania - Really what's dying is Razor and server side rendering.
21:30
It's got the internal implementation
@SpencerRuport so ASP and not so much MVC
Yep. MVC is alive and well.
so should I stop obsessing over C# MVC and just start trying to learn Node or Angular?
go back to PHP
?
@Skullomania - If you want? C# isn't dying though.
but ASP.NET MVC was all about razor because of clean code
21:34
@Skullomania - All that's changing is instead of using server side views you use Controller methods as web service endpoints. I've been doing this in ASP.Net MVC for years now.
Skim those 5 articles
That being said, ASP.Net MVC is being replaced with WebAPI 2 but the differences are pretty minimal. If you design your ASP.Net MVC project the way I did in my articles converting to WebAPI 2 is a trivial process.
Without a debugger, it is hard to find the exact path that everything takes =/
I can show the why and part of the code, but not the entire trail
You think that is enough?
For what its worth (mostly because I never bothered to learn MVC) I use angular client side and Web API on the server side
@TravisJ - I'll upvote anything you post.
21:37
works pretty well
There are literally thousands of lines of code in the process.
@Skullomania - So ASP.Net MVC isn't dying so much as evolving and MS decided to call it WebAPI 2 since that's a more accurate name.
I see
I have invested much in learning MVC...im still baby stepping
Well it's called "ASP.NET 5" which is a unified MVC and webapi
I think after another week or two I will be ready for some solid food and maybe start creating my own apps
21:40
@Shoe - Ah okay my mistake.
@Skullomania - Really if you just make sure to incorporate angular.js or knockout.js into what you're you'll be on the right track.
im not sure I understand that
i was thinking one over the other
I believe they stuck with the name "MVC" so you make an "MVC 6" project which contains the new WebAPI stuff
so ASP.net MVC or Angular or knockout
WebAPI in particular is server side only
So using it doesn't preclude a choice of client side tech
ASP.NET has changed dramastically over the past 10 years. It's mind boggling. Props to MS to force people to keep learning
21:45
its true. i wish i lived by a hackerspace. I liked PHP's object oriented approach and before I really began to get deep with it I jumped to webforms for this job I have been at for the past 2 years
I want to learn MVC because Im tired of fighting with postbacks and pagestates
Well mvc is the successor to webforms
MVC makes cake of both...in one tutorial I touched on everything I learned in webforms in 2 years
@Skullomania - ASP.Net MVC and Angular or Knockout
I use WebAPI and EF with Angular
Web Form Days - circa: 2000-2008
Boss: Hey, you're a web developer, that means you can write win forms. (or vice versa)

Circa 2008-2013
Boss: Hey, you do web Work, so can you do the UI for this winform application

Circa 2013+
Boss: This sucks> i have to now hire 2 devs or pay 1 dev massive amounts of $$ because he knows everything. Fuq microsoft.
21:49
Developer: Wheeeee!
alot of people say they are similar...I think they are completely opposite
MVC and WebForms are not similar at all haha.
Although you can use WebForms as a service
@SpencerRuport @Pheonixblade9 I love a challenge but angular is a bit much for me to chew right now
@Skullomania - I'd recommend Knockout then. You can get the gist of it in about an hour.
@SpencerRuport Yup. WebForms was similar to WinForms, so one "Could" easily jump between the two.
21:50
not that I have tried it...but from what I read...angular is much more advanced than knockout
But Angular seems to be more popular.
Hey guys. Does anyone know if DateTime and/or TimeSpan support leap seconds? There is one coming this year and I started wondering how it's going to affect time management in .NET based applications
However, now with MVC and the Angularized bootstraped ninjected meteors, the web development world has skyrocketed and there's no going back. F'n ninjas.
@SpencerRuport I would like to learn angular for that reason!
21:51
@Skullomania - Learning the basics of Knockout will help you learn Angular.
I'm really just nervous about Angular 3.0. It's completely different.
Like, Python 2/3 different. Different everything
but making the jump between webforms to MVC is hard as hell!
i like it...but as I said...baby steps
@MarcinJuraszek No, they dont
Angular shares a lot of concepts from WPF
So it makes it nice for us WPF devs
@Skullomania - Well let me know if you use my tutorial. I tried to walk through everything so you get a sense of how it all works together.
21:53
there are a ton of youtube videos I have lined up for myself though...im confident i will be competent in 2 weeks
@TravisJ Is it poor practice to call a C# helper method from a class, in your View with Razor?
@SpencerRuport i bookmarked it...as well as the knockout site
I feel so out of date with all these things. I've been doing SOA development for 4 years without touching 1 bit of UI :(
<marquee><img src="../yay.png" />I'm obsolete?!</marquee> is that still valid?
@Shoe So I should expect 6/30/2015 23:59:59 to be returned by DateTime.Now for 2 seconds?
what is enterprise level...when asked by a recruiter?
21:56
Large scale
at least, thats what it probably is
I was told that my resume was great I just did not have enterprise level experience
@MarcinJuraszek There are no leap seconds in DateTime. So I would expect the opposite
how large?
Have you worked on any large-load/scale projects?
@BradleyDotNET You're 2nd one is the best answer "What is probably is"
@Skullomania This software is over 4 million LOC atm. I've trimmed about 500k off with the removal of biztalk
@Skullomania My production stack is 16 servers large, 4 portals, 4 brokers, 4 oracle DB's and 4 Solaris boxes. They're hooked into 32 hospitals, 5 mainframes, and a plethora of other servers
21:57
damn
yea....I did nothing like that
It also means knowing how to program against large load
for example, having 3000 connected clients and your system still working
WEb services that need to execute in 50ms - something that hits a DB with 50million people, and retrieve a single person based on an ID, get all information on that person, create a SOAP message and return it to the client.
@Greg - not as long as it returns something that is only relevant to the view
And has no side affects
Code is code, however quality takes a higher precedent, as well as maintainability
21:59
we would need to hire most IS members and 10 other mes to accomplish this
just ordered a Fitbit Surge. I am now a smart watch wearer
at least one more me
smarter me
@TravisJ How do you do that? Call it through Razor? Inside a foreach loop?
I have a team of 4 developers. 4 operations, 3 QA, 4 managers, 2 PM's, 2 BAs and 2 architects
22:00
@TravisJ Every time it says this: "Your syntax sucks dick, fix it."
@MarcinJuraszek Nice to see that your are back!
hey Johan!
Are ypu fluent in F# now?
@Greg, @RyanTernier I am the only web programmer in my organization, besides me there is one other programmer in IS who doesnt program anymore
@Shoe But that makes it even worse. It means I can't say when that one second will get inserted, as it will depend on windows syncing the time with external service...
22:01
Anyone know why Moq cannot test a non-virtual method in an abstract class? That seems a bit silly
I work mostly alone, or in really small teams. The side-effect being our projects take longer
@BradleyDotNET @Skullomania I miss those days :P
Even though they are enterprise-scale
@JohanLarsson I can read it quite well, but haven't wrote much lately
@Greg - you have to include the namespace with a using statement in your cshtml file
@SpencerRuport - I hit a snag :( =/ =/
22:02
@BradleyDotNET Linus Torvalds wrote git in two weeks.
@JohanLarsson What part of it?
git is still actively developed afaik
dunno, just a rumor I hear. Or maybe he said it himself in a talk.
@TravisJ I'll have to look it up then.
F4z
F4z
@Squiggle I think I did get confused a little bit with what logic to use. I'll try again later
22:04
Slowly i feel i'm getting "taken" out of the Software development part of this world and put into more of a solutions expert / architect - meeting with clients, and helping them craft their system and then leading a team to build it.
@MarcinJuraszek Just the way it is I guess :\
nvm, figured it out
phew lol
@RyanTernier with your experience they no longer want you in the trenches
thats a good thing man!
@Skullomania True, but once a dev always a dev. Those trenches are home, they're comforting.
I certainly hope I'm never truly "out of the trenches"
22:07
I agree with that....
To be honest, sometimes I want to dig the trench and then tell people "ok this is how you sit in it" haha
@TravisJ - What's the issue?
you cant be removed fully man...as a programmer you think about this all the time...my wife gets pissed because I am always programming....even at home...for fun!
no doubts you are the same
I've been trying to tone it down a bit.
@MarcinJuraszek The last leap second happened in 2012. What did you do then?
22:09
@Skullomania haha my girl's eyes just glaze over. She's always saying "Why do you need to solve everything. Can't something just be "bad/broken/etc."?
I don't even think I knew about that 2 years ago :P
and I definitely didn't care back then
@RyanTernier I too suffer from Problem Solver Syndrome (PSS)
@Shoe If it's a documented syndrome I can get free medical!
Where my Obama bux at
@RyanTernier medical is good in colorado
lol
22:11
so I called another Enterprise and they are going to give me a mustang instead of a Grand Cherokee B-D
you can get THC for you PSS
lol
@Skullomania Better in BC ;)
you can go buy it here in washington :P
in a shop, no medical required
and working at a hospital you can get a percentage off meds
lol
@Pheonixblade9 showoff haha
That's strange
22:12
MJ is treated like alcohol in washington state now
A few canadians got banned from the states because they mentioned to the border guards they were going down to smoke pot. IT's weird - it's illegal in the USA, but legal in a few states (Federal vs state law)
Like working at a funeral home gets you a discount on cremations strange
still illegal in KY, even though it grows it for the rest of the contenent
@Pheonixblade9 MJ's music is alcohol.
0
A: Explanation for ObjectCreationHandling using Newtonsoft JSON?

Travis JIt basically boils down to type instantiation and the ObjectCreationHandling setting. There are three settings for ObjectCreationHandling Auto 0 Reuse existing objects, create new objects when needed. Reuse 1 Only reuse existing objects. Replace 2 Always create new objec...

22:13
@RyanTernier maybe, but Michael Jackson has never gotten me laid
LMFAO
on that note I will see you guys later...time to pick up the kiddos
@Pheonixblade9 Only because you aren't young enough
thanks for the help guys!
F4z
F4z
does the US use this format for the time: 11:13? or 11:13 AM?
@F4z the second
22:14
yes and yes
the US does not use 24 hour time generally
I know a military man when they speak in 24 hour time
F4z
F4z
is it possible to have the first as the format?
on your computer
not generally
22:16
@TravisJ - Damn dude that's a fantastic answer
So I guess it isn't that weird
F4z
F4z
specifying the DateTime.Now.ToString("t") get's the computers time format related to the culture however using DateTime.Now.ToString("h:mm tt") is fixed and does not relate to the culture specific. Is that how it works?
I'm gonna wait a couple days to accept so I can bounty it.
@SpencerRuport - You should have seen all the tabs I had open lol
I imagine.
22:17
i imagine also
often
I was mostly wondering about Collection. I'm surprised it doesn't have a default constructor but ReadOnlyCollection does.
I might be a smart ass...
SELECT Name WHERE Employer IN ('Google', 'Microsoft', 'Deloitte', 'Facebook') — Pheonixblade9 16 secs ago
@SpencerRuport - Neither has a default constructor
Make sure you accept an answer for the bounty. If you post an answer to a question and the question then gets a bounty, it doesn't auto-award you the bounty for some reason.
Well, at least neither has an available TypeInitializer from their reflected type.
22:18
question was "Select person with highest salary in every city"
@SpencerRuport - ReadOnlyCollection lacks a parameterless constructor though
var col = new Collection<string>();//works
var roc = new ReadOnlyCollection<String>();//fails
ah
Under the collection section I think you made a wordo: "testObj.**List**.GetType().GetConstructor(Type.EmptyTypes) == null"
I think you meant testObj.Collection.
@SpencerRuport - Yes, thanks :)
@SpencerRuport - How did you even come across that?
22:28
@TravisJ - About 4 months back I swear I had a bug that was deserializing some data to an object with some readonly members and it would null them out.
I couldn't reproduce that though but in the process I found that other behavior.
How to create custom html helper?
@TravisJ - My setup was this: dotnetfiddle.net/saNWmW
the one like : @Html.Devexpress().TextBox.....
22:31
@SpencerRuport - ah, yes that could be strange as well
@TravisJ - I don't remember how but somehow I was able to null out a readonly property.
I'll have to experiment some more to see if I can do it again. It might have been using XML over WCF.
@PaRiMaLRaJ That is so ridiculously broad as to be unanswerable
eww
how so ?
i thought it to be simple
well, i just need my own name
not all methods
like devexpress has
Html.Devexpress.whatever_i_need
i want my own
Html.Raj().WhateverFor(m => m.Prop)
Why Html preface?
It doesn't have to be there
ohh
do, how do i make one w/o html
direct
22:35
using Namespace.MyCustom;
@MyCustomMethod()
Pretty simple :)
point is want the same name
Use w/e name you want
that is available with HtmlHelers
@Raj.TextBoxFor(...);
you could do that
any proper example ?
i am sure that i am searching it the wrong way
on google
22:37
namespace RajExtension
{
 public static class Raj
 {
  public static HtmlString TextBoxFor(...)
  {

  }
 }
}

view.cshtml
@using RajExtension
@Raj.TextBoxFor(...)
woot, thnx
yup :)
22:53
@TravisJ I need some help, in a Razor View... How can I access the contents when I do:
return WithSuccess(View("Result", customer), "");
what is withsuccess
public ActionResult WithSuccess(ActionResult result, string message)
{
    ShowSuccess(message);
    return result;
}
public void ShowSuccess(string message)
{
    TempData["UI_Success"] = message;
}
All I want to do is pass the customer.
In this instance it isn't IEnumerable.
Please don't do it that way.
...?
Anything public can be called from the outside.
So I could call your WithSuccess method from the url with my own parameters
22:57
@TravisJ I'll refactor later, in this instance I need to finish.
Just add TempData["UI_Success"] = customer; to the previous location and move on
TempData["UI_Success"] = customer;
return View("Result");
@TravisJ That isn't the problem though, the problem is on my view. How do I see the Customer model? Razor isn't letting me.
var customer = (Customer)TempData["UI_Success"];
If Customer isn't scoped there, right click on it, and resolve -> (Project.Namespace.Customer)
@TravisJ So, my controller is passing it. So how would I call it then in Razor?
@{
 var customer = (Customer)TempData["UI_Success"];
}
<div>@customer.Name</div>
23:01
Why do I need the TempData thing?
To make it available in the view because the context changes
you could also return it as a viewmodel
Ah, I see.
The message was omitted in the previous example and was ""
Sorry, you can do it with return View("result",customer)
Any advice for a tool that would help diagnose a possibly bad hard disk?
I meant the ui message should be set from the controller though
TempData["UI_Success"] = "";
return View("Result", customer);
The WithSuccess method is not going to work
@TravisJ I have that, but... In Razor.
ok so in your cshtml file use
@model Customer
<div>Success: @(TempData["UI_Success"])</div>
<div>Customer Name: @Model.Name</div>
23:05
But that still errors.
With?
It gives me a protection issue.
Specifically?
If I'm passing the customer why can't I read through it?
Yeah, give me a second... I'll give you the error.
There should be no problems reading it. Is everything inside of the class public?
public string Name { get; set; }
23:07
No, it is get because it uses two separate models to build that model.
it should be public, that is probably why you get the protection error
I thought what I did, purposefully passes the model.
They're public though
what is the error?
@TravisJ If I do:
@model BCCP.Models.Billable { } I get an invalid in context.
I'm passing the model, so shouldn't it be there?
Since View("Result", customer) is being passed.
you don't need the {}
@model BCCP.Models.Billable
<div>@Model.Name</div>
23:17
@TravisJ Well, this just worked:
!!/inhistory 04-13
var content = Model
@NETscape That didn't make much sense. Use the !!/help command to learn more.
@TravisJ Is that not good?
@NETscape That didn't make much sense. Use the !!/help command to learn more.
23:17
you're a piece
@Greg - you can do that if you feel it makes it more readable
@TravisJ Not sure...
@TravisJ That was kind of frustrating.
23:43
0
Q: How do I wrap a field in SQL Server with CDATA without using FOR XML EXPLICIT?

Pheonixblade9As the question title says, I am trying to wrap a SELECT statement in SQL Server with CDATA without using FOR XML EXPLICIT. I currently use FOR XML PATH, like so: SELECT p.SKU AS [BasicInfo/SellerPartNumber] FOR XML PATH('Item') I know that I can convert this to FOR XML EXPLICIT and wrap in a ...

23:58
Does PowerShell and C# share the same math functions? If i use [math]::round in PowerShell does that have the same behavior as the C# round?
I believe round is fairly standardized.
@Rawrgulmuffins generally yes
it's less the C# version that it uses, more the .NET
C# implements the .NET standard library, or wraps it.
x.0 -> x.4999 = x
x.500 -> x.9999 = x+1

« first day (1545 days earlier)      last day (3629 days later) »