« first day (3462 days earlier)      last day (1469 days later) » 

11:01 AM
I am wondering if anyone could help/turn me into right direction about the issue I'm having: I am using DateTime.Now in a project and I need to have a different date for testing purposes for the DaTeTime.Now.So far I googled that I need to use mocking, but I am not that far into unit testing to know what to do else.
 
You have an interface and a class that implements the code
Mocking is creating another class that also implements the interface, and use it instead
 
System.DateTime.Now
 
mr5
the initial estimate for a demo app has almost quadrupled the time spent for development
 
Example: to avoid communicating with external webservice you can mock the ExternalServiceClass that implements IExternalService
 
mr5
I'm so going to get fired soon
 
11:04 AM
estimated
 
Yesterday a friend got an email from HH.RR. asking for his address to "update the file", today he got fired
 
@Squirrelkiller wow, thank you sharing :)
respect to squirrel in training :)
Take care man
but do little stretching exercises to keep your join strong, no?
@mr5 please no negative stuff...lol
you will get promoted :D
 
@bradbury9 wow :(
 
mr5
@Shad that is highly unlikely to happen for the next years
 
...
you are awsome man
 
11:09 AM
@bradbury9 so in a code(class in that case) that uses DateTime.Now i need to pass something that implements a specific interface?
@bradbury9 that's sad
 
mr5
I'm currently working in the frontend, which means, I'm dealing with a lot of UI stuffs.
I'm also not the type of dev who delivers on time but the one who enjoys challenging stuff and always taking the longest route.
I'm not fit with the company. Basically, not fit with IT Solutions
Well, it's not that really negative for me.
I just need to find the next company that deals with long term solutions instead of a company that releases apps every couple of months.
 
hmm
even my long term goal is to be in a Product Company
but right now I have a lot of stuff to learn and get comfortable with that happens in IT service comapanies
 
mr5
Wuhan finally lifted their lockdown
It took them 76 days
 
hey
so I added self referencing properties
 public Guid? SubTaskRef1Id { get; set; }
        [ForeignKey("SubTaskRef1Id")]
        public ProjectTask SubTaskRef1 { get; set; }

        public Guid? SubTaskRef2Id { get; set; }
        [ForeignKey("SubTaskRef2Id")]
        public ProjectTask SubTaskRef2 { get; set;
I am getting Unable to determine the relationship represented by navigation property
 
mr5
11:25 AM
Are they in the same class?
 
yes
class Name is itself ProjectTask
 
mr5
Well, that doesn't seem logical to me
Foreign keys are used to reference other keys located in other tables/modules/classes
 
so I just remove ForeinKey attribute?
lol
 
mr5
what was your initial intention?
why did you put foreign key attributes?
 
they are supposed to self reference to other pks of the same table
 
11:35 AM
@Gintas it might be sad (more work) but it is what you have to do
DateTime.Now is a special kind of trap
 
@Shad If I stop the exercises for too long, I will have even less far to bend my knee after some time. You can't believe how happy I was when the backside of my thigh could finally touch my calf again!
 
@Wietlol but i was given this notion or a feedback rather that tests should not influence the code?
 
Something you wouldn't think about acutally missing lol
 
tests shouldnt influence code, but your code is wrong in the first place
the problem you are facing is the issue related to "tell, don't ask"
 
@Gintas Make that method work on any datetime, and pass the datetime from the outside. Then, to test your business logic, just pass the datetime you need for the test.
 
11:38 AM
the principle is quite simple, calling your code should tell it what values it should operate on
instead of having the code ask for the values in hindsight
if asking is required, then tell where to ask
you should never skip the "tell" part
DateTime.Now is asking
and no one told where to ask it from, it just gets asked for
with that problem, you have a tight coupling with, in this case, which frigging time/date it is at the moment you ran the code
 
@Squirrelkiller I was doing that in a constructor, passing a Datetime, but it's wrong
 
which is probably one of the most horrific issues you can imagine
"ye, this code only breaks on tuesdays between 18:00 and 18:15"
"well? then test it and fix it on tuesday between 18:00 and 18:15"
 
@Squirrelkiller because the datetime being passed is only used in tests, so how do I work this logic backwards
Doesn't matter if I make it in a seperate method/do it via interface or whatever, still it's only for the tests.
 
I mean, there are probably some use cases where passing it in the constructor is the right choice, like if you want to know when the object was constructed. Or...not sure, when the object represents a certain point in time, or it represents an invoice, and that needs a dateimte obviously.
 
@Gintas in your normal code, the datetime which would be passed would be DateTime.Now
can you share the code?
 
11:42 AM
Wietlol is probably right on this one. It's probably not right in the constructor. I jsut don't know the actual use case, so I can't say for sure.
I'd accept the explanation of what the object represents and what the datetime represents.
 
Hello, I'm making a folder explorer using WebBrowser, do you guys knows if we can add a folder that we typically see in explorer that allows you to go one folder back? I want to avoid having to do a button for going back
 
I often avoid the explanation because code is less ambiguous :D
 
with FluentApi I am able to do so
 
but on the other hand, I might be bitten by the sheer volume of the code
 
I did this
modelBuilder.Entity<ProjectTask>()
                    .HasOne(c => c.SubTaskRef1)
                    .WithMany()
                    .HasForeignKey(c => c.SubTaskRef1Id);
 
11:46 AM
@MarioR. I see no reason why not
 
But how can we achieve this? I'm just trying to avoid having to make a new question on the website
 
how did you achieve normal folders?
 
@Squirrelkiller I can understand the feel. Though I can't do it anymore. Lol
 
I just put the folder path as my uri
 
and one folder up can not use the folder path?
 
11:47 AM
Do you know when you browse a zip of explorer ++ there's another folder that does folder up
and it puts you back in the parent
 
often named "...", yes
 
yes how can i add thsi to the webbrowser?
I can make a button out of the browser but i'm tryign to find a way to do this directly in the browser
 
@Squirrelkiller @Wietlol hastebin.com/oyuwogucag.cpp
 
what is the difference between a button to do it and... whatever you want to have it do it?
 
aesthetic
 
11:50 AM
just visuals?
as in, difference between <button> and <a> ?
 
no
i would also prefer that option to manage several webbrowser at the same time
 
I am slightly confused as I do assume you are not literally making a web browser itself
but just make it in html
 
i am making a file explorer
webbrowser allows you to open a directory on your pc
and you can explorer it
 
and what are you making the file explorer in?
C# WPF?
 
winforms
 
11:53 AM
ok, and at some point, when you render your user interface, you have an array of children of a particular folder you currently have opened... right?
 
yeah i have a treeview for that
 
and, you could, just insert another item at the beginning of your treeview, with the text "..." and a handler that would open the parent folder, right?
@Gintas just to be clear... an ILog is a logger, not a log itself, right?
 
@Wietlol correct, hence the I starting letter
 
im not sure that is what the I was for
so, this datetime tells you what the folder/file should be named that the log would be written in?
 
well look AsyncLog is an implementation of ILog interface's methods and few extra things, LogEntry is a log itself
 
12:01 PM
so, AsyncLog is a logger
 
I would expect LogEntry to be an entry to a log, whereas the actual log is either a class or a List<LogEntry> called Log.
Log is the list in which entries are added. The thing writing things into the log is a logger. You might have your interface naming mixed up.
 
I will look into that, how you think should the interface be named then
 
ILogger perhaps
 
@Wietlol correct, datetime is used to set the file name and to check if we crossed midnight
 
does a ternary enable this to be 1-lined?
            if (Base64Decode(token) == _options.Value.Secret)
            {
                IsSecure = true;
            }
            else
            {
                IsSecure = false;
            }
 
12:04 PM
in an ideal situation, you would have an ILogOutputStream, which is responsible for writing the logs
 
IsSecure=Base64Decode(token) == _options.Value.Secret;
 
an implementation would be to write the log onto the file system, somewhere using a particular file path
 
But I think that ILog just exposes the methods to be called by external things
 
@JoJo You don't even need a ternary operator here lol
Hamix has the very simple solution here
 
to start logging, end it and etc
 
12:05 PM
@Hamix I see thank you. What is that syntax called?
I guess it is just assignment to the evaluation.
 
im sorry, I am having a stroke
 
I get it. Thank you.
 
@Gintas brb
 
@Wietlol Good luck
 
@Wietlol good luck dude
 
12:05 PM
@Wietlol
take some gaba powder
or some hydro-chloroquine ;)
 
I might have used the wrong expression actually...
probably weirdly translated to english
 
phew.. he is okay. false alarm guys
@Hamix thank you again
 
Don't worry, in english it also means masturbation.
 
ezowokimoz sounds like a fancier doodat
 
12:09 PM
im not sure masturbation would be an appropriate translation either actually
 
mr5
by moving only two sticks, what is the largest number can you produce?
 
in any case, @Gintas since you already have the timestamp from the log entry, couldnt you use that to determine the file path?
@mr5 17
 
mr5
why?
 
because I cant count higher
 
@JoJo inline if assignment, i suppose :)
 
