问:
How to retreive data sent from openTelemetry C# with telegraf
When I'm trying to retrieve my meter from opentelemetry (C#) with telegraf (OpenTelemetry plugin), the data is not being sent.

Example code 1:

class Program
{
    static Meter s_meter = new Meter("HatCo.HatStore", "1.0.0");
    static Counter<int> s_hatsSold = s_meter.CreateCounter<int>(name: "hats-sold",
unit: "Hats",                                                                description: "The number of hats sold in our store");

static void Main(string[] args)
{
using MeterProvider meterProvider = Sdk.CreateMeterProviderBuilder()
                .AddMeter("HatCo.HatStore")
                .AddPrometheusExporter()
                .Build();

        Console.WriteLine("Press any key to exit");
        while (!Console.KeyAvailable)
        {
            // Pretend our store has a transaction each second that sells 4 hats
            Thread.Sleep(1000);
            Console.WriteLine("+4");
            s_hatsSold.Add(4);
        }
    }
}
```
<p>I get this error:</p>
<pre class="lang-bash prettyprint-override"><code>2023-01-05T13:58:06Z I! Starting Telegraf 1.24.4
2023-01-05T13:58:06Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
2023-01-05T13:58:06Z I! Loaded inputs: opentelemetry
2023-01-05T13:58:06Z I! Loaded aggregators:
2023-01-05T13:58:06Z I! Loaded processors:
2023-01-05T13:58:06Z W! Outputs are not used in testing mode!
2023-01-05T13:58:06Z I! Tags enabled: host= [MY MACHINE]
2023-01-05T13:58:06Z E! [inputs.opentelemetry] Error in plugin: failed to stop OpenTelemetry gRPC service: grpc: the server has been stopped
2023-01-05T13:58:06Z E! [telegraf] Error running agent: input plugins recorded 1 errors
</code>```

And if I try with this example code 2:

class Program
{
    static Meter s_meter = new Meter("HatCo.HatStore", "1.0.0");
    static Counter<int> s_hatsSold = s_meter.CreateCounter<int>(name: "hats-sold",
                                                                unit: "Hats",
                                                                description: "The number of hats sold in our store");

    static void Main(string[] args)
    {
        using MeterProvider meterProvider = Sdk.CreateMeterProviderBuilder()
                .AddMeter("HatCo.HatStore")
                .AddPrometheusExporter(opt =>
                {
                    opt.StartHttpListener = true;
                    opt.HttpListenerPrefixes = new string[] { $"http://localhost:9184/" };
                })
                .Build();

        Console.WriteLine("Press any key to exit");
        while (!Console.KeyAvailable)
        {
            // Pretend our store has a transaction each second that sells 4 hats
            Thread.Sleep(1000);
            Console.WriteLine("+4");
            s_hatsSold.Add(4);
        }
    }
}
```
<p>I get this result:</p>
<pre class="lang-bash prettyprint-override"><code>2023-01-05T14:02:47Z I! Starting Telegraf 1.24.4
2023-01-05T14:02:47Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
2023-01-05T14:02:47Z I! Loaded inputs: opentelemetry
2023-01-05T14:02:47Z I! Loaded aggregators:
2023-01-05T14:02:47Z I! Loaded processors:
2023-01-05T14:02:47Z W! Outputs are not used in testing mode!
2023-01-05T14:02:47Z I! Tags enabled: host= [MY MACHINE]
2023-01-05T14:02:47Z E! [agent] Starting input inputs.opentelemetry: listen tcp 0.0.0.0:9184: bind: address already in use
</code>```

All of this is running on Linux ubuntu 20.04, .NET 5.0, and here are the imported dependencies:

using System;
using System.Diagnostics.Metrics;
using System.Threading;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Exporter.Prometheus;
```
<p>Telegraf inputs:</p>
```[[inputs.opentelemetry]]
  ## Override the default (0.0.0.0:4317) destination OpenTelemetry gRPC service
  ## address:port
  service_address = "0.0.0.0:9184"
  ## Override the default (5s) new connection timeout
  # timeout = "5s"

  ## Override the default (prometheus-v1) metrics schema.
  ## Supports: "prometheus-v1", "prometheus-v2"
  ## For more information about the alternatives, read the Prometheus input
  ## plugin notes.
  #metrics_schema = "prometheus-v1"

  ## Optional TLS Config.
  ## For advanced options: https://github.com/influxdata/telegraf/blob/v1.18.3/docs/TLS.md
  ##
  ## Set one or more allowed client CA certificate file names to
  ## enable mutually authenticated TLS connections.
  # tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
  ## Add service certificate and key.
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
```

Thank you for your time, I've been stuck on this for a week now.

I tried those solutions and I expect the data to be sent to my influxDB database (other telegraf instances are already sending data to it).

Body:
When I'm trying to retrieve my meter from opentelemetry (C#) with telegraf (OpenTelemetry plugin), the data is not being sent.

Example code 1:

class Program
{
    static Meter s_meter = new Meter("HatCo.HatStore", "1.0.0");
    static Counter<int> s_hatsSold = s_meter.CreateCounter<int>(name: "hats-sold",
unit: "Hats",                                                                description: "The number of hats sold in our store");

static void Main(string[] args)
{
using MeterProvider meterProvider = Sdk.CreateMeterProviderBuilder()
                .AddMeter("HatCo.HatStore")
                .AddPrometheusExporter()
                .Build();

        Console.WriteLine("Press any key to exit");
        while (!Console.KeyAvailable)
        {
            // Pretend our store has a transaction each second that sells 4 hats
            Thread.Sleep(1000);
            Console.WriteLine("+4");
            s_hatsSold.Add(4);
        }
    }
}

I get this error:

2023-01-05T13:58:06Z I! Starting Telegraf 1.24.4
2023-01-05T13:58:06Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
2023-01-05T13:58:06Z I! Loaded inputs: opentelemetry
2023-01-05T13:58:06Z I! Loaded aggregators:
2023-01-05T13:58:06Z I! Loaded processors:
2023-01-05T13:58:06Z W! Outputs are not used in testing mode!
2023-01-05T13:58:06Z I! Tags enabled: host= [MY MACHINE]
2023-01-05T13:58:06Z E! [inputs.opentelemetry] Error in plugin: failed to stop OpenTelemetry gRPC service: grpc: the server has been stopped
2023-01-05T13:58:06Z E! [telegraf] Error running agent: input plugins recorded 1 errors

And if I try with this example code 2:

class Program
{
    static Meter s_meter = new Meter("HatCo.HatStore", "1.0.0");
    static Counter<int> s_hatsSold = s_meter.CreateCounter<int>(name: "hats-sold",
                                                                unit: "Hats",
                                                                description: "The number of hats sold in our store");

    static void Main(string[] args)
    {
        using MeterProvider meterProvider = Sdk.CreateMeterProviderBuilder()
                .AddMeter("HatCo.HatStore")
                .AddPrometheusExporter(opt =>
                {
                    opt.StartHttpListener = true;
                    opt.HttpListenerPrefixes = new string[] { $"http://localhost:9184/" };
                })
                .Build();

        Console.WriteLine("Press any key to exit");
        while (!Console.KeyAvailable)
        {
            // Pretend our store has a transaction each second that sells 4 hats
            Thread.Sleep(1000);
            Console.WriteLine("+4");
            s_hatsSold.Add(4);
        }
    }
}

I get this result:

2023-01-05T14:02:47Z I! Starting Telegraf 1.24.4
2023-01-05T14:02:47Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
2023-01-05T14:02:47Z I! Loaded inputs: opentelemetry
2023-01-05T14:02:47Z I! Loaded aggregators:
2023-01-05T14:02:47Z I! Loaded processors:
2023-01-05T14:02:47Z W! Outputs are not used in testing mode!
2023-01-05T14:02:47Z I! Tags enabled: host= [MY MACHINE]
2023-01-05T14:02:47Z E! [agent] Starting input inputs.opentelemetry: listen tcp 0.0.0.0:9184: bind: address already in use

All of this is running on Linux ubuntu 20.04, .NET 5.0, and here are the imported dependencies:

using System;
using System.Diagnostics.Metrics;
using System.Threading;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Exporter.Prometheus;

Telegraf inputs:

[[inputs.opentelemetry]]
  ## Override the default (0.0.0.0:4317) destination OpenTelemetry gRPC service
  ## address:port
  service_address = "0.0.0.0:9184"
  ## Override the default (5s) new connection timeout
  # timeout = "5s"

  ## Override the default (prometheus-v1) metrics schema.
  ## Supports: "prometheus-v1", "prometheus-v2"
  ## For more information about the alternatives, read the Prometheus input
  ## plugin notes.
  #metrics_schema = "prometheus-v1"

  ## Optional TLS Config.
  ## For advanced options: https://github.com/influxdata/telegraf/blob/v1.18.3/docs/TLS.md
  ##
  ## Set one or more allowed client CA certificate file names to
  ## enable mutually authenticated TLS connections.
  # tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
  ## Add service certificate and key.
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"

Thank you for your time, I've been stuck on this for a week now.

I tried those solutions and I expect the data to be sent to my influxDB database (other telegraf instances are already sending data to it).


来源: stackexchange

问:
how to fix TypeError: require(...) is not a function in fs discod.js v14
hello I had command handler in discord.js v14 its hosted in replit I opened my replit today after 3weeks and getting this error. Below is my index.js if want you can join my repl to help but please help me fix it as I have to get the bot on top.gg soon

TypeError: require(...) is not a function
    at /home/runner/uniquegamer204/index.js:28:35
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/runner/uniquegamer204/index.js:27:30)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
```
<pre class="lang-js prettyprint-override"><code>const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildPresences,
        GatewayIntentBits.GuildMessageReactions,
        GatewayIntentBits.DirectMessages,
        GatewayIntentBits.MessageContent
    ],
    partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction]
});

const fs = require('fs');
const config = require('./config.json');

client.commands = new Collection()
client.aliases = new Collection()
client.slashCommands = new Collection();
client.buttons = new Collection();
client.prefix = config.prefix;

module.exports = client;

fs.readdirSync('./handlers').forEach((handler) => {
  require(`./handlers/${handler}`)(client)
});
</code>```

client.login(process.env.TOKEN)

ContentLicense: CC BY-SA 4.0

Body:
hello I had command handler in discord.js v14 its hosted in replit I opened my replit today after 3weeks and getting this error. Below is my index.js if want you can join my repl to help but please help me fix it as I have to get the bot on top.gg soon

TypeError: require(...) is not a function
    at /home/runner/uniquegamer204/index.js:28:35
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/runner/uniquegamer204/index.js:27:30)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)

const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildPresences,
        GatewayIntentBits.GuildMessageReactions,
        GatewayIntentBits.DirectMessages,
        GatewayIntentBits.MessageContent
    ],
    partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction]
});

const fs = require('fs');
const config = require('./config.json');

client.commands = new Collection()
client.aliases = new Collection()
client.slashCommands = new Collection();
client.buttons = new Collection();
client.prefix = config.prefix;

module.exports = client;

fs.readdirSync('./handlers').forEach((handler) => {
  require(`./handlers/${handler}`)(client)
});

client.login(process.env.TOKEN)


问:
Detect Slider move
I want to be able to detect if the slider has moved to a new position and then do some actions in another function called sl. Here is my code:

```<code>
import sys
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QLabel, QLineEdit, QScrollBar, QMainWindow, QMenu, QWidget, QGridLayout, \
  QMessageBox, QListWidget, QPlainTextEdit, QTableWidget, QTableWidgetItem, QHeaderView
