问:
"Warning, FIREBASE_CONFIG and GCLOUD PROJECT environment variables are missing. Initializing firebase-admin will fail"
I have a google cloud function That will send data from iot machine to Firebase Realtime database using MQTT broker. I was running this same code on virtual machine(VM) in gcp everything was working fine i was getting data in Realtime database. i also tried this code in my local system every thing is working fine. But when i tried to run the same code on cloud function I was getting some error i have fixed some of them but i was not able to fix this error Function cannot be initialized. Error: function terminated. Recommended action: inspect logs for termination reason. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging i am adding code and some images below for better understanding.

"In this image i have shown the content or thr files which is present in cloud function"

"In this image i have shown the .json file this json file is Private key file which i have generated in json" and give the same file name in ServiceAcoount const serviceAccount = require("./****-***-firebase-adminsdk-*****-******ca66.json"); and .runtimeconfig.json also contain private key file.

"I have not added anything in variable"

and this my code file

const Admin = require("firebase-admin");
const functions = require("firebase-functions");
const mqtt = require('mqtt');
const clientId = 'mqtt_googleserver_rtdb_main'
const topic = '#'

const serviceAccount = require("./****-*****-firebase-adminsdk-*****-******ca66.json");

Admin.initializeApp({
  credential: Admin.credential.cert(serviceAccount),
  databaseURL: "https://**********.firebaseio.com/"
});
exports.rtdb_main = functions.https.onRequest((request, response) => {
var client = mqtt.connect('mqtt://**.***.***.***:****',{
    clientId,
    clean: true,
    connectTimeout: 4000,
    username: '******',
    password: '*********',
    reconnectPeriod: 1000,
})
const db = Admin.database();

 //client.addListener or client.on is used to listen to the event 'connect' below
  client.addListener('connect',function(){
    console.log('Connected')
    client.subscribe([topic],{qos:1})
    console.log(`Subscribe to topic '${topic}'`)
})
client.on('message', (topic, payload) => {
    console.log('Received Message:', topic, payload.toString())
    if(payload.toString() !== "" && topic !== ""){
    var ref = db.ref("All_machines")
    var childref = ref.child(topic.toString())
   childref.set(payload.toString())
   //Use the code below to isolate any data from All Machines
   const topicDetails = topic.split("/")
   const catagory = topicDetails[0]
   const machineId = topicDetails[1]
   const machineParameter = topicDetails[2]

   if (machineParameter === "BoardID")
   {
   var ref = db.ref(machineParameter)
   ref.set(machineId)
   }
   }
  })
});
```
<p>This is my package.json</p>
<pre class="lang-json prettyprint-override"><code>{
  "name": "sample-http",
  "version": "0.0.1",
  "description": "Cloud Function for Realtime Database",
   "scripts": {
    "serve": "firebase emulators:start --only functions",
      "shell": "firebase functions:shell",
      "start": "npm run shell",
      "deploy": "firebase deploy --only functions",
      "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^11.4.1",
    "firebase-functions": "^3.14.1",
    "mqtt": "^4.3.7",
    "node-schedule": "^2.1.0"
  },

  "devDependencies": {
    "firebase-functions-test": "^0.2.0"
  },
  "private": true

}
</code>```

Body:
I have a google cloud function That will send data from iot machine to Firebase Realtime database using MQTT broker. I was running this same code on virtual machine(VM) in gcp everything was working fine i was getting data in Realtime database. i also tried this code in my local system every thing is working fine. But when i tried to run the same code on cloud function I was getting some error i have fixed some of them but i was not able to fix this error Function cannot be initialized. Error: function terminated. Recommended action: inspect logs for termination reason. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging i am adding code and some images below for better understanding.

"In this image i have shown the content or thr files which is present in cloud function"

"In this image i have shown the .json file this json file is Private key file which i have generated in json" and give the same file name in ServiceAcoount const serviceAccount = require("./****-***-firebase-adminsdk-*****-******ca66.json"); and .runtimeconfig.json also contain private key file.

"I have not added anything in variable"

and this my code file

const Admin = require("firebase-admin");
const functions = require("firebase-functions");
const mqtt = require('mqtt');
const clientId = 'mqtt_googleserver_rtdb_main'
const topic = '#'

const serviceAccount = require("./****-*****-firebase-adminsdk-*****-******ca66.json");

Admin.initializeApp({
  credential: Admin.credential.cert(serviceAccount),
  databaseURL: "https://**********.firebaseio.com/"
});
exports.rtdb_main = functions.https.onRequest((request, response) => {
var client = mqtt.connect('mqtt://**.***.***.***:****',{
    clientId,
    clean: true,
    connectTimeout: 4000,
    username: '******',
    password: '*********',
    reconnectPeriod: 1000,
})
const db = Admin.database();

 //client.addListener or client.on is used to listen to the event 'connect' below
  client.addListener('connect',function(){
    console.log('Connected')
    client.subscribe([topic],{qos:1})
    console.log(`Subscribe to topic '${topic}'`)
})
client.on('message', (topic, payload) => {
    console.log('Received Message:', topic, payload.toString())
    if(payload.toString() !== "" && topic !== ""){
    var ref = db.ref("All_machines")
    var childref = ref.child(topic.toString())
   childref.set(payload.toString())
   //Use the code below to isolate any data from All Machines
   const topicDetails = topic.split("/")
   const catagory = topicDetails[0]
   const machineId = topicDetails[1]
   const machineParameter = topicDetails[2]

   if (machineParameter === "BoardID")
   {
   var ref = db.ref(machineParameter)
   ref.set(machineId)
   }
   }
  })
});

This is my package.json

{
  "name": "sample-http",
  "version": "0.0.1",
  "description": "Cloud Function for Realtime Database",
   "scripts": {
    "serve": "firebase emulators:start --only functions",
      "shell": "firebase functions:shell",
      "start": "npm run shell",
      "deploy": "firebase deploy --only functions",
      "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^11.4.1",
    "firebase-functions": "^3.14.1",
    "mqtt": "^4.3.7",
    "node-schedule": "^2.1.0"
  },

  "devDependencies": {
    "firebase-functions-test": "^0.2.0"
  },
  "private": true

}


来源: stackexchange

ContentLicense: CC BY-SA 4.0

Title: Highlighting specific regions using Matplotlib

Body:
I have two arrays Ii01 and Iv01 and a list J. I am plotting a figure highlighting regions according to the arrays and the list but I also want to highlight other in-between regions (green rectangles) as shown in the expected output.

For example, Ii01[0][0]=array([0, 9]), Iv01[0][0]=array([0.50669985]). So the rectangle has to be placed between 0 and 9. But if Iv01[0][1]= array([2.12339725e-15]), Ii01[0][1]=array([6, 1]) which means no rectangle should be placed 6 and 1 since the corresponding value Iv01[0][1] is very small (<tol).

I also present the current output and the numbering scheme.

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import numpy as np
from matplotlib.colors import Normalize
from matplotlib import cm
import math
from  numpy import nan

fig,ax = plt.subplots(1)
n=5

N=2*n*(n-1)
tol=1e-9

Ii01=[np.array([[ 0,  9],
       [ 6,  1],
       [ 6,  2],
       [ 6, 11],
       [ 9, 13],
       [ 9, 14],
       [ 9, 18],
       [10,  1],
       [10,  6],
       [11,  2],
       [13, 14],
       [13, 18],
       [14, 10],
       [14, 15],
       [14, 18],
       [15, 10],
       [15, 11],
       [15, 16],
       [16, 11],
       [16, 12],
       [18, 23],
       [23, 24],
       [23, 28],
       [24, 25],
       [24, 29],
       [25, 29],
       [26, 25],
       [28, 24],
       [29, 34],
       [34, 35],
       [34, 39],
       [35, 39]])]

Iv01=[np.array([[5.06699852e-01],
       [2.12339725e-15],
       [4.13550077e-15],
       [1.72227525e-15],
       [1.52373662e-01],
       [1.61074525e-01],
       [3.00835056e-01],
       [6.79487120e-15],
       [4.42370647e-15],
       [2.48130046e-15],
       [6.78627540e-15],
       [1.49159465e-01],
       [1.16222264e-14],
       [1.08774049e-14],
       [1.49159465e-01],
       [1.20229928e-15],
       [7.75023863e-15],
       [4.76121254e-15],
       [3.01398169e-15],
       [3.28881299e-15],
       [6.11446470e-01],
       [3.78156546e-01],
       [1.99429033e-01],
       [1.74136110e-01],
       [3.56893326e-01],
       [1.75675731e-01],
       [1.10401108e-14],
       [1.81009884e-01],
       [5.31835816e-01],
       [1.81335471e-01],
       [3.73570441e-01],
       [1.71352591e-01]])]

J=[[32, 33, 3, 4, 5, 36, 7, 8, 37, 38, 17, 19, 20, 21, 22, 27, 30]]

for i in range(0,len(J)):
      J[i].sort()

C1=[0]

Path = []
for i in range(0, len(Ii01)):
    uniq = np.unique(Ii01[i][:, 1][None, :])
    #print(uniq)
    uniq = np.sort(np.concatenate((uniq, J[0])))
    print([uniq])

    Missing=[]
    for ele in range(uniq[0], uniq[-1]+1):
        if ele not in uniq:
            Missing.append(ele)
    print("Missing =", Missing)

    uniq = np.sort(np.concatenate((uniq, Missing)))

    y = Iv01[i][:, 0]
    x = Ii01[i][:, 1][:, None] == uniq
    output = np.vstack((np.linalg.lstsq(x, y, rcond=None)[0], uniq)).T
    Path.append(np.insert(output[:, 0], 0, 10))  # fixed inlet
print(Path)

X=Path[0].reshape(1,N)
X=np.array(X)
print("X =",[X])

for i in range(0,len(X[0])):
        if(X[0][i]<=tol):
            X[0][i]=0.0

X = np.where(X!=0, 10, 0)

for i in range(0,len(X)):
    Max=max(max(X[i]), max(X[i]))
    Min=min(min(X[i]), min(X[i]))
a=Min
b=Max

Amax= math.ceil(Max)
Amin= math.floor(Min)
#print(Amax, Amin)

color = cm.get_cmap('ocean_r')
norm = Normalize(vmin=Amin, vmax=Amax)
color_list = []
for i in range(len(X[0])):
    color_list.append(color(X[0,i]/Amax))
#print(color_list)
id = 0
for j in range(0, n):
    for k in range(n-1):
        ax.hlines(200+200*(n-j-1)+5*n, 200*(k+1)+5*n, 200*(k+2)+5*n, zorder=0, colors=color_list[id], linewidth=10.0)
        id += 1

    for i in range(0, n):
        rect = mpl.patches.Rectangle((200+200*i, 200+200*j), 10*n, 10*n, linewidth=1, edgecolor='black', facecolor='black')
        ax.add_patch(rect)
        if j < n-1:
            ax.vlines(200+200*i+5*n, 200*(n-1-j)+5*n, 200*(n-j)+5*n, zorder=0, colors=color_list[id], linewidth=10.0)
            id += 1

cb = fig.colorbar(cm.ScalarMappable(cmap=color, norm=norm))
# cb.set_label("Invaded interfaces")
ax.set_xlim(left = 0, right = 220*n)
ax.set_ylim(bottom = 0, top = 220*n)

