c++ – What is the “correct” way to go from avx/sse masks to avx512 masks?

I have some existing avx/sse masks that I got the old way:

auto mask_sse = _mm_cmplt_ps(a, b);
auto mask_avx = _mm_cmp_ps(a, b, 17);

In some circumstances when mixing old avx code with new avx512 code, I want to convert these old style masks into the new avx512 __mmask4 or __mmask8 types.

I tried this:

auto mask_avx512 = _mm_cmp_ps_mask(sse_mask, _mm_setzero_ps(), 25/*nge unordered quiet*/);

and it seems to work for plain old outputs of comparisons, but I don’t think it would capture positive NANs correctly that could have been used with an sse4.1 _mm_blendv_ps.

There also is good old _mm_movemask_ps but that looks like it puts the mask all the way out in a general purpose register, and I would need to chain it with a _cvtu32_mask8 to pull it back into one of the dedicated mask registers.

Is there a cleaner way to just directly pull the sign bit out of an old style mask into one of the k registers?

Example Code:

Here’s an example program doing the sort of mask conversion the first way I mentioned above

#include "x86intrin.h"
#include <cassert>
#include <cstdio>

int main()
{
    auto a = _mm_set_ps(-1, 0, 1, 2);
    auto c = _mm_set_ps(3, 4, 5, 6);

    auto sse_mask    = _mm_cmplt_ps(a, _mm_setzero_ps());
    auto avx512_mask = _mm_cmp_ps_mask(sse_mask, _mm_setzero_ps(), 25);

    auto blended    = _mm_blendv_ps(a, c, sse_mask);
    auto blended512 = _mm_mask_blend_ps(avx512_mask, a, c);

    alignas(16) float v1(4);
    alignas(16) float v2(4);
    _mm_store_ps(v1, _mm_blendv_ps(a, c, sse_mask));
    _mm_store_ps(v2, _mm_mask_blend_ps(avx512_mask, a, c));

    assert(v1(0) == v2(0));
    assert(v1(1) == v2(1));
    assert(v1(2) == v2(2));
    assert(v1(3) == v2(3));
    return 0;
}

web applications – Which is the correct way to configure Azure CDN for public web sites with particular attention to SEO

something is not clear using Azure CDN.
I explain step by step what I have done since my website has been created. Call my website www.mypublicwebsite.com. So:

  1. I created a web app on Azure. The website has the following url: https://mypublicwebsite.azurewebsites.net;
  2. I created a custom domain www.mypublicwebsite.com
  3. I redirected all the request from https://mypublicwebsite.azurewebsites.net to www.mypublicwebsite.com. So I solved the problem of duplicated contents for crawlers.

Everything is fine. Then, I decided to create CDN, according the documentation. Here the confusion starts.

  1. I created the CDN profile
  2. I created the endpoint. The endpoint has a new url https://mypublicwebsite.azureedge.net
  3. I deleted the custom domain from web app;
  4. I created the custom domain in cdn profile.

So the current state is this:

enter image description here

This situation is really problematic for SEO!! It cannot be the correct configuration. My contents are triplicated.
I partially solved the situation:

  1. I redirected all the request from https://mypublicwebsite.azureedge.net to www.mypublicwebsite.com. So I solved the problem of duplicated content for crawlers.

But crawler (and perhaps users?) can still navigate the origin web site. I have been looking for different solutions:

I am honestly starting thinking this is not the correct way to manage cdn. And what if I would also add Front Door? I would have another url again: https://mypublicwebsite.azurefd.net… I think I have not understood something.

Any idea?

Thank you

windows 10 – System.FormatException: ‘Input string was not in a correct format’ C#

I’ve built a calculator with 2 numbers a user can input (num1 and num2) and 5 operators (op) they can use (+ – * / ^). I’m trying to make it so that if a user enters anything beside a natural number (such as letters or special symbols) into num1 or num2, it will give an error and return back to the top (I’ve implemented backTop in the code). Basically to see if num1 and num2 are doubles and not strings and if they are anything besides a double (such as a string or character), output an error with Console.WriteLine and return to the top of the code. I’ve tried adding the if statment from line 15 to line 22 but it doesn’t remove the error (System.FormatException: ‘Input string was not in a correct format’). I’m using Visual Studio 2019.

enter image description here

SPFX Web Part, site themes and section backgrounds – automatically apply the correct theme variant to the web part

SPFX web parts developed using the Office UI Fabric / Fluent UI components are out-of-the-box site theme aware. The colors used by the components automatically change to reflect the current in use site theme, so if for example one switches to a green background theme the web part styling will automatically adapt to that without any need for extra development work (obviously provided we don’t explicitly override the default colors somehow).

Yet, while sites themes are automatically reflected by the Office UI Fabric components, apparently section colors – the ones that can be specified for a specific page section – are not.

Section background color selection

In the above example the Sea Monster theme has been applied to the site. In this case a custom SPFX web part will by default use the Sea Monster colors. Yet, if we were to change the section background option from the default to any of the other three options, the web part will not reflect this automatically. This means that if we were to chose the fourth option the section background would be orange, yet the web part would render with an “Rum Swizzle” background instead (the Sea Monster default color name, at least based on some color-name-from-rgb tools).

Searching for a solution is quite easy to find many options that all require extra development work to associate each semantic color to the web part components explicitly.

  • Microsoft solution: implement an interface, some custom hooks and event handlers, pass a theme variable down the React components chain… apply the colors by hand when needed.
  • Hugo Bernier blog same as above but quite more clear with a list of semantic classes names and intended use.
  • Prasanta’s article on netwoven similar approach, but they advocate a way to use the semantic class to build styles, with the advantage that one wouldn’t need to pass the theme around as a parameter to children components.
  • Don Kirkham does basically the same as in Prasanta’s solution, but while Prasanta defines styles in TS classes, Kirkham’s solution uses regular scss.

