问:
how to collapse accordion elements in different rows
I have tried to select css classes for visual effects through every row, so when I click to selected row's accordion element, every other elements supposed to collapse in other rows. Also, divs at the right columns cannot change with css class selector inside selected row

Appreciate for any help..

What I tried;

1)collapse every other accordion element when click any of the elements.

2)calling css classes while not collapsed

3)change the css class of the right column element when click the selected column element

```<code>.card{
    background-color: rgb(18, 18, 18);
    border-radius: 0px;
}

.card-header{
    padding: 0px 0px 4px 0px;
    border-bottom: 1px solid;
    color:  #2F312D;
    display: flex;
    flex-direction: column;
}

.expandable.collapsed .card-header.collapsed{
    filter: var(--filter-primary) ; /*DARK DEGIL LIGHT OLMALI*/
}

.mb-0{
    display: flex;
    justify-content: space-between;
}

.btn{
    padding: 0px;
}

.btn.btn-link{
    color: black;
    filter: var(--filter-tertiary-container);
    font: var(--headline-large);
    width: max-content;

}

.expandable{
    height: 250px;
}

.expandable.collapsed .btn.btn-link.collapsed{
    filter: var(--filter-tertiary);
    font: var(--headline-small);
}

.expand{
    color: black;
    cursor: pointer;
    float: right;
    width: 28px;
    height: 28px;
    border: 0.5px solid var(--tertiary-container);
    border-radius: 26px;
}

.expandIcon{
    content: "";
    background: url(icons/expand_more_down.png) no-repeat 0 0;
    background-position: center;
    color: var(--tertiary-container);

}

.expandable.collapsed .expand.expandIcon.collapsed{
    transform: rotate(90deg);
    filter: var(--filter-tertiary-container);

}

.card-body{
    padding: 4px 0px 0px 0px;
}

#collapseOne{
    padding: 0px;
}

/***middle right***/
.container.middle{
    padding-top: 110px ;
    z-index: 1;
}

.line{
    position: absolute;
    width: 100%;
    height: 0px;
    left: 325px;
    top: 415px;
    z-index: 0;
    border : 1px dashed #424940;
    transform: rotate(90deg);
}

.right{
    text-align: -webkit-center;
    z-index: 1;
}

h2{
    margin-top: 0;
    margin-bottom: 0;
}

.expandable.collapsed .lvlV.collapsed{
    width: 80px;
    height: 80px;
    background: linear-gradient(180deg, #424940 0%, #2F312D 100%);
    border: 1px solid #94F98F;
    box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px rgba(0, 0, 0, 0.3);
    border-radius: 25px;
    font: var(--headline-large);
}
.lvlV h2.collapsed{
    color: #94F98F;
}

.lvlV{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 71px;
    height: 71px;
    background: #2F312D;
    border: 0.5px solid #1A1C19;
    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px rgba(0, 0, 0, 0.3);
    border-radius: 25px;
}

.lvlV h2{
    color: #1A1C19;
}
</code>```
```<code><div class="container middle">
        <div class="row expandable collapsed">
          <div class="col-6 left">
            <div class="accordion" id="accordionExample">
              <div class="card">
                <div class="card-header" id="headingOne">
                  <h5 class="mb-0" >
                    <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne" >
                      Version 1
                    </button>
                    <div class="expand expandIcon" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne"></div>
                  </h5>
                </div>
                <div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordionExample">
                  <div class="card-body --caption-large" style="color: #FFFFFF ;">

                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="col-6 right">
            <div class="lvlV">
              <h2 class="--headline-small">V1</h2>
            </div>
          </div>
        </div>

        <div class="row expandable collapsed">
          <div class="col-6 left">
            <div class="card">
              <div class="card-header" id="headingTwo">
                <h5 class="mb-0" >
                  <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo" >
                    Version 2
                  </button>
                  <div class="expand expandIcon" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"></div>
                </h5>
              </div>
              <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
                <div class="card-body --caption-large" style="color: #FFFFFF ;">

                </div>
              </div>
            </div>
          </div>
          <div class="col-6 right">
            <div class="lvlV">
              <h2 class="--headline-small">V2</h2>
            </div>
          </div>
        </div>

        <div class="row expandable collapsed">
          <div class="col-6 left">
            <div class="card">
              <div class="card-header" id="headingThree">
                <h5 class="mb-0" >
                  <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree" >
                    Version 3
                  </button>
                  <div class="expand expandIcon" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"></div>
                </h5>
              </div>
              <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
                <div class="card-body --caption-large" style="color: #FFFFFF ;">

                </div>
              </div>
            </div>
          </div>
          <div class="col-6 right">
            <div class="lvlV">
              <h2 class="--headline-small">V3</h2>
            </div>
          </div>
        </div>
      </div>
</code>```

Body:
I have tried to select css classes for visual effects through every row, so when I click to selected row's accordion element, every other elements supposed to collapse in other rows. Also, divs at the right columns cannot change with css class selector inside selected row

Appreciate for any help..

What I tried;

1)collapse every other accordion element when click any of the elements.

2)calling css classes while not collapsed

3)change the css class of the right column element when click the selected column element

.card{
    background-color: rgb(18, 18, 18);
    border-radius: 0px;
}

.card-header{
    padding: 0px 0px 4px 0px;
    border-bottom: 1px solid;
    color:  #2F312D;
    display: flex;
    flex-direction: column;
}

.expandable.collapsed .card-header.collapsed{
    filter: var(--filter-primary) ; /*DARK DEGIL LIGHT OLMALI*/
}

.mb-0{
    display: flex;
    justify-content: space-between;
}

.btn{
    padding: 0px;
}

.btn.btn-link{
    color: black;
    filter: var(--filter-tertiary-container);
    font: var(--headline-large);
    width: max-content;

}

.expandable{
    height: 250px;
}

.expandable.collapsed .btn.btn-link.collapsed{
    filter: var(--filter-tertiary);
    font: var(--headline-small);
}

.expand{
    color: black;
    cursor: pointer;
    float: right;
    width: 28px;
    height: 28px;
    border: 0.5px solid var(--tertiary-container);
    border-radius: 26px;
}

.expandIcon{
    content: "";
    background: url(icons/expand_more_down.png) no-repeat 0 0;
    background-position: center;
    color: var(--tertiary-container);

}

.expandable.collapsed .expand.expandIcon.collapsed{
    transform: rotate(90deg);
    filter: var(--filter-tertiary-container);

}

.card-body{
    padding: 4px 0px 0px 0px;
}

#collapseOne{
    padding: 0px;
}

/***middle right***/
.container.middle{
    padding-top: 110px ;
    z-index: 1;
}

.line{
    position: absolute;
    width: 100%;
    height: 0px;
    left: 325px;
    top: 415px;
    z-index: 0;
    border : 1px dashed #424940;
    transform: rotate(90deg);
}

.right{
    text-align: -webkit-center;
    z-index: 1;
}

h2{
    margin-top: 0;
    margin-bottom: 0;
}