from PyQt5.QtWidgets import QMenuBar, QHBoxLayout, QVBoxLayout, QSlider, QPushButton, QDial, QBoxLayout, QSpacerItem
from PyQt5.QtGui import QFont, QColor, QPixmap, QResizeEvent, QPen
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore

class ControlWidget(QWidget):

  def __init__(self):

    QWidget.__init__(self)
    self.layout = QVBoxLayout()
    self.layout.setContentsMargins(10, 10, 10, 10)

    widget3 = QLabel("Manual")
    big_font = QFont('Arial')
    big_font.setPointSize(15)
    widget3.setFont(big_font)
    self.layout.addWidget(widget3, stretch=1)

    widget2 = ManualWidget()
    self.layout.addWidget(widget2, stretch=4)

    self.setLayout(self.layout)

class ManualWidget(QWidget):

  def __init__(self):
    QWidget.__init__(self)

    self.layout = QHBoxLayout()

    right_widget = QWidget()
    right_layout = QVBoxLayout()

    right_top_widget = QWidget()
    self.sld1 = self.slider('V1:', 0, 100)

    right_top_layout = QVBoxLayout()
    right_top_layout.setContentsMargins(0, 0, 0, 0)
    right_top_layout.addWidget(self.sld1, stretch=1)
    right_top_widget.setLayout(right_top_layout)
    right_layout.addWidget(right_top_widget)

    right_widget.setLayout(right_layout)
    self.layout.addWidget(right_widget, stretch=1)

    self.setLayout(self.layout)
    self.layout.addWidget(self.name)
    self.layout.addWidget(self.label)
    self.layout.addWidget(self.slider)
    print(self.sl())

  def slider(self, name, low, high, step=10):
    self.name = QLabel(str(name))
    self.label = QLabel(str(low))

    self.slider = QSlider(Qt.Horizontal, self)
    self.slider.setMinimum(low)
    self.slider.setMaximum(high*step)
    self.slider.setValue(low)
    self.slider.valueChanged.connect(self.change_value)
    self.action = False
    self.slider.sliderMoved.connect(self.act1)

  def change_value(self):
    self.set_point = (float(self.slider.value())) / 10
    self.label.setText(str(self.set_point))

  def act1(self):
    self.action = True
    return self.action

  def sl(self):
    if self.action == True:
      x = 3
    else:
      x = 6
    return x

class MainWidget(QWidget):

  def __init__(self):
    QWidget.__init__(self)
    self.layout = QVBoxLayout()
    self.layout.setContentsMargins(0, 0, 0, 0)

    big_font = QFont('Arial')
    big_font.setPointSize(10)

    bottom_widget = ControlWidget()
    self.layout.addWidget(bottom_widget, stretch=10)
    self.setLayout(self.layout)

class Window(QMainWindow):

  def __init__(self, widget):
    QMainWindow.__init__(self)
    self.setWindowTitle("Flow test rig")
    self.menu = self.menuBar()
    self.setCentralWidget(widget)
    self.status = self.statusBar()
    widget.parent = self

app = QApplication(sys.argv)
main_widget = MainWidget()
win = Window(main_widget)

win.show()
sys.exit(app.exec_())