12:11 PM
@Wietlol i am not interested in the log itself, file path, I need to test whether the midnight log is created when the time difference is correct
 
Okay perfect. Good way to think of it.
 
@Gintas and this midnight log is a logger or log entry?
 
whats up with the filthy roach
havent heard from him in a while
 
corona perhaps?
 
12:13 PM
hope hes alright
 
11503 @mr5
 
hmm
 
or... perhaps...
 
mr5
@bradbury9 nope
 
even more corona
 
12:13 PM
hehe
 
mr5
I am not sure with the answer either but my guess is much higher than that
 
@mr5 1805, on base10, or 11805 if you accept 1 stick is one
 
mr5
nope
 
@Wietlol logEntry I think
 
ok.
 
mr5
12:16 PM
my guess was 81115 but it is still wrong according to the original source
81151 is also wrong
 
18115?
 
511811?
 
5031, moving the two sticks from the 8 to make an 1 after the digits
 
81151?
 
mr5
@Wietlol how did you come up with this number?
 
12:19 PM
keyboard... I think
also, keys
 
keys were a very important factor in getting that number
 
and view it by upside down
 
what number in any base is written the same way?
 
1
0 is interesting as well tho
 
12:20 PM
not only
 
-1 as well
 
mr5
if you flip the image vertically, you would end up with 805. If you remove the top and bottom part of zero, you would end up with 8115 plus combing the two sticks to make 1
 
