« first day (2291 days earlier)      last day (2640 days later) » 
01:00 - 19:0019:00 - 00:00

7:01 PM
Collection initializers were added in C# 4 or 5, but I assume they didn't support extension methods.
 
In an MVC app, if you have a search box and submit it via GET, do you have to have an argument on the controller's action for each field? Such as...
public ActionResult Index(string field1, string field2, ....) { .... }
Or is there a way to get all the variables together in one collection? Such as this...
public ActionResult Index(SomeCollection allFormFields) { .... }
What's the best practice way of doing this? Using a class that has all your fields defined as properties and doing a POST?
 
7:23 PM
@AvnerShahar-Kashtan what you suggest me to do then ?
 
7:34 PM
For anyone else wondering how to do the search in MVC, here's a post with really useful answers: stackoverflow.com/questions/8167853/…
Using a non-DTO model ("view model") is the preferred method of passing data
 
user1630889
Oh, yeah, ViewModel interpolation is great.
 
user1630889
Most of the apps I build end up using a ViewModel for nearly every page.
 
user1630889
That's just how things end up.
 
Thanks, @AlexanderPritchard
I remember posting somewhere about "view models" in MVC and people were upset... they said there's no such thing. Technically, they're all models but not sure what to call this class in MVC world other than view model
It's not a DTO class, so what does that make it?
 
user1630889
IDK the point of people arguing over stuff like that. That's a line you draw.
 
user1630889
7:40 PM
Right.
 
In MVVM + WPF, it's a view model. Anyway, what's a rose by any other name?
 
Hey all, does anyone happen to know if there's a way to force a Singleton service in asp.net core to eagerly load upon app startup? I have a potentially long-running task that I'd like to have executed prior to the first request
 
7:59 PM
@Alex - use a view model class in your action, and use post instead of get if you are using ajax
 
Hello @TravisJ, May I ask you a question?
 
Asking is fine, but why not ask the room? I am just one person
 
I know, but since you helped me last time I thought to ask you once again.
 
Okay, what's up?
 
Travis has the best help. Really tremendous guy. Great brain.
!!tell kevin format
 
8:05 PM
@kevin Format your code - hit Ctrl+K before sending and see the faq
 
@mikeTheLiar - I protested :) There were supposed to only be 100 people in a small park, there were 5000
 
@TravisJ there were jokes about the Boston march not happening because the Common was literally so full of people that you couldn't leave to actually, you know, march
 
wow, it's still ugly
 
You're formatting your code with tabs, aren't you? You monster.
 
lol
put it in a gist or pastebin or something
@mikeTheLiar - I think one of them had to actually stop because the actual march aspect couldn't move around. Even still, aside from the marching, it was pretty impressive. 50 states, 80 countries
 
8:09 PM
Friends of mine actually went to DC. The Boston march wasn't enough for them.
 
