« first day (3163 days earlier)      last day (1770 days later) » 

12:00 PM
lol what
 
Aye, AFAIK special characters which work on certain Databases and execute code
Guys. I'll leave chat for the weekend, i need to concentrate on this hellhole
have a nice day !
seeing you!
 
(true & true)=true

!(true & !true)=true
!(true & !false)=false
!(false & !true)=true
!(false & !false)=true
 
HAMMERTIME!
 
shut it, bot
 
12:05 PM
Hi, I have some question about ASP.NET. Can it be asked here?
 
Sure thing
 
So there are four cases, first predicate selects only true,true. The second predicate selects true,true, false,true and false,false leaving true,false never selected in either.
 
However, don't ask to ask, just ask. If someone can help you, they will 😀 @phwt
EMOJI
WHERE DID THAT COME FROM
Is anyone else seeing this...
😀 😬 😃 😛 😒
like, yellow faces
 
Confim yellow faces.
 
Okay, I'm learning ASP.NET but there are many types of them. MVC, web forms, web API. Is it a subset of ASP.NET or it's completely different topics?
 
12:08 PM
They're all ASP.NET
 
Indeed
They have different ways of working & serving your data
 
ASP.NET is shit ton of classes written by microsoft
 
web API for example, you'd use if you were building a service etc
MVC is what you should use for site's, however if you are unfamiliar with it i'd recommend having a look around at some articles regarding it and how to use it
 
web forms is legacy now
 
web forms i've never used, however as far as i know the general consensus is to stay away if you can
ya
 
12:09 PM
like soooo legacy :)
 
webforms is what we had before mvc
 
Thanks, and about ASP.NET core are they in ASP.NET?
 
no
asp.net has the same idea, but it is full code revamp as far as I know
 
Web forms separated .net code and html markup, MVC brought them back together :)
 
Okay, Thanks for clarification!
 
12:10 PM
with minimum of what you need
 
asp.net core works on .net core
from my experience with it (Very little)
they are similar
 
That's all I have to ask. Thanks again to all of you.
 
