« first day (3168 days earlier)      last day (1763 days later) » 

10:10 AM
ok, C# now you did it
.Select(it => DoStuff(it)) // returns IQueryable<T>
.Select(DoStuff) // returns IEnumerable<T>
now you went completely mad
 
oh i thought the squirrel went mad
nvm
 
10:34 AM
how do I create an EF core initial create migration without connecting to a database?
 
@Squirrelkiller I have one silly qs to ask
how can i create custom log to see all sql queries are running and their runtime error
I tried with elmah but it didn't work
 
Entity Framework?
DBCommand to sql server?
File.WriteAllLines into csv into excel?
 
10:52 AM
input
object[] { 2, 4, 5, 2 }
output
"2,4,5,2"
my try:
return array.Aggregate((a, b) => a.ToString() + "," + b.ToString());
error:
error CS0266: Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)
What I did wrong?
 
return string.Join(",", array.Select(o => o.ToString());
voila
 
@Squirrelkiller I did this to, but CodeWars has problems with this
 
> array.Aggregate("", (current, next) => current + next.ToString())
"2452"
A wait, comma
 
This was the solution on CodeWars:
string.Join(",",array.Select(x=>x is Object[]?PrintArray(x as object[]):x));
 
> array.Aggregate((current, next) => current + "," + next.ToString())
"2,4,5,2"
I don't know why yours doesnt work
 
10:58 AM
sorry
public static string PrintArray(object[] array)
{
return string.Join(",",array.Select(x=>x is Object[]?PrintArray(x as object[]):x));
}
 
Is that...an indefinite recursion that just kills your stack?
 
The challenge was, that there are arrays in your arrays.
 
I thought input was {2, 4, 5, 2}
 
@Squirrelkiller There was different input. This was just one example. Sorry
Sometimes the input was object[]
 
iterative programming
you give me one input, I give you code for the desired output
want the output to a differnt input, gotta give me the different input
 
11:08 AM
:) Yes
 
@Squirrelkiller in my web application I want to catch all the running sql queries into a text file
 
@ratna you could use log4net
there's setup tho
 
@ratna But what actually runs the sql queries?
If you have access to the actual db, you can let the db write a log for you
 
ok . i have db access
 
If you have a wrapper somewhere, you can put log4net or serilog in those wrapper methods
If you want it temporarily for debugging, you can make a trace and watch what queries get to the db
(although I have only done this with MSSQLServer, no idea what you're using)
 
11:14 AM
im using mysql
ok . i'll try with log4net
 
Why is asp so damn inconsistent
 
@CaptainObvious what are you doing wrong this time ;)
 
NRE at ViewData["Title"] = "Schedule";
How can that fuck up
 
@CaptainSquirrel sorry felt asleep
 
11:17 AM
public class pocoData {
	public int id { get; set; }
	public poco1 p1 { get; set; }
	public poco2 p2 { get; set; }
	public poco3 p3 { get; set; }
}
 
If it isn't obvious this is my first netcore and first asp project
 
then I need still to send the whole object for each pocos
 
@CaptainObvious what's your issue?
 
I'm a desktop dweller
 
@Suisse no you don't :D
 
11:18 AM
no?
 
55 secs ago, by Captain Obvious
NRE at ViewData["Title"] = "Schedule";
 
I don't?
 
Your FromJson thing will only populate the relevant poco
so if you pass through a json object with id 1 and poco3 is populated
 
it is doing it automatically?
 
p1 & p2 will be null
ye
 
11:18 AM
no exceptions and so?
aha null
nice nice nice
 
so you just check for which one isn't null
 
then based on that, do your logic
 
11:19 AM
@CaptainObvious is there a reason you are using viewdata and not passing a model?
@AvnerShahar-Kashtan o/
 
I am passing a model, that's just for the page title
 
use viewbag instead
ViewBag.Title = "Schedule"
 
Won't that mean I have to update the _Layout.cshtml
Or will it still work
 
shouldn't do
actually i'm wrong
yes you will
in your _Layout <title>@ViewBag.Title</title>
 
Oh welp, new and exciting error now anywya
RuntimeBinderException: Cannot apply indexing with [] to an expression of type 'Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.DynamicViewData' on same line
 