@foreach (var referral in Model.Referral.Where(x => x.MemberId.ElementAtOrDefault(i).ToString().Contains(members.MemberId.ElementAtOrDefault(i).ToString())))
{
    if (!string.IsNullOrWhiteSpace(referral.RfrInfoFound.ElementAtOrDefault(i)))
    {
<span>|</span> <a class="modal-link-flex" data-target="#flex_modal" href="@Url.Action(" Edit", "Referral" , new {cid=members.CaseId.ElementAtOrDefault(i), mid=members.MemberId.ElementAtOrDefault(i), refid=referral.ReferralId.ElementAtOrDefault(i), sbs=ViewBag.sbs})">Edit</a>
Is it better now? (confused)
 
@mikeTheLiar - I noticed that there are plans to remove "75% of business regulations", I wonder if that means getting rid of OSHA
 
Close enough for government work.
 
@KevinMaxwell - It's fine
 
quick question - are pre post build events run for every configuration? like debug, release etc
 
8:12 PM
So what isn't working?
 
@TravisJ finally, free of the tyranny of not using the top step of the ladder
 
@TravisJ writing...
 
@mikeTheLiar - Business is going to start locking people in to keep them working and burning their trash though if those regulations are removed
@mikeTheLiar - I am not concerned, I don't work salary for a large company. However, a lot of people in our industry do. How does a 70 hour work week sound?
 
Question: As you see, I perform the If condition to see if that value is null or not and based on that show Edit or Add. The issue is that for this particular CaseId or MemberId there is no data, how can I also include if the data doesn't exist?
 
@TravisJ I'll start my own company. With blackjack. And hookers.
 
8:13 PM
@TravisJ I lay down my trap card, "Union"
It's unblockable
 
@Failsafe - Are there software developer unions?
 
There are if you do software development for the government
 
>implying government jobs will still exist
 
Controller:

var getreferral = db.Referral.Where(x => x.CaseId == cid && x.Deleted == false);

var referral = getreferral.GroupBy(c => new { MemberId = c.MemberId, CaseId = c.CaseId })
.OrderBy(c => c.Key.MemberId).Select(s => new ViewMemberViewModel()
{
CaseId = s.Select(p => p.CaseId),
MemberId = s.Select(p => p.MemberId),
ReferralId = s.Select(p => p.ReferralId),
RfrInfoFound = s.Select(p => p.Method.Code),
}).ToList();
 
Someone has to delete all that obamacare code man
 
8:16 PM
Heh, if you live in a red state your life expectancy is years lower.
 
red state = red meat
 
And yet, all they do is rail about trying to help their healthcare
 
aka heart problems
aka i die sooner
i see the connection
 
Just a touch of the sugars
 
@KevinMaxwell - So members.CaseId is empty and you want to know what to put there instead?
 
8:17 PM
@TravisJ Yes, because the data has not been entered yet, so I need to display the Add option.
 
So use an or || in your if statement to also check for members.CaseId?
 
@TravisJ members.CaseId does always exist. Let me share a picture with you.
 
ok
 
It's a user checklist. Because Biographical Info is checked, it means I have both MemberId and CaseId
 
okay
 
8:25 PM
Hello,
 
@KevinMaxwell - I don't understand what the problem is with your code and that image though
 
Im having problems with a simple function call within a printf();
#include <stdio.h>

int main()
{
  int obf(char s[]) {
      int j = 0;
      while (s[j] != '\0'){
          putchar('*');
          j++;
      }
      return 0;
  }

   printf("To Print: %s", obf("TEST"));
}

OutPut: -> ****To Print: (null)sh-4.2$
 
@TravisJ I'm guessing it's good practice to use VMs even if we're not doing AJAX?
 
How can i fix this ?
 
@TravisJ Ok, you see in the image, in front of Referral there is no Add button. In the Razor code I perform the If condition to check whether the CaseId exists in Referral mode or not. The issue is it doesn't exist and I'm asking if the field is Null, the reality is that in Referral Table there is no CaseId yet as it's not been entered yet.
 
user1630889
8:27 PM
@KarmaDoe Why are you asking this in the C# channel?
 
user1630889
Am I missing something?
 
Because that is C?
 
@Alex - Mostly, yes. However, the point was to use post with ajax.
 
What am i missing ?
 
user1630889
@KarmaDoe No, it's a completely different language.
 
8:28 PM
In this room we made the C, sharper :D
 
user1630889
C# is not like C or C++ at all, really.
 
Oh
so this is C#
my bad
 
@TravisJ Thanks :)
 
love you byez
 
@KevinMaxwell - You should add extra conditions to your if statement:
if (!string.IsNullOrWhiteSpace(referral.RfrInfoFound.ElementAtOrDefault(i)))
to cover when caseid is null or whichever other situation indicates the add button needs to appear
@Alex - If there is nothing complex, there doesn't always need to be a view model. Sometimes I will use a list of tuple<string,string> or whatnot if it is only a small amount of items that are being passed.
 
8:31 PM
I already do this:
if (!string.IsNullOrWhiteSpace(referral.RfrInfoFound.ElementAtOrDefault(i)))
but it doesn't do the job.
 
@KevinMaxwell - That was my point, you need to modify that
To make it cover the other scenarios that you are encountering
 
So, it should be a second level condition, first see if CaseId exists then that one?
 
such as using if(!string.... || members.CaseId == null || ... ), or whichever logic and properties exist to use
 
I'm testing now...
 
@TravisJ Hmm. How would the GET action receive the Tuples?
Or would it be POST?
 
8:34 PM
@Alex - I meant returning a tuple from the controller to the view
 
Ohh
Yeah, I've used Tuples recently; pretty cool!
 
Although, be careful, because sometimes they can get a little out of hand
 
Yeah, for tiny amount of data, they're useful
Recently used them when needing to return startDate and endDate from a class, both DateTime? types
 
be back later
 
FYI, it didn't work. Thanks for your help
 
8:40 PM
When using a VM that will hold various lists (including SelectList props), should these be populated from the constructor? Or should they be set on the VM from the controller's action?
 
Anyone here have any experience with .net core's IChangeToken? I'm not able to get file monitoring working
 
Jess Pardue on January 23, 2017
Welcome to the Stack Overflow podcast #99 recorded Thursday, January 19 at the Stack Overflow HQ in NYC. Today's podcast is brought to you by Reverse Polish notation.
 
9:22 PM
posted on January 21, 2017 by Scott Hanselman

As .NET Core and ASP.NET Core make the transition from project.json style project files to MSBuild (csproj) style files, I'm starting to get myself up to speed on what's needed, what's changing, and why/if it's a good thing. Documentation is still getting updated but there's a great blog post from Nate McMaster who works on the team. As I touched on in a previous post, you can continue working

 
9:44 PM
Hi everyone. Where can I ask somebody for a quick lookup favor related to Xamarin.PCL? The Xamarin chat room is basically dead. I need to know a member name to edit an answer to my question and I can't find it in the documentation.
 
member as in user, or member as in class member
 
Thinking that's a class member
 
Member as in class member.
I asked a question about Xamarin.PCL, how to retrieve PropertyInfos, because the method that takes the name of a property returns null. The answerer named the correct method that returns an IEnumerable of PropertyInfo including the one I looked for. Now I want to know what member of PropertyInfo I have to use to filter the Enumerable.
 
Man, is every single developer position on the market a senior-level position? I can't seem to find a job despite years of experience, because I worked in a finite capacity self-taught with webforms and have never been under mentorship.
 
I know when I debugged the code at work the DataTip showed the property name for each entry, but I can't remember the name of the PropertyInfo member containing the property name. Now, every time at work I forget to look it up, and at home I have no Xamarin installation, and the documentation does not appear to have a "Name" property or something in the PropertyInfo class
 
9:59 PM
At interviews I lack the necessary vocabulary to demonstrate my knowledge because I have always worked alone, and mostly on smaller projects.
 
var exists = this.GetType().GetRuntimeProperties().Any(p => p.WhatMemberToUse == propertyName)
 
@ton.yeung - I have seen some people do things of that nature, however, it is not common to see that when looking at large frameworks or anything that has actually been released for widespread use. I think it is one of those situations where the saying "give someone enough rope" applies... it is possible to do, just probably not a good idea.
@Alex - If they are static they can be set in the constructor, if they come from a database then the controller should use a service to populate them.
@KevinMaxwell - It didn't work? What happened / didn't happen?
 
So... how about that local sports team?
 
@SeventhSon don't get me started
 
Did you see that ludicrous display last night
 
10:12 PM
I was stoked that the Falcons won ;) I thought it would be a closer game though
 
