问:
Write multiple values from json file into input php
I was trying to Write multiple values from json file into input php any possible to do that

here an example

array json try to send req

but the code error like this

array on php send request

```<code>$result[] = array(
      "No_" => $record['No_'],
     "Lokasi" => $record['Location'],
     "MRDate" => $record['MRDate']->format('Y-m-d'),
     "Description" => $record['Description'],
     "UOM" => $record['UOM'],
     "QTY" => $record['QTY'],
     "Item_No" => $record['Item_No'],
     //$No_= "No_"

   );

}

   //$result = array("$MRDate", "$No_","$Lokasi","$Item_No","$Description","$UOM","$QTY");
//endwhile

// Send in JSON encoded form
$myJSON = json_encode($result);
echo $myJSON;
//sqlsrv_free_stmt( $stmt2);
</code>```

on js get the req

```<code>var xmlhttp = new XMLHttpRequest();
                xmlhttp.onreadystatechange = function () {

                    if (this.readyState == 4 &&
                            this.status == 200) {

                        var myObj = JSON.parse(this.responseText);

                         var tempD = myObj[0];

                         document.getElementById
                         ("MRDate").value = tempD;

                        document.getElementById
                        ("No_").value = myObj[1];

                        document.getElementById
                        ("lokasi").value = myObj[2];

                        document.getElementById
                        ("Item_No").value = myObj[3];

                        document.getElementById
                        ("Description").value = myObj[4];

                        document.getElementById
                        ("UOM").value = myObj[5];

                        document.getElementById
                        ("QTY").value = myObj[6];

                    }
                };

                // xhttp.open("GET", "filename", true);
                xmlhttp.open("GET", "option_mr.php?List=" + str, true);

                // Sends the request to the server
                xmlhttp.send();
            }
        }
</code>```

i try to single input it working but with multiple array error

please advice

Body:
I was trying to Write multiple values from json file into input php any possible to do that

here an example

array json try to send req

but the code error like this

array on php send request

$result[] = array(
      "No_" => $record['No_'],
     "Lokasi" => $record['Location'],
     "MRDate" => $record['MRDate']->format('Y-m-d'),
     "Description" => $record['Description'],
     "UOM" => $record['UOM'],
     "QTY" => $record['QTY'],
     "Item_No" => $record['Item_No'],
     //$No_= "No_"

   );

}

   //$result = array("$MRDate", "$No_","$Lokasi","$Item_No","$Description","$UOM","$QTY");
//endwhile

// Send in JSON encoded form
$myJSON = json_encode($result);
echo $myJSON;
//sqlsrv_free_stmt( $stmt2);

on js get the req

var xmlhttp = new XMLHttpRequest();
                xmlhttp.onreadystatechange = function () {

                    if (this.readyState == 4 &&
                            this.status == 200) {

                        var myObj = JSON.parse(this.responseText);

                         var tempD = myObj[0];

                         document.getElementById
                         ("MRDate").value = tempD;

                        document.getElementById
                        ("No_").value = myObj[1];

                        document.getElementById
                        ("lokasi").value = myObj[2];

                        document.getElementById
                        ("Item_No").value = myObj[3];

                        document.getElementById
                        ("Description").value = myObj[4];

                        document.getElementById
                        ("UOM").value = myObj[5];

                        document.getElementById
                        ("QTY").value = myObj[6];

                    }
                };

                // xhttp.open("GET", "filename", true);
                xmlhttp.open("GET", "option_mr.php?List=" + str, true);

                // Sends the request to the server
                xmlhttp.send();
            }
        }

i try to single input it working but with multiple array error

please advice


来源: stackexchange

问:
How can I speed up pandas to iterate a function over 500k rows at greater than 600 per minute?
I have a list of many different products sold at auction over the past 10 years or so.

Pandas table is ID (keyed), NAME, DATE_RETRIEVED (which is the online auction final date and happens 1x per month), PRICE,

I then add columns PRIOR, NEARPRIOR and POST and try to populate them using a function to flag how many of the same product NAME were sold ~124 days prior, ~66 days prior, and 93 days after, respectively.

The only way I've done this is to pull all the unique DATE_RETRIEVED entries and put them in a dictionary:

```<code>td0=np.timedelta64(0,'D')
td1=np.timedelta64(125,'D')
td2=np.timedelta64(63,'D')
td3=np.timedelta64(93,'D')

tdict={}
keyer=inp.DATE_RETRIEVED.unique()

for tt in keyer:
  ele=np.datetime64(tt)
  lister1=[]
  lister2=[]
  lister3=[]
  for zz in keyer:
    if zz==tt:
      pass
    else:
      elm=np.datetime64(zz)
      if ele-elm<td1 and ele-elm>td0:
        lister1.append(zz)
      if ele-elm<td2 and ele-elm>td0:
        lister2.append(zz)
      if elm-ele<td3 and elm-ele>td0:
        lister3.append(zz)
  tdict[tt]=(lister1,lister2,lister3)
</code>```

And then to iterate through the database one line at a time:

```<code>sett=inp.index.values
for ele in sett:
  if ele%100==0:
      print(ele)
  try:
    inp.loc[ele,'PRIOR']=float(inp[(inp.NAME==inp.loc[ele].NAME)&(inp.DATE_RETRIEVED.isin(tdict[inp.loc[ele].DATE_RETRIEVED][0]))].groupby('NAME').count().ID[0])
    inp.loc[ele,'POST']=float(inp[(inp.NAME==inp.loc[ele].NAME)&(inp.DATE_RETRIEVED.isin(tdict[inp.loc[ele].DATE_RETRIEVED][2]))].groupby('NAME').count().ID[0])
    inp.loc[ele,'NEARPRIOR']=float(inp[(inp.NAME==inp.loc[ele].NAME)&(inp.DATE_RETRIEVED.isin(tdict[inp.loc[ele].DATE_RETRIEVED][1]))].groupby('NAME').count().ID[0])
  except IndexError:
    pass
</code>```

But this seems very very slow and there has to be a better way to do it.  I just don't know enough how.

ContentLicense: CC BY-SA 4.0

Body:
I have a list of many different products sold at auction over the past 10 years or so.

Pandas table is ID (keyed), NAME, DATE_RETRIEVED (which is the online auction final date and happens 1x per month), PRICE,

I then add columns PRIOR, NEARPRIOR and POST and try to populate them using a function to flag how many of the same product NAME were sold ~124 days prior, ~66 days prior, and 93 days after, respectively.

The only way I've done this is to pull all the unique DATE_RETRIEVED entries and put them in a dictionary:

td0=np.timedelta64(0,'D')
td1=np.timedelta64(125,'D')
td2=np.timedelta64(63,'D')
td3=np.timedelta64(93,'D')

tdict={}
keyer=inp.DATE_RETRIEVED.unique()

for tt in keyer:
  ele=np.datetime64(tt)
  lister1=[]
  lister2=[]
  lister3=[]
  for zz in keyer:
    if zz==tt:
      pass
    else:
      elm=np.datetime64(zz)
      if ele-elm<td1 and ele-elm>td0:
        lister1.append(zz)
      if ele-elm<td2 and ele-elm>td0:
        lister2.append(zz)
      if elm-ele<td3 and elm-ele>td0:
        lister3.append(zz)
  tdict[tt]=(lister1,lister2,lister3)

And then to iterate through the database one line at a time:

sett=inp.index.values
for ele in sett:
  if ele%100==0:
      print(ele)
  try:
    inp.loc[ele,'PRIOR']=float(inp[(inp.NAME==inp.loc[ele].NAME)&(inp.DATE_RETRIEVED.isin(tdict[inp.loc[ele].DATE_RETRIEVED][0]))].groupby('NAME').count().ID[0])
    inp.loc[ele,'POST']=float(inp[(inp.NAME==inp.loc[ele].NAME)&(inp.DATE_RETRIEVED.isin(tdict[inp.loc[ele].DATE_RETRIEVED][2]))].groupby('NAME').count().ID[0])
    inp.loc[ele,'NEARPRIOR']=float(inp[(inp.NAME==inp.loc[ele].NAME)&(inp.DATE_RETRIEVED.isin(tdict[inp.loc[ele].DATE_RETRIEVED][1]))].groupby('NAME').count().ID[0])
  except IndexError:
    pass

But this seems very very slow and there has to be a better way to do it.  I just don't know enough how.


问:
MFE webpack config causing Undefined reading call
After restructure my configs directory and config file entries in the webpack configs, I'm getting error in my HOST application when trying to import Remote Application. Host app was working as intended before the restructure. is there anything to do with the nested /src/ folder?

