« first day (1567 days earlier)      last day (3375 days later) » 

1:11 PM
Ladies and gents, it is the 30th day of November, the day of our lord, which happens to be.... FRIDAY :D
hahaha i realize i typed november, but i thought it was funny that i did that
so i hit enter anyway
 
Awesome Friday!
 
Ladies and Gents, it is the 30th day of January, 2015 ...the year of our lord..... which happens to be.... FRIDAY!!!! :D:D
 
to bad february doesnt have 30 days :(
 
fuck
i fail at life today
 
1:13 PM
@Steve Just today? :D
 
@KendallFrey server not found
@Sippy lol suck it
 
@KendallFrey HAHAHA THEY FINALLY BLOCKED THAT AT WORK
Fuck you typed it wrong
 
@Steve oops
 
My hopes .. my dreams .. :<
 
1:15 PM
@Steve did you see my rad new website? freyed.ca
 
lol
good thing my flash plugin needs updated and refuses to run
:p
 
ehehe
 
ITS FRIDAY FRIDAY GOTTA GET DOWN ON FRIDAY
2
#jammin
 
lets just fill the entire star wall with friday messages
everybody do one
 
Is it a fantastically bad idea to have a database call in _Layout? @scheien
 
1:18 PM
well, how'd you get a model to it
 
_Layout don't have no model, noob
 
@Sippy: Why the heck would you even consider it?
:p
 
Checking role permission
Add cookie?
 
@Sippy exactly
 
Can't you check permissions within the controllers?
 
1:19 PM
@Steve I gonna send u a glitter bomb
 
That was good, I'm listening to it again
 
@scheien Not for layout?
 
7AM WAKIN UP IN THE MORNING
 
I'm displaying a button for administrative users
Or, well, there is a div I only want to display to administrative users.
 
you can have sections in your views, that are rendered if present (permission allow it). then have properties in your viewmodel
If you add a permission object to your viewmodel, and then have a @section which renderes if the right permissions are set
 
1:20 PM
That's still gonna go to the database to check permissions
 
Yep, but you do it in the controller
 
wait, she has to catch the bus, which is a 5-seater convertible driven by an underage teen?
 
and populate the viewmodel accordingly
 
Even if you check the permission in the view it still does it serverside though?
 
LOGIC, MOTHERFUCKER. DO YOU SPEAK IT?
 
1:21 PM
uhm ye?
 
So what's the difference between doing it there or in the controller?
 
Do you want a db call from your view?
 
I think it might be a bad idea to have it call the db every time
It's an extension method for the user
So it's like @if (User.IsAuthorisedFor("Management")) { <div></div> }
And that method checks if the user is authorised in the roles shit for Management, but it goes to the db to do it.
 
Can't you run that within the controller?
 
There is no controller action for _Layout.
 
1:31 PM
@RenderSection("SomeSectionName", required: false)
in your layout
Then have a @section in your view
which is rendered if condition is met
scroll down to part #2
 
I want the management part in the navbar which is in _Layout
That's why it's in there
 
@Sippy use a partial view from layout
that way you can build a model for whatever you're using and do the db calls in the dal layer
 
If I rendered it in a section I'd have to mess with javascript to get it in the right place
And pushing stuff into a bootstrap navbar is hard enough anyway xD
 
BAM
 
Why does it matter where I do the DB call?
 
1:33 PM
PURE AWESOMENESS!
the view is dumb
 
i'm not sure if thats a serious q or not
lol
 
Yeah it is, when it's on the client side
 
it only knows about the model it bound to
 
The DB call is done serverside before the view is sent to the client
So what's the difference?
 
therefore it cannot (should not) perform db calls
 
1:34 PM
hhhhhhhhhhhhhhhhhhhhhhhhhnnnnnnnnnnnngggggggghhhhhh
 
if you put db calls allll throughout random places in your code, it'll be coupled to the current rdms you're using, it'll be terrible to maintain because everybody will be looking for db code in the dal
etc
i thought you knew this?
 
What I'm doing isn't doing shit to the maintainability :P
It's one extension method :P
The reason I figured this'd be a bad idea is cos every full page load would need to go to the db for authorisation as admin
 
doesn't it anyway?
 
Yeah but it's doing one extra
 
dont worry about it until it becomes a problem
even if you used partial views in the layout
that db call would still be present
 
1:38 PM
I don't have db calls all throughout the views, dw about that
It's just this extension method
 
it'd just be decoupled from the rest of your stuff
 
Cos I can't think of a decent way to do it
 
Viewmodel
 
layout doesn't accept models
 
rendersection
 
1:39 PM
never heard of it, so maybe? :p
 
How can you know about partials and shit and not know about sections
:P
 
it's awesome
 
i know about areas too
lol
i've read a few mvc books a couple of years ago, and work in it every now and then at work, but not regularly
 
@scheien I just don't see the benefit to my code in using a section for this
It makes it harder to maintain and read, not easier
 
1:40 PM
The benefit is that you don't clog up your views with random calls
 
Plus the section is defined in layout and used in layout surely that's illegal?
 
you have already defined the viewmodel, and it has all the values needed for rendering
all user info, roles, model data will reside within the viewmodel
which you build and return from the given action in your controller
 
Why bother when you have the User object?
That just seems like clutter?
 
why?
 
Extra code for no reason, you already have all that info
That'd be like a coding your own repo on top of EF
An abstraction for what?
 
1:42 PM
for keeping additional values along with the shit you want to show
 
Hm
I do use that approach everywhere else
 
so that all calls to db, all authorization shit happens in the controller, and now everywhere
 
It just seems like a pointless thing to do in the Layout
 
It has nothing specific to do with the layout
 
No but the layout has specific behaviour which prevents it acting as a view
So there is no controller for it
 
1:43 PM
you render that section within the view, and if present it will be rendered in the layout where you have specified it
 
Hm
 
ugh, i pushed to github after a rebase without testing first
just broke my branch
 
@scheien Right you gave me an idea.
Cheers
 
@Steve did you just rewrite public history?
 
well it's on my personal feature branch, so luckily i didn't bone master or something
 
1:45 PM
@Steve push to master! do it! Christ compels you!
@scheien Upvoted you for your troubles as well :P
 
@Sippy: Do read the article about sections, and read about viewmodel. Then you'll connect the dots
 
that was so corny i couldn't stand looking at it
 
@scheien Yeah am doing
 
Upvoted what?
 
Your top answer.
 
1:46 PM
...
 
Free rep!
 
Not really free
You spent 5 mins arguing with someone for it :P
 
hehe
 
@Steve just like my poo this morning
 
@KendallFrey ..................
 
1:47 PM
.......
 
yep, that's pretty much what it looked like
gotta get down on friday
 
o/
 
oh god this code is giving me a hernia
 
@KendallFrey Lol
Any gems?
 
This time it's just creating an instance of a class to use a method that could be static
Foo foo = new Foo();
foo.Bar();
 
1:56 PM
The dev probably like to instantiate stuff
 
The dev probably likes swastikas too
 
or has an OCD so that he/she needs to use the new keyword whenever possible
 
Can you do Child thisChild = parent;?
Or is it the other way round?
 
How killed
Even worse english than I write
 
2:01 PM
@KendallFrey What a shithead.
 
I'm out
Gotta pick up the kids from daycare.
 
hey guys, I am still semi-new to .net, I want to start making some data retrieval classes so I do not need .aspx pages, what kind of files do I create in vs2013?
 
posted on January 30, 2015 by jonskeet

Invoking event handlers in C# has always been a bit of a pain, because an event with no subscribers is usually represented as a null reference. This leads to code like this: The problem It’s important to use the handler local variable, as if instead you access the field twice, it’s possible that the last … Continue reading Clean event handlers invocation with C# 6 →

 
Handlers types?
 
2:04 PM
@KendallFrey Lol
 
would it be a controller file in the App_Data folder? I dont need a front-end component
 
controllers go in controllers folder
 
Lol, I installed NP++ Je suis Charlie
it's typing at me
 
Haha wat
 
I just want to know what type of file to create for backend classes.. I don't need the .aspx portion
 
2:06 PM
allahu akbar!
 
@Sippy So far:
agh, won't let me copy
 
hard to think of a way to search google for what I am saying
 
alt+prtscrn
 
Freedom of expression is like the air we breathe, we don't feel it, until people take it away from us.

For this reason, Je suis Charlie, not because I endorse everything they published, but because I cherish the right to speak out freely without risk even when it offends others.
And no, you cannot just take someone's life for whatever he/she expressed.

Hence this "Je suis Charlie" edition.
- #JeSuisCharlie
that's the end
it typed that over like a minute and a half
 
@JoJo you will still need the aspx file
 
2:07 PM
@KendallFrey Fair message
 
@CharlieBrown ok ty sir
 
@JoJo unless... you switch to ASP.NET MVC, then no aspx file
 
okay
 
if you need more help,. ill be here all day...light workload today
 
Wonderful!!
 
2:09 PM
Lol
 
man i wish i wouldn't have pushed this branch to github
 
@Steve Revert it?
 
@Steve I wish I hadn't pushed my broken merge 2 years ago. But I will never do it again.
 
it was a rebase
 
Yes.
 
2:11 PM
@KendallFrey lol
 
I know what rebase means.
Totally.
 
@Sippy oh yeah, the solution to rewritten history is to rewrite it again
 
i didnt think you could revert a rebase since it rewrites history?
 
@Steve yeah, revert is for commits I think
 
Chuck Norris can revert a rebase.
 
2:11 PM
A couple weeks ago I rewrote public history
 
Error 2 A numeric comparison was attempted on "$(TargetPlatformVersion)" that evaluates to "" instead of a number, in condition "'$(TargetPlatformVersion)' > '8.0'". C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets
 
No one was using it :)
 
