« first day (3748 days earlier)      last day (1183 days later) » 
02:00 - 12:0012:00 - 21:00

12:34 PM
if I don't have pt2.4 of Infiltration up by tonight, Imma need someone here to kick my ass
 
I don't understand what pt2.4 of Infiltration up means, but I will (remotely) kick your ass later if you don't have it.
 
just keep an eye on the self-promo channel in the server
 
I'm not on the discord server tho
 
yh the link no worky anymore :(
 
Due to recent ban waves, here's a link to our community discord discord.gg/PNMq3pBSUe
Does 2
See descoroption
 
12:46 PM
Doesn't matter to me, I don't actually want to join
If SO as a whole moved the chat system to discord, that would be ok.
But otherwise, it's detrimental to the community.
 
@Squirrelintraining Doh, I'd been using the tagged one in the starred menu xD
Completely misserd that one in the description xD
good job im not an IT Manager or something :/
 
It's your job to lead not to read doh
 
hey I heard something scary yesterday
some experts on empires have said that usually vast empires last about 250 years before crumbling from stretching themselves too thin
 
@Squirrelkiller Totally saving that for use in the future
lol
 
Best fucking line from the Simpsons movie, all credits to the writers^^
 
12:52 PM
@Freerey Yeh but it's more of a land area thing
 
the US has still stretched itself too thin :P
 
@Freerey What happened to divide et impera
 
@Squirrelkiller lol i didnt remember that one, dont remember a huge amount from the movie tbf
 
also there's some conspiracy about how empires crumble when Pluto returns..or something
last Pluto return was 1776 and it's coming back next year
 
@Squirrelkiller It's just a coincedence, and depends on what count as an empire
I mean look at the Roman/Byzantine Empire, that last nearly 2000 years overall
 
12:54 PM
George Lucas said the galactic empire was an allusion to the US, and Palpatine was basically Richard Nixon :P
 
tbf, that's more depth to his writing than ive ever noticed
 
Pig shit makes lake dead -> Schwarzeneggger delivers historical line and taps on folder to put glass on Springfield -> Simpsons sneak off to Alaska -> Springfield gets dangerous to the world, so Schwarzenegger lets too-powerful-dude drop bomb into Springfield -> Simpsons come back and save Springfield.

That is basically the movie.
 
I mean he fucked up the prequels by trying to hide the fact Jar Jar Binks was going to be the main villain
 
@DAustin btw....was that really the same empire for that entire time? they had so many reforms throughout the years that after about 400, nobody really cared about Rome anymore
eastern Rome was still around, but nobody was really afraid of them anymore
 
@Freerey It's why I said it depends on what you count as an empire, but even if you just take the byzantine empire by itself, that lasted until the 1500s
 
12:57 PM
hmmm you right
 
@Freerey Well I've been saying it for years: The USA need a french kind of revolution.
 
lol that's what I've been saying....and I legit am ethnically French, so the typical respons I get is "stfu Frenchie"
 
re: Jar Jar, had he have followed through with that, it would have been a pretty cool twist, but he cowed to pressure from the internet
brb
 
I mean the guy who played jarjar legit became suicidal after TPM came out
 
Jar Jar should be next sith.
 
1:01 PM
Jar Jar should have become a grey Jedi
 
wanting revenge Padmé flips Jar Jar
 
Like "Why'se not let juveniles play'se with girlse"
"Just talk'se to them, stupid Jedi'se"
 
Jar Jar had the time to watch and plan how to grab the power
learned politics from the best
 
wdym? Jar Jar spelled the Jedi's doom by giving Palpatine emergency executive powers
 
but we don't see how Jar Jar become full fledged sith
 
1:08 PM
@DAustin yeah that was my bad only valid for 24 hours upsi
@Squirrelkiller i know you litl' rebel
 
we don't see it, but we find out at the end of RotJ that he survived all the slaughter, which tells us he must have been in on it
 
Nah he's Jar Jar, he's damn good at running away from other people's problems
 
[Squirrel in Training] also daustino
[Squirrel in Training] this link should always wörk
[Squirrel in Training] Why y'all be spoilering every old movie?
 
so does anyone ever have issues with a Sys.WebForms.PageRequestManagerServerErrorException when clicking an imagebutton in asp.net?
 
I got da link SiT thnx, just chowingdown before hopping on
@ntohl Well, there's a theory...
quite a good one actually, buts an old Cracked Video
 
1:34 PM
Btw Soilent Green is people
3
Since we're spoilering stuff anyway
 
@Squirrelkiller Is it a spoiler if it naver actually got released that way? :P
@Squirrelkiller xD never actually watched that
@Squirrelkiller Ever watched Memento?
 
2:10 PM
I've seen it.
 
Not yet, I definitely have to watch it though.
 
I've drank soylent green before
 
Yeh it's good, nothing quite like it I've seen before or since
 
3:02 PM
Ryan Donovan on January 19, 2021
When people say “CI/CD,” they are only talking about continuous integration. Nobody is talking about (or practicing) continuous deployment. AT ALL. It’s like we have all forgotten it exists. It’s time to change that.
 
3:45 PM
btw: wow that is some bad cgi on jarjar in the thumbnail
you can really tell how dated it is when it's a still image
 
4:02 PM
[Captain Obvious] @DAustin what were you on about with the discord link last night
[Captain Obvious] I only saw it when I got in bed so I just didn't do shit
[Squirrel in Training] feierabend wie das dufted
 
...warum essen die eigentlich abends Teewurst?
 
Ich glaub ss-kaliert gleich
 
@Squirrelkiller how would you translate Subway to Sally - Sarabande de Noir?
 
[Squirrel in Training] sa-rtet gleich aus hier im chat!
[Squirrel in Training] as an overrated mittelalterband @Ntohl
[Hans1984] de-eSSkalieren Sie !
[Squirrel in Training] jetzt reichtsadler !
 
4:11 PM
@ntohl Is Subway to Sally a movie or something? To what should I translate it? Sarabande de Noir feels french but I don't know any french except the usual stuff.
 
[Hans1984] hahaha
 
[Captain Obvious] > Subway to Sally is a folk metal band that was founded in Potsdam, Germany, in the early 1990s.
 
I bought their CD not long ago. Nostalgia stuff
 
[Captain Obvious] "nostalgia"
 
4:13 PM
Nord Nord Ost is awesome.
 
[Captain Obvious] > last 3 studio albums: 2011, 2014, 2019
[Captain Obvious] That one's only 15 years old
 
Released August 22, 2005
 
[Captain Obvious] Searching for them on spotify makes the search break... Either that or the spotify search has just stopped wokring
 
4:35 PM
@Botler Not to worry @CaptainObvious turns out I was using the wrong link the whole time xD
@Freerey lol i wasnt looking that close but you're right
 
I have a questions about Views in MVC.
I have code like this:
foreach (string element in list)
        {
            <p>The Quick Brown Fox Jumps Over

                @Html.Display(element)

            </p>
            <hr>
        }
I'm trying to display the value of element on a webpage but the above code does not display the value of element on the web page
 
[Captain Obvious] You can just do @Element and it will spit the value out
 
Can a View only display data from a model passed to it by the controller?
 
[Captain Obvious] Pretty much, although that's sort of the idea
[Captain Obvious] The controllers controls what you get, and the view displays what you get ib some way
[Captain Obvious] That's an awful example but 🤷‍♂️
 
@CaptainObvious brilliant, thanks
@CaptainObvious but doesn't the fact that @element displays the value of element show that a View can display any C# expression, not just data from a view model?
4 mins ago, by Botler
[Captain Obvious] Pretty much, although that's sort of the idea
And, why does the following code need `Html.DisplayFor(...) in order to display property values of item?
@foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ReleaseDate)
            </td>@foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ReleaseDate)
            </td>
...
}
 
4:48 PM
Display for is an override
For instance item.ReleaseDate will be a DateTime
but DisplayFor will be how you want you DateTimes to be formatted, rather than just spitting out the raw value
These can be defined on the model with data annotations
for instance
hold on loading up an example project
ah to hell with it, here's the tech doc
 
3 hours ago, by Squirrelkiller
Btw Soilent Green is people
can't even spell soylent right
 
@DAustin Thanks, so DisplayFor is short for DisplayFormat?
 
kinda, there's a whole bunch of other stuff, like DisplayName will be automagically used for Labels on forms etc
 
At the moment I have more code in one view than I have in the controller. What code should a view not contain?
Maybe I'm doing too much of the heavy lifting in the view?
 
@Freerey Today is maths day, I have no mental capacity for correct spelling
 
4:59 PM
@DAustin What is the code @Html.DisplayFor(modelItem => item.Title) doing?
 
The view shouldn't be performing any logic ideally
just passing out the data it has from the controller
or to the controller in a post request for instance
@BlackPanther Go look at the item class
 
@DAustin logic as in operations?
 
For the Title property, if there's anything set there to customise it, it'll display the value as requested, rather than what the raw value is. Again DateTime being a good example the raw value will be in the format yyyy-MM-dd hh:mm:ss or something simlar, but DIsplayFor may output it in the format dd/MM/yyyy
If you think about an app that needs to be localised, as in used in multiple languages, you want stuff top be formatted the right way, but you don't want to have to write the code out for each location yourself, so this does that for you
@BlackPanther Depends on the operation, but ideally that should have already been done in the Model
This is why we have ViewModels and DTOs (DataTransferObjects)
Your model maybe a direct representation of some table in your database, but you might not need or want to pass all the data from that table to the view, it'll slow it down
so you take the data you want, massage it how you need it, and put it in a DTO/ViewModel
 
@DAustin I passed a model object to the view from the controller, but then I've had to do lots of operations on this model object such as LINQ queries, switch statement, goto, and foreach statements to get the list collection which is the collection whose data the View needs to display.
Is it only this part that should be in the view:
27 mins ago, by Black Panther
foreach (string element in list)
        {
            <p>The Quick Brown Fox Jumps Over

                @Html.Display(element)

            </p>
            <hr>
        }
 
this then increases security, improves performance, and allows you to cuustomise the data and format it without messing with the actual model of the table
@BlackPanther yeah ideally
 
5:07 PM
@DAustin What item class?
 
i mean you can still do operations in the view, its just considered bad practice, because then you're splitting the responsibility of managing an object into multiple places, which can be hard to debug
@BlackPanther When you were asking about modelItem => item.Title
@BlackPanther These operations should be done in the model, before the object is passed back to controller
 
@DAustin I see, so I should really only use @Html.DisplayFor(...) for model objects. I don't get why in the lambda expression modelItem => item.Title the input variable is declared as modelItem when it is never used since the body of the lambda expression is the single expression item.Title?
@DAustin That makes a lot of sense
@DAustin You mean ideally that should have already been done in the controller?
 
@BlackPanther Ideally before then, the controller must be calling up some sort of class?
 
@DAustin Yes to select only properties of the model that we want to show users of the web app.
 
Right, that code in the controller should actually be a method within the class you are calling
 
5:13 PM
@DAustin Understood, so using a View model (i.e. DTO) is not just about security, but also for performance
 
and you should possibly create a DTO class depending on the use case, which is just a collection of the properties you want
return that class from the called class via the method you will create with the controller code
and then the controller will only have one line to get that object in one go
ill bring up an example
ok this code has a bad smell in it but it'll make the point
    public List<SpecialPriceDTO> getSpecialPriceReport(int filter)
        {
            Customer c = new Customer();

            List<ItemCustomerPrice> prices = c.GetCustomerSpecialPrices(filter, connStr);
            List<int> itemIds = prices.Select(x => x.Id).Distinct().ToList();
            List<SpecialPriceDTO> results = new List<SpecialPriceDTO>();
            using (var _ctx = new CoreModels(connStr))
            {
                results = _ctx.Item.AsNoTracking().Where(x => itemIds.Contains(x.ID)).Select(x => new SpecialPriceDTO()
 
@DAustin Damn, I see. So only the final form of the data should be passed to the view, instead of the view breaking down a large model into a smaller model. Is this right?
 
see the bit in the linq query x => new SpecialPriceDTO() ?
that tells entity framework, only get these values from the item table and nothing else, and create me an instance of my DTO to hold the data
ans SpecialPriceDTO looks like
public class SpecialPriceDTO
    {
        public int ItemId { get; set; }
        public String Lookup { get; set; }
        public String Name { get; set; }
        public String Brand { get; set; }
        public int DepartmentId { get; set; }
        public String DepartmentName { get; set; }
        public int CategoryId { get; set; }
        public String CategoryName { get; set; }
        public Double Quantity { get; set; }
        public Double SpecialPrice { get; set; }
    }
 
@DAustin Whose job is it to manage objects, is it the controller?
 
5:21 PM
kind of, the object will do a lot of management internally just by the nature of your code, but public methods on that object can be used by the caller, in this case that will be the controller
so you could have a document object that has a public Save() method and another public Print() method
so in the controller you could say <T> myObject = new myObject();
myObject.Save();
myObject.Print();
from the controller
 
what is this god-object heresy?
 
lol ah Wiet, always has a better way
you wanna take over?
 
whats the case?
 
@DAustin Wait, what. I don't get this. As far as I know, the model is just classes that represent data for your app. You can't actually do any operations in model classes because they are just property bags. What do you mean that these operations should be done in the model before the object is passed back to the controller? Can you clarify?
 
@Wietlol Scroll up, just talking about passing data from the db to the vioew etc, DTOs etc
@BlackPanther You can put methods on those classes if you like, that just operates on it within memory
Sorry I should have been saying ViewModel instead of Model there
but there's nothing against having methods against your classes that represent tables in the database
I have a Customer class that is exactly that
but I have a method in it that allows me to get a custom DueDate for payments depending on a load of parameters the sales team specify
it's there because I need access to that DueDate function in multiple places in the codebase
 
5:26 PM
@DAustin No, the controller is not calling methods from a class which I suspect it is a library that you are thinking of, it is calling static methods in the controller class though.
 
what I would recommend is create a clear boundary between data and operation
between state and procedure
 
so if I put it on the class that is used to get the data in and out of the database, it will always be available to all of my apps that call it, then any changes to that logic will be reflected everywhere its used
 
a class is either
a, a data class, only there to represent something purely by properties
b, a processor class, only there to operate on the data
 
@Wietlol Strong disagree
 
myObject.Print(); violates this principle
you would have a class ObjectPrinter : IPrinter<MyObject>
and you would do printer.Print(myObject);
 
5:29 PM
@Wietlol interesting
 
same for myObject.Save();
 
yeh that's actually a better implementation in that case
TIL
 
@DAustin Is this a method in the controller class?
 
the controller really shouldnt have methods beyond the request endpoints
That would be in the model
or ViewModel* i should say
 
0.o?
 
5:31 PM
depending on your implementation
 
@DAustin So that creates a Data transfer object that will be passed to the view, or in other words that creates a model for the view (i.e. a view model).
 
@BlackPanther I would pass that DTO to the controller
So you see above where Wiet is talking about:
a class is either
a, a data class, only there to represent something purely by properties
b, a processor class, only there to operate on the data
 
@DAustin I think we have a misunderstanding. When you said that the following:
26 mins ago, by DAustin
@BlackPanther These operations should be done in the model, before the object is passed back to controller
 
I misunderstood him at first, this is what we are doing
 
23 mins ago, by DAustin
@BlackPanther Ideally before then, the controller must be calling up some sort of class?
 
5:36 PM
i meant class instead of model
 
I was confused but I know now you are talking about the DbContext. My app does not havea DbContext
 
the class is the processor here, and the model is your table
ah ok
 
My model is just classes that are property bags
 
right
 
EntityFrameWork Core is not used in the app
But most of what you've said is still good to know.
In the view I should not be obtaining a smaller model from a bigger model.
I was writing this kind of code in the view:
results = _ctx.Item.AsNoTracking().Where(x => itemIds.Contains(x.ID)).Select(x => new SpecialPriceDTO()
                {
                    ItemId = x.ID,
                    Lookup = x.ItemLookupCode,
                    Name = x.Description,
                    Brand = x.SubDescription1.Trim(),
                    DepartmentId = x.DepartmentID,
                    DepartmentName = x.Department.Name,
                    CategoryId = x.CategoryID,
                    CategoryName = x.Category.Name,
 
5:42 PM
@BlackPanther Yeh, it's not that doing that is against the law or anything, because as you saw it worked
the issue is with maintenance and code reuse
that code in the view would only ever be available in that view
if you wanted it somewhere else you'd have to duplicate it
and if you wanted to change it you'd have to change all instance of it everywhere, which means some might get missed and then oh dear stuff is breaking
 
@DAustin Interesting, I've only seen classes that are property bags being used strictly for that purpose.
 
so by having the processor class, you can use that same bit of code multiple times in multiple views
@BlackPanther Well it's also a time constraint, that method should be ideally in an extension class, to keep them separate
 
@Wietlol Can you elaborate?
 
but i didnt have time when i needed it to set that all up, adding the method to the class that was the db representation worked and solved the issue
@BlackPanther He's talking about the same thing, but using different terminology (and not fucking it up like me haha)
 
@Wietlol Yep, that's very clear.
 
5:49 PM
So you have a class
 
@DAustin Yeah, when I found out you could use a view template file just like any csharp file I took some liberties.
 
@BlackPanther It's how we learn
It's also why i subject myself to scrutiny from people like Wiet, its a quick way to learn when you've done something wrong xD
 
@DAustin Yep, I should probably remove that code from the view and put it into an assistance (i.e. helper) method in the controller, because I will create a second action that may need that code.
 
@BlackPanther THe other thing is the pattern you're using
for instance this whole time I've been talking about MVC
but you might be using a different pattern? i just assumed lol
 
@DAustin Yup
@DAustin So it is best practice to pass a view model whose data the view is actually going to display.
 
5:57 PM
@BlackPanther I would follow the official documentation here: docs.microsoft.com/en-gb/aspnet/core/tutorials/first-mvc-app/…
but in essence yes
 
@DAustin You mean data classes that also have methods?
@DAustin True, an extension class would be better
 
@BlackPanther not sure what you mean, in Wiet's opinion that's bad practice, in my own opinion, as long as I can track down the code that produces the data easily then its fine
even if that data is just the pure model or a DTO
 
@DAustin I see, he did eleborate, he meant this:
32 mins ago, by Wietlol
a class is either
a, a data class, only there to represent something purely by properties
b, a processor class, only there to operate on the data
@DAustin Yup, Wiet that doesn't actually program using C# yet has a very deep understanding of the language
@DAustin I'm still getting used to this pattern talk. Wiet introduced me to the repository pattern recently
@DAustin Yes, it's MVC
 
@BlackPanther it's because C# is hugely inspired by Java, which is his fave
 
@DAustin I mean for example a class that represents a database table row but has methods that operate on the data in its properties. This is how you did it as opposed to putting that functionality in an extension class.
 
6:09 PM
@BlackPanther Yeh, and ideally the methods would be in a separate class, but I was lazy and it worked. The key thing at the time I needed was that the same function was available to all my apps, which this accomplished
 
No, I think @Wietlol favorite language is Kotlin
 
@BlackPanther I know I think he hates Java with a passion, was trying to trigger him but he's not here lol
 
haha, be careful triggering a lion, he might bight
@DAustin great chat, and I learned a bit. I hope your 3 months notice at your midlands employer is coming to an end and you've found a new employer with a more modern stack.
I have to head off to buy a suit case, and get some food
o/
One more thing, why doesn't a multi-line comment (/**/) and end of line comment (//) properly comment code in a view template (.cshtml) file?
Sometimes commenting using /**/ or // adds @* *@ to the code
 
o/ cheers but i made a deal and stayed on, surprised you remember
@BlackPanther It depends where you are in the file, if you're in the code block, that is the bit that's doing c# good stuff, then you need to use the c# razor comments @* etc
Im not sure why but it's probably a HTML/CSS/JS compatibility thing
just guessing though tbh
 
7:02 PM
hey
ive seen that in ajax if you made a lets say post request
the result contains a response
im wondering how to return a response in asp.net
i get post, use it, and return some response
return json response
 
Hi guys
 
7:26 PM
Omer you can return a JsonResult
 
7:52 PM
but how
ive searched for 1 hr
still dont understand
lets say i got post data in cshtml
and that post was sent by ajax
so i get it by httpcontext.request.form
now how to return
this is my code
@page
@using ExaminerApp.Pages.Server
@using Microsoft.AspNetCore.Http;
@model CookiesModel
@{
Layout = "";
ViewData["Title"] = "Error - Access denied";

var Post = HttpContext.Request.Form;

switch (Post["type"])
{
case "set":
var cookieOptions = new CookieOptions();
cookieOptions.Path = Post["path"];
cookieOptions.Expires = new DateTimeOffset(Convert.ToDateTime(Post["expires"]));
HttpContext.Response.Cookies.Append(Post["name"], Post["value"], cookieOptions);
break;

case "delete":
var abc = new CookieOptions();
btw im using asp.net core
not mvc project
ajax sends by:
$.ajax({
type: 'POST',
url: '/Server/Cookies',
headers:
{
"RequestVerificationToken": '@GetAntiXsrfRequestToken()'
},
data: {
type: "set",
name: "cookieDialogShown",
value: "true",
path: "/",
@{
var expires = DateTime.Now.AddDays(30);
}
expires: "@expires"
},
success: function (data) {
console.log("Success. Cookie prompt will not be shown for 30 days.");
}
});
 
asp.net core is The web libraries of CORE
MVC is a subset, RazorPages is a subset, Blazor is a subset, WebForms is a subset of asp.net
 
@BlackPanther you'd be wrong tho...
@BlackPanther I do
what do you think all my rants are sourced by?
:D
 
lol
 
@BlackPanther no, no I cant :D
 
@OmerHijazi I hope this help you c-sharpcorner.com/article/…
 
8:10 PM
well how could i in razorpages
@BobWhite ok
 
are you using netcore?
 
yes
@BobWhite this works thanks!!!
 
did links work?
is it what you were looking for?
 
yup
will try
but its the thing i wanna do
ajax, response etc
thanks again!
 
02:00 - 12:0012:00 - 21:00

« first day (3748 days earlier)      last day (1183 days later) »