Performance – Block Bootstrap Estimation in Java – Part 2

The following is my attempt to make the code in my previous Block Bootstrap Estimation question more efficient with Java (I learned something about parallel computing last weekend, so I'm very new to it). The text file text.txt can be found at https://drive.google.com/open?id=1vLBoNmFyh4alDZt1eoJpavuEwWlPZSKX (please download the file directly if you want to test it; there are some strange things you won't choose from) even notepad). This is a small 10×10 record with maxBlockSize = 10However, this must be scaled up to twenty 5000 x 3000 data records maxBlockSize = 3000just to get an idea of ​​the size.

import java.io.FileInputStream;
import java.lang.Math;
import java.util.Scanner;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.FileOutputStream;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.DoubleStream;

public class BlockBootstrapTestParallel {

    // Sum of a subarray, based on B(x, i, L) -- i is one-indexing
    public static double sum(double() x, int i, int L) {
        return IntStream.range(i, i + L)
                        .parallel()
                        .mapToDouble(idx -> x(idx - 1))
                        .sum();
    }

    // Mean of a subarray, based on B(x, i, L) -- i is one-indexing
    public static double mean(double() x, int i, int L) {
        return IntStream.range(i, i + L)
                        .parallel()
                        .mapToDouble(idx -> x(idx - 1))
                        .average()
                        .orElse(0);
    }

    // Compute MBB mean
    public static double mbbMu(double() x, int L) {     
        return IntStream.range(0, x.length - L + 1)
                        .parallel()
                        .mapToDouble(idx -> mean(x, idx + 1, L))
                        .average()
                        .orElse(0);
    }

    // Compute MBB variance
    public static double mbbVariance(double() x, int L, double alpha) {
        return IntStream.range(0, x.length - L + 1)
                        .parallel()
                        .mapToDouble(idx -> (Math.pow(L, alpha) * Math.pow(mean(x, idx + 1, L) - mbbMu(x, L), 2)))
                        .average()
                        .orElse(0);
    }

    // Compute NBB mean
    public static double nbbMu(double() x, int L) {
        return IntStream.range(0, x.length / L)
                        .parallel()
                        .mapToDouble(idx -> (mean(x, 1 + ((idx + 1) - 1) * L, L)))
                        .average()
                        .orElse(0);
    }

    // Compute NBB variance
    public static double nbbVariance(double() x, int L, double alpha) {

        double varSum = IntStream.range(0, x.length / L)
                                 .parallel()
                                 .mapToDouble(idx -> (Math.pow(mean(x, 1 + ((idx + 1) - 1) * L, L) - nbbMu(x, L), 2)))
                                 .average()
                                 .orElse(0);

        return Math.pow((double) L, alpha) * varSum;

    }

    // factorial implementation
    public static double factorial(int x) {
        double() fact = {1.0, 1.0, 2.0, 6.0, 24.0, 120.0, 720.0, 5040.0, 40320.0, 362880.0, 3628800.0};
        return fact(x);
    }

    // Hermite polynomial
    public static double H(double x, int p) {
        double out = 0;
        for (int i = 0; i < (p / 2) + 1; i++) {
            out += Math.pow(-1, i) * Math.pow(x, p - (2 * i)) / 
                ((factorial(i) * factorial(p - (2 * i))) * (1L << i));
        }
        out *= factorial(p);
        return out;
    }

    // Row means
    public static double() rowMeans(double()() x, int nrows, int ncols) {
        double() means = new double(nrows);
        for (int i = 0; i < nrows; i++) {
            means(i) = mean(x(i), 1, ncols);
        }
        return means;
    }

    public static void duration(long start, long end) {
        System.out.println("Total execution time: " + (((double)(end - start))/60000) + " minutes");
    }


