问:
Xamarin forms not updating notifications changes on final APK
I have a Xamarin Forms project where I use the following notifications code for Android:

```<code>[Service(Exported = false)]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class MyFirebaseMessagingService : FirebaseMessagingService
{
    public override void OnMessageReceived(RemoteMessage message)
    {
        base.OnMessageReceived(message);

        string messageTitle = GetTitle(message);
        string messageBody = GetBody(message);

        // convert the incoming message to a local notification
        ConfigureAndSendLocalNotification(messageTitle, messageBody);
    }

    private void ConfigureAndSendLocalNotification(string title, string body)
    {
        NotificationCompat.Builder notificationBuilder = ConfigureNotificationBuilder(title, body);
        SendNotification(notificationBuilder);
    }

     private NotificationCompat.Builder ConfigureNotificationBuilder(string title, string body)
    {
        Intent intent = new Intent(this, typeof(MainActivity));
        intent.AddFlags(ActivityFlags.ClearTop);
        intent.PutExtra("title", title);
        intent.PutExtra("message", body);

        PendingIntent pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.Immutable);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, Util.Constants.NotificationChannelName)
            ...//configuring notification

        return notificationBuilder;
    }
</code>```

I'm trying to modify this code to give users a better experience. However, when i generate the APK (going to archive -> distribute -> save as), it seems not to recognize any change in this file.

I've actually commented this part of the code:

```<code> public override void OnMessageReceived(RemoteMessage message){
//base.OnMessageReceived(message);

string messageTitle = GetTitle(message);
string messageBody = GetBody(message);

// convert the incoming message to a local notification
//ConfigureAndSendLocalNotification(messageTitle, messageBody);
}
</code>```

And the notification keeps appearing on the generated APK when I run it on my Android.

Creepy detail: In the Android emulator, all of my changes are correctly displayed. They really are just not reflected in the final APK.

Any ideas?

Body:
I have a Xamarin Forms project where I use the following notifications code for Android:

[Service(Exported = false)]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class MyFirebaseMessagingService : FirebaseMessagingService
{
    public override void OnMessageReceived(RemoteMessage message)
    {
        base.OnMessageReceived(message);

        string messageTitle = GetTitle(message);
        string messageBody = GetBody(message);

        // convert the incoming message to a local notification
        ConfigureAndSendLocalNotification(messageTitle, messageBody);
    }

    private void ConfigureAndSendLocalNotification(string title, string body)
    {
        NotificationCompat.Builder notificationBuilder = ConfigureNotificationBuilder(title, body);
        SendNotification(notificationBuilder);
    }

     private NotificationCompat.Builder ConfigureNotificationBuilder(string title, string body)
    {
        Intent intent = new Intent(this, typeof(MainActivity));
        intent.AddFlags(ActivityFlags.ClearTop);
        intent.PutExtra("title", title);
        intent.PutExtra("message", body);

        PendingIntent pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.Immutable);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, Util.Constants.NotificationChannelName)
            ...//configuring notification

        return notificationBuilder;
    }

I'm trying to modify this code to give users a better experience. However, when i generate the APK (going to archive -> distribute -> save as), it seems not to recognize any change in this file.

I've actually commented this part of the code:

 public override void OnMessageReceived(RemoteMessage message){
//base.OnMessageReceived(message);

string messageTitle = GetTitle(message);
string messageBody = GetBody(message);

// convert the incoming message to a local notification
//ConfigureAndSendLocalNotification(messageTitle, messageBody);
}

And the notification keeps appearing on the generated APK when I run it on my Android.

Creepy detail: In the Android emulator, all of my changes are correctly displayed. They really are just not reflected in the final APK.

Any ideas?


来源: stackexchange

问:
Discord.py bilingual help message
Is it possible to create a bilingual help message using discord.py commands? So when !help is used, it shows the English help message and when another alias !hilfe is used, it shows the German one (for example)?

A simple solution would be to just implement the command separatly. But I am wondering whether there is an inbuilt solution.

ContentLicense: CC BY-SA 4.0

Title: Discord.py bilingual help message


问:
How to compute Dimitrov spectral fatigue index in Python?
I have an already existing python script to calculate mean power frequency. Additionally I would like to calculate dimitrovs spectral fatigue index. Its formula slightly differs from mean power frequency  instead of using a ratio of the moments of 1 and 0 it uses the moments of -1 and 5. I thought, I could simply add the moments of interest, but I get only inf-values in the renamed FInms5 function

[mean power frequency]
[dimitrov spectral fatigue index]

This is the working mean freq function. I changed the last line to:
mean_freq[i] = np.dot(P,f.t-1)/np.dot(P,f.t5)

from scipy.signal import periodogram

def get_mean_freq(emg_sig, sfreq, epoch_duration = 0.5):
'''
Parameters
----------
emg_sig : array
pre-filtered emg data.
sfreq : int
emg sampling frequency, in Hz.
epoch_duration : float
epoch (time window) duration, in seconds.

```<code>Returns
-------
mean_freq: array
    mean frequency at each epoch
time_points: array
    time point at the center of each evaluated epoch
samples: array
    sample numbers at the center of each evaluated epoch

Method according to:
    https://stackoverflow.com/questions/37922928/difference-in-mean-frequency-in-python-and-matlab
'''
ons = range(
    0,
    len(emg_sig),
    int(epoch_duration*sfreq)
    )

mean_freq = np.empty((len(ons),))
samples =np.empty((len(ons),))
time_points = np.empty((len(ons),))
for i,on in enumerate(ons):# i,on = 0,ons[0]
    off = ons[i+1]-1 if i+1<len(ons) else len(emg_sig)
    # print([on,off])
    processing_window = emg_sig[on:off]
    mid_point = (on + off) / 2
    samples[i] = mid_point
    # t_epoch[ch] += [mid_point / sfreq]
    time_points[i] = mid_point / sfreq
    # Processing window power spectrum (PSD) generation
    f, Pxx_den = periodogram(np.array(processing_window), fs=float(sfreq))# plot_freq_spectrum(f, Pxx_den)
    Pxx_den = np.reshape(Pxx_den, (1,-1))
    width = np.tile(f[2]-f[0], (1, Pxx_den.shape[2]))
    f = np.reshape(f, (1,-1))
    P = Pxx_den*width
    pwr = np.sum(P)
    mean_freq[i] = np.dot(P, f.T)/pwr

return mean_freq, time_points, samples
</code>```

This is the working mean freq function. I changed the last line to:
mean_freq[i] = np.dot(P,f.t-1)/np.dot(P,f.t5)

```<code>

  [1]: https://i.stack.imgur.com/He32L.png
  [2]: https://i.stack.imgur.com/o6gGD.png
</code>```

Body:
I have an already existing python script to calculate mean power frequency. Additionally I would like to calculate dimitrovs spectral fatigue index. Its formula slightly differs from mean power frequency  instead of using a ratio of the moments of 1 and 0 it uses the moments of -1 and 5. I thought, I could simply add the moments of interest, but I get only inf-values in the renamed FInms5 function

[mean power frequency]
[dimitrov spectral fatigue index]

This is the working mean freq function. I changed the last line to:
mean_freq[i] = np.dot(P,f.t-1)/np.dot(P,f.t5)

from scipy.signal import periodogram

def get_mean_freq(emg_sig, sfreq, epoch_duration = 0.5):
'''
Parameters
----------
emg_sig : array
pre-filtered emg data.
sfreq : int
emg sampling frequency, in Hz.
epoch_duration : float
epoch (time window) duration, in seconds.

Returns
-------
mean_freq: array
    mean frequency at each epoch
time_points: array
    time point at the center of each evaluated epoch
samples: array
    sample numbers at the center of each evaluated epoch

Method according to:
    https://stackoverflow.com/questions/37922928/difference-in-mean-frequency-in-python-and-matlab
'''
ons = range(
    0,
    len(emg_sig),
    int(epoch_duration*sfreq)
    )

mean_freq = np.empty((len(ons),))
samples =np.empty((len(ons),))
time_points = np.empty((len(ons),))
for i,on in enumerate(ons):# i,on = 0,ons[0]
    off = ons[i+1]-1 if i+1<len(ons) else len(emg_sig)
    # print([on,off])
    processing_window = emg_sig[on:off]
    mid_point = (on + off) / 2
    samples[i] = mid_point
    # t_epoch[ch] += [mid_point / sfreq]
    time_points[i] = mid_point / sfreq
    # Processing window power spectrum (PSD) generation
    f, Pxx_den = periodogram(np.array(processing_window), fs=float(sfreq))# plot_freq_spectrum(f, Pxx_den)
    Pxx_den = np.reshape(Pxx_den, (1,-1))
    width = np.tile(f[2]-f[0], (1, Pxx_den.shape[2]))
    f = np.reshape(f, (1,-1))
    P = Pxx_den*width
    pwr = np.sum(P)
    mean_freq[i] = np.dot(P, f.T)/pwr

return mean_freq, time_points, samples

This is the working mean freq function. I changed the last line to:
mean_freq[i] = np.dot(P,f.t-1)/np.dot(P,f.t5)

  [1]: https://i.stack.imgur.com/He32L.png
  [2]: https://i.stack.imgur.com/o6gGD.png


问:
how to configure apache2 to host nestjs service
Im trying to publish nestjs service with angular front. Angular works correctly but nest dont.

```<code><VirtualHost *:2000>
        ServerName myservername
        ServerAlias myserveralias
        DocumentRoot /var/www/html/path/to/dist

        <Directory /var/www/html/path/to/dist >
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>
</code>```

So far what I got is this directives. if i launch nest it says that port 2000 is already used but it doesnt respond to any request.

Body:
Im trying to publish nestjs service with angular front. Angular works correctly but nest dont.

<VirtualHost *:2000>
        ServerName myservername
        ServerAlias myserveralias
        DocumentRoot /var/www/html/path/to/dist

        <Directory /var/www/html/path/to/dist >
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>

So far what I got is this directives. if i launch nest it says that port 2000 is already used but it doesnt respond to any request.


问:
MariaDB connector not working after JAR was built
I have written a small Java server for a a programming-course. I want to connect to a MariaDB database.

Maven POM

Therefore I added the dependency to my pom.xml:

<dependency>
    <groupId>org.mariadb.jdbc</groupId>
    <artifactId>mariadb-java-client</artifactId>
    <version>3.1.0</version>
</dependency>
```
<h3>What works</h3>
<p>That works wonderfully while I am running it in IntelliJ.</p>
<h3>Error</h3>
<p>As soon as I build the JAR and run it I get this error:</p>
```Caused by: java.lang.RuntimeException: java.sql.SQLException: No suitable driver found for
jdbc:mariadb://192.168.0.3:3306/feeder at Main.<clinit>(Main.java:24)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mariadb://192.168.0.3:3306/feeder
```