Hi
I had an online programming test. And I lost so much time because my code was not executable. :(
my first test
There were only classes without a main method and I didn't know how to add main. :(
 
probably worth knowing how to add one :P
 
12:21 PM
@kame I had test where code wouldn't compile online, but it works in my IDE
Also that online tool had 0 support for intelisense and code formating
 
:(
@Neil from now on I will know it. :D Or how to set it up in the properties!
 
Like seriously are you testing devs so they know how to add main method or actual performance and how they would approach issues
 
Properties - Application - Startup Object
 
Maybe I have personal grudge on all job interviews that rejected me
 
@Raimonds yeah I agree, kind of a stupid test
 
12:24 PM
Hmmmmm
 
mr5
hame
 
if they want to test your programming ability, at least ensure they know exactly what it is supposed to do and have all the means to start coding it
 
Maybe a programmer should know how to handle these "exceptions"
 
Nobody knows all the stuff anyways, I do google a lot of things
 
@kame let me test your skill as a programmer, and I'll deem you worthy for a job (and if you want to)
 
12:25 PM
As long as you are capable of solving issues you should be fine, even tho how you do that might not always be best way
 
@Raimonds I thought you have to know it. I studied a lot by myself. But never trained such cases.
 
test me :D
 
@Neil How to test this?
:D
 
write a fizzbuzz algorithm in pseudocode (prints out all the numbers from 1 to 100, except if it is a multiple of 3, "fizz", if it is a multiple of 5, "buzz", and if it is both, "fizzbuzz")
 
I have a manner of carefully choosing wording so people often consider me less skilled
sounds like directly from grad test for job ;D
 
12:26 PM
@neil okay I will try. :D
 
and no, it isn't a joke, a lot of so-called programmers can't do this
 
I had that kind of interview
1st was do a 1 to 100 backwards loop
 
i had one of them once too
struggled at first cause the operator you use is so rarely used
 
well it said print numbers from 1 to 100 in opposite direction and they gave me for loop
and second was build MVC application with EF
like you can tell difference :D
1st is what my university taught me over course of 4 years
 
So I'm gonna wrap every controller method we have in a using(){} block, completely. Any ides how to make this better?
 
12:29 PM
for (int i = 0; i < 100; i++)
{
if (i % 15 == 0)
{
Console.WriteLine("fizzbuzz");
continue;
}
if (i % 3 == 0)
{
Console.WriteLine("fizz");
}
if (i % 5 == 0)
{
Console.WriteLine("buzz");
}

}
 
I looked for a posibility to make an attribte but they dont work this way it seems
 
!!tell kame format
 
@kame Format your code - hit Ctrl+K before sending and see the faq
 
@Squirrelkiller Why are u doing this?
 
12:29 PM
So we get more log context
each method sets its own context
 
so basically every action in a controller starts with using?
I think you can use some sort of action filters or inherit from BaseController maybe
 
yes
action filters?
 
I should start with I am bad at theory
 
@kame You didn't write out the numbers.
 
Yes
 
12:32 PM
I think they call them class attributes / decorators
 
[HttpPost] <-- this guy
[Authenticate] <--- and this on
public actionresult ....
 
Fatal Error: Console.ReadKey() is not supported in .NET Fiddle.
 
I understand how people version an API using either the URL or Headers, but how do you go about versioning it within the actual source code? I have a .NET App with a "Product" Controller, and at above the class declaration I have [Route("api/v1/[controller]")] as an attribute. If I need a v2 of just my PUT endpoint, but the v1 in the PUT endpoint still needs to be supported, where would the v2 live?
 
12:33 PM
4 mins ago, by Squirrelkiller
I looked for a posibility to make an attribte but they dont work this way it seems
it seems
Maybe I didint look the right way
 
@SteveEggering I would say pass version as part of header
not url
 
Can I make my own action filter that gets called both before and after a decorated method?
 
@Squirrelkiller you can put it on controller itself not just actions
 
But every action has its own context
 
Haven't tried but maybe instance of action being called will be available in context of that attribute
 
12:35 PM
many share a context, but many have diffferent ones too
 
and you should be able to emm make using factory? :D
 
@HollyStyles no correct --> dotnetfiddle.net/a3yEu1
 
That would apply proper using depending on context of attribute
 
oh shit they even have a log example :D
 
ffs sounds already complex
 
12:36 PM
Thanks, I just didnt know hte right name :D
 
when I used logging libs they were able to pick loggers based on config gile
file
 
@kame closer but it emits 'fizzbuzz' on first line :)
 
like if it is X controller and Y action use this logger
 
@kame you need to start i at 1 not 0 in the main loop.
 
@Raimonds I have thought about changing that, but then I still have the question of how that works. Do I have redirect logic inside the PUT endpoint that points it to different resources based on that header?
 
12:38 PM
@SteveEggering We have controllers named like ProductControllerV2 and ProductControllerV1. The ProductControllerV2 extends ProductControllerV1. The router tries to find the exact match based on the path (/api/v2/products). If found, use it, otherwise decrement version by 1 and try again, etc. So, when you have 10 versions of the API and version 10 only adds something new, you could have ProductControllerV10 and ProductControllerV1.
So version 2-9 would all hit ProductControllerV1 instead of V10
 
Well I can tell you that we now use it in url and it's bit of a mess since nobody really knows how things differ and what call does what, not saying header info changes that but url would stay consistant
There is some kind of "best practices" when it comes to versioning of apis
 
All of the best practice articles I find are seemingly very happy to talk about naming conventions, but not a lot of talk about architecture
 
Maybe having version in url isn't that bad after all who knows
I've seen big players change their api without giving any notice
 
like why is my code so broken, oh they changed this class a bit, ok adjusted fix, week later they revert change...
@HéctorÁlvarez Hey
 
12:41 PM
Thank Talos it's Fredas, just in case we were missing the weekly quote.
 
I'm back to confuse all
 
I've also thought about moving the "v1" out of the controller route. So it would just be "api/[controller]", then putting the version in the [HttpPut("v2")]
 
.Where(x => new[] { componentGuid, newParentComponentGuid }.Contains(x.Guid)) would be the same as .Where(x => componentGuid == x.Guid || newParentComponentGuid == x.Guid); or am i mistaken?
 
My suggestion to versioning feels so ignored.
 
@SteveEggering I would literaly deploy versioned builds of the whole application to another virtual directory in the web-server. Like: Default Web Site/v1/ and Default Web Site/v2
 
12:43 PM
@RoelvanUden how does a suggestion feel anything?
 
Hey, today I was finally told the X in this X-Y problem I'm trying to solve. Turns out the full week studying a script and elaborating a document was just a waste of time, the real problem was that there was a small piece of this script failing and I have to fix it.
 
@RoelvanUden I have actually talked to my boss about your way already, and it might be the path we take.
 
@Squirrelintraining linq is cool it combines everything in chain to 1 single operation
 
Just looking for ideas
 
and I think contains would give your bool where "where" would give u collection
 
12:43 PM
@HollyStyles I was to fast. Sorry.
 
@Raimonds thanks for your input i guesss
 
@Squirrelintraining I think the 2nd should be faster.
 
oh I am now closer looking at your linq
 
@kame no need to apologise.
 
@HéctorÁlvarez Yeah me two, and defintelly it will be vs. RAM but vs. Database i don't know
 
12:44 PM
never saw that kind of usage of where
 
@SteveEggering Aight.
 
It confuses me aswell
 
so confusing
 
@Squirrelintraining Uuuh LINQ to SQL? That smells bad. If you can retrieve the code it generates I might be able to see further.
I mean the actual SQL
 
@HéctorÁlvarez How to do that?
 
12:48 PM
No query is made until you do ToList() or FirstOrDefault() or sort of thing that materialises it
 
I don't know by heart, but I used to retrieve the monstruous queries that LINQ-to-SQL generated back in the day.
 
@HéctorÁlvarez pls tell me how
pppplllls
 
use quick watch
 
an IQueryable is basically a SQL query with a fancy object name.
 
on IQueriable
it has statment
 
12:49 PM
You know that feeling when you don't want to fix it anymore, but just want to add a new fuction which overrides the wrong changes and write the corect one
 
I see rob is quite popular in the star board
 
Aka, there is a hole in the wall and what you do is just to add anotehr layer of tapestry to cover it
 
@Squirrelintraining I know point where you have changed too much and there is no way back and no power to move forward ;D
 
@Squirrelintraining you need a log of what queries EF runs?
or do you need to convert an IQueryable to an sql query?
 
@Wietlol The firsters
Or the later i don't know
 
12:50 PM
Tapestry? Look, it's the bourgeoisie in squirrel shape! We use newspapers here and some have poo traces.
 
i am confused to say
 
context.Database.Log = Console.WriteLine;
 
@HéctorÁlvarez newspapers? BAh! Back in the day we where lucky if we had a wall at all!
 
(change Console.WriteLine to whatever you want to use to log the queries)
 
Then you didn't have any holes to plug
 
12:51 PM
you can always run SQL "traffic sniffer" forgot it's name ...
built in tool
 
SQL Analyzer?
 
no
 
Phew I just came up with that name
 
its built in sql managment studio
it's like application on it's own
 
@RoelvanUden Did you have to add any custom logic to the router to make it roll down in number?
 
12:54 PM
Yes. We wrote a piece of code for it.
 
SQL profiler
is the name of that tool
 
@Raimonds but then you assume we use sql server management studio
changes one business logic thing (loading attachments from byte[] to loading from url)
adds in 7 async + await expressions to flow chain
messes up entire readability of the code
 
@SteveEggering A little nuance: The piece of code is nothing more than an attribute implementing IApiVersionProvider taking a min and max parameter. Then generates the list of Versions based on said min and max. So when we create a controller V10, we tag that as [ ApiVersionsSupported(10)] and change the ProductControllerV1 to [ApiVersionsSupported(1, 9)]
 
@Wietlol I do indeed
 
hey guys i have a situation right now. a varriable of mine is always set to false any ide why that might be ?
button 1
button 2
@if (Model.Product.Approved != false)
{
    @if ((await AuthorizationService.AuthorizeAsync(
    User, Model.Product, ProductOperations.Reject)).Succeeded)
    {
        <form style="display:inline;" method="post">
            <input type="hidden" name="id" value="@Model.Product.ProductID" />
            <input type="hidden" name="approved" value="@false" />
            <button type="submit" class="btn btn-xs btn-success">Reject</button>
        </form>
    }
}
 
1:09 PM
!!tell sam format
 
@sam Format your code - hit Ctrl+K before sending and see the faq
 
Press the up arrow and edit your comments with proper formatting please
 
@RoelvanUden So if you want to change the functionality of the POST endpoint. You create ProductControllerV2, add a POST endpoint to it. Later, you want to change the functionality of PUT endpoint, do you create ProductControllerV3 and just add the PUT endpoint to it?
 
Wrong tag order
xd
 
when did markdown stop working
I had it right and it didn't work so I second guessed myself
 
1:12 PM
It didn't Mike
[text](link)
 
Cause I'm dyslexic.
 
@MikeTheLiar cuz u raitin' in da ink-rekt orda
 
im reposting button 1 because it would let me edit formatting
   @if (Model.Product.Approved != true)
{
    @if ((await AuthorizationService.AuthorizeAsync(
    User, Model.Product, ProductOperations.Approve)).Succeeded)
    {
        <form style="display:inline;" method="post">
            <input type="hidden" name="id" value="@Model.Product.ProductID" />
            <input type="hidden" name="approved" value="@true" />
            <button type="submit" class="btn btn-xs btn-success">Approve</button>
        </form>
    }
}
tgere we go
there we
go
basically one buutton is supposed to give it a true value
 
@SamuelWakeman You still have unformatted code. In any case I'll suggest you provide us a pastebin with your code because it's messing up the chat.
 
1:14 PM
thats a good idea
the value being passed to apporved on post async always ends up being false
I think im just an idiot have only been coding with dot net for a coupleweeks
 
I can't look at it in-depth but I'll suggest one thing:
if (Model.Product.Approved != false)
if (Model.Product.Approved)
Those 2 do the same. I'm telling you because it looks like you only started coding recently.
Not just .NET
 
no its not that i only started coding recently
i know that
i worked with a copied and pasted modified tutorial and was going quick this
line used to involve an enum
where in addition to being approved or rejected it could just be submitted
 
Wut, well that's a big code smell, if I read that code I'd assume the person who did it had no idea how to code and would start over myself.
 
im just like well all things are rejected until they are submitted so i made it a bool
 
I mean IDK what the background is, just what I see when I read it.
 
1:21 PM
no the code used to look like @if (Model.Contact.Status != ContactStatus.Rejected)
 
and seeing if(bool != false) makes me more than suspicious
 
i was trying to change it quick
 
@Wietlol Why github and not gitlab?
 
Right I understand. Still what I told you, the background doesn't really matter.
I'm not trying to bash you, it's just a tip
 
ok. noted
 
1:22 PM
@SamuelWakeman: bool defaults to false, I believe on post to server the value of the input element is not being mapped to the input parameter in the controller method.
 
I'm off, have a nice weekend
 
how do i fix that
 
@HéctorÁlvarez the rules for link markdown were right in the FAQ all along
 
i cant accesss that link
 
Do anchors break youtube embeds?
 
1:28 PM
MVC is all about convention over configuration. Your controller method signature should take the full Model object as an input parameter not some random primitives. Should use the HTML helpers to bind Model.Product.Approved to the input element in the cshtml
e.g. @Html.HiddenFor(model => model.Product.Approved)
The idea is the model properties are bound to the controls in the cshtml server-side, (serialized if you will into Html form controls) controls are edited client-side, form post back to server MVC de-serializes htnl control values and hydrates a model object that's passed as input to controller method.
 
dont really understand the html hidden for helper tag but something like this maybe?
 
@SteveEggering Yes. Up the maximum version (V1->V2) and create a ProductControllerV2 that extends from V1. Then create a new POST endpoint. You can still use the base.POST if desired, and all other actions still work because you inherited from V1.
 
ok no thats defnitely wrong
 
What type is Model? Looks like Product is a property on the Model object.
 
Ok bare with me i may sound dumb but model is a folder product is a class i created inside the namespace
 
1:38 PM
what's the fist line of your cshtml?
 
namespace EisenNetwork.Pages.Products
 
should be @model EisenNetwork.Pages.Products
So your controller method should be OnPostAsync(EisenNetwork.Pages.Products products){…}
if(ModelState.IsValid){Context.Product.Update(products.Product);}
 
so i lied and cant read
@model EisenNetwork.Pages.Products.DetailsModel
that is my first line in cshtml
 
OK but the convention still stands, the ViewModel type that you bind in the cshtml form should be the type you receive in the controller method you post back to.
In your case then the ViewModel is EisenNetwork.Pages.Products.DetailsModel
 
1:55 PM
ok gonna do another paste bin ithink my cs is better but my cshtml might stilll be shit
that gives me an error when i try to accesss the page now
InvalidOperationException: Could not create an instance of type 'EisenNetwork.Pages.Products.DetailsModel'. Model bound complex types must not be abstract or value types and must have a parameterless constructor. Alternatively, give the 'products' parameter a non-null default value.
 
I think now though your model is too complex
You have a deep object graph
but your form is only two properties
 

« first day (3163 days earlier)      last day (1770 days later) »