11:22 AM
eh wot
using viewbag this time?
 
what is the difference between these two ways-
 
>2019
>NullReferenceException
WAT
 
var ob = new Class(1,2,3);

var ob = new Class{x = 1, y = 2, z = 3};
both are initializing props
 
11:23 AM
so apparently asp.net core, you should use IActionResult
well shit
this article i just found uses it
wierd
 
ViewBag is bad, do not reccomend to use
 
quiet you, at least provide reasoning
 
Oh fuck wait
 
Not strongly typed?
 
So using it for the Page title is bad because....?
 
11:26 AM
Cuz he have NullReferenceException in 2012 + 7?
 
except he won't because it doesn't throw a nullreferenceexception if it never gets set?
 
I worked it out
 
what was your issue?
 
He can build "base" ViewModel what will be inheritance by other ViewModels
 
And it was this message that twigged it
 
11:27 AM
Or he can just continue to use ViewBag and save the hassle
 
4 mins ago, by Captain Squirrel
so apparently asp.net core, you should use IActionResult
 
Not from C# 8
 
Damn. But using IActionResult means you can't RedirectToAction with your id?
 
It turns out I created the model but didn't actually return it with the view
 
fool!
@J.Doe according to whom?
 
11:28 AM
Which presumably meant that ViewData wasn't initialised#
 
C# 8 nullable reference types + ViewModel = safe type always
Even in views
 
:D
 
This one isn't the same as where I was using RedirectToAction before, this is a different part
 
right ok
 
If he really need to pass something fast better is ViewData
Even MS dont use any more ViewBag
Since from .Net Core
 
11:32 AM
if anyone could shed a beam on my question
you are being rude to ViewBag
 
@Shad do both of those work?
 
ViewData is dictionary where ViewBag is dynamic
ViewData is better OFC
 
yes
 
Hi, I want to assign a keyboard shortcut to the View.SynchronizeClassView with CTRL + C, V , but it uses also Ctrl + C (overriding the Copy command binding). Any help?
 
11:38 AM
Choose a different shortcut?
 
Why not CTRL-K,S
 
So, any shortcut can't start with a used shortcut? why CTRL+C,V override CTRL+C!
 
Because you're firing Ctrl+C?
If you hit Ctrl+C, how is it meant to know if you're gonna follow up with another or you want to copy?
 
doesn't it listen to the subsequent key to decide?
I thought this how it works with commas
 
11:43 AM
good question
 
Ctrl-C might be specifically problematic for follow-up shortcuts.
Seeing as it's not just a keyboard shortcut, it's an abort/terminate control sequence.
 
If I did Ctrl+C,V I would expect copy and paste
 
@CaptainObvious Nope, it's: CTRL+C,CTRL+V
 
So binding something else to it when CtrlC and CtrlV already have defined functions is just bizarre
Whereas if you start with a key which is knows there will be a followup to, it makes sense
 
agree
 
11:46 AM
It's partly being dumb to the user, but also VS would be clueless if you did CtrlC
 
I chose ALT+C,V .. working without collision
 
That would work
 
12:02 PM
what is [ctrl]+[y] set to?
for y'all folks
 
I'd find out but my VS is running at about 3 frames per minute
 
Anyone ever parse a svg for content?
 
CTRL+Y is opposite of CTRL+Z for me (Y=redo, Z=undo)
 
12:30 PM
@Neil Actually, highlighting text in a screenshot has been quite possible for a while now, from the convenience of your browser. projectnaptha.com
 
I'm same as holly stles
 
@AvnerShahar-Kashtan He was using outlook. But sure, next time I'm rehired by my old company, and he makes the same request, I'll tell him to download the attachment, associate .png files with google chrome, and ask him to open the new attachment so he can highlight the text. Thanks!
 
You're welcome.
It's a pretty cool and streamlined use of OCR.
 
my snipping tool has a highlighter?
 
Jesus christ asp core takes so long to deploy
 
12:43 PM
Try deploying to a 6-node ServiceFabric cluster with 5-minute health-checks between each node deployment. :-\
 
Wtf where is it creating the site.min.css
I changed site.css and the changes are not in deployed version
 
