« first day (2029 days earlier)      last day (2927 days later) » 

user47589
9:03 PM
paste your code into the edit box, and press CTRL-K to format it.
 
user47589
1 message moved to Trash can
 
user47589
if you have trouble with formatting it, just paste it into a gist
 
!!format
 
Format your code - hit Ctrl+K before sending and see the faq
 
user47589
i see how EF creates proxies internally.
 
user47589
9:07 PM
ObjectContext.CreateObject<T>()
 
user47589
okay, so is it possible to override this method?
 
I've left that magic box closed so far. I have a basic idea of how it works under the hood but that's about it.
 
user47589
same
 
user47589
i'm surfing the code using ILSpy in an effort to unlock EF's secrets.
 
Surrender your secrets to Zoidberg
 
user47589
9:10 PM
i can inherit from objectcontext, but can't figure out how the dbcontext is related
 
Are there possibly events you could hook into?
 
user47589
i hope so. i think this is a dead end. the dbcontext has an internal constructor that accepts the internal context, and that's how the objectcontext can be set. but its internal
 
user47589
i dont see any events raised though.
 
Some really gnarly reflection might be able to do what you want but that's way above my pay grade. And probably not particularly safe, either.
 
user47589
yeah
 
user47589
9:14 PM
using reflection to get around access modifiers might work, but if MS wanted that constructor to be used by us, it wouldn't be internal.
 
Exactly.
Somebody smarter than us - well, smarter than me at least - made that decision for a good reason.
 
@Amy - why not just remove the noted changes from the changetracker
 
user47589
because it unsets the property back to the "original" value, which is the encrypted one
 
"it"?
 
user47589
the context.
 
user47589
9:15 PM
one second
 
unsets? I thought the point was to read without modification notice
 
Why not just skip EF and use stored procedures and DataReaders? :^)
 
user47589
okay if you do something like this, to tell the change tracker that this property isn't modified: db.Entry(model).Property(x => x.Foo).IsModified = false;, it will actually change the property back to the loaded value
 
user47589
i might move the decryption into a wrapper class and just forget this.
 
user47589
i was hoping for fancy transparent encryption
 
9:19 PM
> transparent encryption
typically that's the opposite of what you want
But yeah the wrapper sounds like the way to go
 
user47589
yeah i think so
 
hmm
 
mmh
 
user47589
i think i figured it out
 
user47589
testing
 
user47589
9:24 PM
nope
 
user47589
wrapper it is
 
anyone got any suggestions for integration testing MVC 5.2.3? stackoverflow.com/questions/37081272/…
 
closed as software recommendation question. this ban cannot be appealed. have a nice day.
 
lol
Decent question, but yeah.
 
Asking what software is compatible with a framework is a recommendation now? or do i just have no sense of humor?
 
9:31 PM
@zwerdlds maybe try Software Recommendations
@zwerdlds It's borderline
 
ugh
wow i cant believe this
 
maybe there exists some magical config setting that makes it work
 
thanks microsoft
lol
 
Eh. Might still get an answer.
 
hmm wtf
 
9:33 PM
<system.web.testing>
    <fuckShitUp Enabled="True">
 
OHHH thats what thats for
i just have so much trouble parsing xml... shoulda known better
so glad json is coming into vogue, definitely would have cought that
 
using System.Net.JustFuckMyShitUp;
 
Last thing I want to solve before i go relax :P, how come that i cant convert 8 bit Bytes into Doubles?
 
Why are you even doing it like that?
just use NextDouble
 
I dont know, I am litterary Try & Erroring how this classes work
 
Also why are you posting screenshots? We prefer code
 
Sorry
 
!!msdn random nextdouble
 
@mikeTheLiar That didn't make much sense. Maybe you meant: mdn
@mikeTheLiar Something went on fire; status 403
 
I can type I swear
Oh that's right. Broken google. :/
 
9:37 PM
@Amy - why does it matter if the value goes back to default? Are you persisting these back to the db? If not, then disconnect the proxy before decrypting, or optionally just disregard the entire thing since it isn't going back to the db anyway
 
NextDouble doesnt take any overloads?
 
@Froxer - Not from people like you! :P
 