</code>```

I tried to detect it with the act1 function, however, self.action is always False, or when it becomes True, it does not reset to False after the first move of the slider. I appreciate it if someone would help me.

Title: Detect Slider move

Body:
I want to be able to detect if the slider has moved to a new position and then do some actions in another function called sl. Here is my code:

import sys
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QLabel, QLineEdit, QScrollBar, QMainWindow, QMenu, QWidget, QGridLayout, \
  QMessageBox, QListWidget, QPlainTextEdit, QTableWidget, QTableWidgetItem, QHeaderView
from PyQt5.QtWidgets import QMenuBar, QHBoxLayout, QVBoxLayout, QSlider, QPushButton, QDial, QBoxLayout, QSpacerItem
from PyQt5.QtGui import QFont, QColor, QPixmap, QResizeEvent, QPen
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore

class ControlWidget(QWidget):

  def __init__(self):

    QWidget.__init__(self)
    self.layout = QVBoxLayout()
    self.layout.setContentsMargins(10, 10, 10, 10)

    widget3 = QLabel("Manual")
    big_font = QFont('Arial')
    big_font.setPointSize(15)
    widget3.setFont(big_font)
    self.layout.addWidget(widget3, stretch=1)

    widget2 = ManualWidget()
    self.layout.addWidget(widget2, stretch=4)

    self.setLayout(self.layout)

class ManualWidget(QWidget):

  def __init__(self):
    QWidget.__init__(self)

    self.layout = QHBoxLayout()

    right_widget = QWidget()
    right_layout = QVBoxLayout()

    right_top_widget = QWidget()
    self.sld1 = self.slider('V1:', 0, 100)

    right_top_layout = QVBoxLayout()
    right_top_layout.setContentsMargins(0, 0, 0, 0)
    right_top_layout.addWidget(self.sld1, stretch=1)
    right_top_widget.setLayout(right_top_layout)
    right_layout.addWidget(right_top_widget)

    right_widget.setLayout(right_layout)
    self.layout.addWidget(right_widget, stretch=1)

    self.setLayout(self.layout)
    self.layout.addWidget(self.name)
    self.layout.addWidget(self.label)
    self.layout.addWidget(self.slider)
    print(self.sl())

  def slider(self, name, low, high, step=10):
    self.name = QLabel(str(name))
    self.label = QLabel(str(low))

    self.slider = QSlider(Qt.Horizontal, self)
    self.slider.setMinimum(low)
    self.slider.setMaximum(high*step)
    self.slider.setValue(low)
    self.slider.valueChanged.connect(self.change_value)
    self.action = False
    self.slider.sliderMoved.connect(self.act1)

  def change_value(self):
    self.set_point = (float(self.slider.value())) / 10
    self.label.setText(str(self.set_point))

  def act1(self):
    self.action = True
    return self.action

  def sl(self):
    if self.action == True:
      x = 3
    else:
      x = 6
    return x

class MainWidget(QWidget):

  def __init__(self):
    QWidget.__init__(self)
    self.layout = QVBoxLayout()
    self.layout.setContentsMargins(0, 0, 0, 0)

    big_font = QFont('Arial')
    big_font.setPointSize(10)

    bottom_widget = ControlWidget()
    self.layout.addWidget(bottom_widget, stretch=10)
    self.setLayout(self.layout)

class Window(QMainWindow):

  def __init__(self, widget):
    QMainWindow.__init__(self)
    self.setWindowTitle("Flow test rig")
    self.menu = self.menuBar()
    self.setCentralWidget(widget)
    self.status = self.statusBar()
    widget.parent = self

app = QApplication(sys.argv)
main_widget = MainWidget()
win = Window(main_widget)

win.show()
sys.exit(app.exec_())

I tried to detect it with the act1 function, however, self.action is always False, or when it becomes True, it does not reset to False after the first move of the slider. I appreciate it if someone would help me.


问:
Typeorm eager loading not working for MxN relationships while utilizing lazy loading
Problem statement,
Would like to create a Product entity which would be mapped to a lot of other entities(relationships), and allow Lazy loading(as in when required situation).
so in the Product entity the ProductCertificateMapping entity is  wrapped within a Promise.

at the time of lazy loading the productCertificateMapping the Certificate Entities is to be eagerly loaded.
Since the entity ProductCertificateMapping would make more to be present along with the values from the Certificate Entity (3rd table)

Product Entity, 1st level ORM object

```<code>@Entity("products", { schema: "catalog" })
export class Products extends BaseEntity {
/* rest of the attributes*/
@OneToMany(
() => ProductCertificateMapping,
(productCertificateMapping) => productCertificateMapping.product
)
productCertificateMappings: Promise<ProductCertificateMapping>;
}
</code>```

ProductCertificateMapping entity, 2nd level ORM object (also the MxN table)

```<code>@Entity("product_certificate_mapping", { schema: "catalog" })
export class ProductCertificateMapping extends BaseEntity {
/* rest of the attributes*/
@ManyToOne(
() =\> Certificate,
(certificate) => certificate.productCertificateMappings,{eager:true}
)
@JoinColumn([{ name: "certificate_id", referencedColumnName: "id" }])
certificate: Certificate;

@ManyToOne(() => Products, (products) => products.productCertificateMappings)
@JoinColumn([{ name: "product_id", referencedColumnName: "id" }])
product: Products;
}
</code>```

Certificate entity, 3rd level object

```<code>@Entity("certificate", { schema: "catalog" })
export class Certificate extends BaseEntity {
/* rest of the attributes*/

@OneToMany(
() => ProductCertificateMapping,
(productCertificateMapping) => productCertificateMapping.certificate
)
productCertificateMappings: ProductCertificateMapping[];
}
</code>```

Problem statement,
what to create Product entity which is mapped to a lot of other entities to allow Lazy loading for developer(as in when required situation).
so Product entity the ProductCertificateMapping entity is also wrapped with a Promise
at the same time since the entinty ProductCertificateMapping would make sense along with the 3rd table.

Expectation
Product table to load only with its own table attributes (no eager loading) --1st level
Product table's relationships to be loaded using promises(lazy) 2nd --level
and at the same time for Product table's relationship which are of MxN realtionship and have 3d tables, these relationship to be eagerly loaded with 3rd level table data as well.

level 1 entities set with Promises
level 2 entities set without promises and marked as eager:true in ManyToOne

Client Code

```<code>const prod = ProductRepo().findOne()[];
const certificates = await prod.productCertificateMappings;
console.log(certificates[0].certificateName) //should display the certificatename from the 3rd table.
</code>```

Body:
Problem statement,
Would like to create a Product entity which would be mapped to a lot of other entities(relationships), and allow Lazy loading(as in when required situation).
so in the Product entity the ProductCertificateMapping entity is  wrapped within a Promise.

at the time of lazy loading the productCertificateMapping the Certificate Entities is to be eagerly loaded.
Since the entity ProductCertificateMapping would make more to be present along with the values from the Certificate Entity (3rd table)

Product Entity, 1st level ORM object

@Entity("products", { schema: "catalog" })
export class Products extends BaseEntity {
/* rest of the attributes*/
@OneToMany(
() => ProductCertificateMapping,
(productCertificateMapping) => productCertificateMapping.product
)
productCertificateMappings: Promise<ProductCertificateMapping>;
}

ProductCertificateMapping entity, 2nd level ORM object (also the MxN table)

@Entity("product_certificate_mapping", { schema: "catalog" })
export class ProductCertificateMapping extends BaseEntity {
/* rest of the attributes*/
@ManyToOne(
() =\> Certificate,
(certificate) => certificate.productCertificateMappings,{eager:true}
)
@JoinColumn([{ name: "certificate_id", referencedColumnName: "id" }])
certificate: Certificate;

@ManyToOne(() => Products, (products) => products.productCertificateMappings)
@JoinColumn([{ name: "product_id", referencedColumnName: "id" }])
product: Products;
}

Certificate entity, 3rd level object

@Entity("certificate", { schema: "catalog" })
export class Certificate extends BaseEntity {
/* rest of the attributes*/

@OneToMany(
() => ProductCertificateMapping,
(productCertificateMapping) => productCertificateMapping.certificate
)
productCertificateMappings: ProductCertificateMapping[];
}

Problem statement,
what to create Product entity which is mapped to a lot of other entities to allow Lazy loading for developer(as in when required situation).
so Product entity the ProductCertificateMapping entity is also wrapped with a Promise
at the same time since the entinty ProductCertificateMapping would make sense along with the 3rd table.

Expectation
Product table to load only with its own table attributes (no eager loading) --1st level
Product table's relationships to be loaded using promises(lazy) 2nd --level
and at the same time for Product table's relationship which are of MxN realtionship and have 3d tables, these relationship to be eagerly loaded with 3rd level table data as well.

level 1 entities set with Promises
level 2 entities set without promises and marked as eager:true in ManyToOne

Client Code

const prod = ProductRepo().findOne()[];
const certificates = await prod.productCertificateMappings;
console.log(certificates[0].certificateName) //should display the certificatename from the 3rd table.


问:
Responsive Website Looks Completely Different on Desktop (using Developer Tools) vs. Android Chrome
When I test out my website (right here) in Mozilla FireFox OR in Google Chrome using their developer tools to simulate a mobile device, they both look just fine! See this image:

While the header is a bit too tall to my liking, at least I can scroll and view all of the "objects" on the page. However, when I try to go view the page on my Android Chrome browser itself, it looks completely different! See this image:

There's no "objects" onscreen, I can't scroll down, it's almost as if only the header exists on the page! I have no idea how this is happening, nor how to fix it. What am I missing here, and how do I get my page to look the same on a mobile device as it looks in Responsive Design Mode? Any assistance would be greatly appreciated. It's a Wordpress site under the hood, but I do have direct access to all of the files. I just don't know where to start!


问:
TypeScript error in const theme = useContext(ThemeContext)
I am trying to run a code from a github project by running yarn start but i am getting failed to compile with this error:

```<code>TypeScript error in /Users/myname/Documents/Projects/BC/pancakeswap_fork/pancake_clone/pancake-swap-exchange-testnet-master/src/components/Popups/PopupItem.tsx(69,28):
Argument of type 'import("/Users/myname/Documents/Projects/BC/pancakeswap_fork/pancake_clone/pancake-swap-exchange-testnet-master/node_modules/@types/react-redux/node_modules/@types/react/index").Context<import("/Users/myname/Documents/Projects/BC/pancakeswap_fork/pancake_clone/pancake-swap-exchange-testnet-master/node_module...' is not assignable to parameter of type 'React.Context<import("/Users/myname/Documents/Projects/BC/pancakeswap_fork/pancake_clone/pancake-swap-exchange-testnet-master/node_modules/@types/styled-components/index").DefaultTheme>'.  TS2345

    67 |   }, [removeAfterMs, removeThisPopup])
    68 |
  > 69 |   const theme = useContext(ThemeContext)
       |                            ^
    70 |
    71 |   let popupContent
    72 |   if ('txn' in content) {
</code>```

I've researched about ThemeContext and found a promising solution (how to create context for theme with reactjs?) but i am unsure on how to implement it.

If it's useful, the variable theme is used like this:

```<code>  return (
    <Popup>
      <StyledClose color={theme.colors.textSubtle} onClick={removeThisPopup} />
      {popupContent}
      {removeAfterMs !== null ? <AnimatedFader style={faderStyle} /> : null}
    </Popup>
</code>```

Thanks for any insight and sorry for the noob q.. i'm new with typescript

Body:
I am trying to run a code from a github project by running yarn start but i am getting failed to compile with this error:

TypeScript error in /Users/myname/Documents/Projects/BC/pancakeswap_fork/pancake_clone/pancake-swap-exchange-testnet-master/src/components/Popups/PopupItem.tsx(69,28):
Argument of type 'import("/Users/myname/Documents/Projects/BC/pancakeswap_fork/pancake_clone/pancake-swap-exchange-testnet-master/node_modules/@types/react-redux/node_modules/@types/react/index").Context<import("/Users/myname/Documents/Projects/BC/pancakeswap_fork/pancake_clone/pancake-swap-exchange-testnet-master/node_module...' is not assignable to parameter of type 'React.Context<import("/Users/myname/Documents/Projects/BC/pancakeswap_fork/pancake_clone/pancake-swap-exchange-testnet-master/node_modules/@types/styled-components/index").DefaultTheme>'.  TS2345

    67 |   }, [removeAfterMs, removeThisPopup])
    68 |
  > 69 |   const theme = useContext(ThemeContext)
       |                            ^
    70 |
    71 |   let popupContent
    72 |   if ('txn' in content) {

I've researched about ThemeContext and found a promising solution (how to create context for theme with reactjs?) but i am unsure on how to implement it.

If it's useful, the variable theme is used like this:

  return (
    <Popup>


问:
Algorithm for finding the shortest cycle in a positive weighted directed graph passing through only specific nodes (not the other nodes)
A question was asked in the below link, but the answers do not mention which algorithm I can use exactly. I am wondering if the algorithm is based on Dijkstra or traveling salesman problem (TSP)
.
Find the shortest cycle in a positive weighted directed graph passing through only specific nodes (not the other nodes)</p>


问:
How to set-up the same stream for cross domain tracking (GA4) in two different GTM container
I'd like to set-up cross domain tracking between two domains (let's say website A and website B).

Each website involved has its' own GTM installed and configured a bunch of custom events.

Each website has also own GA4 property (different once) with different data streams configured to send data to GA4 using GTM.

Official Google doc describes that before you set-up cross domain tracking in GA4, you must have the same data stream for each domain. I don't wanna mix data from two different websites in one (existing) property, so what's recommendation here?
How, in this case,  we should direct data to the same data stream?
Should we eg. set-up new GA4 property and create config tag in both GTM containers (for website A and B) with the same Measurement ID and add this config tag only to event generating click on onbound link on domain A?
How about domain B? Should we assign config tag with new data stream to all events triggered by page view?

Thanks for any recommendations and tips.


问:
Selenium Adblock and download default options set to google drive folder
I currently have a working version of a selenium web automated through python - as part of this I have installed the Adblocker by using the following:

```<code>options = webdriver.ChromeOptions()
options.add_extension(
    'C:/Users/xxx/AppData/Local/Google/Chrome/User Data/Default/Extensions/AdblockPlusv3.crx')
prefs = {'download.default_directory': 'C:/Users/xxx/'}
options.add_experimental_option('prefs', prefs)
self.driver = webdriver.Chrome(options=options)
</code>```

This works well and does what it is supposed to do - but I plan to move this code into the cloud, specifically to run in Google Functions so I can call on it through a HTTPS request for automation.

I want to change my default location for download as well as my default crx for adblocker to read from Google Drive so the files are in a cloud space and have no reliance on my PC which cloud functions will not see - the code would then be amended to look like the following:

```<code>options = webdriver.ChromeOptions()
options.add_extension(
    'https://drive.google.com/file/d/id/view?usp=share_link')
prefs = {'download.default_directory': 'https://drive.google.com/drive/folders/id?usp=sharing'}
options.add_experimental_option('prefs', prefs)
self.driver = webdriver.Chrome(options=options)
</code>```

Both these links are set to anyone with a link can edit so it is not permissions causing issues but I am unable to get the crx file from the link nor set the download location - any thoughts?

Body:
I currently have a working version of a selenium web automated through python - as part of this I have installed the Adblocker by using the following:

options = webdriver.ChromeOptions()
options.add_extension(
    'C:/Users/xxx/AppData/Local/Google/Chrome/User Data/Default/Extensions/AdblockPlusv3.crx')
prefs = {'download.default_directory': 'C:/Users/xxx/'}
options.add_experimental_option('prefs', prefs)
self.driver = webdriver.Chrome(options=options)

This works well and does what it is supposed to do - but I plan to move this code into the cloud, specifically to run in Google Functions so I can call on it through a HTTPS request for automation.

I want to change my default location for download as well as my default crx for adblocker to read from Google Drive so the files are in a cloud space and have no reliance on my PC which cloud functions will not see - the code would then be amended to look like the following:

options = webdriver.ChromeOptions()
options.add_extension(
    'https://drive.google.com/file/d/id/view?usp=share_link')
prefs = {'download.default_directory': 'https://drive.google.com/drive/folders/id?usp=sharing'}
options.add_experimental_option('prefs', prefs)
self.driver = webdriver.Chrome(options=options)

Both these links are set to anyone with a link can edit so it is not permissions causing issues but I am unable to get the crx file from the link nor set the download location - any thoughts?


问:
requires clause on non-template friend function of a template class
Reproducible code as below or on godbolt compiles with clang trunk and MSVC but fails with gcc trunk. Given that non-template friend function of a template class could be constrained by requires clause, is it a gcc bug here?</p>
```<code>template< typename Derived >
struct base {
    friend void foo(Derived const& d) requires requires { bar(d); } {
        bar(d);
    }
};

namespace adl {
    struct S: base<S> {
        friend void bar(S const&) {}
    };
}
using adl::S;

void test(S const& s) {
    foo(s); // gcc error: 'foo' was not declared in this scope
}
</code>```

Body:
Reproducible code as below or on godbolt compiles with clang trunk and MSVC but fails with gcc trunk. Given that non-template friend function of a template class could be constrained by requires clause, is it a gcc bug here?

template< typename Derived >
struct base {
    friend void foo(Derived const& d) requires requires { bar(d); } {
        bar(d);
    }
};

namespace adl {
    struct S: base<S> {
        friend void bar(S const&) {}
    };
}
using adl::S;

void test(S const& s) {
    foo(s); // gcc error: 'foo' was not declared in this scope
}


问:
How to return all the selected choices to a final screen in React Native
So I have been unsure how to word this issue in my search for an answer, and so far have come up empty-handed.

I am trying to set up a 3-screen process that allows a vendor to specify the item they are trying to list on an app. By all means, if there is an easier solution then I am open to it also, this is just how the owner of the startup requested it done, but he isn't final on it.

So the process is something like this: There is an addListings screen that I have built with options like adding a photo, title, description, etc. Then there are three buttons, men, women, and children, which should lead to a new screen of choices of "sportswear, casual, swimwear, etc. " then that choice takes them to a third page of "shirts, pants, shoes, etc.

ANYWAYS. I am able to carry over the data from one screen to another, but I am unsure as to how I would carry all three choices back to the original listings screen, to display the results, such as "Women's > Casual > Blouse".

here is some example of what I have:

```<code>export default function Categories({  }) {

const navigation = useNavigation();

const [catagories, setCatagories] = useState([
    { title: 'Mens', key: '1' },
    { title: 'Womens', key: '2' },
    { title: 'Children', key: '3' }
]);

return (
    <View>
        <FlatList
            data={catagories}
            renderItem={({ item }) => (
                <TouchableOpacity onPress={() => navigation.navigate('CategoryDetails', item)}>
                    <Text>{ item.title }</Text>
                </TouchableOpacity>
            )}
        />
    </View>
)
</code>```

which I initially put into the addlistings screen as  then that takes the user to:

```<code>export default function CategoryDetails({  }) {

  const navigation = useNavigation();

const {
    params: {
      title,
    },
  } = useRoute();

const [details, setDetails] = useState([
    { type: 'shirt', key: '1' },
    { type: 'pants', key: '2' },
    { type: 'shoes', key: '3' }
]);

return (
    <View>
        <Text>{title}</Text>
        <FlatList
            data={details}
            renderItem={({ item }) => (
                <TouchableOpacity onPress={() => navigation.navigate('CategorySubDetails', item)}>
                    <Text> {item.type} </Text>
                </TouchableOpacity>
            )}
        />
    </View>
)
</code>```

and then this is where I am unsure as to how I then transfer the "Mens" title onwards to the subCategories screen along with the new "type" then return all three back to the original addlistings Screen... Any insight is greatly appreciated!

Body:
So I have been unsure how to word this issue in my search for an answer, and so far have come up empty-handed.

I am trying to set up a 3-screen process that allows a vendor to specify the item they are trying to list on an app. By all means, if there is an easier solution then I am open to it also, this is just how the owner of the startup requested it done, but he isn't final on it.

So the process is something like this: There is an addListings screen that I have built with options like adding a photo, title, description, etc. Then there are three buttons, men, women, and children, which should lead to a new screen of choices of "sportswear, casual, swimwear, etc. " then that choice takes them to a third page of "shirts, pants, shoes, etc.

ANYWAYS. I am able to carry over the data from one screen to another, but I am unsure as to how I would carry all three choices back to the original listings screen, to display the results, such as "Women's > Casual > Blouse".

here is some example of what I have:

export default function Categories({  }) {

const navigation = useNavigation();

const [catagories, setCatagories] = useState([
    { title: 'Mens', key: '1' },
    { title: 'Womens', key: '2' },
    { title: 'Children', key: '3' }
]);

return (
    <View>
        <FlatList
            data={catagories}
            renderItem={({ item }) => (
                <TouchableOpacity onPress={() => navigation.navigate('CategoryDetails', item)}>
                    <Text>{ item.title }</Text>
                </TouchableOpacity>
            )}
        />
    </View>
)

which I initially put into the addlistings screen as  then that takes the user to:

export default function CategoryDetails({  }) {

  const navigation = useNavigation();

const {
    params: {
      title,
    },
  } = useRoute();

const [details, setDetails] = useState([
    { type: 'shirt', key: '1' },
    { type: 'pants', key: '2' },
    { type: 'shoes', key: '3' }
]);

return (
    <View>
        <Text>{title}</Text>
        <FlatList
            data={details}
            renderItem={({ item }) => (
                <TouchableOpacity onPress={() => navigation.navigate('CategorySubDetails', item)}>
                    <Text> {item.type} </Text>
                </TouchableOpacity>
            )}
        />
    </View>
)

and then this is where I am unsure as to how I then transfer the "Mens" title onwards to the subCategories screen along with the new "type" then return all three back to the original addlistings Screen... Any insight is greatly appreciated!


问:
React doesn't detect that an input had been filled
I am using some code with fields that are "required", the confirm button will not activate while they are empty. When someone else types something in the field while running it on their computer the button activates as intended, but if I do it on my computer the button does not activate, the field is still considered empty.

We are running the same code from the same branch of Github and all our dependencies are on the same version. This code is a small part of it, this error happens on all screens only on my end.

```<code>const {
    control,
    formState: { isValid, isDirty, errors },
    handleSubmit,
    reset,
    register,
    setError,
  } = useForm();

const onSubmit = async form =>
    mutation.mutate({
      ...form,
      id: state.data.id,
      esn: Number(form.esn),
    });

<Controller
        render={({ field: { onChange, value } }) => (
          <Select
            defaultValue={value}
            title={language.trackerModelId}
            setValue={onChange}
            placeholder={language.trackerModelIdPlaceholder}
            options={trackerModelData}
            filterable
          />
        )}
        name="trackerModelId"
        control={control}
        rules={{ required: true }}
      />
      <Input
        title={language.esn}
        name="esn"
        register={register}
        error={errors.esn?.message}
        onChange={handleValidateESN}
        required
        upperCase
      />
</code>```

Edit: If I use { mode: 'onChange' } inside the useForm then it will work correctly, but it can't be a permanent solution due to it being a code to fix a problem that only happens on my computer.

Body:
I am using some code with fields that are "required", the confirm button will not activate while they are empty. When someone else types something in the field while running it on their computer the button activates as intended, but if I do it on my computer the button does not activate, the field is still considered empty.

We are running the same code from the same branch of Github and all our dependencies are on the same version. This code is a small part of it, this error happens on all screens only on my end.

const {
    control,
    formState: { isValid, isDirty, errors },
    handleSubmit,
    reset,
    register,
    setError,
  } = useForm();

const onSubmit = async form =>
    mutation.mutate({
      ...form,
      id: state.data.id,
      esn: Number(form.esn),
    });

<Controller
        render={({ field: { onChange, value } }) => (
          <Select
            defaultValue={value}
            title={language.trackerModelId}
            setValue={onChange}
            placeholder={language.trackerModelIdPlaceholder}
            options={trackerModelData}
            filterable
          />
        )}
        name="trackerModelId"
        control={control}
        rules={{ required: true }}
      />
      <Input
        title={language.esn}
        name="esn"
        register={register}
        error={errors.esn?.message}
        onChange={handleValidateESN}
        required
        upperCase
      />

Edit: If I use { mode: 'onChange' } inside the useForm then it will work correctly, but it can't be a permanent solution due to it being a code to fix a problem that only happens on my computer.


问:
Reencode video with lower FPS in swift
I have an mp4 file that I would like to compress. The way I'd like to do it is to take it and just reduce the fps of the video, down to something like 1fps.

I've tried setting the AVVideoCompressionPropertiesKey on AVAssetWriterInput but it does not seem to be working.

Given I don't want to change any of the buffers, just drop frames to satisfy an FPS requirement, what is the most efficient way of doing so in Swift?

Title: Reencode video with lower FPS in swift


问:
Custom OpenCV build works in command prompt but not working in Pycharm 2022.3.1?
Last December I've compiled OpenCV 4.6.0 with contrib modules + cuda support with cMake in a conda environment called opencv-460+cuda with python 3.9.15 and numpy 1.23.5. The cuda version installed is the cuda_11.0.3_451.82_win10 with cudnn-11.0-windows-x64-v8.0.5.39. Then I configured my previosly installed Pycharm 2021.2 to execute my own cv2 based scripts and all worked like a digital heaven. Only had to proper config these: .

Then one day I've decide to install CUDA v9.0 because Re3 object tracking algorithm requirement and it worked just fine alongside the v11.0 after settings the correct order in the environment variables panel

And lastly I choose to compile Marlin 2.1(yes, for 3D printers) with Visual Studio Code and after this, things got weird.

I couldn't execute cv2 scripts inside Pycharm nor the Anaconda Prompt with env opencv-460+cuda activated due to

import cv2
ImportError: DLL load failed while importing cv2: Couldn't find the specified module.

Then I get Windows to a past point using its restoration tool. It removed the CUDA v9.0(not the files) and the Visual Studio Code. And now the opencv scripts work in the Anaconda Prompt and in Windows PS but not in Pycharm 2022.3

I have even installed cuda v9.0 again and I still can execute my cv2 programs in Anaconda Prompt but not in Pycharm and I want to know what the h3ll have VS Code done to my Windows

I have even run Dependency Walker on the cv2.cp39-win_amd64.pyd file and I've got these . It finds all DLLs but in Checksum column says incorrect for the first three elements, altough when I put the caret on top of them appears the next

And other odd behavior is when I use Terminal from Pycharm I can import cv2  and even execute scripts but I can't execute it with Pycharm console and I WANT THE WAY THINGS WERE BEFORE VS CODE


问:
What is wrong with the SQL select statement?
Every time I try to run this select statement I get told there is a syntax error. Can someone please help me figure out what the syntax error is?

```<code>SELECT
ZERO_SALES.STORE_NUMBER,
COUNT( * ) AS COLUMN0001,
ZERO_SALES.SKU_NUMBER
FROM
MM4R5LIB.ZERO_SALES ZERO_SALES,
MM4R5LIB.INVMST INVMST,
MM4R5LIB.OPORBK OPORBK,
MM4R5LIB.TBLSTT TBLSTT,
MM4R5LIB.TBLSTR TBLSTR
WHERE
ZERO_SALES.SKU_NUMBER = INVMST.INUMBR
AND INVMST.INUMBR = OPORBK.INUMBR
AND ZERO_SALES.STORE_NUMBER = OPORBK.ISTORE
AND OPORBK.ISTORE = TBLSTT.STRNUM
AND TBLSTT.STRNUM = TBLSTR.STRNUM
AND ZERO_SALES.STORE_NUMBER = 6009
AND ZERO_SALES.SKU_NUMBER =(233879, 659250, 240896)

GROUP BY
ZERO_SALES.STORE_NUMBER,
ZERO_SALES.SKU_NUMBER
</code>```

I am trying to get a list of the number of occurrences for each SKU number for this particular store.

Body:
Every time I try to run this select statement I get told there is a syntax error. Can someone please help me figure out what the syntax error is?

SELECT
ZERO_SALES.STORE_NUMBER,
COUNT( * ) AS COLUMN0001,
ZERO_SALES.SKU_NUMBER
FROM
MM4R5LIB.ZERO_SALES ZERO_SALES,
MM4R5LIB.INVMST INVMST,
MM4R5LIB.OPORBK OPORBK,
MM4R5LIB.TBLSTT TBLSTT,
MM4R5LIB.TBLSTR TBLSTR
WHERE
ZERO_SALES.SKU_NUMBER = INVMST.INUMBR
AND INVMST.INUMBR = OPORBK.INUMBR
AND ZERO_SALES.STORE_NUMBER = OPORBK.ISTORE
AND OPORBK.ISTORE = TBLSTT.STRNUM
AND TBLSTT.STRNUM = TBLSTR.STRNUM
AND ZERO_SALES.STORE_NUMBER = 6009
AND ZERO_SALES.SKU_NUMBER =(233879, 659250, 240896)

GROUP BY
ZERO_SALES.STORE_NUMBER,
ZERO_SALES.SKU_NUMBER

I am trying to get a list of the number of occurrences for each SKU number for this particular store.


问:
Use findstr to find input from file a within file b, and send the output to a different file
I'm trying to write a batch script in Windows to take a list of IP addresses and ping them. Once a site doesn't respond, I want Windows to take all of the unresponsive IP addresses, and parse them through a comparison file that has the IP and physical street addresses of these systems. Once the unresponsive sites are parsed through the comparison file, I want the end result to be the matching info from the compare file for only the sites that are unresponsive. I already have script written for Linux that does this same thing, but I wanted a Windows version for some of the customers I work with who aren't Linux savvy.

Here is my script:

```<code>@Echo Off
Set "ServerList=C:\Users\<mylogin>\ip.txt"
Set "LogFile=C:\Users\<mylogin>\PingResults.txt"

If Not Exist "%ServerList%" Exit /B
>"%LogFile%" (For /F UseBackQ %%A In ("%ServerList%"
) Do Ping -n 1 %%A|Find "TTL=">Nul&&(Echo Yes [%%A] > Nul)||Echo No [%%A])

findstr /f:%LogFile sites.txt > Down.txt
</code>```

The script itself seems to execute just fine, but it doesn't put anything in the final output file of Down.txt, I'm positive I have something wrong in my findstr command.

Below is my Linux script that does this exact same thing. Yeah it's clunky but it gets the job done:

#!/bin/bash

# Script to test ssh connectivity using expect script
rm -f results.txt
clear
echo "Please be patient while the script runs..."
while read user ip port pass; do
    ${PWD}/test_ssh_edge_device.sh $user $ip $port $pass >> results.txt
done < rekor_edge_device_list.txt

#This will boil down the results of the ping script so only the IP address is left

cat results.txt | grep -B1 time > refined.txt

cat refined.txt | grep -Eo "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" > refinedip.txt

#This will take the boiled down IP addresses and check them against the compare file, final output will be all system info for only downed systems

list=refinedip.txt

rm -f iplist.txt

exec 3<&0

exec 0<$list

while read line
do
        cat compare.txt | grep $line >> iplist.txt
done

exec 0<&3

cat iplist.txt
```

Body:
I'm trying to write a batch script in Windows to take a list of IP addresses and ping them. Once a site doesn't respond, I want Windows to take all of the unresponsive IP addresses, and parse them through a comparison file that has the IP and physical street addresses of these systems. Once the unresponsive sites are parsed through the comparison file, I want the end result to be the matching info from the compare file for only the sites that are unresponsive. I already have script written for Linux that does this same thing, but I wanted a Windows version for some of the customers I work with who aren't Linux savvy.

Here is my script:

@Echo Off
Set "ServerList=C:\Users\<mylogin>\ip.txt"
Set "LogFile=C:\Users\<mylogin>\PingResults.txt"

If Not Exist "%ServerList%" Exit /B
>"%LogFile%" (For /F UseBackQ %%A In ("%ServerList%"
) Do Ping -n 1 %%A|Find "TTL=">Nul&&(Echo Yes [%%A] > Nul)||Echo No [%%A])

findstr /f:%LogFile sites.txt > Down.txt

The script itself seems to execute just fine, but it doesn't put anything in the final output file of Down.txt, I'm positive I have something wrong in my findstr command.

Below is my Linux script that does this exact same thing. Yeah it's clunky but it gets the job done:

#!/bin/bash

# Script to test ssh connectivity using expect script
rm -f results.txt
clear
echo "Please be patient while the script runs..."
while read user ip port pass; do
    ${PWD}/test_ssh_edge_device.sh $user $ip $port $pass >> results.txt
done < rekor_edge_device_list.txt

#This will boil down the results of the ping script so only the IP address is left

cat results.txt | grep -B1 time > refined.txt

cat refined.txt | grep -Eo "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" > refinedip.txt

#This will take the boiled down IP addresses and check them against the compare file, final output will be all system info for only downed systems

list=refinedip.txt

rm -f iplist.txt

exec 3<&0

exec 0<$list

while read line
do
        cat compare.txt | grep $line >> iplist.txt
done

exec 0<&3

cat iplist.txt


问:
Parallel Timer animation in flutter
I made an automatic scrolling bar in flutter, the way I made it scroll automatically by using a combination of a timer and scroll controller, and then I linked the scroll controller to a regular ListView.builder, blew is the implementation of my way to do it

```<code>  @override
  void initState() {
    super.initState();
    int _length = widget.items.length;
    currentItems = widget.items;

    // scroll smothly to the end of the list then reverse the scroll
    bool isAscending = true;
    _timer = Timer.periodic(const Duration(milliseconds: 3000), (timer) {
      if (isAscending) {
        _currentIndex++;
        if (_currentIndex == currentItems.length) {
          isAscending = !isAscending;
        }
      }
      if (!isAscending) {
        _currentIndex--;
        if (_currentIndex == 0) {
          isAscending = !isAscending;
        }
      }
      _scrollController.animateTo(_currentIndex * 304.0,
          duration: const Duration(milliseconds: 3000), curve: Curves.linear);
    });
  }
</code>```

my problem here is when I navigate to another screen or press the phone's home button and stay away from this widget for a while and then come back, I'd find it scrolling so fast to catch the currentIndex ( which is far away from where I left it ) in a period of time that I specified for the .animateTo method, I'm guessing the solution is to somehow pause the timer when I'm not in the same route, but I didn't find any reference of how to implement that

Title: Parallel Timer animation in flutter

Body:
I made an automatic scrolling bar in flutter, the way I made it scroll automatically by using a combination of a timer and scroll controller, and then I linked the scroll controller to a regular ListView.builder, blew is the implementation of my way to do it

  @override
  void initState() {
    super.initState();
    int _length = widget.items.length;
    currentItems = widget.items;

    // scroll smothly to the end of the list then reverse the scroll
    bool isAscending = true;
    _timer = Timer.periodic(const Duration(milliseconds: 3000), (timer) {
      if (isAscending) {
        _currentIndex++;
        if (_currentIndex == currentItems.length) {
          isAscending = !isAscending;
        }
      }
      if (!isAscending) {
        _currentIndex--;
        if (_currentIndex == 0) {
          isAscending = !isAscending;
        }
      }
      _scrollController.animateTo(_currentIndex * 304.0,
          duration: const Duration(milliseconds: 3000), curve: Curves.linear);
    });
  }

my problem here is when I navigate to another screen or press the phone's home button and stay away from this widget for a while and then come back, I'd find it scrolling so fast to catch the currentIndex ( which is far away from where I left it ) in a period of time that I specified for the .animateTo method, I'm guessing the solution is to somehow pause the timer when I'm not in the same route, but I didn't find any reference of how to implement that


问:
Plateaus training loss but validation loss decreases
I am training a fully convolutional regressor, with mobilenet as its backbone. I have already overcome a massive overfitting problem by augmenting the data. However, the training loss seems to be stuck after a couple of epochs. On the other hand, validation loss reduces for a reasonable number of epochs and plateaus. Here are the learning curves.

Learning curves

And here is the architecture and compiling parameters.

```<code>backbone = keras.applications.ResNet50(weights="imagenet",
                                        include_top=False,
                                        input_shape=(shape[0], shape[1], 3)
    )
backbone.trainable = True

inputs = layers.Input((shape[0], shape[1], 3))
x = keras.applications.resnet.preprocess_input(inputs)
x = backbone(x)
x = layers.Dropout(0.5)(x)
x = layers.SeparableConv2D(
    N, kernel_size=5, strides=1, activation="relu"
)(x)
outputs = layers.SeparableConv2D(
    N, kernel_size=3, strides=1
)(x)

model = keras.Model(inputs, outputs, name="mobilenet_FullyConv_rect")

model.compile(loss="mse", optimizer=keras.optimizers.Adam(1e-4))
history = model.fit(train_gen, validation_data=val_gen,
                    epochs=epochs,
                    batch_size=batch_size
                    )
</code>```

Any idea of why training loss faces plateaus sooner than val loss is appreciated. Also any suggestions to how I can reach smaller loss values instead of facing plateaus soon.

I have tried using more complex backbones like ResNet50 and DenseNet169, as I suspected underfitting. However, this did not solve anything and validation loss was having massive fluctuations. I also tried augmenting my data even more ( trippling the data instead of doubling ). This did not help very much either, which makes me believe that this is actually underfitting, since feeding more data did not lead to improvements. To put it short, I am kind of lost between bringing more data or making my architecture more complex.

Body:
I am training a fully convolutional regressor, with mobilenet as its backbone. I have already overcome a massive overfitting problem by augmenting the data. However, the training loss seems to be stuck after a couple of epochs. On the other hand, validation loss reduces for a reasonable number of epochs and plateaus. Here are the learning curves.

Learning curves

And here is the architecture and compiling parameters.

backbone = keras.applications.ResNet50(weights="imagenet",
                                        include_top=False,
                                        input_shape=(shape[0], shape[1], 3)
    )
backbone.trainable = True

inputs = layers.Input((shape[0], shape[1], 3))
x = keras.applications.resnet.preprocess_input(inputs)
x = backbone(x)
x = layers.Dropout(0.5)(x)
x = layers.SeparableConv2D(
    N, kernel_size=5, strides=1, activation="relu"
)(x)
outputs = layers.SeparableConv2D(
    N, kernel_size=3, strides=1
)(x)

model = keras.Model(inputs, outputs, name="mobilenet_FullyConv_rect")

model.compile(loss="mse", optimizer=keras.optimizers.Adam(1e-4))
history = model.fit(train_gen, validation_data=val_gen,
                    epochs=epochs,
                    batch_size=batch_size
                    )

Any idea of why training loss faces plateaus sooner than val loss is appreciated. Also any suggestions to how I can reach smaller loss values instead of facing plateaus soon.

I have tried using more complex backbones like ResNet50 and DenseNet169, as I suspected underfitting. However, this did not solve anything and validation loss was having massive fluctuations. I also tried augmenting my data even more ( trippling the data instead of doubling ). This did not help very much either, which makes me believe that this is actually underfitting, since feeding more data did not lead to improvements. To put it short, I am kind of lost between bringing more data or making my architecture more complex.


问:
ERROR: The Compose file './docker-compose.yml' is invalid because
I have a problem :)

I wanted to run a docker-compose for the first time.

But he got it wrong

It is this one:
https://github.com/navilg/media-stack

Here is my error message:

```<code>root@ubuntu:~/docker-compose/media-stack# docker-compose --profile stack-2 up -d
ERROR: The Compose file './docker-compose.yml' is invalid because:
'name' does not match any of the regexes: '^x-'
</code>```

You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the services key, or omit the version key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

Here are my versions:

```<code>root@ubuntu:~/docker-compose/media-stack# docker version
Customer:
 Version: 20.10.16
 API version: 1.41
 Go version: go1.18.1
 Git commit: 20.10.16-0ubuntu1
 Built: Thu May 12 20:45:12 2022
 OS/Arch: linux/arm64
 Context: default
 Experimental: true

server:
 Engine:
  Version: 20.10.16
  API version: 1.41 (minimum version 1.12)
  Go version: go1.18.1
  Git commit: 20.10.16-0ubuntu1
  Built: Thu May 12 20:04:31 2022
  OS/Arch: linux/arm64
  Experimental: false
 containerd:
  Version: 1.6.4-0ubuntu1.1
  GitCommit:
 runc:
  Version: 1.1.2-0ubuntu1.1
  GitCommit:
 docker-init:
  Version: 0.19.0
  GitCommit:
root@ubuntu:~/docker-compose/media-stack# docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.7
OpenSSL version: OpenSSL 3.0.5 5 Jul 2022
</code>```

I tried to change version on the docker-compose to version 1 or 2 and 3 but nothing works.

Here is the docker-compose:

```<code>version: "3.9"
name: media-stack
services:
  vpn:
  ## Read https://github.com/qdm12/gluetun/wiki for details on configuring VPN for different service providers.
    profiles: ["vpn", "stack-2"]
    container_name: vpn
    image: qmcgaw/gluetun:v3.32
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_SERVICE_PROVIDER=${VPN_SERVICE_PROVIDER:-nordvpn} # Valid values: nordvpn, expressvpn, protonvpn, surfshark or custom
      - OPENVPN_USER=${OPENVPN_USER:-""}
      - OPENVPN_PASSWORD=${OPENVPN_PASSWORD:-""}

      ## For list of server regions and countries, visit https://raw.githubusercontent.com/qdm12/gluetun/master/internal/storage/servers.json

      ## SERVER_REGIONS is required for NordVPN and Surfshark VPN. Comment SERVER_COUNTRIES if SERVER_REGIONS is used.
      - SERVER_REGIONS=${SERVER_REGIONS:-Switzerland}

      ## SERVER_COUNTRIES is required for ExpressVPN and ProtonVPN. Comment SERVER_REGIONS if SERVER_COUNTRIES is used.
      # - SERVER_COUNTRIES=${SERVER_COUNTRIES:-Netherlands}
      # - FREE_ONLY=on  # Valid with protonvpn only. on if using free service provided by protonvpn

      ## Enable below if VPN_SERVICE_PROVIDER=custom
      # - VPN_TYPE=openvpn # or wireguard.

      ## If VPN_TYPE is openvpn
      # - OPENVPN_CUSTOM_CONFIG=/gluetun/custom.conf

      ## If VPN_TYPE is wireguard. Replace below env variables as required.
      # - VPN_ENDPOINT_IP=1.2.3.4                                               # Replace with your wg endpoint ip or domain
      # - VPN_ENDPOINT_PORT=51820                                               # Replace with wg server port
      # - WIREGUARD_PUBLIC_KEY=wAUaJMhAq3NFutLHIdF8AN0B5WG8RndfQKLPTEDHal0=     # Replace with your wg public key
      # - WIREGUARD_PRIVATE_KEY=wOEI9rqqbDwnN8/Bpp22sVz48T71vJ4fYmFWujulwUU=    # Replace with your wg client private key
      # - WIREGUARD_PRESHARED_KEY=xOEI9rqqbDwnN8/Bpp22sVz48T71vJ4fYmFWujulwUU=  # Replaced with your wg pre-shared key
      # - WIREGUARD_ADDRESSES="10.64.222.21/32"                                 # Replace with wg address

    ## Enable volume if custom VPN_SERVICE_PROVIDER is used
    # volumes:
      # - /yourpath/yourconfig.conf:/gluetun/config.conf:ro

    networks:
      - mynetwork
    ports:
      # qbittorrent ports
      - 5080:5080
      - 6881:6881
      - 6881:6881/udp
      # prowlarr ports
      - 9696:9696
      # Transmission ports. Uncomment below if Transmission is used with VPN
      # - 9091:9091
      # - 51413:51413
      # - 51413:51413/udp
    restart: "unless-stopped"
  transmission:
    profiles: ["tx", "stack-1"]
    container_name: transmission
    image: lscr.io/linuxserver/transmission:3.00-r6
    networks:
      - mynetwork
    # network_mode: service:vpn # Uncomment this line if vpn is enabled
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
      - USER=admin
      - PASS=nimdatx

    ## Comment below ports if VPN is enabled.
    ports:
      - 9091:9091
      - 51413:51413
      - 51413:51413/udp
    volumes:
      - tx-config:/config
      - torrent-downloads:/downloads
      - tx-watch:/watch
    restart: "unless-stopped"

  ## Default credentials - Username: admin password: adminadmin ##
  ## Change password after install from UI --> Tools --> Options --> WebUI ##
  qbittorrent:
    container_name: qbittorrent
    profiles: ["qbt", "stack-2"]
    image: lscr.io/linuxserver/qbittorrent:4.5.0
    # Comment this if vpn is disabled
    depends_on:
      - vpn
    networks:
      - mynetwork
    network_mode: service:vpn # Comment this line if vpn is disabled
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
      - WEBUI_PORT=5080
    volumes:
      - qbittorrent-config:/config
      - torrent-downloads:/downloads

    ## Uncomment below ports if VPN is disabled.
    # ports:
    #   - 5080:5080
    #   - 6881:6881
    #   - 6881:6881/udp
    restart: "unless-stopped"
  radarr:
    profiles: ["base", "radarr", "stack-1", "stack-2"]
    container_name: radarr
    image: lscr.io/linuxserver/radarr:4.2.4
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    ports:
      - 7878:7878
    volumes:
      - radarr-config:/config
      - torrent-downloads:/downloads
    restart: "unless-stopped"

  sonarr:
    profiles: ["base", "sonarr", "stack-1", "stack-2"]
    image: lscr.io/linuxserver/sonarr:develop-version-4.0.0.269
    container_name: sonarr
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    volumes:
      - sonarr-config:/config
      - torrent-downloads:/downloads
    ports:
      - 8989:8989
    restart: unless-stopped

  jackett:
    profiles: ["jackett", "stack-1"]
    container_name: jackett
    image: lscr.io/linuxserver/jackett:v0.20.2309
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    volumes:
      - jackett-config:/config
      - jackett-blackhole:/downloads
    ports:
      - 9117:9117
    restart: unless-stopped

  prowlarr:
    profiles: ["prowlarr", "stack-2"]
    container_name: prowlarr
    image: linuxserver/prowlarr:0.4.9-develop
    # Comment this if vpn is disabled
    depends_on:
      - vpn
    network_mode: service:vpn # Comment this line if vpn is disabled
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    volumes:
      - prowlarr-config:/config
    ## Uncomment below ports if VPN is disabled.
    # ports:
    #   - 9696:9696
    restart: unless-stopped

  jellyfin:
    profiles: ["base", "jelly", "stack-1", "stack-2"]
    image: lscr.io/linuxserver/jellyfin:10.8.8
    container_name: jellyfin
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    volumes:
      - jellyfin-config:/config
      - torrent-downloads:/data
  # devices:
   #  - /dev/videoN:/dev/videoN # Mount GPU device
    ports:
      - 8096:8096
      - 7359:7359/udp
      - 8920:8920
    restart: unless-stopped

volumes:
  torrent-downloads:
  radarr-config:
  sonarr-config:
  jackett-config:
  jackett-blackhole:
  prowlarr-config:
  jellyfin-config:
  qbittorrent-config:
  tx-config:
  tx-watch:

networks:
  mynetwork:
    external: true
</code>```

Have you ever seen this problem?

Thank you for your attention.

Body:
I have a problem :)

I wanted to run a docker-compose for the first time.

But he got it wrong

It is this one:
https://github.com/navilg/media-stack

Here is my error message:

root@ubuntu:~/docker-compose/media-stack# docker-compose --profile stack-2 up -d
ERROR: The Compose file './docker-compose.yml' is invalid because:
'name' does not match any of the regexes: '^x-'

You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the services key, or omit the version key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

Here are my versions:

root@ubuntu:~/docker-compose/media-stack# docker version
Customer:
 Version: 20.10.16
 API version: 1.41
 Go version: go1.18.1
 Git commit: 20.10.16-0ubuntu1
 Built: Thu May 12 20:45:12 2022
 OS/Arch: linux/arm64
 Context: default
 Experimental: true

server:
 Engine:
  Version: 20.10.16
  API version: 1.41 (minimum version 1.12)
  Go version: go1.18.1
  Git commit: 20.10.16-0ubuntu1
  Built: Thu May 12 20:04:31 2022
  OS/Arch: linux/arm64
  Experimental: false
 containerd:
  Version: 1.6.4-0ubuntu1.1
  GitCommit:
 runc:
  Version: 1.1.2-0ubuntu1.1
  GitCommit:
 docker-init:
  Version: 0.19.0
  GitCommit:
root@ubuntu:~/docker-compose/media-stack# docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.7
OpenSSL version: OpenSSL 3.0.5 5 Jul 2022

I tried to change version on the docker-compose to version 1 or 2 and 3 but nothing works.

Here is the docker-compose:

version: "3.9"
name: media-stack
services:
  vpn:
  ## Read https://github.com/qdm12/gluetun/wiki for details on configuring VPN for different service providers.
    profiles: ["vpn", "stack-2"]
    container_name: vpn
    image: qmcgaw/gluetun:v3.32
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_SERVICE_PROVIDER=${VPN_SERVICE_PROVIDER:-nordvpn} # Valid values: nordvpn, expressvpn, protonvpn, surfshark or custom
      - OPENVPN_USER=${OPENVPN_USER:-""}
      - OPENVPN_PASSWORD=${OPENVPN_PASSWORD:-""}

      ## For list of server regions and countries, visit https://raw.githubusercontent.com/qdm12/gluetun/master/internal/storage/servers.json

      ## SERVER_REGIONS is required for NordVPN and Surfshark VPN. Comment SERVER_COUNTRIES if SERVER_REGIONS is used.
      - SERVER_REGIONS=${SERVER_REGIONS:-Switzerland}

      ## SERVER_COUNTRIES is required for ExpressVPN and ProtonVPN. Comment SERVER_REGIONS if SERVER_COUNTRIES is used.
      # - SERVER_COUNTRIES=${SERVER_COUNTRIES:-Netherlands}
      # - FREE_ONLY=on  # Valid with protonvpn only. on if using free service provided by protonvpn

      ## Enable below if VPN_SERVICE_PROVIDER=custom
      # - VPN_TYPE=openvpn # or wireguard.

      ## If VPN_TYPE is openvpn
      # - OPENVPN_CUSTOM_CONFIG=/gluetun/custom.conf

      ## If VPN_TYPE is wireguard. Replace below env variables as required.
      # - VPN_ENDPOINT_IP=1.2.3.4                                               # Replace with your wg endpoint ip or domain
      # - VPN_ENDPOINT_PORT=51820                                               # Replace with wg server port
      # - WIREGUARD_PUBLIC_KEY=wAUaJMhAq3NFutLHIdF8AN0B5WG8RndfQKLPTEDHal0=     # Replace with your wg public key
      # - WIREGUARD_PRIVATE_KEY=wOEI9rqqbDwnN8/Bpp22sVz48T71vJ4fYmFWujulwUU=    # Replace with your wg client private key
      # - WIREGUARD_PRESHARED_KEY=xOEI9rqqbDwnN8/Bpp22sVz48T71vJ4fYmFWujulwUU=  # Replaced with your wg pre-shared key
      # - WIREGUARD_ADDRESSES="10.64.222.21/32"                                 # Replace with wg address

    ## Enable volume if custom VPN_SERVICE_PROVIDER is used
    # volumes:
      # - /yourpath/yourconfig.conf:/gluetun/config.conf:ro

    networks:
      - mynetwork
    ports:
      # qbittorrent ports
      - 5080:5080
      - 6881:6881
      - 6881:6881/udp
      # prowlarr ports
      - 9696:9696
      # Transmission ports. Uncomment below if Transmission is used with VPN
      # - 9091:9091
      # - 51413:51413
      # - 51413:51413/udp
    restart: "unless-stopped"
  transmission:
    profiles: ["tx", "stack-1"]
    container_name: transmission
    image: lscr.io/linuxserver/transmission:3.00-r6
    networks:
      - mynetwork
    # network_mode: service:vpn # Uncomment this line if vpn is enabled
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
      - USER=admin
      - PASS=nimdatx

    ## Comment below ports if VPN is enabled.
    ports:
      - 9091:9091
      - 51413:51413
      - 51413:51413/udp
    volumes:
      - tx-config:/config
      - torrent-downloads:/downloads
      - tx-watch:/watch
    restart: "unless-stopped"

  ## Default credentials - Username: admin password: adminadmin ##
  ## Change password after install from UI --> Tools --> Options --> WebUI ##
  qbittorrent:
    container_name: qbittorrent
    profiles: ["qbt", "stack-2"]
    image: lscr.io/linuxserver/qbittorrent:4.5.0
    # Comment this if vpn is disabled
    depends_on:
      - vpn
    networks:
      - mynetwork
    network_mode: service:vpn # Comment this line if vpn is disabled
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
      - WEBUI_PORT=5080
    volumes:
      - qbittorrent-config:/config
      - torrent-downloads:/downloads

    ## Uncomment below ports if VPN is disabled.
    # ports:
    #   - 5080:5080
    #   - 6881:6881
    #   - 6881:6881/udp
    restart: "unless-stopped"
  radarr:
    profiles: ["base", "radarr", "stack-1", "stack-2"]
    container_name: radarr
    image: lscr.io/linuxserver/radarr:4.2.4
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    ports:
      - 7878:7878
    volumes:
      - radarr-config:/config
      - torrent-downloads:/downloads
    restart: "unless-stopped"

  sonarr:
    profiles: ["base", "sonarr", "stack-1", "stack-2"]
    image: lscr.io/linuxserver/sonarr:develop-version-4.0.0.269
    container_name: sonarr
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    volumes:
      - sonarr-config:/config
      - torrent-downloads:/downloads
    ports:
      - 8989:8989
    restart: unless-stopped

  jackett:
    profiles: ["jackett", "stack-1"]
    container_name: jackett
    image: lscr.io/linuxserver/jackett:v0.20.2309
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    volumes:
      - jackett-config:/config
      - jackett-blackhole:/downloads
    ports:
      - 9117:9117
    restart: unless-stopped

  prowlarr:
    profiles: ["prowlarr", "stack-2"]
    container_name: prowlarr
    image: linuxserver/prowlarr:0.4.9-develop
    # Comment this if vpn is disabled
    depends_on:
      - vpn
    network_mode: service:vpn # Comment this line if vpn is disabled
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    volumes:
      - prowlarr-config:/config
    ## Uncomment below ports if VPN is disabled.
    # ports:
    #   - 9696:9696
    restart: unless-stopped

  jellyfin:
    profiles: ["base", "jelly", "stack-1", "stack-2"]
    image: lscr.io/linuxserver/jellyfin:10.8.8
    container_name: jellyfin
    networks:
      - mynetwork
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
    volumes:
      - jellyfin-config:/config
      - torrent-downloads:/data
  # devices:
   #  - /dev/videoN:/dev/videoN # Mount GPU device
    ports:
      - 8096:8096
      - 7359:7359/udp
      - 8920:8920
    restart: unless-stopped

volumes:
  torrent-downloads:
  radarr-config:
  sonarr-config:
  jackett-config:
  jackett-blackhole:
  prowlarr-config:
  jellyfin-config:
  qbittorrent-config:
  tx-config:
  tx-watch:

networks:
  mynetwork:
    external: true

Have you ever seen this problem?

Thank you for your attention.


问:
WebRTC is not been working with Ios devices
I have created a webapplication with webRTC, my one to one calls are working fine, but those are not working in case of Ios Devices. Not sure how to make it work.

I have tried changing settings in safari -> experimental mode -> Multiple WebRTC settings and it didn't help either.

Can you please help me with any suggestion about this?

Thanks

I have tried changing settings in safari -> experimental mode -> Multiple WebRTC settings and it didn't help either.


问:
Intellij IDEA - how to override code style config
We have a Java project in small team, all developers use Intellij IDEA.

I need to setup code style so that

some settings (for example use tabs instead of spaces, import order, threshold for asterisk import etc.) are common for all developers, these settings are obligatory and versioned in Git

tab size setting is up to each developer since it affects only appearance on his screen and not source code. It should not be versioned. Technically it should override common setting (actually its value should not be among obligatory values at all).

How to achieve it?

My attempts:

I am aware of "Stored in Project" vs "Stored in IDE" configuration where the first one is recommended to be in VCS. However, if I define common settings as "Project" configuration, user can define custom "IDE" setting and activate it instead of the "Project" configuration, not on top of it.

We also have .editorconfig file in project root with some common settings. Since the file is versioned in Git there would be great to have something like .editorconfig-gitignored file with custom settings (or put .editorconfig one level down into each subfolder, which is clumsy)

Since Intellij Idea can override project settings with .editorconfig settings, it seems to be a solution to define common settings in Idea and custom setting in (newly gitignored) .editorconfig file. Unfortunately some properties in .editorconfig are mandatory as well so I feel it would be downgrade at this moment.


问:
how to transfer processing processing back to http worker threadpool from okhttp client?
I have a simple springboot web service ( using embedded tomcat ) that as part of a request calls another service using okhttp client async api . The issue is that the part of processing once the async call returns happens on the okhttp client thread only . Ideally I would want the remaining processing be happening on the http worker thread . I am using standard java 8 ( Completion stage ) . How to achieve this ? as I do not have access to the underlying tomcat threadpool/executorService .</p>


问:
Can I use multiple NLS_LANG in same sql loader?
I have a situation where my Oracle sql loader has to support 4 character sets. The loader script is common and loads files from multiple country sources, hence the requirement.

At the moment, the value of a field coming from file is 1àáâäåèéêëîïñóòôöùûüÿßçtecseven, and after the loader loads this file in the table, the value is seen  �������������tecseven

Now, I checked my env file and currently it has the following value set for parameter:

```<code>export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
</code>```

My question, how can I further add other NLS_LANG parameter values like
NLS_LANG=FRENCH_FRANCE.AL32UTF8, NLS_LANG=GERMAN_GERMANY.AL32UTF8 etc?

TIA.

how to upload special characters with sql loader

Body:
I have a situation where my Oracle sql loader has to support 4 character sets. The loader script is common and loads files from multiple country sources, hence the requirement.

At the moment, the value of a field coming from file is 1àáâäåèéêëîïñóòôöùûüÿßçtecseven, and after the loader loads this file in the table, the value is seen  �������������tecseven

Now, I checked my env file and currently it has the following value set for parameter:

export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

My question, how can I further add other NLS_LANG parameter values like
NLS_LANG=FRENCH_FRANCE.AL32UTF8, NLS_LANG=GERMAN_GERMANY.AL32UTF8 etc?

TIA.

how to upload special characters with sql loader


问:
How to kill supervisord if child process exited with non-zero status
I have 3 child proccesses in supervisord, one of them is java.

```<code>[program:sgw]
command=java -jar test.jar
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
autostart=true                ; start at supervisord start (default: true)
autorestart=unexpected        ; when to restart if exited after running (def: unexpected)
exitcodes=1
killasgroup=true
stopasgroup=true
stopsignal=TERM
startsec=0
</code>```

I want to stop the java process when it returns exit-code 1 and supervisord should not restart it, hence autorestart=unexpected and exitcodes=1

Now, How do I kill parent process, i.e. supervisord once java is exited. here is my event section.

```<code>[eventlistener:processes]
command=/bin/bash -c ". /etc/stop-supervisor.sh"
events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL, PROCESS_STATE_UNKNOWN, PROCESS_STATE_BACKOFF
</code>```

/etc/stop-supervisord.sh

```<code>#!/bin/bash

printf "READY\n";

while read line; do
  echo "Processing Event: $line" >&2;
  kill -3 $(cat "/data/logs/supervisord.pid")
done < /dev/stdin
</code>```

I see java is exited but supervisord is still running along with two other processes.

Body:
I have 3 child proccesses in supervisord, one of them is java.

[program:sgw]
command=java -jar test.jar
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
autostart=true                ; start at supervisord start (default: true)
autorestart=unexpected        ; when to restart if exited after running (def: unexpected)
exitcodes=1
killasgroup=true
stopasgroup=true
stopsignal=TERM
startsec=0

I want to stop the java process when it returns exit-code 1 and supervisord should not restart it, hence autorestart=unexpected and exitcodes=1

Now, How do I kill parent process, i.e. supervisord once java is exited. here is my event section.

[eventlistener:processes]
command=/bin/bash -c ". /etc/stop-supervisor.sh"
events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL, PROCESS_STATE_UNKNOWN, PROCESS_STATE_BACKOFF

/etc/stop-supervisord.sh

#!/bin/bash

printf "READY\n";

while read line; do
  echo "Processing Event: $line" >&2;
  kill -3 $(cat "/data/logs/supervisord.pid")
done < /dev/stdin

I see java is exited but supervisord is still running along with two other processes.


问:
asp.net vb socket works on first iteration only
I have a server used to get info from SAPGUI. Everything works fine for a first request but nothing after that. The first iteration waits for a socket event. Once the socket is read for the first time it just loops without reading the receive buffer.  I am assuming I need to reset the listener but am having trouble doing so.

'first iteration it works as expected but readbyte is always 0 after that even though it loops through fine.
'what I don't get is that the first iteration it waits for data to come down the socket, but after that it just loops
'and doesn't retreive anything.

Dim listenerSocket As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

Dim ipend As IPEndPoint = New IPEndPoint(IPAddress.Parse("127.0.0.1"), 8888)

listenerSocket.Bind(ipend)
listenerSocket.Listen(0)

Dim clientSocket As Socket = listenerSocket.Accept()
Dim Buffer As Byte() = New Byte(clientSocket.SendBufferSize - 1) {}
Dim readByte, sendByte As Integer
Dim Sbuffer As Byte() = System.Text.Encoding.ASCII.GetBytes("Some form of SAP response!")
Dim clientError As System.Net.Sockets.SocketError

Console.WriteLine("Waiting for connection : ")

For infinitecounter = 1 To 3
    infinitecounter = 1
    readByte = clientSocket.Receive(Buffer)

    While (True)
        If readByte > 0 Then
            Dim rData As Byte() = New Byte(readByte - 1) {}
            Array.Copy(Buffer, rData, readByte)

            SAPrq = System.Text.Encoding.UTF8.GetString(rData)
            SAPpar = Left(SAPrq, 1)

            SAPpar1 = InStr(SAPrq, "%")

            If SAPpar = 1 Then
                SAPnwk = Mid(SAPrq, 3)

                xy = Getbam(SAPnwk)' this is a function that talks to SAP and it works on first loop
            End If
End if
        End While

    Next
```

I tried adding setting infinitecounter = 2 before the next statement and adding an if statement to reset the listener but failed.

Body:
I have a server used to get info from SAPGUI. Everything works fine for a first request but nothing after that. The first iteration waits for a socket event. Once the socket is read for the first time it just loops without reading the receive buffer.  I am assuming I need to reset the listener but am having trouble doing so.

'first iteration it works as expected but readbyte is always 0 after that even though it loops through fine.
'what I don't get is that the first iteration it waits for data to come down the socket, but after that it just loops
'and doesn't retreive anything.

Dim listenerSocket As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

Dim ipend As IPEndPoint = New IPEndPoint(IPAddress.Parse("127.0.0.1"), 8888)

listenerSocket.Bind(ipend)
listenerSocket.Listen(0)

Dim clientSocket As Socket = listenerSocket.Accept()
Dim Buffer As Byte() = New Byte(clientSocket.SendBufferSize - 1) {}
Dim readByte, sendByte As Integer
Dim Sbuffer As Byte() = System.Text.Encoding.ASCII.GetBytes("Some form of SAP response!")
Dim clientError As System.Net.Sockets.SocketError

Console.WriteLine("Waiting for connection : ")

For infinitecounter = 1 To 3
    infinitecounter = 1
    readByte = clientSocket.Receive(Buffer)

    While (True)
        If readByte > 0 Then
            Dim rData As Byte() = New Byte(readByte - 1) {}
            Array.Copy(Buffer, rData, readByte)

            SAPrq = System.Text.Encoding.UTF8.GetString(rData)
            SAPpar = Left(SAPrq, 1)

            SAPpar1 = InStr(SAPrq, "%")

            If SAPpar = 1 Then
                SAPnwk = Mid(SAPrq, 3)

                xy = Getbam(SAPnwk)' this is a function that talks to SAP and it works on first loop
            End If
End if
        End While

    Next

I tried adding setting infinitecounter = 2 before the next statement and adding an if statement to reset the listener but failed.


问:
Using fetch in chrome extension popup.js return empty response object
Below is the code for the popup.js in my chrome extension v3
The parts I commented out are meant to extract previews (of the first few lines) for the respective queries, but when implemented, the search for the extension does not work at all (no errors though).

I tried logging into console to see what happened along the way, and noticed that even the response object did not register anything in the console, needless to say the HTML. Any clues, or perhaps there are better ways to generate the previews?

```<code>document.addEventListener("DOMContentLoaded", function () {
    // Select the search form and the search results container
    var form = document.getElementById("search-form");
    var container = document.getElementById("search-results");

    // Handle the submit event of the form
    form.addEventListener("submit", function (event) {
        event.preventDefault(); // Prevent the form from being submitted

        // Get the search title from the form
        var title = form.elements.title.value;
        var title2 = title.replace(/ /g, "+"); // Replace spaces with +
        var results = [];
        var queries = [
            {
                url: `https://www.ncbi.nlm.nih.gov/pmc/?term=${title}`,
                title: "NCBI PMC"
            },
            {
                url: `https://www.biorxiv.org/search/${title}`,
                title: "bioRxiv"
            },
            {
                url: `https://www.medrxiv.org/search/${title}`,
                title: "medRxiv"
            },
            {
                url: `https://www.google.com/search?q=${title2}+filetype:pdf`,
                title: "PDF Search"
            }
        ];
        queries.forEach(function (query) {
            fetch(query.url)
                .then(function (response) {
                    return response.text();
                    console.log(response);
                })
                // .then(function (html) {
                //     console.log(query.title);
                //     console.dir(html); // Inspect the properties of the html variable
                //     console.table(html); // View the contents of the html variable as a table
                //     // Parse the HTML using the DOMParser
                //     var parser = new DOMParser();
                //     var doc = parser.parseFromString(html, "text/html");
                //     // Extract the relevant information from the parsed HTML
                //     var title = doc.querySelector("title").innerText;
                //     var lines = [];
                //     var paragraphs = doc.querySelectorAll("p");
                //     for (var i = 0; i < paragraphs.length; i++) {
                //         lines.push(paragraphs[i].innerText);
                //         if (lines.length === 5) {
                //             break; // Break the loop
                //         }
                //     }
                    results.push({
                        title: query.title,
                        url: query.url,
                        // preview: lines.join("\n")
                    });
                // });
        });

        // Create the search results HTML
        var resultsHTML = "";
        results.forEach(function (result) {
            resultsHTML += `<div class="result">
        <h2><a href="#" data-url="${result.url}">${result.title}</a></h2>
        <p>${result.preview}</p>
      </div>`;
        });

        // Update the container with the search results HTML
        container.innerHTML = resultsHTML;

        // Handle the click event of the result links
        container.addEventListener("click", function (event) {
            var target = event.target;
            if (target.tagName === "A") {
                // Open the URL in a new tab and bring it to the front
                var url = target.dataset.url;
                var tab = window.open(url, "_blank");
                tab.focus();
            }
        });
    });
});```

```

Body:
Below is the code for the popup.js in my chrome extension v3
The parts I commented out are meant to extract previews (of the first few lines) for the respective queries, but when implemented, the search for the extension does not work at all (no errors though).

I tried logging into console to see what happened along the way, and noticed that even the response object did not register anything in the console, needless to say the HTML. Any clues, or perhaps there are better ways to generate the previews?

document.addEventListener("DOMContentLoaded", function () {
    // Select the search form and the search results container
    var form = document.getElementById("search-form");
    var container = document.getElementById("search-results");

    // Handle the submit event of the form
    form.addEventListener("submit", function (event) {
        event.preventDefault(); // Prevent the form from being submitted

        // Get the search title from the form
        var title = form.elements.title.value;
        var title2 = title.replace(/ /g, "+"); // Replace spaces with +
        var results = [];
        var queries = [
            {
                url: `https://www.ncbi.nlm.nih.gov/pmc/?term=${title}`,
                title: "NCBI PMC"
            },
            {
                url: `https://www.biorxiv.org/search/${title}`,
                title: "bioRxiv"
            },
            {
                url: `https://www.medrxiv.org/search/${title}`,
                title: "medRxiv"
            },
            {
                url: `https://www.google.com/search?q=${title2}+filetype:pdf`,
                title: "PDF Search"
            }
        ];
        queries.forEach(function (query) {
            fetch(query.url)
                .then(function (response) {
                    return response.text();
                    console.log(response);
                })
                // .then(function (html) {
                //     console.log(query.title);
                //     console.dir(html); // Inspect the properties of the html variable
                //     console.table(html); // View the contents of the html variable as a table
                //     // Parse the HTML using the DOMParser
                //     var parser = new DOMParser();
                //     var doc = parser.parseFromString(html, "text/html");
                //     // Extract the relevant information from the parsed HTML
                //     var title = doc.querySelector("title").innerText;
                //     var lines = [];
                //     var paragraphs = doc.querySelectorAll("p");
                //     for (var i = 0; i < paragraphs.length; i++) {
                //         lines.push(paragraphs[i].innerText);
                //         if (lines.length === 5) {
                //             break; // Break the loop
                //         }
                //     }
                    results.push({
                        title: query.title,
                        url: query.url,
                        // preview: lines.join("\n")
                    });
                // });
        });

        // Create the search results HTML
        var resultsHTML = "";
        results.forEach(function (result) {
            resultsHTML += `

${result.title}

${result.preview}

`;
        });

        // Update the container with the search results HTML
        container.innerHTML = resultsHTML;

        // Handle the click event of the result links
        container.addEventListener("click", function (event) {
            var target = event.target;
            if (target.tagName === "A") {
                // Open the URL in a new tab and bring it to the front
                var url = target.dataset.url;
                var tab = window.open(url, "_blank");
                tab.focus();
            }
        });
    });
});```


问:
Relative path for prisma generator provider
I have a custom prisma generator inside my nodejs project.
The problem is, that the provider field for the generator is relative. I can't publish it as package.
I will call the the generator from different places based on context (ci pipeline, testing, development, etc)

Example:

```<code>generator nexus {
  provider = "node ../modules/prisma-generator-custom"
  output   = "./generated"
}
</code>```

Since Prisma supports bash to some degree, I tried using $BASH_SOURCE[0] for accessing a full path, but it is always relative to the path I am calling from, not the directory of the file.

Thank you for any ideas.

Body:
I have a custom prisma generator inside my nodejs project.
The problem is, that the provider field for the generator is relative. I can't publish it as package.
I will call the the generator from different places based on context (ci pipeline, testing, development, etc)

Example:

generator nexus {
  provider = "node ../modules/prisma-generator-custom"
  output   = "./generated"
}

Since Prisma supports bash to some degree, I tried using $BASH_SOURCE[0] for accessing a full path, but it is always relative to the path I am calling from, not the directory of the file.

Thank you for any ideas.