Rest create API sharepoint list item

See the updated sample code as follows:

If you have a single selection for the User and Group field and for the Selection field, create the data as shown below

function createEmployeeDetailsListItem(excelRow) {
var data = {
    __metadata: {
        type: "SP.Data.E2EVMVulnerabilitiesMappingMasterListItem"
    },
    Title: excelRow("Title"),
    ID: excelRow("ID"),
    DateCol: new Date(excelRow("Datecolumn")).toISOString(), //Datecolumn
    PersonGroupColId: excelRow("Persongroupcolumn"), //here you need to set the Id of the Group or a User (For single user or group selection)
    ChoiceCol: excelRow("Choicecolumn") //Choicecolumn, here you need to set you Choice as a Stirng "Choice 1" (Only work for single Choice selection)
}

$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Test')/items",
    type: "POST",
    data: JSON.stringify(data),
    headers: {
        "Accept": "application/json;odata=verbose",
        "Content-Type": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val(),
        "X-HTTP-Method": "POST"
    },
    success: function(data, status, xhr) {
        console.log("success");
    },
    error: function(xhr, status, error) {
        console.log("error");
    }
});}

If you have multiple selections for user and group fields and for selection fields, create data as below

function createEmployeeDetailsListItem(excelRow) {
var data = {
    __metadata: {
        type: "SP.Data.E2EVMVulnerabilitiesMappingMasterListItem"
    },
    Title: excelRow("Title"),
    ID: excelRow("ID"),
    DateCol: new Date(excelRow("Datecolumn")).toISOString(), //Datecolumn
    PersonGroupColId: { 'results': excelRow("Persongroupcolumn") }, //Here excelRow("Persongroupcolumn") is array of multiple choice - When you field set as Allow Multiple
    ChoiceCol: {
        "__metadata": {
            "type": "Collection(Edm.String)"
        },
        "results": excelRow("Choicecolumn") //Here excelRow("Choicecolumn") is array of multiple choice - When you field set as Allow Multiple
    }
}

$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Test')/items",
    type: "POST",
    data: JSON.stringify(data),
    headers: {
        "Accept": "application/json;odata=verbose",
        "Content-Type": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val(),
        "X-HTTP-Method": "POST"
    },
    success: function(data, status, xhr) {
        console.log("success");
    },
    error: function(xhr, status, error) {
        console.log("error");
    }
});}

magento2 – Create new VPS memory images and download files to magento

My pages are very big with image and file upload.

So, I want to set up as a CDN from another Server2 VPS from the current Server1 VPS. This server will upload memory images and files.

I knew that Magento could change the URL storage of baseUrl and baseSecureUrl. However, I do not know how to map 2 servers and sync that.

Can someone suggest me to create such a memory step by step?

Custom Post Types – Create and update 2 CPT consecutively

Is it possible to create and update a CPT after a post has been created sequentially in the same flow?

For example:

First, I'm doing a wp_insert_post ($ my_first_cpt) (with some data and running on save_post hook)

Second, wp_update_post ($ my_second_cpt) (with DATA from $ my_first_cpt, for example, a random seed) and show are executed immediately afterwards

Basically, $ my_first_cpt needs to be created and saved, and immediately afterwards something must be raised to retrieve data from $ my_first_post and update $ my_second_post

Is that possible?
I tried to place one after the other and it just does not work.

Google Sheets – Create a hyperlink of two columns, one with title and one with links, and then just keep the hyperlink without losing the links

Demo sheet here.

Suppose I have two columns, one with string literal names and one with links (in text form).

A               B
Restaurant 1    http://www.link1.com
Restaurant 2    http://www.link2.com

I want to combine these, which I can easily do over HYPERLINK In another column, say C:

=HYPERLINK(B2, A2)

A               B                       C
Restaurant 1    http://www.link1.com    Combined Link+Name 1
Restaurant 2    http://www.link2.com    Combined Link+Name 2

My problem, however, is that I want to replace column A with my new combined hyperlink + name field. My ultimate goal is to combine my name and link columns into one, and that does not have to be anymore.

A                           B
Combined Link+Name 1      http://www.link1.com
Combined Link+Name 2      http://www.link2.com

If I paste the combined column or delete the existing columns, at least one of the links in the link will be removed, causing either a REF error or loss of text or link. In most cases, I could just insert values, but pasting values ​​looses the join I need to keep. Does anyone know a way to get around this?

Java – Create a listener, pass a value from a BroadcastReceive

