« first day (1505 days earlier)      last day (3449 days later) » 

12:54 AM
migration complete :)
 
1:10 AM
hello
huh i'm tired but i want to implement a sql query before i go to bed. maybe anyone got an idea
gyazo.com/844abdc0572ccaf0576997d9395839b5 <- i think it's clear what i want to do and it's also clear that it's not possible to do a count with a condition. :)
ha cool that works: sum(case when loginsuccess = 1 then 1 else 0 end) as successfulConnection,
 
Hi Team
I have a weird problem i never seen before
 
ok
 
A ctr is running in a loop
not sure why
 
ctr = counter?
 
1:25 AM
constructor
let me show you
 
ah okay
 
public CurrentUser(IPrincipal principal)
{
IsAuthenticated = principal.Identity.IsAuthenticated;
DisplayName = principal.Identity.GetUserName();
UserID = principal.Identity.GetUserId();
if (principal == null) throw new ArgumentNullException("principal");
_systemPrincipal = principal;





}
when i run my app it keeps running it like a while loop
this a class i am creating to manage roles and current user info
 
if (principal == null) throw new ArgumentNullException("principal"); should be in first line
but thats not the issue
 
I agree
maybe it's because of Ninject
let me show you how i have my Injection
 
withut the call method we dont have any chance to help you
 
1:28 AM
kernel.Bind<IPrincipal>().ToMethod(c => HttpContext.Current.User);
 
oh ok. i've never used ninject
 
Thanks
 
i would try
var usr = HttpContext.Current.User;
kernel.Bind<IPrincipal>().ToMethod(c => usr);
just a guess
 
Sounds like an option
for MVC>?
so about last line
did you ever use Iprincipal or IIdentity for MVC?
 
i always use FormsAuthentication in my MVC projects
with an ActionFilterAttribute
 
1:34 AM
here's my problem and how i start getting this erro
r
at first i was using this:kernel.Bind<IIdentity>().ToMethod(c => HttpContext.Current.User.Identity);
and in my class i was able to get the user info like this
public CurrentUser(IIdentity identity)
{
IsAuthenticated = identity.IsAuthenticated;
DisplayName = identity.Name;
UserID = identity.GetUserId();
isCustomer = Roles.IsUserInRole(DisplayName, "Customer");
}
I changed other classes and started getting NULL for Roles.IsUserInRole...
because i guess it's part of IPrincipal
when i tried to use IPrincipal i started having the other issue of repeated execution of the ctr
 
i think it has something to do with ninject
but i have no clue. sorry
 
No Problem buddy
thank you so much for your help
 
good night
yeah i couldnt help :)
 
which one do you use for your Injection?
 
in MVC? nothing :)
i dont need it
 
1:39 AM
:)
I have another problem (More about design)
and Deployment
I am working on an asp.net solution and using my remote testing environment with godaddy. The application is ready for deployment so i have two questions: 1- since the database will be different , i am thinking about using a different Web.config , but not sure how does it work and how to implement that so i can choose easily which web config depending on the poriject/solution

2- the solution i am working on could be personalized and deployed to multiple clients , so each client version will be different (Like the logo and other stuff not the design and functionality), do i need to create s
 
2. store e config of the customers in a DB
query it, build a view model and change the layout or special stuff dependend on the values in the views
or call different partial views. it depends
 
Interesting
didnt think about that before
so what you are saying is to create a new table in my database to manage views and access according to the client
?
 
@if(Model.LayoutType == LayoutTypeEnum.Simple){
Html.Partial("_SimpleView", GetSimpleViewModel(Model))
}
for example
yes. or you just hardcode it
 
I see
interesting!!!
 
depends on how many clients you have, how often you have to change behavior and how different the clients are
 
1:46 AM
i would say 5 for now
 
<img src="@Model.CustomerLogo"/>
or something like that
 
I see
 
you can load the property from your db :)
 
I like this idea
the same thing for Database access since each one will be hosted in a different DB
 
okay i have to sleep now. it's almost 3:00 here
 
1:48 AM
ok Buddy
have a good night
it's 8:48 here
where r u at?
 
germany. you?
 
USA
Thanks
 
okay so have a good day. bye
 
bye
and Dunkichen
Thank you
 
2:09 AM
hey!
let's talk unit testing, if anybody's here
 
2:40 AM
does it slow you down noticeably while coding? what kinds of tests do you create? etc
 
 
5 hours later…
7:28 AM
@AndrewKim I'd say it takes a bit more time but it is also a matter of fixing the code so it works.
If you just hack together shit you can be fast but before the code works it can be some time debugging.
I test happy path, try to think of edge cases and ideally add a failing test for every bug I fix.
Many things are faster to write with tests.
 