the working structure before refactoring

```<code>- /
- /remote
-    /bootstrap
-    /app
-    /index
-    /webpack.config.js
- /host
-    /bootstrap
-    /app
-    /index
-    /webpack.config.js
</code>```

the structure after refactoring that causes the undefined (reading 'call')

```<code>- /
- /remote/src
-    /bootstrap
-    /app
-    /index
- /host/src
-    /bootstrap
-    /app
-    /index
- /configs
-    /webpack.remote.js
-    /webpack.host.js
</code>```

In general unchanged files

```<code>index.ts
import './App.tsx'

App.tsx (Actual Application Component)
    -- HOST import Box from 'mfe/Box'
    -- REMOTE export Box()

Bootstrap.tsx (Used for mounting the Remote MFE without host)
    - import './App'
    - mount App to DOM
</code>```

Below are the restructured webpack config files with only the file path changed in the following properties

entry from: ./src/App.tsx to ./{folder}/src/App.tsx

HtmlWebPackPlugin.template: from /src/index.html to /{folder}/src/index.html

remote mfe config

```<code>  -- from
  exposes: {
    "./App": "./src/index.ts"
  },
  -- to
  exposes: {
    "./App": "./remote/src/index.ts"
  },
</code>```

-- webpack host config

```<code>const HtmlWebPackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");

const deps = require("./host/package.json").dependencies;
module.exports = {
  mode: "development",
  entry: './host/src/App.tsx',
  output: {
    publicPath: "http://localhost:5000/",
  },

  resolve: {
    extensions: ["*", ".tsx", ".ts", ".jsx", ".js", ".json"],
  },

  devServer: {
    port: 5000,
    historyApiFallback: true,
  },

  module: {
    rules: [
      {
        test: /\.m?js/,
        type: "javascript/auto",
        resolve: {
          fullySpecified: false,
        },
      },
      {
        test: /\.(css|s[ac]ss)$/i,
        use: ["style-loader", "css-loader", "postcss-loader"],
      },
      {
        test: /\.(ts|tsx|js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
        },
      },
    ],
  },

  plugins: [
    new ModuleFederationPlugin({
      name: "host",
      // filename: "remoteEntry.js",
      remotes: {
        'module': "remote@http://localhost:5001/remoteEntry.js"
      },
      exposes: {},
    }),
    new HtmlWebPackPlugin({
      template: "./host/src/index.html",
    }),
  ],
};
</code>```

-- webpack remote

```<code>const HtmlWebPackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");

const deps = require("./remote/package.json").dependencies;
module.exports = {
  mode: "development",
  entry: "./remote/src/Bootstrap.tsx",
  output: {
    publicPath: "http://localhost:5001/",
  },

  resolve: {
    extensions: [".tsx", ".ts", ".jsx", ".js", ".json"],
  },

  devServer: {
    port: 5001,
    historyApiFallback: true,
  },

  module: {
    rules: [
      {
        test: /\.m?js/,
        type: "javascript/auto",
        resolve: {
          fullySpecified: false,
        },
      },
      {
        test: /\.(css|s[ac]ss)$/i,
        use: ["style-loader", "css-loader", "postcss-loader"],
      },
      {
        test: /\.(ts|tsx|js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
        },
      },
    ],
  },

  plugins: [
    new ModuleFederationPlugin({
      name: "remote",
      filename: "remoteEntry.js",
      exposes: {
        "./App": "./remote/src/index.ts"
      },
      shared: {
        ...deps,
        react: {
          singleton: true,
          requiredVersion: deps.react,
        },
        "react-dom": {
          singleton: true,
          requiredVersion: deps["react-dom"],
        },
      },
    }),
    new HtmlWebPackPlugin({
      template: "./remote/src/index.html",
    }),
  ],
};
</code>```

Body:
After restructure my configs directory and config file entries in the webpack configs, I'm getting error in my HOST application when trying to import Remote Application. Host app was working as intended before the restructure. is there anything to do with the nested /src/ folder?

the working structure before refactoring

- /
- /remote
-    /bootstrap
-    /app
-    /index
-    /webpack.config.js
- /host
-    /bootstrap
-    /app
-    /index
-    /webpack.config.js

the structure after refactoring that causes the undefined (reading 'call')

- /
- /remote/src
-    /bootstrap
-    /app
-    /index
- /host/src
-    /bootstrap
-    /app
-    /index
- /configs
-    /webpack.remote.js
-    /webpack.host.js

In general unchanged files

index.ts
import './App.tsx'

App.tsx (Actual Application Component)
    -- HOST import Box from 'mfe/Box'
    -- REMOTE export Box()

Bootstrap.tsx (Used for mounting the Remote MFE without host)
    - import './App'
    - mount App to DOM

Below are the restructured webpack config files with only the file path changed in the following properties

entry from: ./src/App.tsx to ./{folder}/src/App.tsx

HtmlWebPackPlugin.template: from /src/index.html to /{folder}/src/index.html

remote mfe config

  -- from
  exposes: {
    "./App": "./src/index.ts"
  },
  -- to
  exposes: {
    "./App": "./remote/src/index.ts"
  },

-- webpack host config

const HtmlWebPackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");

const deps = require("./host/package.json").dependencies;
module.exports = {
  mode: "development",
  entry: './host/src/App.tsx',
  output: {
    publicPath: "http://localhost:5000/",
  },

  resolve: {
    extensions: ["*", ".tsx", ".ts", ".jsx", ".js", ".json"],
  },

  devServer: {
    port: 5000,
    historyApiFallback: true,
  },

  module: {
    rules: [
      {
        test: /\.m?js/,
        type: "javascript/auto",
        resolve: {
          fullySpecified: false,
        },
      },
      {
        test: /\.(css|s[ac]ss)$/i,
        use: ["style-loader", "css-loader", "postcss-loader"],
      },
      {
        test: /\.(ts|tsx|js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
        },
      },
    ],
  },

  plugins: [
    new ModuleFederationPlugin({
      name: "host",
      // filename: "remoteEntry.js",
      remotes: {
        'module': "remote@http://localhost:5001/remoteEntry.js"
      },
      exposes: {},
    }),
    new HtmlWebPackPlugin({
      template: "./host/src/index.html",
    }),
  ],
};

-- webpack remote

const HtmlWebPackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");

const deps = require("./remote/package.json").dependencies;
module.exports = {
  mode: "development",
  entry: "./remote/src/Bootstrap.tsx",
  output: {
    publicPath: "http://localhost:5001/",
  },

  resolve: {
    extensions: [".tsx", ".ts", ".jsx", ".js", ".json"],
  },

  devServer: {
    port: 5001,
    historyApiFallback: true,
  },

  module: {
    rules: [
      {
        test: /\.m?js/,
        type: "javascript/auto",
        resolve: {
          fullySpecified: false,
        },
      },
      {
        test: /\.(css|s[ac]ss)$/i,
        use: ["style-loader", "css-loader", "postcss-loader"],
      },
      {
        test: /\.(ts|tsx|js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
        },
      },
    ],
  },

  plugins: [
    new ModuleFederationPlugin({
      name: "remote",
      filename: "remoteEntry.js",
      exposes: {
        "./App": "./remote/src/index.ts"
      },
      shared: {
        ...deps,
        react: {
          singleton: true,
          requiredVersion: deps.react,
        },
        "react-dom": {
          singleton: true,
          requiredVersion: deps["react-dom"],
        },
      },
    }),
    new HtmlWebPackPlugin({
      template: "./remote/src/index.html",
    }),
  ],
};


问:
Any Solution Fasttext And XGBClassifier ( Invalid Classes )
```<code>max_depth = range(1, 51)
train_score = []
test_score = []

X = vecs_train
y = df_train1.Sentiment

for k in max_depth:
    dt = XGBClassifier(random_state=42, max_depth=k)
    dt.fit(X, y)

    train_score.append(dt.score(vecs_train, df_train1.Sentiment))
    test_score.append(dt.score(vecs_dev, df_dev1.Sentiment))

plt.plot(max_depth, train_score, label="train")
plt.plot(max_depth, test_score, label="test")
plt.legend()

print(f"Test Score: {np.max(test_score)}")
print(f"n ke: {max_depth[np.argmax(test_score)]}")
</code>```
```<code>ValueError                                Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_916/2795825213.py in <module>
      8 for k in max_depth:
      9     dt = XGBClassifier(random_state=42, max_depth=k)
---> 10     dt.fit(X, y)
     11
     12     train_score.append(dt.score(vecs_train, df_train1.Sentiment))

c:\users\roihan\miniconda3\lib\site-packages\xgboost\core.py in inner_f(*args, **kwargs)
    573         for k, arg in zip(sig.parameters, args):
    574             kwargs[k] = arg
--> 575         return f(**kwargs)
    576
    577     return inner_f

c:\users\roihan\miniconda3\lib\site-packages\xgboost\sklearn.py in fit(self, X, y, sample_weight, base_margin, eval_set, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, base_margin_eval_set, feature_weights, callbacks)
   1356         ):
   1357             raise ValueError(
-> 1358                 f"Invalid classes inferred from unique values of `y`.  "
   1359                 f"Expected: {expected_classes}, got {self.classes_}"
   1360             )

ValueError: Invalid classes inferred from unique values of `y`.  Expected: [0 1 2], got [1 2 3]
</code>```