    public static void main(String() argv) throws IOException {
        final long start = System.currentTimeMillis();
        FileInputStream fileIn = new FileInputStream("test.txt");
        FileOutputStream fileOutMBB = new FileOutputStream("MBB_test.txt");
        FileOutputStream fileOutNBB = new FileOutputStream("NBB_test.txt");
        FileOutputStream fileOutMean = new FileOutputStream("means_test.txt");

        Scanner scnr = new Scanner(fileIn);
        PrintWriter outFSMBB = new PrintWriter(fileOutMBB);
        PrintWriter outFSNBB = new PrintWriter(fileOutNBB);
        PrintWriter outFSmean = new PrintWriter(fileOutMean);

        // These variables are taken from the command line, but are inputted here for ease of use.
        int rows = 10;
        int cols = 10;
        int maxBlockSize = 10; // this could potentially be any value <= cols
        int p = 1;
        double alpha = 0.1;
        double()() timeSeries = new double(rows)(cols);

        // read in the file, and perform the H_p(x) transformation
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                timeSeries(i)(j) = H(scnr.nextDouble(), p);
            }
            scnr.next(); // skip null terminator
        }

        // row means
        double() sampleMeans = rowMeans(timeSeries, rows, cols);
        for (int i = 0; i < rows; i++) {
            outFSmean.print(sampleMeans(i) + " ");
        }
        outFSmean.println();
        outFSmean.close();

        new Thread(() -> {
            for (int j = 0; j < rows; j++) {
                for (int m = 0; m < maxBlockSize; m++) {
                    outFSMBB.print(mbbVariance(timeSeries(j), m + 1, alpha) + " ");
                }
            outFSMBB.println();
            }           
            outFSMBB.close();
        }).start();

        new Thread(() -> {
            for (int j = 0; j < rows; j++) {
                for (int m = 0; m < maxBlockSize; m++) {
                    outFSNBB.print(nbbVariance(timeSeries(j), m + 1, alpha) + " ");
                }
            outFSNBB.println();
            }           
            outFSNBB.close();
        }).start();
        duration(start, System.currentTimeMillis());
    }
}

If required, I have 8 cores with 64 GB RAM and two GPUs, the use of which I do not know (Intel UHD Graphics 630, NVIDIA Quadro P620). I will be thinking about how to use them when I have to over the next few days.

Web Part – Error using RSS feed web part in SP 2013

I am using the RSS web part to display an RSS feed. It worked fine for 2 years, but a few months ago it stopped working and shows the error message & # 39; The requested RSS feed could not be displayed. Please check the settings and URL for this feed. If this problem persists, contact your administrator. & # 39; I have used other RSS readers to test the feed and it is displaying properly.

I am the site administrator in the manner "I am responsible for this website" and not in the manner "I am the server administrator in the IT department". Therefore, I cannot check the logs or do anything on the server side that is frustrating. The RSS feed is hosted in the same top-level domain as the SharePoint site, and both URLs enforce HTTPS. When I google the error, I have a guess that it is either related to a proxy server or security problems related to the certificate. I sent links to the server administrator but they pull their feet up and I wonder if they don't know what's going on and I want to find something that I can send to the server administrator because if I don't. t, this will turn into a problem that you ignore and hope it will go away.

Python – Understand how the IM / Chat part of the app is structured

I've read a lot about XMPP and I'm still not sure if I fully understand how XMPP works and how I would create the instant messaging part of my Python app.

Am I right when I think I need to use something like sleekxmpp or aioxmpp to route the messages to a server like IoT Broker / ejabberd / open fire (recommendations for a good free one would be great) that I need to install on my computer ?

Don't I need a better server than my computer when the number of user messages increases? Is it possible to use a cloud server and how would this work with IoT Broker or ejabberd ….. or did I misunderstand this bit?

I also plan to save the chat history in a MySQL database. I can imagine that this has to be hosted on a server (AWS or something?).

Web Part – Sharepoint SPFX React / typescript layout for mobile devices

That's why I created a Sharepoint SPFx React Typescript app that works perfectly.

With this manual I am designing a mobile version of the web part app: https://goshakkk.name/different-mobile-desktop-tablet-layouts-react/

I used developer tools on Google Chrome to view the website on a mobile device (screen size less than 760 pixels).

However, when I load the Sharepoint page on my mobile phone, the desktop version is displayed. When I view the SharePoint site in my mobile browser or in the SharePoint app, it appears that the full desktop version of the site is loading. If I change const isMobile = width <= 1200; up to 1200 the mobile version is displayed, but everything is designed for the desktop.

Is that because I switched off? mobile browser view : https://gauravmahajan.net/2016/07/15/sharepoint-turn-off-mobile-view/

I disabled it because the site was redirected to a touch app link that was not working.

How can I open my SharePoint site on a mobile phone in the mobile area?

Web Part – How do I use Flow to create a brand new Sharepoint news story?

I am very new to Sharepoint, Forms and Flow. I am trying to automate a workflow when sending a form response to create a Newspost page on Sharepoint with data from the form.

I want to designate the author of the page as the person who submitted the form.

The page title should also be taken from one of the answers. The rest of the answers can be in a text web part.