the changes are not showing up on the css itself? or the webpage is not being changed?
 
12:58 PM
did you check in the folder where site.min.css is?
search for it either se or file browser?
 
WOW
Apparently you need to install a package to do it
which isn't isntalled by default with the template
Actually maybe this one
 
@CaptainObvious the whole point of core is that you add what you need
:)
 
Yeah but if the template starts with bundled/minified assets in release config, it should include the file to do that
Otherwise it's just broken from the start
I would expect the default template to work with minor tweaks to the CSS and JS by itself
Oh in fairness the first thing in the CSS is a link to the msdocs article I just posted
Hey it works now
 
1:14 PM
nice!
 
user10864482
good morning
 
afternoon*
:D
 
morning guys
guess who forgot his glasses at home so iget to stare really close to the screen this should be fun
 
NO >:(
@SamuelWakeman go get your glasses
to not wear them is muchobado
 
im not actually nearsight or far sighted theyre jsut a pair of blue light blockers to prevent eye fatigue
 
1:22 PM
oh well in that case
 
ill go get them at lunch, don't think my boss would be very understanding
 
that should do the trick
 
user10864482
I really need to drink my coffee before making stupid assumption
 
I mean
You'd still suffer from it
cuz its blue light
 
1:41 PM
I hate this trend where at the end or beginning of videos, they'll do some promo for a website or product on youtube
 
user10864482
@Neil metrics (ads value) must be very great on that spot
 
@Neil do you mean... an advert?!
 
@CaptainSquirrel yeah, except not really one in any official capacity
 
suprisedpikachu.jpg
 
it's like watching game of thrones, and Tyrion invites everyone to try his new dishwashing formula for getting out the toughest of stains
 
2:01 PM
But he drinks and knows things
who else should tell me what is the best at removing stains
 
Where do stains go?
 
@CaptainSquirrel Ask his chambermaid
 
The Hand of the King is silky smooth thanks to Dawn's newest moisturizing formula
We've had caked-on dishes and we've had greasy dishes but I don't know that we've ever been cursed with a caked-on greasy dish!
 
"Why, Jaime Lannister! You've regrown your hand!" "No, Cersei.. It's the effect of Dawn's new moisterizing formula.. a Johnson & Johnson company."
 
2:06 PM
I once brought a soapbar and a rag into a brothel
 
Hey guys/gals. Noob here. I have an MVC page that provides a form for filtering and displaying some data. It works fine. I placed a button on it to send an additional parameter to the actionmethod indicating that I want to export the results to Excel using EPPlus. That also works fine, resubmitting the form and using the filters/form submission. BUT it doesn't allow the view to be updated because it's returning the file instead of the view. What to do?
 
 
hey im apretty big noob myself. but before your file is returned could you make a call to to another function to update the view?
 
that might be horrible advice just an idea
 
2:10 PM
Ideally you should have to requests
One to update your form
one to get your file
 
But the actionmethod only returns once. I don't understand the concept.
 
Are you doing your request via ajax?
or regular form submission
 
Regular form
 
mkai so
 
Only takes four characters to change that though, aye?
 
2:14 PM
in your OnComplete function, what do you do?
Eh, not really
If you change to an ajax form, you have to change the way your form params are used
 
I don't think I have to change anything except the word Html to Ajax, I've done that with other forms in this project. But not trying to argue...
I don't have an OnComplete function.
in the controller?
 
user10864482
@SeaCharp do you sanitize user input? Meaning do you 'clean' user input before interacting with it
 
Sorry to sound obtuse. That's why I chat here, to struggle, and learn.
 
AFAIK you have to include a new AjaxOptions in the form
Unfortunately, i don't have access to any of my projects to give you an example
 
Sanitize? How is that relevant?
 
2:21 PM
@user23333 I wouldn't think that would be necessary unless you are dealing with writing that to database/handling sensitive info
 
Yeah, I'm just using some LINQ to get the data, not writing ad-hoc, and it's for an intranet site behind a firewall.
And a login
 
user10864482
@CaptainSquirrel I might be wrong but I always tough that if a parameter is coming from the client it need to be checked because there are dirty string outta here.
 
!!shrug
 
¯\_(ツ)_/¯
 
im about to sounds incredibly dumb. it i set a page variable in the cs ongetasync of a razor page how do i access it in the cshtml?
 
2:23 PM
actually
IIRC MVC has security checks in the form submission by default @user23333
You have to use the [AllowHTML] tag on any strings that you try to send html, javascript etc to
 
user10864482
@CaptainSquirrel okok
 
@SamuelWakeman are you passing it to your model?
Do you return said model in your return View
 
no i just want to display the route as the title
 
You could use ViewBag.Title
provided that you didn't remove that from your _Layout.cshtml
@SeaCharp so when your form submission is done & your backend code has finished what happens?
 
It returns a view, for the filter, or a file, for the export, depending on which submit button is pressed.
I'm considering storing the results in TempData or something and returning using this method...

https://stackoverflow.com/questions/3663480/in-asp-mvc-how-can-i-return-a-new-view-and-a-file-to-the-user
Unless there's an easier way
 
2:30 PM
i want do display string id i pass to the index page on getasync as a title. the Viewbag.title just displays te name of the page?
like i created public member variable title class and im depending on it
and i set it here
  public async Task OnGetAsync(string id)
        {
            title = id;

            Subcategory = await _context.Subcategory.ToListAsync();

            foreach (Subcategory item in Subcategory.ToList())
            {
                if (item.CategoryName != id)
                {
                   Subcategory.Remove(item);
                }
            }

        }
please dont cry too hard about how im doing everything wrong.
 
user10864482
there are so many xss bs these days, is Ms mvc holding the fort by default?
 
nvmind im just a big dumb...
 
Sitting down and using my mouse makes my right arm go numb sometimes, and a knot forms in my upper back. I hate getting old. I already can't feel my pinky in my left arm...
 
how old are you
 
@SeaCharp Raise your chair
 
2:39 PM
does vs have a hotkey to close all non pinned windows
 
I'm almost 50
 
> Logger.LogDebug($"Request: {JsonConvert.SerializeObject(request)}");
sees log in log management thing
sees NullReferenceException on that line as well
I guess I will try turning it off and on again
 
I swear I don't feel old though. I still get into the mosh pit!
 
@SeaCharp you need to be sitting upright and ideally you need to have your whole arm resting on your desk
sounds like RSI
 
You don't stop playing when you get old. You get old when you stop playing.
 
2:49 PM
Amen.
Rahmen.
Whatever.
 
I keep trying to force myself to play video games but the ones i want to play just make me angry
apart from my vr which i enjoy
 
RSI? Will hve to google it
 
but one of my vive lighthouses stopped tracking yesterday :(
Repetitive Strain Injury
 
Ah.
 
I've had it before
made half of my hand/arm go numb
feels wierd
 
2:51 PM
Yeah I guess. But freakin ortho doesn't do shit. Been working out, feel like it's a better investment in time than PT.
Half my hand/arm has been numb for about 6 years now. Had a slipped disk.
But now it's hitting the other arm too a bit....
 
-_- i hate NullReferenceExceptions
 
@CaptainSquirrel which vg do you play?
 
Apex Legends Mainly
Might get back into pubg
I've been trying to play Pavlov VR more as well
but that's difficult
cuz broken lighthouse
 
hmm... NRE came from DI which doesnt know what to do with entity framework
 
3:29 PM
I ended up using the solution here:
https://stackoverflow.com/questions/3663480/in-asp-mvc-how-can-i-return-a-new-view-and-a-file-to-the-user
And stored my results from the initial search in TempData
 
mr5
3:41 PM
@CaptainSquirrel you're playing too many games
 
Clearly @mr5
lmao
 
mr5
I only play dotatu
kinda hard to invest in other games
even when I was a kid
I'm loyal to 1 game
only thing makes me move to other games is when I found one that excites me
 
user10864482
i'm a fan of hitman franchise
 
mr5
like Big Fish
hitman reborn?
 
user10864482
 
user10864482
3:47 PM
it's a assassination sandbox basically
 
mr5
ended up here: ioi.dk/jobs
 
hitman is a brilliant franchise
I think i played up to absolution?
 
user10864482
I started with blood money
 
mr5
3:52 PM
I want to get back to C++ someday
 
user10864482
4:17 PM
and I'm also a Kerbal Space Program lover
 
4:39 PM
anyone svg?
Don't tell KendallFrey, he'll talk your ear off
 
4:51 PM
Hi
 
user10864482
hi
 
Why do I need Interfaces for Equality Implementation when I can just override the base object's Equals method?
 
user10864482
@juanvan Scalable Vector Graphics?
 
user10864482
@Shad i found this thorough answer aaronstannard.com/overriding-equality-in-dotnet
 
well thank you, sir!
 
5:00 PM
IEquatable<T> lets you tell callers what types you can be compared to.
(also, you should be overriding GetHashCode at the same time)
 
Thanks @Grace
 
 
3 hours later…
8:03 PM
hey everyone!
 
samuel, you ever enable cors for an api before?
 
never written an api sorry bro
#still in college
out of curiousity does anyone know what a handler is?
public virtual RedirectToPageResult RedirectToPage(string pageName, string pageHandler, object routeValues);
        //
        // Summary:
        //     Redirects (Microsoft.AspNetCore.Http.StatusCodes.Status302Found) to the specified
        //     pageName using the specified fragment.
        //
        // Parameters:
        //   pageName:
        //     The name of the page.
        //
        //   pageHandler:
        //     The page handler to redirect to.
        //
        //   fragment:
in that context^
 
user10864482
hey
 
user10864482
@TomCrosman I have done some api before, maybe I can help
 
8:11 PM
hey user23333
so im just doing a test here
but i have an app with 2 solutions, one is an api, one is an mvc controller
i've enabled cors in both for now
        app.UseCors(options => options.AllowAnyOrigin());
async function GetStuff() {
var config = {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
headers: { 'Authorization': "bearer " + token }
}

let response = await axios.get(`https://localhost:44351/api/values`, config)
alert(response.data)
}
the chat removed my h-t-t-p-s etc
@user23333 any idea?
nevermind it appears to be working, might have been issue with the token
Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.
 
8:31 PM
like im trying to redirect to page but pass in my route id
        return RedirectToPage("./Index", "?id=" , Subcategory.CategoryName);
having troubles
 
user10864482
@TomCrosman sorry i went away
 
no prob
so yeah, axios is blocking my authentication token for some reason
trying to figure out how to disable
 
user10864482
return RedirectToAction("Action", new { id = 99 }); ?
be like, where HomeController is meant as Home (don't add Controller part)
return RedirectToAction("Index", "Home", new { id = 99});
 
sorry...im not sure i understand
axious is front end, so im not calling it on the server
 
user10864482
meant for Samuel, sorry
 
8:42 PM
ohhhh
 
yeah hes helping my tiny boi problems
so like from an edit page i want to return to the homepage of this model with a routeid
that i have changed to a string because im abad bad man
im gonna go write a question and then call it quits for the dayonly 15 min of work left anyway
 
user10864482
@SamuelWakeman do you experience mvc advantages yet?
 
not yet. i feel like tearing everything down to go to mvc is an undertaking that seems too large when theres agood chance tomorrow could be my last full day
 
user10864482
Sorry to hear that
 
i found the issue
i need to set the server to allow headers
        app.UseCors(options => options.AllowAnyOrigin()
                    .AllowAnyHeader());
 
8:51 PM
if i dont get the other job you think its worth trying to figure out how to restructure this or should i just scrap it?
i have like 4 models and i could probably set it up to reference the same dev database i have so far
feel free to msg me whatever youthink imma take off
 
user10864482
@SamuelWakeman I think that in the long run you win from using mvc for many reason. First is that it limit complexity, then at some point you can have many view with a same controller. Also it force you to follow a certain internal structure and that structure stays the same, even when your project will become more complex.
 
user10864482
Overall its a win-win pattern to follow
 
It's good to have some kind of structure when you start your project
It looks like a pain now, and it is, but a good structure will pay dividends later
one of the most important things you can do in software engineering is structure your programs correctly
 

« first day (3168 days earlier)      last day (1763 days later) »