i use fasttext to make word or vector weights, then i use that vector for DecisionTreeClassifier and it works, but when i use XGBClassifier i get an error message then after i try i don't get a solution for the error like in the picture

Body:
max_depth = range(1, 51)
train_score = []
test_score = []

X = vecs_train
y = df_train1.Sentiment

for k in max_depth:
    dt = XGBClassifier(random_state=42, max_depth=k)
    dt.fit(X, y)

    train_score.append(dt.score(vecs_train, df_train1.Sentiment))
    test_score.append(dt.score(vecs_dev, df_dev1.Sentiment))

plt.plot(max_depth, train_score, label="train")
plt.plot(max_depth, test_score, label="test")
plt.legend()

print(f"Test Score: {np.max(test_score)}")
print(f"n ke: {max_depth[np.argmax(test_score)]}")

ValueError                                Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_916/2795825213.py in <module>
      8 for k in max_depth:
      9     dt = XGBClassifier(random_state=42, max_depth=k)
---> 10     dt.fit(X, y)
     11
     12     train_score.append(dt.score(vecs_train, df_train1.Sentiment))

c:\users\roihan\miniconda3\lib\site-packages\xgboost\core.py in inner_f(*args, **kwargs)
    573         for k, arg in zip(sig.parameters, args):
    574             kwargs[k] = arg
--> 575         return f(**kwargs)
    576
    577     return inner_f

c:\users\roihan\miniconda3\lib\site-packages\xgboost\sklearn.py in fit(self, X, y, sample_weight, base_margin, eval_set, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, base_margin_eval_set, feature_weights, callbacks)
   1356         ):
   1357             raise ValueError(
-> 1358                 f"Invalid classes inferred from unique values of `y`.  "
   1359                 f"Expected: {expected_classes}, got {self.classes_}"
   1360             )

ValueError: Invalid classes inferred from unique values of `y`.  Expected: [0 1 2], got [1 2 3]

i use fasttext to make word or vector weights, then i use that vector for DecisionTreeClassifier and it works, but when i use XGBClassifier i get an error message then after i try i don't get a solution for the error like in the picture


问:
Task always pass a past value to a function in a iteration
I am creating a service in dynamics 365 crm plugin which is based on C#.
There is a class service containing a function which creates a task for each data in list to submit the data to separate function. However for each iteration of data list, the function always submit the first data in a list.

```<code>public void SubmitPubconDataByCreatingTask(HeadersAndData headersAndData, PubconMessage message)
{
    string mainLabel = "exampleLabel";
    PubconService pubconService = new PubconService(appSetting.PunconUrl, tracingService);
    List<Task> submissionTaks = new List<Task>();

    foreach (List<object> item in headersAndData.data[exampleLabel])
    {
        PubconBody newPubconBody = new PubconBody();
        HeadersAndData newHeadersAndData = headersAndData;
        List<List<object>> newSingleList = new List<List<object>>();

        newSingleList.Add(item);
        newHeadersAndData.data[mainQueryLabel] = newSingleList;
        message.AddHeadersAndData = newHeadersAndData;
        newPubconBody.AddMessage(message);

        Task task = Task.Run(() => pubconService.SubmitData(newPubconBody));
        submissionTaks.Add(task);
     }

     Task.WaitAll(submissionTaks.ToArray());
}
</code>```

Here, message contains a list of data, where I am trying to replace a list with a single data for each iteration.

Body:
I am creating a service in dynamics 365 crm plugin which is based on C#.
There is a class service containing a function which creates a task for each data in list to submit the data to separate function. However for each iteration of data list, the function always submit the first data in a list.

public void SubmitPubconDataByCreatingTask(HeadersAndData headersAndData, PubconMessage message)
{
    string mainLabel = "exampleLabel";
    PubconService pubconService = new PubconService(appSetting.PunconUrl, tracingService);
    List<Task> submissionTaks = new List<Task>();

    foreach (List<object> item in headersAndData.data[exampleLabel])
    {
        PubconBody newPubconBody = new PubconBody();
        HeadersAndData newHeadersAndData = headersAndData;
        List<List<object>> newSingleList = new List<List<object>>();

        newSingleList.Add(item);
        newHeadersAndData.data[mainQueryLabel] = newSingleList;
        message.AddHeadersAndData = newHeadersAndData;
        newPubconBody.AddMessage(message);

        Task task = Task.Run(() => pubconService.SubmitData(newPubconBody));
        submissionTaks.Add(task);
     }

     Task.WaitAll(submissionTaks.ToArray());
}

Here, message contains a list of data, where I am trying to replace a list with a single data for each iteration.


问:
Minikube Virtualbox Save-state/restart node
I am using Minikube with Virtualbox for my home labs and that's awesome.
But sometime I would like to simulate crashe node (Just reset or shutdown VM) or just I don't need this cluster now (Suspend all VMs).
But there is a problem, after any of action reboot VM or suspend VM - minikube doesn't start internal services.
Did anybody have explanation of this behavior and could advice how to avoid it? (Just I don't want to prepare manually VMs, deploy K8s etc.)
PS
When VM up after restart/shutdown/wake up - there is no docker/containerd services start automatically.

Reboot VM, Save State VM and resume.
My expectations are kubernetes cluster works fine but it is not.

PS
Some update: Save-state is ok related to services, but by some reason I lost access via network to node -(


问:
MUI DataGrid transition in heigh when the pageSize changed
@mui/x-data-grid": "^5.17.14

The DataGrid is set to autoHeight, and pageSize value is changeable via setPageSize.
When the pageSize is set to other value, the height of the DataGrid is dynamicly changed.

May I ask how this height change can be made in transition in vertical please? Thanks.

```<code>const [pageSize, setPageSize] = useState<number>(10);

 <DataGrid
          autoHeight
          pageSize={pageSize}
          ...
 />
</code>```

Body:
@mui/x-data-grid": "^5.17.14

The DataGrid is set to autoHeight, and pageSize value is changeable via setPageSize.
When the pageSize is set to other value, the height of the DataGrid is dynamicly changed.

May I ask how this height change can be made in transition in vertical please? Thanks.

const [pageSize, setPageSize] = useState<number>(10);

 <DataGrid
          autoHeight
          pageSize={pageSize}
          ...
 />


问:
How to change Jupyter notebook background color cell toolbar in PyCharm
The cell toolbar has this light grey background color which makes the text unreadable. I cannot find which value in the color scheme to change for this.


问:
Caused by: com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 0))
getting error :Caused by: com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 0)): has to be escaped using backslash to be included in name

at [Source: {"abc":2000,"identifier":"P123"}; line: 1, column: 27]
but i am not able to find this in source table.

I added exception handling while reading but still no luck..


问:
How to debug a cmake dll target in visual studio without generating solution file?
With the solution file I can change the command in the debugging settings to launch the exe that uses the dll, but how to do this when opening the cmake project directly in visual studio (that is without generating the solution file)? launch.vs.json doesn't seems to have relevant settings.


问:
Why do I have incompatible types error when Iterate Map in Java using keySet()?
sI have Class 1 where I have

protected Map<String, Object> parameter = new HashMap<String, Object>();
I have Class 2 that extends Class1 and where I do

List list = this.dao.createSQLQuery(query, this.parameter);

createSQLQuery method for dao looks like this:

```<code>public List createSQLQuery(final String query, final Map parameter) {

                    for (final String key : parameter.keySet()) {

                     . . .
} }
</code>```

Why do I have a error in the for cycle line - “incompatible types: Object cannot be converted to String”?

As I understand my case is not the raw type issue because I declare parameter as Map<String, Object> so parameter.keySet() has to return set of Strings

Body:
sI have Class 1 where I have

protected Map<String, Object> parameter = new HashMap<String, Object>();
I have Class 2 that extends Class1 and where I do

