问:
Trying to run sklearn on a loop and store predictions in a dataframe
My problem

I've been working for some time on an ML algorithm which predicts redshifts of galaxies based on magnitudes. An MWE here:

https://pastebin.com/G19Qx2Yj

The MWE is a self-contained version of my full code, which is more complex, but this is as close as I can get it to the actual script.

In lines 120-122, I add the predictions as a column to X_test. This works as intended.

What I'm trying to achieve

On each iteration through the loop, I'm trying to add another column to X_test, labelled X_test1, X_test2, X_test3, etc. so I can calculate the average of all of them.

What I've tried

I've tried using

X_test['z_spec'] = y_test
X_test['z_phot'+str(i)] = y_pred

but this ends up just recording y_pred from the final run.

I've also tried moving train_test_split to line 102, before the loop, so that I'm not reinitialising X_test on each iteration, but this returns an error:

```<code>  ValueError: Input 0 of layer "sequential_15" is incompatible with the layer: expected shape=(None, 5), found shape=(None, 8)
</code>```

I've tried making a new dataframe to store the predictions:

```<code>z_df = pd.DataFrame([])
z_df ['z_spec'] = y_test
z_df ['z_phot'+str(i)] = y_pred
z_df ['delta_z'] = z_df ['z_spec'] - z_df ['z_phot']
</code>```

but this records only the final y_pred.