so im correct?
 
the base itself is always written as 10 in any base
 
@Neil base1 is something interesting to keep in mind tho
 
mr5
12:22 PM
eh it was said that it was also wrong
 
base 10 value for 10 is 10
 
mr5
I actually don't know the answer
 
@Wietlol so how do you think it would be appropriate to change the datetime?
 
mr5
You can also make -G0D from it ^^
 
@nyconing That is worng, if you move them to the end, your first digit is 5, not 1
 
12:23 PM
@Gintas that depends on what you really want to do with it
 
mr5
@nyconing flip your answer and that was my answer also
but again, it's said that it was wrong
 
"it"?
 
51181 should be the correct answer
 
mr5
"that"?
 
@Wietlol how bad would it be to change the datetime in a seperate method instead of a constructor
 
12:24 PM
I assume this is some quiz then, and a bot is checking your answer?
 
mr5
@bradbury9 yeah also wrong. somebody answered that too
 
you allow flip or not
 
mr5
unfortunately it's human ^^
maybe it's allowed
 
then allow math expression ?
like 5x5
 
@mr5 infinity?
63110714507263668935083553384002806085632?
 
12:26 PM
infinity arent number afaik
 
10009384254425209391764872978609942810329088?
@nyconing but it is a human that checks your answer
 
mr5
> In this matchstick puzzle, the number 508 is made up of 18 matchstick. As per rule, you need to find the highest number by just moving 2 matchsticks in any direction.
that's the original instruction ^
 
my final guess would be... "this message is too long"
dang it
that is the biggest (actual) number I can get
 
mr5
@Wietlol again. you need to work under the rules only
rebels are not allowed
 
which rules?
move 2 chopsticks?
 
mr5
12:28 PM
@nyconing maybe
 
scrub :D
 
mr5
lol
maybe that's the correct answer
we'll never know xD
!~>Math.Pow(8, 151)
 
!=>2.325883917745942E+136
 
mr5
how many digits are those o.O?
 
12:31 PM
oh, shit, I did wrong visual maf
 
mr5
!~>Math.Pow(8, 115)
 
136.
 
!=>7.1671831749689735E+103
 
mr5
@nyconing I have commented your answer in my fb friend. Let's see if it's correct. I'll tag you if you want ^^
Or I'll tag Wietlol if he wants
 
the only weird thing is that a power, written in superscript is often smaller, not larger
 
mr5
12:33 PM
your equal sign have autism
 
so, it might have to be 8115^11
it is not an equal sign, those are the spare matches
 
mr5
!~>Math.Pow(8115,11)
 
!=>1.0050178280346339E+43
 
mr5
nah, nyc's answer is higher
 
try 11^8115 tho
 
mr5
12:35 PM
ohhh
yeah right
those are superscripts
 
mr5
what did you do to produce those numbers?
 
which is approx 8116 characters long
 
Exponentiation is a mathematical operation, written as bn, involving two numbers, the base b and the exponent or power n. When n is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, bn is the product of multiplying n bases: b n = b × ⋯ × b ⏟ n...
 
(by simply doing 10^8115)
@mr5 math?
I thought that was obvious
 
12:36 PM
how about 8115!!
 
oooh
I dont think my computer can calculate that
 
that's probably considered cheating though
 