cb.set_ticks([10])
cb.remove()
plt.title("Invasion Path \n Time = 0.0")
plt.show()

The numbering scheme is

The current output is

The expected output is


问:
How do I change default camera app android 12, or how I force my app to use third party camera
I have a xamarin app that uses xam.media (jamesmontemagno/MediaPlugin) for photos. In android 10 i was using Open Camera,(user was asked about the camera app he wants).
But in Android 12 this is gone.
The problem is that default camera, after 20-30 pictures, freezes with memory not enough problem.
So
How can i force xam.media to use Open Camera.
Or how can i change default Camera to Open Camera

Thanks In Advance

gave ALL QUERIES permission to manifest. Nothing changed.


问:
Search Icon clickable MUI
I want to make the search icon clickable so you can search what you have written by also clicking the icon

cant find anything on mui

ive tried to make a button on it but dont know what to do when it comes to onClick

Title: Search Icon clickable MUI


问:
ffmpeg - Unable to record screen and speaker audio at the same time
I'm trying to record my screen and speaker audio with ffmpeg but I'm facing various problems.

This is the command I'm using:

ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0.0 -f pulse -ac 2 -i alsa_output.pci-0000_2d_00.4.analog-stereo.monitor output.mp4
```
<p>but the output video is really slow and out of sync with the audio.<br />
Moreover, I'm getting these warnings:</p>
```[x11grab @ 0x563635302480] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[aac @ 0x563635319f40] Queue input is backward in time04.49 bitrate= 466.9kbits/s dup=268 drop=45 speed=1.84x
[mp4 @ 0x5636353172c0] Non-monotonous DTS in output stream 0:1; previous: 217669, current: 210387; changing to 217670. This may result in incorrect timestamps in the output file.
```

When recording the screen with alsa source (microphone), the output video has no problems.

How can I solve?

Body:
I'm trying to record my screen and speaker audio with ffmpeg but I'm facing various problems.

This is the command I'm using:

ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0.0 -f pulse -ac 2 -i alsa_output.pci-0000_2d_00.4.analog-stereo.monitor output.mp4

but the output video is really slow and out of sync with the audio.

Moreover, I'm getting these warnings:

[x11grab @ 0x563635302480] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[aac @ 0x563635319f40] Queue input is backward in time04.49 bitrate= 466.9kbits/s dup=268 drop=45 speed=1.84x
[mp4 @ 0x5636353172c0] Non-monotonous DTS in output stream 0:1; previous: 217669, current: 210387; changing to 217670. This may result in incorrect timestamps in the output file.

When recording the screen with alsa source (microphone), the output video has no problems.

How can I solve?


问:
How to make website responsive to current screen aspect ratio?
As the title says how do you make a website responsive to the screens aspect ratio? So if it's 16:9 it'll look one way, but if it's 9:16 it'l look another way.

I've only tried setting a max/min width/height but I realized it wouldn't actually consider the aspect ratio just the screen size. So if a smartphone had a 1920px width it would look the same as a normal 1920p monitor, which would obviously be a problem.


问:
Hi, I would like to get the second most repeated value within an array in javascript or if two elements are repeated the same number of times
I have a function that stores strings inside an array and after calculating which one is the most repeated it returns it to me. The problem is that now I also need to get the second most repeated and in case two elements are repeated the same number of times I need to get both elements. I have given it a lot of thought but I can't figure out how to do it.

I have tried to remove the most repeated element from the array once it has been returned and then run the same function again without that element, but I don't find it practical. I don't know if there is another way to do it, I hope you can help me, thank you very much in advance.

```<code>arrayTotal = [...result4, ...result7, ...result8, ...result10, ...result11, ...result12, ...result13, ...result14];
    var arrayOrder = arrayTotal.sort();
    console.log(arrayOrder);

    var map = {};
    var occurence = "";
    var valor_mayor = 0;

    if (typeof arrayOrder === "string") {
        arrayOrder = arrayOrder.split(" ");
    }

    for (let elemento of arrayOrder) {
        if (map[elemento]) {
            map[elemento]++;
        } else {
            map[elemento] = 1;
        }

    };

    for (let elemento in map) {
        if (map[elemento] > valor_mayor) {
            valor_mayor = map[elemento];
            occurence = elemento;
        }
    }
    console.log(valor_mayor);
    console.log(occurence);
</code>```

Body:
I have a function that stores strings inside an array and after calculating which one is the most repeated it returns it to me. The problem is that now I also need to get the second most repeated and in case two elements are repeated the same number of times I need to get both elements. I have given it a lot of thought but I can't figure out how to do it.

I have tried to remove the most repeated element from the array once it has been returned and then run the same function again without that element, but I don't find it practical. I don't know if there is another way to do it, I hope you can help me, thank you very much in advance.

arrayTotal = [...result4, ...result7, ...result8, ...result10, ...result11, ...result12, ...result13, ...result14];
    var arrayOrder = arrayTotal.sort();
    console.log(arrayOrder);

    var map = {};
    var occurence = "";
    var valor_mayor = 0;

    if (typeof arrayOrder === "string") {
        arrayOrder = arrayOrder.split(" ");
    }

    for (let elemento of arrayOrder) {
        if (map[elemento]) {
            map[elemento]++;
        } else {
            map[elemento] = 1;
        }

    };

    for (let elemento in map) {
        if (map[elemento] > valor_mayor) {
            valor_mayor = map[elemento];
            occurence = elemento;
        }
    }
    console.log(valor_mayor);
    console.log(occurence);


问:
Scala spark aggregator NotSerializableException
I have DataSet with id and sub_ids. I want to use Aggregator for grouping sub_ids per ids into set.

When I execute below code in databricks:

```<code>%scala

import org.apache.spark.sql.{DataFrame, Dataset, Encoder}
import org.apache.spark.sql.expressions.Aggregator
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder

case class SubIdPerId(id: Int, sub_id: String)
case class SubIdsPerId(id: Int, sub_ids: Set[String])

object PreprocessData{
  def createSubIdsArray(df: Dataset[SubIdPerId]): Dataset[SubIdsPerId] = {
      val transformedData: Dataset[SubIdsPerId] =
      df.groupByKey(_.id)
        .agg(
          PreprocessData.distinctSubIdsAggregator.toColumn.name("sub_ids")
        ).map{
          case(id: Int, si: Set[String]) => SubIdsPerId(id, si)
        }
    transformedData
  }

  val distinctSubIdsAggregator: Aggregator[SubIdPerId, Set[String], Set[String]] = new Aggregator[SubIdPerId, Set[String], Set[String]] {
    override def zero: Set[String] = Set[String]()

    override def reduce(es: Set[String], supi: SubIdPerId): Set[String] =
      es + supi.sub_id

    override def merge(wx: Set[String], wy: Set[String]): Set[String] =
      wx.union(wy)

    override def finish(reduction: Set[String]): Set[String] = reduction

    override def bufferEncoder: Encoder[Set[String]] =
      implicitly(ExpressionEncoder[Set[String]])

    override def outputEncoder: Encoder[Set[String]] =
      implicitly(ExpressionEncoder[Set[String]])
  }
}

val df_t = Seq(
(1, "zk67"),
(1, "gg89"),
(2, "gg97"),
(2, "gd01"),
(2, "af83"),
(3, "af84"),
(3, "gd77"),
(3, "gd73"),
(3, "cl55"),
(3, "zk67")
).toDF("id","sub_id")

val ds_t = df_t.as[SubIdPerId]
val transformedData = PreprocessData.createSubIdsArray(ds_t)

display(transformedData)
</code>```

I receive:

```<code>NotSerializableException: $line813d300e73a74f3e9ab1e2bfe2afe2de59.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$PreprocessData$
</code>```

Additional note:
When I execute this code without wrapping it into object it works:

```<code>ds_t.groupByKey(_.id).agg(distinctSubIdsAggregator.toColumn.name("sub_ids"))
</code>```

Body:
I have DataSet with id and sub_ids. I want to use Aggregator for grouping sub_ids per ids into set.

When I execute below code in databricks:

%scala

import org.apache.spark.sql.{DataFrame, Dataset, Encoder}
import org.apache.spark.sql.expressions.Aggregator
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder

case class SubIdPerId(id: Int, sub_id: String)
case class SubIdsPerId(id: Int, sub_ids: Set[String])

object PreprocessData{
  def createSubIdsArray(df: Dataset[SubIdPerId]): Dataset[SubIdsPerId] = {
      val transformedData: Dataset[SubIdsPerId] =
      df.groupByKey(_.id)
        .agg(
          PreprocessData.distinctSubIdsAggregator.toColumn.name("sub_ids")
        ).map{
          case(id: Int, si: Set[String]) => SubIdsPerId(id, si)
        }
    transformedData
  }

  val distinctSubIdsAggregator: Aggregator[SubIdPerId, Set[String], Set[String]] = new Aggregator[SubIdPerId, Set[String], Set[String]] {
    override def zero: Set[String] = Set[String]()

    override def reduce(es: Set[String], supi: SubIdPerId): Set[String] =
      es + supi.sub_id

    override def merge(wx: Set[String], wy: Set[String]): Set[String] =
      wx.union(wy)

    override def finish(reduction: Set[String]): Set[String] = reduction

    override def bufferEncoder: Encoder[Set[String]] =
      implicitly(ExpressionEncoder[Set[String]])

    override def outputEncoder: Encoder[Set[String]] =
      implicitly(ExpressionEncoder[Set[String]])
  }
}

val df_t = Seq(
(1, "zk67"),
(1, "gg89"),
(2, "gg97"),
(2, "gd01"),
(2, "af83"),
(3, "af84"),
(3, "gd77"),
(3, "gd73"),
(3, "cl55"),
(3, "zk67")
).toDF("id","sub_id")

val ds_t = df_t.as[SubIdPerId]
val transformedData = PreprocessData.createSubIdsArray(ds_t)

display(transformedData)

I receive:

NotSerializableException: $line813d300e73a74f3e9ab1e2bfe2afe2de59.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$PreprocessData$

Additional note:
When I execute this code without wrapping it into object it works:

ds_t.groupByKey(_.id).agg(distinctSubIdsAggregator.toColumn.name("sub_ids"))


问:
How to get the first column in ag grid with example
I wanted to pass first column as an argument so wanted to know how to get the first column in ag grid.

I wanted to get the first column


问:
How to add insets to view's margin wth keeping previous margin?
I'm using edge-to-edge in my app. I want to add info window (ViewStub) at the top of the screen. Also i need to apply margin to this window to avoid it drawing on system top panel. I'm using this code:

```<code>fun View.applyTopInsetAsMargin() {
    ViewCompat.setOnApplyWindowInsetsListener(this) { view, windowInsets ->
        val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
        view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
            topMargin = insets.top
        }
        windowInsets
    }
}
</code>```

It's working fine but it's overriding margin to just inset size. In my viewstub i'm setting topMagin to 8 dp because i need to lay it down from status bar and add extra 8 dp margin.

The problem is: when i'm using this extension my 8 dp margin getting overrided so viewstub is only getting top inset size. How can i presave my extra margin and apply it to my view?

```<code>val popupBinding = DemoPopupWindowBinding.bind(binding.demoPopupStub.inflate())
popupBinding.root.applyTopInsetAsMargin()