I have doubts about how to perform an action.

When I receive an income call, I want to share the number for my class managing the Bluetooth connection with Arduino.

After I sent the number, I would like to send it via Bluetooth connection

I have tried to use intent, but I may be using outdated version.

Android Api 7.1

Brodcaster receiver class

package com.jidea.glass;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;

public class TelephonyReceiver extends BroadcastReceiver
{

    @Override
    public void onReceive(Context arg0, Intent intent) {
// TODO Auto-generated method stub
        try {
            if (intent != null && intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) {
                //Toast.makeText(context, "Outgoign call", 1000).show();
                String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
            } else {
                //get the phone state
                String newPhoneState = intent.hasExtra(TelephonyManager.EXTRA_STATE) ? intent.getStringExtra(TelephonyManager.EXTRA_STATE) : null;
                Bundle bundle = intent.getExtras();

                if (newPhoneState != null && newPhoneState.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                    //read the incoming call number
                    String phoneNumber = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
                    Log.i("PHONE RECEIVER", "Telephone is now ringing " + phoneNumber);
                    //Toast.makeText(arg0, "Tele disponivel " + phoneNumber, Toast.LENGTH_LONG).show();
                    if(phoneNumber!=null | phoneNumber.equals("")){
                               PASS HERE TO BLUETOOTH           
                    }
                }

Bluetooth Class

package com.jidea.glass;


import android.app.ProgressDialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
//import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import java.io.IOException;
import java.util.UUID;

public class CustomProcess extends AppCompatActivity
{
    String address = null;
    private ProgressDialog progress;
    BluetoothAdapter myBluetooth = null;
    BluetoothSocket btSocket = null;
    private boolean isBtConnected = false;
    //SPP UUID. Look for it
    static final UUID myUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");

    //observable


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent newint = getIntent();
        address = newint.getStringExtra(MainActivity.EXTRA_ADDRESS); //receive the address of the bluetooth device
        setContentView(R.layout.activity_custom_process);
        //msg(address);
        new ConnectBT().execute(); //Call the class to connect

    }
    public void isConnected() {//View view
        if (btSocket!=null)
        {
            try
            {
                btSocket.getOutputStream().write("Conectado".toString().getBytes());
            }
            catch (IOException e)
            {
                msg("Error");
            }
        }
    }

    public void haveCall(String Phone) {//View view
        Object aLig="Ligação n"+Phone;
        if (btSocket!=null)
        {
            try
            {
                btSocket.getOutputStream().write(aLig.toString().getBytes());
            }
            catch (IOException e)
            {
                msg("Error");
            }
        }
    }

    private void msg(String s)
    {
        Toast.makeText(getApplicationContext(),s,Toast.LENGTH_LONG).show();
    }

    private class ConnectBT extends AsyncTask  // UI thread
    {
        private boolean ConnectSuccess = true; //if it's here, it's almost connected

        @Override
        protected void onPreExecute()
        {
            progress = ProgressDialog.show(CustomProcess.this, "Connecting...", "Please wait!!!");  //show a progress dialog
        }

        @Override
        protected Void doInBackground(Void... devices) //while the progress dialog is shown, the connection is done in background
        {
            try
            {
                if (btSocket == null || !isBtConnected)
                {
                    myBluetooth = BluetoothAdapter.getDefaultAdapter();//get the mobile bluetooth device
                    BluetoothDevice dispositivo = myBluetooth.getRemoteDevice(address);//connects to the device's address and checks if it's available
                    btSocket = dispositivo.createInsecureRfcommSocketToServiceRecord(myUUID);//create a RFCOMM (SPP) connection
                    BluetoothAdapter.getDefaultAdapter().cancelDiscovery();
                    btSocket.connect();//start connection
                }
            }
            catch (IOException e)
            {
                ConnectSuccess = false;//if the try failed, you can check the exception here
            }
            return null;
        }
        @Override
        protected void onPostExecute(Void result) //after the doInBackground, it checks if everything went fine
        {
            super.onPostExecute(result);

            if (!ConnectSuccess)
            {
                msg("Connection Failed. Is it a SPP Bluetooth? Try again.");
                finish();
            }
            else
            {
                msg("Conectado");
                isBtConnected = true;
                isConnected();
            }
            progress.dismiss();
        }
    }


}

Manipulate – Why Does Manipulation Not Create a Diagram?

Why does not the manipulation produce a diagram?

Remove(y);
Remove(b);
n = 1;
k = 1;
j = Solve(k*y*(1 - y/n) - b == 0, {y})
o(b_) := Evaluate(y /. j)
s = DSolve(y'(t) == k*y(t)*(1 - y(t)/n) - b, y(t), t);
f(t_, b_, c_) := Evaluate(y(t) /. s)
sol = Table(f(t, b, c), {c, -5, 5})
d=Manipulate(Plot(sol, {t, -5, 5}), {b, 1, 5})

image

How do we correct that? How would I make it into a GIF?

Graphics – Create a nine-region cluster diagram with tooltip to display labels for 2D points

I'm trying to create a cluster graph with nine regions using the tooltip to show labels associated with 2D points that are also displayed on them. I DO NOT want to use "FindClusters". I want to design my own cluster diagram, as explained below. The following dummy data consists of 2-D points, each point having an identifier named "NAICS" (NAICS stands for "North American Industry")
Classification system ").

mockdataWithNAICS = {{"29-1141", 186, 112}, {"41-2031", 123, 92}, {"41-1011", 65, 404}, {"43-4051", 108, 646}, {"31-1014", 643, 246},
        {"49-9071", 356, 363}, {"43-1011", 543, 381}, {"43-5081", 268, 674}, {"53-3032", 416, 653}, {"37-3011", 514, 428}, {"37-2012", 501, 58},
        {"33-9032", 441, 598}, {"35-2014", 633, 138}, {"29-2061", 414, 590}, {"53-3033", 98, 155}, {"35-3031", 179, 431}, {"49-3023", 93, 623},
        {"35-3021", 37, 578}, {"41-2011", 256, 237}, {"37-2011", 302, 50}, {"47-1011", 518, 2}, {"11-9111", 313, 294}, {"31-9092", 698, 136},
        {"43-3031", 608, 610}, {"43-6013", 562, 515}, {"13-2011", 415, 327}, {"21-1093", 191, 72}, {"41-4012", 212, 92}, {"41-3031", 546, 418},
        {"31-1011", 591, 49}, {"47-2031", 405, 526}, {"41-3021", 191, 297}, {"15-1151", 442, 445}, {"43-6011", 118, 185}, {"49-1011", 472, 402},
        {"53-7062", 348, 552}, {"43-4171", 409, 396}, {"43-6014", 348, 247}, {"53-1031", 629, 59}, {"47-2061", 589, 534}, {"27-1026", 22, 377},
        {"29-1069", 445, 74}, {"49-9021", 647, 539}, {"43-9061", 25, 543}, {"11-1021", 19, 165}, {"41-1012", 482, 199}, {"29-1062", 1, 68},
        {"43-4081", 217, 112}, {"41-3099", 663, 66}, {"11-3031", 329, 392}, {"53-7061", 357, 515}, {"35-2021", 488, 245}, {"31-9091", 318, 679},
        {"51-1011", 650, 349}, {"11-9051", 38, 145}, {"53-3031", 166, 691}, {"39-9021", 561, 127}, {"39-5012", 665, 362}, {"47-2111", 397, 532},
        {"43-3071", 326, 271}, {"29-2034", 361, 450}, {"35-9011", 12, 366}, {"29-1123", 16, 211}, {"15-1142",162, 662}, {"11-2021", 520, 164},
        {"29-2031", 339, 619}, {"25-2011", 263, 564}, {"41-4011", 551, 301}, {"29-2055", 76, 549}, {"29-2052", 285, 640}, {"13-2072", 370, 542},
        {"35-2012", 512, 547}, {"11-2022", 130, 154}, {"15-1132", 188, 274}, {"13-2052", 338, 587}, {"15-1199", 455, 5}, {"35-9031", 595, 472},
        {"17-2051", 648, 481}, {"11-9199", 430, 189}, {"39-3091", 29, 396}, {"47-2152", 412, 342}, {"29-1122", 582, 20}, {"11-9141", 276, 4},
        {"25-2021", 666, 617}, {"15-1134", 236, 334}, {"37-1011", 407, 664}, {"29-1063", 260, 278}, {"49-3031", 161, 354}, {"41-9022", 185, 144},
        {"41-9041", 551, 628}, {"25-2031", 529, 505}, {"29-2071", 548, 296}, {"29-1127", 373, 124}, {"21-1023", 473, 71}, {"29-1067", 489, 569},
        {"29-1071", 539, 277}, {"11-3121", 390, 348}, {"11-9021", 634, 20}, {"53-3041", 589, 258}, {"49-3021", 47, 206}};

L = Length(mockdataWithNAICS);
counter = Range(L);
counter = Range(L);
mock2Dvalues = {mockdataWithNAICS((#))((2)), mockdataWithNAICS((#))((3))} & /@ counter

The following measurements are required to create a raster:

minx = Round(Min(Table({mock2Dvalues((i))((1))}, {i, 1, L})));
maxx = Round(Max(Table({mock2Dvalues((i))((1))}, {i, 1, L})));

dx = Round(Subdivide(minx, maxx, 3));

miny = Round(Min(Table({mock2Dvalues((i))((2))}, {i, 1, L})));

maxy = Round(Max(Table({mock2Dvalues((i))((2))}, {i, 1, L})));

dy = Round(Subdivide(miny, maxy, 3));

gridpts = Tuples({dx, dy});

Use the following diagram to visualize the grid and all data points:

plt1 = ListPlot(gridpts, Frame -> True, PlotStyle -> Black, 
  GridLines -> {dx, dy}, Epilog :> {Blue, Point(mock2Dvalues)})

The following diagram shows the grid
Points using the tooltip to define the following nine regions:

plt2 = ListPlot(Tooltip(gridpts), Frame -> True, PlotStyle -> Black, 
  GridLines -> {dx, dy})

Here we define the nine cluster regions. We assign colors to the region name to map the 2D points to the regions to which they belong, depending on the color. The colors are arbitrary:

    magentaregion = Rectangle(gridpts((1)), gridpts((6)))

    orangeregion = Rectangle(gridpts((5)), gridpts((10)))

    cyanregion = Rectangle(gridpts((9)), gridpts((14)))

    redregion = Rectangle(gridpts((2)), gridpts((7)))

    blueregion = Rectangle(gridpts((6)), gridpts((11)))

    greenregion = Rectangle(gridpts((10)), gridpts((15)))

    lightgrayregion = Rectangle(gridpts((3)), gridpts((8)))

    yellowregion = Rectangle(gridpts((7)), gridpts((12)))

    blackregion = Rectangle(gridpts((11)), gridpts((16)))

Here the points are paid out by region, to which they belong:

remagentapts = Select(mock2Dvalues, # (Element) magentaregion &)

orangepts = Select(mock2Dvalues, # (Element) orangeregion &)

cyanpts = Select(mock2Dvalues, # (Element) cyanregion &)

redpts = Select(mock2Dvalues, # (Element) redregion &)

bluepts = Select(mock2Dvalues, # (Element) blueregion &)

greenpts = Select(mock2Dvalues, # (Element) greenregion &)

lightgraypts = Select(mock2Dvalues, # (Element) lightgrayregion &)

yellowpts = Select(mock2Dvalues, # (Element) yellowregion &)

blackpts = Select(mock2Dvalues, # (Element) blackregion &) 

The following diagrams are required to create the following final diagram:

plt3 = ListPlot(magentapts, Frame -> True, PlotStyle -> Magenta, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

plt4 = ListPlot(orangepts, Frame -> True, PlotStyle -> Orange, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

plt5 = ListPlot(cyanpts, Frame -> True, PlotStyle -> Cyan, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

plt6 = ListPlot(redpts, Frame -> True, PlotStyle -> Red, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

plt7 = ListPlot(bluepts, Frame -> True, PlotStyle -> Blue, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

plt8 = ListPlot(greenpts, Frame -> True, PlotStyle -> Green, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

plt9 = ListPlot(lightgraypts, Frame -> True, PlotStyle -> LightGray, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

plt10 = ListPlot(yellowpts, Frame -> True, PlotStyle -> Yellow, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

plt11 = ListPlot(blackpts, Frame -> True, PlotStyle -> Black, 
   GridLines -> {dx, dy}, PlotRange -> {{minx, maxx}, {miny, maxy}}, 
   AspectRatio -> 1);

This diagram shows the cluster diagram with nine regions with the points colored by the region to which they belong:

finalchart = Show({plt3, plt4, plt5, plt6, plt7, plt8, plt9, plt10, plt11})

At last; We make an association between the NAICS codes and their 2D points as follows:

mockdataWithNAICSlabels = 
  Association(#((1)) -> #((2 ;; 3)) & /@ mockdataWithNAICS);

Dataset(mockdataWithNAICSlabels)

My question is: how can I map the NAICS codes to their respective points BY COLOR REGION so that when I use tooltips; The NAICS codes are displayed for each item in the final chart above. Thanks!