What I tried

I've tried rebuilding the jar and re-adding the dependency.

Why does that happen?

Body:
I have written a small Java server for a a programming-course. I want to connect to a MariaDB database.

Maven POM

Therefore I added the dependency to my pom.xml:

<dependency>
    <groupId>org.mariadb.jdbc</groupId>
    <artifactId>mariadb-java-client</artifactId>
    <version>3.1.0</version>
</dependency>

What works

That works wonderfully while I am running it in IntelliJ.

Error

As soon as I build the JAR and run it I get this error:

Caused by: java.lang.RuntimeException: java.sql.SQLException: No suitable driver found for
jdbc:mariadb://192.168.0.3:3306/feeder at Main.<clinit>(Main.java:24)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mariadb://192.168.0.3:3306/feeder

What I tried

I've tried rebuilding the jar and re-adding the dependency.

Why does that happen?


问:
solr search syntax : search document when array contains "all" values in search string
I am trying to put together a search solution where i control the document structure as well as the search string pattern. The need is to be able to search/select documents

```<code>{
    "type" : "planet",
    "name" : [ "earth","mars","venus","jupiter" ]
}

{
    "type" : "planet",
    "name" : [  "earth","saturn","jupiter" ]
}
</code>```

where the values in array meet all or one of the search strings ->

search: "Earth or Mars" should match a:["earth","mars","venus","jupiter"]

search : "Earth and Mars" should match
 a:["earth","mars","venus","jupiter"] but not

a:["earth","venus","jupiter"]

I can restructure the document schema, if need be, though I want to reduce denormalization - since my actual dataset spans in billions of rows - and denormalization will just increase the size of overall indexed dataset.

As it is, the search is behaving relatively erratically, the AND is honored, but OR is not. I m concerned that its due to the fact that the content for search target is inside an array element (which is defined as a Multivalued item)

Any thoughts / ideas ?

Body:
I am trying to put together a search solution where i control the document structure as well as the search string pattern. The need is to be able to search/select documents

{
    "type" : "planet",
    "name" : [ "earth","mars","venus","jupiter" ]
}

{
    "type" : "planet",
    "name" : [  "earth","saturn","jupiter" ]
}

where the values in array meet all or one of the search strings ->

search: "Earth or Mars" should match a:["earth","mars","venus","jupiter"]

search : "Earth and Mars" should match
 a:["earth","mars","venus","jupiter"] but not

a:["earth","venus","jupiter"]

I can restructure the document schema, if need be, though I want to reduce denormalization - since my actual dataset spans in billions of rows - and denormalization will just increase the size of overall indexed dataset.

As it is, the search is behaving relatively erratically, the AND is honored, but OR is not. I m concerned that its due to the fact that the content for search target is inside an array element (which is defined as a Multivalued item)

Any thoughts / ideas ?


问:
Matplotlib make legend position flush with axes
I want to make my legend in the top-right corner of my matplotlib figure without any padding. I.e. I want the legend to be flush as per below,

If I use loc and bbox_to_anchor I can't seem to make this work (I do not want to have to manually type in values myself each time). I have tried,

```<code>fig, ax = plt.subplots(1, 1, figsize=(8, 8))
h, bins = np.histogram(np.random.normal(size=100000), bins=100)
mplhep.histplot(h, bins, ax=ax, label="Gaussian")
legend = ax.legend(frameon=True, fancybox=False, edgecolor="#000", loc="upper right", bbox_to_anchor=(1, 1))
legend.get_frame().set_alpha(None)
plt.tight_layout()
plt.show()
</code>```

But I still have padding in between the axes and legend. Changing loc doesn't work.

Body:
I want to make my legend in the top-right corner of my matplotlib figure without any padding. I.e. I want the legend to be flush as per below,

If I use loc and bbox_to_anchor I can't seem to make this work (I do not want to have to manually type in values myself each time). I have tried,

fig, ax = plt.subplots(1, 1, figsize=(8, 8))
h, bins = np.histogram(np.random.normal(size=100000), bins=100)
mplhep.histplot(h, bins, ax=ax, label="Gaussian")
legend = ax.legend(frameon=True, fancybox=False, edgecolor="#000", loc="upper right", bbox_to_anchor=(1, 1))
legend.get_frame().set_alpha(None)
plt.tight_layout()
plt.show()

But I still have padding in between the axes and legend. Changing loc doesn't work.


问:
Hide sidebar on 1 page glitches homepage content
I would like to hide the sidebar on just 1 specific page and allow the content to take the full 100%. I am using liquid. I have done this:

```<code>{% if page.handle != 'lorem' %}
<main-sidebar class="sidebar {% if page.handle == 'lorem' %} blockCSS {% endif %}">
</code>```

It works.

But then you check the homepage and normally all the sections are wrapped within the content-holder div but for some reason after adding that piece of code after 3 sections they are outside of that div. I have not even changed that div at all.

How do I ensure that all sections that come after the first 3 that they are also in the content-holder?

Body:
I would like to hide the sidebar on just 1 specific page and allow the content to take the full 100%. I am using liquid. I have done this:

{% if page.handle != 'lorem' %}

It works.

But then you check the homepage and normally all the sections are wrapped within the content-holder div but for some reason after adding that piece of code after 3 sections they are outside of that div. I have not even changed that div at all.

How do I ensure that all sections that come after the first 3 that they are also in the content-holder?


问:
Vert.x "Cannot assign requested address" errors caused by high throughput
I"m doing a stress test on vert.x application and send ~10K RPS.
My application send an http async request from a dedicated verticle.
I"m using vert.x http client, and see that around 20 seconds my application sent the http requests successfully.
After 20 seconds i"m starting to get a lot of "Cannot assign requested address" errors.

I tried to deploy more verticles, to set different values to the http client thread pool and nothing helped to solve the issue.
I guess that the issue related to the high throughput in a short time around 1 minute.

Main Class:

```<code> public static void main(String[] args) {

final VertxOptions vertxOptions = new VertxOptions()
  .setMaxEventLoopExecuteTime(1)
  .setMaxEventLoopExecuteTimeUnit(TimeUnit.MILLISECONDS);

final Vertx vertx = Vertx.vertx(vertxOptions);

final Injector injector = Guice.createInjector(new Dependencies(vertx));

CustomCodecRegister.register(vertx.eventBus());

final Stream<Future<String>> deploymentFutures = Stream.of(
        deployWorker(vertx, injector, StatsHttpVerticle.class, 10)
).flatMap(stream -> stream);

CompositeFuture.all(deploymentFutures.collect(Collectors.toList()))
        .onSuccess(successfulCompositeFuture -> { });}

private static <T> Stream<Future<String>> deployWorker(Vertx vertx, Injector injector, Class<T> workerVerticleClass, int numVerticles) {
    final String poolName = workerVerticleClass.getSimpleName()
            .toLowerCase()
            .replace("verticle", "-worker-pool");
    final int numberOfThreads = 50;

    final DeploymentOptions options = new DeploymentOptions()
            .setWorker(true)
            .setWorkerPoolName(poolName)
            .setWorkerPoolSize(numberOfThreads);

    return IntStream.range(0, numVerticles)
            .mapToObj(ignore -> Future.future((Promise<String> promise) ->
                    vertx.deployVerticle((Verticle) injector.getInstance(workerVerticleClass), options, promise)));
}
</code>```

EventBusAdapter:

```<code>  public void send(Map<String, Object> queryParams, HashMap<String, String> headers, boolean followRedirect, Event eventToFire) {
    StatsRequest statsRequest = new StatsRequest(queryParams, headers, eventToFire, followRedirect);
    eventBus.request(FIRE_GET_METRIC_TO_STATS,statsRequest);
  }
</code>```

WorkerVerticle:

```<code>  @Override
  public void start(Promise<Void> startPromise) throws Exception {
    vertx.eventBus().consumer(FIRE_GET_METRIC_TO_STATS, this::fire);
    startPromise.complete();
  }

  private void fire(Message<StatsRequest> message) {
    StatsRequest body = message.body();
    MultiMap multimapHeader = MultiMap.caseInsensitiveMultiMap();

    WebClientOptions webClientOptions = new WebClientOptions();
    webClientOptions.setMaxPoolSize(1000);
    WebClient httpClient = WebClient.create(vertx, webClientOptions);

    httpClient.request(HttpMethod.GET, port, "example.com", "/1x1.gif" + "?" + "queryParamsString")
            .followRedirects(false)
            .putHeaders(multimapHeader)
            .timeout(120000)
            .send()
            .onSuccess(response -> {
              logger.info("All good");
            })
            .onFailure(err -> {
              logger.error("Exception: " + err.getMessage());
            });
  }
</code>```