<ViewStub
        android:id="@+id/demo_popup_stub"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/horizontal_margin_16"
        android:layout_marginTop="@dimen/vertical_margin_8"
        android:layout_marginEnd="@dimen/horizontal_margin_16"
        android:inflatedId="@+id/demo_popup_window"
        android:layout="@layout/demo_popup_window" />
</code>```

viewstub layout:

```<code><androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/demo_scheme_popup_background"
    android:padding="@dimen/padding_8">
    ...
</code>```

Body:
I'm using edge-to-edge in my app. I want to add info window (ViewStub) at the top of the screen. Also i need to apply margin to this window to avoid it drawing on system top panel. I'm using this code:

fun View.applyTopInsetAsMargin() {
    ViewCompat.setOnApplyWindowInsetsListener(this) { view, windowInsets ->
        val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
        view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
            topMargin = insets.top
        }
        windowInsets
    }
}

It's working fine but it's overriding margin to just inset size. In my viewstub i'm setting topMagin to 8 dp because i need to lay it down from status bar and add extra 8 dp margin.

The problem is: when i'm using this extension my 8 dp margin getting overrided so viewstub is only getting top inset size. How can i presave my extra margin and apply it to my view?

val popupBinding = DemoPopupWindowBinding.bind(binding.demoPopupStub.inflate())
popupBinding.root.applyTopInsetAsMargin()

<ViewStub
        android:id="@+id/demo_popup_stub"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/horizontal_margin_16"
        android:layout_marginTop="@dimen/vertical_margin_8"
        android:layout_marginEnd="@dimen/horizontal_margin_16"
        android:inflatedId="@+id/demo_popup_window"
        android:layout="@layout/demo_popup_window" />

viewstub layout:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/demo_scheme_popup_background"
    android:padding="@dimen/padding_8">
    ...


问:
Predis sub/pub on multiple channels with laravel
**Hi every one **,

I'm using predis with laravel in microservice architecture, and I have the following scenario :

App 1 :

in a controller I published an event in the 'timeslot' channel.

```<code>Redis::connection('timeslot')->publish('timeslot/updateStatus', json_encode([
    'timeslot' => $this->timeSlot,
    'customer' => $this->file->customer_id
]));
</code>```

App2:

I subscribed to this channel 'timeslot' and I have a process that makes a modification in a model (that works).

I have a listener in this model when updating I launch another redis event to app 1 in other channel (event)

```<code>static::updated(function (TimeSlot $model) {
if($model->isDirty('state') && $model->state->value === 'booked'){
      $result = json_encode(array_merge($model->toArray(), $model->agency->toArray()));
           Redis::connection('event')->publish('timeslot/booked', $result);
      }
});
</code>```

when executing this part I would have the following error:

```<code>fclose(): supplied resource is not a valid stream resource

at vendor/predis/predis/src/Connection/StreamConnection.php:247
    243▕      */
    244▕     public function disconnect()
    245▕     {
    246▕         if ($this->isConnected()) {
  ➜ 247▕             fclose($this->getResource());
    248▕             parent::disconnect();
    249▕         }
    250▕     }
    251▕
</code>```

Diagram
Any help please.
Thank you

I tried to do it on same channel but also i got an error

Body:
**Hi every one **,

I'm using predis with laravel in microservice architecture, and I have the following scenario :

App 1 :

in a controller I published an event in the 'timeslot' channel.

Redis::connection('timeslot')->publish('timeslot/updateStatus', json_encode([
    'timeslot' => $this->timeSlot,
    'customer' => $this->file->customer_id
]));

App2:

I subscribed to this channel 'timeslot' and I have a process that makes a modification in a model (that works).

I have a listener in this model when updating I launch another redis event to app 1 in other channel (event)

static::updated(function (TimeSlot $model) {
if($model->isDirty('state') && $model->state->value === 'booked'){
      $result = json_encode(array_merge($model->toArray(), $model->agency->toArray()));
           Redis::connection('event')->publish('timeslot/booked', $result);
      }
});

when executing this part I would have the following error:

fclose(): supplied resource is not a valid stream resource

at vendor/predis/predis/src/Connection/StreamConnection.php:247
    243▕      */
    244▕     public function disconnect()
    245▕     {
    246▕         if ($this->isConnected()) {
  ➜ 247▕             fclose($this->getResource());
    248▕             parent::disconnect();
    249▕         }
    250▕     }
    251▕

Diagram
Any help please.
Thank you

I tried to do it on same channel but also i got an error


问:
(python website) how to let website get output from other python script
follow by discussion Get output of python script from within python script

I create online webpage (.html) run other .py script result, but face model not found error

logically seems the python code is fine, might the setting error or other issue I don't come up myself

printbob.py

```<code>#!/usr/bin/env python

import sys

def main(args):
    for arg in args:
        print(arg)

if __name__ == '__main__':
    main(sys.argv)
</code>```

test_0109_003.html

```<code><html>
    <head>
      <link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
      <script defer src="https://pyscript.net/latest/pyscript.js"></script>
    </head>
  <body>
    <b><p>title test 1.10-test_get_ print  </p></b>
    <br>

    <py-script>
      import printbob

      printbob.main('arg1 arg2 arg3 arg4'.split(' '))

    </py-script>
  </body>
</html>
</code>```

(pic 01) the result website showing

(pic 02) I put .py and .html script in WinSCP, online host system

so how to solve this problem, I locate that there might be the resaon

my winscp ip port is private that public   cannot access to private's file, I'm not sure if this the reason, and if so, how to deal with it?

Body:
follow by discussion Get output of python script from within python script

I create online webpage (.html) run other .py script result, but face model not found error

logically seems the python code is fine, might the setting error or other issue I don't come up myself

printbob.py

#!/usr/bin/env python

import sys

def main(args):
    for arg in args:
        print(arg)

if __name__ == '__main__':
    main(sys.argv)

test_0109_003.html

      <link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />

title test 1.10-test_get_ print

    <py-script>
      import printbob

      printbob.main('arg1 arg2 arg3 arg4'.split(' '))

    </py-script>

(pic 01) the result website showing

(pic 02) I put .py and .html script in WinSCP, online host system

so how to solve this problem, I locate that there might be the resaon

my winscp ip port is private that public   cannot access to private's file, I'm not sure if this the reason, and if so, how to deal with it?


问:
How to set the hint_text to stay always on the top?
I would like to have an MDTextField, whose hint_text stays always in the top of it, even if it's not focused or they are no letter written on it, but I don´t know how nor if it is possible.

code:

```<code>from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.core.window import Window
from kivymd.uix.screen import MDScreen

Window.size = (300, 500)

navigation_helper = """

<CalculatorScreen>
    name: 'calculator_screen'
    MDBoxLayout:

        orientation: 'vertical'
        padding: (0, "70dp" , 0, 0)
        pos_hint: {"top": 1}
        spacing: "5dp"

        MDBoxLayout:
            id: food_block
            padding : ("5dp",0,"5dp",0)
            size_hint: (1,None)
            height: "33dp"
            padding: ("2dp",0,"2dp","-20dp")

            MDTextField:
                id: kcal_result
                hint_text: "Kcal"
                size_hint: (0.14,None)
                height: "30dp"

            MDTextField:
                id: proteins_result
                hint_text: "Proteínas"
                readonly: True
                size_hint: (0.185,None)
                height: "30dp"
            MDTextField:
                id: carbohydrates_result
                hint_text: "Glúcidos"
                readonly: True
                size_hint: (0.175,None)
                height: "30dp"

            MDTextField:
                id: lipids_result
                hint_text: "Grasas"
                readonly: True
                size_hint: (0.15,None)
                height: "30dp"

            MDTextField:
                id: sugar_result
                hint_text_font_size: "5dp"
                hint_text: "Azúcar"

                readonly: True
                size_hint: (0.15,None)
                height: "30dp"
            MDTextField:
                id: salt_result
                hint_text : "Sal"
                readonly: False
                size_hint: (0.10,None)
                height: "30dp"

<MainScreen>:
    name: "main_screen"

    BoxLayout:
        orientation: 'vertical'

        MDTopAppBar:
            id: title_bar
            title: 'Dietas'
            md_bg_color: 0.08,0.07,0.45
            specific_text_color: 1,1,1
            left_action_items: [["menu", lambda x: nav_drawer.set_state('toggle')]]

        Widget:

    MDNavigationLayout:

        ScreenManager:
            id: scr

            CalculatorScreen:

        MDNavigationDrawer:
            id: nav_drawer

            BoxLayout:
                orientation: 'vertical'
                spacing: '8dp'

                ScrollView:
                    MDList:

                        OneLineListItem:
                            text: "Calcular comida"
                            on_press:
                                scr.current= 'calculator_screen'
                                title_bar.title = "Calculadora Comida"
                                nav_drawer.set_state('close')

MainScreen:
"""

class CalculatorScreen(MDScreen):
    pass

class MainScreen(MDScreen):
    def disable_top_bar2(self):
        self.ids.title_bar.disabled = True
    def enable_top_bar(self):
        self.ids.title_bar.disabled = False

class DemoApp(MDApp):
    def build(self):
        self.theme_cls.theme_style = ("Dark")
        screen = Builder.load_string(navigation_helper)
        return screen

DemoApp().run()
</code>```

I tried to set a hint_text on_text but didn't work (it appears only when clicked, remained there after deleting text, and stayed big in the top)

Body:
I would like to have an MDTextField, whose hint_text stays always in the top of it, even if it's not focused or they are no letter written on it, but I don´t know how nor if it is possible.

code:

from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.core.window import Window
from kivymd.uix.screen import MDScreen

Window.size = (300, 500)

navigation_helper = """

<CalculatorScreen>
    name: 'calculator_screen'
    MDBoxLayout:

        orientation: 'vertical'
        padding: (0, "70dp" , 0, 0)
        pos_hint: {"top": 1}
        spacing: "5dp"

        MDBoxLayout:
            id: food_block
            padding : ("5dp",0,"5dp",0)
            size_hint: (1,None)
            height: "33dp"
            padding: ("2dp",0,"2dp","-20dp")

            MDTextField:
                id: kcal_result
                hint_text: "Kcal"
                size_hint: (0.14,None)
                height: "30dp"

            MDTextField:
                id: proteins_result
                hint_text: "Proteínas"
                readonly: True
                size_hint: (0.185,None)
                height: "30dp"
            MDTextField:
                id: carbohydrates_result
                hint_text: "Glúcidos"
                readonly: True
                size_hint: (0.175,None)
                height: "30dp"

            MDTextField:
                id: lipids_result
                hint_text: "Grasas"
                readonly: True
                size_hint: (0.15,None)
                height: "30dp"

            MDTextField:
                id: sugar_result
                hint_text_font_size: "5dp"
                hint_text: "Azúcar"

                readonly: True
                size_hint: (0.15,None)
                height: "30dp"
            MDTextField:
                id: salt_result
                hint_text : "Sal"
                readonly: False
                size_hint: (0.10,None)
                height: "30dp"

<MainScreen>:
    name: "main_screen"

    BoxLayout:
        orientation: 'vertical'

        MDTopAppBar:
            id: title_bar
            title: 'Dietas'
            md_bg_color: 0.08,0.07,0.45
            specific_text_color: 1,1,1
            left_action_items: [["menu", lambda x: nav_drawer.set_state('toggle')]]

        Widget:

    MDNavigationLayout:

        ScreenManager:
            id: scr

            CalculatorScreen:

        MDNavigationDrawer:
            id: nav_drawer

            BoxLayout:
                orientation: 'vertical'
                spacing: '8dp'

                ScrollView:
                    MDList:

                        OneLineListItem:
                            text: "Calcular comida"
                            on_press:
                                scr.current= 'calculator_screen'
                                title_bar.title = "Calculadora Comida"
                                nav_drawer.set_state('close')

MainScreen:
"""

class CalculatorScreen(MDScreen):
    pass

class MainScreen(MDScreen):
    def disable_top_bar2(self):
        self.ids.title_bar.disabled = True
    def enable_top_bar(self):
        self.ids.title_bar.disabled = False

class DemoApp(MDApp):
    def build(self):
        self.theme_cls.theme_style = ("Dark")
        screen = Builder.load_string(navigation_helper)
        return screen

DemoApp().run()

I tried to set a hint_text on_text but didn't work (it appears only when clicked, remained there after deleting text, and stayed big in the top)


问:
How to make a Factory Contract which deploys a UUPS Proxy?
I have UUPS erc721 contract. I have deployed them. Now I have a proxy contract and a logic contract.
Lets say logic contract has address 0x1234

I want a factory contract to deploy multiple upgradeable proxies by copying a already deployed proxy from blockchain and all those proxies using logic contract at address 0x1234.

I want the project to be like as shown in the figure.

I have tried the following code but it does not produce the expected result. Proxy is not initialized/Deployed :
My ERC721 contract takes ownerAddress, name and symbol as initializer arguments. ERC721 is upgradeable so it uses a initializer and not a constructor.

```<code>pragma solidity 0.8.15;