(Because my data will contain NaNs, I can't put z_df = pd.DataFrame([]) before the loop. -- Ignore)

How can I achieve this?

Body:
My problem

I've been working for some time on an ML algorithm which predicts redshifts of galaxies based on magnitudes. An MWE here:

https://pastebin.com/G19Qx2Yj

The MWE is a self-contained version of my full code, which is more complex, but this is as close as I can get it to the actual script.

In lines 120-122, I add the predictions as a column to X_test. This works as intended.

What I'm trying to achieve

On each iteration through the loop, I'm trying to add another column to X_test, labelled X_test1, X_test2, X_test3, etc. so I can calculate the average of all of them.

What I've tried

I've tried using

X_test['z_spec'] = y_test
X_test['z_phot'+str(i)] = y_pred

but this ends up just recording y_pred from the final run.

I've also tried moving train_test_split to line 102, before the loop, so that I'm not reinitialising X_test on each iteration, but this returns an error:

  ValueError: Input 0 of layer "sequential_15" is incompatible with the layer: expected shape=(None, 5), found shape=(None, 8)

I've tried making a new dataframe to store the predictions:

z_df = pd.DataFrame([])
z_df ['z_spec'] = y_test
z_df ['z_phot'+str(i)] = y_pred
z_df ['delta_z'] = z_df ['z_spec'] - z_df ['z_phot']

but this records only the final y_pred.

(Because my data will contain NaNs, I can't put z_df = pd.DataFrame([]) before the loop. -- Ignore)

How can I achieve this?


来源: stackexchange

问:
Getting text inside ::before in div tag with html.parser
I have a html page and I need to get the text inside div with 'extra class' ::before with using html.parser. How do I get this?

```<code><div class='price'>
    ::before
    "1051"
</div>
</code>```

Here is my code that shows me an empty value.

```<code>class ParserShop(HTMLParser):

    price_is_found = is_price_field = None
    _product_info = {}

    def handle_starttag(self, tag, attrs):
        if (not self.price_is_found and
                'class' not in self._product_info and
                 tag == 'div'):
            attrs = dict(attrs)
            if attrs.get('class') == 'price':
                self.is_price_field = True

    def handle_data(self, data):
         if (not self.price_is_found and
                self.is_price_field and
                'class' not in self._product_info):
            self._product_info['price'] = data.strip()
            self.price_is_found = True
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a html page and I need to get the text inside div with 'extra class' ::before with using html.parser. How do I get this?

    ::before
    "1051"

Here is my code that shows me an empty value.

class ParserShop(HTMLParser):

    price_is_found = is_price_field = None
    _product_info = {}

    def handle_starttag(self, tag, attrs):
        if (not self.price_is_found and
                'class' not in self._product_info and
                 tag == 'div'):
            attrs = dict(attrs)
            if attrs.get('class') == 'price':
                self.is_price_field = True

    def handle_data(self, data):
         if (not self.price_is_found and
                self.is_price_field and
                'class' not in self._product_info):
            self._product_info['price'] = data.strip()
            self.price_is_found = True


问:
Multivariate Gaussian Mixture Model
By using python, I want to fit Multivariate gaussian function to Multivariate Gaussian Mixture Model. What should I insert instead of places of three $ marks ?
Note: There is missing for loop which will generate 3 Multivariate gaussian distributions.
####################################################

```<code>##########################
#Request libraries
##########################
import numpy as np
from matplotlib import cm
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from mpl_toolkits.mplot3d import Axes3D
import tensorflow as tf
import tensorflow_probability as tfp

T = 1
samplingFrequency = T/40
t = np.arange(-2.*T, 2.*T, samplingFrequency )
# Our 2-dimensional distribution will be over variables x and y
x,y = t,t
x,y= np.meshgrid(x, y)

# Mean vector and covariance matrix (pulseWidth or sigma)
mu1 = np.array([0., 0.])                               #Mean vector for Gaussian pulse only
GPulseWidth = np.array([[ 1. , -0.5], [-0.5,  1.]])    #GPulseWidth just for 2D Gaussian distribution
# Pack x and y into a single 3-dimensional array
pos = np.empty(x.shape + (2,))
pos[:, :, 0] = x
pos[:, :, 1] = y
def Multivariate_gaussian(pos, mu1, GPulseWidth,Io):
    n = mu1.shape[0]
    pulseWidth_det = np.linalg.det(GPulseWidth)
    pulseWidth_inv = np.linalg.inv(GPulseWidth)  # linalg.inv(a) Compute the (multiplicative) inverse of a matrix
    N = np.sqrt((2*np.pi)**n * pulseWidth_det)/ Io
        # This einsum call calculates (x-mu1)T.Sigma-1.(x-mu1) in a vectorized
        # way across all the input variables.
    fac = np.einsum('...k,kl,...l->...', pos-mu1, pulseWidth_inv, pos-mu1)
    return np.exp(-fac / 2) / N

# there is missing for loop whih will generate Multivariate_gaussian distributuins
# Multivariate Gaussian Mixture Model
##########################
tfd = tfp.distributions

mvgmm = tfd.MixtureSameFamily(
    mixture_distribution=tfd.Categorical(probs= $ ), # replace $ by what ?
    components_distribution=tfd.MultivariateNormalDiag(
        loc=$,          # replace $ by what ?
        scale_diag= $ ) # replace $ by what ?

)data = np.stack((x.flatten(), y.flatten()), axis=1)
prob = mvgmm.prob(data).numpy()
plt.contour(x, y, prob.reshape((160, 160)));
surf=axs[1].plot_surface(xx, yy, prob.reshape((160,160)), label = 'z location ' + str(zStep), cmap='plasma',linewidth=1, antialiased=False,alpha=0.5)
</code>```

Title: Multivariate Gaussian Mixture Model

Body:
By using python, I want to fit Multivariate gaussian function to Multivariate Gaussian Mixture Model. What should I insert instead of places of three $ marks ?
Note: There is missing for loop which will generate 3 Multivariate gaussian distributions.
####################################################

##########################
#Request libraries
##########################
import numpy as np
from matplotlib import cm
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from mpl_toolkits.mplot3d import Axes3D
import tensorflow as tf
import tensorflow_probability as tfp

T = 1
samplingFrequency = T/40
t = np.arange(-2.*T, 2.*T, samplingFrequency )
# Our 2-dimensional distribution will be over variables x and y
x,y = t,t
x,y= np.meshgrid(x, y)

# Mean vector and covariance matrix (pulseWidth or sigma)
mu1 = np.array([0., 0.])                               #Mean vector for Gaussian pulse only
GPulseWidth = np.array([[ 1. , -0.5], [-0.5,  1.]])    #GPulseWidth just for 2D Gaussian distribution
# Pack x and y into a single 3-dimensional array
pos = np.empty(x.shape + (2,))
pos[:, :, 0] = x
pos[:, :, 1] = y
def Multivariate_gaussian(pos, mu1, GPulseWidth,Io):
    n = mu1.shape[0]
    pulseWidth_det = np.linalg.det(GPulseWidth)
    pulseWidth_inv = np.linalg.inv(GPulseWidth)  # linalg.inv(a) Compute the (multiplicative) inverse of a matrix
    N = np.sqrt((2*np.pi)**n * pulseWidth_det)/ Io
        # This einsum call calculates (x-mu1)T.Sigma-1.(x-mu1) in a vectorized
        # way across all the input variables.
    fac = np.einsum('...k,kl,...l->...', pos-mu1, pulseWidth_inv, pos-mu1)
    return np.exp(-fac / 2) / N

# there is missing for loop whih will generate Multivariate_gaussian distributuins
# Multivariate Gaussian Mixture Model
##########################
tfd = tfp.distributions

mvgmm = tfd.MixtureSameFamily(
    mixture_distribution=tfd.Categorical(probs= $ ), # replace $ by what ?
    components_distribution=tfd.MultivariateNormalDiag(
        loc=$,          # replace $ by what ?
        scale_diag= $ ) # replace $ by what ?

)data = np.stack((x.flatten(), y.flatten()), axis=1)
prob = mvgmm.prob(data).numpy()
plt.contour(x, y, prob.reshape((160, 160)));
surf=axs[1].plot_surface(xx, yy, prob.reshape((160,160)), label = 'z location ' + str(zStep), cmap='plasma',linewidth=1, antialiased=False,alpha=0.5)


问:
How to remove or ignore a string in python
I'm trying to ignore specific strings in python so that they don't get added to my list, for example: not including the string "front". I tried using names.remove("front") in the initial if loop, but it won't work. Any ideas how to achieve this?</p>
```<code>import maya.cmds as mc
outliner = mc.ls(type='transform')
lists=[]
names=[]
for i in outliner:
    if not '|' in i:
        names.append(i)

    if '|' in i:
        lists.append(i.split('|'))

for i in lists:
    names.append(i[len(i)-1])

projPath = mc.workspace( q=True, dir=True )+'Outliner.txt'
print(projPath)

f = open(projPath,'w')
f.write('{0:*^50}'.format('Outliner structure')+'\n')
for i in outliner:
    #print(i)
    f.write(i+'\n')
f.close()
</code>```

Body:
I'm trying to ignore specific strings in python so that they don't get added to my list, for example: not including the string "front". I tried using names.remove("front") in the initial if loop, but it won't work. Any ideas how to achieve this?

import maya.cmds as mc
outliner = mc.ls(type='transform')
lists=[]
names=[]
for i in outliner:
    if not '|' in i:
        names.append(i)

    if '|' in i:
        lists.append(i.split('|'))

for i in lists:
    names.append(i[len(i)-1])

projPath = mc.workspace( q=True, dir=True )+'Outliner.txt'
print(projPath)

f = open(projPath,'w')
f.write('{0:*^50}'.format('Outliner structure')+'\n')
for i in outliner:
    #print(i)
    f.write(i+'\n')
f.close()


问:
Wrong textarea.value while making ajax calls to server side
I have a text area with  id "text" and I am toggling the text area to appear on the screen with a click event on some div and I have 30 such divs.
Initially , I'm assigning the textarea.value with result of ajax call to my fetch api which fetches the data from the mongo on the server side based on an unique id.

Sometimes , when I'm making the ajax call to my  update api in my backend , the textarea.value I'm sending as data to this ajax call is not the same as the updated text of the text area.

//client side
// called when any of the divs is clicked
$(".radius").on("click", function(event) {
//extracting the id from the class and using this id as the id of my data for my mongo
var st=event.target.classList[1].substring(0,7);
var num=parseInt(event.target.classList[1].substring(7));
var toadd="close-button"+num;
//console.log(num+"modal")
closeButton.classList.add(toadd);
$.ajax({type: "POST",
        url: "/fetch",
        async: true,
        data:  JSON.stringify({
            id: num,
        }),
        dataType: 'json',
        contentType: 'application/json; charset=utf-8',
        success:function(result) {
          input.value=result.text;
        },
        error:function(result) {
           console.log("error")
        }
});
modal.classList.toggle("show-modal");
});
// called when textarea is closed
function toggleModal1(event) {
    var s1=closeButton.classList[closeButton.classList.length-1];
    var st=s1.substring(12);
    closeButton.classList.remove(s1);
    var num=parseInt(st);
   // event.preventDefault();
   console.log(input.value)
    $.ajax({type: "POST",
        url: "/update",

        data:  JSON.stringify({
            id:num,
            text:input.value,
  //input is my textarea
        }),
        dataType: 'json',
        contentType: 'application/json; charset=utf-8',
        success:function(result) {

        },
        error:function(result) {
           console.log("error")
        }
    });
    modal.classList.toggle("show-modal");
}
```
```//server side
app.post("/fetch",function(req,res)
{
      //console.log(req.body);
      // var id1=req.body.id;
      const findInDB= Fruit.findOne({id:req.body.id},function (err, docs) {
        console.log(docs);
             res.send({text:docs.text});
       });

});
app.post("/update",function(req,res)
{
  Fruit.updateOne({id:req.body.id},
    {text:req.body.text}, function (err, docs) {
    if (err){
        console.log(err)
    }
    else{
       console.log("Updated Docs : ", docs);
    }
});
```

Body:
I have a text area with  id "text" and I am toggling the text area to appear on the screen with a click event on some div and I have 30 such divs.
Initially , I'm assigning the textarea.value with result of ajax call to my fetch api which fetches the data from the mongo on the server side based on an unique id.

Sometimes , when I'm making the ajax call to my  update api in my backend , the textarea.value I'm sending as data to this ajax call is not the same as the updated text of the text area.

//client side
// called when any of the divs is clicked
$(".radius").on("click", function(event) {
//extracting the id from the class and using this id as the id of my data for my mongo
var st=event.target.classList[1].substring(0,7);
var num=parseInt(event.target.classList[1].substring(7));
var toadd="close-button"+num;
//console.log(num+"modal")
closeButton.classList.add(toadd);
$.ajax({type: "POST",
        url: "/fetch",
        async: true,
        data:  JSON.stringify({
            id: num,
        }),
        dataType: 'json',
        contentType: 'application/json; charset=utf-8',
        success:function(result) {
          input.value=result.text;
        },
        error:function(result) {
           console.log("error")
        }
});
modal.classList.toggle("show-modal");
});
// called when textarea is closed
function toggleModal1(event) {
    var s1=closeButton.classList[closeButton.classList.length-1];
    var st=s1.substring(12);
    closeButton.classList.remove(s1);
    var num=parseInt(st);
   // event.preventDefault();
   console.log(input.value)
    $.ajax({type: "POST",
        url: "/update",

        data:  JSON.stringify({
            id:num,
            text:input.value,
  //input is my textarea
        }),
        dataType: 'json',
        contentType: 'application/json; charset=utf-8',
        success:function(result) {

        },
        error:function(result) {
           console.log("error")
        }
    });
    modal.classList.toggle("show-modal");
}

//server side
app.post("/fetch",function(req,res)
{
      //console.log(req.body);
      // var id1=req.body.id;
      const findInDB= Fruit.findOne({id:req.body.id},function (err, docs) {
        console.log(docs);
             res.send({text:docs.text});
       });

});
app.post("/update",function(req,res)
{
  Fruit.updateOne({id:req.body.id},
    {text:req.body.text}, function (err, docs) {
    if (err){
        console.log(err)
    }
    else{
       console.log("Updated Docs : ", docs);
    }
});


问:
Websocket connection fails in the browser, but works in Postman
I am trying to make my backend and frontend communicate trough web sockets using STOMP. It is very weird that I get 401(Unauthorized) status code when I try to connect from my browser, but 200(OK) when connecting from by Postman after login. It is important to mention that i keep my jwt in the sessionStorage on my browser and i build the Authorization Header with it and pass it to the stompClient connection.

Below is the client code in JS:

async function connect() {
    var socket = new SockJS("http://localhost:8080/api/websocket");
    let stompClient = Stomp.over(socket);
    const token = sessionStorage.getItem("jwtToken");
    const headers = {
      Authorization: "Bearer " + token,
    };
    const headersAuth = { headers };
    console.log(headersAuth);
    stompClient.connect({ headersAuth }, function (frame) {
      stompClient.subscribe("/topic/events", function (messageOutput) {
        const msg = JSON.parse(messageOutput.body);

        if (msg.id_user === sessionStorage.getItem("jwtToken")) {
          setMess(
            "for the client with id " +
              msg.id_user +
              " the max energy for device with ID " +
              msg.id_device +
              " has been EXCEDEED with " +
              msg.diferenta
          );
          setOpen(true);
        }
        console.log(msg.id_user);
      });
    });
  }
```


问:
power automate desktop - get any value from complicate XML
Please help me read this XML file with power automate desktop.
I never get any values!

I use 'read XML from file' to get the data.
But I cannot get any value (if it is not throwing errors, it returns no data).

Here is a link to the file:
copy.xml

Thank you in advance.


问:
Need tot. no of employees count of a company which is establised after 1990
Two tables with their data which I have created.

```<code>select c.name,e.year,c.branch,c.employees from company as c
join Established as e on c.name=e.name;

select c.name,sum(c.employees),e.year from company as c
join Established as e on c.name=e.name where e.year=1990 group by c.Name
</code>```

It's working correctly, But when I use-

```<code>select c.name,sum(c.employees),e.year from company as c
join Established as e on c.name=e.name
group by c.Name having e.year=1990
</code>```

Error Code: 1055. Expression #3 of SELECT list is not in GROUP BY
clause and contains nonaggregated column 'joins.e.year' which is not
functionally dependent on columns in GROUP BY clause; this is
incompatible with sql_mode=only_full_group_by

```<code>select c.name,sum(c.employees),e.year from company as c
join Established as e on c.name=e.name
group by c.Name having e.year\>1990;

select c.name,sum(c.employees),e.year from company as c
join Established as e on c.name=e.name
group by c.Name having e.year\>1990 LIMIT 0, 1000
</code>```

Error Code: 1055. Expression #3 of SELECT list is not in GROUP BY
clause and contains nonaggregated column 'joins.e.year' which is not
functionally dependent on columns in GROUP BY clause; this is
incompatible with sql_mode=only_full_group_by 0.000 sec

Body:
Two tables with their data which I have created.

select c.name,e.year,c.branch,c.employees from company as c
join Established as e on c.name=e.name;

select c.name,sum(c.employees),e.year from company as c
join Established as e on c.name=e.name where e.year=1990 group by c.Name

It's working correctly, But when I use-

select c.name,sum(c.employees),e.year from company as c
join Established as e on c.name=e.name
group by c.Name having e.year=1990

Error Code: 1055. Expression #3 of SELECT list is not in GROUP BY
clause and contains nonaggregated column 'joins.e.year' which is not
functionally dependent on columns in GROUP BY clause; this is
incompatible with sql_mode=only_full_group_by

select c.name,sum(c.employees),e.year from company as c
join Established as e on c.name=e.name
group by c.Name having e.year\>1990;

select c.name,sum(c.employees),e.year from company as c
join Established as e on c.name=e.name
group by c.Name having e.year\>1990 LIMIT 0, 1000

Error Code: 1055. Expression #3 of SELECT list is not in GROUP BY
clause and contains nonaggregated column 'joins.e.year' which is not
functionally dependent on columns in GROUP BY clause; this is
incompatible with sql_mode=only_full_group_by 0.000 sec


问:
if statement fires even when it's condition is false
Edit: not a fix but a workaround. Replaced appearance listener with a useEffect:

```<code> React.useEffect(() => {
    if (useSystemMode === true) {
      console.log("setting theme based on appearance");
      setTheme(systemTheme === "dark" ? DarkTheme : LightTheme);
    }
  }, [systemTheme]);
</code>```

Still curious if anyone has an answer to the original issue, but problem is solved.

ORGINAL POST

I'm working on a theming app, where I can set the theme to system, dark, light, and others as added. I need it to listen for a system color scheme change ONLY IF the useSystemMode state is true.

However, when I set it to any theme, and then switch to another app, it still fires even when useSystemMode is set to false.

I notice that when I switch to another app, the ThemeProvider is re-rendered several times, and the system theme swaps. However that seems to only be an issue because the Appearance.addChangeListener fires when it shouldn't.

I'm using expo on IOS if it matters.

Here is the culprit code in Theme.context.tsx:

```<code>if (useSystemMode === true) {
    Appearance.addChangeListener(({ colorScheme }) => {
      console.log("setting theme based on appearance");
      setTheme(colorScheme === "dark" ? DarkTheme : LightTheme);
      // setUseSystemMode(true);
    });
  }
</code>```

Here is the full code:

```<code>// app.tsx

import { StatusBar } from "expo-status-bar";
import { SafeAreaProvider } from "react-native-safe-area-context";

import useCachedResources from "./hooks/useCachedResources";
import useColorScheme from "./hooks/useColorScheme";
import Navigation from "./navigation";
import { DarkTheme, LightTheme, ThemeProvider } from "./theme";

export default function App() {
  const isLoadingComplete = useCachedResources();
  const colorScheme = useColorScheme();

  if (!isLoadingComplete) {
    return null;
  } else {
    return (
      <ThemeProvider
        theme={colorScheme === "dark" ? DarkTheme : LightTheme}
        useSystemMode={true}
      >
        <SafeAreaProvider>
          <Navigation colorScheme={colorScheme} />
          <StatusBar />
        </SafeAreaProvider>
      </ThemeProvider>
    );
  }
}

</code>```
```<code>// Theme.context.tsx

import React, { useEffect } from "react";
import { Appearance } from "react-native";
import useColorScheme from "../hooks/useColorScheme";
import { Theme } from "./Theme.interface";
import { LightTheme, DarkTheme } from "./Themes";

interface ProvidedValue {
  theme: Theme;
  setTheme: (theme: Theme) => void;
  useSystemMode: boolean;
  setUseSystemMode: (systemMode: boolean) => void;
}

export const ThemeContext = React.createContext<ProvidedValue>({
  theme: LightTheme,
  setTheme: () => {
    console.log("ThemeProvider is not rendered!");
  },
  useSystemMode: true,
  setUseSystemMode: () => {
    console.log("ThemeProvider is not rendered!");
  },
});

interface Props {
  theme: Theme;
  useSystemMode: boolean;
  children?: React.ReactNode;
}

// memo will skip re-rendering the Theme Provider if state is unchanged
export const ThemeProvider = React.memo<Props>((props) => {
  const [theme, setTheme] = React.useState<Theme>(props.theme);
  const [useSystemMode, setUseSystemMode] = React.useState<boolean>(
    props.useSystemMode
  );
  const systemTheme = useColorScheme();

  console.log(
    "ThemeProvider was rendered. systemMode:",
    useSystemMode,
    " systemTheme:",
    systemTheme,
    " theme:",
    theme.id
  );

  const SetThemeCallback = React.useCallback((newTheme: Theme) => {
    console.log("calling setThemeCallBack)");
    setTheme((currentTheme: Theme) => {
      console.log("calling SetTheme");
      if (currentTheme.id === newTheme.id) {
        console.log("theme is already", currentTheme.id);

        return currentTheme;
      }
      console.log("setting theme to", newTheme.id);

      return newTheme;
    });
  }, []);

  const SetSystemModeCallback = React.useCallback((newValue: boolean) => {
    setUseSystemMode((currentValue: boolean) => {
      if (currentValue === newValue) {
        console.log("system mode is already", currentValue);
        return currentValue;
      }
      console.log("setting system mode to", newValue);
      return newValue;
    });
  }, []);

  if (useSystemMode === true) {
    Appearance.addChangeListener(({ colorScheme }) => {
      console.log("setting theme based on appearance");
      setTheme(colorScheme === "dark" ? DarkTheme : LightTheme);
      // setUseSystemMode(true);
    });
  }

  return (
    <ThemeContext.Provider
      value={{
        theme,
        setTheme: SetThemeCallback,
        useSystemMode: useSystemMode,
        setUseSystemMode: SetSystemModeCallback,
      }}
    >
      {props.children}
    </ThemeContext.Provider>
  );
});

// create hook that allows us to get the current theme in other components
export const useTheme = () => React.useContext(ThemeContext);

</code>```

I tried putting the Appearance.addChangeListener in an if statement to only fire when the useSystemMode is true. However it still fires when useSystemMode is false.

Body:
Edit: not a fix but a workaround. Replaced appearance listener with a useEffect:

 React.useEffect(() => {
    if (useSystemMode === true) {
      console.log("setting theme based on appearance");
      setTheme(systemTheme === "dark" ? DarkTheme : LightTheme);
    }
  }, [systemTheme]);

Still curious if anyone has an answer to the original issue, but problem is solved.

ORGINAL POST

I'm working on a theming app, where I can set the theme to system, dark, light, and others as added. I need it to listen for a system color scheme change ONLY IF the useSystemMode state is true.

However, when I set it to any theme, and then switch to another app, it still fires even when useSystemMode is set to false.

I notice that when I switch to another app, the ThemeProvider is re-rendered several times, and the system theme swaps. However that seems to only be an issue because the Appearance.addChangeListener fires when it shouldn't.

I'm using expo on IOS if it matters.

Here is the culprit code in Theme.context.tsx:

if (useSystemMode === true) {
    Appearance.addChangeListener(({ colorScheme }) => {
      console.log("setting theme based on appearance");
      setTheme(colorScheme === "dark" ? DarkTheme : LightTheme);
      // setUseSystemMode(true);
    });
  }

Here is the full code:

// app.tsx

import { StatusBar } from "expo-status-bar";
import { SafeAreaProvider } from "react-native-safe-area-context";

import useCachedResources from "./hooks/useCachedResources";
import useColorScheme from "./hooks/useColorScheme";
import Navigation from "./navigation";
import { DarkTheme, LightTheme, ThemeProvider } from "./theme";

export default function App() {
  const isLoadingComplete = useCachedResources();
  const colorScheme = useColorScheme();

  if (!isLoadingComplete) {
    return null;
  } else {
    return (
      <ThemeProvider
        theme={colorScheme === "dark" ? DarkTheme : LightTheme}
        useSystemMode={true}
      >
        <SafeAreaProvider>
          <Navigation colorScheme={colorScheme} />
          <StatusBar />
        </SafeAreaProvider>
      </ThemeProvider>
    );
  }
}

// Theme.context.tsx

import React, { useEffect } from "react";
import { Appearance } from "react-native";
import useColorScheme from "../hooks/useColorScheme";
import { Theme } from "./Theme.interface";
import { LightTheme, DarkTheme } from "./Themes";

interface ProvidedValue {
  theme: Theme;
  setTheme: (theme: Theme) => void;
  useSystemMode: boolean;
  setUseSystemMode: (systemMode: boolean) => void;
}

export const ThemeContext = React.createContext<ProvidedValue>({
  theme: LightTheme,
  setTheme: () => {
    console.log("ThemeProvider is not rendered!");
  },
  useSystemMode: true,
  setUseSystemMode: () => {
    console.log("ThemeProvider is not rendered!");
  },
});

interface Props {
  theme: Theme;
  useSystemMode: boolean;
  children?: React.ReactNode;
}

// memo will skip re-rendering the Theme Provider if state is unchanged
export const ThemeProvider = React.memo<Props>((props) => {
  const [theme, setTheme] = React.useState<Theme>(props.theme);
  const [useSystemMode, setUseSystemMode] = React.useState<boolean>(
    props.useSystemMode
  );
  const systemTheme = useColorScheme();

  console.log(
    "ThemeProvider was rendered. systemMode:",
    useSystemMode,
    " systemTheme:",
    systemTheme,
    " theme:",
    theme.id
  );

  const SetThemeCallback = React.useCallback((newTheme: Theme) => {
    console.log("calling setThemeCallBack)");
    setTheme((currentTheme: Theme) => {
      console.log("calling SetTheme");
      if (currentTheme.id === newTheme.id) {
        console.log("theme is already", currentTheme.id);

        return currentTheme;
      }
      console.log("setting theme to", newTheme.id);

      return newTheme;
    });
  }, []);

  const SetSystemModeCallback = React.useCallback((newValue: boolean) => {
    setUseSystemMode((currentValue: boolean) => {
      if (currentValue === newValue) {
        console.log("system mode is already", currentValue);
        return currentValue;
      }
      console.log("setting system mode to", newValue);
      return newValue;
    });
  }, []);

  if (useSystemMode === true) {
    Appearance.addChangeListener(({ colorScheme }) => {
      console.log("setting theme based on appearance");
      setTheme(colorScheme === "dark" ? DarkTheme : LightTheme);
      // setUseSystemMode(true);
    });
  }

  return (
    <ThemeContext.Provider
      value={{
        theme,
        setTheme: SetThemeCallback,
        useSystemMode: useSystemMode,
        setUseSystemMode: SetSystemModeCallback,
      }}
    >
      {props.children}
    </ThemeContext.Provider>
  );
});

// create hook that allows us to get the current theme in other components
export const useTheme = () => React.useContext(ThemeContext);

I tried putting the Appearance.addChangeListener in an if statement to only fire when the useSystemMode is true. However it still fires when useSystemMode is false.


问:
How do i get my video.mp4 to display on website?
I have trouble displaying a video on my website. It's working when I try it with vs code live server but not when uploaded... The video is supposed to start when you arrive on page and loop. There is also text displaying in front of video.

Html:

```<code> <div class="container">
      <video autoplay loop muted>
        <source
          src="/Steak - 16395.mp4"
          type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
        />
      </video>

      <div class="text-box">
        <h1>LINNÈA</h1>
      </div>
    </div>
</code>```

Css

```<code>.container {
width: 100%;
height: 100vh;
position: relative;
pointer-events: none;
}

.container video{
  width: 100%;
  height: 100%;
}

.text-box {
  position: absolute;
  top: 0;
  left:0;
  background: #111;
  height: 100%;
  width: 100%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  font-weight: 900;
  mix-blend-mode:color-dodge ;
}
</code>```

Website is uploaded with filezilla on https://www.infinityfree.net/.
Everything seems fine except the video.... Any clues?

I tried changing video format to see if that was the problem, but nothing happened.

Seperated html code from index and ran with styling in new vs code project to see if other html or styling was interfering with the video.

Tried changing browsers. (website works best with crome or edge)

Body:
I have trouble displaying a video on my website. It's working when I try it with vs code live server but not when uploaded... The video is supposed to start when you arrive on page and loop. There is also text displaying in front of video.

Html:

      <video autoplay loop muted>
        <source
          src="/Steak - 16395.mp4"
          type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
        />
      </video>

LINNÈA

Css

.container {
width: 100%;
height: 100vh;
position: relative;
pointer-events: none;
}

.container video{
  width: 100%;
  height: 100%;
}

.text-box {
  position: absolute;
  top: 0;
  left:0;
  background: #111;
  height: 100%;
  width: 100%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  font-weight: 900;
  mix-blend-mode:color-dodge ;
}

Website is uploaded with filezilla on https://www.infinityfree.net/.
Everything seems fine except the video.... Any clues?

I tried changing video format to see if that was the problem, but nothing happened.

Seperated html code from index and ran with styling in new vs code project to see if other html or styling was interfering with the video.

Tried changing browsers. (website works best with crome or edge)


问:
How to control RX/TX size for a BLE connection in a C# program running on Windows?
I am connecting to a BLE device from a C# program using the Windows.Devices.Bluetooth WinRT API.

The code uses an BluetoothLEAdvertisementWatcher for scanning to verify the device is in range, then uses the BluetoothLEDevice.FromBluetoothAddressAsync method to connect.

The peripheral is an STM32WB55, which then tries to negotiate a bigger MTU using the hci_le_set_data_length function to request MTU 251 and transmission time 2120ms in TX direction (as seen from the peripheral, so peripheral->central), and aci_l2cap_connection_parameter_update_req to request a connection interval of 48.75ms, and a timeout of 5000ms.

For any central, there's not much to send to the peripheral, but a lot of data to receive from it. So splitting a connection event with asymmetric phase durations is very beneficial. And in fact, on Android with "nRF Connect" as the connecting app, I can see that once all negotiation has finished, the connection configuration settled on (as seen from the peripheral) is:

nRF Connect

Interval: 48.75ms

Latency: 0

Timeout: 5000ms

TX Size: 251

TX Time: 2120ms

RX Size: 27

RX Time: 328ms

MTU: 251

So for nRF Connect, the peripheral can send a lot of data and will only wait to receive few data, which is perfect and exactly what I want. In Windows 10 and 11 however, the final configuration is reported to have ended up as follows:

Windows 10/11

Interval: 48.75ms

Latency: 0

Timeout: 5000ms

TX Size: 123

TX Time: 1096ms

RX Size: 123

RX Time: 1096ms

MTU: 251

As you can see, Windows does respect the requested interval, timeout, and MTU, but it splits each connection event evenly into [TX 123, RX 123] opposed to nRF Connect's [TX 251, RX 27].

Is there anything I can do to get Windows to split the connection event unevenly, i. e. more time peripheral->central and less time central->peripheral? The API seems to lack any means of controlling that part - or am I overlooking something here?

(Side note: Starting from Windows 11, the BluetoothLEDevice has a RequestPreferredConnectionParameters method. Unfortunately this method only allows to change interval, latency and timeout, as evident from the effect requesting any of the static members PowerOptimized (180ms / 6000ms), Balanced (60ms / 4000ms), or ThroughputOptimized (15ms / 2000ms) has.)


问:
Is there a way to use Select Case with Worksheet_Change
I am trying to use worksheet change to perform functions over 2 separate ranges on the same sheet. So far I have something along the lines of

```<code>Private Sub Worksheet_Change(ByVal Target As Range)

Select Case ActiveCell.Address
Case "G1"
    ' Only proceed with Effects if the Effect dropdown changes
    If Intersect(Target, Me.Range("G1")) Is Nothing Then Exit Sub

    Dim KeyEffects As Range, EffectCell As Range
    Set KeyEffects = Me.Range("Q32:BS32")

    ' Unhide all columns by default
    KeyEffects.EntireColumn.Hidden = False

    If Me.Range("G1").Value <> "All" Then
        For Each EffectCell In KeyEffects
            If EffectCell.DisplayFormat.Interior.ColorIndex <> _
            Me.Range("G1").DisplayFormat.Interior.ColorIndex Then
                EffectCell.EntireColumn.Hidden = True
            End If
        Next
    ElseIf Me.Range("G1") = "All" Then
        KeyEffects.EntireColumn.Hidden = False
    End If
    MsgBox "Working."

Case "D1"
    ' Only proceed with Causes if the Cause dropdown changes
    If Intersect(Target, Me.Range("D1")) Is Nothing Then Exit Sub

    Dim KeyCauses As Range, CauseCell As Range
    Set KeyCauses = Me.Range("A34:A105")

    ' Unhide all columns by default
    KeyCauses.EntireRow.Hidden = False

    If Me.Range("D1").Value <> "All" Then
        For Each CauseCell In KeyCauses
            If CauseCell.DisplayFormat.Interior.ColorIndex <> _
            Me.Range("D1").DisplayFormat.Interior.ColorIndex Then
                CauseCell.EntireRow.Hidden = True
            End If
        Next
    ElseIf Me.Range("D1") = "All" Then
        KeyCauses.EntireRow.Hidden = False
    End If
    MsgBox "Working."
End Select
MsgBox "Not Working."

End Sub
</code>```

But I have yet to get a working message; am I doing something wrong with my Select Case statement? This is my first time trying to work with the Change Event handler and also using Select Case.
Thanks!

Body:
I am trying to use worksheet change to perform functions over 2 separate ranges on the same sheet. So far I have something along the lines of

Private Sub Worksheet_Change(ByVal Target As Range)

Select Case ActiveCell.Address
Case "G1"
    ' Only proceed with Effects if the Effect dropdown changes
    If Intersect(Target, Me.Range("G1")) Is Nothing Then Exit Sub

    Dim KeyEffects As Range, EffectCell As Range
    Set KeyEffects = Me.Range("Q32:BS32")

    ' Unhide all columns by default
    KeyEffects.EntireColumn.Hidden = False

    If Me.Range("G1").Value <> "All" Then
        For Each EffectCell In KeyEffects
            If EffectCell.DisplayFormat.Interior.ColorIndex <> _
            Me.Range("G1").DisplayFormat.Interior.ColorIndex Then
                EffectCell.EntireColumn.Hidden = True
            End If
        Next
    ElseIf Me.Range("G1") = "All" Then
        KeyEffects.EntireColumn.Hidden = False
    End If
    MsgBox "Working."

Case "D1"
    ' Only proceed with Causes if the Cause dropdown changes
    If Intersect(Target, Me.Range("D1")) Is Nothing Then Exit Sub

    Dim KeyCauses As Range, CauseCell As Range
    Set KeyCauses = Me.Range("A34:A105")

    ' Unhide all columns by default
    KeyCauses.EntireRow.Hidden = False

    If Me.Range("D1").Value <> "All" Then
        For Each CauseCell In KeyCauses
            If CauseCell.DisplayFormat.Interior.ColorIndex <> _
            Me.Range("D1").DisplayFormat.Interior.ColorIndex Then
                CauseCell.EntireRow.Hidden = True
            End If
        Next
    ElseIf Me.Range("D1") = "All" Then
        KeyCauses.EntireRow.Hidden = False
    End If
    MsgBox "Working."
End Select
MsgBox "Not Working."

End Sub

But I have yet to get a working message; am I doing something wrong with my Select Case statement? This is my first time trying to work with the Change Event handler and also using Select Case.
Thanks!


问:
Python3 with unittest using TestSuite and TestCase
I am attempting to use the modules TestSuite and TestCase to build a testing hierarchy where I start with a TestSuite module that invokes modules containing test cases. My test case modules use the load_test function to define what the tests in the TestCase class are. I can use my test module correctly from the command line but when I try to use it from a TestSuite module that invokes it, I get a module is not a callable error. I know how to make the module callable but I have no idea what should be done to have it correctly processed and I could find no documentation or examples on the Internet.

My test suite is:

```<code>import unittest
import MyTestModule

def suite():
  suite = unittest.TestSuite()
  suite.addTest(MyTestModule)
  return suite

if __name__ == '__main__':
    # Startup the testing
    runner = unittest.TextTestRunner()
    runner.run(suite())
</code>```

and my TestCase module is:

```<code>class MyTestCase(unittest.TestCase):
  def Test1(self):
     pass

  def test2(self)
      pass
if __name__ == "__main__":
  unittest.main()
</code>```

Can anyone tell me what I need to do to invoke my TestCase module from my TestSuite?
I am using Python 3.11 on Ubuntu 22.04.

Body:
I am attempting to use the modules TestSuite and TestCase to build a testing hierarchy where I start with a TestSuite module that invokes modules containing test cases. My test case modules use the load_test function to define what the tests in the TestCase class are. I can use my test module correctly from the command line but when I try to use it from a TestSuite module that invokes it, I get a module is not a callable error. I know how to make the module callable but I have no idea what should be done to have it correctly processed and I could find no documentation or examples on the Internet.

My test suite is:

import unittest
import MyTestModule

def suite():
  suite = unittest.TestSuite()
  suite.addTest(MyTestModule)
  return suite

if __name__ == '__main__':
    # Startup the testing
    runner = unittest.TextTestRunner()
    runner.run(suite())

and my TestCase module is:

class MyTestCase(unittest.TestCase):
  def Test1(self):
     pass

  def test2(self)
      pass
if __name__ == "__main__":
  unittest.main()

Can anyone tell me what I need to do to invoke my TestCase module from my TestSuite?
I am using Python 3.11 on Ubuntu 22.04.


Title: Concatenate multiple columns by referring to another table

Body:
I have table1 around 26 columns and 2mln rows

line
 a
 b
 c
 d
 e
 f
 g
 h
 i
 j
 k
 l
 m
 n
 o
 p
 q
 r
 s
 t
 u
 v
 w
 x
 y
 z

1
18
2
2
22
0
2
1
2
1
3
1
2
1
3
26
2
0
22
0
22
2
32
2
4
2
2

2
20
2
2
2
0
0
0
2
1
4
0
2
1
4
24
0
0
2
0
2
1
3
2
5
0
0

3
10
2
2
222
0
2
1
2
1
2
1
2
1
2
24
0
2
2
0
2
1
3
1
5
0
2

4
12
2
2
3
0
0
0
0
1
3
0
0
1
3
21
2
0
0
0
0
0
22
1
4
2
0

5
15
2
2
3
0
0
0
0
1
3
0
0
1
3
21
2
0
2
0
2
1
22
1
4
2
0

6
20
2
2
2
0
0
0
0
1
4
0
0
1
4
20
2
0
2
0
0
0
22
2
4
2
0

7
15
2
2
22
0
0
0
0
1
2
0
0
1
2
21
2
0
2
0
0
0
22
2
4
2
0

8
18
2
2
22
0
0
0
0
1
3
0
0
1
3
21
2
0
2
0
0
0
22
1
4
2
0

9
8
2
0
22
0
2
1
0
1
3
1
0
1
3
24
0
0
2
0
0
0
3
2
5
0
2

10
14
2
2
3
0
2
1
0
1
3
1
0
1
3
12
0
2
22
0
2
1
22
2
3
0
2

11
14
2
0
222
0
22
2
2
2
2
2
2
2
2
20
0
0
0
0
0
0
3
3
4
0
22

Table2 around 900,000 lines (concatenated headers of table1)

 line
 sets
 joins

1
2
 a,b

2
4
 a,c,f,i

3
5
 a,d,o,x,y

4
2
 a,e

Table3 where I want to update joins & combs with concatenated data from entire table1 based on each rows in table2.joins.
For example, taking ("a,b") & ("a,c,f,i") from table2, the output of table3 looks something like this; I was wondering if this query could be done with the CTE?

line
sets
joins
combs

1
2
 a,b
18,2

2
2
 a,b
20,2

3
2
 a,b
10,2

4
2
 a,b
12,2

5
2
 a,b
15,2

6
2
 a,b
20,2

7
2
 a,b
15,2

8
2
 a,b
18,2

9
2
 a,b
8,2

10
2
 a,b
14,2

11
2
 a,b
14,2

12
4
 a,c,f,i
18,2,2,1

13
4
 a,c,f,i
20,2,0,1

14
4
 a,c,f,i
10,2,2,1

15
4
 a,c,f,i
12,2,0,1

16
4
 a,c,f,i
15,2,0,1

17
4
 a,c,f,i
20,2,0,1

18
4
 a,c,f,i
15,2,0,1

19
4
 a,c,f,i
18,2,0,1

20
4
 a,c,f,i
8,0,2,1

21
4
 a,c,f,i
14,2,2,1

22
4
 a,c,f,i
14,0,22,2


问:
How to show the yaxis' limit greater than the data's extreme value
Let's say I wish to compare the performance of bubble sort and selection sort and I have the time taken for the code to run for different number of inputs. The graph for each came out as follows.

The Bubble sort:

n=[]
for i in range(13):
    n.append(i*1000)
t=[0,1,5,12,21,31,45,61,81,102,125,160,191]
plt.plot(n,t,'s')
plt.plot(n,t)
plt.title('Time Complexity Analysis of Bubble Sort')
plt.xlabel('Number of Inputs')
plt.ylabel('Time Taken')
```
<p><img src="https://i.stack.imgur.com/nGbZ9.png" alt="Graph for Bubble Sort generated" /></p>
<p>The Selection Sort:</p>
<pre class="lang-py prettyprint-override"><code>n=[]
for i in range(13):
    n.append(i*1000)
t=[0,1,3,6,11,17,24,33,43,54,66,80,94]
plt.plot(n,t,'s')
plt.plot(n,t)
plt.title('Time Complexity Analysis of Selection Sort')
plt.xlabel('Number of Inputs')
plt.ylabel('Time Taken')
</code>```

The Graph look pretty similar because the y upper bound for selection sort is 100 while that for Bubble sort is 200. I wish the graph for the selection sort to have the y-upperbound be 200 as well.

I googled and found the following method:

```<code>ax.set_ylim(top=200)
</code>```

But this only works within the data entered extremes. If the data has the highest value less than 200 then it will show until the highest value of the data.

I wish to show the yaxis ticks until the 200 mark.

Body:
Let's say I wish to compare the performance of bubble sort and selection sort and I have the time taken for the code to run for different number of inputs. The graph for each came out as follows.

The Bubble sort:

n=[]
for i in range(13):
    n.append(i*1000)
t=[0,1,5,12,21,31,45,61,81,102,125,160,191]
plt.plot(n,t,'s')
plt.plot(n,t)
plt.title('Time Complexity Analysis of Bubble Sort')
plt.xlabel('Number of Inputs')
plt.ylabel('Time Taken')

The Selection Sort:

n=[]
for i in range(13):
    n.append(i*1000)
t=[0,1,3,6,11,17,24,33,43,54,66,80,94]
plt.plot(n,t,'s')
plt.plot(n,t)
plt.title('Time Complexity Analysis of Selection Sort')
plt.xlabel('Number of Inputs')
plt.ylabel('Time Taken')

The Graph look pretty similar because the y upper bound for selection sort is 100 while that for Bubble sort is 200. I wish the graph for the selection sort to have the y-upperbound be 200 as well.

I googled and found the following method:

ax.set_ylim(top=200)

But this only works within the data entered extremes. If the data has the highest value less than 200 then it will show until the highest value of the data.

I wish to show the yaxis ticks until the 200 mark.


问:
Combine two pyplot axis into single axis
Note: This is different from the following questions which make the following assumptions:

pyplot - copy an axes content and show it in a new figure: Deletes lines from an axis

Plot something in one figure, and use it again later for another figure: code to plot the lines again is available

matplotlib - duplicate plot from one figure to another?: moves onto a new empty figure

Here instead, the goal is to add lines to an existing axis which already has other lines on it.

I want to merge two axes that have been created as follows:

```<code>xx = np.arange(12)

fig1, ax1 = plt.subplots()
ax1.plot(xx, np.sin(xx), label="V1")

fig2, ax2 = plt.subplots()
ax2.plot(xx, 0*xx, label="V2")
</code>```

Suppose I no longer have access to the code used to create these plots, but just to fig1, ax1, fig2, ax2 objects (e.g. via pickling).

The two plots should be merged such that the output is (visually) the same (up to colors) as the output of:

```<code>fig, ax = plt.subplots()
ax.plot(xx, np.sin(xx), label="V1")
ax.plot(xx, 0*xx, label="V2")
</code>```

I have tried

```<code># move lines from ax1 to ax2
def move_lines_to_axis(ax1, ax2):
    for line in ax1.lines:
        line.remove()
        line.set_linestyle("dashed")
        line.recache(always=True)
        ax2.add_line(line)
    return ax2

ax2 = move_lines_to_axis(ax1, ax2)
ax2.figure
</code>```

but this gives the wrong scaling.

How can I copy the lines from one figure to the other?

Fig1:

Fig2:

Expected merged figure:

What the above code gives (note the wrong y-scale of the sinus):

This seems to be related to the axis transformation, but looking at the code of add_line, it sets the transformation to ax.transData.

Body:
Note: This is different from the following questions which make the following assumptions:

pyplot - copy an axes content and show it in a new figure: Deletes lines from an axis

Plot something in one figure, and use it again later for another figure: code to plot the lines again is available

matplotlib - duplicate plot from one figure to another?: moves onto a new empty figure

Here instead, the goal is to add lines to an existing axis which already has other lines on it.

I want to merge two axes that have been created as follows:

xx = np.arange(12)

fig1, ax1 = plt.subplots()
ax1.plot(xx, np.sin(xx), label="V1")

fig2, ax2 = plt.subplots()
ax2.plot(xx, 0*xx, label="V2")

Suppose I no longer have access to the code used to create these plots, but just to fig1, ax1, fig2, ax2 objects (e.g. via pickling).

The two plots should be merged such that the output is (visually) the same (up to colors) as the output of:

fig, ax = plt.subplots()
ax.plot(xx, np.sin(xx), label="V1")
ax.plot(xx, 0*xx, label="V2")

I have tried

# move lines from ax1 to ax2
def move_lines_to_axis(ax1, ax2):
    for line in ax1.lines:
        line.remove()
        line.set_linestyle("dashed")
        line.recache(always=True)
        ax2.add_line(line)
    return ax2

ax2 = move_lines_to_axis(ax1, ax2)
ax2.figure

but this gives the wrong scaling.

How can I copy the lines from one figure to the other?

Fig1:

Fig2:

Expected merged figure:

What the above code gives (note the wrong y-scale of the sinus):

This seems to be related to the axis transformation, but looking at the code of add_line, it sets the transformation to ax.transData.


问:
Valgrind Cross-compiling for MIPS64el Platform Error
I want to cross compile Valgrind (latest version 3.20.0) on MIPS64 little endian platform,

however it got error when I make:

```<code>/tmp/ccA58zPn.s:6706: Error: unrecognized opcode `cfcmsa $t0,$1'
/tmp/ccA58zPn.s:6707: Error: unrecognized opcode `ctcmsa $1,$4'
/tmp/ccA58zPn.s:6708: Error: unrecognized opcode `ld.b $w24,0($3)'
/tmp/ccA58zPn.s:6709: Error: unrecognized opcode `ld.b $w26,0($2)'
/tmp/ccA58zPn.s:6710: Error: unrecognized opcode `fadd.w $w24,$w24,$w26'
/tmp/ccA58zPn.s:6711: Error: unrecognized opcode `cfcmsa $4,$1'
/tmp/ccA58zPn.s:6712: Error: unrecognized opcode `ctcmsa $1,$t0'
/tmp/ccA58zPn.s:6741: Warning: tried to set unrecognized symbol: msa

/tmp/ccA58zPn.s:6800: Error: unrecognized opcode `cfcmsa $2,$0'
make[3]: *** [Makefile:1778: priv/libvex_mips32_linux_a-guest_mips_helpers.o] Error 1
make[3]: *** Waiting for unfinished jobs....
mv -f priv/.deps/libvex_mips32_linux_a-guest_arm64_toIR.Tpo priv/.deps/libvex_mips32_linux_a-guest_arm64_toIR.Po
mv -f priv/.deps/libvex_mips32_linux_a-guest_ppc_toIR.Tpo priv/.deps/libvex_mips32_linux_a-guest_ppc_toIR.Po
mv -f priv/.deps/libvex_mips32_linux_a-guest_s390_toIR.Tpo priv/.deps/libvex_mips32_linux_a-guest_s390_toIR.Po
make[3]: Leaving directory '/home/user/pkgs/valgrind-3.20.0/VEX'
make[2]: *** [Makefile:1055: all] Error 2
make[2]: Leaving directory '/home/user/pkgs/valgrind-3.20.0/VEX'
make[1]: *** [Makefile:898: all-recursive] Error 1
make[1]: Leaving directory '/home/user/pkgs/valgrind-3.20.0'
make: *** [Makefile:761: all] Error 2
</code>```

my configuration command:

```<code>sudo ./configure --host=mipsel-linux-musl \
--prefix=/home/user/pkgs/output/vargrind-mips64el/  \
CC=/home/user/kernels/gcc-4.9.3-64-gnu64/bin/mips64el-linux-gcc \
CXX=/home/user/kernels/gcc-4.9.3-64-gnu64/bin/mips64el-linux-g++ \
CFLAGS="-mips64 -EL"
</code>```

and my whole configuration info:

```<code>                    Version: 3.20.0
         Maximum build arch: mips32
         Primary build arch: mips32
       Secondary build arch:
                   Build OS: linux
     Link Time Optimisation: no
       Primary build target: MIPS32_LINUX
     Secondary build target:
           Platform variant: vanilla
      Primary -DVGPV string: -DVGPV_mips32_linux_vanilla=1
         Default supp files: ./xfree-3.supp ./xfree-4.supp glibc-2.X-drd.supp glibc-2.X-helgrind.supp glibc-2.X.supp
</code>```

my compiler version info:

```<code>Using built-in specs.
COLLECT_GCC=/home/user/kernels/gcc-4.9.3-64-gnu64/bin/mips64el-linux-gcc
COLLECT_LTO_WRAPPER=/home/user/kernels/gcc-4.9.3-64-gnu64/bin/../libexec/gcc/mips64el-linux/4.9.3/lto-wrapper
Target: mips64el-linux
Configured with: ../gcc-loongson-4.9.3/configure --disable-werror --prefix=/opt/gcc-4.9.3-64-gnu64/ --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=mips64el-linux --host=x86_64-pc-linux-gnu --with-sysroot=/opt/gcc-4.9.3-64-gnu64//sysroot --with-abi=64 --enable-static --with-build-sysroot=/opt/gcc-4.9.3-64-gnu64//sysroot --enable-poison-system-directories --with-arch=loongson3a --with-gmp=/opt/gcc-4.9.3-64-gnu64/ --with-mpfr=/opt/gcc-4.9.3-64-gnu64/ --with-mpc=/opt/gcc-4.9.3-64-gnu64/ --with-cloog=/opt/gcc-4.9.3-64-gnu64/ --disable-nls --enable-shared --disable-multilib --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-threads=posix --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.9.3 20150626 (4.9.3-2) (GCC)
</code>```

I use change some configuration like use:

```<code>--host=mips64el-linux-musl
</code>```

but it won't work.

How should I fix this?

I tried some different configurations.

I expect it can be used in my MIPS platform

Body:
I want to cross compile Valgrind (latest version 3.20.0) on MIPS64 little endian platform,

however it got error when I make:

/tmp/ccA58zPn.s:6706: Error: unrecognized opcode `cfcmsa $t0,$1'
/tmp/ccA58zPn.s:6707: Error: unrecognized opcode `ctcmsa $1,$4'
/tmp/ccA58zPn.s:6708: Error: unrecognized opcode `ld.b $w24,0($3)'
/tmp/ccA58zPn.s:6709: Error: unrecognized opcode `ld.b $w26,0($2)'
/tmp/ccA58zPn.s:6710: Error: unrecognized opcode `fadd.w $w24,$w24,$w26'
/tmp/ccA58zPn.s:6711: Error: unrecognized opcode `cfcmsa $4,$1'
/tmp/ccA58zPn.s:6712: Error: unrecognized opcode `ctcmsa $1,$t0'
/tmp/ccA58zPn.s:6741: Warning: tried to set unrecognized symbol: msa

/tmp/ccA58zPn.s:6800: Error: unrecognized opcode `cfcmsa $2,$0'
make[3]: *** [Makefile:1778: priv/libvex_mips32_linux_a-guest_mips_helpers.o] Error 1
make[3]: *** Waiting for unfinished jobs....
mv -f priv/.deps/libvex_mips32_linux_a-guest_arm64_toIR.Tpo priv/.deps/libvex_mips32_linux_a-guest_arm64_toIR.Po
mv -f priv/.deps/libvex_mips32_linux_a-guest_ppc_toIR.Tpo priv/.deps/libvex_mips32_linux_a-guest_ppc_toIR.Po
mv -f priv/.deps/libvex_mips32_linux_a-guest_s390_toIR.Tpo priv/.deps/libvex_mips32_linux_a-guest_s390_toIR.Po
make[3]: Leaving directory '/home/user/pkgs/valgrind-3.20.0/VEX'
make[2]: *** [Makefile:1055: all] Error 2
make[2]: Leaving directory '/home/user/pkgs/valgrind-3.20.0/VEX'
make[1]: *** [Makefile:898: all-recursive] Error 1
make[1]: Leaving directory '/home/user/pkgs/valgrind-3.20.0'
make: *** [Makefile:761: all] Error 2

my configuration command:

sudo ./configure --host=mipsel-linux-musl \
--prefix=/home/user/pkgs/output/vargrind-mips64el/  \
CC=/home/user/kernels/gcc-4.9.3-64-gnu64/bin/mips64el-linux-gcc \
CXX=/home/user/kernels/gcc-4.9.3-64-gnu64/bin/mips64el-linux-g++ \
CFLAGS="-mips64 -EL"

and my whole configuration info:

                    Version: 3.20.0
         Maximum build arch: mips32
         Primary build arch: mips32
       Secondary build arch:
                   Build OS: linux
     Link Time Optimisation: no
       Primary build target: MIPS32_LINUX
     Secondary build target:
           Platform variant: vanilla
      Primary -DVGPV string: -DVGPV_mips32_linux_vanilla=1
         Default supp files: ./xfree-3.supp ./xfree-4.supp glibc-2.X-drd.supp glibc-2.X-helgrind.supp glibc-2.X.supp

my compiler version info:

Using built-in specs.
COLLECT_GCC=/home/user/kernels/gcc-4.9.3-64-gnu64/bin/mips64el-linux-gcc
COLLECT_LTO_WRAPPER=/home/user/kernels/gcc-4.9.3-64-gnu64/bin/../libexec/gcc/mips64el-linux/4.9.3/lto-wrapper
Target: mips64el-linux
Configured with: ../gcc-loongson-4.9.3/configure --disable-werror --prefix=/opt/gcc-4.9.3-64-gnu64/ --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=mips64el-linux --host=x86_64-pc-linux-gnu --with-sysroot=/opt/gcc-4.9.3-64-gnu64//sysroot --with-abi=64 --enable-static --with-build-sysroot=/opt/gcc-4.9.3-64-gnu64//sysroot --enable-poison-system-directories --with-arch=loongson3a --with-gmp=/opt/gcc-4.9.3-64-gnu64/ --with-mpfr=/opt/gcc-4.9.3-64-gnu64/ --with-mpc=/opt/gcc-4.9.3-64-gnu64/ --with-cloog=/opt/gcc-4.9.3-64-gnu64/ --disable-nls --enable-shared --disable-multilib --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-threads=posix --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.9.3 20150626 (4.9.3-2) (GCC)

I use change some configuration like use:

--host=mips64el-linux-musl

but it won't work.

How should I fix this?

I tried some different configurations.

I expect it can be used in my MIPS platform


问:
Having issue managing iBooks annotations using its sqlite db and node.js
I am trying to manage annotations from books in iBooks app on MacOS13.

I need somehow to manage the title of the book to check if it's the same book in different formats. What could you suggest to do in this case ?

What I found out is that iBooks app stores the annotations and other metadata in SQLite databases. There are 2 separate databases, one of each stores annotations and the other one metadata about books.

I also noticed that whenever I add a new book to the library the iBooks app copies this book into a specific folder.

What I am trying to do is watch these databases, and every time a new annotation gets added my app would save it in my personal db. But first of all, it should check if the annotation with this ID is present in my database and and also check if a book is present in my db, otherwise it would create a new item in a table for books with book's title and author name.

The problem I am facing here is that I can't figure out how the title of the book is recorded in iBooks database. I have to deal with title cause I want the same book in different formats(PDF and epub) to be associated with just one entity on my own database.

I thought that title is being generated from file name. However it seems that it somehow interferes with iCloud sync. Cause when I deleted a book from my library and fully reset databases after that, I then added this book again it got a title as in the file name this book had before I deleted it in the first place. So can't really understand how the title is being generated.


问:
TFVC: Avoiding baseless merge between sibling branches
We are using a branching strategy like the following

```<code>Main
|_ v1
|_ v2
</code>```

As we were working on [v1], some devs needed to begin on [v2] so a branch was created from [Main].
Normally, we would have merged [v1] to [Main] for release then merged [v1] to [v2] and made sure everything was working as expected.

The thing is stuff happened and we were forced to merge only parts of [v1] leaving other changes for [v2] release (will call this changesets group [Remaining v1]).

Now, I need to merge all the remaining changesets from [v1] into [v2] but since they have no parent-child relationship, it looks like all I could directly do is a baseless merge. So I thought maybe we could Merge [Remaining v1] to [Main], Merge everything new from [Main] to [v2], rollback [Remaining v1] in [Main].

The thing is, according to my tests, when time will come to merge [v2] into [Main], every changes that came from [Remaining v1] won't be included since they once existed in [Main].

My question is: is there any way of forcing [Remaining v1] to merge again in [Main] from the [v2] branch even though they were once rollbacked?

Body:
We are using a branching strategy like the following

Main
|_ v1
|_ v2

As we were working on [v1], some devs needed to begin on [v2] so a branch was created from [Main].
Normally, we would have merged [v1] to [Main] for release then merged [v1] to [v2] and made sure everything was working as expected.

The thing is stuff happened and we were forced to merge only parts of [v1] leaving other changes for [v2] release (will call this changesets group [Remaining v1]).

Now, I need to merge all the remaining changesets from [v1] into [v2] but since they have no parent-child relationship, it looks like all I could directly do is a baseless merge. So I thought maybe we could Merge [Remaining v1] to [Main], Merge everything new from [Main] to [v2], rollback [Remaining v1] in [Main].

The thing is, according to my tests, when time will come to merge [v2] into [Main], every changes that came from [Remaining v1] won't be included since they once existed in [Main].

My question is: is there any way of forcing [Remaining v1] to merge again in [Main] from the [v2] branch even though they were once rollbacked?


问:
aws lightsail database// join to super user
I join to mysql database(from lightsail) by external connection.
I can connect to the database and I can control data in workbench.

but I want to change Database setting as a super user.

the error code is 1227(access denied)

how can I change db setting of lightsail database?

thank you

I tried RDS solution. but RDS can not read lightsail database.


问:
Jupyterlab load model fromJSON issue
I am developing notebook syncronization mechanism using websockets between jupyterlab users editing same notebook, here is what i am doing:

```<code>// having notebook instance as a NotebookPanel
// I am merging UI cell data and server (other's edited) cell data
// `updatedModel` contains merged cells from server and from user's current changes in the notebook.
notebook.context.model.fromJSON(updatedModel.content);
</code>```

I am facing following issue:

and cell actions disappear.

did anyone have this issue and came up with a solution to properly load notebook from a json?

Jupyterlab Version 3.5.0

Reproduction Code:

import {JupyterFrontEnd, JupyterFrontEndPlugin} from "@jupyterlab/application";
import {INotebookTracker, NotebookPanel, NotebookTracker} from "@jupyterlab/notebook";

const testCopyModelFromJSON = (notebookTracker: NotebookTracker) => {
    notebookTracker.widgetAdded.connect((tracker: NotebookTracker, panel: NotebookPanel) => {
        let notebook = panel.content;
        const notebookModel = notebook.model;
        if (!notebookModel) {
            return;
        }
        const model = notebookModel.toJSON();
        notebookModel.fromJSON(model);
    });
}

const plugin: JupyterFrontEndPlugin<void> = {
    id: 'nbsync-extension:plugin',
    autoStart: true,
    requires: [INotebookTracker],
    activate: (app: JupyterFrontEnd, notebookTracker: NotebookTracker) => {
        console.info('nbsync-extension started');
        app.started
            .then(() => {
                testCopyModelFromJSON(notebookTracker);
            });
        app.restored
            .then(() => {
                testCopyModelFromJSON(notebookTracker);
            });
    }
};

export default plugin;
```
<p>dependencies:</p>
```"@jupyterlab/application": "^3.5.0",
"@jupyterlab/notebook": "^3.5.0"
```

Title: Jupyterlab load model fromJSON issue

Body:
I am developing notebook syncronization mechanism using websockets between jupyterlab users editing same notebook, here is what i am doing:

// having notebook instance as a NotebookPanel
// I am merging UI cell data and server (other's edited) cell data
// `updatedModel` contains merged cells from server and from user's current changes in the notebook.
notebook.context.model.fromJSON(updatedModel.content);

I am facing following issue:

and cell actions disappear.

did anyone have this issue and came up with a solution to properly load notebook from a json?

Jupyterlab Version 3.5.0

Reproduction Code:

import {JupyterFrontEnd, JupyterFrontEndPlugin} from "@jupyterlab/application";
import {INotebookTracker, NotebookPanel, NotebookTracker} from "@jupyterlab/notebook";

const testCopyModelFromJSON = (notebookTracker: NotebookTracker) => {
    notebookTracker.widgetAdded.connect((tracker: NotebookTracker, panel: NotebookPanel) => {
        let notebook = panel.content;
        const notebookModel = notebook.model;
        if (!notebookModel) {
            return;
        }
        const model = notebookModel.toJSON();
        notebookModel.fromJSON(model);
    });
}

const plugin: JupyterFrontEndPlugin<void> = {
    id: 'nbsync-extension:plugin',
    autoStart: true,
    requires: [INotebookTracker],
    activate: (app: JupyterFrontEnd, notebookTracker: NotebookTracker) => {
        console.info('nbsync-extension started');
        app.started
            .then(() => {
                testCopyModelFromJSON(notebookTracker);
            });
        app.restored
            .then(() => {
                testCopyModelFromJSON(notebookTracker);
            });
    }
};

export default plugin;

dependencies:

"@jupyterlab/application": "^3.5.0",
"@jupyterlab/notebook": "^3.5.0"


问:
How can you securely store a JWT token with Auth0 and React?
I'm trying to find a relatively secure way to store JWT-tokens in my distributed web app with a React front-end, using Auth0. I'm currently using local storage, however this is vulnerable to XSS and CSRF. Session storage is not an option, since a re-login is necessary after the site is closed. I think 2 alternatives remain:

In-memory storage

As far as I know, this would be the most secure option and recommended by Auth0. However, I cannot call the getAccessTokenSilently hook everywhere.

Currently this is my code for API request:

```<code>import axios from 'axios';

const token = localStorage.getItem('token') || null

export default axios.create({
    baseURL: `http://localhost:8080/`,
    headers: {Authorization: `Bearer ${token}`},
    timeout: 2000
});
</code>```

When refactoring this code to use getAccessTokenSilently to achieve in-memory storage, I get the following error:
Line 3:34: React Hook "useAuth0" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks

```<code>import axios from 'axios';
import {useAuth0} from "@auth0/auth0-react";
const {getAccessTokenSilently} = useAuth0();

export default axios.create({
    baseURL: `http://localhost:8080/`,
    headers: {Authorization: `Bearer ${getAccessTokenSilently}`},
    timeout: 2000
});
</code>```

Is there any way to fix this? For GET-request I'm using a custom hook, but since a hook is always called imminently / at top level I cannot use it for POST-request (like adding a product).

HTTP only cookie

Since this is not recommended by Auth0 it would not be a preference, but an alternative if possible.

Auth0 SPA settings:

Auth0 API settings:

Thanks for your suggestions

Body:
I'm trying to find a relatively secure way to store JWT-tokens in my distributed web app with a React front-end, using Auth0. I'm currently using local storage, however this is vulnerable to XSS and CSRF. Session storage is not an option, since a re-login is necessary after the site is closed. I think 2 alternatives remain:

In-memory storage

As far as I know, this would be the most secure option and recommended by Auth0. However, I cannot call the getAccessTokenSilently hook everywhere.

Currently this is my code for API request:

import axios from 'axios';

const token = localStorage.getItem('token') || null

export default axios.create({
    baseURL: `http://localhost:8080/`,
    headers: {Authorization: `Bearer ${token}`},
    timeout: 2000
});