i double click the build error, and it takes me to a file thats not even in the solution
lmao
 
probably linked in a project or something
 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets
is where it lives
 
2:13 PM
thats why you should always make backup copies. project_v1, project_v2, project_v3
 
i should have
 
@CharlieBrown oh yeh
 
one for every check in
 
but i got cocky and complacent
who? me? screw up? never :p
 
@CharlieBrown Really?
 
2:14 PM
i refuse to learn rebase so i never use it
@Sippy /sarcasm
 
I refuse to use merge
 
fuck
 
i refuse to use merge except githubs PR
 
@Steve I don't even use it for that :)
unless I have to
 
you can set up PR's to use rebases? or you don't even use PRs?
 
2:14 PM
if anyone is totes into noaa weather data, im doing a noaa mapping side project
weather is so hip these days
 
@CharlieBrown what does it do
 
GH will never do a FF merge, but you don't need to use GH to close PRs
 
overlays noaa buoy data on google maps, then for each buoy displays historical wind and wave data
 
@CharlieBrown that sounds fun and different, were you looking for help?
 
if your bored. once i have the initial set up and hosted
 
2:16 PM
yeah
android made me angry so i'm giving it a break
 
stack is node/hapi/angular
 
why can't grids do colspans, why can't tableviews use an adapter easily
oh i dont know node, that'll be fun
!!google hapi
 