As you can see every solution requires the developer to do extra work to ensure that the web part is theme-variants aware. And apparently not even every Microsoft out-of-the-box provided web part is guaranteed to be theme-variant compatible so I fear this feature is simply badly supported.

Yet I still wonder. Can anyone provide a solution that would make a web part aware of the variant-specific subtheme colors and avoids the need for the developer to specify all the coloring manually?

To be clear. The Microsoft solution for example contains this code snippet:

return (
<div style={{backgroundColor: semanticColors.bodyBackground}}>
  <p>This React web part has support for section backgrounds and will inherit its background from the section</p>
</div>

);

In this case the bodyBackground semantic color is explicitly applied to the div so that the correct theme variant color is used. Yet, since the framework code must already be aware of the theme (since that gets applied if we don’t use the above snippet) is there a way to make it aware of the selected variant too?

Notice: this is not related to question like this one: How to apply a theme to a spfx web part?. The problem here is that if we use a standard Office UI Fabric component in a web part without any further customization it will automatically reflect the current site theme but it will fail to reflect any theme variant specific to the zone where the web part is collocated.

Are the labels on this use case diagram correct/is the use case diagram correct?

I have created a use case diagram for my system which is an e-learning system.

In terms of the ‘include’ and ‘extend’ I was not 100% sure if I’ve got it right.

I am wondering can anyone tell me if it is good/correct and if the extend’s and include’s are correct?

image of diagram

Hope someone can help! Thanks

How do I determine the correct index on MS-SQL-Server based on a select?

I have two questions about the index management of MS-SQL-Server 2019

  1. If the term “table scan” appears in the execution plan, is that an indication of a “full table scan”, and that means that no index has been used here?

This is the execution plan

  1. I’m never sure if MS-SQL will use my indexes. But I also don’t know how to find out which index it actually uses.

For this join, I create an index on the F_Skonto table with the three columns gueltig_ab, gueltig_bis and CD_Kunde. Is that correct?

LEFT OUTER JOIN dbo.F_Skonto 
    ON S631_BSA.SPTAG >= dbo.F_Skonto.gueltig_ab 
    AND S631_BSA.SPTAG <= dbo.F_Skonto.gueltig_bis 
    AND S631_BSA.PKUNRG = dbo.F_Skonto.CD_Kunde

enter image description here

And for this join I create an index with the two columns Monat and CD_Kunde on the table F_Umstellkosten. Is that correct?

LEFT OUTER JOIN F_Umstellkosten AS u1 
    ON CONVERT(varchar(6), v1.Tag, 112) = u1.Monat 
    AND v1.CD_Kunde = u1.CD_Kunde

enter image description here

information architecture – Tree testing during a redesign – which answers are correct?

I’m working with another UX person on reorganizing the information architecture for a large website. The IA work may eventually lead to a complete redesign of the website and will certainly impact its content.

I am the researcher running the studies on the IA. We have run a series of tree tests, including benchmarking, but the one we just ran has a mostly new set of tasks for a different audience. Some tasks have had multiple people nominate the same answers that we had originally thought were incorrect. Just like in the Atlassian wiki’s guide, we’ve needed to add some new correct answers that we had missed initially.

We are still undecided about some other answers that we have frequently seen.

For example: There’s a page called Contact Us. Let’s say it has only a generic contact form for the entire organization in question. The task in the tree test involves finding someone in a specific department, which participants outside our organization would recognize (at least very generally). The correct answers initially dealt with that department, but about 20% of users nominated Contact Us. (This affects several other tasks too, but these are more complex, and changing the content on the pages would require more significant discussions with stakeholders.)

I’ve been saying that Contact Us is not the right answer for this task, based on its current purpose. Users won’t find what the task is asking for on that page, and there is no cross link to pages where they can contact more specific people.

The other person (who designed the IA) is saying that Contact Us should be a right answer because the site is in a redesign and, if users are saying the content should be in that place, we should change the site to put it there. I’m concerned this may be a slippery slope, but I’m not sure.

In studying tree testing, I haven’t seen anything on how to handle defining correct answers when the site’s content itself is open to change. Are there any previous studies or best practices surrounding this?

discrete mathematics – Probability: portion of wrong and correct words edited by proofreader

Thanks for contributing an answer to Mathematics Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

remote desktop – RDP connection allows any domain name as long as user is correct

I’m hoping someone can provide some ideas about this.

I’ve got a couple of virtual Windows servers set up on Server 2016 and Server 2019. They are DCs and also RDS servers to run remote apps.

I’m encountering a curious situation where, in both instances, when I connect to the servers either via remote app or directly via IP/port using Microsoft Remote Desktop, I am prompted to enter credentials as expected, however the domain does not appear to matter. As an example, if the correct domain is CORRECTDOMAIN and the user is USER1, the following credentials work:

CORRECTDOMAINUSER1

However, the following also works:

PICKLEUSER1

Of note, a domain user is required to login. If I try with an incorrect user, it does not allow me to log in. Essentially any domain string appears to be accepted.

I’m connecting from Windows 10 machines from various IP addresses/networks not in the same domain as the RDS/DCs.

Does a DC assume a connection to it is trying to authenticate to the domain it manages and thus not requiring a domain to be specified? I did some additional testing, and it looks like this is specific to DCs suggesting this may be the case, but I’m not sure that I’m articulating this correctly. To test, I connected to an RDS server that is not a DC but is subject to one’s policies, and a correct domain was required.

Has anyone else ever experienced this, or have any tips to point me in the right direction?

Thank you for your time.