import "./GenericERC721.sol";
import "./cloneFactory.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";

contract GenericFactory is Ownable, CloneFactory {
    address public proxyAddress;
    address public logicAddress;

    address[] public addressBook;

    event GenericERC721created(address deployedProxyAddress);

    constructor(address _proxyAddress, address _logicAddress) {
        proxyAddress = _proxyAddress;
        logicAddress =_logicAddress;
    }

    function createProxy(
        address _owner,
        string calldata _name,
        string calldata _symbol
    ) public onlyOwner {

        address clone = createClone(proxyAddress);
        ERC1967Proxy(clone).constructor(logicAddress, abi.encodeWithSignature("initialize(address,string,string)", _owner, _name, _symbol));
        addressBook.push(clone);
        emit GenericERC721created(clone);
    }
}
</code>```

Body:
I have UUPS erc721 contract. I have deployed them. Now I have a proxy contract and a logic contract.
Lets say logic contract has address 0x1234

I want a factory contract to deploy multiple upgradeable proxies by copying a already deployed proxy from blockchain and all those proxies using logic contract at address 0x1234.

I want the project to be like as shown in the figure.

I have tried the following code but it does not produce the expected result. Proxy is not initialized/Deployed :
My ERC721 contract takes ownerAddress, name and symbol as initializer arguments. ERC721 is upgradeable so it uses a initializer and not a constructor.

pragma solidity 0.8.15;

import "./GenericERC721.sol";
import "./cloneFactory.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";

contract GenericFactory is Ownable, CloneFactory {
    address public proxyAddress;
    address public logicAddress;

    address[] public addressBook;

    event GenericERC721created(address deployedProxyAddress);

    constructor(address _proxyAddress, address _logicAddress) {
        proxyAddress = _proxyAddress;
        logicAddress =_logicAddress;
    }

    function createProxy(
        address _owner,
        string calldata _name,
        string calldata _symbol
    ) public onlyOwner {

        address clone = createClone(proxyAddress);
        ERC1967Proxy(clone).constructor(logicAddress, abi.encodeWithSignature("initialize(address,string,string)", _owner, _name, _symbol));
        addressBook.push(clone);
        emit GenericERC721created(clone);
    }
}


问:
Angular mat-table UI not updating on datasource update - (signalr-azure service live update)
We are using server-stream updates from the signalr-azure service to get live updates from the backend, and the WebSocket is blocked on the client-side(browser).
We can observe that the data is being updated in debugging, but the mat-table UI is not updated without any mouse events.

Steps to reproduce:

Create a signalr-service for live updates
Create a connection with signalr service and render the incoming data in a mat-table
Block the web-socket on client-side(browser), use event stream updates to receive data from signalr
Create a button to reload the data, onClick of the button expected to update the mat-table with recent data.

Expected Behavior
mat-table should load the data onClick of the button

Actual Behavior
mat-table datasource being updated but not reflected in the UI until any mouse event is performed (cursor movement)

Environment
Angular: 13.0.x
CDK/Material: v 13.0.2
Browser(s): Chrome Version 108.0.5359.98 (Official Build) (64-bit)
Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

We were trying to use signal-r azure service to show live update of data.


问:
How to get access token of an account to invoke google appscript apis programatically?
I would want to get the ID token to be consumed in google appscript web app (which needs my account) in order to access the API.

My end goal is to know how can I achieve getGoogleIDTokenToInvokeAppScriptEndPoint (I have added in my sample code).

What exactly needs to be done to programatically access ID Token to invoke AppScript APIs from external service.

I am not sure how to generate the same programatically. Do I need to create a service account on my behalf?

Lets say I created a google account as abc@gmail.com, so I need to access the service account programatically for this user only and not some other service account. I then want to get the ID token and invoke my appscript services using the same.

Here's what I have already done:

Created my doPost request and deployed it like this:

Now the URL that I get can only be invoked if it has a bearer ${token}, where token is my ID token.

My question is how to possibly get this ID token programatically from an external service? I am using Node Application and I would like something like:

```<code>
// External Script from where I am invoking AppScript API
const token = getGoogleIDTokenToInvokeAppScriptEndPoint();
// Now Since I got my ID Token, I could use the same
// to invoke my appScript app:
fetch(appScriptEndpoint,
    {
    method:"POST",
    headers: {
        Authorization: `Bearer ${token}` // Token I got from first step
    }
}).then(res => res.json().then(data => data))
</code>```

Here's how my appscript looks like (though not much relevant here, but still adding for detailing):

```<code>// AppScript Script
const doPost = (request = {}) => {
    const { _, postData: { contents, type } = {} } = request;
    let query = {};
    if (type === 'application/json') {
        query = JSON.parse(contents);
    } else if (type === 'application/x-www-form-urlencoded') {
        contents
            .split('&')
            .map((input) => input.split('='))
            .forEach(([key, value]) => {
                query[decodeURIComponent(key)] = decodeURIComponent(value);
            });
    } else if (type === 'text/plain') {
        try {
            query = JSON.parse(contents);
        } catch (e) {
            return ContentService.createTextOutput(
                JSON.stringify({
                    error: true,
          statusCode: 400,
                    msg: 'Unable to Parse JSON',
                    type: type,
                    requestBody: contents,
          payload: {}
                })
            ).setMimeType(ContentService.MimeType.JSON);
        }
    } else
        return ContentService.createTextOutput(
            JSON.stringify({
                error: true,
        statusCode: 400,
                msg: 'Unknown Request Type',
                type: type,
        requestBody: contents,
        payload: {}
            })
        ).setMimeType(ContentService.MimeType.JSON);

    const apiKey = query.apiKey;
    const isAuthenticated = authenticate({apiKey});
  if(!isAuthenticated) return ContentService.createTextOutput(
            JSON.stringify({
                error: true,
        statusCode: 401,
                msg: 'User not authorized to make the Request.',
                type: type,
        requestBody: contents,
        payload: {}
            })
        ).setMimeType(ContentService.MimeType.JSON);
  else {
    const {opType,opProps} = query;
    const result = requestHandler({opType, opProps});
    return ContentService.createTextOutput(
            JSON.stringify({
                error: false,
        statusCode: 200,
                msg: 'Connection Established',
                type: type,
        requestBody: contents,
        payload: result
            })
        ).setMimeType(ContentService.MimeType.JSON);
    }
};
</code>```

Please note that I already know how to invoke it by keeping my web app open however, I want to invoke it when authentication is required as shown in the above configuration.

Body:
I would want to get the ID token to be consumed in google appscript web app (which needs my account) in order to access the API.

My end goal is to know how can I achieve getGoogleIDTokenToInvokeAppScriptEndPoint (I have added in my sample code).

What exactly needs to be done to programatically access ID Token to invoke AppScript APIs from external service.

I am not sure how to generate the same programatically. Do I need to create a service account on my behalf?

Lets say I created a google account as abc@gmail.com, so I need to access the service account programatically for this user only and not some other service account. I then want to get the ID token and invoke my appscript services using the same.

Here's what I have already done:

Created my doPost request and deployed it like this:

Now the URL that I get can only be invoked if it has a bearer ${token}, where token is my ID token.

My question is how to possibly get this ID token programatically from an external service? I am using Node Application and I would like something like:

// External Script from where I am invoking AppScript API
const token = getGoogleIDTokenToInvokeAppScriptEndPoint();
// Now Since I got my ID Token, I could use the same
// to invoke my appScript app:
fetch(appScriptEndpoint,
    {
    method:"POST",
    headers: {
        Authorization: `Bearer ${token}` // Token I got from first step
    }
}).then(res => res.json().then(data => data))

Here's how my appscript looks like (though not much relevant here, but still adding for detailing):

// AppScript Script
const doPost = (request = {}) => {
    const { _, postData: { contents, type } = {} } = request;
    let query = {};
    if (type === 'application/json') {
        query = JSON.parse(contents);
    } else if (type === 'application/x-www-form-urlencoded') {
        contents
            .split('&')
            .map((input) => input.split('='))
            .forEach(([key, value]) => {
                query[decodeURIComponent(key)] = decodeURIComponent(value);
            });
    } else if (type === 'text/plain') {
        try {
            query = JSON.parse(contents);
        } catch (e) {
            return ContentService.createTextOutput(
                JSON.stringify({
                    error: true,
          statusCode: 400,
                    msg: 'Unable to Parse JSON',
                    type: type,
                    requestBody: contents,
          payload: {}
                })
            ).setMimeType(ContentService.MimeType.JSON);
        }
    } else
        return ContentService.createTextOutput(
            JSON.stringify({
                error: true,
        statusCode: 400,
                msg: 'Unknown Request Type',
                type: type,
        requestBody: contents,
        payload: {}
            })
        ).setMimeType(ContentService.MimeType.JSON);

    const apiKey = query.apiKey;
    const isAuthenticated = authenticate({apiKey});
  if(!isAuthenticated) return ContentService.createTextOutput(
            JSON.stringify({
                error: true,
        statusCode: 401,
                msg: 'User not authorized to make the Request.',
                type: type,
        requestBody: contents,
        payload: {}
            })
        ).setMimeType(ContentService.MimeType.JSON);
  else {
    const {opType,opProps} = query;
    const result = requestHandler({opType, opProps});
    return ContentService.createTextOutput(
            JSON.stringify({
                error: false,
        statusCode: 200,
                msg: 'Connection Established',
                type: type,
        requestBody: contents,
        payload: result
            })
        ).setMimeType(ContentService.MimeType.JSON);
    }
};

Please note that I already know how to invoke it by keeping my web app open however, I want to invoke it when authentication is required as shown in the above configuration.


问:
Trouble with matchmaking in iOS with gamekit and game centre
At the moment I'm trying to add online multiplayer to my iOS game (that uses UIKit) using gameKit/GameCenter for matchmaking. I'm trying to present game center's matchmaker interface but with varied success. I have two view controllers (with respective .xib files), mainMenuViewController and onlineViewController, along with a file called GCHelper.h.

In CGHelper I have this:

```<code>- (void)findMatchWithMinPlayers:(int)minPlayers
                     maxPlayers:(int)maxPlayers
                 viewController:(UIViewController *)viewController
                       delegate:(id<GCHelperDelegate>)theDelegate
{
    if (!gameCenterAvailable) return;

    self.presentingViewController = viewController;
    delegate = theDelegate;
    [presentingViewController dismissModalViewControllerAnimated:NO];

    GKMatchRequest *request = [[GKMatchRequest alloc] init];
    request.minPlayers = minPlayers;
    request.maxPlayers = maxPlayers;

    GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc] initWithMatchRequest:request];
    mmvc.matchmakerDelegate = self;

    [presentingViewController presentModalViewController:mmvc animated:YES];
}
</code>```

I use this function in my views to show the matchmaking interface. At first I tried it in mainMenuViewController, which is my first view controller using this:

```<code>[[GCHelper sharedInstance] findMatchWithMinPlayers:2 maxPlayers:2 viewController:self delegate:self];
</code>```

And that worked fine but that's not where I wanted to do it, so I tried the exact same thing from onlineViewController and nothing happens, no error, just the blank view of onlineViewController.view stares back at me. I'm fairly new at this so I'm wondering if it's down to how I'm dealing with the views, here's the code I use to switch from the mainMenu to the other view:

```<code>-(IBAction)showOnlineView
{
    OnlineViewController *onlineViewController = [[OnlineViewController alloc] initWithNibName:@"OnlineViewController" bundle:nil];
    UIView *currentView = self.view;
    UIView *theWindow = [currentView superview];
    [currentView removeFromSuperview];
    [theWindow addSubview:onlineViewController.view];
}
</code>```

Any help would be greatly appreciated. Also, I'm not sure how I should deal with going back to the main menu if the user presses cancel (although that may become self evident once I've got this working, I just thought I'd mention it in case this lack of knowledge on my part makes it obvious I'm going about the whole thing incorrectly).

ContentLicense: CC BY-SA 3.0

Body:
At the moment I'm trying to add online multiplayer to my iOS game (that uses UIKit) using gameKit/GameCenter for matchmaking. I'm trying to present game center's matchmaker interface but with varied success. I have two view controllers (with respective .xib files), mainMenuViewController and onlineViewController, along with a file called GCHelper.h.

In CGHelper I have this:

- (void)findMatchWithMinPlayers:(int)minPlayers
                     maxPlayers:(int)maxPlayers
                 viewController:(UIViewController *)viewController
                       delegate:(id<GCHelperDelegate>)theDelegate
{
    if (!gameCenterAvailable) return;

    self.presentingViewController = viewController;
    delegate = theDelegate;
    [presentingViewController dismissModalViewControllerAnimated:NO];

    GKMatchRequest *request = [[GKMatchRequest alloc] init];
    request.minPlayers = minPlayers;
    request.maxPlayers = maxPlayers;

    GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc] initWithMatchRequest:request];
    mmvc.matchmakerDelegate = self;

    [presentingViewController presentModalViewController:mmvc animated:YES];
}

I use this function in my views to show the matchmaking interface. At first I tried it in mainMenuViewController, which is my first view controller using this:

[[GCHelper sharedInstance] findMatchWithMinPlayers:2 maxPlayers:2 viewController:self delegate:self];

And that worked fine but that's not where I wanted to do it, so I tried the exact same thing from onlineViewController and nothing happens, no error, just the blank view of onlineViewController.view stares back at me. I'm fairly new at this so I'm wondering if it's down to how I'm dealing with the views, here's the code I use to switch from the mainMenu to the other view:

-(IBAction)showOnlineView
{
    OnlineViewController *onlineViewController = [[OnlineViewController alloc] initWithNibName:@"OnlineViewController" bundle:nil];
    UIView *currentView = self.view;
    UIView *theWindow = [currentView superview];
    [currentView removeFromSuperview];
    [theWindow addSubview:onlineViewController.view];
}

Any help would be greatly appreciated. Also, I'm not sure how I should deal with going back to the main menu if the user presses cancel (although that may become self evident once I've got this working, I just thought I'd mention it in case this lack of knowledge on my part makes it obvious I'm going about the whole thing incorrectly).


问:
cannot assign a string element to a random function in Swift Xcode
I am trying to generate an automatic password code, however, I get an error with the below code "Cannot convert value of type '[Any]' to specified type 'String'

Output of debugger as follows:
expression failed to parse:
error: Loops + Function.playground:7:25: error: cannot convert value of type '[Any]' to specified type 'String'
var passString:String = []
^~

warning: Loops + Function.playground:9:5: warning: immutable value 'n' was never used; consider replacing with '_' or removing it
for n in 0...5 {
^
_

```<code>let alphabet =     ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
var passString:String = []