mr5
nah. you can't produce two exclamations with just two matchsticks
 
considering they are matches... which have a dot
 
well you can if you break off the end
 
12:37 PM
I dont think my machine has enough ram to store that number
 
that would truly be an enormous number
still infinitely smaller than graham's number
 
with 32GB...
 
you allow II = 2 ?
 
mr5
ha. I have commented all those numbers. let's wait for his answer.
 
but grahams number is just to have the biggest number that is actually "useful" but no one can actually use it?
 
mr5
12:38 PM
what are you gonna do with those numbers then?
 
if II can be used, then we can use exponent pow to pow
 
mr5
fyi, code jam is active right now. I think final day tomorrow for qualifications
 
hmm wait a sec..
 
8 knuth 5?
 
mr5
is there a symbol for knuth?
 
12:39 PM
considering we all know how knuth stuff works, since we know grahams number
 
mr5
eh isn't he the original author of C++?
Donald Knuth?
 
8 ↑ 5 is just 8^5
 
I would accept that
rotate 180 degrees, change the 0 to that
BAM bigger number than my 32GB machine can handle
 
now 8 ↑↑ 5 would be a lot
 
mr5
but it is limited to two moves only
 
12:42 PM
oh... I thought knuth arrow was with 2 lines
 
mr5
@Wietlol but consoles are displaying them in scientific notation
 
but Java isnt
I suppose 11^8115 is the big gun atm
assuming double factorial is not a thing
 
here's a puzzle for you.. on a clock, the hour hand and the minute hand are equidistant from the 6. What time is it?
there's only one correct answer
 
12PM
no, wait... 0AM
no... that doesnt exist
uhm... 12AM
dang it
just 12
or 0
 
mr5
I need visualization
 
12:44 PM
or 24
 
didn't think about 12pm
 
mr5
Art by lgbeard
.'`~~~~~~~~~~~`'.
(  .'11 12 1'.  )
|  :10 \    2:  |
|  :9   @-> 3:  |
|  :8       4;  |
'. '..7 6 5..' .'
 ~-------------~  ldb
 
knowing all of you, trying to find the answer from the site :P
 
also... that is assuming either of them moves by 60ths
 
mr5
So those two arrows are pointing at 12 @Neil?
 
12:45 PM
@mr5 I suppose that's an answer, but not the one I'm looking for
 
mr5
what does equidistant mean?
equivalent distance?
 
same distance
see the image
 
mr5
means, parallel to each other? overlaps?
 
they're both the same distance from the 6
 
mr5
oh I thought that was a random image haha
 
12:48 PM
@Neil what time would it be then?
8:18?
 
that's the puzzle isn't it?
 
or is the image you linked not an actual answer?
 
mr5
@Neil but you didn't put "assuming" or "supposedly" or similar words to connect those two sentence. without following any context, the answer is 8:48PM +0800
 
@Wietlol what would you do in regards about the DateTime.Now and unit tests?
 
I would derive the DateTime from the timestamp of the log entry
 
12:49 PM
@mr5 assuming what?
also that's wrong
 
that would make the datetime field in the logger itself irrelevant
and would simplify your logger a lot
for testing, you pass a log entry with whatever datetime you like
@Neil do I have to assume that the minute hand moves in steps and the hour hand moves gradually?
if not, I could list quite a few moments in a day
 
@Wietlol assume gradual
 
both gradual?
 
yes
 
> on a clock, the hour hand and the minute hand are equidistant from the 6. What time is it?
the question implies there is only one time
as the question assumes unambiguity
but since both hands are gradual, there are a lot of moments in 12 hours where they are equidistant from the 6
in fact... twice per hour actually
probably missing only some cases, resulting in 22 or 23 different options
 
12:53 PM
Also...does it mean "the tip of the hour hand and hte tip of the minute hand", or what? Because the beginning of those hands are always equidistant from the 6.
 
@Wietlol well I mean, use the image as a reference.. it's clearly not 12 o'clock
 
if you go that route, then what are the lengths of the hands?
so, you want to pick the first occurrence between the 8 and 9 hour marks?
in that case... pulls up IntelliJ
I need a battleship for this kind of maths
8:18
 
assume the hands are the same length
 
assume minute hand speed is 1 per 1 minute
hour hand speed is therefor 5/60 or 1/12 per 1 minute
 
at 8:18, they're not precisely equidistant
 
12:57 PM
the hour hand starting at 8 o clock would have a 10 steps headstart
oh, dang it, I swapped the rotation
 
@mr5 im not sure what you mean by multilayer modules
 

« first day (3462 days earlier)      last day (1469 days later) »