I'm starting to worry now: Is it normal that my brain works better on the VS2013 dark theme, as compared to the light? xD
 
The only time tests are really bad is early when things move around much. Huge test code creates an inertia.
 
 
3 hours later…
10:28 AM
How do I use static void X without getting the Error "Expected class, delegate, enum, interface, or struct" when deleting code which called these static void X's?
 
@FoX Huh, what? Code?
 
For instance, I have a method to shorten the typing for Console.ResetColor:

static void ColDel{
Console.ResetColor();
}
 
You might want to make that a valid C# function first.
 
What does this mean?
 
static void ColDel**()** {
Note the ()..
Also, "shortening" things is considered bad and it becomes a nightmare to read.
 
10:40 AM
oh right I forgot to type it in the exampe
it IS actually there
 
So make it public next
And make the class public, too.
And static.
Or just use your ACTUAL sources next time you paste code here :-P
 
The code is horribly long. > 3<
But Im getting the sense that I'm making the error of not using classes
 
Work on making it more comprehensible and use pastebin.
 
Ouh right, that's a great idea! I'll have to restart because it's too messy though.
 
Well, yeah. C# is an object-orientated language for a reason. We frown on statics, but you can use them and there is nothing stopping you from doing that (except if our frowning on you disturbs you)
 
10:43 AM
I like static methods
 
Damn @JohanLarsson. Why, just why.
 
I've been treating statics as objects, mentally at least.
 
@RoelvanUden Not for all things but they are pure & nice :)
 
Sure, as extension methods and deserialization methods for example. But those are more like the exceptions than the standard :P
 
They become extremely testable also
 
10:44 AM
Also, I think that using Console.ResetColor(); is far too annoying to type instead of creating a menthod which simply writes DelCol() when using it often.
 
static can also be a pain for tests, like datetime
 
@FoX Yeah, you might think that now but you'll eventually think "What the hell was I thinking?!". Console.ResetColor is not exactly long, your IDE will autocomplete it, and when you read it, it totally makes sense (opposed to DelCol whatever that means). Note that you will begin to understand the problem once you've shifted your head into a different problem context, and have to read your old code back at some later point -- right now it's crystal clear for sure, for you.
It's the problem that Python-like languages have. It's really concise and there isn't much code needed to express really complex problems, and when you're working on that you'll be all like "Oh yeah, this is so short and sweet! Python is great!". Then, 2 months later you have to fix a problem in that code and think "What the fuck does this even mean?!"
 
That makes quite some sense to me. To get what I'm doing into context, I'm trying to visualize a text-based rpg with the C# Console. But problems and questions arise in high numbers. Probably because I have no prior experience in any other programming language.
Haha, I'm getting where you're going. :D
 
Writing too big lambdas is like that, so convenient to write but ew to read later.
 
10:49 AM
Yeah, to summarize, you write for maximum readability; not shortest code :-P
Especially Lambdas, man, you should see some of mine
 
Shorter is often better though. Formatting is important.
 
376 -> 115 lines of code
whew, I want to achieve that too!
 
10:53 AM
now write it in F# :)
 
@FoX You probably want to make some kind of object-orientated flow in that, and inject your input/output functions so you can talk to some kind of IGameManager and do game.question("blablabla") and not worry about the trivial details of console.
@JohanLarsson I can't seem to get my head around F#..
 
me neither
editor experience is a showstopper for me.
 
The thing is, I've also drawn EVERY single picture for the battle system and dialogues etc.
 
F# power tools seems to be very actively developed so it probably gets better and better
 
Any hints or ideas/guides where I can get inspiration/understanding for a "graphics" engine?
 
10:55 AM
Would love to have resharper for F# when trying to learn
suggestions and help all over the place
 
@FoX I've got nothing for you, unfortunately. TRPGs aren't exactly something I've ever architectured at all. All I've got is the standard stuff for you; SRP, DRY, KISS, IoC, etc. :-/
@JohanLarsson Maybe. I just can't take that everything is supposed to be immutable. It's weird, awkward, and feels like inefficient use of memory and CPU to copy over and over and over.
 
Are there any books or tutorials which would get me going on the rails?
Also, the fudge:
// Iterate through each child.
foreach (var child in Children)
{
// Dispose of the object.
child.Dispose();
}
// Remove the children.
Children = null;
hahaha :,D
 