How can i solve this issue?

Body:
I"m doing a stress test on vert.x application and send ~10K RPS.
My application send an http async request from a dedicated verticle.
I"m using vert.x http client, and see that around 20 seconds my application sent the http requests successfully.
After 20 seconds i"m starting to get a lot of "Cannot assign requested address" errors.

I tried to deploy more verticles, to set different values to the http client thread pool and nothing helped to solve the issue.
I guess that the issue related to the high throughput in a short time around 1 minute.

Main Class:

 public static void main(String[] args) {

final VertxOptions vertxOptions = new VertxOptions()
  .setMaxEventLoopExecuteTime(1)
  .setMaxEventLoopExecuteTimeUnit(TimeUnit.MILLISECONDS);

final Vertx vertx = Vertx.vertx(vertxOptions);

final Injector injector = Guice.createInjector(new Dependencies(vertx));

CustomCodecRegister.register(vertx.eventBus());

final Stream<Future<String>> deploymentFutures = Stream.of(
        deployWorker(vertx, injector, StatsHttpVerticle.class, 10)
).flatMap(stream -> stream);

CompositeFuture.all(deploymentFutures.collect(Collectors.toList()))
        .onSuccess(successfulCompositeFuture -> { });}

private static <T> Stream<Future<String>> deployWorker(Vertx vertx, Injector injector, Class<T> workerVerticleClass, int numVerticles) {
    final String poolName = workerVerticleClass.getSimpleName()
            .toLowerCase()
            .replace("verticle", "-worker-pool");
    final int numberOfThreads = 50;

    final DeploymentOptions options = new DeploymentOptions()
            .setWorker(true)
            .setWorkerPoolName(poolName)
            .setWorkerPoolSize(numberOfThreads);

    return IntStream.range(0, numVerticles)
            .mapToObj(ignore -> Future.future((Promise<String> promise) ->
                    vertx.deployVerticle((Verticle) injector.getInstance(workerVerticleClass), options, promise)));
}

EventBusAdapter:

  public void send(Map<String, Object> queryParams, HashMap<String, String> headers, boolean followRedirect, Event eventToFire) {
    StatsRequest statsRequest = new StatsRequest(queryParams, headers, eventToFire, followRedirect);
    eventBus.request(FIRE_GET_METRIC_TO_STATS,statsRequest);
  }

WorkerVerticle:

  @Override
  public void start(Promise<Void> startPromise) throws Exception {
    vertx.eventBus().consumer(FIRE_GET_METRIC_TO_STATS, this::fire);
    startPromise.complete();
  }

  private void fire(Message<StatsRequest> message) {
    StatsRequest body = message.body();
    MultiMap multimapHeader = MultiMap.caseInsensitiveMultiMap();

    WebClientOptions webClientOptions = new WebClientOptions();
    webClientOptions.setMaxPoolSize(1000);
    WebClient httpClient = WebClient.create(vertx, webClientOptions);

    httpClient.request(HttpMethod.GET, port, "example.com", "/1x1.gif" + "?" + "queryParamsString")
            .followRedirects(false)
            .putHeaders(multimapHeader)
            .timeout(120000)
            .send()
            .onSuccess(response -> {
              logger.info("All good");
            })
            .onFailure(err -> {
              logger.error("Exception: " + err.getMessage());
            });
  }

How can i solve this issue?


问:
Laravel Sanctum Session (Backend & Frontend Separated)
I'm developing a project has two separate projects

Backend : Laravel API

Frontend: VueJS SPA

I want to let the front-end developer develop the front-end project without installing the backend locally.

Can I upload the backend in the Remote server? and frontend locally?

I use a "Session Driver". it has a domain restriction.

frontend: localhost:XXXX
backend: api.example.com


问:
Firestore wrong order of documents
Firestore orders first by not mentioned field and then by the requested field

I am trying to order the documents (bookings) by the 'from' date of the booking with this query

```<code>query(this.colRef,orderBy("from","desc"));
</code>```

Which ends up in this result:

Randomly firestore first orders by the user and then by the 'from' date which is not as requested. The date is stored as timestamp in firestore.

Firestore document

Code how i display the result

```<code><p-table [value]="bookings" dataKey="id"  [responsive]="true" [scrollable]="true" *ngIf="globals.windowWidth > 640">
<ng-template pTemplate="caption">
  <div class="table-header">
      <p-dropdown [options]="bookingYears" (onChange)="loadBookings()" [(ngModel)]="selectedYear" optionLabel="name"
                  optionValue="code" autoWidth="true" *ngIf="selectedYear!=undefined && !isShowingRequests"></p-dropdown>

      <button pButton pRipple type="button"  style="float: right;" icon="pi pi-refresh" (click)="loadBookings()" *ngIf="loadedBookings"></button>
      <button  icon="pi pi-spin pi-spinner" style="float: right;" class="p-button-rounded p-button-primary rightButton" pButton type="button" *ngIf="!loadedBookings"></button>
      <div></div>
      <br><br>
  </div>
</ng-template>
<ng-template pTemplate="header">
  <tr>
      <th *ngIf="bookerID == undefined">Booker</th>
      <th>From</th>
      <th>To</th>
      <th>Price</th>
      <th>Status</th>
      <th></th>
  </tr>

  <tr *ngIf="bookings.length == 0 && loadedBookings">
    <th colspan="6">
          No Bookings found!
    </th>
  </tr>
</ng-template>
<ng-template pTemplate="body" let-booking >
  <tr>
      <td *ngIf="bookerID == undefined">
        {{booking.user.forename}} {{booking.user.lastname}}
      </td>
      <td>
        {{booking.from.toLocaleDateString()}}
      </td>
      <td>
        {{booking.to.toLocaleDateString()}}
      </td>
      <td>
        {{bookingCalculationService.getTotalPrice(booking)}} €
      </td>
      <td >
        {{bookingsStatus[booking.status-1].name}}
      </td>
      <td style="text-align:center"><!--pi-window-maximize-->
        <button (click)="showBookingInfoDialog(booking)" icon="pi pi-window-maximize" pButton pRipple type="button"   class="p-button-rounded p-button-outlined" title="Edit"></button><!---->
      </td>
  </tr>
</ng-template>
</code>```

TS code

```<code>getDocs(query)
  .then((snapchot) => {
    let counter = 0;
    if(snapchot.docs.length ==0 )this.loadedBookings = true;

    snapchot.docs.forEach((doc) => {
      this.fireStoreService.bookingConverter.fromFirestore(doc).then((booking: Booking) =>
      {
        if(this.isShowingRequests){
          if(this.authService.isLoggedInAndHost() && booking.status == 1)this.bookings.push(booking)
        }
        else if(this.isShowingBookingsAsHost){
          if(this.authService.isLoggedInAndHost() && booking.status != 1)this.bookings.push(booking)
        }
        else{
          if(this.authService.isLoggedIn())this.bookings.push(booking)
        }

        counter++;
        if(snapchot.docs.length == counter){
          this.loadedBookings = true;
        }
      });
    });
  })
  .catch((e)=>{
    console.log(e)
    this.showToastMessage('error', 'Error', 'An error orccured!');
  })
  ;
</code>```

Title: Firestore wrong order of documents

Body:
Firestore orders first by not mentioned field and then by the requested field

I am trying to order the documents (bookings) by the 'from' date of the booking with this query

query(this.colRef,orderBy("from","desc"));

Which ends up in this result:

Randomly firestore first orders by the user and then by the 'from' date which is not as requested. The date is stored as timestamp in firestore.

Firestore document

Code how i display the result

 640">
<ng-template pTemplate="caption">

      <button pButton pRipple type="button"  style="float: right;" icon="pi pi-refresh" (click)="loadBookings()" *ngIf="loadedBookings"></button>
      <button  icon="pi pi-spin pi-spinner" style="float: right;" class="p-button-rounded p-button-primary rightButton" pButton type="button" *ngIf="!loadedBookings"></button>

</ng-template>
<ng-template pTemplate="header">

      Booker
      From
      To
      Price
      Status

          No Bookings found!

</ng-template>
<ng-template pTemplate="body" let-booking >

        {{booking.user.forename}} {{booking.user.lastname}}

        {{booking.from.toLocaleDateString()}}

        {{booking.to.toLocaleDateString()}}

        {{bookingCalculationService.getTotalPrice(booking)}} €

        {{bookingsStatus[booking.status-1].name}}

        <button (click)="showBookingInfoDialog(booking)" icon="pi pi-window-maximize" pButton pRipple type="button"   class="p-button-rounded p-button-outlined" title="Edit"></button>

</ng-template>

TS code

getDocs(query)
  .then((snapchot) => {
    let counter = 0;
    if(snapchot.docs.length ==0 )this.loadedBookings = true;

    snapchot.docs.forEach((doc) => {
      this.fireStoreService.bookingConverter.fromFirestore(doc).then((booking: Booking) =>
      {
        if(this.isShowingRequests){
          if(this.authService.isLoggedInAndHost() && booking.status == 1)this.bookings.push(booking)
        }
        else if(this.isShowingBookingsAsHost){
          if(this.authService.isLoggedInAndHost() && booking.status != 1)this.bookings.push(booking)
        }
        else{
          if(this.authService.isLoggedIn())this.bookings.push(booking)
        }

        counter++;
        if(snapchot.docs.length == counter){
          this.loadedBookings = true;
        }
      });
    });
  })
  .catch((e)=>{
    console.log(e)
    this.showToastMessage('error', 'Error', 'An error orccured!');
  })
  ;