When refactoring this code to use getAccessTokenSilently to achieve in-memory storage, I get the following error:
Line 3:34: React Hook "useAuth0" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks

import axios from 'axios';
import {useAuth0} from "@auth0/auth0-react";
const {getAccessTokenSilently} = useAuth0();

export default axios.create({
    baseURL: `http://localhost:8080/`,
    headers: {Authorization: `Bearer ${getAccessTokenSilently}`},
    timeout: 2000
});

Is there any way to fix this? For GET-request I'm using a custom hook, but since a hook is always called imminently / at top level I cannot use it for POST-request (like adding a product).

HTTP only cookie

Since this is not recommended by Auth0 it would not be a preference, but an alternative if possible.

Auth0 SPA settings:

Auth0 API settings:

Thanks for your suggestions


问:
Error: Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
I am trying to setup both CPU and GPU for tensorflow but i am getting this error

enter image description here

I was Expecting a True as answer

Why am I getting this error instead of True? How can I get True instead of the error?


问:
to_tsvector function with strings ending with numbers
I am trying to vectorize below text column (ends with a number always) value using to_tsvector function, so i can use the vector for full text search.

sample data

this-is-news-1
to_tsvector function is resulting in below values
'1':5 'is':3 'news':4 'this':2 'this-is-news':1