.expandable.collapsed .lvlV.collapsed{
    width: 80px;
    height: 80px;
    background: linear-gradient(180deg, #424940 0%, #2F312D 100%);
    border: 1px solid #94F98F;
    box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px rgba(0, 0, 0, 0.3);
    border-radius: 25px;
    font: var(--headline-large);
}
.lvlV h2.collapsed{
    color: #94F98F;
}

.lvlV{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 71px;
    height: 71px;
    background: #2F312D;
    border: 0.5px solid #1A1C19;
    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px rgba(0, 0, 0, 0.3);
    border-radius: 25px;
}

.lvlV h2{
    color: #1A1C19;
}

                    <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne" >
                      Version 1
                    </button>

V1

                  <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo" >
                    Version 2
                  </button>

V2

                  <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree" >
                    Version 3
                  </button>

V3


来源: stackexchange

问:
Google charts dataTable crates paralel arrays inside
Im at coding the app to draw some charts from mysql base using XML
The charts is displayed but only with static statment add.Row.
When using ajax in Jquery statement add.Row from .each()
the data goes to paralel array and is not showing on charts

google.charts.load('current', {
  'packages': ['corechart']
});

google.charts.setOnLoadCallback(drawChart);

function drawChart() {
  var data = new google.visualization.DataTable();
  data.addColumn('date', 'czas', 'czas');
  data.addColumn('number', 'temp_max', 'tempmax');
  data.addColumn('number', 'temp_min', 'tempmin');
  data.addRow([new Date(2022, 10, 22), 10, 6]);
  data.addRow([new Date(2022, 10, 23), 18, 5]);
  data.addRow([new Date(2022, 10, 24), 2, -5]);

  //data = [['Czas'],['Temp'],]
  $.ajax({
    type: 'GET',
    url: 'https://ziemiecice.pl/?action=WeatherTempMaxMinXML',
    dataType: 'xml'
  }).done(function(xml) {
    //data.addRows([ ['22', 10]]);

    $(xml).find('dane').each(function() {
      czas = $(this).find('time').text();
      temp_max = parseFloat($(this).find('temp_max').text());
      temp_min = parseFloat($(this).find('temp_min').text());
      data.addRow([{
        v: new Date(czas)
      }, {
        v: temp_max
      }, {
        v: temp_min
      }]);
    });

    //return data;
    console.log(data);
  });

  var options = {
    title: 'Temperatury max i min',
    hAxis: {
      title: 'Czas',
      titleTextStyle: {
        color: '#666'
      }
    },
    vAxis: {
      minValue: 0
    },
    animation: {
      duration: 3000,
      easing: 'out',
      startup: true
    }
  };

  var chart = new google.visualization.
  AreaChart(document.getElementById('chart_div'));
  chart.draw(data, options);
}
```
<p>The console.log shows paralel arrays in dataTable
How to sort it out ?
The file is at: https://ziemiecice.pl/test.html</p>
<pre class="lang-js prettyprint-override"><code>Object {
  cq: null,
  bf: (3)\[…\],
  Wf: (25)\[…\],
  Br: null,
  cache: (3)\[…\],
  version: "0.6"
}
</code>```

The dataTable object display only data from cashe table :3 instead should shows data from Wf table

ContentLicense: CC BY-SA 4.0

Body:
Im at coding the app to draw some charts from mysql base using XML
The charts is displayed but only with static statment add.Row.
When using ajax in Jquery statement add.Row from .each()
the data goes to paralel array and is not showing on charts

google.charts.load('current', {
  'packages': ['corechart']
});

google.charts.setOnLoadCallback(drawChart);

function drawChart() {
  var data = new google.visualization.DataTable();
  data.addColumn('date', 'czas', 'czas');
  data.addColumn('number', 'temp_max', 'tempmax');
  data.addColumn('number', 'temp_min', 'tempmin');
  data.addRow([new Date(2022, 10, 22), 10, 6]);
  data.addRow([new Date(2022, 10, 23), 18, 5]);
  data.addRow([new Date(2022, 10, 24), 2, -5]);

  //data = [['Czas'],['Temp'],]
  $.ajax({
    type: 'GET',
    url: 'https://ziemiecice.pl/?action=WeatherTempMaxMinXML',
    dataType: 'xml'
  }).done(function(xml) {
    //data.addRows([ ['22', 10]]);

    $(xml).find('dane').each(function() {
      czas = $(this).find('time').text();
      temp_max = parseFloat($(this).find('temp_max').text());
      temp_min = parseFloat($(this).find('temp_min').text());
      data.addRow([{
        v: new Date(czas)
      }, {
        v: temp_max
      }, {
        v: temp_min
      }]);
    });

    //return data;
    console.log(data);
  });

  var options = {
    title: 'Temperatury max i min',
    hAxis: {
      title: 'Czas',
      titleTextStyle: {
        color: '#666'
      }
    },
    vAxis: {
      minValue: 0
    },
    animation: {
      duration: 3000,
      easing: 'out',
      startup: true
    }
  };

  var chart = new google.visualization.
  AreaChart(document.getElementById('chart_div'));
  chart.draw(data, options);
}

The console.log shows paralel arrays in dataTable
How to sort it out ?
The file is at: https://ziemiecice.pl/test.html

Object {
  cq: null,
  bf: (3)\[…\],
  Wf: (25)\[…\],
  Br: null,
  cache: (3)\[…\],
  version: "0.6"
}

The dataTable object display only data from cashe table :3 instead should shows data from Wf table


问:
How to remove inside of a string from a list of words that have start/end delimiter?
Looking to remove parts of string from the middle with predefined list of words that have a delimiter.

```<code>delimiter_begin = "#"
delimiter_end = "@"
remove_list = ["#ab", "O@"]
string = "abc ab . bb, cc O cbaO"
</code>```
```<code>
for s in remove_list:
    if delimiter_begin in s:
        replace_begin = s.replace(delimiter_begin, "")
        for e in remove_list:
            if delimiter_end in e:
                replace_end = e.replace(delimiter_end, "")
                string = re.sub(fr"(\b{replace_begin}\b).*(\b{replace_end}\b)", "", string)
                print(string)
</code>```
```<code>abc  cbaO
</code>```

This gets the desired output as but I am wondering if there is a better way of doing this?

Another problem arises when a regex special character should be parsed out. As example when replacing remove_list and string:

```<code>remove_list = ["#ab", "?@"]
string = "abc ab . bb, cc ? cba abc"
</code>```

I get a re.error: nothing to repeat. How can I escape these characters?

Body:
Looking to remove parts of string from the middle with predefined list of words that have a delimiter.

delimiter_begin = "#"
delimiter_end = "@"
remove_list = ["#ab", "O@"]
string = "abc ab . bb, cc O cbaO"

for s in remove_list:
    if delimiter_begin in s:
        replace_begin = s.replace(delimiter_begin, "")
        for e in remove_list:
            if delimiter_end in e:
                replace_end = e.replace(delimiter_end, "")
                string = re.sub(fr"(\b{replace_begin}\b).*(\b{replace_end}\b)", "", string)
                print(string)

abc  cbaO

This gets the desired output as but I am wondering if there is a better way of doing this?

Another problem arises when a regex special character should be parsed out. As example when replacing remove_list and string:

remove_list = ["#ab", "?@"]
string = "abc ab . bb, cc ? cba abc"

I get a re.error: nothing to repeat. How can I escape these characters?


问:
Invalid Reference Exception in Freemarker Template while running Junit test case
I have a Junit test case that mocks and returns a FTL. However I have a property "myPageTitle" in FTL and here is my junit and ftl

```<code>myPageTitle will be set dynamically from the controllers

FTL
----
"<title id="myId"><@spring.message "${myPageTitle}"</title>"

Junit
------
public void myJunit() throws Exception() {
   mockMvc.perform(....).andExpect(status().isOk()).andExpect(MockMvcResultMatchers.view().name("my-ftl"));

}
</code>```

When I run this junit, it throws the exception InvalidReferenceException. The following has evaluated null or missing (referring to the property myPageTitle)

Any advise on how can I set these values into the Junit?

Body:
I have a Junit test case that mocks and returns a FTL. However I have a property "myPageTitle" in FTL and here is my junit and ftl

myPageTitle will be set dynamically from the controllers

FTL
----
"<title id="myId"><@spring.message "${myPageTitle}"</title>"

Junit
------
public void myJunit() throws Exception() {
   mockMvc.perform(....).andExpect(status().isOk()).andExpect(MockMvcResultMatchers.view().name("my-ftl"));

}

When I run this junit, it throws the exception InvalidReferenceException. The following has evaluated null or missing (referring to the property myPageTitle)

Any advise on how can I set these values into the Junit?


问:
Is it possible to download a blob video using java?
I'm trying to download a blob video using java and selenium library.

```<code><video class="x1lliihq" src="blob:https://www.instagram.com/8eab0708-66d4-4b90-9a51-4b7d4fec8a9c" style="display: block;"></video>
</code>```

Is there any way to get the real video url ?

Body:
I'm trying to download a blob video using java and selenium library.

<video class="x1lliihq" src="blob:https://www.instagram.com/8eab0708-66d4-4b90-9a51-4b7d4fec8a9c" style="display: block;"></video>

Is there any way to get the real video url ?


问:
Android Jetpack Accompanist Permission request does not work
I have try to learn Android jetpack compose.

I am trying to use NotificationServiceListener with accompanist permission library, but it does not work correctly.

I have added the <service> element on AndroidManifest.xml, And the name of Listener class is same as a class name that mentioned in AndroidManifest.xml

I have no idea why it does not work.

Nothing happen even tap the button.  there is no any display to ask to user whether allow it despite launchPermissionRequest is invoked in onclick event.

```
<code>
// Listener Class
class MyListener : NotificationListenerService() {
    override fun onNotificationPosted(sbn: StatusBarNotification?) {
        super.onNotificationPosted(sbn)
        Log.i("Notification Listener", sbn!!.opPkg)
    }
}
</code>
```
```
<code>
// Main Activity Code
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            LineLight2Theme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colors.background
                ) {
                    Column(modifier = Modifier
                        .fillMaxWidth()
                        .fillMaxHeight(),
                            verticalArrangement = Arrangement.Center,
                            horizontalAlignment = Alignment.CenterHorizontally) {
                        BigButton()
                    }
                }
            }
        }
    }
}

@Preview(showBackground = true)
@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun BigButton() {
    val servicePermissionState = rememberPermissionState(permission = android.Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE)
    val listener = MyListener()
    var is_enable = remember { mutableStateOf(true)}
    val text = if (servicePermissionState.status.isGranted) "Enable" else "Disable"
    var color = if (is_enable.value) Color.DarkGray else Color.Red
    val context = LocalContext.current
    if (!servicePermissionState.status.isGranted) {
        color = Color.Red
    }
    Button(modifier= Modifier
        .size(width = 220.dp, height = 80.dp),
        colors=ButtonDefaults.buttonColors(backgroundColor = color), onClick = {
            if (servicePermissionState.status.isGranted) {
                is_enable.value = !is_enable.value
            } else {
                servicePermissionState.launchPermissionRequest()
            }
        }) {
        Text(text)
    }
}
</code>
```
```<code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.LineLight2"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.LineLight2">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
        <service android:name=".MyListener"
            android:exported="true"
            android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
            <intent-filter>
                <action android:name="android.service.notification.NotificationListenerService" />
            </intent-filter>
        </service>
    </application>

</manifest>
</code>```

Body:
I have try to learn Android jetpack compose.

I am trying to use NotificationServiceListener with accompanist permission library, but it does not work correctly.

I have added the <service> element on AndroidManifest.xml, And the name of Listener class is same as a class name that mentioned in AndroidManifest.xml

I have no idea why it does not work.

Nothing happen even tap the button.  there is no any display to ask to user whether allow it despite launchPermissionRequest is invoked in onclick event.

// Listener Class
class MyListener : NotificationListenerService() {
    override fun onNotificationPosted(sbn: StatusBarNotification?) {
        super.onNotificationPosted(sbn)
        Log.i("Notification Listener", sbn!!.opPkg)
    }
}

// Main Activity Code
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            LineLight2Theme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colors.background
                ) {
                    Column(modifier = Modifier
                        .fillMaxWidth()
                        .fillMaxHeight(),
                            verticalArrangement = Arrangement.Center,
                            horizontalAlignment = Alignment.CenterHorizontally) {
                        BigButton()
                    }
                }
            }
        }
    }
}