for n in 0...5 {
 passString = passString + alphabet.randomElement()!
}
print(passString)
</code>```

Body:
I am trying to generate an automatic password code, however, I get an error with the below code "Cannot convert value of type '[Any]' to specified type 'String'

Output of debugger as follows:
expression failed to parse:
error: Loops + Function.playground:7:25: error: cannot convert value of type '[Any]' to specified type 'String'
var passString:String = []
^~

warning: Loops + Function.playground:9:5: warning: immutable value 'n' was never used; consider replacing with '_' or removing it
for n in 0...5 {
^
_

let alphabet =     ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
var passString:String = []

for n in 0...5 {
 passString = passString + alphabet.randomElement()!
}
print(passString)


问:
vuejs-datepicker Nuxt issue
I'm trying to use vuejs-datepicker with Nuxt (version: 2.15.8). I've followed the steps written in this documentation.

Everything worked fine but when I tried to import the translation to the component, I've got the following error:

Could not find a declaration file for module
'vuejs-datepicker/dist/locale'.
'd:/projectname/node_modules/vuejs-datepicker/dist/locale/index.js'
implicitly has an 'any' type.

I've imported it this way:

```<code><script lang="ts">
import { es } from 'vuejs-datepicker/dist/locale';
import { computed, defineComponent, onMounted, ref } from "vue";
...
</code>```

The plugins/vue-datepicker.js code is the following:

```<code>import Vue from 'vue'
import Datepicker from 'vuejs-datepicker'
Vue.component('date-picker', Datepicker)
</code>```

And the nuxt.config.js :

```<code>...
plugins: [{
        src: '~/plugins/vue-datepicker',
        ssr: false
    }, ],
...
</code>```

What is the proper way to import the translation?

Title: vuejs-datepicker Nuxt issue


问:
Loading transactional logs from AWS RDS
I have an AWS RDS database of SQL server I created from a bak file and I would like to update it using transactional logs.

The transaction logs zip files are in s3.

Is it possible and if so how?

Title: Loading transactional logs from AWS RDS


问:
C# syntax question: builder.Services.AddControllers
I'm trying to understand the following syntax

```<code>builder.Services.AddControllers(option =>
{
    option.ReturnHttpNotAcceptable = true;
});
</code>```

As far as I understand it it creates an Action delegate with an object (option) of type MvcOptions. The following approaches should be the same, are they?

```<code>// Approach 1
Action<MvcOptions> optionDelegate = (MvcOptions option) =>
{
    option.ReturnHttpNotAcceptable = true;
};
builder.Services.AddControllers(optionDelegate);

// Approach 2, shorter
builder.Services.AddControllers((MvcOptions option) =>
{
    option.ReturnHttpNotAcceptable = true;
});

// Approach 3, even more shorter
builder.Services.AddControllers(option =>
{
    option.ReturnHttpNotAcceptable = true;
});
</code>```

Body:
I'm trying to understand the following syntax

builder.Services.AddControllers(option =>
{
    option.ReturnHttpNotAcceptable = true;
});

As far as I understand it it creates an Action delegate with an object (option) of type MvcOptions. The following approaches should be the same, are they?

// Approach 1
Action<MvcOptions> optionDelegate = (MvcOptions option) =>
{
    option.ReturnHttpNotAcceptable = true;
};
builder.Services.AddControllers(optionDelegate);

// Approach 2, shorter
builder.Services.AddControllers((MvcOptions option) =>
{
    option.ReturnHttpNotAcceptable = true;
});

// Approach 3, even more shorter
builder.Services.AddControllers(option =>
{
    option.ReturnHttpNotAcceptable = true;
});


问:
How to Order By on a key inside JSONB column in PostgreSQL
I want to get all the details for a particular userID in DESC order of email_subject which is a key present inside "metadata" column of type JSONB.

Metadata is a JSONB column which has below structure:

```<code>{
 "emails" : [ {"recipients":["userId1@testsite.com"], "email_subject":"Test Subject1"},
              {"recipients":["userId2@testsite.com"], "email_subject":"Test Subject2"}]

}
</code>```

Query:

```<code>SELECT * FROM details
WHERE classification = 'EMAIL'
AND EXISTS (SELECT TRUE FROM jsonb_array_elements(metadata->'emails') x
            WHERE x->>'recipients' LIKE ('["%userId1@testsite.com%"]') ORDER BY x->>'email_subject' DESC)
            ORDER BY metadata->'emails'->>'email_subject' DESC

</code>```

The above query is able to give me required results for userId "userId1@testsite.com" but I want the final result to be sorted as per this field :

metadata->'emails'->>'email_subject'

I would appreciate all the inputs/suggestions.

Body:
I want to get all the details for a particular userID in DESC order of email_subject which is a key present inside "metadata" column of type JSONB.

Metadata is a JSONB column which has below structure:

{
 "emails" : [ {"recipients":["userId1@testsite.com"], "email_subject":"Test Subject1"},
              {"recipients":["userId2@testsite.com"], "email_subject":"Test Subject2"}]

}

Query:

SELECT * FROM details
WHERE classification = 'EMAIL'
AND EXISTS (SELECT TRUE FROM jsonb_array_elements(metadata->'emails') x
            WHERE x->>'recipients' LIKE ('["%userId1@testsite.com%"]') ORDER BY x->>'email_subject' DESC)
            ORDER BY metadata->'emails'->>'email_subject' DESC

The above query is able to give me required results for userId "userId1@testsite.com" but I want the final result to be sorted as per this field :

metadata->'emails'->>'email_subject'

I would appreciate all the inputs/suggestions.


问:
Linking additional module against already built main microcontroller firmware
I'm working on a bare-metal microcontroller project that needs to be able to execute a blob of code loaded at runtime. The basic implementation is simple enough - write a linker script that can handle it being loaded in to RAM somewhere, leave a little vector table at the beginning of the image, memcpy it in to place, and then from the main firmware read the vector table and jump in to the module's entry point.

My question comes with how to convince the linker for the module to allow calls back in to the main firmware (avoid duplicating utility functions, share data with main firmware, etc).

Suppose the main firmware has some function:

int FunctionInMainFirmware() {
    return 1234;
}
```
<p>The main firmware complies/links to produce an elf that's later objdump'd to a bin flashed to the microcontroller. As expected, the function ends up linked in the main firmware's flash:</p>
<p><code>080b73b0 g     F .text 00000008 _Z22FunctionInMainFirmwarev</code></p>
<p>So then we get to the loadable module:</p>
<pre class="lang-cpp prettyprint-override"><code>using myFunc = int(void);
static const myFunc* f = reinterpret_cast<myFunc*>(0x080b73b0);