I don't think I can handle another Patriots parade.
 
@TravisJ My code in Controller returns 0 because it doesn't exist and this is normal. But inside Foreach I can't make it work to say if variable in foreach doesn't exist do certain things...
 
I don't actually watch sports. I'm a politics guy, which is really ugly right now.
 
@SeventhSon in that case the Boston Women's March went quite well
 
Who won?
 
10:20 PM
@TomW basic human decency
 
Aww maan
I had fifty bucks on bigotry
 
Well they won the election so...
 
Oh, you're one of those whiney liberals, huh?
j/k j/k j/k
I didn't make it out for the Women's march but I was in Manhattan the weekend ofter the election and it was beautiful.
Worked my way up to Trump Tower with my group like we were at a Primus concert.
You guys are hilarious.
 
10:36 PM
Not sure why so many people voted for higher taxes, higher gas prices, decreasing house values, and a ruined stock market. I think they were probably lied to and for some reason believed it.
Now would be probably be a good time to invest in the Renminbi as a hedge.
 
Part of it was the pendulum, but I thought for sure the evangelicals would reject Trump because he's... an asshole. Turns out they just hate liberals more than they love morality.
I really should have known, I was religious when I was young. The modern conservative movement is a cult.
 
@SeventhSon there's also a startling large part of the population who are literally trying to bring about Revelations
 