List list = this.dao.createSQLQuery(query, this.parameter);

createSQLQuery method for dao looks like this:

public List createSQLQuery(final String query, final Map parameter) {

                    for (final String key : parameter.keySet()) {

                     . . .
} }

Why do I have a error in the for cycle line - “incompatible types: Object cannot be converted to String”?

As I understand my case is not the raw type issue because I declare parameter as Map<String, Object> so parameter.keySet() has to return set of Strings


问:
nginx Permission denied 403
I'm having a tough time getting an Orange Pi (Ubuntu 22.04.1 LTS) to serve static websites on nginx.  I get the following error:

```<code>2022/12/17 23:05:41 [error] 5206#5206: *4 "/home/user3/sites/vhost1/index.html" is forbidden (13: Permission denied), client: 192.168.1.4, server: vhost1.com, request: "GET / HTTP/1.1", host: "pt.local:8080"
2022/12/17 23:05:41 [error] 5234#5234: *5 open() "/home/user3/sites/vhost1/favicon.ico" failed (13: Permission denied), client: 192.168.1.4, server: vhost1.com, request: "GET /favicon.ico HTTP/1.1", host: "pt.lo
cal:8080", referrer: "http://pt.local:8080/"
</code>```

Permissions on that vhost are 755, and ownership is to :.  The wwwuser is deliberately made to serve sites using nginx.

SELINUX=disabled

How can I make these sites serve properly?

Title: nginx Permission denied 403

Body:
I'm having a tough time getting an Orange Pi (Ubuntu 22.04.1 LTS) to serve static websites on nginx.  I get the following error:

2022/12/17 23:05:41 [error] 5206#5206: *4 "/home/user3/sites/vhost1/index.html" is forbidden (13: Permission denied), client: 192.168.1.4, server: vhost1.com, request: "GET / HTTP/1.1", host: "pt.local:8080"
2022/12/17 23:05:41 [error] 5234#5234: *5 open() "/home/user3/sites/vhost1/favicon.ico" failed (13: Permission denied), client: 192.168.1.4, server: vhost1.com, request: "GET /favicon.ico HTTP/1.1", host: "pt.lo
cal:8080", referrer: "http://pt.local:8080/"

Permissions on that vhost are 755, and ownership is to :.  The wwwuser is deliberately made to serve sites using nginx.

SELINUX=disabled

How can I make these sites serve properly?


问:
member/2 in prolog not working as intended
I am doing a dfs problem using an agent that looks for ships in a grid and picks up the passengers on these ships then drops them off at the station the goal state is all empty ships. In the dfs search I try to prevent the repeated states using the member/2 to check whether a state has already been visited. I've tried debugging the problem as it the output is a bunch of left and right which means the states are repeating but I have no clue why that's happening as I am very new to prolog.

Here I call the the goal It initializes the grid in the predicate s0 and tries to find the path using the path predicate.
`

```<code>goal(Path) :-
    s0(S0),
    path(S0, Path).

% Define the depth-first search algorithm
result(Action, Subpath) :-
    Subpath = result(Action, Subpath).
result(Action, Subpath) :-
    Subpath = s0.

path(S, Path,Visited) :-
    goalCheck(S),
    !.
path(S, Path,Visited) :-
    transition(S, Action, S2),
    \+ member(S2, Visited),
    path(S2, Subpath,[S2|Visited]),
    result(Action, Subpath, Path).

path(S, Path) :-
call_with_depth_limit(path(S, Path,S), 10, Path).
</code>```

Here is the rest of the code, the action predicates check whether an action is possible and the transition predicate return the new state after the action is done.

```<code>grid(3,3).
agent_loc(0,1).
ships_loc([[2,2], [1,2]]).
station(1,1).
capacity(1).
onGuard(0).

% define the initial state
s0(S) :-
    agent_loc(X, Y),
    ships_loc(Ships),
    station(SX, SY),
    capacity(Capacity),
    onGuard(OnGuard),
    S = [[X, Y], Ships, [SX, SY], Capacity,OnGuard].

% define the goal predicate
goalCheck(S) :-
    S = [[_, _], [], [_, _], _].
