[-] SmartmanApps@programming.dev 0 points 2 years ago

The syntax is arbitrary in some edge cases

Such as?

[-] SmartmanApps@programming.dev 0 points 2 years ago

Order of magnitude?

It's actually short for "to the order of", as in 2 squared is 2 to the order of 2. i.e. same thing as Exponent or Index.

[-] SmartmanApps@programming.dev 0 points 2 years ago

A typical scientific calculator didn’t have juxtaposition, so you’d have to enter 6÷2(1+2) as 6÷2×(1+2)

That's not true

you’d get 9 as the answer because ÷ and × have equal precedence and just go left to right

Well, more precisely you broke up the single term 2(1+2) into 2 terms - 2 and (1+2) - when you inserted the multiplication symbol, which sends the (1+2) from being in the denominator to being in the numerator. Terms are separated by operators and joined by grouping symbols.

[-] SmartmanApps@programming.dev 0 points 2 years ago

https://plus.maths.org/content/pemdas-paradox

There's no pemdas paradox, just people who have forgotten the order of operations rules

Even two casios won’t give you the same answer:

The one on the right is an old model. As far as I'm aware Casio no longer make any models that still give the wrong answer.

[-] SmartmanApps@programming.dev 0 points 2 years ago

I’ve never seen a calculator that had bracket keys but didn’t implement the conventional order of operations.

I've seen plenty

[-] SmartmanApps@programming.dev 0 points 2 years ago* (last edited 2 years ago)

You are saying that 14 is the correct answer because of the order of operations

No, I am saying that is because that's the number that we started with and we wrote the expression based on the operator definitions.

Let me try this again, but be more explicit about each step...

Teacher is writing a test. Has decided the answer for this question is going to be 14. What can he make the question? Well, we can throw in some addition, so let's change it to 2+3+3+3+3. What else can we do?

Well, that 3+3+3+3 part there, we have a shorthand version of that in multiplication, that being 3x4, so now let's change it to 2+3x4.

So, now we've turned 14 into 2+3x4. None of that had anything to do with order of operations, just the definitions of the operators - + means addition, and x is shorthand for multiple additions.

So, we already know that the answer is 14, because that's what the teacher started with.

Now we need some rules of Maths to make sure that anyone who tries this question gets 14 as the answer.

And as we already saw, we have to do multiplication first or we arrive at the wrong answer - 20. And the reason we can only get the correct answer from doing multiplication first is because multiplication is shorthand for repeated additions, which was the first step the teacher made from having started from 14.

Similarly, we have defined exponents as being shorthand for multiplication, so for the very same reason we will need to solve exponents before we solve multiplication or we won't end up at 14.

And welcome to the order of operations rules! As I said, they are a natural consequence of the way that we have defined the operators. So, with the way we have defined addition, multiplication, and exponents, solving any such expression requires that we do them in the order E M A. In other words, we have to undo all the shorthand in the opposite way to how it was written to begin with, until we end up with just additions, and from there we arrive at the correct answer of 14.

Let's say though, way back in time, that instead they had defined exponents as shorthand for multiplication, and x as shorthand for exponents. Then, with these different definitions the order of operations rules would be M E A (because these definitions have exponents and multiplication the opposite way around to how we actually have defined them).

Do you see it now? If there's something you don't understand, then just ask me.

[-] SmartmanApps@programming.dev 0 points 2 years ago* (last edited 2 years ago)

Ok, but why does 2 * 3 = 2 + 2 + 2 mean that we should prioritize multiplication and division over addition and subtraction?

Because multiplication is shorthand for addition, and if you don't expand it before doing the addition you get wrong answers. Let me show you...

Multiply first (i.e. correct)

2+3x4=2+3+3+3+3=14 - the right answer, by the very definition of 3x4=3+3+3+3

Now let's see what happens if we do the addition first...

2+3x4=5x4=5+5+5+5=20 - which we know is the wrong answer! (because we already know the right answer is 14, because we already know that the actual original fully expanded expression was 2+3+3+3+3, so the rules of Maths have to guide us back to getting the same thing the original author started with, or it all breaks down! The author took 2+3+3+3+3 and wrote it as 2+3x4, so the rules of Maths have to make sure when we see that we get back to 2+3+3+3+3)

So the fact that we know multiplication is shorthand for addition, means we have to multiply before we add. Similarly, exponents are shorthand for multiplication (2³=2x2x2), so we have to do exponents before we do multiplication... which we have to do before we do addition! It all comes from what these very things have been defined as meaning in the first place.

I’ll take a source if you got one

Well, I just showed you by doing the Maths myself, which is one of the great things about Maths - some things you can prove it to yourself! :-) And that's another topic I wrote about here and here.

[-] SmartmanApps@programming.dev 0 points 2 years ago

Ummm, I was agreeing with you??

Anyways, I'm a Maths teacher who has taught this topic many times - what would I know?

[-] SmartmanApps@programming.dev 0 points 2 years ago