@Preview(showBackground = true)
@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun BigButton() {
    val servicePermissionState = rememberPermissionState(permission = android.Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE)
    val listener = MyListener()
    var is_enable = remember { mutableStateOf(true)}
    val text = if (servicePermissionState.status.isGranted) "Enable" else "Disable"
    var color = if (is_enable.value) Color.DarkGray else Color.Red
    val context = LocalContext.current
    if (!servicePermissionState.status.isGranted) {
        color = Color.Red
    }
    Button(modifier= Modifier
        .size(width = 220.dp, height = 80.dp),
        colors=ButtonDefaults.buttonColors(backgroundColor = color), onClick = {
            if (servicePermissionState.status.isGranted) {
                is_enable.value = !is_enable.value
            } else {
                servicePermissionState.launchPermissionRequest()
            }
        }) {
        Text(text)
    }
}

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.LineLight2"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.LineLight2">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
        <service android:name=".MyListener"
            android:exported="true"
            android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
            <intent-filter>
                <action android:name="android.service.notification.NotificationListenerService" />
            </intent-filter>
        </service>
    </application>

</manifest>


问:
Is it possible to print the label of the object instead the id in material ui DataGrid
So I have two tables in my database. I want a DataGrid UI to print all my columns except the categoryId I want to print a label instead (like in selection valueOptions) :

```<code>
const columns: GridColDef = [
    {
        "field": "title",
        "headerName": "Titel",
        "width": 350,
        "editable": true
    },
    {
        "field": "categoryId",
        "headerName": "Kategorie",
        "width": 250,
        "editable": true,
        "type": "singleSelect",
        "valueOptions": [
            {
                "value": "miv560972ynqzk9",
                "label": "stuff 1"
            },
            {
                "value": "1t7n08l9tfdwotn",
                "label": "stuff 2"
            },
        ]
    }
]

const rows: GridRowsProp = [
    {
        "categoryId": "miv560972ynqzk9",
        "title": "Lineare Algebra Hausaufga",
    },
    {
        "categoryId": "1t7n08l9tfdwotn",
        "title": "Test",
    },
]

</code>```

So I want something like this:

```<code>const rows: GridRowsProp = [
    {
        "categoryId": { value:"miv560972ynqzk9", label: "stuff1"},
        "title": "Lineare Algebra Hausaufga",
    },
    {
        "categoryId": { value: "1t7n08l9tfdwotn", label: "stuff2" },
        "title": "Test",
    },
]

</code>```

Body:
So I have two tables in my database. I want a DataGrid UI to print all my columns except the categoryId I want to print a label instead (like in selection valueOptions) :

const columns: GridColDef = [
    {
        "field": "title",
        "headerName": "Titel",
        "width": 350,
        "editable": true
    },
    {
        "field": "categoryId",
        "headerName": "Kategorie",
        "width": 250,
        "editable": true,
        "type": "singleSelect",
        "valueOptions": [
            {
                "value": "miv560972ynqzk9",
                "label": "stuff 1"
            },
            {
                "value": "1t7n08l9tfdwotn",
                "label": "stuff 2"
            },
        ]
    }
]

const rows: GridRowsProp = [
    {
        "categoryId": "miv560972ynqzk9",
        "title": "Lineare Algebra Hausaufga",
    },
    {
        "categoryId": "1t7n08l9tfdwotn",
        "title": "Test",
    },
]

So I want something like this:

const rows: GridRowsProp = [
    {
        "categoryId": { value:"miv560972ynqzk9", label: "stuff1"},
        "title": "Lineare Algebra Hausaufga",
    },
    {
        "categoryId": { value: "1t7n08l9tfdwotn", label: "stuff2" },
        "title": "Test",
    },
]


问:
Sourcemaps in wwwroot do not map to typescript source outside of it
I am running a C# app, using Typescript with gulpfile to provide the file to wwwroot

```<code>gulp.task('typescript', function () {
return gulp.src(paths.typescriptSrc, {sourcemaps : true})
    .pipe(tsProject().on('error', swallowError))
    .pipe(relativeSourcemapsSource({dest: paths.webroot + "js/"}))
    .pipe(gulp.dest(paths.webroot + "js/", {sourcemaps : '.'}));
</code>```

which looks OK, it's producing map and js files to wwwroot, with map file 'sources' arugment set to ["..\\src\\typescript\\file.ts"] and js file having //# sourceMappingURL=file.js.map comment. However, the breakpoints do not seem to work. Or Rather, when the sources argument is ..\\src\\typescript\\file.ts, it works (I can debug file.ts in src/typescript folder, but if it is in wwwroot/js subfolder and the sources argument is ..\\..\\src\\typescript\\file.ts (one lower), it doesnt work. I just don't know where to go from here, and maybe I'm not providing enough info for it.
I have put file server info to the c sharp Startup.cs:

```<code>      if (env.IsDevelopment())
        {
            app.UseFileServer(new FileServerOptions()
            {
                FileProvider = new PhysicalFileProvider(env.ContentRootPath),
            });
</code>```

and this executes fine

Has anybody built experienced this? Can I provide more details?

Body:
I am running a C# app, using Typescript with gulpfile to provide the file to wwwroot