But i want -1 to come along with the full string.
Expected data is
'1':5 'is':3 'news':4 'this':2 'this-is-news-1':1

How can i get this data.


问:
Scrolling to the left in horizontally scrollable RTL element
I have a basic slider that contains some cards styled with Tailwind CSS to scroll horizontally and two buttons for scrolling in each direction, the issue is when the document direction is RTL and I'm using any of the JavaScript methods available(Element.scroll(), Element.scrollBy(), Element.scrollTo(), and *Element.scrollLeft*) to scroll into the elements on the x-axis it only scrolls to the left whether the document has a direction of RTL/LTR(haveing maximum value for scrollLeft on RTL) and looking around, I have to use negative values conditionally to make it scroll correctly.

```<code><script setup>
import { ref, onMounted } from 'vue'

// declare a ref to hold the element reference
// the name must match template ref value
const slider = ref(null)

onMounted(() => {
  console.log('mounted', slider.value)
  slider.scrollLeft = 100
  window.slider = slider
})

const clicked = () => {
  slider.value.scrollTo({
  top: 0,
  left: -1000,
  behavior: 'smooth'
});
}
</script>
<template>
  <section class="mt-20 px-20">
    <ul class="flex gap-[15px] overflow-x-auto" ref="slider">
      <li class="flex-none w-[calc(33.333333%_-_10px)] border" v-for="i in 7" :key="i">
        <h2>Hello</h2>
        <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et libero corporis veritatis nemo accusantium, recusandae inventore, animi nisi at cumque sunt excepturi exercitationem tenetur vel. Id distinctio voluptate quasi in!</p>
      </li>
    </ul>
    <button @click.prevent="clicked" type="button" class="p-4 mt-4 bg-green-200 hover:bg-blue-200">Make me scroll to the left on RTL</button>
  </section>
</template>
</code>```