问:
Flyout menu and static tabs - .Net MAUI
I am working on a .Net Maui app using xaml, what I am trying to achieve is a flyout menu with static tabs at the bottom (Think master/child pages). I have seen some tutorials and was able to achieve having a flyout menu with tabs at the bottom, the issue is that the tabs are only present for the selected menu items within the FlyoutItem

```<code><?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="App.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:App"
    Shell.FlyoutBehavior="Flyout">

    <Shell.FlyoutHeader>
        <Grid HeightRequest="100" BackgroundColor="DarkSlateBlue">
            <Image Source="applogo.png" HeightRequest="100" WidthRequest="100" />
        </Grid>
    </Shell.FlyoutHeader>

    <FlyoutItem Title="App Title">
        <ShellContent Title="Dashboard"
                  ContentTemplate="{DataTemplate local:MainPage}">
            <ShellContent.Icon>
                <FontImageSource FontFamily="FAS"
                            Glyph=""/>
            </ShellContent.Icon>
        </ShellContent>

        <ShellContent Title="Sessions"
                  ContentTemplate="{DataTemplate local:SessionsPage}">
            <ShellContent.Icon>
                <FontImageSource FontFamily="FAS"
                            Glyph=""/>
            </ShellContent.Icon>
        </ShellContent>
    </FlyoutItem>

    <FlyoutItem Title="Info">
        <ShellContent Title="Info"
                  ContentTemplate="{DataTemplate local:AboutPage}">
            <ShellContent.Icon>
                <FontImageSource FontFamily="FAS"
                                 Glyph=""/>
            </ShellContent.Icon>
        </ShellContent>
    </FlyoutItem>

    <Shell.FlyoutFooter>
        <Grid HeightRequest="40" BackgroundColor="DarkSlateBlue">
            <Label TextColor="White" Text="copyright © 2022 All Rights Reserved" />
        </Grid>
    </Shell.FlyoutFooter>

</Shell>
</code>```

With the code above the 2 Shell Content items Dashboard & Sessions will show the tabs positioned at the bottom of the screen when either one of those pages are active, but when the flyout item Info is selected then tabs disappear. What I am trying to achieve here is that the flout menu and the tabs are always visible whenever any page is active, the catch is that I only want a select number of tabs visible at the bottom at all times (i.e. 4 tabs), but I may have 10 pages/menu items to select from that should not be tabs.

Update: I added screen shots as well as all the code for the AppShell.xaml file

Here is what the app looks like with the flyout menu and the tabs:

Tabs in app:

Flyout Menu with tabs:

Info/About Page, there are no tabs present when this page is selected:

This is how I would like the flyout menu to look, notice that all the menu items are now visible, but there are no tabs now when they are separated out like this:

Title: Flyout menu and static tabs - .Net MAUI

Body:
I am working on a .Net Maui app using xaml, what I am trying to achieve is a flyout menu with static tabs at the bottom (Think master/child pages). I have seen some tutorials and was able to achieve having a flyout menu with tabs at the bottom, the issue is that the tabs are only present for the selected menu items within the FlyoutItem

<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="App.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:App"
    Shell.FlyoutBehavior="Flyout">

    <Shell.FlyoutHeader>
        <Grid HeightRequest="100" BackgroundColor="DarkSlateBlue">
            <Image Source="applogo.png" HeightRequest="100" WidthRequest="100" />
        </Grid>
    </Shell.FlyoutHeader>

    <FlyoutItem Title="App Title">
        <ShellContent Title="Dashboard"
                  ContentTemplate="{DataTemplate local:MainPage}">
            <ShellContent.Icon>
                <FontImageSource FontFamily="FAS"
                            Glyph=""/>
            </ShellContent.Icon>
        </ShellContent>

        <ShellContent Title="Sessions"
                  ContentTemplate="{DataTemplate local:SessionsPage}">
            <ShellContent.Icon>
                <FontImageSource FontFamily="FAS"
                            Glyph=""/>
            </ShellContent.Icon>
        </ShellContent>
    </FlyoutItem>

    <FlyoutItem Title="Info">
        <ShellContent Title="Info"
                  ContentTemplate="{DataTemplate local:AboutPage}">
            <ShellContent.Icon>
                <FontImageSource FontFamily="FAS"
                                 Glyph=""/>
            </ShellContent.Icon>
        </ShellContent>
    </FlyoutItem>

    <Shell.FlyoutFooter>
        <Grid HeightRequest="40" BackgroundColor="DarkSlateBlue">

        </Grid>
    </Shell.FlyoutFooter>

</Shell>

With the code above the 2 Shell Content items Dashboard & Sessions will show the tabs positioned at the bottom of the screen when either one of those pages are active, but when the flyout item Info is selected then tabs disappear. What I am trying to achieve here is that the flout menu and the tabs are always visible whenever any page is active, the catch is that I only want a select number of tabs visible at the bottom at all times (i.e. 4 tabs), but I may have 10 pages/menu items to select from that should not be tabs.

Update: I added screen shots as well as all the code for the AppShell.xaml file

Here is what the app looks like with the flyout menu and the tabs:

Tabs in app:

Flyout Menu with tabs:

Info/About Page, there are no tabs present when this page is selected:

This is how I would like the flyout menu to look, notice that all the menu items are now visible, but there are no tabs now when they are separated out like this:


问:
Need help calling for a variable with my program that uses a qr scanner with php and js
I need to be able to call the id that is stored in the qr, but i dont know how to call it, i´m sorry for the horrible code its my first proyect.

```<code>
<html>
<body>

    <?php
    function connection (){
    $connection= mysqli_connect("localhost","root","","control_index");
    return $connection;
}
    $hostname="localhost";
    $username="root";
    $password="";
    $databaseName="control_index";
    $connect=mysqli_connect($hostname,$username,$password,$databaseName);
    $query_curso="SELECT * FROM curso";
    $result1=mysqli_query($connect,$query_curso);

  ?>
  <form method="POST">
    <script src="html5-qrcode.min.js"></script>
        <h3>asistencia:</h3>
        <select name="curso">
            <option value="" disabled selected>Selecciona una curso</option>
            <?php while($row1 = mysqli_fetch_array($result1)):;?>
            <option value="<?php echo $row1[0];?>">
                <?php echo $row1[1];?>
            </option>
            <?php endwhile;?>
        </select>
        <p><a href="http://localhost/index_archivos/Menu_principal.html">Volver</a></p>
<div class="row" align="center">
  <div class="col" align="center">
    <div style="width:500px;" id="reader"></div>
  </div>
  <div class="col" style="padding:30px;">
    <h4>SCAN RESULT</h4>
    <div id="result">Result Here</div>
  </div>
</div>
<script type="text/javascript">
function onScanSuccess(qrCodeMessage) {
    document.getElementById('result').innerHTML = '<span class="result">id_trabajador = '+qrCodeMessage+'</span>';
    "${result}";
    return qrCodeMessage;
}
function onScanError(errorMessage) {
  //handle scan error
}

var html5QrcodeScanner = new Html5QrcodeScanner(
"reader", { fps: 10, qrbox: 250 });
html5QrcodeScanner.render(onScanSuccess, onScanError);

</script>

  <?php
if(isset($_POST['curso'])){
$id_curso=$_POST['curso'];

$sql=mysqli_query($connect,"INSERT INTO asistencia(ID_Trabajador,ID_Curso,Hora_De_Asistencia)values('$id_trabajador','$id_curso',CURRENT_TIME)");
}

?>

<input type="submit" name="submit">

</form>
</body>
</html>
</code>```

I know where its displayed and its generated in on scan success, but i dont know how to call the function to php to be able to store it in an sql

Body:
I need to be able to call the id that is stored in the qr, but i dont know how to call it, i´m sorry for the horrible code its my first proyect.

    <?php
    function connection (){
    $connection= mysqli_connect("localhost","root","","control_index");
    return $connection;
}
    $hostname="localhost";
    $username="root";
    $password="";
    $databaseName="control_index";
    $connect=mysqli_connect($hostname,$username,$password,$databaseName);
    $query_curso="SELECT * FROM curso";
    $result1=mysqli_query($connect,$query_curso);

  ?>
  <form method="POST">

asistencia:

        <select name="curso">
            <option value="" disabled selected>Selecciona una curso</option>
            <?php while($row1 = mysqli_fetch_array($result1)):;?>
            <option value="<?php echo $row1[0];?>">
                <?php echo $row1[1];?>
            </option>
            <?php endwhile;?>
        </select>

Volver

SCAN RESULT

Result Here

  <?php
if(isset($_POST['curso'])){
$id_curso=$_POST['curso'];

$sql=mysqli_query($connect,"INSERT INTO asistencia(ID_Trabajador,ID_Curso,Hora_De_Asistencia)values('$id_trabajador','$id_curso',CURRENT_TIME)");
}

?>

<input type="submit" name="submit">

</form>

I know where its displayed and its generated in on scan success, but i dont know how to call the function to php to be able to store it in an sql


问:
Big Query SQL: include the running sum of an id for a period that doesn't have that id
Let's say I have an table with values for ids over different days