The key is automating all of this in Flow (or Power Automate). So far no success after many hours of research and testing. I only managed to collect data when a form was submitted.

Azure Ad – How do I get an accessToken using the MSAL library in a Sharepoint web part?

I have developed a Sharepoint web part in which I have to get the accessToken. I used an MSAL library to get the token.

My problem is next: I am logged in to my sharepoint, but when the web part tries to get the accessToken, authentication fails and the following error is displayed:

xxxx-web-part.js: 1838 ClientAuthError: User login required. at ClientAuthError.AuthError (as constructor) (https: // localhost: 4321 / dist / xxx-web-part.js: 2057: 28) at new ClientAuthError (https: // localhost: 4321 / dist / xxxx-web-part ) .js: 630: 28) under Function.7ZR7.ClientAuthError.createUserLoginRequiredError (https: // localhost: 4321 / dist / xxxx-web-part.js: 682: 16) under https: // localhost: 4321 / dist / xxx -web-part.js: 2916: 103 at new Promise () at UserAgentApplication.ZES5.UserAgentApplication.acquireTokenSilent (https: // localhost: 4321 / dist / xxxx-web-part.js: 2905: 16) at UserAgentApplication. descriptor .value (as purchaseTokenSilent) (https: // localhost: 4321 / dist / xxxx-web-part.js: 2543: 38) at xxxWebPart.PlTk.xxxxWebPart.render (https: // localhost: 4321 / dist / xxxx – web-part.js: 1828: 19) at xxxxWebPart.t._renderWithAccessibleTitle (https://spoprod-a.akamaihd.net/files/sp-client/sp-webpart-workbench-assembly_en-us_27e01b6941bf5cdddecc695bd8bb3bb) unterbb3bb) /spoprod-a.akamaihd.net/files/sp-cli ent / sp-webpart-workbench-assembly_en-us_27e01b6941bf5cdddecc695bd3bdbb95.js: 21: 585352

How can this be fixed? I would like me to receive the accessToken when I am logged into Sharepoint without logging into the system again.

This is my code:

    export default class MyWebPart extends BaseClientSideWebPart  {

     public render(): void {

     const config = {
         auth: {
            clientId: "xxxxxxxxxxxxxxx",
            authority: "https://login.microsoftonline.com/yyyyyyyyyyyyyyyyyyy"
        }
   };

    const myMSALObj = new UserAgentApplication(config);

      let accessTokenRequest = {
          scopes: ("user.read")
      }

      myMSALObj.acquireTokenSilent(accessTokenRequest).then(function(accessTokenResponse) {
          // Acquire token silent success
          // call API with token
          let accessToken = accessTokenResponse.accessToken;
          let scopes = accessTokenResponse.scopes;
      }).catch(function (error) {
              //Acquire token silent failure, and send an interactive request
              console.log(error);
              if (error.errorMessage.indexOf("interaction_required") !== -1) {
                  myMSALObj.acquireTokenRedirect(accessTokenRequest);
              }
      });

Sharepoint online – drag & drop email – document library vs. Web part

When dragging an email from Outlook (version 1902 build 11328.20368 click-to-run), two different drag-and-drop experiences when using the web part document library vs. Document library occur in SharePoint Online.

Document library – When dragging the email is the email copied to the document library.

Web part – When dragging the email is the email touched from Outlook inbox to document library.

The preferred feature is the first to copy the email. Is this expected behavior? Can i change that?

Thanks a lot!

Typescript – How can I automatically log a user in a Sharepoint web part?

Enter the image description here

I have a "Play Web" website. If I want to access this site, I have to log in with user / pass beforehand. An authentication module that processes this information and starts communication with an Azure AD. If the user is properly verified using a callback, the control with the logged in user is returned to the Play Web. All of these steps work well.

Where is the problem?. One of our customers wants to embed this "Play Web" in his sharepoint, but does not want to register again. He must use the Sharepoint context to automatically register the user on the website.

Is there any way to do this? Should I set up something in Azure AD: proxy, function?

I stick to it.

greetings

Hyperlink – Text Web Part – Edit Hiperlink on Sharepoint Online

When I select the text with the hyperlink, click on edit and the field with the link is empty ("https: //"), although the link is clickable and leads you to the correct page.
If I enter a new link in this empty field and publish the page, the text also loses the formatting and the hyperlink is removed.

Hyperlink editor

I reported a ticket to ms, but they've only been collecting logs for a month.