I think those are valid points, I just wanted to believe more in people I suppose.
 
They support Israel but only because rebuilding the temple on the rock is a prerequisite
 
Yeah, I'm aware of the lore.
 
10:40 PM
@KevinMaxwell - You could check to see if the list has any items and then if not take action.
 
This is the way the world ends,
this is the way the world ends,
this is the way the world ends,
not with a bang but a tweet
2
 
LOL
 
I wish aliens would come and knock some sense into people
 
@erotavlas we're gonna build a wall to keep the aliens out
 
heh
 
10:43 PM
It's refreshing to hear you guys. I get on facebook and there's lots of support for liberalism, but also the usual... fuckery.
 
@mikeTheLiar - We tried that, but the aliens were broke so the wall never got built.
 
I'm pretty enraged about it, since I'm kind of older / midlife.
 
@TravisJ should've pulled on their bootstraps a little harder
@SeventhSon one of the few Trump supporters in my FB friends list has recently switched over to posting about how true patriots are loyal to the country, not the president.
 
@mikeTheLiar I guess that's good news. I also had a conservative lately saying that Trump shouldn't be focusing on the size of his, uh... crowds.
But he'll defend many of his positions anyway.
 
The biggest crowds, the best. Many people are saying.
!!trump
 
10:47 PM
@mikeTheLiar That didn't make much sense. Maybe you meant: drumpf
 
!!drumpf
 
@mikeTheLiar That didn't make much sense. Maybe you meant: trump
 
ah, recursion jokes.
 
lol
 
So, I can't find a job, and I'm panicking. Talk me down. Offer me a job.
 
10:52 PM
@SeventhSon here, have a job
Where are you looking?
 
Awe, thanks.
I'm on Long Island.
 
I heard that there are about to be a lot of construction jobs in trump's new fence company
 
i'll give you my job for $$ 1 million
 
@SeventhSon - Have you tried looking at SO jobs?
 
SO ?
 
10:57 PM
stack overflow
 
No.
 
There is a Jobs tab
 
Christ my careers page is a mess
 
At least it's not American politics
 
zing
!!rimshot
 
zing?
 
The problem is that most of the jobs I've looked at require a high-level knowledge of software design patterns and unit testing, and MVC, and my experience has been diversified webforms and all the associated knowledge, but I'm self-taught and have never worked with a team or been mentored.
 
@mikeTheLiar That didn't make much sense. Use the !!/help command to learn more.
 
Why is the rimshot so melancholy
 
So... I sound like I don't know what I'm talking about even though I've been doing this for years.
 
11:00 PM
@SeventhSon - You will have to be trained on the job then for a new technology stack.
 
Not much OTJ training advertised!
 
@TravisJ because American politics
 
they wouldn't necessarily advertise that
all companies do training, they don't expect you to know everything
 
@SeventhSon - If you don't try to apply then you most certainly wont get a job :P
 
Random question, have you ever read Conservapedia?
 