int FunctionInLibrary() {
    return f();

    // How do I make this work?
    // return FunctionInMainFirmware();
}
</code>```

This implementation works - the compiler correctly generates the call to the function in the main firmware. This is of course nasty and too unwieldy to do in the real world, but proved to me that if the code is generated how I want, it'll do what I want.

How do I convince the linker to treat my main firmware elf as if it was a static library? Essentially I just want it to read the linker map from the main firmware to resolve missing functions from the module.

I tried -l:MyMainFirmware.elf, which doesn't fail, but also doesn't produce a valid result:

It copies the entire contents of the main firmware's elf. This makes sense since it sees sections it should copy (ie, .text), so it puts them in the output and re-links it.

It doesn't link correctly, and does some weird math resulting in mangled addresses.

Is there some way to get the linker to just read the .map or .dmp files generated by the main build? Or to read the elf but ignore the contents, and only look at the symbol address (then don't futz with it)?

Body:
I'm working on a bare-metal microcontroller project that needs to be able to execute a blob of code loaded at runtime. The basic implementation is simple enough - write a linker script that can handle it being loaded in to RAM somewhere, leave a little vector table at the beginning of the image, memcpy it in to place, and then from the main firmware read the vector table and jump in to the module's entry point.

My question comes with how to convince the linker for the module to allow calls back in to the main firmware (avoid duplicating utility functions, share data with main firmware, etc).

Suppose the main firmware has some function:

int FunctionInMainFirmware() {
    return 1234;
}

The main firmware complies/links to produce an elf that's later objdump'd to a bin flashed to the microcontroller. As expected, the function ends up linked in the main firmware's flash:

080b73b0 g     F .text 00000008 _Z22FunctionInMainFirmwarev

So then we get to the loadable module:

using myFunc = int(void);
static const myFunc* f = reinterpret_cast<myFunc*>(0x080b73b0);

int FunctionInLibrary() {
    return f();

    // How do I make this work?
    // return FunctionInMainFirmware();
}

This implementation works - the compiler correctly generates the call to the function in the main firmware. This is of course nasty and too unwieldy to do in the real world, but proved to me that if the code is generated how I want, it'll do what I want.

How do I convince the linker to treat my main firmware elf as if it was a static library? Essentially I just want it to read the linker map from the main firmware to resolve missing functions from the module.

I tried -l:MyMainFirmware.elf, which doesn't fail, but also doesn't produce a valid result:

It copies the entire contents of the main firmware's elf. This makes sense since it sees sections it should copy (ie, .text), so it puts them in the output and re-links it.

It doesn't link correctly, and does some weird math resulting in mangled addresses.

Is there some way to get the linker to just read the .map or .dmp files generated by the main build? Or to read the elf but ignore the contents, and only look at the symbol address (then don't futz with it)?


问:
Unzip / untar `pip` wheel without compiling or installing
I want to download a source tarball from PyPI and extract it.

pip install -t . downloads and installs package.
pip download numpy && tar -xf numpy* doesn't work on Windows. No cross-platform compatibility.

I expect a command to download the source distribution from PyPI and extract it automatically, in 1 command.

Note: only extract the source. No installing / compiling.
Note 2: It should work on Windows, Linux and MacOS.
Note 3: The solution should use only one command: pip. No other command should be used.


问:
adding as favorite conditionally in Flutter
I am using the favorite_button Widget to add items to the list of favorites.

For that matter, I have a listview and for each row, I added the option to add it as a favorite. I also have a condition in the backend that if the number of favorites is more than 10, the responsecode equals to 2 and then shows a dialogbox in the flutter and does not add it to the favorite.

Everything works perfectly. The only problem that I have is that in conditions with more than 10 favorites, when I click, it marks as favorite and then shows the dialog box but I could not find a way to undo this action. However, it does not add it to the list (when I refresh the page, it shows as unmarked). How could I unmark it from marked as favorite, for example, when user closes the showDialog?

Any other approach is also appreciated like simulating the onpressed action to undo the action of favoriting.

Thank you in advance.

```<code>StarButton(
  isStarred: UserFavorite
      .Users!
  valueChanged: (_isStarred) {
    if (_isStarred == true)
      setState(() async {
        var resp =
            await add(
                widget.oauth,
                widget.Id,);
        if (resp.responseCode ==
            2) {
          await showDialog(
            context: context,
            builder:
                (alertDialogContext) {
              return AlertDialog(
                title: Text(
                    'Limit Reached'),
                content: Text(
                    'You are allowed to add up to 10 sensors as your favorite.'),
                actions: [
                  TextButton(
                    child: Text(
                        'Ok'),
                    onPressed:
                        () {
                      Navigator.pop(
                          alertDialogContext);
                    },
                  ),
                ],
              );
            },
          );
        }
      });
    else
      setState(() {
        delete(
            widget.oauth,
            widget.Id,
       );
      });
  },
)
</code>```

Body:
I am using the favorite_button Widget to add items to the list of favorites.

For that matter, I have a listview and for each row, I added the option to add it as a favorite. I also have a condition in the backend that if the number of favorites is more than 10, the responsecode equals to 2 and then shows a dialogbox in the flutter and does not add it to the favorite.

Everything works perfectly. The only problem that I have is that in conditions with more than 10 favorites, when I click, it marks as favorite and then shows the dialog box but I could not find a way to undo this action. However, it does not add it to the list (when I refresh the page, it shows as unmarked). How could I unmark it from marked as favorite, for example, when user closes the showDialog?

Any other approach is also appreciated like simulating the onpressed action to undo the action of favoriting.

Thank you in advance.

StarButton(
  isStarred: UserFavorite
      .Users!
  valueChanged: (_isStarred) {
    if (_isStarred == true)
      setState(() async {
        var resp =
            await add(
                widget.oauth,
                widget.Id,);
        if (resp.responseCode ==
            2) {
          await showDialog(
            context: context,
            builder:
                (alertDialogContext) {
              return AlertDialog(
                title: Text(
                    'Limit Reached'),
                content: Text(
                    'You are allowed to add up to 10 sensors as your favorite.'),
                actions: [
                  TextButton(
                    child: Text(
                        'Ok'),
                    onPressed:
                        () {
                      Navigator.pop(
                          alertDialogContext);
                    },
                  ),
                ],
              );
            },
          );
        }
      });
    else
      setState(() {
        delete(
            widget.oauth,
            widget.Id,
       );
      });
  },
)


问:
Migration between old and new Cypress
I'm transferring an older project in Cypress to a new one, but somehow I don't understand it. In the older version I had tests saved in the integration folder and then ran them from there. In the new version of Cypress, everything is stored in the e2e folder and if I play the files from the old project there, they don't show up. The structure is completely different. Do you know how to migrate it correctly? I am migrating from version 6.9.0 to version 12.3.0

I will add that I am doing a completely new installation on a new machine.

I found that I had a problem in the specification. I've edited it and now everything displays correctly as it should. See picture:

Title: Migration between old and new Cypress


问:
power automate can you make a drop down input with dynamic values
Fairly simple question I have a power automate flow with a for selected file trigger one of the inputs is a dropdown is there any way to create this dropdown to have values based on a dropdown that is in the SharePoint document library the file is in?

this should be populated by these values


问:
Create a search page with acf fields and wpml transalte
I want to create a search form in a new search page in WordPress with Custom Fields (ACF) and WPML, and I'm trying it with the code above! The problem is that the search results is great when I use the main language (Greek) but I have no results when I use the secondary language of the site (English).

```<code><?php
/* Template name: Search */

get_header();

$current_lang = apply_filters( 'wpml_current_language', NULL ); ?>

