« first day (3420 days earlier)      last day (1520 days later) » 

12:00 PM
you are missing another type argument
 
@Wietlol but doesn't Func<int, string, string> specify three arguments?
Each argument type is separated by a comma?
 
yes, but those generics are not function arguments
they are type arguments
the last one specifies the return type of the function
 
Okay, so for Func the last type argument is always the return type?
But for Action all type arguments are functiomn arguments?
So Action<int, int, string> means three function arguments arg1 is an int, arg2 is an int and arg3 is a string?
 
@techno I am not the squirrel you were looking for.
 
yep
the difference between Action and Func is the presence of the return type
anyway, lunch
 
12:05 PM
@Wietlol enjoy!
Does anyone know if C# has pre-increment and post-increment?
 
++i i++?
 
it has
 
So how come it's not working as I expect then
 
12:13 PM
Does pre-increment and post-increment not work when used in a string interpolation
 
If I were reviewing that code, I'd send back anything that counted on a side effect in an interpolated expression. — Joel Coehoorn Jan 18 at 22:37
 
int i = 0; int taskNumber = 1; while (i < 5)
        {

            Console.WriteLine($"Task {++taskNumber}");

        }
I expect the output:
Task 1
Task 2
Task 3
Task 4
 
int taskNumber = 1
 
But I'm getting the following instead
Task 2
Task 4
Task 3
 
you should write $"Task {++i}"
 
12:18 PM
Task 5
 
taskNumber++ postfix vs prefix I thought that was a C thing... doses C# have that behaviour?
 
you pre-increment, so the output is right
@BlackSquirrel yep. It has. Demonic stuff
@MyWrathAcademia is it clear now?
 
@ntohl Pre-incement means use before incrementing so I expect Console.WriteLine($"Task {++taskNumber}"); to use (i.e. print) 1 before incrementing to 2, and so forth
 
nope pre-increment means it adds 1 before printing it out
 
other way. taskNumber++ is what you mean
 
12:22 PM
@BlackSquirrel I just face palmed myself. Thank you.
 
check the edututorials link
 
@ntohl I made a mistake, thanks
 
as we all do
 
I understood what I wanted to do just implemented it wrong because I mixed them up
 
You should have seen my ignorance level when I tried to grasp the evaluation order is not fixed, while 3 ppl here tried to convince me.
 
12:24 PM
@Squirrelkiller guess so :)
 
After learning this you should resolve to never use it again, and instead place the statement on a separate line either before the writeline or after, that way your intention is much more explicit and easily read by others without them having to remember esoteric details about postfix/prefix infix operator precedence in C#
 
^agreed
 
@BlackSquirrel I also agree, great advice
So the output is now correct :)
 
mr5
o/o
I mean
\o/
 