day
id
val

2
id2
2

2
id3
4

1
id1
2

1
id2
4

1
id3
6

I would like to calculate the running sum for each of the ids and have all the ids visible for each day in the results, like this:

day
id
val
running_sum

2
id1

2

2
id2
2
6

2
id3
4
10

1
id1
2
2

1
id2
4
4

1
id3
6
6

Calculating the running sum using this window function only returns the ids adn the sum for each day where the id was present.

```<code>WITH t as (
SELECT 2 as day,'id2' as id, 2 as val UNION ALL
SELECT 2 as day, 'id3' as id, 4 as val UNION ALL

SELECT 1 as day, 'id1' as id, 1 as val UNION ALL
SELECT 1 as day,'id2' as id, 2 as val UNION ALL
SELECT 1 as day,'id3' as id, 3 as val
),

select day, id, val, SUM(val) OVER(PARTITION BY id ORDER BY DAY) running_sum
from t
order by day desc
</code>```

How could I query the data to include all ids in every day?

Body:
Let's say I have an table with values for ids over different days

day
id
val

2
id2
2

2
id3
4

1
id1
2

1
id2
4

1
id3
6

I would like to calculate the running sum for each of the ids and have all the ids visible for each day in the results, like this:

day
id
val
running_sum

2
id1

2

2
id2
2
6

2
id3
4
10

1
id1
2
2

1
id2
4
4

1
id3
6
6

Calculating the running sum using this window function only returns the ids adn the sum for each day where the id was present.

WITH t as (
SELECT 2 as day,'id2' as id, 2 as val UNION ALL
SELECT 2 as day, 'id3' as id, 4 as val UNION ALL

SELECT 1 as day, 'id1' as id, 1 as val UNION ALL
SELECT 1 as day,'id2' as id, 2 as val UNION ALL
SELECT 1 as day,'id3' as id, 3 as val
),

select day, id, val, SUM(val) OVER(PARTITION BY id ORDER BY DAY) running_sum
from t
order by day desc

How could I query the data to include all ids in every day?


问:
Select column from selected column subquery
I have select table like this

```<code>SELECT COUNT(id_lokasi) AS terbanyak, id_lokasi
FROM personil_tunas_paragitas
GROUP BY id_lokasi ORDER BY terbanyak DESC LIMIT 1
</code>```

then i want to select the id_lokasi

```<code>SELECT id_lokasi
FROM (SELECT COUNT(id_lokasi) AS terbanyak, id_lokasi
FROM personil_tunas_paragitas GROUP BY id_lokasi ORDER BY terbanyak DESC LIMIT 1);
</code>```

but this query give me error. am i have something wrong with this query?

Body:
I have select table like this

SELECT COUNT(id_lokasi) AS terbanyak, id_lokasi
FROM personil_tunas_paragitas
GROUP BY id_lokasi ORDER BY terbanyak DESC LIMIT 1

then i want to select the id_lokasi

SELECT id_lokasi
FROM (SELECT COUNT(id_lokasi) AS terbanyak, id_lokasi
FROM personil_tunas_paragitas GROUP BY id_lokasi ORDER BY terbanyak DESC LIMIT 1);

but this query give me error. am i have something wrong with this query?


问:
Ansible custom module (powershell): access environment variable
How can I access an environment variable in powershell when building a custom module?

```<code>- name: custom module
  environment:
    MY_ENVIRONMENT: "custom"
  custom_action:
    custom_param: "param"
  register: result
</code>```

With the following

```<code>Function Get-CommonSpec
{
    @{
        options = @{
            MY_ENVIRONMENT = @{type = "str"; required = $true; }
        }
    }
}
</code>```

I get 'missing required arguments USER' error

Body:
How can I access an environment variable in powershell when building a custom module?

- name: custom module
  environment:
    MY_ENVIRONMENT: "custom"
  custom_action:
    custom_param: "param"
  register: result

With the following

Function Get-CommonSpec
{
    @{
        options = @{
            MY_ENVIRONMENT = @{type = "str"; required = $true; }
        }
    }
}

I get 'missing required arguments USER' error


问:
How to insert JSON data into table in plsql which are having multiple records
How to insert JSON data into PL/SQL table?

Sample input data to the procedure:

```<code>"[{"REPORTREFERENCENUMBER":"1","FIRSTNAME":"null","PHONENO":"8471921920","CUSTOMERID":"AD00000080660459615","UNIQUE_ID":"NTR-0403"},   {"REPORTREFERENCENUMBER":"2","FIRSTNAME":"null","PHONENO":"8471921920","CUSTOMERID":"AD00000080660459615","UNIQUE_ID":"NTR-0403"}]"
</code>```

I need to insert multiple records into table without mentioning column names in the table. That means my input data may vary, and columns may change every time.

Thus I should create table structure and insert data into it.

I tried the below but it inserts only one record. If my input has  multiple records as shown above sample data it shows an error.

```<code>EXECUTE IMMEDIATE 'DROP INDEX idx_json_rr';
   EXECUTE IMMEDIATE 'Create search index idx_json_rr on tbl_rr_import_json_data ( jsondata )
  for json  parameters ( 'sync (on commit)' )';

begin
  dbms_json.create_view_on_path ('tbl_rr_json_vw', 'tbl_rr_import_json_data', 'jsondata', '$');
end;
</code>```

Body:
How to insert JSON data into PL/SQL table?

Sample input data to the procedure:

"[{"REPORTREFERENCENUMBER":"1","FIRSTNAME":"null","PHONENO":"8471921920","CUSTOMERID":"AD00000080660459615","UNIQUE_ID":"NTR-0403"},   {"REPORTREFERENCENUMBER":"2","FIRSTNAME":"null","PHONENO":"8471921920","CUSTOMERID":"AD00000080660459615","UNIQUE_ID":"NTR-0403"}]"

I need to insert multiple records into table without mentioning column names in the table. That means my input data may vary, and columns may change every time.

Thus I should create table structure and insert data into it.

I tried the below but it inserts only one record. If my input has  multiple records as shown above sample data it shows an error.

EXECUTE IMMEDIATE 'DROP INDEX idx_json_rr';
   EXECUTE IMMEDIATE 'Create search index idx_json_rr on tbl_rr_import_json_data ( jsondata )
  for json  parameters ( 'sync (on commit)' )';

begin
  dbms_json.create_view_on_path ('tbl_rr_json_vw', 'tbl_rr_import_json_data', 'jsondata', '$');
end;


问:
can someone help me figure out why my script automatically executes without out me pressing the button?
```<code>local OrionLib = loadstring(game:HttpGet(('https://raw.githubusercontent.com/shlexware/Orion/main/source')))()
local Window = OrionLib:MakeWindow({Name = "BoxHub", HidePremium = false, SaveConfig = true, ConfigFolder = "OrionTest"})

---Values
getgenv().AutoFarm = true

--tabs

local MainTab = Window:MakeTab({
    Name = "Main",
    Icon = "rbxassetid://4483345998",
    PremiumOnly = false
})
--toggels

MainTab:AddToggle({
    Name = "AutoFarm",
    Default = false,
    Callback = function(Value)
        wait(1)
        game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(-118.933174, 3.50129104, 63.7992935, -0.99859041, -2.3044068e-08, -0.0530771464, -2.18308767e-08, 1, -2.34369075e-08, 0.0530771464, -2.22451497e-08, -0.99859041)
        wait(1)
        game:GetService("ReplicatedStorage").Strength_Exercises.Squat1:FireServer()
        wait(17)
        game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(-144.613525, 3.50129104, -52.2876129, -0.0295129567, -3.152`48556e-08, 0.999564409, -2.02664463e-08, 1, 3.09402104e-08, -0.999564409, -1.93444816e-08, -0.0295129567)`
        wait(1)
        game:GetService("ReplicatedStorage").Strength_Exercises.Speed_Bag2:FireServer()
        wait(3)
    end
})
</code>```

i tried doing a function like this

```<code>function getgenv().AutoFarm
  AutoFarm() = Value
</code>```

and it just made the toggle button not work`

Body:
local OrionLib = loadstring(game:HttpGet(('https://raw.githubusercontent.com/shlexware/Orion/main/source')))()
local Window = OrionLib:MakeWindow({Name = "BoxHub", HidePremium = false, SaveConfig = true, ConfigFolder = "OrionTest"})

---Values
getgenv().AutoFarm = true

--tabs

local MainTab = Window:MakeTab({
    Name = "Main",
    Icon = "rbxassetid://4483345998",
    PremiumOnly = false
})
--toggels

MainTab:AddToggle({
    Name = "AutoFarm",
    Default = false,
    Callback = function(Value)
        wait(1)
        game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(-118.933174, 3.50129104, 63.7992935, -0.99859041, -2.3044068e-08, -0.0530771464, -2.18308767e-08, 1, -2.34369075e-08, 0.0530771464, -2.22451497e-08, -0.99859041)
        wait(1)
        game:GetService("ReplicatedStorage").Strength_Exercises.Squat1:FireServer()
        wait(17)
        game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(-144.613525, 3.50129104, -52.2876129, -0.0295129567, -3.152`48556e-08, 0.999564409, -2.02664463e-08, 1, 3.09402104e-08, -0.999564409, -1.93444816e-08, -0.0295129567)`
        wait(1)
        game:GetService("ReplicatedStorage").Strength_Exercises.Speed_Bag2:FireServer()
        wait(3)
    end
})

i tried doing a function like this

function getgenv().AutoFarm
  AutoFarm() = Value

and it just made the toggle button not work`


