« first day    last day (1338 days later) » 

12:50 AM
What
Up
 
1:26 AM
Hey Brock!
You missed it on slack. I put in a sell for all the btc I own in liquid format.
 
 
7 hours later…
8:02 AM
snowing outside.
 
8:35 AM
Ssnnnoooowww
Hey @BrockHensley
 
Woo snow!
 
9:28 AM
oh oh
I need a linq expression I think :3
 
Kat.Select(c=>c.LinqExpression); //I'm a helper.
 
is it really this simple:
public ActionResult GetPalletData(string palletCodeType)
        {
            var model = Utilities.Utility.GetPalletTypes().FirstOrDefault(m => m.PartCode == palletCodeType);
            return Json(new {success = true, width = model.Width, length = model.Length, weight = model.Weight});
        }
Aha. Guess not
oh it is.. I just had to trim it. doh.
 
9:50 AM
Ya got it?
also, you might be a happier camper using a json serializer.
 
10:14 AM
That is a Json serializerrrrr woooo
 
You give me shit for manually converting sql response to an object, but you let that fly?
 
I mean return Json() is built in
 
NewtonSoft is a default reference iirc. It's got model serializers/deserializers right there.
 
10:33 AM
Yeah but so is return Json :D
I mean I'm not sure what you're suggesting other than return Content(JsonConvert.SerializeObject(new { bla }), "application/json")
 
I mean, that's exactly what I'm suggesting - only instead of a new blah it'd be model
 
I see, but return Json(model) is the same :D
 
Notice how that's not what she's doing?
also, for some definitions of same. I'm too tired/vba-minded to conjure the differences.
 
Yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees I get it I was just wondering on using a json serializer - that's what is happening, the idea is to use a model but she doesn't even do that for params :(
VBA makes me sad
 
it has collections, and collections can have keys. Keys are supposed to be unique. But they fucking aren't. and I want to find John Kemeny and Tom Kurtz and punch them in the throat for inventing BASIC.
(TrueBASIC was the first language I learned. I don't mean that. I just really hate VBA.)
 
11:41 AM
Hi all
 
Morning
 
Morning, Rudi
 
12:30 PM
Let's say we have a web app that requires authentication + authorization. There are form fields displayed for some roles as read-only/disabled
Do we need to worry about the logged on, authorized users tampering with values of these fields?
Some folks suggest using an encrypted token with the field: sergeyakopov.com/tamper-proof-hidden-fields-in-asp-net-mvc
This is overkill, I think, but not sure
 
12:51 PM
i r lurker now
 
1:04 PM
Woo hallo @Kcvin
@Alex Yes, you do. But you can do it server side easily by role restricting the model changes on the action. Why are you displaying them for postback in the first instance if they can't be changed?
So that you have a sample, we have something similar and use EF's .SetValues() method (if you're using EF too it's v useful)
var changes = new { postedModel.Property };
var entry = DbContext.Entry(dbModel);
entry.CurrentValues.SetValues(changes);
if (User.IsInRole(nameof(Roles.SuperAdmin)) {
    entry.CurrentValues.SetValues(new { postedModel.SuperProperty });
}
 
We show the values for some roles as read-only while other roles can edit
Hmm. We're using EF but hadn't used SetValues
 
Fair enough, but you could remove the name attribute from the input to stop them from posting back in the first instance
That's security through obscurity, of course, so would still need the server side protection too
But it's reducing transmitted data which is always nice
SetValues is nice, only takes the changes you pass :)
 
The way this is designed, the fields are required on db so passing null will blow up the db update
 
Oh no, you're not passing the whole model through are you and storing it back in DB?
That's flaw 101 of web apps :(
 
Kinda
 
1:13 PM
db.Entry(postedModel).Status = Changed; or whatever it is right
 
We pass fields for that tab, which has its own form
They're a subset of all fields
Yup, we do that + db.SaveChanges();
Hmm. Correction, we're using SetValue()
 
I'd get out of that habit ASAP 😀 SetValues will let you store only the fields you choose, can be a whole model if desired but nah
It's like using [Bind(..)], always better to explicitly define what you want storing in DB, which fields to overwrite etc
 
Can I come work where you work? :)
The issues that I notice in this code drive me bonkers
 
Haha you wouldn't like it here, we discover and/or create new issues every minute :D
 
Hey, we do the same, though not every minute... maybe hourly
BTW, how do you remove name from form field in Razor?
new {name = null} ?
 
1:26 PM
If you're using the HTML Helpers it's probably quite a lot harder
Not sure it would pay attention to that
 
Yup, lots of posts on this: stackoverflow.com/questions/6057865/…
If you specify Name, it'll add 2 names w/ MVC 4+
Hmm. What if I append -Ignore to it and then check for that before calling SetValue?
 
You could, but if you're creating an anonymous type of things to update, just role restrict it
Then you don't need to worry about any of that crap anyway
Cos you're only setting the values that you explicitly allow for that role
 
1:47 PM
Yup, I've got a custom [Authorize] attribute on the action w/ the roles, + a check in the action to ensure the user only updates their record
Yup, that's what I'm thinking... this user can mangle his own data if he wants, but no one else's
 
Think of it from a non-security perspective
You change that model, add another field, haven't updated that view - everything breaks
If you're defining the fields that you're updating instead, you've got no risk of breakage, and no risk of fields being overwritten
 
2:02 PM
Server-side is all we control in web dev
 
3:01 PM
AspNetMvcFarmer.GenerateTumbleweeds(9);
* * * * * * * * *
 
3:22 PM
🤣
 
3:38 PM
Well, this gal is WpfFarmer's cousin
 
We just bought a Christmas tree that PLAYS MUSIC
Festive af
 
Nice!
 
Lemme try and get the video sec
 
Prefer folks get artificial ones... no live trees hurt
 
https://_assets.cedita.one/FESTIVEAF.mp4
 
3:46 PM
Me like
 
Welcome @mahendrayadav!
 
We need to put a sign in the hallway so folks know this room's open again ;)
 
Haha yes
 
"Free cookies and wifi! Meet and greet this afternoon!"
 
4:11 PM
Hi, I'm Kevin and I'm addicted to powdered sugar donuts holes... am I in the right place?
 
4:22 PM
Come on in. Please fill out the sign-up sheet over there. Then grab a powdered sugar donut hole and join us at the round table.
 
:'DDD
 
 
2 hours later…
6:28 PM
BEWHAHAHAHAHA. I am your god now!
 

« first day    last day (1338 days later) »