Like your picture (I mean avatar), nice
Now on to the next observation:
This little asynchronous program outputs:
class Program
{
    static async Task Main()
    {
        // cannot easily remove an element from an array
        Task<int>[] tasks = new Task<int>[] {GiveMeAnInteger(1), GiveMeAnInteger(2), GiveMeAnInteger(3), GiveMeAnInteger(4),
                                                                                GiveMeAnInteger(5)};

        //IEnumerable<Task<int>> enumerableQuery = from t in tasks select GiveMeAnInteger(number);

        List<Task<int>> listOfTasks = tasks.ToList();

        int taskNumber = 1;
Outputs to the console:
Task 1: 511833644
Task 2: 70765336
Task 3: 2104066648
Task 4: 1762412119
Task 5: 1066622552

Press any key to continue...
[Process completed]
 
12:35 PM
there should be a timer for this chatroom's birthday cause it's coming in less than 8 months
 
mr5
@Wietlol
 
Boss: "We've never called that column 'EAN', ever"
Me looking at 8 years worth of dev code calling it EAN: Yeah, you did...
 
My question is, why does the task with the least iterations finish second, not first?
Second run of the program outputs:
Task 1: 1065312402
Task 2: 2088956950
Task 3: 936621347
Task 4: 575379458
Task 5: 1753139667

Press any key to continue...
 
@MyWrathAcademia No way of knowing. They're all competing for CPU time, and you have no way of knowing the order they'll be executed. The question is why you care, in a scenario that's really perfect for parallel-LINQ or for Tasks.WhenAll()?
 
mr5
@Wietlol similar to this: stackoverflow.com/a/15685301/2304737
 
12:38 PM
Shouldn't the completion order of asynchronous tasks be in the order: least iterations to most iterations?
 
not necessarily.
You probably don't have 5 CPU cores, and even if you do, your program probably isn't using them all. Execution on the available cores is split between them, not necessarily equally.
Counting numbers is fast. It's possible that a given task starts, increments your number 10 million times and returns, before any other task even starts.
 
mr5
union Alphabet {
	struct {
		uint32_t a:1;
		uint32_t b:1;
		uint32_t c:1;
		uint32_t d:1;
	};
	uint32_t value;
};


Alphabet aa = { .a = 1, .d = 1 };

OR

Alphabet bb = { .value = 0b1001 }
similar for assigning flags
 
@AvnerShahar-Kashtan thanks. Is a core equivalent to a thread?
 
mr5
then you check for individual bits like if (alphabet.a == 1) // it is set!
@Wietlol
 
@MyWrathAcademia A core is a physical processing unit on your CPU.
Consider it "a CPU".
 
12:43 PM
Anyone know of a good way to check for schema difference between 2 databases?
 
@AvnerShahar-Kashtan thanks. And a thread is?
 
You have way more threads running than CPUs, so they get scheduled. A tiny little method like yours might be scheduled to run start-to-finish before relinquishing the CPU time again.
 
@mr5 does C# have unions?
 
mr5
Erm, I think it doesn't
have
one
 
@DAustin There are commercial tools. I used one by RedGate many years ago.
 
12:44 PM
no you need to use Ling-to-SQL i think
 
@AvnerShahar-Kashtan Are you saying that a thread is the same as a method?
 
Yeah think i used RedGate last time I had to do this
 
mr5
Ling-Ling to SQL?
 
lmao linq* oops
 
@MyWrathAcademia A thread is a unit of execution. When a method runs, it runs in a thread. If you call a new method, you're still on the same thread - same unit of execution.
When you do Thread.Run(MyMethod), you're starting a new thread and telling MyMethod to run on it. Now that thread and your current thread are running in parallel.
 
12:46 PM
@AvnerShahar-Kashtan wow, great explanation. So everytime you execute a program it is a thread?
 
@MyWrathAcademia Yes, there's always, implicitly, at least one thread in any program, the main thread.
(I'm simplifying a bit, but this is good enough for now)
 
@mr5 shouldnt that just be the api of Float?
 
@AvnerShahar-Kashtan just to confirm, when you say "A thread is a unit of execution" do you mean "A thread a unit of execution of a program" or "A thread is a unit of execution of a statement"?
 
mr5
@MyWrathAcademia just so you know, I just read some question few days ago. They're also confused when they said post and pre increment. Having said that, I get it the first time I see it. I'm also in my younger years of learning programming the day I learned it. I wonder what is the correlation though...
 
In other words, "A thread is a unit of execution of what?"
 
12:50 PM
@Native("system.math.float")
type Float {
    value mantisa: Float
    value exponent: Float
    value sign: Boolean
}
(iDunno what types the mantisa or exponent should be)
 
@mr5 I see what you mean.
 
but the getters for those properties would extract the value from the bytes
 
@MyWrathAcademia this might help: youtube.com/watch?v=Z5JC9Ve1sfI
 
@MyWrathAcademia Your code is a sequence of instructions. The "thread" is the context in which the CPU executes those instructions.
 
@mr5 May be programming veterans are rusty with beginner things
 
12:52 PM
the thread is who manage to runs your code
thread not run, your code not run
 
mr5
@MyWrathAcademia imagine threads as a handler for program counter. Having many cores means more handler so you can jump around in RAM.
 
or we can just use incrementAndGet() or getAndIncrement()
 
@mr5 Wow, I really don't think that helps understanding.
 
@AvnerShahar-Kashtan I understand that my code is a sequence of instructions but may be an example would help me visualize 'The "thread" is the context in which the CPU executes those instructions.'
 
mr5
@AvnerShahar-Kashtan it's just my theory though so I don't think it's actually true. But I think it would help him understand it.
 
12:55 PM
a thread is basically the executor, it loops over your sequence of instructions and executes them one at a time
 
@MyWrathAcademia You have a method which runs from start to finish, right? You can think of the thread as the agent that executes it. A thread can do one thing - set a variable, call a method, read a file, come back, etc. If you want your code to do two things at once, a common way is to start another thread - so that the two run concurrently.
 
@MyWrathAcademia deadlockempire.github.io
this is a fun thing if you want to understand threading
(but basic knowledge about the concept is required)
 
@AvnerShahar-Kashtan so a thread can only do one thing at a time (i.e. a thread is synchronous)?
@AvnerShahar-Kashtan So a synchronous program has only one thread?
 
@MyWrathAcademia not necessarily
 
12:58 PM
@AvnerShahar-Kashtan an asynchronous program can have as many threads as the tasks that are executing concurrently?
 
@Wietlol Don't complicate matters. It's a simplification, we'll get there.
 
I think we should drop asynchrony for the time being then :)
 
I finally understand what a thread is!
 
@MyWrathAcademia To begin with, yes - the simplest way to achieve asynchronous execution inside a program is to start a thread for each task. Simplest, but not best, because threads can be expensive - each thread reserves some memory, for instance.
 
Thanks @AvnerShahar-Kashtan what other couldn't explain properly and you too @Wietlol for knowing everything :)
 
1:00 PM
There are many nuances, but to get your head wrapped around the concept, consider a thread for each concurrent, parallel task.
Next time, we'll talk about the difference between parallel and asynchronous. :)
 
lol
 
Ok, ok, enough pinging. :)
 
stop editing with tag
 
Editing with tag?
 
mr5
@MyWrathAcademia try Threads now :)
 