gulp.task('typescript', function () {
return gulp.src(paths.typescriptSrc, {sourcemaps : true})
    .pipe(tsProject().on('error', swallowError))
    .pipe(relativeSourcemapsSource({dest: paths.webroot + "js/"}))
    .pipe(gulp.dest(paths.webroot + "js/", {sourcemaps : '.'}));

which looks OK, it's producing map and js files to wwwroot, with map file 'sources' arugment set to ["..\\src\\typescript\\file.ts"] and js file having //# sourceMappingURL=file.js.map comment. However, the breakpoints do not seem to work. Or Rather, when the sources argument is ..\\src\\typescript\\file.ts, it works (I can debug file.ts in src/typescript folder, but if it is in wwwroot/js subfolder and the sources argument is ..\\..\\src\\typescript\\file.ts (one lower), it doesnt work. I just don't know where to go from here, and maybe I'm not providing enough info for it.
I have put file server info to the c sharp Startup.cs:

      if (env.IsDevelopment())
        {
            app.UseFileServer(new FileServerOptions()
            {
                FileProvider = new PhysicalFileProvider(env.ContentRootPath),
            });

and this executes fine

Has anybody built experienced this? Can I provide more details?


问:
Multiple JOIN conditions with different operators in $lookup stage sub-pipeline
How to do below query using Spring Boot lookup operation?</p>
```<code>db.getCollection('doctor').aggregate([{ $lookup: {from: "doctor_supplementary_info",
      let: { doctorIdField: "$doctorId", doctorTypeField: "$doctorType" },
      pipeline: [{$match: {$expr: {$and: [{ $eq: ["$doctorId", "$$doctorIdField"]
                },{ $eq: [ "$doctorType", "$$doctorTypeField"]}] }}}],  as: "joined_results"
    }
  },
  {
    $unwind: { path: "$joined_results" }
  }
])
</code>```

Body:
How to do below query using Spring Boot lookup operation?

db.getCollection('doctor').aggregate([{ $lookup: {from: "doctor_supplementary_info",
      let: { doctorIdField: "$doctorId", doctorTypeField: "$doctorType" },
      pipeline: [{$match: {$expr: {$and: [{ $eq: ["$doctorId", "$$doctorIdField"]
                },{ $eq: [ "$doctorType", "$$doctorTypeField"]}] }}}],  as: "joined_results"
    }
  },
  {
    $unwind: { path: "$joined_results" }
  }
])


问:
How to use Quarkus to read data from Redis Stream?
Am trying to read data from Redis stream using Quarkus. But am unable to achieve it.Upon checking the Quarkus guide,stream is not available yet .Is there any other way that I could read data from Redis Stream using Quarkus

Using Redis API

```<code> @Startup
  void onStart(@Observes StartupEvent ev) {
    System.out.println("Stream");
    Redis.createClient(vertx)
        .connect()
        .onSuccess(connection -> {
          // use the connection
          System.out.println("Successfully connected = " + connection + " " + Thread.currentThread().getName());
          connection.handler(message -> {
            // do whatever you need to do with your message
            System.out.println("Message = " + message + " " + Thread.currentThread().getName());
          });
          connection.send(Request.cmd(Command.XRANGE).arg("test").arg("-").arg("+"))
              .onSuccess(res -> {
                System.out.println("Subscribed");
                System.out.println(res);
              });
        });
  }
</code>```

Body:
Am trying to read data from Redis stream using Quarkus. But am unable to achieve it.Upon checking the Quarkus guide,stream is not available yet .Is there any other way that I could read data from Redis Stream using Quarkus

Using Redis API

 @Startup
  void onStart(@Observes StartupEvent ev) {
    System.out.println("Stream");
    Redis.createClient(vertx)
        .connect()
        .onSuccess(connection -> {
          // use the connection
          System.out.println("Successfully connected = " + connection + " " + Thread.currentThread().getName());
          connection.handler(message -> {
            // do whatever you need to do with your message
            System.out.println("Message = " + message + " " + Thread.currentThread().getName());
          });
          connection.send(Request.cmd(Command.XRANGE).arg("test").arg("-").arg("+"))
              .onSuccess(res -> {
                System.out.println("Subscribed");
                System.out.println(res);
              });
        });
  }


问:
GitHub "Remote Repo" options do not exist in Xcode
I'm having a problem with the latest Xcode where I have already configured my GitHub account, and init the .git file, but I can't find any option to create/host my repository on GitHub. How do I fix this?


问:
How do I solve this error? x and y must be the same size
I am trying to plot a scatter plot of mean squared error with the order (degree) of polynomial regression to determine the best order.  But I'm getting an error 'x and y must be the same size'.

Below is my code. When I run it, I get an error message 'x and y must be the same size'.

features =["floors", "waterfront","lat" ,"bedrooms" ,"sqft_basement" ,"view" ,"bathrooms","sqft_living15","sqft_above","grade","sqft_living"]

X = df[features].values
Y = df['price'].values

```<code>order = [1,2,3,4,5,6,7,8]
y_mse = []
for n in order:
    p_model = PolynomialFeatures(degree = n)
    p_x = p_model.fit_transform(X)
    p_model.fit(p_x, Y)
    reg_model = LinearRegression()
    reg_model.fit(p_x, Y)
    yhat = reg_model.predict(p_x)
    y_mse.append(mean_squared_error(Y, yhat, squared = False))
    plt.scatter(order, y_mse, color = "green")
    plt.plot(order, y_mse, color = "red")

</code>```

Body:
I am trying to plot a scatter plot of mean squared error with the order (degree) of polynomial regression to determine the best order.  But I'm getting an error 'x and y must be the same size'.

Below is my code. When I run it, I get an error message 'x and y must be the same size'.

features =["floors", "waterfront","lat" ,"bedrooms" ,"sqft_basement" ,"view" ,"bathrooms","sqft_living15","sqft_above","grade","sqft_living"]

X = df[features].values
Y = df['price'].values

order = [1,2,3,4,5,6,7,8]
y_mse = []
for n in order:
    p_model = PolynomialFeatures(degree = n)
    p_x = p_model.fit_transform(X)
    p_model.fit(p_x, Y)
    reg_model = LinearRegression()
    reg_model.fit(p_x, Y)
    yhat = reg_model.predict(p_x)
    y_mse.append(mean_squared_error(Y, yhat, squared = False))
    plt.scatter(order, y_mse, color = "green")
    plt.plot(order, y_mse, color = "red")


问:
EasyAdmin CRUD edit using Doctrine Proxy and failing
Our stack is PHP 8.1, Symfony 6.1 and EasyAdmin 4.4, the context of the error is we are trying to edit an entity record through normal EA CRUD edit, the error when I try to edit the record is:

```<code>15:41:19.128 critical   Uncaught PHP Exception ErrorException: "User Notice: Undefined property: Proxies\__CG__\App\Entity\Sys\Auth\RoleClass::$ea_form_panel_01GKPKZ6CGWJ4FX3Q4J5C6C961" at /opt/app/var/cache/dev/doctrine/orm/Proxies/__CG__AppEntitySysAuthRoleClass.php line 101
request Show context Hide trace
{▼
  /opt/app/var/cache/dev/doctrine/orm/Proxies/__CG__AppEntitySysAuthRoleClass.php:101 {▶}
  /opt/app/vendor/symfony/property-access/PropertyAccessor.php:426 {▶}
  /opt/app/vendor/symfony/property-access/PropertyAccessor.php:115 {▶}
  /opt/app/vendor/easycorp/easyadmin-bundle/src/Field/Configurator/CommonPreConfigurator.php:47 {▶}
  /opt/app/vendor/easycorp/easyadmin-bundle/src/Factory/FieldFactory.php:100 {▶}
  /opt/app/vendor/easycorp/easyadmin-bundle/src/Factory/EntityFactory.php:43 {▶}
  /opt/app/vendor/easycorp/easyadmin-bundle/src/Controller/AbstractCrudController.php:218 {▶}
  /opt/app/vendor/symfony/http-kernel/HttpKernel.php:163 {▶}
  /opt/app/vendor/symfony/http-kernel/HttpKernel.php:75 {▶}
  /opt/app/vendor/symfony/http-kernel/Kernel.php:202 {▶}
  /opt/app/public/index.php:30 {▶}
}
</code>```

What appears to be happening is the following:

The Fields returned from configureFields() (in edit page mode) include Panel Fields

The entity instance is a Proxy and not a 'real class'.  I can't replicate this anywhere else, in all other cases (i.e. all edit views on all other entities I see a 'real class' and not a Proxy), in fact this error only occurs on specific instances of this entity type, most are fine, just 1 record causes this issue

Since the entity instance is a Doctrine Proxy, the PropertyAccessor.php works differently because $this->getReadInfo($class, $property); treats Proxies differently as they have magic __get functions (it seems to assume that the property exists in ReflectionExtractor.getReadInfo on line 293 (I'm clearly missing something):

```<code>        if ($allowMagicGet && $reflClass->hasMethod('__get') && ($reflClass->getMethod('__get')->getModifiers() & $this->methodReflectionFlags)) {
            return new PropertyReadInfo(PropertyReadInfo::TYPE_PROPERTY, $property, PropertyReadInfo::VISIBILITY_PUBLIC, false, false);
        }
</code>```

I am completely stumped as to why $context->getEntity()->getInstance() in AbstractCrudController::edit is returning a Doctrine Proxy in this very specific case (I've never seen this happen before).  Tracing the code it feels that this should never be a Proxy (or you can't use Fields that don't exist on the Entity like Panels and Tabs).

Body:
Our stack is PHP 8.1, Symfony 6.1 and EasyAdmin 4.4, the context of the error is we are trying to edit an entity record through normal EA CRUD edit, the error when I try to edit the record is:

15:41:19.128 critical   Uncaught PHP Exception ErrorException: "User Notice: Undefined property: Proxies\__CG__\App\Entity\Sys\Auth\RoleClass::$ea_form_panel_01GKPKZ6CGWJ4FX3Q4J5C6C961" at /opt/app/var/cache/dev/doctrine/orm/Proxies/__CG__AppEntitySysAuthRoleClass.php line 101
request Show context Hide trace
{▼
  /opt/app/var/cache/dev/doctrine/orm/Proxies/__CG__AppEntitySysAuthRoleClass.php:101 {▶}
  /opt/app/vendor/symfony/property-access/PropertyAccessor.php:426 {▶}
  /opt/app/vendor/symfony/property-access/PropertyAccessor.php:115 {▶}
  /opt/app/vendor/easycorp/easyadmin-bundle/src/Field/Configurator/CommonPreConfigurator.php:47 {▶}
  /opt/app/vendor/easycorp/easyadmin-bundle/src/Factory/FieldFactory.php:100 {▶}
  /opt/app/vendor/easycorp/easyadmin-bundle/src/Factory/EntityFactory.php:43 {▶}
  /opt/app/vendor/easycorp/easyadmin-bundle/src/Controller/AbstractCrudController.php:218 {▶}
  /opt/app/vendor/symfony/http-kernel/HttpKernel.php:163 {▶}
  /opt/app/vendor/symfony/http-kernel/HttpKernel.php:75 {▶}
  /opt/app/vendor/symfony/http-kernel/Kernel.php:202 {▶}
  /opt/app/public/index.php:30 {▶}
}

What appears to be happening is the following:

The Fields returned from configureFields() (in edit page mode) include Panel Fields

The entity instance is a Proxy and not a 'real class'.  I can't replicate this anywhere else, in all other cases (i.e. all edit views on all other entities I see a 'real class' and not a Proxy), in fact this error only occurs on specific instances of this entity type, most are fine, just 1 record causes this issue

Since the entity instance is a Doctrine Proxy, the PropertyAccessor.php works differently because $this->getReadInfo($class, $property); treats Proxies differently as they have magic __get functions (it seems to assume that the property exists in ReflectionExtractor.getReadInfo on line 293 (I'm clearly missing something):

        if ($allowMagicGet && $reflClass->hasMethod('__get') && ($reflClass->getMethod('__get')->getModifiers() & $this->methodReflectionFlags)) {
            return new PropertyReadInfo(PropertyReadInfo::TYPE_PROPERTY, $property, PropertyReadInfo::VISIBILITY_PUBLIC, false, false);
        }

I am completely stumped as to why $context->getEntity()->getInstance() in AbstractCrudController::edit is returning a Doctrine Proxy in this very specific case (I've never seen this happen before).  Tracing the code it feels that this should never be a Proxy (or you can't use Fields that don't exist on the Entity like Panels and Tabs).


问:
How to retrive image from django database?
I saved image in database, there are multiple images and i want to retrive it in my website.

my image is stored in static folder inside app folder that is card/static/images.

my images is showing when i enter link http://127.0.0.1:8000/images/p.jpeg

this is my urls.py
`

```<code>
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('card.urls')),
    path('index/', include('card.urls')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
</code>```

this is my models.py

```<code>class dish(models.Model):
    dish_name = models.CharField(max_length=255)
    dish_size = models.CharField(max_length=7)
    dish_price = models.IntegerField()
    dish_description = models.CharField(max_length=255)
    dish_image = models.ImageField()
    dish_date = models.DateField()
</code>```

this is my index.html file

```<code><img src="{{ request.dish.dish_image.url }}" height="100px" width="100px">
</code>```

this is my setting.py

```<code>
STATIC_URL = 'static/'
MEDIA_URL = 'images/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

MEDIA_ROOT = os.path.join(BASE_DIR, 'card/static/images')
</code>```

`
this is my card/urls.py

```<code>urlpatterns = [
    path('', views.index),
    path('/', views.index),
    path('/index', views.index),
    path('index/', views.index),
    path('index', views.index),
]
</code>```

this is my views file

```<code>def index(request):
if request.method == "POST":
    dish_name = request.POST.get('dish_name')
    dish_size = request.POST.get('dish_size')
    dish_price = request.POST.get('dish_price')
    dish_description = request.POST.get('dish_description')
    dish_image = request.POST.get('dish_image')
    item = dish(dish_name = dish_name, dish_size = dish_size, dish_price = dish_price, dish_description = dish_description, dish_image = dish_image, dish_date = datetime.today())
    item.save()
return render(request, "card/index.html")
</code>```

Body:
I saved image in database, there are multiple images and i want to retrive it in my website.

my image is stored in static folder inside app folder that is card/static/images.

my images is showing when i enter link http://127.0.0.1:8000/images/p.jpeg

this is my urls.py
`

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('card.urls')),
    path('index/', include('card.urls')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

this is my models.py

class dish(models.Model):
    dish_name = models.CharField(max_length=255)
    dish_size = models.CharField(max_length=7)
    dish_price = models.IntegerField()
    dish_description = models.CharField(max_length=255)
    dish_image = models.ImageField()
    dish_date = models.DateField()

this is my index.html file

this is my setting.py

STATIC_URL = 'static/'
MEDIA_URL = 'images/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

MEDIA_ROOT = os.path.join(BASE_DIR, 'card/static/images')

`
this is my card/urls.py

urlpatterns = [
    path('', views.index),
    path('/', views.index),
    path('/index', views.index),
    path('index/', views.index),
    path('index', views.index),
]

this is my views file

def index(request):
if request.method == "POST":
    dish_name = request.POST.get('dish_name')
    dish_size = request.POST.get('dish_size')
    dish_price = request.POST.get('dish_price')
    dish_description = request.POST.get('dish_description')
    dish_image = request.POST.get('dish_image')
    item = dish(dish_name = dish_name, dish_size = dish_size, dish_price = dish_price, dish_description = dish_description, dish_image = dish_image, dish_date = datetime.today())
    item.save()
return render(request, "card/index.html")


问:
Mapbox Hover with React
I am having trouble getting the hover functionality to work with mapbox using React JS.

This code is taken from the Mapbox documentation found here Mapbox Documentation hover and I have just substituted in my data.

My code is the following and there is a snippet of the JSON data below that.

I have set up a sandbox environment here -Hover Sandbox

```<code>        mapboxgl.accessToken =
      "pk.eyJ1IjoicGJyb2NrbWFubiIsImEiOiJjajgxbnlqbGg2enR4MnhxbXllaHYzOGNzIn0.mA9mk90HM6ePh0gQq_55yw";

    const HoverMap = () => {
      const mapContainer = useRef();
      const [map, setMap] = useState(undefined);
      const zoom = 12.2;

      useEffect(() => {
        // Creating the map
        setMap(
          new mapboxgl.Map({
            container: mapContainer.current,
            style: "mapbox://styles/mapbox/streets-v12",
            center: [151.89, -33.830348],
            zoom: 7,
          })
        );
      }, []);

let hoveredStateId = null;
      useEffect(() => {
        if (typeof map === "undefined") return;
        map.on("load", () => {
          map.addSource("RandwickCityCouncil", {
            type: "geojson",
            data: RandwickCC,
          });
          map.addLayer({
            id: "RandwickCityCouncil-fills",
            type: "fill",
            source: "RandwickCityCouncil",
            layout: {},
            paint: {
              "fill-color": "#627BC1",
              "fill-opacity": [
                "case",
                ["boolean", ["feature-state", "hover"], false],
                1,
                0.2,
              ],
            },
          });
          map.addLayer({
            id: "RandwickCityCouncil-outline",
            type: "line",
            source: "RandwickCityCouncil",
            layout: {},
            paint: {
              "line-color": "#f50202",
              "line-width": 2,
            },
          });

          // Hover effect

          map.on("mousemove", "RandwickCityCouncil-fills", (e) => {
            if (e.features.length > 0) {
              if (hoveredStateId !== null) {
                map.setFeatureState(
                  { source: "RandwickCityCouncil", id: hoveredStateId },
                  { hover: false }
                );
              }
              hoveredStateId = e.features[0].id;
              map.setFeatureState(
                { source: "RandwickCityCouncil", id: hoveredStateId },
                { hover: true }
              );
            }
          });

          map.on("mouseleave", "RandwickCityCouncil-fills", () => {
            if (hoveredStateId !== null) {
              map.setFeatureState(
                { source: "RandwickCityCouncil", id: hoveredStateId },
                { hover: false }
              );
            }
            hoveredStateId = null;
          });
        });
      }, [map]);

      return (
        <div>
          {/* <MapToolbar> Map Toolbar </MapToolbar> */}
          <div className="mapbox" ref={mapContainer} />
        </div>
      );
    };

    export default HoverMap;
</code>```

The map renders and displays the opaque fill (0.2) but when I hover with the mouse it doesn't transition to a fill of (1).

My JSON data looks like this.

```<code>    {
  "type": "FeatureCollection",
  "name": "RandwickCityCouncil",
  "crs": {
    "type": "name",
    "properties": { "name": "urn:ogc:def:crs:EPSG::4283" }
  },
  "features": [
    {
      "type": "Feature",
      "properties": {
        "csId": "RCC-20221116103310",
        "cadid": "108012496",
        "lganame": "RANDWICK",
        "councilnam": "RANDWICK CITY COUNCIL",
        "abscode": 6550.0,
        "supplydate": "2022-11-16"
      },
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
          [
            [
              [151.237223263119546, -33.890750241364117],
              [151.237312069267318, -33.890752670602645],
              [151.237401162262444, -33.890752374791312],
              [151.237490291113488, -33.890749344966139],
              [151.237579204829018, -33.890743625947039],
              [151.237667643453619, -33.890735199806031],....
</code>```

Title: Mapbox Hover with React

Body:
I am having trouble getting the hover functionality to work with mapbox using React JS.

This code is taken from the Mapbox documentation found here Mapbox Documentation hover and I have just substituted in my data.

My code is the following and there is a snippet of the JSON data below that.

I have set up a sandbox environment here -Hover Sandbox

        mapboxgl.accessToken =
      "pk.eyJ1IjoicGJyb2NrbWFubiIsImEiOiJjajgxbnlqbGg2enR4MnhxbXllaHYzOGNzIn0.mA9mk90HM6ePh0gQq_55yw";

    const HoverMap = () => {
      const mapContainer = useRef();
      const [map, setMap] = useState(undefined);
      const zoom = 12.2;

      useEffect(() => {
        // Creating the map
        setMap(
          new mapboxgl.Map({
            container: mapContainer.current,
            style: "mapbox://styles/mapbox/streets-v12",
            center: [151.89, -33.830348],
            zoom: 7,
          })
        );
      }, []);

let hoveredStateId = null;
      useEffect(() => {
        if (typeof map === "undefined") return;
        map.on("load", () => {
          map.addSource("RandwickCityCouncil", {
            type: "geojson",
            data: RandwickCC,
          });
          map.addLayer({
            id: "RandwickCityCouncil-fills",
            type: "fill",
            source: "RandwickCityCouncil",
            layout: {},
            paint: {
              "fill-color": "#627BC1",
              "fill-opacity": [
                "case",
                ["boolean", ["feature-state", "hover"], false],
                1,
                0.2,
              ],
            },
          });
          map.addLayer({
            id: "RandwickCityCouncil-outline",
            type: "line",
            source: "RandwickCityCouncil",
            layout: {},
            paint: {
              "line-color": "#f50202",
              "line-width": 2,
            },
          });

          // Hover effect

          map.on("mousemove", "RandwickCityCouncil-fills", (e) => {
            if (e.features.length > 0) {
              if (hoveredStateId !== null) {
                map.setFeatureState(
                  { source: "RandwickCityCouncil", id: hoveredStateId },
                  { hover: false }
                );
              }
              hoveredStateId = e.features[0].id;
              map.setFeatureState(
                { source: "RandwickCityCouncil", id: hoveredStateId },
                { hover: true }
              );
            }
          });

          map.on("mouseleave", "RandwickCityCouncil-fills", () => {
            if (hoveredStateId !== null) {
              map.setFeatureState(
                { source: "RandwickCityCouncil", id: hoveredStateId },
                { hover: false }
              );
            }
            hoveredStateId = null;
          });
        });
      }, [map]);

      return (

          {/* <MapToolbar> Map Toolbar </MapToolbar> */}

      );
    };

    export default HoverMap;

The map renders and displays the opaque fill (0.2) but when I hover with the mouse it doesn't transition to a fill of (1).

My JSON data looks like this.

    {
  "type": "FeatureCollection",
  "name": "RandwickCityCouncil",
  "crs": {
    "type": "name",
    "properties": { "name": "urn:ogc:def:crs:EPSG::4283" }
  },
  "features": [
    {
      "type": "Feature",
      "properties": {
        "csId": "RCC-20221116103310",
        "cadid": "108012496",
        "lganame": "RANDWICK",
        "councilnam": "RANDWICK CITY COUNCIL",
        "abscode": 6550.0,
        "supplydate": "2022-11-16"
      },
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
          [
            [
              [151.237223263119546, -33.890750241364117],
              [151.237312069267318, -33.890752670602645],
              [151.237401162262444, -33.890752374791312],
              [151.237490291113488, -33.890749344966139],
              [151.237579204829018, -33.890743625947039],
              [151.237667643453619, -33.890735199806031],....


问:
Flutter: About Firebase
I have a question, do I need to have a list of data(for example: list of toDoTask) even though I can do CRUD operation with Firebase database?

And how can I display the data inside database in listview builder? Do I need to put itemcount?

Title: Flutter: About Firebase


问:
Can not change dictionary of com.apple.configuration.managed
I am trying to change the value of for a key in the dictionary 'com.apple.configuration.managed' inside UserDefaults with Swift 5

This is my code:

```<code>if let dict = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"){
        var newDict = dict
        newDict["gatewayConfig"] = "Test123"
        do{
          let data = try NSKeyedArchiver.archivedData(withRootObject: newDict, requiringSecureCoding: true)
          UserDefaults.standard.set(data, forKey: "com.apple.configuration.managed")
          //UserDefaults.standard.setValue(["gatewayConfig":"Test123"], forKey: "com.apple.configuration.managed")
          UserDefaults.standard.set(object: newDict, forKey: "com.apple.configuration.managed")
          //UserDefaults.standard.setValue(data, forKey: "com.apple.configuration.managed")
          UserDefaults.standard.synchronize()
          let dict2 = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed")
print("New value for gatewayConfig: \(dict2)")

        }
catch {
          print("failed to archive dictionary")
        }
</code>```

When I print the value it still shows the old value and not "Test123". I tried alternative solutions which are commented out yet none of them work.
It does not update the value.
What should I do?

Body:
I am trying to change the value of for a key in the dictionary 'com.apple.configuration.managed' inside UserDefaults with Swift 5

This is my code:

if let dict = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"){
        var newDict = dict
        newDict["gatewayConfig"] = "Test123"
        do{
          let data = try NSKeyedArchiver.archivedData(withRootObject: newDict, requiringSecureCoding: true)
          UserDefaults.standard.set(data, forKey: "com.apple.configuration.managed")
          //UserDefaults.standard.setValue(["gatewayConfig":"Test123"], forKey: "com.apple.configuration.managed")
          UserDefaults.standard.set(object: newDict, forKey: "com.apple.configuration.managed")
          //UserDefaults.standard.setValue(data, forKey: "com.apple.configuration.managed")
          UserDefaults.standard.synchronize()
          let dict2 = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed")
print("New value for gatewayConfig: \(dict2)")

        }
catch {
          print("failed to archive dictionary")
        }

When I print the value it still shows the old value and not "Test123". I tried alternative solutions which are commented out yet none of them work.
It does not update the value.
What should I do?


问:
Perceptron Training Issues
I am trying to build a simple perceptron. Right now I am just trying to find the weight values for the training data set to make sure it is working, but it will not converge no matter how many epochs I use.

here's the code:

`

```<code>var inputs = [];
inputs[0] = [15, 30, 1];
inputs[1] = [45, 90, -1];
inputs[2] = [64, 120, -1];
inputs[3] = [21, 40, 1];
inputs[4] = [9, 18, 1];

var weights = [0,0];

var epochs = 100;

var lRate = 0.1;

var bias = 12;

function weighted_sum(inputs, weights)
{
    var products = [];
    var weightedSum = 0;

    for (var i = 0; i < weights.length; i++)
    {
        products.push(inputs[i]*weights[i]);
    }
    for (var i = 0; i < products.length; i++)
    {
        weightedSum += products[i];
    }
    return weightedSum;
}

function activate(weightedSum)
{
    if (weightedSum >= 0)
    {
        return 1;
    }
    else
    {
        return -1;
    }
}

function adjust(error, weights, input)
{
    if (error !== 0)
    {
        for (var i = 0; i < weights.length; i++)
        {
            weights[i] += lRate * error * input[i];
        }

        bias += lRate * error;
    }
}

function train(inputs, weights, epochs)
{

        for (var n = 0; n < epochs; n++)
        {
            for (var i = 0; i < inputs.length; i++)
            {
                var set = inputs[i];

                var weightedSum = weighted_sum(set, weights);
                var result = activate(weightedSum);
                var target = set[2];

                var error = target - result;

                adjust(error, weights, set);

                console.log("result: "+ result + " target: " + target + " error: " + error + " weights: " + weights);
            }
            for (i = inputs.length; i > 0; i--)
            {
                var set = inputs[i];

                var weightedSum = weighted_sum(set, weights);
                var result = activate(weightedSum);
                var target = set[2];

                var error = target - result;

                adjust(error, weights, set);

                console.log("result: "+ result + " target: " + target + " error: " + error + " weights: " + weights);
            }

        }

}

train(inputs, weights, epochs);
console.log(weights);
</code>```

`
Any help is appreciated, with my problem, or just general improvements. Thanks!

Title: Perceptron Training Issues

Body:
I am trying to build a simple perceptron. Right now I am just trying to find the weight values for the training data set to make sure it is working, but it will not converge no matter how many epochs I use.

here's the code:

`

var inputs = [];
inputs[0] = [15, 30, 1];
inputs[1] = [45, 90, -1];
inputs[2] = [64, 120, -1];
inputs[3] = [21, 40, 1];
inputs[4] = [9, 18, 1];

var weights = [0,0];

var epochs = 100;

var lRate = 0.1;

var bias = 12;

function weighted_sum(inputs, weights)
{
    var products = [];
    var weightedSum = 0;

    for (var i = 0; i < weights.length; i++)
    {
        products.push(inputs[i]*weights[i]);
    }
    for (var i = 0; i < products.length; i++)
    {
        weightedSum += products[i];
    }
    return weightedSum;
}

function activate(weightedSum)
{
    if (weightedSum >= 0)
    {
        return 1;
    }
    else
    {
        return -1;
    }
}

function adjust(error, weights, input)
{
    if (error !== 0)
    {
        for (var i = 0; i < weights.length; i++)
        {
            weights[i] += lRate * error * input[i];
        }

        bias += lRate * error;
    }
}

function train(inputs, weights, epochs)
{

        for (var n = 0; n < epochs; n++)
        {
            for (var i = 0; i < inputs.length; i++)
            {
                var set = inputs[i];

                var weightedSum = weighted_sum(set, weights);
                var result = activate(weightedSum);
                var target = set[2];

                var error = target - result;

                adjust(error, weights, set);

                console.log("result: "+ result + " target: " + target + " error: " + error + " weights: " + weights);
            }
            for (i = inputs.length; i > 0; i--)
            {
                var set = inputs[i];

                var weightedSum = weighted_sum(set, weights);
                var result = activate(weightedSum);
                var target = set[2];

                var error = target - result;

                adjust(error, weights, set);

                console.log("result: "+ result + " target: " + target + " error: " + error + " weights: " + weights);
            }

        }

}

train(inputs, weights, epochs);
console.log(weights);

`
Any help is appreciated, with my problem, or just general improvements. Thanks!


问:
Unexplained behavior of round() with Decimal type
Using Python 3.9.9:

```<code>>>> from decimal import Decimal, Context, ROUND_HALF_UP
>>> round( Decimal( '4.605', context=Context( rounding=ROUND_HALF_UP ) ), 2 )
Decimal('4.60')
</code>```

With ROUND_HALF_UP, shouldn't the above result be 4.61?

Am I misusing or misunderstanding the documentation for ROUND_HALF_UP or the documentation for constructing a Decimal with Context?

Body:
Using Python 3.9.9:

>>> from decimal import Decimal, Context, ROUND_HALF_UP
>>> round( Decimal( '4.605', context=Context( rounding=ROUND_HALF_UP ) ), 2 )
Decimal('4.60')

With ROUND_HALF_UP, shouldn't the above result be 4.61?

Am I misusing or misunderstanding the documentation for ROUND_HALF_UP or the documentation for constructing a Decimal with Context?


问:
Dynamic update open-street-map position mark in plotly.graph_objects in python ( dash )
In the dash application, I have a map displayed with the center in my position and on it I have a point (mark) in the center again as my position. However, I need to dynamically change my position on the map.
The map itself changes its center without problems, but the point (marker) does not, as if it is anchored in its original position and does not move to a new position (the new center of the map).
Here is a simple code that shows it nicely.  After running it, the map is redrawn every 2 seconds as I want. But the point remains in the last-origial position..... Does anyone know what I'm doing wrong?

```<code>import random
import dash
from dash import dcc,html
from dash.dependencies import Input, Output
import plotly.graph_objects as go

def get_fig():
    # random position as center
    lat = 48.8 + 1/random.randrange(300, 800)
    lon = 20.1+ 1/random.randrange(300, 800)

    fig = go.Figure()
    # blue point - should be in center of map , vhy is not ?
    fig.add_trace(
            go.Scattermapbox(
                lat=[lat],
                lon=[lon],
                mode="markers",
                marker=go.scattermapbox.Marker(size=20),
            )
        )

    # open street map with center at lat:lon
    fig.update_layout(
            height=552,
            width=640,
            margin={"r": 2, "t": 2, "b": 2, "l": 2},
            autosize=True,
            mapbox=dict(style="open-street-map", center=dict(lat=lat, lon=lon), zoom=16),
        )
    return fig

app = dash.Dash()
@app.callback(
    Output("graph", "figure"),
    Input("my_interval", "n_intervals"))
def update_bar_chart(dummy):
    return get_fig()

app.layout = html.Div([
    dcc.Graph(id = "graph"),
    dcc.Interval(id="my_interval", interval=2000, n_intervals=0, disabled=False),
])

app.run_server(debug=True, use_reloader=False)

</code>```

I use python 3.9 ,  plotly version is 5.11.0 and dash version is 2.7.0

I've tried several different ways, but they all fail in the same way.

Body:
In the dash application, I have a map displayed with the center in my position and on it I have a point (mark) in the center again as my position. However, I need to dynamically change my position on the map.
The map itself changes its center without problems, but the point (marker) does not, as if it is anchored in its original position and does not move to a new position (the new center of the map).
Here is a simple code that shows it nicely.  After running it, the map is redrawn every 2 seconds as I want. But the point remains in the last-origial position..... Does anyone know what I'm doing wrong?

import random
import dash
from dash import dcc,html
from dash.dependencies import Input, Output
import plotly.graph_objects as go

def get_fig():
    # random position as center
    lat = 48.8 + 1/random.randrange(300, 800)
    lon = 20.1+ 1/random.randrange(300, 800)

    fig = go.Figure()
    # blue point - should be in center of map , vhy is not ?
    fig.add_trace(
            go.Scattermapbox(
                lat=[lat],
                lon=[lon],
                mode="markers",
                marker=go.scattermapbox.Marker(size=20),
            )
        )

    # open street map with center at lat:lon
    fig.update_layout(
            height=552,
            width=640,
            margin={"r": 2, "t": 2, "b": 2, "l": 2},
            autosize=True,
            mapbox=dict(style="open-street-map", center=dict(lat=lat, lon=lon), zoom=16),
        )
    return fig

app = dash.Dash()
@app.callback(
    Output("graph", "figure"),
    Input("my_interval", "n_intervals"))
def update_bar_chart(dummy):
    return get_fig()

app.layout = html.Div([
    dcc.Graph(id = "graph"),
    dcc.Interval(id="my_interval", interval=2000, n_intervals=0, disabled=False),
])

app.run_server(debug=True, use_reloader=False)

I use python 3.9 ,  plotly version is 5.11.0 and dash version is 2.7.0

I've tried several different ways, but they all fail in the same way.


问:
DepthwiseConv2D vs SeparableConv2D vs Groups
How do conv2d groups differ from Depthwise and Separable convolutions ?

DepthwiseConv2D: https://keras.io/api/layers/convolution_layers/depthwise_convolution2d/

SeparableConv2D: https://keras.io/api/layers/convolution_layers/separable_convolution2d/

Groups in Conv2D: https://keras.io/api/layers/convolution_layers/convolution2d/

I didn't find any schema or article to understand in what they differs mostly.


问:
Laravel, Add conditionable on every object
Is there any chance to having ->when() or ->unless() on any kind of objects in laravel?
I mean something that acts like following:

$object = wrap($object)->when($condition===true,function($object){
   $object->changeSomething();
   return $object;
});/....
```


问:
pyqt / is there any way to change options for all keySequenceEdit boxes?
i have created 4 QKeySequenceEdits and setCleatButtonEnabled(True) for all of the four but i have to set each of the edits manually. is there an alternative command that can set every QKeySequenceEdit?

```<code>Pyqt.QKeySequenceEdit.setClearButtonEnabled(True)
</code>```

something like this would be nice.

```<code>from PyQt6 import QtCore, QtWidgets
from PyQt6.QtCore import *
from PyQt6.QtWidgets import *
from PyQt6 import uic
import sys

class MainWindow(QDialog):

    def __init__(self):
        super().__init__()
        uic.loadUi("test.ui",self)

        self.keySequenceEdit.setClearButtonEnabled(True)
        self.keySequenceEdit_2.setClearButtonEnabled(True)
        self.keySequenceEdit_3.setClearButtonEnabled(True)
        self.keySequenceEdit_4.setClearButtonEnabled(True)

if __name__ == "__main__":

    app = QApplication(sys.argv)

    mainwindow = MainWindow()
    mainwindow.show()
    app.exec()
</code>```

Body:
i have created 4 QKeySequenceEdits and setCleatButtonEnabled(True) for all of the four but i have to set each of the edits manually. is there an alternative command that can set every QKeySequenceEdit?

Pyqt.QKeySequenceEdit.setClearButtonEnabled(True)

something like this would be nice.

from PyQt6 import QtCore, QtWidgets
from PyQt6.QtCore import *
from PyQt6.QtWidgets import *
from PyQt6 import uic
import sys

class MainWindow(QDialog):

    def __init__(self):
        super().__init__()
        uic.loadUi("test.ui",self)

        self.keySequenceEdit.setClearButtonEnabled(True)
        self.keySequenceEdit_2.setClearButtonEnabled(True)
        self.keySequenceEdit_3.setClearButtonEnabled(True)
        self.keySequenceEdit_4.setClearButtonEnabled(True)

if __name__ == "__main__":

    app = QApplication(sys.argv)

    mainwindow = MainWindow()
    mainwindow.show()
    app.exec()


问:
rsyslog include a date substring in a string value
I feel like there's something simple staring at me that I'm missing on this but have been through the docs several times and haven't found a way to include the date in a string.

Here is my working custom rsyslog config shipping logs into elastic:

```<code>module(load="imfile" PollingInterval="10")
module(load="omelasticsearch")

input(type="imfile"
      persistStateInterval="10"
      file="/var/log/myapp/myapp.log"
      tag="my_app_log")

if ($syslogtag == "my_app_log") then {

      action(type="omelasticsearch"
          server=["172.x.x.x", "172.x.x.x", "172.x.x.x"]
          serverport="9200"
          searchIndex="app-logs"
          )
      stop
  }
</code>```

I'd like to append a date string to the name of the searchIndex and tried using a template:

```<code>module(load="imfile" PollingInterval="10")
module(load="omelasticsearch")

template(name="string_template" type="string" string="app-logs-$now")

input(type="imfile"
      persistStateInterval="10"
      file="/var/log/myapp/myapp.log"
      tag="my_app_log")

if ($syslogtag == "my_app_log") then {

      action(type="omelasticsearch"
          server=["172.x.x.x", "172.x.x.x", "172.x.x.x"]
          serverport="9200"
          searchIndex="string_template" <-- (results in an index in elasticsearch called string_template)
          )
      stop
  }
</code>```

Then the same as above but without the quotes like I would have expected when specifying a variable rather than a string:

```<code>module(load="imfile" PollingInterval="10")
module(load="omelasticsearch")

template(name="string_template" type="string" string="app-logs-$now")

input(type="imfile"
      persistStateInterval="10"
      file="/var/log/myapp/myapp.log"
      tag="my_app_log")

if ($syslogtag == "my_app_log") then {

      action(type="omelasticsearch"
          server=["172.x.x.x", "172.x.x.x", "172.x.x.x"]
          serverport="9200"
          searchIndex=string_template <-- (does nothing, no index created and no errors in syslog)
          )
      stop
  }
</code>```

To troubleshoot, removing the replacement variable from the template doesn't work to pass a simple string:

```<code>template(name="string_template" type="string" string="app-logs")
</code>```

Some of the values tried for "searchIndex=":

app_logs-$now (no template)

"app_logs-$now" (no template)

"app_logs-%$now%" (no template)

string_template

"string_template"

$string_template

"$string_template"

%$string_template%

"%$string_template%"

Body:
I feel like there's something simple staring at me that I'm missing on this but have been through the docs several times and haven't found a way to include the date in a string.

Here is my working custom rsyslog config shipping logs into elastic:

module(load="imfile" PollingInterval="10")
module(load="omelasticsearch")

input(type="imfile"
      persistStateInterval="10"
      file="/var/log/myapp/myapp.log"
      tag="my_app_log")

if ($syslogtag == "my_app_log") then {

      action(type="omelasticsearch"
          server=["172.x.x.x", "172.x.x.x", "172.x.x.x"]
          serverport="9200"
          searchIndex="app-logs"
          )
      stop
  }

I'd like to append a date string to the name of the searchIndex and tried using a template:

module(load="imfile" PollingInterval="10")
module(load="omelasticsearch")

template(name="string_template" type="string" string="app-logs-$now")

input(type="imfile"
      persistStateInterval="10"
      file="/var/log/myapp/myapp.log"
      tag="my_app_log")

if ($syslogtag == "my_app_log") then {

      action(type="omelasticsearch"
          server=["172.x.x.x", "172.x.x.x", "172.x.x.x"]
          serverport="9200"
          searchIndex="string_template" <-- (results in an index in elasticsearch called string_template)
          )
      stop
  }

Then the same as above but without the quotes like I would have expected when specifying a variable rather than a string:

module(load="imfile" PollingInterval="10")
module(load="omelasticsearch")

template(name="string_template" type="string" string="app-logs-$now")

input(type="imfile"
      persistStateInterval="10"
      file="/var/log/myapp/myapp.log"
      tag="my_app_log")

if ($syslogtag == "my_app_log") then {

      action(type="omelasticsearch"
          server=["172.x.x.x", "172.x.x.x", "172.x.x.x"]
          serverport="9200"
          searchIndex=string_template <-- (does nothing, no index created and no errors in syslog)
          )
      stop
  }

To troubleshoot, removing the replacement variable from the template doesn't work to pass a simple string:

template(name="string_template" type="string" string="app-logs")

Some of the values tried for "searchIndex=":

app_logs-$now (no template)

"app_logs-$now" (no template)

"app_logs-%$now%" (no template)

string_template

"string_template"

$string_template

"$string_template"

%$string_template%

"%$string_template%"


问:
GStreamer fails to play speedhq .mov files made by ndi-recorder
I am trying to play a file ".mov", produced by NewTek "ndi-recorder", using gstreamer 1.18.6.

I have also built the  teltek/gst-plugin-ndi and it works correctly playing live NDI videos.

The speedhq plugin seems present in my installation:
./gst-inspect-1.0 | grep speedhq
libav:  avdec_speedhq: libav NewTek SpeedHQ decoder

The .mov is shown correctly using ffplay.

I am not able to play it using gstreamer:

./gst-launch-1.0 filesrc location=/home/michele/Videos/1670422899.mov ! decodebin ! videoconvert ! autovideosink

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Missing element: video/x-gst-fourcc-SHQ2 decoder
WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0: Delayed linking failed.
Additional debug info:
gst/parse/grammar.y(550): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0:
failed delayed linking some pad of GstDecodeBin named decodebin0 to some pad of GstVideoConvert named videoconvert0
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: Internal data stream error.
Additional debug info:
../gst/isomp4/qtdemux.c(6545): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0:
streaming stopped, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Any hint would be very appreciated....