11:01 PM
> Remember that person who didn't try?
> No? Neither does anyone else.
@KendallFrey - Never heard of it
 
You're in for a treat
 
> Conservapedia is a glorified blog by Andrew Schlafly that masquerades as a Trusworthy "Trustworthy Encyclopedia". Being created as a response to Wikipedia's claimed "liberal bias" (also known as "Reality"), the Website tries to tell the World the Conservative (American) version of our reality.
aka "Reality"... love it
 
And who said that?
 
I have seen conservapedia, it's.. crazy
 
@KendallFrey - LOL
Well, that was google's suggested definition
Ironically coming from liberapedia.com
 
11:03 PM
From who?
@TravisJ That site doesn't exist
 
@KendallFrey - liberapedia.wikia.com/wiki/Conservapedia
Was slightly off apparently
 
liberapedia doesn't look much better
 
I wouldn't assume it was
Fake news is bad no matter where it resides
I didn't realize there were alternative fact wikipedias, that is kind of scary
Hopefully people don't start watering their lawns with Gatorade.
 
11:26 PM
Anybody here good with pInvoke and/or the StructLayout offsets?
 
G'day. o/
 
I have used some pinvoke for exception monitoring
Kendall is probably pretty good with that stuff though too, either way, just ask and find out.
 
I'm trying to get the second version of this one to work: pinvoke.net/default.aspx/Structures/RAWINPUT.html
But I'm getting a, "Could not load type 'Union' from assembly ... because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field."
/// <summary>
/// Contains the raw input from a device.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct RawInput
{
  /// <summary>
  /// Header for the data.
  /// </summary>
  public RawInputHeader Header;
  public Union Data;
  [StructLayout(LayoutKind.Explicit)]
  public struct Union
  {
    /// <summary>
    /// Mouse raw input data.
    /// </summary>
    [FieldOffset(0)]
    public RawMouse Mouse;
    /// <summary>
    /// Keyboard raw input data.
    /// </summary>
    [FieldOffset(0)]
 
Have you looked at any of the SO posts related to that?
 
Are questions asking to highlight potential issues in an implementation suited for SO?
I'm aware of what's generally frowned upon, but I can't make my mind up on this one.
 
11:35 PM
No that would be suited for codereview
 
Gottcha, thanks.
 
Yes, I checked. Everything is for personal problems. But these are Windows calls. I don't have a choice on how things are structured.
This is the C++ Version
typedef struct tagRAWINPUT {
    RAWINPUTHEADER header;
    union {
        RAWMOUSE    mouse;
        RAWKEYBOARD keyboard;
        RAWHID      hid;
    } data;
} RAWINPUT, *PRAWINPUT, *LPRAWINPUT;
 
@David - I am not sure. The SO answers seem to indicate that the size offsets may be problematic when being inferred by the marshaller, but beyond that, I don't have experience with what you are trying
 
@TravisJ inside View or Controller?
 
11:54 PM
Hey All ! I was asked to make a garage-system which deals with Car\Bike\Truck . I've created a Vehicle class and Car\Bike\Truck classes as derived classes . Vehicle is an Abstract class and each Car\Bike\Truck class has it own attributes.

Then, the lecturer added a note saying "you should make the system so if i want to add a new Vehicle (for example a Tractor), no changes should be made in the system
should i cancel Vehicle Abstraction ?
 
@ItayZaguri Why would you do that?
 
so i can make a Vehicle tractor i guess
 
@KevinMaxwell - In the view
 
which is separated from car\bike\truck
 
@TravisJ I even tried this. You know what, I think I need to explain about CaseId and MemberId. Every MemberId has the same CaseId (This is used in a family). I'm showing all the members in a Case/Family. Based on the entry in db for each MemberId, I display the Checkbox to indicate whether this stage has been accomplished are not. Please take a look at the image.
 
01:00 - 19:0019:00 - 00:00

« first day (2291 days earlier)      last day (2640 days later) »