1:01 PM
@MyWrathAcademia if you edit a message where you pinged someone that person gets pinged a lot
 
Oh right, apologies everyone
 
(now I do assume you have sounds on)
 
mr5
Does anyone here have tried the new System.Text.Json?
 
its no biggie tho :D
 
mr5
@Wietlol yeah but it can also be used for checking against flag
 
1:03 PM
ye, but that should also have a much better api
 
I think sound is disabled. I switched from Linux to MacOS recently and for some reason can't find the sound icon on the MacOS GUI
I know this is windows/microsoft land, so forgive me for being a linux/Mac guy
 
mr5
@Wietlol anyway, is this Kotlin?
 
@mr5 like this
 
Top Right Corner I think for sound on MacOSX
 
type MethodFlags
{
	value isAbstract: Boolean
	value isStatic: Boolean
	value isOverriding: Boolean
	value isSealed: Boolean
	value isExtern: Boolean
}
the compiler should be able to make it an actual bit set that can contain all the values
if not implicitly, then explicitly
I rely on LLVM to do that optimization for me
 
mr5
1:05 PM
@MyWrathAcademia Settings > Sounds > Show Sound Icon (iirc)
 
@mr5 that is Wietlang
 
mr5
eww
 
its not eww
 
@mr5 I recently used Newtonsoft.JSONto deserialize JSON so I'm curious what System.Text.Json does
 
mr5
so you're saying any developer can easily create native types?
 
1:06 PM
sure... but the compiler will reject them
 
@MyWrathAcademia It's MS's actual attempt to replace NewtonSoft
it should be faster apparently
 
because native types need to be supported by the compiler
 
mr5
@MyWrathAcademia they claim it's faster. But it still has a lot of bugs and missing features so we're not yet implementing it.
But I'm trying it with my personal project.
 
and currently, I havent yet made anything to add more native support
 
mr5
having more keywords means more fool-proof
 
1:07 PM
not necessarily
having fewer keywords often means more consistent syntax
 
@mr5 Thanks, found it. Your directions were just about correct.
 
I trade in as many keywords as I can for a much more consistent syntax
 
@DAustin The icon is disabled by default
 