hapi makes node as easy as writing a small json file
 
hapijs
 
2:17 PM
node is old hat. io is the cool new thing
 
why do they have to hate on each other, counterproductive
 
counterreproductive
<redacted>
 
what is io
more server-side js?
 
It's a more modern fork of node.js
 
node peeps got made, and forked node into io
 
2:19 PM
newer language features etc.
 
ah
 
node was driven by joyent, io is open source driven
 
node isn't open source? then how'd people fork it and use it for io
 
im not convinced that open source is not design by committee and this prone to failure
node is open source, but the decisions are made by joyent
 
gotcha
 
2:21 PM
io decisions are made by open source committe voting
 
who determines who to put on that committee?
 
theres lots of angry blog posts about the split
 
ah
 
@CharlieBrown I dont want to have to redirect to my Models >> GetData.aspx page though.. I just want to call a global class.. this is a WebForms app
wont their be redirects needed due to that?
 
@JoJo in webforms, all views/pages must have a class
if you had one class for all of them (which, technically you can), they would all share the same lifecycle and variables/buttons
So, you couldnt have a button named btnMakeUnicorns on 2 different pages
And in your Page_Load method, you would have to handle every page at once
 
2:26 PM
I can see why everyone is jumping to MVC.. our company forbade MVC.. arghh
there must be a workaround I am not thinking of yet..
 