multiple always happens first. But apparently it’s what’s left side first

Multiplication and division are equal precedence (and done left to right) if that's what you're talking about, but the issue is that a(b+c) isn't "multiplication" at all, it's a bracketed term with a coefficient which is therefore subject to The Distributive Law, and is solved as part of solving Brackets, which is always first. Multiplication refers literally to multiplication signs, of which there are none in the original question. A Term is a product, which is the result of a multiplication, not something which is to be multiplied.

If a=2 and b=3, then...

axb=2x3 - 2 terms

ab=6 - 1 term

[-] SmartmanApps@programming.dev 0 points 2 years ago

I've taught a class of kids that has various disabilities. Having a disability doesn't make you stupid.

[-] SmartmanApps@programming.dev 0 points 2 years ago

No, they have to be the way they are as a result of the way the operators have been defined. e.g. 2x3 is shorthand for 2+2+2, so if you don't do multiplication before addition then you get the wrong answer, hence the order of operations rules.

3

cross-posted from: https://programming.dev/post/9762485

I've just run into a MAUI issue which is specific to Windows (works fine on Android), and so I looked for a Windows Lemmy Community and was surprised to find there wasn't one! So I have created one at !windows_dev@programming.dev

Of course you are still welcome to post about MAUI issues in !dotnetmaui@programming.dev but if the issue is specific to Windows (as I have just encountered) then there is now the Windows Development Community as well (and of course we already have Communities for Android and IOS development, for issues on those platforms).

1

I've just run into a MAUI issue which is specific to Windows (works fine on Android), and so I looked for a Windows Lemmy Community and was surprised to find there wasn't one! So I have created one at !windows_dev@programming.dev

Of course you are still welcome to post about MAUI issues in !dotnetmaui@programming.dev but if the issue is specific to Windows (as I have just encountered) then there is now the Windows Development Community as well (and of course we already have Communities for Android and IOS development, for issues on those platforms).

1

Hello everyone. I am your mod, Donald, Founder of Smartman Apps. You can find me on Mastodon at @SmartmanApps@dotnet.social.

You can follow/post to this Community from Mastodon by following @windows_dev@programming.dev

A few rules…

  1. As usual these site-wide rules apply (bear in mind this is a SFW Community)…
  • Dangerous content on the instance and federated instances including phishing, spamming, brigading, unmarked nsfw, nsfw content in sfw communities, doxing, etc. is not allowed and subject to be handled by the mods or admins
  • Hate speech is not allowed on the instance or in instances federated with it. This includes remarks directed at sex, gender, ethnicity, orientation, disabilities, etc…
  1. Anything that relates specifically to Windows programming is welcome. e.g. native Windows development (such as WinUI, UWP, etc.), a MAUI issue which only happens on Windows, Windows Store related issues, etc.
  2. When posting, bear in mind that these are also going out to people’s Mastodon feeds. i.e. try not to be overly wordy.
  3. I reserve the right to modify these rules :-) (but also feel free to make appropriate suggestions for such modifications).
7

cross-posted from: https://programming.dev/post/9650331

Just had this pop up in my Mastodon feed, if we have any Brisbane-based dotnet engineers in the job market here eigenmagic.net/@arichtman/111883866093603121

6

Just had this pop up in my Mastodon feed, if we have any Brisbane-based dotnet engineers in the job market here eigenmagic.net/@arichtman/111883866093603121

6

cross-posted from: https://programming.dev/post/9220472

I've just had this happen (and then stop again) for the second time in a few weeks. This is a new MAUI app where the only thing I've changed so far, other than add a few of my own (already previously tested and working) libraries, is change the home page, and the new home page only has a couple of labels on it, so it has no complexity at all added to it yet, and yet getting this odd alleged memory issue. The first time it happened I couldn't find a fix for it, left it for a while, came back (a week's worth of reboots later) and it was working again. Then today I made one trivial change - added a debug write - and the problem came back (but got past the new line without any issues). Then I rebooted and it's working again.

I have 32Gb of RAM, with 12Gb allocated to a RAMdisk, and I have my paging files set to use the RAMdisk.

It generated a log file which said...

"Native memory allocation (mmap) failed to map 186646528 bytes for G1 virtual space"

...so it only needed 180Mb, and down near the bottom it says...

"Memory: 4k page, system-wide physical 32579M (3638M free)"

...so I had more than enough space left (so the memory message may be a red herring for whatever did cause the crash). Googling that first message brings up a bunch of matches, but none of which are for MAUI Android (all different cases with different fixes).

This is using the Android emulator on a Windows machine where I've set the paging sizes to be system-managed. I'm not sure where the Android emulator actually gets memory from though - the system RAM? The paging RAM(disk)? The build directory? The user's App directory?

It reminds me of years ago there was a similar issue with Xamarin Android where the fix/workaround was to add a line to the csproj (I think it increased the heap or something from memory), but I haven't seen that pop up in a long time. Not sure if this is the same issue or a different one.