is there any way to make the element scroll according to the document dir attribute without adding the additional checks for JS?

Body:
I have a basic slider that contains some cards styled with Tailwind CSS to scroll horizontally and two buttons for scrolling in each direction, the issue is when the document direction is RTL and I'm using any of the JavaScript methods available(Element.scroll(), Element.scrollBy(), Element.scrollTo(), and *Element.scrollLeft*) to scroll into the elements on the x-axis it only scrolls to the left whether the document has a direction of RTL/LTR(haveing maximum value for scrollLeft on RTL) and looking around, I have to use negative values conditionally to make it scroll correctly.

<template>

Hello

Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et libero corporis veritatis nemo accusantium, recusandae inventore, animi nisi at cumque sunt excepturi exercitationem tenetur vel. Id distinctio voluptate quasi in!

    <button @click.prevent="clicked" type="button" class="p-4 mt-4 bg-green-200 hover:bg-blue-200">Make me scroll to the left on RTL</button>

</template>

is there any way to make the element scroll according to the document dir attribute without adding the additional checks for JS?


问:
Skipping the second users input
```<code>typedef struct car_description{
char car_name [MAXLEN];
int car_date;
}CAR;

int main() {
using namespace std;
int num_of_cars;
CAR users_car;

//ptr = new(CAR);
cout << "How many cars do you wish to catalog? ";
cin >> num_of_cars;
cout << "Please enter the make: ";
cin.get(users_car.car_name, MAXLEN);
cout << "Please Enter the year made: ";
cin >> users_car.car_date;

cout << "Here your collection:" << endl;
cout << users_car.car_date << " " << users_car.car_name;
</code>```

}