% define the possible actions
action(pickup(X, Y),S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    ships_loc(Ships),
    member([X, Y], Ships),
    OnGuard < Capacity .
action(drop,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard],
    station(X, Y),
    OnGuard > 0 .
action(left,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    X2 is X - 1,
    X2 >= 0 .
action(right,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    grid(N, _),
    X2 is X + 1,
    X2 < N .
action(up,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    grid(_, M),
    Y2 is Y - 1,
    Y2 >= 0,
action(down,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    grid(_, M),
    Y2 is Y + 1,
    Y2 < M .

% define the transition function

transition(S, pickup(X, Y), S2) :-
    action(pickup(X, Y),S),
    write("Pickup"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    select([X, Y], Ships, Ships2), % remove [X, Y] from Ships
    OnGuard2 is OnGuard + 1,
    S2 = [[X, Y], Ships2, Station, Capacity,OnGuard2].
transition(S, drop, S2) :-
    action(drop,S),
    write("drop"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    OnGuard2 is 0,
    S2 = [[X, Y], Ships, Station, Capacity,OnGuard2].
transition(S, left, S2) :-
    action(left,S),
    write("left"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    X2 is X - 1,
    X2>=0,
    S2 = [[X2, Y], Ships, Station, Capacity,OnGuard].
transition(S, right, S2) :-
    action(right,S),
    write("right"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    X2 is X + 1,
    grid(_,M),
    X2<M,
    S2 = [[X2, Y], Ships, Station, Capacity,OnGuard].
transition(S, up, S2) :-
    action(up,S),
    write("up"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    Y2 is Y - 1,
    Y2>=0,
    S2 = [[X, Y2], Ships, Station, Capacity,OnGuard].
transition(S, down, S2) :-
    action(down,S),
    write("down"),
    [[X, Y],Ships, Station, Capacity,OnGuard]=S,
    Y2 is Y + 1,
    grid(N,_),
    Y2<N,
    S2 = [[X, Y2], Ships, Station, Capacity,OnGuard].

</code>```

`

I tried running the goal(S) expecting a normal path but it keeps on doing right,left,right,left... indefinitely.

Here is the tracing when it does a left after doing a right and checks if this state has been visited before, it fails, which means this repeating state has not been visited before.

Exit: (17) transition([[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], left, [[0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0]) ? creep

Call: (17) lists:member([[0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [[[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0]) ? creep

Fail: (17) lists:member([[0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [[[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0]) ? creep

Redo: (16) path([[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], _214, [[[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0]) ? creep

Body:
I am doing a dfs problem using an agent that looks for ships in a grid and picks up the passengers on these ships then drops them off at the station the goal state is all empty ships. In the dfs search I try to prevent the repeated states using the member/2 to check whether a state has already been visited. I've tried debugging the problem as it the output is a bunch of left and right which means the states are repeating but I have no clue why that's happening as I am very new to prolog.

Here I call the the goal It initializes the grid in the predicate s0 and tries to find the path using the path predicate.
`

goal(Path) :-
    s0(S0),
    path(S0, Path).

% Define the depth-first search algorithm
result(Action, Subpath) :-
    Subpath = result(Action, Subpath).
result(Action, Subpath) :-
    Subpath = s0.

path(S, Path,Visited) :-
    goalCheck(S),
    !.
path(S, Path,Visited) :-
    transition(S, Action, S2),
    \+ member(S2, Visited),
    path(S2, Subpath,[S2|Visited]),
    result(Action, Subpath, Path).

path(S, Path) :-
call_with_depth_limit(path(S, Path,S), 10, Path).

Here is the rest of the code, the action predicates check whether an action is possible and the transition predicate return the new state after the action is done.

grid(3,3).
agent_loc(0,1).
ships_loc([[2,2], [1,2]]).
station(1,1).
capacity(1).
onGuard(0).

% define the initial state
s0(S) :-
    agent_loc(X, Y),
    ships_loc(Ships),
    station(SX, SY),
    capacity(Capacity),
    onGuard(OnGuard),
    S = [[X, Y], Ships, [SX, SY], Capacity,OnGuard].

% define the goal predicate
goalCheck(S) :-
    S = [[_, _], [], [_, _], _].
% define the possible actions
action(pickup(X, Y),S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    ships_loc(Ships),
    member([X, Y], Ships),
    OnGuard < Capacity .
action(drop,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard],
    station(X, Y),
    OnGuard > 0 .
action(left,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    X2 is X - 1,
    X2 >= 0 .
action(right,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    grid(N, _),
    X2 is X + 1,
    X2 < N .
action(up,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    grid(_, M),
    Y2 is Y - 1,
    Y2 >= 0,
action(down,S) :-
    [[X, Y], Ships, [SX, SY], Capacity,OnGuard]=S,
    grid(_, M),
    Y2 is Y + 1,
    Y2 < M .

% define the transition function

transition(S, pickup(X, Y), S2) :-
    action(pickup(X, Y),S),
    write("Pickup"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    select([X, Y], Ships, Ships2), % remove [X, Y] from Ships
    OnGuard2 is OnGuard + 1,
    S2 = [[X, Y], Ships2, Station, Capacity,OnGuard2].
transition(S, drop, S2) :-
    action(drop,S),
    write("drop"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    OnGuard2 is 0,
    S2 = [[X, Y], Ships, Station, Capacity,OnGuard2].
transition(S, left, S2) :-
    action(left,S),
    write("left"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    X2 is X - 1,
    X2>=0,
    S2 = [[X2, Y], Ships, Station, Capacity,OnGuard].
transition(S, right, S2) :-
    action(right,S),
    write("right"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    X2 is X + 1,
    grid(_,M),
    X2<M,
    S2 = [[X2, Y], Ships, Station, Capacity,OnGuard].
transition(S, up, S2) :-
    action(up,S),
    write("up"),
    [[X, Y], Ships, Station, Capacity,OnGuard] = S,
    Y2 is Y - 1,
    Y2>=0,
    S2 = [[X, Y2], Ships, Station, Capacity,OnGuard].
transition(S, down, S2) :-
    action(down,S),
    write("down"),
    [[X, Y],Ships, Station, Capacity,OnGuard]=S,
    Y2 is Y + 1,
    grid(N,_),
    Y2<N,
    S2 = [[X, Y2], Ships, Station, Capacity,OnGuard].

`

I tried running the goal(S) expecting a normal path but it keeps on doing right,left,right,left... indefinitely.

Here is the tracing when it does a left after doing a right and checks if this state has been visited before, it fails, which means this repeating state has not been visited before.

Exit: (17) transition([[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], left, [[0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0]) ? creep

Call: (17) lists:member([[0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [[[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0]) ? creep

Fail: (17) lists:member([[0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [[[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0]) ? creep

Redo: (16) path([[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], _214, [[[1, 1], [[2, 2], [1, 2]], [1, 1], 1, 0], [0, 1], [[2, 2], [1, 2]], [1, 1], 1, 0]) ? creep


问:
Html button on each side of a background picture

My html

```<code><head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
      rel="stylesheet"
      integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
      crossorigin="anonymous"
    />
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <nav class="navbar navbar-expand-lg bg-light navbar-light fixed-top bg-transparent">
      <div class="container">

        <a class="navbar-brand" href="#"></a>
          ELADY<span class="text-warning">Designs</span></a
        >
        <button
          class="navbar-toggler"
          type="button"
          data-bs-toggle="collapse"
          data-bs-target="#navbarSupportedContent"
          aria-controls="navbarSupportedContent"
          aria-expanded="false"
          aria-label="Toggle navigation"
        >
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav mb-2 mb-lg-0 ms-auto">
            <li class="nav-item">
              <a class="nav-link" href="#home">HOME</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="nails.html">About</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#contact">Contact</a>
            </li>
          </ul>
        </div>
      </div>
    </nav>

    <script
      src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
      crossorigin="anonymous"
    ></script>
  </body>
</html>

</code>```

```<code>* {
  font-family: montserrat;
}[![enter image description here](https://i.stack.imgur.com/d6IZs.png)](https://i.stack.imgur.com/d6IZs.png)
body {
  /* The image used */

  /* Full height */
  height: 100%;

  /* Center and scale the image nicely */
}
html {
  background-image: url(images/p4.jpeg);
  background-position: center;
  background-repeat: no-repeat;
  margin-top: 400px;
  background-size: 1000px 1000px;
  background-color: #f0f0f0 Gray94;
}

</code>```

here is my css I'm trying to add a larg button on each side of the my background picture without distoring my image
here is my page. Need help please and thank you

tried couple technique but they all distored my backroung image. none of them worked so far
here is my css I'm trying to add a larg button on each side of the my background picture without distoring my image
here is my page. Need help please and thank you

Body:
My html

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
      rel="stylesheet"
      integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
      crossorigin="anonymous"
    />
    <link rel="stylesheet" href="style.css">

          ELADYDesigns
        <button
          class="navbar-toggler"
          type="button"
          data-bs-toggle="collapse"
          data-bs-target="#navbarSupportedContent"
          aria-controls="navbarSupportedContent"
          aria-expanded="false"
          aria-label="Toggle navigation"
        >

        </button>

              HOME

              About

              Contact

* {
  font-family: montserrat;
}[![enter image description here](https://i.stack.imgur.com/d6IZs.png)](https://i.stack.imgur.com/d6IZs.png)
body {
  /* The image used */

  /* Full height */
  height: 100%;

  /* Center and scale the image nicely */
}
html {
  background-image: url(images/p4.jpeg);
  background-position: center;
  background-repeat: no-repeat;
  margin-top: 400px;
  background-size: 1000px 1000px;
  background-color: #f0f0f0 Gray94;
}

here is my css I'm trying to add a larg button on each side of the my background picture without distoring my image
here is my page. Need help please and thank you

tried couple technique but they all distored my backroung image. none of them worked so far
here is my css I'm trying to add a larg button on each side of the my background picture without distoring my image
here is my page. Need help please and thank you


问:
Compiler produce slower program although I gave information
In my knowledge, giving information(like using restrict, static on function, __builtin_expect(), etc) to compiler makes program better or equal. However, this works opposite to what was expected.

This is a function that changes the order of data storage in a matrix(packing method for matrix multiplication). Size of src matrix is m * n, and size of dst matrix is MAX_M * MAX_N. Case 2) line is disabled yet.

// pack.c

#define MAX_M 5000
#define MAX_N 5000
#define EPC 8  // number of Elements Per Cache line
               // also AVX-512 SIMD register can hold up to 8 double-precision floating points.

void pack(int m, int n, const double *restrict src, double *restrict dst) {
    int upper_n = (n + EPC - 1) / EPC;
    int remainder_n = n % EPC;
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < upper_n; ++j) {
            int len = j < upper_n - 1 || remainder_n == 0 ? EPC : remainder_n; // case 1)
            // int len = EPC;                                                  // case 2)
            for (int k = 0; k < len; ++k) {
                dst[i * EPC + j * EPC * MAX_M + k] = src[i * n + j * EPC + k];
            }
        }
    }
}
```
<p>I used the code below to measure performance of <code>pack</code> function. This code runs the <code>pack(5000, 5000, A, B)</code> 50 times and measures the average execution time. <code>A</code> and <code>B</code> are aligned with 64 bytes, and both sizes are 5000 * 5000.</p>
<pre class="lang-c prettyprint-override"><code>// main.c

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>

#define MAX_M 5000
#define MAX_N 5000

#define ITERATION 50

void pack(int m, int n, const double *restrict src, double *restrict dst);

int main(int argc, char **argv) {
    int m = 5000;
    int n = 5000;

    double *A;
    double *B;

    posix_memalign((void **)&A, 64, sizeof(double) * m * n);
    posix_memalign((void **)&B, 64, sizeof(double) * MAX_M * MAX_N);

    for (int i = 0; i < m * n; ++i) A[i] = i;

    double total_duration = 0;
    for (int i = 0; i < ITERATION; ++i) {
        double start_time = omp_get_wtime();
        pack(m, n, A, B);
        double end_time = omp_get_wtime();
        double duration = end_time - start_time;

        total_duration += duration;
    }
    printf("avg duration: %.8lf s\n", total_duration / ITERATION);

    free(A);
    free(B);

    return 0;
}
</code>```

It only calls pack with n=5000. It means remaninder_n in pack is always 0 and len is always 8. So I used case 2) instead of case 1) in pack function.

Then weird thing happens. Performance becomes worse. case 2) is slower than case 1). I gave information(len is always 8) to compiler, but compiler produced slow code.

```<code>avg duration: 0.05746786 s    <- case 1)
avg duration: 0.06110375 s    <- case 2)
</code>```

Is it possible that giving information to compiler makes program slower? Or is it just an issue with the compiler?

Target machine is Intel Xeon Phi 7250(Intel Knight Landing). Compile command is icc -o perf_test main.c pack.c -qopenmp -march=knl -O3. Assembly of pack function is like this except that mine uses movslq but the link uses movsxd.

I tested by modifying some codes. So I could figure out that 'case 1) is faster than case 2)' is a special case.

Case 2) becomes faster than case 1) if I

change compiler to gcc from icc

move pack function to main.c file

remove restrict keyword from pack function

remove -march=knl flag

Case 1) becomes slow as case 2) if I

change case 1)'s remainder_n to any integer literal

int len = j < upper_n - 1 || remainder_n == 0 ? EPC : 0;

or

int len = j < upper_n - 1 || remainder_n == 0 ? EPC : EPC;
```

In other words, case 2) is slower than case 1) if none of the above conditions are used. I don't know why compiler create slow program when these conditions are given.

Body:
In my knowledge, giving information(like using restrict, static on function, __builtin_expect(), etc) to compiler makes program better or equal. However, this works opposite to what was expected.

This is a function that changes the order of data storage in a matrix(packing method for matrix multiplication). Size of src matrix is m * n, and size of dst matrix is MAX_M * MAX_N. Case 2) line is disabled yet.

// pack.c

#define MAX_M 5000
#define MAX_N 5000
#define EPC 8  // number of Elements Per Cache line
               // also AVX-512 SIMD register can hold up to 8 double-precision floating points.

void pack(int m, int n, const double *restrict src, double *restrict dst) {
    int upper_n = (n + EPC - 1) / EPC;
    int remainder_n = n % EPC;
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < upper_n; ++j) {
            int len = j < upper_n - 1 || remainder_n == 0 ? EPC : remainder_n; // case 1)
            // int len = EPC;                                                  // case 2)
            for (int k = 0; k < len; ++k) {
                dst[i * EPC + j * EPC * MAX_M + k] = src[i * n + j * EPC + k];
            }
        }
    }
}

I used the code below to measure performance of pack function. This code runs the pack(5000, 5000, A, B) 50 times and measures the average execution time. A and B are aligned with 64 bytes, and both sizes are 5000 * 5000.

// main.c

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>

#define MAX_M 5000
#define MAX_N 5000

#define ITERATION 50

void pack(int m, int n, const double *restrict src, double *restrict dst);

int main(int argc, char **argv) {
    int m = 5000;
    int n = 5000;

    double *A;
    double *B;

    posix_memalign((void **)&A, 64, sizeof(double) * m * n);
    posix_memalign((void **)&B, 64, sizeof(double) * MAX_M * MAX_N);

    for (int i = 0; i < m * n; ++i) A[i] = i;

    double total_duration = 0;
    for (int i = 0; i < ITERATION; ++i) {
        double start_time = omp_get_wtime();
        pack(m, n, A, B);
        double end_time = omp_get_wtime();
        double duration = end_time - start_time;

        total_duration += duration;
    }
    printf("avg duration: %.8lf s\n", total_duration / ITERATION);

    free(A);
    free(B);

    return 0;
}

It only calls pack with n=5000. It means remaninder_n in pack is always 0 and len is always 8. So I used case 2) instead of case 1) in pack function.

Then weird thing happens. Performance becomes worse. case 2) is slower than case 1). I gave information(len is always 8) to compiler, but compiler produced slow code.

avg duration: 0.05746786 s    <- case 1)
avg duration: 0.06110375 s    <- case 2)

Is it possible that giving information to compiler makes program slower? Or is it just an issue with the compiler?

Target machine is Intel Xeon Phi 7250(Intel Knight Landing). Compile command is icc -o perf_test main.c pack.c -qopenmp -march=knl -O3. Assembly of pack function is like this except that mine uses movslq but the link uses movsxd.

I tested by modifying some codes. So I could figure out that 'case 1) is faster than case 2)' is a special case.

Case 2) becomes faster than case 1) if I

change compiler to gcc from icc

move pack function to main.c file

remove restrict keyword from pack function

remove -march=knl flag

Case 1) becomes slow as case 2) if I

change case 1)'s remainder_n to any integer literal

int len = j < upper_n - 1 || remainder_n == 0 ? EPC : 0;

or

int len = j < upper_n - 1 || remainder_n == 0 ? EPC : EPC;

In other words, case 2) is slower than case 1) if none of the above conditions are used. I don't know why compiler create slow program when these conditions are given.


问:
AWS amplify push/pull error: "error pulling the backend environment dev"
I am trying to configure my react native app to work with aws amplify. I installed aws and configured the amplify cli. I ran the following commands:

amplify configure
amplify init
amplify add api

```<code>"Authorization modes: API key (default, expiration time: 7 days from now)
 Conflict detection (required for DataStore): Disabled"
</code>```

I do get an error of
There was an error adding the API resource.

But when I perform amplify status, it shows that my api has been added.

```<code>┌──────────┬────────────────┬───────────┬───────────────────┐
│ Category │ Resource name  │ Operation │ Provider plugin   │
├──────────┼────────────────┼───────────┼───────────────────┤
│ Api      │ calorieexpoapp │ Create    │ awscloudformation │

</code>```

Then I get an error when I amplify push
Error:

```<code>- Fetching updates to backend environment: dev from the cloud.
× There was an error pulling the backend environment dev.
 The specified key does not exist.

</code>```

So from my aws console in the browswer, I see that my app has been created and linked to the cloud. But no apis have been added according to the aws console.

Body:
I am trying to configure my react native app to work with aws amplify. I installed aws and configured the amplify cli. I ran the following commands:

amplify configure
amplify init
amplify add api

"Authorization modes: API key (default, expiration time: 7 days from now)
 Conflict detection (required for DataStore): Disabled"

I do get an error of
There was an error adding the API resource.

But when I perform amplify status, it shows that my api has been added.

┌──────────┬────────────────┬───────────┬───────────────────┐
│ Category │ Resource name  │ Operation │ Provider plugin   │
├──────────┼────────────────┼───────────┼───────────────────┤
│ Api      │ calorieexpoapp │ Create    │ awscloudformation │

Then I get an error when I amplify push
Error:

- Fetching updates to backend environment: dev from the cloud.
× There was an error pulling the backend environment dev.
 The specified key does not exist.

So from my aws console in the browswer, I see that my app has been created and linked to the cloud. But no apis have been added according to the aws console.


问:
Receiving error: Exception thrown at 0x009B1396 in Project4.exe: 0xC0000005: Access violation reading location 0x009BA000. on my assembly language
I am working on a low level programming project & am having trouble getting past this error when debugging: "Exception thrown at 0x009B1396 in Project4.exe: 0xC0000005: Access violation reading location 0x009BA000." which occurs on line 47. I am trying to make matrices given the two user inputted values. Any & All help would be appreciated!
Code:

```<code>INCLUDE <C:\Irvine\Irvine32.inc>
INCLUDELIB <C:\Irvine\Irvine32.lib>

.stack 4096

ExitProcess PROTO, dwExitCode:DWORD

.data
FirstDimension dword ?
SecondDimension dword ?

prompt1 BYTE "Please enter first positive integer 1 - 9: ", 0
prompt2 BYTE "Please enter second positive integer 1 - 9: ", 0

m1 dword ?
m2 dword ?
mp dword ?

ranNum dword ?

.code
main PROC

mov edx, OFFSET prompt1                 ; part a
call WriteString                   ; user input
mov edx, OFFSET firstDimension
call ReadInt

mov edx, OFFSET prompt2                 ; part b
call WriteString                   ; user input
mov edx, OFFSET secondDimension
call ReadInt

mov eax, FirstDimension                          ; part c
mul SecondDimension
mov eax, OFFSET m1

mov eax, 15                   ; part d
call RandomRange         ; retrieving random number 0 - 15
mov ranNum, eax          ; storing it in eax
mov eax, (black * 16) + red        ; bonus points
call SetTextColor
call DumpMem             ; part e

mov ebx, SecondDimension      ; part f ** error occurs**
mul FirstDimension
mov ebx, OFFSET m2

mov ebx, 15              ; part g
call RandomRange         ; retrieving random number 1 - 15
mov ranNum, ebx          ; storing it in ebx
mov ebx, (black * 16) + blue       ; bonus points
call SetTextColor
call DumpMem            ; part h

mov eax, OFFSET mp            ; part i
mov eax, FirstDimension
mul FirstDimension
mov eax, 0              ; part j
mov eax, (black * 16) + green      ; bonus points
call SetTextColor
call DumpMem            ; part k

mov eax, OFFSET mp       ; part l
mov eax, SecondDimension
mul firstDimension
add ebx, eax
call WriteStackFrame          ; part m

Invoke ExitProcess, 0
main endp
end main
</code>```

I tried pushing & popping the registers but I do not think I was doing it correctly if that is what I should do. I am not very experienced in this field & am clearly struggle.

Body:
I am working on a low level programming project & am having trouble getting past this error when debugging: "Exception thrown at 0x009B1396 in Project4.exe: 0xC0000005: Access violation reading location 0x009BA000." which occurs on line 47. I am trying to make matrices given the two user inputted values. Any & All help would be appreciated!
Code:

INCLUDE <C:\Irvine\Irvine32.inc>
INCLUDELIB <C:\Irvine\Irvine32.lib>

.stack 4096

ExitProcess PROTO, dwExitCode:DWORD

.data
FirstDimension dword ?
SecondDimension dword ?

prompt1 BYTE "Please enter first positive integer 1 - 9: ", 0
prompt2 BYTE "Please enter second positive integer 1 - 9: ", 0

m1 dword ?
m2 dword ?
mp dword ?

ranNum dword ?

.code
main PROC

mov edx, OFFSET prompt1                 ; part a
call WriteString                   ; user input
mov edx, OFFSET firstDimension
call ReadInt

mov edx, OFFSET prompt2                 ; part b
call WriteString                   ; user input
mov edx, OFFSET secondDimension
call ReadInt

mov eax, FirstDimension                          ; part c
mul SecondDimension
mov eax, OFFSET m1

mov eax, 15                   ; part d
call RandomRange         ; retrieving random number 0 - 15
mov ranNum, eax          ; storing it in eax
mov eax, (black * 16) + red        ; bonus points
call SetTextColor
call DumpMem             ; part e

mov ebx, SecondDimension      ; part f ** error occurs**
mul FirstDimension
mov ebx, OFFSET m2

mov ebx, 15              ; part g
call RandomRange         ; retrieving random number 1 - 15
mov ranNum, ebx          ; storing it in ebx
mov ebx, (black * 16) + blue       ; bonus points
call SetTextColor
call DumpMem            ; part h

mov eax, OFFSET mp            ; part i
mov eax, FirstDimension
mul FirstDimension
mov eax, 0              ; part j
mov eax, (black * 16) + green      ; bonus points
call SetTextColor
call DumpMem            ; part k

mov eax, OFFSET mp       ; part l
mov eax, SecondDimension
mul firstDimension
add ebx, eax
call WriteStackFrame          ; part m

Invoke ExitProcess, 0
main endp
end main

I tried pushing & popping the registers but I do not think I was doing it correctly if that is what I should do. I am not very experienced in this field & am clearly struggle.


问:
How to convert a running SQL Server code into a stored procedure with the proper parameters to pass to the stored procedure
If I run this in a query from SQL Server that works:

```<code>DECLARE @Point geography;
DECLARE @Polygon geography;

-- Set the values for the point and polygon
SET @Point = geography::STPointFromText('POINT(-71.56 44.50)', 4326);
SET @Polygon = geography::STPolyFromText('POLYGON((-72.69449829101593 45.668674540806705,-72.10535644531258 45.77413811271179,-71.64118408203115 45.59665341601985,-72.96692970976399 45.28088342792443,-72.69449829101593 45.668674540806705))', 4326);

-- Determine if the point is within the polygon
IF @Polygon.STContains(@Point) = 1
BEGIN
    PRINT 'The point is within the polygon';
END
ELSE
BEGIN
    PRINT 'The point is not within the polygon';
END
</code>```

Now if I am trying to create a stored procedure, but it's always saying the data conversion is not correct

Here is my stored procedure:

```<code>ALTER PROCEDURE [NSGIS].CheckPointInPolygon
    @PlanePoint NVARCHAR(255),
    @PolygonInfos NVARCHAR(4000)
AS
BEGIN
    DECLARE @Point GEOGRAPHY;
    DECLARE @Polygon GEOGRAPHY;

    -- Set the values for the point and polygon
    SET @Point = geography::STPointFromText('POINT(@PlanePoint)', 4326);
    SET @Polygon = geography::STPolyFromText('POLYGON((@PolygonInfos))', 4326);

    -- Determine if the point is within the polygon
    IF @Polygon.STContains(@Point) = 1
    BEGIN
        PRINT 'The point is within the polygon';
    END
    ELSE
    BEGIN
        PRINT 'The point is not within the polygon';
    END
END
</code>```

Now to access the stored procedure, I use this code:

```<code>DECLARE @return_value INT

EXEC    @return_value = [NSGIS].[CheckPointInPolygon]
        @PlanePoint = 'POINT(-71.99 45.33)',
        @PolygonInfos = '-122.34900 47.65100, -122.23700 47.65100, -122.23700 47.73900'

SELECT  @return_value AS "Return Value"
</code>```

What is wrong? Sorry I am not able to figure it out.

Many thanks for your help

Mike

Body:
If I run this in a query from SQL Server that works:

DECLARE @Point geography;
DECLARE @Polygon geography;

-- Set the values for the point and polygon
SET @Point = geography::STPointFromText('POINT(-71.56 44.50)', 4326);
SET @Polygon = geography::STPolyFromText('POLYGON((-72.69449829101593 45.668674540806705,-72.10535644531258 45.77413811271179,-71.64118408203115 45.59665341601985,-72.96692970976399 45.28088342792443,-72.69449829101593 45.668674540806705))', 4326);

-- Determine if the point is within the polygon
IF @Polygon.STContains(@Point) = 1
BEGIN
    PRINT 'The point is within the polygon';
END
ELSE
BEGIN
    PRINT 'The point is not within the polygon';
END

Now if I am trying to create a stored procedure, but it's always saying the data conversion is not correct

Here is my stored procedure:

ALTER PROCEDURE [NSGIS].CheckPointInPolygon
    @PlanePoint NVARCHAR(255),
    @PolygonInfos NVARCHAR(4000)
AS
BEGIN
    DECLARE @Point GEOGRAPHY;
    DECLARE @Polygon GEOGRAPHY;

    -- Set the values for the point and polygon
    SET @Point = geography::STPointFromText('POINT(@PlanePoint)', 4326);
    SET @Polygon = geography::STPolyFromText('POLYGON((@PolygonInfos))', 4326);

    -- Determine if the point is within the polygon
    IF @Polygon.STContains(@Point) = 1
    BEGIN
        PRINT 'The point is within the polygon';
    END
    ELSE
    BEGIN
        PRINT 'The point is not within the polygon';
    END
END

Now to access the stored procedure, I use this code:

DECLARE @return_value INT

EXEC    @return_value = [NSGIS].[CheckPointInPolygon]
        @PlanePoint = 'POINT(-71.99 45.33)',
        @PolygonInfos = '-122.34900 47.65100, -122.23700 47.65100, -122.23700 47.73900'

SELECT  @return_value AS "Return Value"

What is wrong? Sorry I am not able to figure it out.

Many thanks for your help

Mike


问:
How to tell if a Pandas data frame column is a string object or date object?
I use df.dtypes to list the data types for each of the column in my data frame. However, for non-primitive types like string and date types, the listed types are simply 'object'. Is there a way to tell if my column is a string or date column?


问:
Django +4.1: How to show in templates the message from violation_error_message in UniqueConstraint
I'm lost...

In my model in models.py I have

```<code>class Project(models.Model):

    # fields
    # save
    # etc

    class Meta:
        constraints = [
            UniqueConstraint(
                 fields=['name', 'owner'],
                 name='unique_name',
                 violation_error_message='my_error_message'
            )
        ]
</code>```

In my class in views.py I have

```<code>class CreateProject(LoginRequiredMixin, CreateView):
    form_class = ProjectForm
    model = Project

    def form_valid(self, form):
            return super().form_valid(form)
</code>```

In forms.py I have

```<code>class ProjectForm(forms.ModelForm):
    class Meta:
        model = Project
        fields = ("name", "description")
</code>```

How do I display in templates, the message in violation_error_message when the constraint is not fulfilled?

Body:
I'm lost...

In my model in models.py I have

class Project(models.Model):

    # fields
    # save
    # etc

    class Meta:
        constraints = [
            UniqueConstraint(
                 fields=['name', 'owner'],
                 name='unique_name',
                 violation_error_message='my_error_message'
            )
        ]

In my class in views.py I have

class CreateProject(LoginRequiredMixin, CreateView):
    form_class = ProjectForm
    model = Project

    def form_valid(self, form):
            return super().form_valid(form)

In forms.py I have

class ProjectForm(forms.ModelForm):
    class Meta:
        model = Project
        fields = ("name", "description")

How do I display in templates, the message in violation_error_message when the constraint is not fulfilled?


问:
My android emulator is running MAUI app extremely slowly
Spent all weekend updating Visual Studio to 17.4.3. Removed my old Android Simulator -- had to clear up space for the upgrade because my 128GB SSD got filed up.

Anyways, trying out the Maui framework, run the new Welcome app on Android Simulator (pixel 5 api 31). It takes a whopping full minute just for the emulator to boot up, and then another 1.5 minutes to deploy and finally see the welcome screen.

I do not think this is normal. I spent all night trying to enable hardware acceleration on the emulator, but I believe the HAXM options was always turned on.

Any tip for how I can tune up my android emulator performance? It was really fast before my MAUI upgrade when I used good-old Xamarin.


问:
Optimization of decay rate for adstock using Grid Search
I am working on MMM, I have a small doubt on how to optimize decay rate lambda in adstock using Grid search? Please share a sample code.

I am confused about this, How can we define a model for it.


问:
My service account as guest user in google shared drive. My issue is ,guest not able to add new folder in the gdrive
My service account as guest user in google shared drive. My issue is ,guest not able to add  new folder in the gdrive.

I set the user as guest. He can't creat a new folder under the drive location


问:
Running socket.io on A2hosting VPS hosting
A2hosting seems not pass socket = io("https://localhost:45678") to the server.

I have done the following and check below article but still can't figure out.

Running socket.io on Shared Hosting

ssh into the server

go to /public_html directory

npm install socket.io and go to node_modules directory

edit server.js below and node server.js

```<code>const { createServer } = require("http");
const { Server } = require("socket.io");

const httpServer = createServer();
const io = new Server(httpServer, { cors: {
    origin: '*',
  } });

io.on("connection", (socket) => {
  console.log("connection")
});

httpServer.listen(45678);

5. revise the .htaccess file in the public_html directory with
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^$ http://127.0.0.1:45678/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:45678/$1 [P,L]
</IfModule>

6. from the client side, just create php file and excute below
const socket = io("https://localhost:45678");

but the console said "Failed to load resource", it seems the request do not go to server.

7. if item 6 is changed to socket = io("https://muazkhan.com:9001/") it is ok.

I have ask A2hosting but they can check the port is open but not able to fix the problem.
Please help me. Thanks a lot.
</code>```

Body:
A2hosting seems not pass socket = io("https://localhost:45678") to the server.

I have done the following and check below article but still can't figure out.

Running socket.io on Shared Hosting

ssh into the server

go to /public_html directory

npm install socket.io and go to node_modules directory

edit server.js below and node server.js

const { createServer } = require("http");
const { Server } = require("socket.io");

const httpServer = createServer();
const io = new Server(httpServer, { cors: {
    origin: '*',
  } });

io.on("connection", (socket) => {
  console.log("connection")
});

httpServer.listen(45678);

5. revise the .htaccess file in the public_html directory with
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^$ http://127.0.0.1:45678/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:45678/$1 [P,L]
</IfModule>

6. from the client side, just create php file and excute below
const socket = io("https://localhost:45678");

but the console said "Failed to load resource", it seems the request do not go to server.

7. if item 6 is changed to socket = io("https://muazkhan.com:9001/") it is ok.

I have ask A2hosting but they can check the port is open but not able to fix the problem.
Please help me. Thanks a lot.


问:
Pass Entity Id to GetDefaultPricelevel Message
I am extending the default price level selection in a Dynamics 365 Sales implementation. For that I need to register a custom plugin to the sdk message GetDefaultPriceLevel. This message gets executed everytime an Order, Quote or Opportunity is created so the custom code returns the default price level. I created the plugin and I registed the plugin to the correct message and it is being properly executed. The issue is that as part of the plugin context I don't receive the entity id. I need the entity id to retrieve the account (customer) and subsequently the price level tied to that account so the opportunity price level gets assigned with that value. Is there a way to pass this value?</p>


问:
HTML Email Signature Compatibility
I wanted to know how to make HTML Email Signature compatible with popular mail clients like Gmail, Apple Mail, Outlook, etc. ?

Thank You ^_^ .

Well, I searched the web about this topic but unfortunately couldn't find anything useful.
Some were using email signature generator, some were using divs but I was taught to use only tables.
I am very much confused.

Any kind of help will be really really appreciated.

Thank You again & have a nice day _ .

Title: HTML Email Signature Compatibility


问:
The buying selling volume works perfect when seen in Daily timeframe, however it is not showing correct numbers in lower time frame
So, I am creating an Buy/sell Volume indicator. It shows total buying and selling volume of the script. The indicator was working perfect and now I want to add a table that shows daily buying and selling volume when I am seeing lower time frame i.e, 1 min, 5 min and 10 min. I wrote the code and table shows correct value of volume when looking at daily time-frame, but when I change to lower-time-frame the numbers are not correct. I don't know if it is calculation problem or coding problem. If any one can help me, I will be very Thankfull.

I have attached image of what it is showing on daily time-frame. In image the table shows daily buying and selling volume and the screenshot is taken on daily time-frame.enter image description here

```<code>//@version=4

study("BS",format=format.price, precision=0)

buyVolume = iff( (high==low), 0, volume*(close-low)/(high-low))

plot(volume, style=plot.style_columns, color=color.red, title="SELL V")
plot(buyVolume, style=plot.style_columns, color=color.teal, title="BUY V")

volD = security(syminfo.tickerid, "D", volume)
buyVolume1 = iff( (high==low), 0, volD*(close-low)/(high-low))
sellvolume = volD - buyVolume1
string i_positionr = position.bottom_right

var tblr = table.new(i_positionr, 3, 3, frame_color=#151715, frame_width=1, border_width=2,
border_color=color.new(color.white, 100))

if barstate.islast
    table.cell(tblr, 0, 1, 'Buy Volume',     text_halign = text.align_center, bgcolor =
color.green, text_color = color.white, text_size = size.normal)
    table.cell(tblr, 1, 1, 'Sell Volume',     text_halign = text.align_center, bgcolor =
color.red, text_color = color.white, text_size = size.normal)

table.cell(tblr, 0, 2, tostring(buyVolume1,format.price)   , text_halign = text.align_center,
   bgcolor = color.green, text_color = color.white, text_size = size.normal)
table.cell(tblr, 1, 2, tostring(sellvolume,format.price) ,   text_halign = text.align_center,
   bgcolor = color.red, text_color = color.white, text_size = size.normal)
</code>```

Body:
So, I am creating an Buy/sell Volume indicator. It shows total buying and selling volume of the script. The indicator was working perfect and now I want to add a table that shows daily buying and selling volume when I am seeing lower time frame i.e, 1 min, 5 min and 10 min. I wrote the code and table shows correct value of volume when looking at daily time-frame, but when I change to lower-time-frame the numbers are not correct. I don't know if it is calculation problem or coding problem. If any one can help me, I will be very Thankfull.

I have attached image of what it is showing on daily time-frame. In image the table shows daily buying and selling volume and the screenshot is taken on daily time-frame.enter image description here

//@version=4

study("BS",format=format.price, precision=0)

buyVolume = iff( (high==low), 0, volume*(close-low)/(high-low))

plot(volume, style=plot.style_columns, color=color.red, title="SELL V")
plot(buyVolume, style=plot.style_columns, color=color.teal, title="BUY V")

volD = security(syminfo.tickerid, "D", volume)
buyVolume1 = iff( (high==low), 0, volD*(close-low)/(high-low))
sellvolume = volD - buyVolume1
string i_positionr = position.bottom_right

var tblr = table.new(i_positionr, 3, 3, frame_color=#151715, frame_width=1, border_width=2,
border_color=color.new(color.white, 100))

if barstate.islast
    table.cell(tblr, 0, 1, 'Buy Volume',     text_halign = text.align_center, bgcolor =
color.green, text_color = color.white, text_size = size.normal)
    table.cell(tblr, 1, 1, 'Sell Volume',     text_halign = text.align_center, bgcolor =
color.red, text_color = color.white, text_size = size.normal)

table.cell(tblr, 0, 2, tostring(buyVolume1,format.price)   , text_halign = text.align_center,
   bgcolor = color.green, text_color = color.white, text_size = size.normal)
table.cell(tblr, 1, 2, tostring(sellvolume,format.price) ,   text_halign = text.align_center,
   bgcolor = color.red, text_color = color.white, text_size = size.normal)


问:
Display value from object in javascript
a person is an object
person: {
name: 'joe',
object: {
name: 'jay'
}
}

let value = 'object.name'

let array = value.split('.')
// ['object', 'name']

how can I make this into person['object']['name'] ?

Title: Display value from object in javascript