There's no repro for it cos I can't even reliably repro it. I'm just concerned that it's going to keep coming back given I haven't even added any complexity to it yet.

Has anyone run into this and/or knows how to fix it?

1

I've just had this happen (and then stop again) for the second time in a few weeks. This is a new MAUI app where the only thing I've changed so far, other than add a few of my own (already previously tested and working) libraries, is change the home page, and the new home page only has a couple of labels on it, so it has no complexity at all added to it yet, and yet getting this odd alleged memory issue. The first time it happened I couldn't find a fix for it, left it for a while, came back (a week's worth of reboots later) and it was working again. Then today I made one trivial change - added a debug write - and the problem came back (but got past the new line without any issues). Then I rebooted and it's working again.

I have 32Gb of RAM, with 12Gb allocated to a RAMdisk, and I have my paging files set to use the RAMdisk.

It generated a log file which said...

"Native memory allocation (mmap) failed to map 186646528 bytes for G1 virtual space"

...so it only needed 180Mb, and down near the bottom it says...

"Memory: 4k page, system-wide physical 32579M (3638M free)"

...so I had more than enough space left (so the memory message may be a red herring for whatever did cause the crash). Googling that first message brings up a bunch of matches, but none of which are for MAUI Android (all different cases with different fixes).

This is using the Android emulator on a Windows machine where I've set the paging sizes to be system-managed. I'm not sure where the Android emulator actually gets memory from though - the system RAM? The paging RAM(disk)? The build directory? The user's App directory?

It reminds me of years ago there was a similar issue with Xamarin Android where the fix/workaround was to add a line to the csproj (I think it increased the heap or something from memory), but I haven't seen that pop up in a long time. Not sure if this is the same issue or a different one.

There's no repro for it cos I can't even reliably repro it. I'm just concerned that it's going to keep coming back given I haven't even added any complexity to it yet.

Has anyone run into this and/or knows how to fix it?

1

Marco Siccardi has shared an extensive post about MAUI menus (came up in my Mastodon feed, but lacked some relevant tags, so mostly only his followers would've seen it) that I thought some of you might find helpful. I wanted to share it here so that it's easier to find again later - Marco's post about MAUI menus

4

Hello. I follow 4 community bots from here on Mastodon - dotnet, dotnetmaui, csharp, and community request. The last time I got a post from any of these on Mastodon (at dotnet.social) was the 13th of December (that was from dotnet), but there have definitely been posts/comments made since then.

I just tried posting to dotnetmaui from Mastodon via the bot and that worked, so it's just outbound (just to dotnet.social?) which is affected. Are you aware of this? Is someone looking at it? (I've had a look and can't see anything that sounds like it) Or is this an issue for the admins of dotnet.social? It's odd that inbound (from Mastodon/dotnet.social) is working but outbound (from here) isn't, and it's the same with all the communities I follow here (though I only tested dotnetmaui with inbound).

thanks, Donald. dotnetmaui admin

1

cross-posted from: https://programming.dev/post/8419041

I'm just trying out the built-in builder.Logging.AddDebug(); in a MAUI app, but don't see the output anywhere. From several blogs I expected to see the messages in the Visual Studio Debug output window, but they aren't appearing.

Just using the stock-standard MAUI app, the only changes I have made are in App.cs as follows...

using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls;
namespace BaseMAUIApp;
internal class App :Application
{
public App(ILogger<App> logger) {
    logger.LogDebug("******************* Message from logger!");
// rest of code...

But I don't see my message anywhere. Is there something else I have to configure, or somewhere else I have to look?

1

cross-posted from: https://programming.dev/post/8419041

I'm just trying out the built-in builder.Logging.AddDebug(); in a MAUI app, but don't see the output anywhere. From several blogs I expected to see the messages in the Visual Studio Debug output window, but they aren't appearing.

Just using the stock-standard MAUI app, the only changes I have made are in App.cs as follows...

using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls;
namespace BaseMAUIApp;
internal class App :Application
{
public App(ILogger<App> logger) {
    logger.LogDebug("******************* Message from logger!");
// rest of code...

But I don't see my message anywhere. Is there something else I have to configure, or somewhere else I have to look?

1
submitted 2 years ago* (last edited 2 years ago) by SmartmanApps@programming.dev to c/dotnetmaui@programming.dev

I'm just trying out the built-in builder.Logging.AddDebug(); in a MAUI app, but don't see the output anywhere. From several blogs I expected to see the messages in the Visual Studio Debug output window, but they aren't appearing.

Just using the stock-standard MAUI app, the only changes I have made are in App.cs as follows...

using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls;
namespace BaseMAUIApp;
internal class App :Application
{
public App(ILogger<App> logger) {
    logger.LogDebug("******************* Message from logger!");
// rest of code...

But I don't see my message anywhere. Is there something else I have to configure, or somewhere else I have to look?

view more: ‹ prev next ›

SmartmanApps

0 post score
0 comment score
joined 2 years ago
MODERATOR OF