When entering the first input skips over and ends the program. Tried to use different functions of cin like cin.get or getline and still the same issue. What is the issue with the code. (Probably a lot)

Title: Skipping the second users input

Body:
typedef struct car_description{
char car_name [MAXLEN];
int car_date;
}CAR;

int main() {
using namespace std;
int num_of_cars;
CAR users_car;

//ptr = new(CAR);
cout << "How many cars do you wish to catalog? ";
cin >> num_of_cars;
cout << "Please enter the make: ";
cin.get(users_car.car_name, MAXLEN);
cout << "Please Enter the year made: ";
cin >> users_car.car_date;

cout << "Here your collection:" << endl;
cout << users_car.car_date << " " << users_car.car_name;

}

When entering the first input skips over and ends the program. Tried to use different functions of cin like cin.get or getline and still the same issue. What is the issue with the code. (Probably a lot)


问:
How to get data from a sign Computer Craft
is there a way of getting what is written on a sign from a turtle, the furthest I've gotten is getting that it's a sign... yeah.

If anyone knows how to do it, please do tell.

To make it more clear, I have a sign with "Hello" written on it, I want the turtle to read the sign and output the "Hello" to the console.


问:
Error using RandomizedSearchCV on a LSTM model
I want to find the optimal number of neurons and layers for a LSTM model and I have created the following:

```<code>def build_model(n_hidden=1, n_neurons=30, learning_rate=3e-3, input_shape=[20,11]):
    model = keras.models.Sequential()
    options = {"input_shape": input_shape}
    for layer in range(n_hidden):
        model.add(keras.layers.Dense(n_neurons, activation="swish", **options))
        options = {}
        model.add(keras.layers.Dense(10, **options))
       #optimizer = keras.optimizers.SGD(learning_rate)
       model.compile(loss="mse", optimizer='adam')
    return model

keras_reg = keras.wrappers.scikit_learn.KerasRegressor(build_model)

from scipy.stats import reciprocal
from sklearn.model_selection import RandomizedSearchCV
param_distribs = {
"n_hidden": [0, 1, 2, 3],
"n_neurons": np.arange(1, 100),
#"learning_rate": reciprocal(3e-4, 3e-2),
 }
rnd_search_cv = RandomizedSearchCV(keras_reg, param_distribs, n_iter=10)
rnd_search_cv.fit(x_tr, y_tr , epochs=100,
callbacks=[keras.callbacks.EarlyStopping(patience=10)])
</code>```

The dataset used is composed of 11 features and in this model it looks for the 20-in previous times steps and aims to predict the following 10 time steps. When I run the following code I have the following error:

```<code>> /home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_validation.py:372: FitFailedWarning:
50 fits failed out of a total of 50.
The score on these train-test partitions for these parameters will be set to nan.
If these failures are not expected, you can try to debug them by setting error_score='raise'.

Below are more details about the failures:
> --------------------------------------------------------------------------------
1 fits failed with the following error:
Traceback (most recent call last):
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_validation.py", line 680, in _fit_and_score
estimator.fit(X_train, y_train, **fit_params)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/wrappers/scikit_learn.py", line 175, in fit
history = self.model.fit(x, y, **fit_args)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/use/anaconda3/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 52, in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node 'gradient_tape/mean_squared_error/BroadcastGradientArgs' defined at (most recent call last):
File "/home/use/anaconda3/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/use/anaconda3/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel_launcher.py", line 17, in <module>
app.launch_new_instance()
File "/home/use/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
app.start()
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelapp.py", line 712, in start
self.io_loop.start()
File "/home/use/anaconda3/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 199, in start
self.asyncio_loop.run_forever()
File "/home/use/anaconda3/lib/python3.9/asyncio/base_events.py", line 601, in run_forever
self._run_once()
File "/home/use/anaconda3/lib/python3.9/asyncio/base_events.py", line 1905, in _run_once
handle._run()
File "/home/use/anaconda3/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 510, in dispatch_queue
await self.process_one()
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 499, in process_one
await dispatch(*args)
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 406, in dispatch_shell
await result
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 730, in execute_request
reply_content = await reply_content
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/ipkernel.py", line 390, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/zmqshell.py", line 528, in run_cell
return super().run_cell(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 2914, in run_cell
result = self._run_cell(
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 2960, in _run_cell
return runner(coro)
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/async_helpers.py", line 78, in _pseudo_sync_runner
coro.send(None)
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3185, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3377, in run_ast_nodes
if (await self.run_code(code, result,  async_=asy)):
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3457, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/tmp/ipykernel_10055/1251208469.py", line 9, in <module>
rnd_search_cv.fit(x_tr, y_tr , epochs=100,
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_search.py", line 891, in fit
self._run_search(evaluate_candidates)
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_search.py", line 1766, in _run_search
evaluate_candidates(
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_search.py", line 838, in evaluate_candidates
out = parallel(
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 1043, in __call__
if self.dispatch_one_batch(iterator):
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 861, in dispatch_one_batch
self._dispatch(tasks)
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 779, in _dispatch
job = self._backend.apply_async(batch, callback=cb)
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 208, in apply_async
result = ImmediateResult(func)
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 572, in __init__
self.results = batch()
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 262, in __call__
return [func(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 262, in <listcomp>
return [func(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/utils/fixes.py", line 216, in __call__
return self.function(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_validation.py", line 680, in _fit_and_score
estimator.fit(X_train, y_train, **fit_params)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/wrappers/scikit_learn.py", line 175, in fit
history = self.model.fit(x, y, **fit_args)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 65, in error_handler
return fn(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1650, in fit
tmp_logs = self.train_function(iterator)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1249, in train_function
return step_function(self, iterator)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1233, in step_function
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1222, in run_step
outputs = model.train_step(data)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1027, in train_step
self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 526, in minimize
grads_and_vars = self.compute_gradients(loss, var_list, tape)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 259, in compute_gradients
grads = tape.gradient(loss, var_list)
Node: 'gradient_tape/mean_squared_error/BroadcastGradientArgs'
Incompatible shapes: [32,20,10] vs. [32,10]
[[{{node gradient_tape/mean_squared_error/BroadcastGradientArgs}}]] [Op:__inference_train_function_1033752]

</code>```

Body:
I want to find the optimal number of neurons and layers for a LSTM model and I have created the following:

def build_model(n_hidden=1, n_neurons=30, learning_rate=3e-3, input_shape=[20,11]):
    model = keras.models.Sequential()
    options = {"input_shape": input_shape}
    for layer in range(n_hidden):
        model.add(keras.layers.Dense(n_neurons, activation="swish", **options))
        options = {}
        model.add(keras.layers.Dense(10, **options))
       #optimizer = keras.optimizers.SGD(learning_rate)
       model.compile(loss="mse", optimizer='adam')
    return model