问:
502 bad gateway error on AWS kubernetes cluster with nodejs application
Getting 502 bad gateway error while doing performance testing
it occurs randomly on random API only 2-3 times in a 30 min execution

ingress logs show this error
11.150.71.00 - - [22/Dec/2022:10:44:17 +0000] "POST /api/quotes/test HTTP/1.1" 502 150 "-" "AmazonAPIGateway_hodcqxftdw" 1466 0.030 [cpq-cpq-server-service-9001] [] 11.150.71.177:9001 0 0.028 502 1322918b6f840892739d4dcf194e2226

I have added keep alive time for ingress still no success,
CPU and Memory both are stable there is no spike

Ingress.yml

```<code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: testIngress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/auth-tls-secret: "test/test-secret"
    nginx.ingress.kubernetes.io/auth-tls-verify-client: "off"
spec:
  rules:
  - host: test.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: testService
            port:
              number: 9001
</code>```

Body:
Getting 502 bad gateway error while doing performance testing
it occurs randomly on random API only 2-3 times in a 30 min execution

ingress logs show this error
11.150.71.00 - - [22/Dec/2022:10:44:17 +0000] "POST /api/quotes/test HTTP/1.1" 502 150 "-" "AmazonAPIGateway_hodcqxftdw" 1466 0.030 [cpq-cpq-server-service-9001] [] 11.150.71.177:9001 0 0.028 502 1322918b6f840892739d4dcf194e2226

I have added keep alive time for ingress still no success,
CPU and Memory both are stable there is no spike

Ingress.yml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: testIngress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/auth-tls-secret: "test/test-secret"
    nginx.ingress.kubernetes.io/auth-tls-verify-client: "off"
spec:
  rules:
  - host: test.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: testService
            port:
              number: 9001


问:
Matplotlib avoid plotting "overshooting" lines through canvas
I have the following setting using matplotlib:
I got particles that have x and y coordinates, and for every particle, I plot the way it moved over some time.

So I have multiple arrays containing x and y coordinates from particles like:

```<code>vals_x = [[] for x in x_vals[0]]
vals_y = [[] for x in x_vals[0]]
for i, x in enumerate(x_vals):
    for j, x1 in enumerate(x):
        vals_x[j].append(x1)
        vals_y[j].append(y_vals[i][j])

fig, ax = plt.subplots(figsize=(15, 8))

for i, xs in enumerate(vals_x):
    ax.plot(vals_y[i], xs)
</code>```

The problem I am having is that it allowed particles to move from one side of the canvas to the other side ([-100,100] for both axis). So, for example, if a particle leaves the plot "left," it comes in "right" again.
However, if I plot it like above, matplot logically plots over the whole canvas (sticking to the example from: a line from "left" to "right"). But I want that the line wrapps around the edges of the canvas.

For example, the orange line going from one side of the canvas to the other should not be here. It should go to the left edge of the canvas and start at the right edge instead of plotting the line through the whole canvas.
example of the problem

I hope my problem is clear. Is there any easy solution to this?

Body:
I have the following setting using matplotlib:
I got particles that have x and y coordinates, and for every particle, I plot the way it moved over some time.

So I have multiple arrays containing x and y coordinates from particles like:

vals_x = [[] for x in x_vals[0]]
vals_y = [[] for x in x_vals[0]]
for i, x in enumerate(x_vals):
    for j, x1 in enumerate(x):
        vals_x[j].append(x1)
        vals_y[j].append(y_vals[i][j])

fig, ax = plt.subplots(figsize=(15, 8))

for i, xs in enumerate(vals_x):
    ax.plot(vals_y[i], xs)

The problem I am having is that it allowed particles to move from one side of the canvas to the other side ([-100,100] for both axis). So, for example, if a particle leaves the plot "left," it comes in "right" again.
However, if I plot it like above, matplot logically plots over the whole canvas (sticking to the example from: a line from "left" to "right"). But I want that the line wrapps around the edges of the canvas.

For example, the orange line going from one side of the canvas to the other should not be here. It should go to the left edge of the canvas and start at the right edge instead of plotting the line through the whole canvas.
example of the problem

I hope my problem is clear. Is there any easy solution to this?


问:
How to remove Id using put method
Indexing.vue;

```<code>    <template>
      <div class="row">
        <div class="col-md-12">
          <card class="card-plain" card-body-classes="table-full-width" header-classes="row">
            <template slot="header" :class="row">
              <h3 class="card-title">Indexing</h3>
              <base-button type="primary" size="sm" @click="addNewIndexing" class="ml-4">Add     Indexing</base-button>
            </template>
            <div class="row indexing-cards-container pl-5">
              <div class="col card " v-for="data in indexingList"   :key="data.id">
                <div class="row">
                  <p class="pl-4">{{data.indexing_name}}</p>
                </div>
                <div class="row">
                  <p class="pl-4">{{data.indexing_url}}</p>
                </div>
                <div class="row  IndexingImage pb-2 ">
                  <img :src="data.indexing_image_url" class="rounded mx-auto d-block"/>
                </div>
                       <div class="row">
                    <div class="col pl-4">
                      <base-switch
                        class="mt-2"
                        v-model="data.is_active"
                    type="primary"
                    on-text="Active"
                    off-text="Inactive"
                      ></base-switch>
                    </div>
                <div class="col">
                      <base-button type="primary"  @click="deleteIndexing(data.id)">Delete</base button>
                </div>
               </div>
                </div>
                </div>
              </card>
          <!-- </div>
        </div>
          </card> -->
        </div>
      </div>
    </template>
    <script>
    import { Table, TableColumn } from 'element-ui';
    import { BaseSwitch } from 'src/components/index';

    export default {
  components: {
    [Table.name]: Table,
    [TableColumn.name]: TableColumn,
    BaseSwitch
  },
  data() {
    return {
      indexingList: [],

    };
  },
  methods: {
    addNewIndexing() {
      this.$router.push({path: 'addindexing'})
    },
    deleteIndexing: function() {
      this.api.putData('indexing/'+store.state.journalId, ).then((res)=> {
        console.log(res.data)

      })
    },
    getIndexingList: function() {
      this.api.getDataModule('indexing/'+store.state.journalId, 'journals/v1/').then((res) => {
        console.log(res.data)
        this.indexingList = res.data.indexingList
      }, (err) => {
        console.log(err)
      })
    },
  },
  mounted: function() {
    this.getIndexingList()
  }
};

    api.js;
      putData (action, data) {
        let url = `${BASE_URL}`
       url += action + '.json'
       return instance.put(url, data)
      },
</code>```

Issue :

We have separately created one component called (AddIndexing.vue) to get user details like indexing_name, indexing_url and indexing_image_url. And we wrote  post method to post those user datas to the server. That is working fine. In this component (Indexing.vue) I'm showing those received datas from the server, that is also working fine.

I want to implement the delete function in the deleteIndexing method. We wrote the complete API code in api.js file. But I have mentioned only putData function because my boss told me to implement the delete option by putData api function. So now for action parameter in the putData function I passed "indexing/'+store.state.journalId" as an argument through deleteIndexing function and for data parameter in the putData function

I don't know what to pass as an argument. My boss told me to create a temporary object in the name of indexing_id and he asked me to pass as an second argument because indexing_id is the name of the id for each index in the database. But I don't know how to implement exactly. If I click delete option then that button should delete one index data based on the ID.

This is what I need to do. I can post the data and I can get the data but I don't know how to delete. After filling all the fields user entered the submit option means that data will send to the server, and it will create a new index module to have that data for single customer. If we are filling two customer details it means it will create two indexes separately and those two customer details will show in the "indexing.vue" component.

So now by using delete option I want to delete any user details by the ID.' API code everything was working fine but I don't know how to implement. The I do have one toggle button for active state and inactive state for that also I have to write a code by using putData api function.

How to implement this so I can do based on that.

I want to know how to do active and inactive toggle button function also. I tried some ways but that doesn't work for me. I'm quite beginner here so that I'm struggling a lot to do these API's.

Title: How to remove Id using put method

Body:
Indexing.vue;

    <template>

          <card class="card-plain" card-body-classes="table-full-width" header-classes="row">
            <template slot="header" :class="row">

Indexing

              <base-button type="primary" size="sm" @click="addNewIndexing" class="ml-4">Add     Indexing</base-button>
            </template>

{{data.indexing_name}}

{{data.indexing_url}}

                      <base-switch
                        class="mt-2"
                        v-model="data.is_active"
                    type="primary"
                    on-text="Active"
                    off-text="Inactive"
                      ></base-switch>

                      <base-button type="primary"  @click="deleteIndexing(data.id)">Delete</base button>

              </card>

    </template>


问:
how to populate a listview widget with widgets depending on selections made
I'd like to populate a listview widget dependant on what the user chose earlier in the app. and If i can, i'd like to do this without using the visibility widget.

currently I have 40+ buttons the user can select and then depending on their selection, a listview widget will show more buttons that relate to their earlier selections. I thought the best way to do this is have the original buttons update a string variable and then I can reference that to work out what widgets to display in the listview.

I'm built a simplified version below where the original buttons, (option A and Option B) update a string variable (option Selection). when Option A is selected, I'd like the ListView widget below to be populated with Selection1 and Selection3 widgets and when Option B is selected the listview widget should be populated with Selection2 and Selection4 Widgets.

I've also left the selction2,3,4 widgets out of the below code for space saving they are exactly the same as Selection1 widget just with different texts on the buttons.