<div class="container inner-content">
    <form class="search" method="post" action="<?php echo get_permalink( get_field('amorgos_search_results_page','option')[0] ) ?>">
        <?php
        if ( $current_lang === 'en') {
            if ($_GET['type']=='advanced') {
                $title =  'Advanced Search';
            }
            elseif ($_GET['type']=='simple') {
                $title = 'Simple Search';
            }
            elseif ($_GET['type']=='geographic') {
                $title =  'Geographic Search';
            }
            else{
                $title =  'Topic Search';
            }
        }
        else
        {
            if ($_GET['type']=='advanced') {
                $title =  'Σύνθετη Αναζήτηση';
            }
            elseif ($_GET['type']=='simple') {
                $title = 'Απλή Αναζτηση';
            }
            elseif ($_GET['type']=='geographic') {
                $title =  'Γεωγραφική Αναζήτηση';
            }
            else{
                $title =  'Τοπική Αναζήτηση';
            }
        }
        ?>
        <h1 class="title"><?php echo $title; ?></h1>
        <div class="search__fields">
            <?php
            if ( $current_lang === 'en') {

                    if( isset($_GET['type']) && $_GET['type'] === 'simple')
                    {
                        amorgos_search_field('Place of origin', 'Select Island', 'field_5d51cc71c4d71', 'origin');
                        amorgos_search_field('Location', 'Select Location', 'field_5d516b8b52c6a', 'location');
                        amorgos_search_field('Designation', 'Type Name / Title of Song or Instrumental Tune', null, 'post_title');
                        amorgos_search_field('Instrumentalists', 'Names', 'field_5d543cf799a50', 'relation_musicians' );
                        amorgos_search_field('Information about the Instrumental Tune', 'field_5d4f401050075', 'Type of Instrumental Tune');
                    }
                    elseif( isset($_GET['type']) && $_GET['type'] === 'geographic')
                     {
                        amorgos_search_field('Place of origin','Select Island', 'field_5d51cc71c4d71', 'origin');
                        amorgos_search_field('Location' , 'Select Location', 'field_5d516b8b52c6a', 'location');
                     }
                    elseif( isset($_GET['type']) && $_GET['type'] === 'topic')
                    {
                        amorgos_search_field('Classifications', 'field_5d4f398135758', 'By content');
                        amorgos_search_field(null, 'By type', 'field_5d4f38d376a15');
                        amorgos_search_field(null, 'During Execution', 'field_5d4f392e97a73');
                    }
                    else
                    {
                        amorgos_search_field('Place of origin', 'Select Island', 'field_5d51cc71c4d71', 'origin');
                        amorgos_search_field('Location', 'Select Location', 'field_5d516b8b52c6a', 'location');
                        amorgos_search_field('Name / Title', 'Type Name / Title of Song or Instrumental Tune', null, 'post_title');
                        amorgos_search_field('Instrumentalists', 'Names', 'field_5d543cf799a50', 'relation_musicians' );
                        amorgos_search_field('Classification by Occasion', 'Life Cycle', 'field_5d4f35a13c634');
                        amorgos_search_field(null, 'Seasons Cycle', 'field_5d4f375476b4b');
                        amorgos_search_field(null, 'Agricultural Cycle', 'field_5d4f37a151267');
                        amorgos_search_field(null, 'Other Occasions', 'field_5d4f380651268');
                        amorgos_search_field('Other Classifications', 'By content', 'field_5d4f398135758');
                        amorgos_search_field(null, 'By Kind', 'field_5d4f38d376a15');
                        amorgos_search_field(null, 'By Performance Practice', 'field_5d4f392e97a73');
                        amorgos_search_field('Information about the Dance', 'Type of dance', 'field_5d51d28b3beec', 'dance_kind');
                        amorgos_search_field(null, 'Genus of Dance', 'field_5d4f3da15b73f');
                        amorgos_search_field(null, 'Dancers’ Positioning', 'field_5d4f3e068927f');
                        amorgos_search_field(null, 'Classification by Dancer', 'field_5d4f3e626a68c');
                        amorgos_search_field('Information about the Song', 'Metric analysis', 'field_5d51cdf695665', 'metre_analysis');
                        amorgos_search_field('Information about the Instrumental Tune', 'Kind of Instrumental Tune', 'field_5d4f401050075');
                        amorgos_search_field(null, 'Meter', 'field_5d4f40bd9d858');
                        amorgos_search_field('Melodic Analysis', 'Genus', 'field_5d4f416a4ed88');
                        amorgos_search_field(null, 'Mode', 'field_5d4f41d94ed89');
                        amorgos_search_field(null, 'Number of Notes in the Scale', 'field_5d4f4249e01e2');
                    }

                # code...
            }
            else
            {

                if( isset($_GET['type']) && $_GET['type'] === 'simple'){
                    amorgos_search_field('Τόπος Προέλευσης', 'Επιλέξτε Νησί', 'field_5d51cc71c4d71', 'origin');
                    amorgos_search_field('Τοποθεσία', 'Επιλέξτε Τοποθεσία', 'field_5d516b8b52c6a', 'location');
                    amorgos_search_field('Ονομασία / Τίτλος', 'Πληκρολογήστε Ονομασία / Τίτλο Τραγουδιού ή Οργανικού Σκοπού', null, 'post_title');
                    amorgos_search_field('Οργανοπαίκτες', 'Ονόματα', 'field_5d543cf799a50', 'relation_musicians' );
                    amorgos_search_field('Στοιχεία σχετικά με τον Οργανικό Σκοπό', 'Είδος Οργανικού Σκοπού', 'field_5d4f401050075');
                }
                elseif( isset($_GET['type']) && $_GET['type'] === 'geographic'){
                    amorgos_search_field('Τόπος Προέλευσης','Επιλέξτε Νησί', 'field_5d51cc71c4d71', 'origin');
                    amorgos_search_field('Τοποθεσία' , 'Επιλέξτε Τοποθεσία', 'field_5d516b8b52c6a', 'location');
                }
                elseif( isset($_GET['type']) && $_GET['type'] === 'topic'){
                    amorgos_search_field('Ταξινομήσεις', 'Κατά το Περιεχόμενο', 'field_5d4f398135758');
                    amorgos_search_field(null, 'Κατά το Είδος', 'field_5d4f38d376a15');
                    amorgos_search_field(null, 'Κατά την Εκτέλεση', 'field_5d4f392e97a73');
                }
                else
                {
                    amorgos_search_field('Τόπος Προέλευσης', 'Επιλέξτε Νησί', 'field_5d51cc71c4d71', 'origin');
                    amorgos_search_field('Τοποθεσία', 'Επιλέξτε Τοποθεσία', 'field_5d516b8b52c6a', 'location');
                    amorgos_search_field('Ονομασία', 'Πληκρολογήστε Ονομασία / Τίτλο Τραγουδιού ή Οργανικού Σκοπού', null, 'post_title');
                    amorgos_search_field('Οργανοπαίκτες', 'Ονόματα', 'field_5d543cf799a50', 'relation_musicians' );
                    amorgos_search_field('Ταξινόµηση κατά την Περίσταση', 'Κύκλος Ζωής', 'field_5d4f35a13c634' );
                    amorgos_search_field(null, 'Κύκλος Χρόνου', 'field_5d4f375476b4b');
                    amorgos_search_field(null, 'Αγροτικός Κύκλος', 'field_5d4f37a151267');
                    amorgos_search_field(null, 'Άλλες Περιστάσεις', 'field_5d4f380651268');
                    amorgos_search_field('Άλλες Ταξινομήσεις', 'Κατά το Περιεχόμενο', 'field_5d4f398135758');
                    amorgos_search_field(null, 'Κατά το Είδος', 'field_5d4f38d376a15');
                    amorgos_search_field(null, 'Κατά την Εκτέλεση', 'field_5d4f392e97a73');
                    amorgos_search_field('Στοιχεία για το Χορό', 'Είδος Χορού', 'field_5d51d28b3beec', 'dance_kind');
                    amorgos_search_field(null, 'Γένος Χορού', 'field_5d4f3da15b73f');
                    amorgos_search_field(null, 'Σύνδεση Χορευτών', 'field_5d4f3e068927f');
                    amorgos_search_field(null, 'Ταξινόμηση κατά το Χορευτή', 'field_5d4f3e626a68c');
                    amorgos_search_field('Στοιχεία για το Τραγούδι', 'Μετρική Ανάλυση', 'field_5d51cdf695665', 'metre_analysis');
                    amorgos_search_field('Στοιχεία σχετικά με τον Οργανικό Σκοπό', 'Είδος Οργανικού Σκοπού', 'field_5d4f401050075');
                    amorgos_search_field(null, 'Μέτρο', 'field_5d4f40bd9d858');
                    amorgos_search_field('Μελωδική Ανάλυση', 'Γένος', 'field_5d4f416a4ed88');
                    amorgos_search_field(null, 'Τρόπος', 'field_5d4f41d94ed89');
                    amorgos_search_field(null, 'Αριθμός Φθόγγων στην Κλίμακα', 'field_5d4f4249e01e2');
                }
            }

            ?>
        </div>
        <button type="submit" class="results__btn results__btn--search has-brackets has-brackets--active-hover has-brackets--no-top"><?php _e('Αναζητηση' ,'wpml_theme'); ?></button>
    </form>