Err.?
 
It's from your code
child.Dispose(); made me chuckle
 
@RoelvanUden I love the fact that things have to be explicitly mutable
 
10:58 AM
@FoX Oh yeah, gotta dispose of the kids y'know. Annoying little buggers.
 
think C#6 will be great as it makes making a property readonly the easiest / shortest to write
 
Yeah, then it makes sense at least. Let F# remain the test ground for C# features.
 
I would love F# records in C#
 
Records?
 
declare datatypes as lines not files
@RoelvanUden record vs class
Think they are the same thing
 
11:01 AM
Oh yeah that was nice indeed.
 
implementing equality and stuff like that is so huge
and mostly just noise
 
 
9 hours later…
7:49 PM
Hi :D
 
8:18 PM
Hey pewps! Small question regarding this: pastebin.com/uDH5AdkN
Why can't I add +14 to User.pHPts?
 
syntax is invalid
The operator to add a value to a property is +=
 
So, to clarify this, an int of an object is a property.
 
ah, beg your pardon
no, that's not a property, sorry. Usually I would define that as a property, but there is nothing that says you have to
pHPts is just a member
 
Thanks a lot, this cleared a lot of misconceptions now. :3
 
Ignore the notion of properties for the moment, you don't need that right now
so yeah, pHPts + 14 is half of an expression. The compiler expects something = on left hand side
+= is a shorthand for thing = thing + 14
 
8:24 PM
So in context of that: pHPts = pHPts + 14;
works aswell?
 
yep
 
I've been reading through 2 classes - beginner tutorials and neither of them cleared this up for me
these short answers for you really made everything pretty clear to me
from*
 
If you're serious, you're welcome :)
My terseness is not usually appreciated. Usually the response is more like wtf
 
I am dead serious, I'm having lots of problems understanding how unnecessary complicated some tutorials are being expressed in contrast to your short and on the point explanations
 
There's probably some terminology that I can dig up
 
8:39 PM
I'm trying to google some sort of conditions for variables in c# right now, for example:

"variable loc" must not exceed "variable max"

Under prompt may I find this?
Also, these terminologies will most likely clear up a lot of dark clouds for me. :3
Under which prompt*
 
Don't understand the question, sorry
Oh, I think I see.
You'd like to prevent a variable being set to a value outside a given range?
 
Correct!
 
Getting that kind of assurance at compile-time is difficult, if the variable is a primitive type (like an int). There are a few ways you could achieve that
 
I'm working solemly with integers for the time being
 
- Define a type that won't let you construct it with a value outside that range that stands in for an integer. The compiler won't let you assign anything other than that type to the variable
(or any of its derived types, which could still screw it up)
- Define a property and check the range of an assignment, throwing an exception if it's out of bounds
However I have a preferred choice of solving the problem a different way:
Test that you haven't written any code that can assign a value that's not allowed
I think as soon as you've got the fundamental points of the language itself clear, the next thing to learn about, without a doubt, is unit testing. Second most important skill in programming IMHO after knowing how the language itself works
 
8:52 PM
I could aswell enter an if statement like that:

if (User.locHPts > User.maxHPts)
{
User.locHPts = User.maxHPts;
}

though this might seem sloppy I think
which would reside within the main loop*
Would you say I should read into unit testing at least or wait until I've set the fundamentals clear?
 
That would satisfy that requirement, but consider...if you're coding that loop, isn't it simpler to just ensure that the code that sets User.locHPts never attempts to assign a value greater than User.maxHPts? What you're doing there is setting it, then checking whether you've set it to a value that isn't allowed, and amending it
This might be a time to explore properties
 
Thanks for the whole lot of input and taking the time for answering my questions! I'll be coming back soon! :,D
 
no prob
The answer about the range checking depends on what you want to happen when it goes wrong, btw
In a large program there might be a lot of different components that had no knowledge of each other when they were written and the only safe thing to do when someone tries to set a prohibited value is crash the program. That's an option. Probably not very helpful in your case
 
Indeed, I'd not like to shut the program down, just reassign it to the User.maxHPts value
 
There's a continuum to think about: on the one hand there's the situation you're in where the smart money is on various methods of making sure that the code using the class or member of a class doesn't do something that isn't allowed. On the other there's the idea that every component is responsible for preventing itself from being misused and you can't predict what any violation of the rules actually means, so as I said, the only safe thing to do is immediately destroy the running program
most people's code is somewhere in between
 

« first day (1505 days earlier)      last day (3449 days later) »