```<code>class TestPage extends StatefulWidget {
  const TestPage({Key? key}) : super(key: key);

  @override
  State<TestPage> createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {
  String optionSelection = '';
  String selectionSelection = '';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Row(
            children: [
              Buttons(
                  onTap: (val) {
                    setState(() {
                      optionSelection = val;
                      print(optionSelection);
                    });
                  },
                  text: 'Option 1'),
              SizedBox(
                width: 10,
              ),
              Buttons(
                  onTap: (val) {
                    setState(() {
                      optionSelection = val;
                      print(optionSelection);
                    });
                  },
                  text: 'Option 2'),
            ],
          ),
          Expanded(
            child: Container(
              child: SelectionListView(
                onTap: (val) {
                  setState(() {
                    selectionSelection = val;
                    print(selectionSelection);
                  });
                },
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class Buttons extends StatelessWidget {
  Buttons({required this.onTap, required this.text});

  final ValueChanged? onTap;
  final String text;
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        if (onTap != null) {
          onTap!(text);
        }
      },
      child: Container(
        height: 50,
        width: 100,
        color: Colors.yellow,
        child: Center(
          child: Text(
            text,
            style: TextStyle(color: Colors.black),
          ),
        ),
      ),
    );
  }
}

class SelectionListView extends StatelessWidget {
  SelectionListView({required this.onTap});

  final ValueChanged? onTap;

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        SelectionA(onTap: onTap),
        SelectionB(onTap: onTap),
        SelectionC(onTap: onTap),
        SelectionD(onTap: onTap),
      ],
    );
  }
}

class SelectionA extends StatelessWidget {
  SelectionA({required this.onTap});
  final ValueChanged? onTap;
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Buttons(onTap: onTap, text: 'Selection A1'),
        SizedBox(
          height: 10,
        ),
        Buttons(onTap: onTap, text: 'Selection A2'),
        SizedBox(
          height: 10,
        ),
        Buttons(onTap: onTap, text: 'Selection A3'),
        SizedBox(
          height: 10,
        ),
        Buttons(onTap: onTap, text: 'Selection A4'),
        SizedBox(
          height: 10,
        ),
      ],
    );
  }
}
</code>```

I know how to do this using the Visibility widget but because I have so many options and selections in my app, it means a amssive amount of bool variables. hence why I'd like it to work of a string variable that changes when the user presses a button.

thanks so much and any help would be greatly appreciated.

cheers

Body:
I'd like to populate a listview widget dependant on what the user chose earlier in the app. and If i can, i'd like to do this without using the visibility widget.

currently I have 40+ buttons the user can select and then depending on their selection, a listview widget will show more buttons that relate to their earlier selections. I thought the best way to do this is have the original buttons update a string variable and then I can reference that to work out what widgets to display in the listview.

I'm built a simplified version below where the original buttons, (option A and Option B) update a string variable (option Selection). when Option A is selected, I'd like the ListView widget below to be populated with Selection1 and Selection3 widgets and when Option B is selected the listview widget should be populated with Selection2 and Selection4 Widgets.

I've also left the selction2,3,4 widgets out of the below code for space saving they are exactly the same as Selection1 widget just with different texts on the buttons.

class TestPage extends StatefulWidget {
  const TestPage({Key? key}) : super(key: key);

  @override
  State<TestPage> createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {
  String optionSelection = '';
  String selectionSelection = '';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Row(
            children: [
              Buttons(
                  onTap: (val) {
                    setState(() {
                      optionSelection = val;
                      print(optionSelection);
                    });
                  },
                  text: 'Option 1'),
              SizedBox(
                width: 10,
              ),
              Buttons(
                  onTap: (val) {
                    setState(() {
                      optionSelection = val;
                      print(optionSelection);
                    });
                  },
                  text: 'Option 2'),
            ],
          ),
          Expanded(
            child: Container(
              child: SelectionListView(
                onTap: (val) {
                  setState(() {
                    selectionSelection = val;
                    print(selectionSelection);
                  });
                },
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class Buttons extends StatelessWidget {
  Buttons({required this.onTap, required this.text});

  final ValueChanged? onTap;
  final String text;
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        if (onTap != null) {
          onTap!(text);
        }
      },
      child: Container(
        height: 50,
        width: 100,
        color: Colors.yellow,
        child: Center(
          child: Text(
            text,
            style: TextStyle(color: Colors.black),
          ),
        ),
      ),
    );
  }
}

class SelectionListView extends StatelessWidget {
  SelectionListView({required this.onTap});

  final ValueChanged? onTap;

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        SelectionA(onTap: onTap),
        SelectionB(onTap: onTap),
        SelectionC(onTap: onTap),
        SelectionD(onTap: onTap),
      ],
    );
  }
}

class SelectionA extends StatelessWidget {
  SelectionA({required this.onTap});
  final ValueChanged? onTap;
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Buttons(onTap: onTap, text: 'Selection A1'),
        SizedBox(
          height: 10,
        ),
        Buttons(onTap: onTap, text: 'Selection A2'),
        SizedBox(
          height: 10,
        ),
        Buttons(onTap: onTap, text: 'Selection A3'),
        SizedBox(
          height: 10,
        ),
        Buttons(onTap: onTap, text: 'Selection A4'),
        SizedBox(
          height: 10,
        ),
      ],
    );
  }
}

I know how to do this using the Visibility widget but because I have so many options and selections in my app, it means a amssive amount of bool variables. hence why I'd like it to work of a string variable that changes when the user presses a button.

thanks so much and any help would be greatly appreciated.

cheers


问:
How to update Array without refreshing the page
How can i update array of users without refreshin page.
In database i have user

Im making request to take user data, and then i set user data into React Context.
Then i take profiles and map them on the page.

```<code>      {profiles === undefined || 0 ? "Loading..." :
         <>
          {profiles.map((user,id)=>
          <UserProfile key={id} name={user.name}/>
          )}
         </>
        }
</code>```

When i post new profile in the user data, i need to refresh the page to see new account.

```<code>  const handleSudmitProfile = (e) =>{ // function to set new profile
    e.preventDefault();
    if(name.length === 0){
      setMessageError(true); // set error if input is empty
    }
    if(name){
    setNewUserForm(false);
    setMessageError(false);// clear error
    axios.post(reqApiUrl+"/createProfile",{name},{ withCredentials: true })
    .then((res)=>setUser(res.data))
    .catch((err)=>console.log(err));
    }
  }
</code>```

This two popups on the one page, i just hide and show them.

Body:
How can i update array of users without refreshin page.
In database i have user

Im making request to take user data, and then i set user data into React Context.
Then i take profiles and map them on the page.

      {profiles === undefined || 0 ? "Loading..." :
         <>
          {profiles.map((user,id)=>
          <UserProfile key={id} name={user.name}/>
          )}
         </>
        }

When i post new profile in the user data, i need to refresh the page to see new account.

  const handleSudmitProfile = (e) =>{ // function to set new profile
    e.preventDefault();
    if(name.length === 0){
      setMessageError(true); // set error if input is empty
    }
    if(name){
    setNewUserForm(false);
    setMessageError(false);// clear error
    axios.post(reqApiUrl+"/createProfile",{name},{ withCredentials: true })
    .then((res)=>setUser(res.data))
    .catch((err)=>console.log(err));
    }
  }

This two popups on the one page, i just hide and show them.


问:
VSCode Explorer always excludes files in .gitignore
Using VS Code 1.74.2, any files or folders in .gitignore are excluded from the File Explorer tree. None of the solutions seen on the web work...

```<code>"explorer.excludeGitIgnore": false, doesn't work
files: exclude doesn't work
</code>```

Isn't .gitignore meant to indicate files and folders you don't want in the repository? If yes, then why does it also remove them from the VS Code file explorer. What can I do to stop files and folders going into the repository but still have them visible in the File Explorer tree?

Thanks

Body:
Using VS Code 1.74.2, any files or folders in .gitignore are excluded from the File Explorer tree. None of the solutions seen on the web work...

"explorer.excludeGitIgnore": false, doesn't work
files: exclude doesn't work

Isn't .gitignore meant to indicate files and folders you don't want in the repository? If yes, then why does it also remove them from the VS Code file explorer. What can I do to stop files and folders going into the repository but still have them visible in the File Explorer tree?

Thanks


问:
Getting an array of checked boxes (Combine duplicates in URLSearchParams into an array)
I have checkboxes in a form.  The same name but multiple values.

```<code><input type=checkbox name=checkname value=1>
<input type=checkbox name=checkname value=2>
<input type=checkbox name=checkname value=3>
<input type=checkbox name=checkname value=4>
<input type=checkbox name=checkname value=5>
</code>```

I read the result using URLSearchParams:

```<code>body='checkname=1&checkname=2&checkname=3&checkname=4&checkname=5'
params=new URLSearchParams(body)
URLSearchParams {
  'checkname' => '1',
  'checkname' => '2',
  'checkname' => '3',
  'checkname' => '4',
  'checkname' => '5' }
params.get('checkname')
'1'
</code>```

I would like to get an array of 1,2,3,4,5

Body:
I have checkboxes in a form.  The same name but multiple values.

<input type=checkbox name=checkname value=1>
<input type=checkbox name=checkname value=2>
<input type=checkbox name=checkname value=3>
<input type=checkbox name=checkname value=4>
<input type=checkbox name=checkname value=5>

I read the result using URLSearchParams:

body='checkname=1&checkname=2&checkname=3&checkname=4&checkname=5'
params=new URLSearchParams(body)
URLSearchParams {
  'checkname' => '1',
  'checkname' => '2',
  'checkname' => '3',
  'checkname' => '4',
  'checkname' => '5' }