keras_reg = keras.wrappers.scikit_learn.KerasRegressor(build_model)

from scipy.stats import reciprocal
from sklearn.model_selection import RandomizedSearchCV
param_distribs = {
"n_hidden": [0, 1, 2, 3],
"n_neurons": np.arange(1, 100),
#"learning_rate": reciprocal(3e-4, 3e-2),
 }
rnd_search_cv = RandomizedSearchCV(keras_reg, param_distribs, n_iter=10)
rnd_search_cv.fit(x_tr, y_tr , epochs=100,
callbacks=[keras.callbacks.EarlyStopping(patience=10)])

The dataset used is composed of 11 features and in this model it looks for the 20-in previous times steps and aims to predict the following 10 time steps. When I run the following code I have the following error:

> /home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_validation.py:372: FitFailedWarning:
50 fits failed out of a total of 50.
The score on these train-test partitions for these parameters will be set to nan.
If these failures are not expected, you can try to debug them by setting error_score='raise'.

Below are more details about the failures:
> --------------------------------------------------------------------------------
1 fits failed with the following error:
Traceback (most recent call last):
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_validation.py", line 680, in _fit_and_score
estimator.fit(X_train, y_train, **fit_params)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/wrappers/scikit_learn.py", line 175, in fit
history = self.model.fit(x, y, **fit_args)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/use/anaconda3/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 52, in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node 'gradient_tape/mean_squared_error/BroadcastGradientArgs' defined at (most recent call last):
File "/home/use/anaconda3/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/use/anaconda3/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel_launcher.py", line 17, in <module>
app.launch_new_instance()
File "/home/use/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
app.start()
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelapp.py", line 712, in start
self.io_loop.start()
File "/home/use/anaconda3/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 199, in start
self.asyncio_loop.run_forever()
File "/home/use/anaconda3/lib/python3.9/asyncio/base_events.py", line 601, in run_forever
self._run_once()
File "/home/use/anaconda3/lib/python3.9/asyncio/base_events.py", line 1905, in _run_once
handle._run()
File "/home/use/anaconda3/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 510, in dispatch_queue
await self.process_one()
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 499, in process_one
await dispatch(*args)
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 406, in dispatch_shell
await result
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 730, in execute_request
reply_content = await reply_content
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/ipkernel.py", line 390, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/home/use/anaconda3/lib/python3.9/site-packages/ipykernel/zmqshell.py", line 528, in run_cell
return super().run_cell(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 2914, in run_cell
result = self._run_cell(
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 2960, in _run_cell
return runner(coro)
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/async_helpers.py", line 78, in _pseudo_sync_runner
coro.send(None)
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3185, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3377, in run_ast_nodes
if (await self.run_code(code, result,  async_=asy)):
File "/home/use/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3457, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/tmp/ipykernel_10055/1251208469.py", line 9, in <module>
rnd_search_cv.fit(x_tr, y_tr , epochs=100,
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_search.py", line 891, in fit
self._run_search(evaluate_candidates)
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_search.py", line 1766, in _run_search
evaluate_candidates(
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_search.py", line 838, in evaluate_candidates
out = parallel(
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 1043, in __call__
if self.dispatch_one_batch(iterator):
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 861, in dispatch_one_batch
self._dispatch(tasks)
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 779, in _dispatch
job = self._backend.apply_async(batch, callback=cb)
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 208, in apply_async
result = ImmediateResult(func)
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 572, in __init__
self.results = batch()
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 262, in __call__
return [func(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/joblib/parallel.py", line 262, in <listcomp>
return [func(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/utils/fixes.py", line 216, in __call__
return self.function(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/sklearn/model_selection/_validation.py", line 680, in _fit_and_score
estimator.fit(X_train, y_train, **fit_params)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/wrappers/scikit_learn.py", line 175, in fit
history = self.model.fit(x, y, **fit_args)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 65, in error_handler
return fn(*args, **kwargs)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1650, in fit
tmp_logs = self.train_function(iterator)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1249, in train_function
return step_function(self, iterator)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1233, in step_function
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1222, in run_step
outputs = model.train_step(data)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1027, in train_step
self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 526, in minimize
grads_and_vars = self.compute_gradients(loss, var_list, tape)
File "/home/use/anaconda3/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 259, in compute_gradients
grads = tape.gradient(loss, var_list)
Node: 'gradient_tape/mean_squared_error/BroadcastGradientArgs'
Incompatible shapes: [32,20,10] vs. [32,10]
[[{{node gradient_tape/mean_squared_error/BroadcastGradientArgs}}]] [Op:__inference_train_function_1033752]


问:
Jittery movement with falling object moving back and forth horizontally
I've got a falling object, which i want to move back and forth horizontally while falling.

While i've manage to do this, i'm getting a jittery movement while this happens. When the object falls without horizontal movement, theres no jittery movement.This is also the case if the object just moves horizontally without falling.

I'm currently using rigidbody2d.velocity to move it horizontally and have tried using transform.position and translate but didn't see any difference in smoother movement.

Jittery Movement GIF

So clearly theres an issue with combine the two movements together, but i can't work out how to remedy this in order to make it a smooth movement.

Object Inspector Image

Here's the object code for it's movement:

```<code>public float verticalSpeed = 7f;

private Rigidbody2D object_RB;

private int moveHorizontal;
private int horizontalSpeed;

void Start()
{
    object_RB = GetComponent<Rigidbody2D>();

    moveHorizontal = Random.Range(1, 3);
    horizontalSpeed = Random.Range(4, 7);
}

void Update()
{
    if (transform.position.y <= -10f)
    {
        Destroy(gameObject);
    }

    if (transform.position.x < -1.7f)
    {
        moveHorizontal = 1;
    }
    else if (transform.position.x > 1.7f)
    {
        moveHorizontal = 2;
    }

    transform.position -= transform.up * Time.deltaTime * verticalSpeed;
}

void FixedUpdate()
{
    if (moveHorizontal == 1)
    {
        object_RB.velocity = new Vector2(horizontalSpeed, 0);
    }
    else if (moveHorizontal == 2)
    {
        object_RB.velocity = new Vector2(-horizontalSpeed, 0);
    }
}
</code>```

I'm stuck with this and would appreciate some input to fix this movement.

EDIT - I've tried setting the Interpolate property of the rigidbody to Interpolate or Extrapolate and had no luck. If i set it to Interpolate, the horizontal movement slows down drastically, to a point where it doesn't seem like its moving horizontally at all. Changing it to Extrapolate actually increases the jittery effect.

Body:
I've got a falling object, which i want to move back and forth horizontally while falling.

While i've manage to do this, i'm getting a jittery movement while this happens. When the object falls without horizontal movement, theres no jittery movement.This is also the case if the object just moves horizontally without falling.

I'm currently using rigidbody2d.velocity to move it horizontally and have tried using transform.position and translate but didn't see any difference in smoother movement.

Jittery Movement GIF

So clearly theres an issue with combine the two movements together, but i can't work out how to remedy this in order to make it a smooth movement.

Object Inspector Image

Here's the object code for it's movement:

public float verticalSpeed = 7f;

private Rigidbody2D object_RB;

private int moveHorizontal;
private int horizontalSpeed;

void Start()
{
    object_RB = GetComponent<Rigidbody2D>();

    moveHorizontal = Random.Range(1, 3);
    horizontalSpeed = Random.Range(4, 7);
}

void Update()
{
    if (transform.position.y <= -10f)
    {
        Destroy(gameObject);
    }

    if (transform.position.x < -1.7f)
    {
        moveHorizontal = 1;
    }
    else if (transform.position.x > 1.7f)
    {
        moveHorizontal = 2;
    }

    transform.position -= transform.up * Time.deltaTime * verticalSpeed;
}

void FixedUpdate()
{
    if (moveHorizontal == 1)
    {
        object_RB.velocity = new Vector2(horizontalSpeed, 0);
    }
    else if (moveHorizontal == 2)
    {
        object_RB.velocity = new Vector2(-horizontalSpeed, 0);
    }
}

I'm stuck with this and would appreciate some input to fix this movement.

EDIT - I've tried setting the Interpolate property of the rigidbody to Interpolate or Extrapolate and had no luck. If i set it to Interpolate, the horizontal movement slows down drastically, to a point where it doesn't seem like its moving horizontally at all. Changing it to Extrapolate actually increases the jittery effect.


问:
How to declare a URL not to be interpreted by WordPress but by a plugin( I have written)?
I made a plugin, simply displaying news. Till now I called the news article by a function.
example.com/?f=va&id=23
Means: Function = view article and the ID is the ID of the database entry. All good so far.
Now I want to change that to example.com/my-dumb-news

Problem: WordPress interprets /my-dumb-news and says its not found on the page.
Means the plugin does not get the chance to parse url, get the path, look if there is something in database.

So is there a way to tell WordPress not to interpret a list of URLs?

Thank you
C


问:
How to remove additional screens and monitors from X configuration file ( /etc/X11/xorg.conf )
I have one monitor but X -configure makes a configuration file for 16 screens and monitors.

```<code>Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen0" 0 0
        Screen      1  "Screen1" RightOf "Screen0"
        Screen      2  "Screen2" RightOf "Screen1"
        Screen      3  "Screen3" RightOf "Screen2"
        Screen      4  "Screen4" RightOf "Screen3"
        Screen      5  "Screen5" RightOf "Screen4"
        Screen      6  "Screen6" RightOf "Screen5"
        Screen      7  "Screen7" RightOf "Screen6"
        Screen      8  "Screen8" RightOf "Screen7"
        Screen      9  "Screen9" RightOf "Screen8"
        Screen     10  "Screen10" RightOf "Screen9"
        Screen     11  "Screen11" RightOf "Screen10"
        Screen     12  "Screen12" RightOf "Screen11"
        Screen     13  "Screen13" RightOf "Screen12"
        Screen     14  "Screen14" RightOf "Screen13"
        Screen     15  "Screen15" RightOf "Screen14"
        Screen     16  "Screen16" RightOf "Screen15"
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

...
</code>```

When I remove additional screens I face with X server errors on loading GUI.

Body:
I have one monitor but X -configure makes a configuration file for 16 screens and monitors.

Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen0" 0 0
        Screen      1  "Screen1" RightOf "Screen0"
        Screen      2  "Screen2" RightOf "Screen1"
        Screen      3  "Screen3" RightOf "Screen2"
        Screen      4  "Screen4" RightOf "Screen3"
        Screen      5  "Screen5" RightOf "Screen4"
        Screen      6  "Screen6" RightOf "Screen5"
        Screen      7  "Screen7" RightOf "Screen6"
        Screen      8  "Screen8" RightOf "Screen7"
        Screen      9  "Screen9" RightOf "Screen8"
        Screen     10  "Screen10" RightOf "Screen9"
        Screen     11  "Screen11" RightOf "Screen10"
        Screen     12  "Screen12" RightOf "Screen11"
        Screen     13  "Screen13" RightOf "Screen12"
        Screen     14  "Screen14" RightOf "Screen13"
        Screen     15  "Screen15" RightOf "Screen14"
        Screen     16  "Screen16" RightOf "Screen15"
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

...

When I remove additional screens I face with X server errors on loading GUI.