(Java actually also has @Native, but you can only use it for fields
 
!~>new wietlol()
<!>The type or namespace name 'wietlol' could not be found (are you missing a using directive or an assembly reference?)
 
mr5
1:10 PM
@AvnerShahar-Kashtan lol. he's the ping master xD
 
@DAustin great I'll replace NewtonSoft.JSON in my project and try it out soon. I'll let you guys know how it is and if there's any speed difference.
 
1:30 PM
@AvnerShahar-Kashtan Just found this article for comparing schemas natively, works a treat :D
https://www.mssqltips.com/sqlservertip/4824/easy-way-to-compare-sql-server-table-schemas/
 
reminds me my dad's gonna be stuck in Korea for quite awhile now -v-
now's a good time to start stocking up on food and water supplies before the virus gets too big in your country
 
mr5
Why is Europe panicking with covid19?
 
I dunno; don't ask the American
 
mr5
Because of the recent rise of confirmed cases in S. Korea?
 
1:40 PM
probably because of how it's prevalent in Italy now
what was it -- some people in a hotel are stuck there now until the virus has worn off?
 
@mr5 I've never experienced an apocalyptic scenario where I'm in a city that's on lockdown due to quarantine but if that virus gets to the UK I might finally relive all my favorite horror movies.
 
mr5
I blame your department of foreign affairs
 
@Freerey any idea if that virus has gotten to Japan. I'm lookin forward to the Olympics there this year and don't want anything to disrupt the show Japan's gonna put on for the world.
 
yes it has
 
mr5
Japan I think is in control
 
1:42 PM
@mr5 Comments deactivated
 
it's not under control
anywhere on the world
 
@mr5 I blame Trump's lax regulations on the FDA
 
they might even cancel the olympics
we will see
 
@MyWrathAcademia Isn't it in londonalready?
 
mr5
Basically, every country that have Chinese or basically all over the world
 
1:43 PM
ffs there was an outbreak of e coli shortly after Trump changed a few things with the FDA's rules
one place I liked to frequent would not serve lettuce for a few weeks
 
@Hans1984 noo that's terrible news. London Olympics was great and I expect Tokyo Olympics to be even better
 
mr5
@Squirrelintraining oh. I think YouTube is becoming sensitive
 
@MyWrathAcademia yeah it would be disappointing
 
mr5
@Freerey FDA stands for Foreign Department Affairs?
 
but they might have no choice
by now its not needed
 
1:45 PM
@mr5 Food and Drug Administration
 
@Squirrelintraining I haven't followed this virus until it started getting serious. Crap, if it's in London then its only a matter of time until it gets here.
 
lets see how things evolve the next few weeeks/months
 
@mr5 Its the uploader not youtube
@MyWrathAcademia lel it's being over dramatised in any case.
German press titled "people dying by the hour in italy"
In the text it then said 7 dead
7 old already sick people
 
mr5
@Squirrelintraining main stream media controls people minds
 
1:47 PM
@Hans1984 yeah not just for sports fans. They were also talking self driving cars (e.g. taxis). Tokyo Olympics is gonna be an athletic and technologic showcase. A perfect blend of sports and technology
 
whats going on with south korea
it's very concerning that it is spreading this fast in that short amount of time
 
@MyWrathAcademia Generally speaking, the lethality of Covid19 is about that of the common flu, which is bad enough - hundreds of thousands die from the flu every year, though mostly the very old, very young and those with poor immune systems - but it's a lot more contagious, so that it reaches more of those vulnerable people.
 
@Squirrelintraining I hope its being overdramatized. I remember a reddit user linked a website that shows the spread of any virus across the globe. Does any one remember the website?
 
no it was shared he two tho.
Aswell my aunti cancled our stay in London because of corona.
She is a bit of a germaphobe
 
Oh, I'm not saying that precautions shouldn't be taken. We were considering going to Europe in April and decided to postpone it, not because of panic, but because we have two children, one young and one with a history of lung disease, and there's simply no reason to risk it just for a short holiday.
 
1:52 PM
@AvnerShahar-Kashtan how is it a lot more contagious. Don't you catch it the same way people catch the flu or cold, that is, by breathing in contaminated air from someone who sneezed?
 
Panic is when it starts affecting your daily life.
 
@MyWrathAcademia Yes, but there are still more factors to consider. For instance, if the virus remains viable in the air for 30 seconds more than the common flu, it can seriously increase its infection rate.
 
I remember ebola being contained quickly
What surprised me is how quickly this virus spread.
 
UPPERCONTINUESCASE
lowercontinuescase
camelCase
PascalCase
lower_snake_case
UPPER_SNAKE_CASE
lower-dash-case
UPPER-DASH-CASE
mEmEcAsE
SPonGeBObCASe
WürstKäse
hyphen/dash case is also known as kebab-case
 
1:55 PM
What's different this time around?
@AvnerShahar-Kashtan true I didn't consider that. I remember hearing that a cold/flu virus lasts for 24 hours
 
@MyWrathAcademia *shrug* It's a different virus with different characteristics.
 
I'm not sure if I should feel safe when I've never gotten the flu before and covid has all the same effects, but is more contagious.
 

« first day (3420 days earlier)      last day (1520 days later) »