params.get('checkname')
'1'

I would like to get an array of 1,2,3,4,5


问:
Is it possible to use config server to set the default timezone?
I am trying to use config server to set the default timezone for the application.

I have tried putting below value in VM argument and its working. -Duser.timezone=IST

However, when I am adding the property user.timezone to application.properties or bootstrap.properties or config server properties, it's not working.

Other thing I tried was using a @PostConstruct like below:

```<code>    @PostConstruct
    public void init() {
        // Setting Spring Boot SetTimeZone
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    }
</code>```

But here I am hardcoding the timezone information and I need it to be configurable.

I believe application might need this property in the very beginning of the application startup and thus, properties file settings are not working but I am not sure.

Is there any workaround or solution by which I can use config server to set the Default timezone to spring boot application?

Body:
I am trying to use config server to set the default timezone for the application.

I have tried putting below value in VM argument and its working. -Duser.timezone=IST

However, when I am adding the property user.timezone to application.properties or bootstrap.properties or config server properties, it's not working.

Other thing I tried was using a @PostConstruct like below:

    @PostConstruct
    public void init() {
        // Setting Spring Boot SetTimeZone
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    }

But here I am hardcoding the timezone information and I need it to be configurable.

I believe application might need this property in the very beginning of the application startup and thus, properties file settings are not working but I am not sure.

Is there any workaround or solution by which I can use config server to set the Default timezone to spring boot application?


问:
How to add scopes dynamically based on dev and Prod environnement in a swagger spec (swagger.json)?
I have 2 environnement (dev, prod), and foreach environnement we have 2 scopes
cli_customer_dev:read,  cli_customer_dev:write for DEV environement, and cli_customer_prod:read, cli_customer_dev:write for production environement.

how can I define these scopes based on environnement and when clicking on authorise button, it shows only scopes that belongs to env.

Actually, I have this in swagger.json:

```<code>  "securityDefinitions": {
    "OAuth2": {
      "type": "oauth2",
      "flow": "application",
      "tokenUrl": "https://*/v2/token",
      "scopes": {
        "cli_customer_dev:read" :  "read",
        "cli_customer_dev:write": "write"
      }
    }
  }
</code>```

And in html file I have this script :

```<code><script>
    window.onload = function () {
        // Begin Swagger UI call region
        const ui = SwaggerUIBundle({
            url: "/swagger.json",
            dom_id: '#swagger-ui',
            deepLinking: true,
            displayRequestDuration: true,
            tryItOutEnabled: true,
            presets: [
                SwaggerUIBundle.presets.apis,
                SwaggerUIStandalonePreset
            ],
            plugins: [
                SwaggerUIBundle.plugins.DownloadUrl
            ],
            layout: "StandaloneLayout",
            oauth2RedirectUrl: "https://*/v2/token"
        });
        // End Swagger UI call region

        window.ui = ui;
    };

</script>
</code>```

Body:
I have 2 environnement (dev, prod), and foreach environnement we have 2 scopes
cli_customer_dev:read,  cli_customer_dev:write for DEV environement, and cli_customer_prod:read, cli_customer_dev:write for production environement.

how can I define these scopes based on environnement and when clicking on authorise button, it shows only scopes that belongs to env.

Actually, I have this in swagger.json:

  "securityDefinitions": {
    "OAuth2": {
      "type": "oauth2",
      "flow": "application",
      "tokenUrl": "https://*/v2/token",
      "scopes": {
        "cli_customer_dev:read" :  "read",
        "cli_customer_dev:write": "write"
      }
    }
  }

And in html file I have this script :


问:
Can't choose option/value from drop down list using Selenium and Python
The website I want to automate is EURid.eu (with .eu domains). I want to choose domain from drop-down-list and click button to generate auth code. Below I attached traceback and my code...

I got error:

Traceback (most recent call last):   File
"C:\Users\Ryzen\PycharmProjects\eurid\main.py", line 129, in
main()   File "C:\Users\Ryzen\PycharmProjects\eurid\main.py", line 96, in main
select = Select(WebDriverWait(drv, timeout).until(   File "C:\Users\Ryzen\PycharmProjects\eurid\venv\lib\site-packages\selenium\webdriver\support\select.py",
line 37, in init
raise UnexpectedTagNameException(f"Select only works on  elements, not on {webelement.tag_name}")
selenium.common.exceptions.UnexpectedTagNameException: Message: Select
only works on  elements, not on div

My code that does not working:

```<code>timeout = 15
domain = "mydomain.eu"
select = Select(WebDriverWait(drv, timeout).until(
            EC.element_to_be_clickable((By.CLASS_NAME, "selpicker"))))

        pattern = re.compile(domain.lower())
        for option in select.options:
            value = option.get_attribute('value')
            if pattern.search(value):
                option.click()
                break

        code_button = WebDriverWait(drv, timeout).until(
            EC.element_to_be_clickable((By.XPATH, "/html/body/div[2]/div/div/div[3]/div[2]/div[1]/div/form/div[2]/button")))
        code_button.click()

        time.sleep(2)
        if "Current authorisation code for the domain name" in drv.page_source:
            auth_code = drv.find_element_by_xpath("/html/body/div[2]/div/div/div[3]/div[2]/div[1]/div/form/div[1]/div/div/span/a").text
            print(auth_code)

</code>```

Here is interesting part of EURid website:

```<code><div class="panel-footer text-right">
          <span class="">
            Select domain name:

<div class="dropdown bootstrap-select selpicker bs3 fit-width open">
<select class="selpicker" data-width="fit" data-style="btn-sm mar-rgt" name="name" tabindex="null">

                <option value="aaa1.eu">aaa1.eu</option>

                <option value="mydomain.eu">mydomain.eu</option>

                <option value="bbb2.eu">bbb2.eu</option>

            </select>
</div>
</code>```

Body:
The website I want to automate is EURid.eu (with .eu domains). I want to choose domain from drop-down-list and click button to generate auth code. Below I attached traceback and my code...

I got error:

Traceback (most recent call last):   File
"C:\Users\Ryzen\PycharmProjects\eurid\main.py", line 129, in
main()   File "C:\Users\Ryzen\PycharmProjects\eurid\main.py", line 96, in main
select = Select(WebDriverWait(drv, timeout).until(   File "C:\Users\Ryzen\PycharmProjects\eurid\venv\lib\site-packages\selenium\webdriver\support\select.py",
line 37, in init
raise UnexpectedTagNameException(f"Select only works on  elements, not on {webelement.tag_name}")
selenium.common.exceptions.UnexpectedTagNameException: Message: Select
only works on  elements, not on div

My code that does not working:

timeout = 15
domain = "mydomain.eu"
select = Select(WebDriverWait(drv, timeout).until(
            EC.element_to_be_clickable((By.CLASS_NAME, "selpicker"))))

        pattern = re.compile(domain.lower())
        for option in select.options:
            value = option.get_attribute('value')
            if pattern.search(value):
                option.click()
                break

        code_button = WebDriverWait(drv, timeout).until(
            EC.element_to_be_clickable((By.XPATH, "/html/body/div[2]/div/div/div[3]/div[2]/div[1]/div/form/div[2]/button")))
        code_button.click()

        time.sleep(2)
        if "Current authorisation code for the domain name" in drv.page_source:
            auth_code = drv.find_element_by_xpath("/html/body/div[2]/div/div/div[3]/div[2]/div[1]/div/form/div[1]/div/div/span/a").text
            print(auth_code)

Here is interesting part of EURid website:

            Select domain name:

<select class="selpicker" data-width="fit" data-style="btn-sm mar-rgt" name="name" tabindex="null">

                <option value="aaa1.eu">aaa1.eu</option>

                <option value="mydomain.eu">mydomain.eu</option>

                <option value="bbb2.eu">bbb2.eu</option>

            </select>


问:
How to load .mat file properly
I'm trying to load a .mat file with this the code:

```<code>from scipy.io import loadmat
matFile = loadmat('myFile.mat')

print(matFile)
</code>```

But when I try to access to data with

```<code>matVar = matFile['Walking']
</code>```

I get an array of void320 (1,1). How can I read properly the data? How can I access to all the subsets / variables inside the file?

Title: How to load .mat file properly

Body:
I'm trying to load a .mat file with this the code:

from scipy.io import loadmat
matFile = loadmat('myFile.mat')

print(matFile)

But when I try to access to data with

matVar = matFile['Walking']

I get an array of void320 (1,1). How can I read properly the data? How can I access to all the subsets / variables inside the file?


问:
How to read DayTime from txt File using Javascript?
In the script below, i redirect the main homepage to another one at a specific time (16:00:00).

Is there a way, to read the Daytime inputs from a text files? The Textfiles are in the same folder.
File1.txt ==> Line[0]==> 18:00:00
File2.txt ==> Line[0]==> 19:00:00
thanks for any advice.

```<code><script type="text/javascript">
function RedirectAt(hours, minutes, seconds) {
    var now = new Date();
    var then = new Date();

    if(now.getHours() > hours ||
      (now.getHours() == hours && now.getMinutes() > minutes) ||
       now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) {
       then.setDate(now.getDate() + 1);
    }
    then.setHours(hours);
    then.setMinutes(minutes);
    then.setSeconds(seconds);

    var timeout = (then.getTime() - now.getTime());
    setTimeout(function() { window.location.replace("page1.htm"); }, timeout);
}
RedirectAt(16,00,00);
</script>
</code>```