:(
 
Should it?
Okay, let's back up. What are you trying to do?
 
Randomize 3 numbers and fill 3 book variables from a ClassBook class.
 
9:43 PM
So you just want 3 random numbers? Given your example it seems like your requirements might be a bit more complex
 
Well, I was making it too complex
Because I didnt know how to approach it.
 
Do you want random doubles? Are ints acceptable?
 
I want doubles since I am fucking around right now with Floats, Doubles, Decimals
 
Is there a range of acceptable values?
 
No
 
9:45 PM
how dumb am I?
 
Then just use NextDouble. The results will all be between 0 and 1
@Codeman so dumb
Like a rock that learned to program
 
so dumb that I was getting annoyed that my changes weren't showing up when I deployed... without realizing I hadn't saved my changes in VS...
 
@Codeman xD been there
Or trying to commit without saving changes. Done that too
@Froxer If you need values >1 multiply by the max acceptable value
books.AddGrade(randGen.NextDouble())
Or
double maxValue = 100.0;
books.AddGrade(randGen.NextDouble() * maxValue)
 
oh
 
Does that make sense?
 
9:47 PM
yea
ofc
thanks
 
or use Next with a range
 
randGen.Next(low,high);
 
@TravisJ he specifically wants doubles
 
        static void Main(string[] args)
        {
            Random randomGen = new Random();
            GradeBook book = new GradeBook();
            var randDouble = randomGen.NextDouble();
            book.AddGrade(randDouble);
            book.AddGrade(randDouble);
            book.AddGrade(randDouble);
            //GradeBook book2 = new GradeBook();
            //book2.AddGrade(50);
        }
easy
 
9:48 PM
And don't forget high is non-inclusive for Next
@Froxer press up then Ctrl+K to format your code
 
ctrl-k, crtl-d
foxer that will put the same random double in all three addGrade arguments
 
For future reference, Google is really good with stuff like this. Literally googling "c# generate random double" is all you need to do
 
yea, i seen that now in the debugger
 
for(int i = 0; i < 3; i++)
{
        var randDouble = randomGen.NextDouble();
        book.AddGrade(randDouble);
 }
 
@Froxer - Those grades will all be the same
 
9:51 PM
yea i am aware, i am writing a loop
hold on..
 
You need to call nextdouble each time in order to make them random
 
reaching for the random or
 
Also, in my opinion exposing AddGrade() instead of exposing the internal List<Grade> is an anti pattern in my opinion.
 
Enumerable.Range(0,3).map(i => randomGen.NextDouble()).ToList().ForEach(rn => {book.AddGrade(rn);})
 
@zwerdlds lol
 
9:52 PM
finally some clarity on where RC2 is going blogs.msdn.microsoft.com/dotnet/2016/05/06/…
RTM by the end of june :)
(2023)
 
ITS SO EXPRESSIVE
 
k, let me debug before i pasta my code snippet
ok, i see yea. Thanks guys

(I did it like this)
static void Main(string[] args)
{
Random randomGen = new Random();
GradeBook book = new GradeBook();
for (double randDouble = 0; randDouble < 3; randDouble++)
{
randomGen.NextDouble();
book.AddGrade(randDouble);
}

GradeBook book2 = new GradeBook();
book2.AddGrade(50);

}
but of course it should be as @mikeTheLiar wrote.
As my example prints 1,2,3 in my grades.
 
Because you're not doing anything with the random values
 
yea, i realized
 
randomGen.NextDouble(); // value is discarded
book.AddGrade(randDouble); // add the loop counter to grades
Anyway, that's quittin' time. Officially the weekend.
 
10:00 PM
Yea
 
damn you
 
Have a good couple days everybody!
 
Alright, im gonna go chill as well. Just didnt want to leave this as it is but get to the end of it
Gonna document about my new understanding of this & go chill :)
 
Program & Chill
 
What do you guys do when you learn something new?
I have a Google.Docs i just write down a few notes with some print screens
 
10:02 PM
reading the spec is a good way to learn, at least you'll have the ability to find what you need later
 
I guess i should stop doing print screens, as that text will be hard to do maintenance on when i learn more later.
 
you're probably overthinking it
if you're unsure of the software a good tool can be unit tests
 
I am, always. It is my struggle
 
i write really insignificant unit tests on tried and true software so i can base my new layer on something concrete
like
Assert.AreEqual((1+1), 2)
Seems like the learning issue you're running into now could be encapsulated in red-green development cycle
 
Yea
There is a lot of (Well most of my learning) is coming from Trial & Error
right now
 
10:05 PM
red-green development is just a formalization of that
 
I see
 
you write a test that fails initially
then you refactor your software until it passes
Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: first an (initially failing) automated test case is written that defines a desired improvement or new function. Then, the minimum amount of code is written to pass that test, and finally one refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence. Test-driven development is related to the test-first programming concepts of...
I encourage everyone to follow this
its expecially good for software you dont understand
 
@zwerdlds wat
 
what wat
 
don't be offended when i say this but
do you commit code like that on a team of developers?
 
10:12 PM
code like what?
 
user4451265
Hi, I have been asked to accomplish a task: to use "<something I don't remember> service", to accept a string and return another string.. I can't remember if that "something" was a windows or web service. I don't want to ask him to remind me, I don't want to look like as a fool. Can anyone help, because I've never used any of them, and I'm about to learn it.
 
Assert.AreEqual((1+1), 2)
 
oh lol
no
just demoing an assertion to forxer
 
It was understandable, basically create Units you can use later on that obviously will pass unit testing. But how do you even know that some Units will pass for certain?
 
when you're writing the software ultimately you want it to match your concept. you should test your concepts in the unit tests, so having a unit test that fails on the concept before the concept is created is correct
you know they will pass because they must. if the test is inapplicable, it shouldnt exist
 
10:15 PM
I see
 
for example
you have a method AddOne. Your unit test would start as Assert.AreEqual(AddOne(1), 2) saying that you expect the result of AddOne(1) to be 2. If you just stub out the "complex" functionality of AddOne to always return 0, your test will fail until your implementation is correct for that test case.

Creating tests as you go has two other benefits: if something breaks due to refactoring and that failure is covered by a test case, you will know once you run the test again. Additionally, test cases show how to use the software, so when someone new comes into a project they can take a look at
 
Do you mind if i save that in my doc?
 
Free as in beer
 
Thanks man
 
of course
 
user4451265
11:06 PM
Can anyone help me please, can you guess what service he meant?
 
user47589
11:56 PM
@MohammedElshawaf you will need to ask. you can't complete the task to his requirements if you don't know them. in the future, take notes. we won't be table to tell you what kind of service he meant - it could be any number of things.
 
user4451265
So, both of them can make such function?!
 
user47589
what?
 

« first day (2029 days earlier)      last day (2927 days later) »