</div>
<?php get_footer(); ?>
</code>```

Could help me to resolve this problem and to have search results not only in the main language but in secondary too?

Body:
I want to create a search form in a new search page in WordPress with Custom Fields (ACF) and WPML, and I'm trying it with the code above! The problem is that the search results is great when I use the main language (Greek) but I have no results when I use the secondary language of the site (English).

<?php
/* Template name: Search */

get_header();

$current_lang = apply_filters( 'wpml_current_language', NULL ); ?>

    <form class="search" method="post" action="<?php echo get_permalink( get_field('amorgos_search_results_page','option')[0] ) ?>">
        <?php
        if ( $current_lang === 'en') {
            if ($_GET['type']=='advanced') {
                $title =  'Advanced Search';
            }
            elseif ($_GET['type']=='simple') {
                $title = 'Simple Search';
            }
            elseif ($_GET['type']=='geographic') {
                $title =  'Geographic Search';
            }
            else{
                $title =  'Topic Search';
            }
        }
        else
        {
            if ($_GET['type']=='advanced') {
                $title =  'Σύνθετη Αναζήτηση';
            }
            elseif ($_GET['type']=='simple') {
                $title = 'Απλή Αναζτηση';
            }
            elseif ($_GET['type']=='geographic') {
                $title =  'Γεωγραφική Αναζήτηση';
            }
            else{
                $title =  'Τοπική Αναζήτηση';
            }
        }
        ?>

<?php echo $title; ?>

            <?php
            if ( $current_lang === 'en') {

                    if( isset($_GET['type']) && $_GET['type'] === 'simple')
                    {
                        amorgos_search_field('Place of origin', 'Select Island', 'field_5d51cc71c4d71', 'origin');
                        amorgos_search_field('Location', 'Select Location', 'field_5d516b8b52c6a', 'location');
                        amorgos_search_field('Designation', 'Type Name / Title of Song or Instrumental Tune', null, 'post_title');
                        amorgos_search_field('Instrumentalists', 'Names', 'field_5d543cf799a50', 'relation_musicians' );
                        amorgos_search_field('Information about the Instrumental Tune', 'field_5d4f401050075', 'Type of Instrumental Tune');
                    }
                    elseif( isset($_GET['type']) && $_GET['type'] === 'geographic')
                     {
                        amorgos_search_field('Place of origin','Select Island', 'field_5d51cc71c4d71', 'origin');
                        amorgos_search_field('Location' , 'Select Location', 'field_5d516b8b52c6a', 'location');
                     }
                    elseif( isset($_GET['type']) && $_GET['type'] === 'topic')
                    {
                        amorgos_search_field('Classifications', 'field_5d4f398135758', 'By content');
                        amorgos_search_field(null, 'By type', 'field_5d4f38d376a15');
                        amorgos_search_field(null, 'During Execution', 'field_5d4f392e97a73');
                    }
                    else
                    {
                        amorgos_search_field('Place of origin', 'Select Island', 'field_5d51cc71c4d71', 'origin');
                        amorgos_search_field('Location', 'Select Location', 'field_5d516b8b52c6a', 'location');
                        amorgos_search_field('Name / Title', 'Type Name / Title of Song or Instrumental Tune', null, 'post_title');
                        amorgos_search_field('Instrumentalists', 'Names', 'field_5d543cf799a50', 'relation_musicians' );
                        amorgos_search_field('Classification by Occasion', 'Life Cycle', 'field_5d4f35a13c634');
                        amorgos_search_field(null, 'Seasons Cycle', 'field_5d4f375476b4b');
                        amorgos_search_field(null, 'Agricultural Cycle', 'field_5d4f37a151267');
                        amorgos_search_field(null, 'Other Occasions', 'field_5d4f380651268');
                        amorgos_search_field('Other Classifications', 'By content', 'field_5d4f398135758');
                        amorgos_search_field(null, 'By Kind', 'field_5d4f38d376a15');
                        amorgos_search_field(null, 'By Performance Practice', 'field_5d4f392e97a73');
                        amorgos_search_field('Information about the Dance', 'Type of dance', 'field_5d51d28b3beec', 'dance_kind');
                        amorgos_search_field(null, 'Genus of Dance', 'field_5d4f3da15b73f');
                        amorgos_search_field(null, 'Dancers’ Positioning', 'field_5d4f3e068927f');
                        amorgos_search_field(null, 'Classification by Dancer', 'field_5d4f3e626a68c');
                        amorgos_search_field('Information about the Song', 'Metric analysis', 'field_5d51cdf695665', 'metre_analysis');
                        amorgos_search_field('Information about the Instrumental Tune', 'Kind of Instrumental Tune', 'field_5d4f401050075');
                        amorgos_search_field(null, 'Meter', 'field_5d4f40bd9d858');
                        amorgos_search_field('Melodic Analysis', 'Genus', 'field_5d4f416a4ed88');
                        amorgos_search_field(null, 'Mode', 'field_5d4f41d94ed89');
                        amorgos_search_field(null, 'Number of Notes in the Scale', 'field_5d4f4249e01e2');
                    }

                # code...
            }
            else
            {

                if( isset($_GET['type']) && $_GET['type'] === 'simple'){
                    amorgos_search_field('Τόπος Προέλευσης', 'Επιλέξτε Νησί', 'field_5d51cc71c4d71', 'origin');
                    amorgos_search_field('Τοποθεσία', 'Επιλέξτε Τοποθεσία', 'field_5d516b8b52c6a', 'location');
                    amorgos_search_field('Ονομασία / Τίτλος', 'Πληκρολογήστε Ονομασία / Τίτλο Τραγουδιού ή Οργανικού Σκοπού', null, 'post_title');
                    amorgos_search_field('Οργανοπαίκτες', 'Ονόματα', 'field_5d543cf799a50', 'relation_musicians' );
                    amorgos_search_field('Στοιχεία σχετικά με τον Οργανικό Σκοπό', 'Είδος Οργανικού Σκοπού', 'field_5d4f401050075');
                }
                elseif( isset($_GET['type']) && $_GET['type'] === 'geographic'){
                    amorgos_search_field('Τόπος Προέλευσης','Επιλέξτε Νησί', 'field_5d51cc71c4d71', 'origin');
                    amorgos_search_field('Τοποθεσία' , 'Επιλέξτε Τοποθεσία', 'field_5d516b8b52c6a', 'location');
                }
                elseif( isset($_GET['type']) && $_GET['type'] === 'topic'){
                    amorgos_search_field('Ταξινομήσεις', 'Κατά το Περιεχόμενο', 'field_5d4f398135758');
                    amorgos_search_field(null, 'Κατά το Είδος', 'field_5d4f38d376a15');
                    amorgos_search_field(null, 'Κατά την Εκτέλεση', 'field_5d4f392e97a73');
                }
                else
                {
                    amorgos_search_field('Τόπος Προέλευσης', 'Επιλέξτε Νησί', 'field_5d51cc71c4d71', 'origin');
                    amorgos_search_field('Τοποθεσία', 'Επιλέξτε Τοποθεσία', 'field_5d516b8b52c6a', 'location');
                    amorgos_search_field('Ονομασία', 'Πληκρολογήστε Ονομασία / Τίτλο Τραγουδιού ή Οργανικού Σκοπού', null, 'post_title');
                    amorgos_search_field('Οργανοπαίκτες', 'Ονόματα', 'field_5d543cf799a50', 'relation_musicians' );
                    amorgos_search_field('Ταξινόµηση κατά την Περίσταση', 'Κύκλος Ζωής', 'field_5d4f35a13c634' );
                    amorgos_search_field(null, 'Κύκλος Χρόνου', 'field_5d4f375476b4b');
                    amorgos_search_field(null, 'Αγροτικός Κύκλος', 'field_5d4f37a151267');
                    amorgos_search_field(null, 'Άλλες Περιστάσεις', 'field_5d4f380651268');
                    amorgos_search_field('Άλλες Ταξινομήσεις', 'Κατά το Περιεχόμενο', 'field_5d4f398135758');
                    amorgos_search_field(null, 'Κατά το Είδος', 'field_5d4f38d376a15');
                    amorgos_search_field(null, 'Κατά την Εκτέλεση', 'field_5d4f392e97a73');
                    amorgos_search_field('Στοιχεία για το Χορό', 'Είδος Χορού', 'field_5d51d28b3beec', 'dance_kind');
                    amorgos_search_field(null, 'Γένος Χορού', 'field_5d4f3da15b73f');
                    amorgos_search_field(null, 'Σύνδεση Χορευτών', 'field_5d4f3e068927f');
                    amorgos_search_field(null, 'Ταξινόμηση κατά το Χορευτή', 'field_5d4f3e626a68c');
                    amorgos_search_field('Στοιχεία για το Τραγούδι', 'Μετρική Ανάλυση', 'field_5d51cdf695665', 'metre_analysis');
                    amorgos_search_field('Στοιχεία σχετικά με τον Οργανικό Σκοπό', 'Είδος Οργανικού Σκοπού', 'field_5d4f401050075');
                    amorgos_search_field(null, 'Μέτρο', 'field_5d4f40bd9d858');
                    amorgos_search_field('Μελωδική Ανάλυση', 'Γένος', 'field_5d4f416a4ed88');
                    amorgos_search_field(null, 'Τρόπος', 'field_5d4f41d94ed89');
                    amorgos_search_field(null, 'Αριθμός Φθόγγων στην Κλίμακα', 'field_5d4f4249e01e2');
                }
            }

            ?>

        <button type="submit" class="results__btn results__btn--search has-brackets has-brackets--active-hover has-brackets--no-top"><?php _e('Αναζητηση' ,'wpml_theme'); ?></button>
    </form>

<?php get_footer(); ?>

Could help me to resolve this problem and to have search results not only in the main language but in secondary too?


问:
Is there a way to serve google ads when iOS user uses content blocking vpn?
I am using google ads in my iOS app and I am wondering if there is a way to avoid vpn content blockers? One being for example lockdown.

I was thinking if its possible to fetch the ads trough custom urls so they do not get blocked by default.

Thanks for any tips.


问:
Dependent dropdown using Exposed Drop-Down Menu and AutoCompleteTextView
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

```<code>            //Define city spinner but we will populate the option through the selected state
            policeStationSelectDropdown = findViewById(R.id.psAutoCompleteText);

            // Obtain the selected district

             selectedDistrict = districtSelectDropdown.getSelectedItem().toString();

            Toast.makeText(Complaint_page.this,selectedDistrict, Toast.LENGTH_SHORT).show();

          //  int parentId = parent.getId();

            if (parent.getId() == R.id.districtAutoCompleteText)
</code>```

getSelectedItem() is showing error??
How to use this with autoCompleteTextView. I want dependent dropdown using Exposed Drop-Down Menu and autoCompleteTextView using JAVA.

Body:
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

            //Define city spinner but we will populate the option through the selected state
            policeStationSelectDropdown = findViewById(R.id.psAutoCompleteText);

            // Obtain the selected district

             selectedDistrict = districtSelectDropdown.getSelectedItem().toString();

            Toast.makeText(Complaint_page.this,selectedDistrict, Toast.LENGTH_SHORT).show();

          //  int parentId = parent.getId();

            if (parent.getId() == R.id.districtAutoCompleteText)

getSelectedItem() is showing error??
How to use this with autoCompleteTextView. I want dependent dropdown using Exposed Drop-Down Menu and autoCompleteTextView using JAVA.


问:
Microsoft Java graph sdk if-none-match header does not work
i am using microsoft graph java sdk version 5.32.0 and making a call to get drive item , i am also provding etag so that if item is not modified i get a 304 exception , but i never get an exception eventhough item is not modfied and same etag is returned , any issue is there in the below code which is causing this?</p>
```<code> var ho = new HeaderOption("if-none-match","{CE8370C2-65E6-4AF5-8B4A-E02C8A29C081},6");
        var options = new ArrayList<Option>();
        options.add(ho);

        InputStream driveItem = _userClient.drives().byId("b!XSQmjmdVB0qX4G0WHdLwiuszVcK2AgdInZpWIonRDSyw0hXMWgo8T6LY2EqFsRND")
                .items("01PK4R276COCB45ZTF6VFIWSXAFSFCTQEB").content().buildRequest(options).get();

</code>```

Body:
i am using microsoft graph java sdk version 5.32.0 and making a call to get drive item , i am also provding etag so that if item is not modified i get a 304 exception , but i never get an exception eventhough item is not modfied and same etag is returned , any issue is there in the below code which is causing this?

 var ho = new HeaderOption("if-none-match","{CE8370C2-65E6-4AF5-8B4A-E02C8A29C081},6");
        var options = new ArrayList<Option>();
        options.add(ho);

        InputStream driveItem = _userClient.drives().byId("b!XSQmjmdVB0qX4G0WHdLwiuszVcK2AgdInZpWIonRDSyw0hXMWgo8T6LY2EqFsRND")
                .items("01PK4R276COCB45ZTF6VFIWSXAFSFCTQEB").content().buildRequest(options).get();


问:
Exclude One Mails in Catch All Default Routing rule in Google Workspace
I am administering Google Workspace email service and I had a catch all done for the delivery of all mails sent to non exiting mailboxes to go in one specific mail box. I've did this with Default Routing rule.

Now I need to reroute support@domain.com mail to external Help Desk system. I've did a default routing rule and it is working, but the global catch rule is catching also the support@domain.com mails.

Can you suggest how I can exclude the support mails?

I've tried to do the support mails with routing, but the default rule still catches them.


问:
Send document to client server from .net server
I have an API that offers a file translation service. I have been able to generate a new the new translated file but I have not been able to get it to the client correctly, because the document downloaded it is not readable.

This is my controller code:

```<code>[HttpPost]
[Route("TranslateDocument/{inputLanguage}/{outputLanguage}")]
[ProducesResponseType(typeof(FileContentResult), StatusCodes.Status200OK)]
public async Task<ActionResult<FileInfo>> TranslateDocument(string inputLanguage, string outputLanguage, [FromForm] IFormFile file)
{
    try
    {
        FileContentResult result = await _deeplService.TranslateFile(inputLanguage, outputLanguage, file);
        return Ok(result);
    }
    catch (Exception ex)
    {
        return ManageExceptions(ex);
    }
}
</code>```

In my service I have the following function:

```<code>public async Task<FileContentResult> TranslateFile(string inputLang, string outputLang, IFormFile file){
    //Code to translate the file into outputLang
    ...

    //Get bytes from Document generated
    byte[] bytes = System.IO.File.ReadAllBytes("localpath from doc");

    //Send the File to Download.
    return new FileContentResult(bytes, "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
}
</code>```

And this is the response I am getting on the client site:

```<code>{
    "fileContents": "UEsDBBQAAA...AAyCUAAAAA",
    "contentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "fileDownloadName": "",
    "lastModified": null,
    "entityTag": null,
    "enableRangeProcessing": false
}
</code>```

And when I do the const url = window.URL.createObjectURL(new Blob([response.fileContents], {type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"}));, the file downloaded is not readable in word

Body:
I have an API that offers a file translation service. I have been able to generate a new the new translated file but I have not been able to get it to the client correctly, because the document downloaded it is not readable.

This is my controller code:

[HttpPost]
[Route("TranslateDocument/{inputLanguage}/{outputLanguage}")]
[ProducesResponseType(typeof(FileContentResult), StatusCodes.Status200OK)]
public async Task<ActionResult<FileInfo>> TranslateDocument(string inputLanguage, string outputLanguage, [FromForm] IFormFile file)
{
    try
    {
        FileContentResult result = await _deeplService.TranslateFile(inputLanguage, outputLanguage, file);
        return Ok(result);
    }
    catch (Exception ex)
    {
        return ManageExceptions(ex);
    }
}

In my service I have the following function:

public async Task<FileContentResult> TranslateFile(string inputLang, string outputLang, IFormFile file){
    //Code to translate the file into outputLang
    ...

    //Get bytes from Document generated
    byte[] bytes = System.IO.File.ReadAllBytes("localpath from doc");

    //Send the File to Download.
    return new FileContentResult(bytes, "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
}

And this is the response I am getting on the client site:

{
    "fileContents": "UEsDBBQAAA...AAyCUAAAAA",
    "contentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "fileDownloadName": "",
    "lastModified": null,
    "entityTag": null,
    "enableRangeProcessing": false
}

And when I do the const url = window.URL.createObjectURL(new Blob([response.fileContents], {type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"}));, the file downloaded is not readable in word