forbade mvc!? yikes! webforms makes maintenance, testing, and coding so much more difficult
The cost to maintain webforms is much higher than mvc
 
roger.. they said it is 4X more costly to develop
amen..
 
Webforms 4x more than MVC... i would agree to that
 
@JoJo Why?
 
both sr's said it costs more in time to develop mvc and the promise of code-reuse is not always realized. I persoannly think we should do it without a doubt in MVC
as my above ^^ case proves..
 
2:30 PM
thats unfortunate
 
dat job security
 
haha
 
Out of all the companies you have to wait for tax documents, you would think eTrade would not be the slowest
 
Friday time
 
2:51 PM
@CharlieBrown I'm trying to conditionally display a div in the layout page dependent on whether or not the user passes an auth check, someone suggested I use sections but I can't figure out a way to actually do it, do you have any knowledge you can drop on me?
 
sections? sounds silly
 
As far as I can tell it'd work fine if I was trying to conditionally render something in a view, but rendering something in the layout, sections just isn't gonna work
And to that end I don't have a view model or a controller for the layout
What I initially had was an extension method for the User object which calls the database but I was told that was wrong
 
@Request.IsAuthenticated { <div> }
Or
 
It's custom authorisation*
 
@User.IsInRole("Unicorns")
 
2:54 PM
Not using role based authentication :3
 
extension method that calls database -> scary, you will lock your page rendering during the call
 
FYI: I just added a class.cs file and now have a global returndataset capability
newdt = AdminII.GetDataTable.ReturnDataSet(strSql);
 
Yeah I figured
 
what are you using?
 
public static bool IsAuthorisedFor(this IPrincipal principal, string activity)
{
	var Context = new Context();
	var userName = principal.Identity.Name.Substring(principal.Identity.Name.LastIndexOf('\\') + 1);
	var user = Context.Users.First(m => m.EHLogin == userName);

	if (Context.ActivityAuthorisations.Any(m => m.ActivityName == activity && m.RoleID == user.RoleID))
		return true;
	return false;
}
 
2:55 PM
ok, no porblem
using SippyNamespace.WonderExtensions;
@User.Identity.IsAuthorizedFor("Making Unicorns") { }
 
that's what I did initially lol
I cri
So there's nothing wrong with that approach in Layout?
 
besides the db call, no
 
How would you deal with the db call?
 
i would cache it
 
Hm
any resources?
 
2:58 PM
otherwise you take the hit ever page load
 
Yeah that's why I initially asked how I should be doing it
 
just repeated stuff like that
I would start with that though, always start with easy, then refactor
 
are you newing up a context in the view there?
 
@CharlieBrown Well fortunately this way I can just add to the extension
 
probs should wrap your context up in a using
 
2:59 PM
Aye
 
public static bool IsAuthorisedFor(this IPrincipal principal, string activity)
{
	using(var Context = new Context()){
	var userName = principal.Identity.Name.Substring(principal.Identity.Name.LastIndexOf('\\') + 1);
	var user = Context.Users.First(m => m.EHLogin == userName);

	if (Context.ActivityAuthorisations.Any(m => m.ActivityName == activity && m.RoleID == user.RoleID))
		return true;
	return false;
       }
}
 

« first day (1567 days earlier)      last day (3375 days later) »