问:
Prophet cross_validation method stops unexepectedly #2319
We are currently facing a problem with a Prophet model which stops unexpectedly. We've used optuna as our HyperParameter model searching framework, and gave 400 trials per each TimeSeries (we are traininig Prophet on ~ 1000 Timeseries, 1 by 1, not all at once). For cross validation, we've used the methode from the Prophet class called cross_validation.

Here is the code we've used:

```<code>def get_best_hp_prophet_cv(df_for_cv, weeks_to_forecast):
    logging.getLogger('prophet').setLevel(logging.ERROR)
    logging.getLogger('fbprophet').setLevel(logging.ERROR)

    # print('DF entered for search: ', df_for_cv)
    cutoffs = generate_cutoffs(df_for_cv, weeks_to_forecast)

    def objective(trial):

        # print(cutoffs)

        # print(df.tail(30))
        param_grid = {
        "changepoint_prior_scale": trial.suggest_categorical(
            "changepoint_prior_scale", [0.001, 0.01, 0.1, 0.5, 0.05, 0.8, 0.9]
        ),
        "seasonality_prior_scale": trial.suggest_categorical(
            "seasonality_prior_scale", [0.01, 0.05, 0.1, 0.5, 1.0, 10]
        ),
        "seasonality_mode": trial.suggest_categorical(
            "seasonality_mode", ["multiplicative", "additive"]
        ),
        "growth": trial.suggest_categorical("growth", ["linear"]),
        "yearly_seasonality": trial.suggest_categorical(
            "yearly_seasonality", [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16]
        ),
        "daily_seasonality": trial.suggest_categorical("daily_seasonality",[False]),
        "weekly_seasonality": trial.suggest_categorical("weekly_seasonality",[False]),
        "uncertainty_samples": trial.suggest_categorical("uncertainty_samples",[0]),

    }

        prior_scale_month = trial.suggest_categorical('prior_scale_month', [0.001, 0.01, 0.1, 0.5, 0.05, 0.9])
        prior_scale_week_num = trial.suggest_categorical('prior_scale_week_num', [0.001, 0.01, 0.1, 0.5, 0.05, 0.9])
        prior_scale_avg_month_qty_over_df = trial.suggest_categorical('prior_scale_avg_month_qty_over_df', [0.001, 0.01, 0.1, 0.5, 0.05, 0.9])
        prior_scale_avg_week_nr_qty_over_df = trial.suggest_categorical('prior_scale_avg_week_nr_qty_over_df', [0.001, 0.01, 0.1, 0.5, 0.05, 0.9])

        # I ve used this only for testing to see if everything works fine
        # param_grid = {
        # 'changepoint_prior_scale': trial.suggest_categorical('changepoint_prior_scale', [0.001]),
        # 'seasonality_prior_scale': trial.suggest_categorical('seasonality_prior_scale',[0.01, 0.1]),
        # 'seasonality_mode' : trial.suggest_categorical('seasonality_mode',['additive']),
        # 'growth': trial.suggest_categorical('growth',['linear']),
        # 'yearly_seasonality': trial.suggest_categorical('yearly_seasonality',[14,15]),
        # 'holidays_prior_scale' : trial.suggest_categorical('holidays_prior_scale',[10])
        # }

        # all_params = [dict(zip(param_grid.keys(), v)) for v in itertools.product(*param_grid.values())]
        # mses = []  # Store the MSEs for each params here

        # Use cross validation to evaluate all parameters
        # for params in all_params:
        m = Prophet(**param_grid)
        m.add_regressor('month', prior_scale = prior_scale_month)
        m.add_regressor('week_num', prior_scale = prior_scale_week_num)
        m.add_regressor('avg_month_qty_over_df', prior_scale = prior_scale_avg_month_qty_over_df)
        m.add_regressor('avg_week_nr_qty_over_df', prior_scale = prior_scale_avg_week_nr_qty_over_df)

        m.fit(df_for_cv)
        df_cv = cross_validation(
            m, cutoffs=cutoffs, horizon="{} days".format(weeks_to_forecast*7), parallel="processes"
        )
        df_p = performance_metrics(df_cv, rolling_window=1)
        return df_p["mse"].values[0]

    # Find the best parameters
    optuna_prophet = optuna.create_study(
        direction="minimize", sampler=TPESampler(seed=321)
    )

    # * n_trials optuna hyperparameter.
    #optuna_prophet.optimize(objective, n_trials=400)
    optuna_prophet.optimize(objective, n_trials=1)

    prophet_trial = optuna_prophet.best_trial
    prophet_trial_params = prophet_trial.params

    list_of_variables_outside_the_param_grid = ['prior_scale_month','prior_scale_week_num','prior_scale_avg_month_qty_over_df','prior_scale_avg_week_nr_qty_over_df']

    params_outside_the_param_grid={}
    param_grid = {}
    for param_name in prophet_trial_params.keys():
        if param_name in list_of_variables_outside_the_param_grid:
            params_outside_the_param_grid.update({param_name : prophet_trial_params[param_name]})
        else:
            param_grid.update({param_name : prophet_trial_params[param_name]})

    return param_grid, params_outside_the_param_grid
</code>```

We've used Prophet before, but on less Timeseries (around 20) and with even more nr_of_trials in Optuna and never faced this issue before. Does anybody knows why is this happening? Has anybody a workaround? It always stops at the begging of the 54 trial from Optuna Search.

We've tried to run with only 1 trial on all 1000 Timeseries and it worked end - 2 - end, but still we can't figure it out why it stops on the 54th trial ?

Versions:

Optuna ---- 3.0.3.

Prophet ---- 1.1

Body:
We are currently facing a problem with a Prophet model which stops unexpectedly. We've used optuna as our HyperParameter model searching framework, and gave 400 trials per each TimeSeries (we are traininig Prophet on ~ 1000 Timeseries, 1 by 1, not all at once). For cross validation, we've used the methode from the Prophet class called cross_validation.

Here is the code we've used:

def get_best_hp_prophet_cv(df_for_cv, weeks_to_forecast):
    logging.getLogger('prophet').setLevel(logging.ERROR)
    logging.getLogger('fbprophet').setLevel(logging.ERROR)

    # print('DF entered for search: ', df_for_cv)
    cutoffs = generate_cutoffs(df_for_cv, weeks_to_forecast)

    def objective(trial):

        # print(cutoffs)

        # print(df.tail(30))
        param_grid = {
        "changepoint_prior_scale": trial.suggest_categorical(
            "changepoint_prior_scale", [0.001, 0.01, 0.1, 0.5, 0.05, 0.8, 0.9]
        ),
        "seasonality_prior_scale": trial.suggest_categorical(
            "seasonality_prior_scale", [0.01, 0.05, 0.1, 0.5, 1.0, 10]
        ),
        "seasonality_mode": trial.suggest_categorical(
            "seasonality_mode", ["multiplicative", "additive"]
        ),
        "growth": trial.suggest_categorical("growth", ["linear"]),
        "yearly_seasonality": trial.suggest_categorical(
            "yearly_seasonality", [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16]
        ),
        "daily_seasonality": trial.suggest_categorical("daily_seasonality",[False]),
        "weekly_seasonality": trial.suggest_categorical("weekly_seasonality",[False]),
        "uncertainty_samples": trial.suggest_categorical("uncertainty_samples",[0]),

    }

        prior_scale_month = trial.suggest_categorical('prior_scale_month', [0.001, 0.01, 0.1, 0.5, 0.05, 0.9])
        prior_scale_week_num = trial.suggest_categorical('prior_scale_week_num', [0.001, 0.01, 0.1, 0.5, 0.05, 0.9])
        prior_scale_avg_month_qty_over_df = trial.suggest_categorical('prior_scale_avg_month_qty_over_df', [0.001, 0.01, 0.1, 0.5, 0.05, 0.9])
        prior_scale_avg_week_nr_qty_over_df = trial.suggest_categorical('prior_scale_avg_week_nr_qty_over_df', [0.001, 0.01, 0.1, 0.5, 0.05, 0.9])

        # I ve used this only for testing to see if everything works fine
        # param_grid = {
        # 'changepoint_prior_scale': trial.suggest_categorical('changepoint_prior_scale', [0.001]),
        # 'seasonality_prior_scale': trial.suggest_categorical('seasonality_prior_scale',[0.01, 0.1]),
        # 'seasonality_mode' : trial.suggest_categorical('seasonality_mode',['additive']),
        # 'growth': trial.suggest_categorical('growth',['linear']),
        # 'yearly_seasonality': trial.suggest_categorical('yearly_seasonality',[14,15]),
        # 'holidays_prior_scale' : trial.suggest_categorical('holidays_prior_scale',[10])
        # }

        # all_params = [dict(zip(param_grid.keys(), v)) for v in itertools.product(*param_grid.values())]
        # mses = []  # Store the MSEs for each params here

        # Use cross validation to evaluate all parameters
        # for params in all_params:
        m = Prophet(**param_grid)
        m.add_regressor('month', prior_scale = prior_scale_month)
        m.add_regressor('week_num', prior_scale = prior_scale_week_num)
        m.add_regressor('avg_month_qty_over_df', prior_scale = prior_scale_avg_month_qty_over_df)
        m.add_regressor('avg_week_nr_qty_over_df', prior_scale = prior_scale_avg_week_nr_qty_over_df)

        m.fit(df_for_cv)
        df_cv = cross_validation(
            m, cutoffs=cutoffs, horizon="{} days".format(weeks_to_forecast*7), parallel="processes"
        )
        df_p = performance_metrics(df_cv, rolling_window=1)
        return df_p["mse"].values[0]

    # Find the best parameters
    optuna_prophet = optuna.create_study(
        direction="minimize", sampler=TPESampler(seed=321)
    )

    # * n_trials optuna hyperparameter.
    #optuna_prophet.optimize(objective, n_trials=400)
    optuna_prophet.optimize(objective, n_trials=1)

    prophet_trial = optuna_prophet.best_trial
    prophet_trial_params = prophet_trial.params

    list_of_variables_outside_the_param_grid = ['prior_scale_month','prior_scale_week_num','prior_scale_avg_month_qty_over_df','prior_scale_avg_week_nr_qty_over_df']

    params_outside_the_param_grid={}
    param_grid = {}
    for param_name in prophet_trial_params.keys():
        if param_name in list_of_variables_outside_the_param_grid:
            params_outside_the_param_grid.update({param_name : prophet_trial_params[param_name]})
        else:
            param_grid.update({param_name : prophet_trial_params[param_name]})

    return param_grid, params_outside_the_param_grid

We've used Prophet before, but on less Timeseries (around 20) and with even more nr_of_trials in Optuna and never faced this issue before. Does anybody knows why is this happening? Has anybody a workaround? It always stops at the begging of the 54 trial from Optuna Search.

We've tried to run with only 1 trial on all 1000 Timeseries and it worked end - 2 - end, but still we can't figure it out why it stops on the 54th trial ?

Versions:

Optuna ---- 3.0.3.

Prophet ---- 1.1


来源: stackexchange

问:
NodeJS with MS-SQL
In NodeJs with MS-SQL, I want to retrieve two three table data in the form of array of objects

Hello there my name is Shaziya, please help me out (●´⌓`●)
Actually i have done NodeJs from YouTube,

I want learn NodeJS with MS-SQL, do you or any friends have such course for Advance understanding,

Like how to connect 4 5 tables and show data in array of objects format

How to make nested query or subquires like...

I mean if wanna do table match with two table product and order

Product ID with Order table by matching product ID

```<code>data {
productId : 1:
productName : "abc",
[{
orderId : 1
orderName : "xyz"
},
{
orderId : 2
orderName : "pqr"
}
]
}
</code>```

At least i got some course or solution for that where i stuck

ContentLicense: CC BY-SA 4.0

Title: NodeJS with MS-SQL

Body:
In NodeJs with MS-SQL, I want to retrieve two three table data in the form of array of objects

Hello there my name is Shaziya, please help me out (●´⌓`●)
Actually i have done NodeJs from YouTube,

I want learn NodeJS with MS-SQL, do you or any friends have such course for Advance understanding,

Like how to connect 4 5 tables and show data in array of objects format

How to make nested query or subquires like...

I mean if wanna do table match with two table product and order

Product ID with Order table by matching product ID

data {
productId : 1:
productName : "abc",
[{
orderId : 1
orderName : "xyz"
},
{
orderId : 2
orderName : "pqr"
}
]
}

At least i got some course or solution for that where i stuck


问:
Having a problem displaying the correct value in the edit workorder QComboBox
I am trying to set the current value of the order_type_combo QComboBox 29: 'Complaint: Damage caused by sewer blockages' instead I'm getting a default value 2: 'Complaint: Sewerage Blockage'. These values are created in a table t_wo_workorders which uses another table wo_type as a dropdown.

Here is my code:

```<code>from PyQt5 import QtWidgets, QtGui
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QLineEdit, QVBoxLayout, QDateEdit, QComboBox, QStyleFactory, QTableView, QMessageBox, QSizePolicy, QTextEdit
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont, QStandardItemModel, QStandardItem, QPalette
import psycopg2
import datetime
from PyQt5.QtCore import QDate
from PyQt5.QtWidgets import QDateEdit
from PyQt5.QtCore import QTimer

current_date = QDate.currentDate()

# Connect to the database and create a cursor object
conn = psycopg2.connect(
    host="localhost",
    database="mms",
    user="postgres",
    password="postgres"
)
cur = conn.cursor()

# Retrieve the last work order from the t_wo_workorders table
cur.execute("SELECT * FROM t_wo_workorders ORDER BY order_id DESC LIMIT 1")
work_order = cur.fetchone()

# Extract the values for each field in the work order
work_order_id = work_order[0]
defined = work_order[1]
org = work_order[2]
order_type = work_order[3]
scheduled = work_order[4]
status = work_order[5]
request = work_order[6]
address = work_order[7]
customer = work_order[8]
tel_no = work_order[9]

class EditWorkOrderForm(QWidget):

    def populate_org_combo(self):
        self.cur.execute("SELECT org_unit, id FROM org_units")
        org_units = self.cur.fetchall()
        for org_unit in org_units:
            self.org_combo.addItem(str(org_unit[0]))
            self.org_units_dict[org_unit[1]] = org_unit[0]

    def populate_order_type_combo(self, order_type):
        self.order_type = order_type
        # Retrieve the wo_type records from the database
        self.cur.execute("SELECT type_description_en, id FROM wo_type")
        wo_type = self.cur.fetchall()

        # Create a dictionary with the id values as keys and the type_description_en values as values
        self.order_types_dict = {}
        for id, type_description_en in wo_type:
            self.order_types_dict[id] = type_description_en
            self.order_type_combo.addItem(str(type_description_en))

        # Check if the order_type value is present in the order_types_dict dictionary
        if self.order_type not in self.order_types_dict:
            print("Error: Invalid order type")
            return

        # Get the index of the order_type value in the order_types_dict keys and set the combo box's current index to that value
        default_index = list(self.order_types_dict.keys()).index(self.order_type)
        self.order_type_combo.setCurrentIndex(default_index)

    def populate_status_combo(self):
        self.cur.execute("SELECT status_descr_en, id FROM wo_status")
        wo_status = self.cur.fetchall()
        for status in wo_status:
            self.status_combo.addItem(str(status[0]))
            self.status_dict[status[1]] = status[0]

    def __init__(self, conn, cur, order_id, defined, org, order_type, scheduled, status, request, address, customer, tel_no):
        super().__init__()
        self.cur = cur  # Assign the cur parameter to the self.cur attribute
        self.order_types_dict = {}
        self.order_type_combo = QComboBox(self)
        self.populate_order_type_combo(order_type)

        print(order_type)
        self.conn = conn
        self.org_units_dict = {}
        self.status_dict = {}
        self.order_id = order_id
        self.org_combo = QComboBox(self)
        self.populate_org_combo()
        if str(org) in self.org_units_dict:
            org_value = self.org_units_dict[int(org)]
        else:
            org_value = ""
        try:
            org_value = self.org_units_dict[int(org)]
        except KeyError:
            pass
        org_index = self.org_combo.findText(org_value)
        order_type_value = [v for k, v in self.order_types_dict.items() if k == order_type]
        if order_type_value:
            order_type_value = order_type_value[0]
        else:
            order_type_value = ""
        order_type_index = self.order_type_combo.findText(order_type_value)
        self.order_type_combo.setCurrentIndex(order_type_index)
        self.status_combo = QComboBox(self)
        self.populate_status_combo()
        conn = psycopg2.connect(
            host="localhost",
            database="mms",
            user="postgres",
            password="postgres"
        )

        self.cur.execute(
            "SELECT * FROM t_wo_workorders WHERE order_id = %s",
            (self.order_id,)
        )
        work_order = self.cur.fetchone()
        self.defined_label = QLabel("Defined:")
        self.defined_edit = QDateEdit()
        self.defined_edit.setDate(defined)

        self.org_label = QLabel("Org. Unit:")
        self.org_combo.setGeometry(100, 100, 200, 25)
        self.org_combo.setCurrentIndex(int(org))
        self.org_combo.setCurrentIndex(org_index)

        self.order_type_label = QLabel("Order Type:")
        self.order_type_combo.setGeometry(100, 100, 200, 25)
        self.order_type_combo.setCurrentIndex(int(order_type))
        self.order_type_combo.setCurrentIndex(order_type_index)

        self.scheduled_label = QLabel("Scheduled:")
        self.scheduled_edit = QDateEdit()
        self.scheduled_edit.setDate(scheduled)
        self.status_label = QLabel("Status:")
        self.status_combo = QComboBox()
        self.order_type_combo.setCurrentIndex(int(status))
        status_value = self.status_dict.get(org, "")
        status_index = self.status_combo.findText(status_value)
        self.request_label = QLabel("Request:")
        self.request_edit = QLineEdit()
        self.request_edit.setText(request)
        self.address_label = QLabel("Address:")
        self.address_edit = QLineEdit()
        self.address_edit.setText(address)
        self.customer_label = QLabel("Customer:")
        self.customer_edit = QLineEdit()
        self.customer_edit.setText(customer)
        self.tel_no_label = QLabel("Tel. No:")
        self.tel_no_edit = QLineEdit()
        self.tel_no_edit.setText(tel_no)
        self.request_gps_label = QLabel("Request GPS:")

        layout = QVBoxLayout()
        layout.addWidget(self.defined_label)
        layout.addWidget(self.defined_edit)
        layout.addWidget(self.org_label)
        layout.addWidget(self.org_combo)
        layout.addWidget(self.order_type_label)
        layout.addWidget(self.order_type_combo)
        layout.addWidget(self.scheduled_label)
        layout.addWidget(self.scheduled_edit)
        layout.addWidget(self.status_label)
        layout.addWidget(self.status_combo)
        layout.addWidget(self.request_label)
        layout.addWidget(self.request_edit)
        layout.addWidget(self.address_label)
        layout.addWidget(self.address_edit)
        layout.addWidget(self.customer_label)
        layout.addWidget(self.customer_edit)
        layout.addWidget(self.tel_no_label)
        layout.addWidget(self.tel_no_edit)
        layout.addWidget(self.request_gps_label)

        self.setLayout(layout)
        self.show()

        def edit_work_order(self, work_order_id):
            form = EditWorkOrderForm(work_order_id)
            form.show()

        def create_edit_work_order_form(work_order_id, defined, org, order_type, scheduled, status, request, address, customer, tel_no):
            form = EditWorkOrderForm(conn, cur, work_order_id, defined, org, order_type, scheduled, status, request, address, customer, tel_no)
            return form

app = QApplication(sys.argv)
edit_work_order_form = EditWorkOrderForm(conn, cur, work_order_id, defined, org, order_type, scheduled, status, request, address, customer, tel_no)
edit_work_order_form.show()
sys.exit(app.exec_())
</code>```

and this is what it prints:

```<code>Error: Invalid order type
3
[Finished in 5.3s]
</code>```

Body:
I am trying to set the current value of the order_type_combo QComboBox 29: 'Complaint: Damage caused by sewer blockages' instead I'm getting a default value 2: 'Complaint: Sewerage Blockage'. These values are created in a table t_wo_workorders which uses another table wo_type as a dropdown.

Here is my code:

from PyQt5 import QtWidgets, QtGui
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QLineEdit, QVBoxLayout, QDateEdit, QComboBox, QStyleFactory, QTableView, QMessageBox, QSizePolicy, QTextEdit
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont, QStandardItemModel, QStandardItem, QPalette
import psycopg2
import datetime
from PyQt5.QtCore import QDate
from PyQt5.QtWidgets import QDateEdit
from PyQt5.QtCore import QTimer

current_date = QDate.currentDate()

# Connect to the database and create a cursor object
conn = psycopg2.connect(
    host="localhost",
    database="mms",
    user="postgres",
    password="postgres"
)
cur = conn.cursor()

# Retrieve the last work order from the t_wo_workorders table
cur.execute("SELECT * FROM t_wo_workorders ORDER BY order_id DESC LIMIT 1")
work_order = cur.fetchone()

# Extract the values for each field in the work order
work_order_id = work_order[0]
defined = work_order[1]
org = work_order[2]
order_type = work_order[3]
scheduled = work_order[4]
status = work_order[5]
request = work_order[6]
address = work_order[7]
customer = work_order[8]
tel_no = work_order[9]

class EditWorkOrderForm(QWidget):

    def populate_org_combo(self):
        self.cur.execute("SELECT org_unit, id FROM org_units")
        org_units = self.cur.fetchall()
        for org_unit in org_units:
            self.org_combo.addItem(str(org_unit[0]))
            self.org_units_dict[org_unit[1]] = org_unit[0]

    def populate_order_type_combo(self, order_type):
        self.order_type = order_type
        # Retrieve the wo_type records from the database
        self.cur.execute("SELECT type_description_en, id FROM wo_type")
        wo_type = self.cur.fetchall()

        # Create a dictionary with the id values as keys and the type_description_en values as values
        self.order_types_dict = {}
        for id, type_description_en in wo_type:
            self.order_types_dict[id] = type_description_en
            self.order_type_combo.addItem(str(type_description_en))

        # Check if the order_type value is present in the order_types_dict dictionary
        if self.order_type not in self.order_types_dict:
            print("Error: Invalid order type")
            return

        # Get the index of the order_type value in the order_types_dict keys and set the combo box's current index to that value
        default_index = list(self.order_types_dict.keys()).index(self.order_type)
        self.order_type_combo.setCurrentIndex(default_index)

    def populate_status_combo(self):
        self.cur.execute("SELECT status_descr_en, id FROM wo_status")
        wo_status = self.cur.fetchall()
        for status in wo_status:
            self.status_combo.addItem(str(status[0]))
            self.status_dict[status[1]] = status[0]

    def __init__(self, conn, cur, order_id, defined, org, order_type, scheduled, status, request, address, customer, tel_no):
        super().__init__()
        self.cur = cur  # Assign the cur parameter to the self.cur attribute
        self.order_types_dict = {}
        self.order_type_combo = QComboBox(self)
        self.populate_order_type_combo(order_type)

        print(order_type)
        self.conn = conn
        self.org_units_dict = {}
        self.status_dict = {}
        self.order_id = order_id
        self.org_combo = QComboBox(self)
        self.populate_org_combo()
        if str(org) in self.org_units_dict:
            org_value = self.org_units_dict[int(org)]
        else:
            org_value = ""
        try:
            org_value = self.org_units_dict[int(org)]
        except KeyError:
            pass
        org_index = self.org_combo.findText(org_value)
        order_type_value = [v for k, v in self.order_types_dict.items() if k == order_type]
        if order_type_value:
            order_type_value = order_type_value[0]
        else:
            order_type_value = ""
        order_type_index = self.order_type_combo.findText(order_type_value)
        self.order_type_combo.setCurrentIndex(order_type_index)
        self.status_combo = QComboBox(self)
        self.populate_status_combo()
        conn = psycopg2.connect(
            host="localhost",
            database="mms",
            user="postgres",
            password="postgres"
        )

        self.cur.execute(
            "SELECT * FROM t_wo_workorders WHERE order_id = %s",
            (self.order_id,)
        )
        work_order = self.cur.fetchone()
        self.defined_label = QLabel("Defined:")
        self.defined_edit = QDateEdit()
        self.defined_edit.setDate(defined)

        self.org_label = QLabel("Org. Unit:")
        self.org_combo.setGeometry(100, 100, 200, 25)
        self.org_combo.setCurrentIndex(int(org))
        self.org_combo.setCurrentIndex(org_index)

        self.order_type_label = QLabel("Order Type:")
        self.order_type_combo.setGeometry(100, 100, 200, 25)
        self.order_type_combo.setCurrentIndex(int(order_type))
        self.order_type_combo.setCurrentIndex(order_type_index)

        self.scheduled_label = QLabel("Scheduled:")
        self.scheduled_edit = QDateEdit()
        self.scheduled_edit.setDate(scheduled)
        self.status_label = QLabel("Status:")
        self.status_combo = QComboBox()
        self.order_type_combo.setCurrentIndex(int(status))
        status_value = self.status_dict.get(org, "")
        status_index = self.status_combo.findText(status_value)
        self.request_label = QLabel("Request:")
        self.request_edit = QLineEdit()
        self.request_edit.setText(request)
        self.address_label = QLabel("Address:")
        self.address_edit = QLineEdit()
        self.address_edit.setText(address)
        self.customer_label = QLabel("Customer:")
        self.customer_edit = QLineEdit()
        self.customer_edit.setText(customer)
        self.tel_no_label = QLabel("Tel. No:")
        self.tel_no_edit = QLineEdit()
        self.tel_no_edit.setText(tel_no)
        self.request_gps_label = QLabel("Request GPS:")

        layout = QVBoxLayout()
        layout.addWidget(self.defined_label)
        layout.addWidget(self.defined_edit)
        layout.addWidget(self.org_label)
        layout.addWidget(self.org_combo)
        layout.addWidget(self.order_type_label)
        layout.addWidget(self.order_type_combo)
        layout.addWidget(self.scheduled_label)
        layout.addWidget(self.scheduled_edit)
        layout.addWidget(self.status_label)
        layout.addWidget(self.status_combo)
        layout.addWidget(self.request_label)
        layout.addWidget(self.request_edit)
        layout.addWidget(self.address_label)
        layout.addWidget(self.address_edit)
        layout.addWidget(self.customer_label)
        layout.addWidget(self.customer_edit)
        layout.addWidget(self.tel_no_label)
        layout.addWidget(self.tel_no_edit)
        layout.addWidget(self.request_gps_label)

        self.setLayout(layout)
        self.show()

        def edit_work_order(self, work_order_id):
            form = EditWorkOrderForm(work_order_id)
            form.show()

        def create_edit_work_order_form(work_order_id, defined, org, order_type, scheduled, status, request, address, customer, tel_no):
            form = EditWorkOrderForm(conn, cur, work_order_id, defined, org, order_type, scheduled, status, request, address, customer, tel_no)
            return form

app = QApplication(sys.argv)
edit_work_order_form = EditWorkOrderForm(conn, cur, work_order_id, defined, org, order_type, scheduled, status, request, address, customer, tel_no)
edit_work_order_form.show()
sys.exit(app.exec_())

and this is what it prints:

Error: Invalid order type
3
[Finished in 5.3s]


问:
How to create an Angular Material Date Range Picker where only years are selectable?
I'm using mat-date-range-picker and I want the user to be able to select only the start-year and the end-year.

I looked in the documentation for the date-picker and reused the method that is provided there, but I could not find a way to reopen the popup for the second date.

My code reads as follows:

```<code><mat-datepicker #dp
                  startView="multi-year"
                  (yearSelected)="chosenYearHandler($event)"
                  panelClass="example-month-picker">
</mat-datepicker>
</code>```

How can I create Date Range Picker where only years are selectable?

Body:
I'm using mat-date-range-picker and I want the user to be able to select only the start-year and the end-year.

I looked in the documentation for the date-picker and reused the method that is provided there, but I could not find a way to reopen the popup for the second date.

My code reads as follows:

<mat-datepicker #dp
                  startView="multi-year"
                  (yearSelected)="chosenYearHandler($event)"
                  panelClass="example-month-picker">
</mat-datepicker>

How can I create Date Range Picker where only years are selectable?


问:
VPN disconnects when removing from recent apps on Xiaomi devices
In my case I implemented CakeVpn (https://github.com/ashraf789/Cake-VPN) application as second module of project.

In original version from google play there's no problem with removing from recent.

And there's a problem on Xiaomi devices with my app that removing from recent apps causing VPN disconnect.

OnStartCommand is same with the original version

How can it be fixed?


问:
Automatically save JUnit test report in IntelliJ TestRunner XML / HTML format as a gradle task
I am currently running a huge bunch of JUnit tests on various Android devices using a standard gradle Android project, that was generated by Android Studio IDE (IntelliJ).

The tests are working fine and also the default JUnit reports in XML + HTML are being generated.

My problem with the generated report outputs: The standard outputs and the error outputs of all individual test are each being merged into two huge blobs.

However, I also noticed, that the test runner window has an option to export the Unit test results in its own XML and HTML export results.

And those exported versions of the JUnit reports do have separated outputs for the standard and error streams for each test.

I would like to know, if there is any available Gradle task or special already implemented TestRunner, that provides me with the same output, so I can generate those outputs automatically without manually doing those exports via the IDE 'Test runner' window.

My tests will be continuously run on a remote server with multiple attached Android devices with no supervision.

It would be awesome to have all test reports in the 'Test runner' XML + HTML versions, so someone can have a look at those outputs later on from the IDE itself (via the 'Import Tests from File...' feature) or in some browser.

I do have the default JUnit test report outputs, that are not helpful for later error analysis.

I did not attempt to write my own Runner implementation, that would mimic the IntelliJ XML output format, because it would be a maintainance horror to keep the output consistent to future IntelliJ updates.

I just hope for some hidden IntelliJ gradle task or some incubating gradle api, that just solves my problem.


问:
'jspdf-html2canvas' safari font issue post deployment
I have used jspdf-html2canvas package in Angular 10 project for PDF download. Post deployment in safari browser the downloaded pdf bold font is not rendering proper. Also some of the pages shows alignment issues. Same code is working fine on local.

Package link: [https://www.npmjs.com/package/jspdf-html2canvas]

Issues:

Bold text is overlapping

text displayed with strong tag are not aligned

Error image reference

Below is the configuration I have used.

```<code>const opt = {
      jsPDF: {
        unit: 'px',
        format: 'a4',
      },
      html2canvas: {
        imageTimeout: 15000,
        logging: true,
        useCORS: true,
        allowTaint: true,
        quality: 2,
        scale: 5,
      },
      imageType: 'image/jpeg',
      imageQuality: 1,
      margin: {
        top: 50,
        right: 20,
        bottom: 32,
        left: 20,
      },
      output: 'pdfFileName',
      init: function () { }
    }

</code>```

Body:
I have used jspdf-html2canvas package in Angular 10 project for PDF download. Post deployment in safari browser the downloaded pdf bold font is not rendering proper. Also some of the pages shows alignment issues. Same code is working fine on local.

Package link: [https://www.npmjs.com/package/jspdf-html2canvas]

Issues:

Bold text is overlapping

text displayed with strong tag are not aligned

Error image reference

Below is the configuration I have used.

const opt = {
      jsPDF: {
        unit: 'px',
        format: 'a4',
      },
      html2canvas: {
        imageTimeout: 15000,
        logging: true,
        useCORS: true,
        allowTaint: true,
        quality: 2,
        scale: 5,
      },
      imageType: 'image/jpeg',
      imageQuality: 1,
      margin: {
        top: 50,
        right: 20,
        bottom: 32,
        left: 20,
      },
      output: 'pdfFileName',
      init: function () { }
    }


问:
what is the best way to import css file in jsx?
what is the difference between method 1 and method 2 when importing css files ?

method 1:

```<code>import "./link.css"
<div className="button-style">
</code>```

method 2:

```<code>import styles from "./link.css"
<div className={styles.button-syle}>
</code>```

Body:
what is the difference between method 1 and method 2 when importing css files ?

method 1:

import "./link.css"

method 2:

import styles from "./link.css"


问:
Why my test keeps getting skipped? (Using WebDriver.io and cucumber)
I am trying to run my test, but the result is some of my scenario test is getting skipped:

step-definitions file:

const { Given, When, Then } = require('@wdio/cucumber-framework');

const MainPage = require('../pageobjects/main-page.js');
const ElementsPage = require('../pageobjects/elements-page.js');
const ButtonsPage = require('../pageobjects/buttons-page.js')

Given('I am on the Main Page', async () => {
    await MainPage.open(`https://demoqa.com/`)
});

When('I click Elements Button', async() => {
    await MainPage.clickElements()
});

Then('I successfully go to <string> Page', async(namePage) => {
    await ElementsPage.verifyClickButton(namePage)
});

When('I click Button on Navbar', async() => {
    await ElementsPage.clickBtnButtons()
});

Then('I successfully open {string} Page', async(buttons) => {
    await ButtonsPage.verifyNamePage(buttons)
});

When('I click on Click Me Button', async() => {
    await ButtonsPage.clickBtnClickMe()
});

Then('I successfully click on Click Me Button', async() => {
    await ButtonsPage.verifyClickMeButton()
});

When('I click on Right Click Me Button', async() => {
    await ButtonsPage.clickBtnRightClickMe()
});

Then('I successfully click on Right Click Me Button', async() => {
    await ButtonsPage.verifyRightClickMeButton()
});

When('I click on Double Click Me Button', async() => {
    await ButtonsPage.clickBtnDoubleClickMe()
});

Then('I successfully click on Double Click Me Button', async() => {
    await ButtonsPage.verifyDoubleClickMeButton()
});```
</div>
</div>
</p>
<p>Since there are no errors, I am wondering what should I do?</p>
<p><strong>Console-logs:</strong></p>
```
 "spec" Reporter:
------------------------------------------------------------------
[chrome 108.0.5359.125 windows #0-0] Running: chrome (v108.0.5359.125) on windows
[chrome 108.0.5359.125 windows #0-0] Session ID: 86891a0c4203314f998ad2a06ab208a6
[chrome 108.0.5359.125 windows #0-0]
[chrome 108.0.5359.125 windows #0-0] » \features\scenarios\buttons.feature
[chrome 108.0.5359.125 windows #0-0] Latihan Automation di demoqa.com
[chrome 108.0.5359.125 windows #0-0] Successfully click 3 Buttons in Elements Page
[chrome 108.0.5359.125 windows #0-0]    ✓ Given I am on the Main Page
[chrome 108.0.5359.125 windows #0-0]    ✓ When I click Elements Button
[chrome 108.0.5359.125 windows #0-0]    ✓ Then I successfully go to "Elements" Page
[chrome 108.0.5359.125 windows #0-0]    ✓ When I click Button on Navbar
[chrome 108.0.5359.125 windows #0-0]    - Then I successfully open "Buttons" Page
[chrome 108.0.5359.125 windows #0-0]    - When I click on Click Me Button
[chrome 108.0.5359.125 windows #0-0]    - Then I successfully click on Click Me Button
[chrome 108.0.5359.125 windows #0-0]    - When I click on Right Click Me Button
[chrome 108.0.5359.125 windows #0-0]    - Then I successfully click on Right Click Me Button
[chrome 108.0.5359.125 windows #0-0]    - Then I successfully click on Double Click Me Button
[chrome 108.0.5359.125 windows #0-0]
[chrome 108.0.5359.125 windows #0-0] 4 passing (37.2s)
[chrome 108.0.5359.125 windows #0-0] 7 skipped

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:42

2022-12-20T08:58:07.664Z INFO @wdio/local-runner: Shutting down spawned worker
2022-12-20T08:58:07.927Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-12-20T08:58:07.929Z INFO @wdio/local-runner: shutting down
```

Am I am missing some configurations here? I don't know what to try, it is my first time using WebdriverIO.

Body:
I am trying to run my test, but the result is some of my scenario test is getting skipped:

step-definitions file:

const { Given, When, Then } = require('@wdio/cucumber-framework');

const MainPage = require('../pageobjects/main-page.js');
const ElementsPage = require('../pageobjects/elements-page.js');
const ButtonsPage = require('../pageobjects/buttons-page.js')

Given('I am on the Main Page', async () => {
    await MainPage.open(`https://demoqa.com/`)
});

When('I click Elements Button', async() => {
    await MainPage.clickElements()
});

Then('I successfully go to <string> Page', async(namePage) => {
    await ElementsPage.verifyClickButton(namePage)
});

When('I click Button on Navbar', async() => {
    await ElementsPage.clickBtnButtons()
});

Then('I successfully open {string} Page', async(buttons) => {
    await ButtonsPage.verifyNamePage(buttons)
});

When('I click on Click Me Button', async() => {
    await ButtonsPage.clickBtnClickMe()
});

Then('I successfully click on Click Me Button', async() => {
    await ButtonsPage.verifyClickMeButton()
});

When('I click on Right Click Me Button', async() => {
    await ButtonsPage.clickBtnRightClickMe()
});

Then('I successfully click on Right Click Me Button', async() => {
    await ButtonsPage.verifyRightClickMeButton()
});

When('I click on Double Click Me Button', async() => {
    await ButtonsPage.clickBtnDoubleClickMe()
});

Then('I successfully click on Double Click Me Button', async() => {
    await ButtonsPage.verifyDoubleClickMeButton()
});

Since there are no errors, I am wondering what should I do?

Console-logs:

 "spec" Reporter:
------------------------------------------------------------------
[chrome 108.0.5359.125 windows #0-0] Running: chrome (v108.0.5359.125) on windows
[chrome 108.0.5359.125 windows #0-0] Session ID: 86891a0c4203314f998ad2a06ab208a6
[chrome 108.0.5359.125 windows #0-0]
[chrome 108.0.5359.125 windows #0-0] » \features\scenarios\buttons.feature
[chrome 108.0.5359.125 windows #0-0] Latihan Automation di demoqa.com
[chrome 108.0.5359.125 windows #0-0] Successfully click 3 Buttons in Elements Page
[chrome 108.0.5359.125 windows #0-0]    ✓ Given I am on the Main Page
[chrome 108.0.5359.125 windows #0-0]    ✓ When I click Elements Button
[chrome 108.0.5359.125 windows #0-0]    ✓ Then I successfully go to "Elements" Page
[chrome 108.0.5359.125 windows #0-0]    ✓ When I click Button on Navbar
[chrome 108.0.5359.125 windows #0-0]    - Then I successfully open "Buttons" Page
[chrome 108.0.5359.125 windows #0-0]    - When I click on Click Me Button
[chrome 108.0.5359.125 windows #0-0]    - Then I successfully click on Click Me Button
[chrome 108.0.5359.125 windows #0-0]    - When I click on Right Click Me Button
[chrome 108.0.5359.125 windows #0-0]    - Then I successfully click on Right Click Me Button
[chrome 108.0.5359.125 windows #0-0]    - Then I successfully click on Double Click Me Button
[chrome 108.0.5359.125 windows #0-0]
[chrome 108.0.5359.125 windows #0-0] 4 passing (37.2s)
[chrome 108.0.5359.125 windows #0-0] 7 skipped

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:42

2022-12-20T08:58:07.664Z INFO @wdio/local-runner: Shutting down spawned worker
2022-12-20T08:58:07.927Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-12-20T08:58:07.929Z INFO @wdio/local-runner: shutting down

Am I am missing some configurations here? I don't know what to try, it is my first time using WebdriverIO.


问:
How to include Zip files to Node Js Package
I am trying to unzip a file and use them in the Node Js application but when I run the application on a different pc the console logs file missing how can I include the files in the package itself.</p>
```<code>const decompress = require("decompress");
 decompress("extension.zip", "C:\\Program Files\\Google\\Chrome\\Application\\").then(files => {
     console.log("done!");
</code>```

Body:
I am trying to unzip a file and use them in the Node Js application but when I run the application on a different pc the console logs file missing how can I include the files in the package itself.

const decompress = require("decompress");
 decompress("extension.zip", "C:\\Program Files\\Google\\Chrome\\Application\\").then(files => {
     console.log("done!");


问:
Want to convert all datetimes in a nested dictionary to string and retain original dictionary as well
I want to convert all datetime (in key or in value) in a nested dictionary to string and retain original dictionary as well. In the below code I am not able to do so:

```<code>import datetime
import json

DATE_FMT = '%Y-%m-%d %H:%M'
def decode_dict(d):
    result = {}
    for key, value in d.items():
        if isinstance(key, (datetime.datetime,datetime.date)):
            key = datetime.datetime.strftime(key, DATE_FMT)
        if isinstance(value, (datetime.datetime,datetime.date)):
            value = datetime.datetime.strftime(value, DATE_FMT)
        elif isinstance(value, dict):
            value = decode_dict(value)  # Recursive call.
        elif isinstance(value, list):
            for x,i in enumerate(value):
                if isinstance(i, (dict, list)):
                    decode_dict(i)
        result.update({key: value})
    return result

#This is the dictionary I want update.

item3 = {"vs": [{'Id': {
    'mval': datetime.datetime(2000, 10, 1, 0, 0),
    'vc': {datetime.datetime(2000, 10, 1, 0, 0): 1,
     datetime.datetime(2000, 10, 2, 0, 0): 1,
     datetime.datetime(2000, 10, 11, 0, 0): 1}}}]}

decode_dict(item3)

{'vs': [{'Id': {'mval': datetime.datetime(2000, 10, 1, 0, 0),
    'vc': {datetime.datetime(2000, 10, 1, 0, 0): 1,
     datetime.datetime(2000, 10, 2, 0, 0): 1,
     datetime.datetime(2000, 10, 11, 0, 0): 1}}}]}
</code>```

Please guide here. Thanks.

Body:
I want to convert all datetime (in key or in value) in a nested dictionary to string and retain original dictionary as well. In the below code I am not able to do so:

import datetime
import json

DATE_FMT = '%Y-%m-%d %H:%M'
def decode_dict(d):
    result = {}
    for key, value in d.items():
        if isinstance(key, (datetime.datetime,datetime.date)):
            key = datetime.datetime.strftime(key, DATE_FMT)
        if isinstance(value, (datetime.datetime,datetime.date)):
            value = datetime.datetime.strftime(value, DATE_FMT)
        elif isinstance(value, dict):
            value = decode_dict(value)  # Recursive call.
        elif isinstance(value, list):
            for x,i in enumerate(value):
                if isinstance(i, (dict, list)):
                    decode_dict(i)
        result.update({key: value})
    return result

#This is the dictionary I want update.

item3 = {"vs": [{'Id': {
    'mval': datetime.datetime(2000, 10, 1, 0, 0),
    'vc': {datetime.datetime(2000, 10, 1, 0, 0): 1,
     datetime.datetime(2000, 10, 2, 0, 0): 1,
     datetime.datetime(2000, 10, 11, 0, 0): 1}}}]}

decode_dict(item3)

{'vs': [{'Id': {'mval': datetime.datetime(2000, 10, 1, 0, 0),
    'vc': {datetime.datetime(2000, 10, 1, 0, 0): 1,
     datetime.datetime(2000, 10, 2, 0, 0): 1,
     datetime.datetime(2000, 10, 11, 0, 0): 1}}}]}

Please guide here. Thanks.


问:
Duplicate postback when using nicedit script in chrome
I have a .net framework web-forms project that uses the nicedit script, to makes an inline content editor on my page. (see https://nicedit.com/)

Page.aspx:

```<code><asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script src="nicEdit.js" type="text/javascript"></script>
<script type="text/javascript">
    bkLib.onDomLoaded(function () {
        var myNicEditor = new nicEditor();
        myNicEditor.setPanel('myNicPanel');
        myNicEditor.addInstance('txtData');
    });

    </script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div id="myNicPanel" style="width: 545px;"> </div>
    <textarea id="txtData" name="S1" rows="12" cols="100"></textarea>

    <input type="submit" value="sumbit form"/>
</asp:Content>

</code>```

In IE it works fine. But in chrome something goes wrong.

I created a tiny project that contains the minimal things to demonstrate the problem.

The problem: For some reason in each postback (for example when clicking on the submit button etc.) page loads twice, instead of one time. (First time with the IsPostBack=true and second time with the IsPostBack=false)

It makes unwanted behavior in my real application so that I must prevent that duplicate postback.

Can someone help me?

Thanks.

Body:
I have a .net framework web-forms project that uses the nicedit script, to makes an inline content editor on my page. (see https://nicedit.com/)

Page.aspx:

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <textarea id="txtData" name="S1" rows="12" cols="100"></textarea>

    <input type="submit" value="sumbit form"/>
</asp:Content>

In IE it works fine. But in chrome something goes wrong.

I created a tiny project that contains the minimal things to demonstrate the problem.

The problem: For some reason in each postback (for example when clicking on the submit button etc.) page loads twice, instead of one time. (First time with the IsPostBack=true and second time with the IsPostBack=false)

It makes unwanted behavior in my real application so that I must prevent that duplicate postback.

Can someone help me?

Thanks.


问:
Headless WordPress BUT using Gutenberg blocks and ACF blocks, is it possible?
I am looking to branch out into the world of headless WordPress(WP). I have a project lined up and was hoping to use a JS front end on top of WP. I've found lots of articles around headless WP setup, however none of them seem to support Gutenberg blocks.

Does anyone have a good headless WP setup with a JS front end? I am not too picky, just want it to be robust, well supported and able to handle Gutenberg and ACF blocks.

Any help/info would be appreciated.

One path I have ventured down is attempting to do this with Gatsby(which seemed like it was possible a year or two ago), however have had limited success. I have followed their documentation for setting up the site and required plugins for both WP and Gatsby but are unable to locate blocks in the graphQL JSON. I've installed plugins such as graphQL Gutenberg but this throws an error. I am able to get ACF fields but that would only be helpful if I decided to build the site using ACF flexible content.


问:
Android Room FOREIGN KEY constraint failed
Here Category Model:

```<code>@Entity(tableName = "category")
data class Category(
    @PrimaryKey(autoGenerate = true) val id : Int,
    @ColumnInfo(name = "name") val name: String
)

</code>```

Here Todo Model:

```<code>@Entity(tableName = "todo", foreignKeys = [
    ForeignKey(
        entity = Category::class,
        parentColumns = ["id"],
        childColumns = ["nameID"],
        onDelete = CASCADE
    )
])
data class Todo(
    @PrimaryKey (autoGenerate = true)val id : Int,
    @ColumnInfo(name = "text")val text : String,
    @ColumnInfo(name = "nameID")val nameID : Int
)

</code>```

android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)

Body:
Here Category Model:

@Entity(tableName = "category")
data class Category(
    @PrimaryKey(autoGenerate = true) val id : Int,
    @ColumnInfo(name = "name") val name: String
)

Here Todo Model:

@Entity(tableName = "todo", foreignKeys = [
    ForeignKey(
        entity = Category::class,
        parentColumns = ["id"],
        childColumns = ["nameID"],
        onDelete = CASCADE
    )
])
data class Todo(
    @PrimaryKey (autoGenerate = true)val id : Int,
    @ColumnInfo(name = "text")val text : String,
    @ColumnInfo(name = "nameID")val nameID : Int
)

android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)


问:
ckEditor5 online build works in development, not in production mode
Downloaded final build with required plugins from https://ckeditor.com/ckeditor-5/online-builder/

Extracted build content into a folder name ckeditor5 in root of project.

Installed the local package with this command npm add file:./ckeditor5
Used these commands in nextjs to generate production build npm run build and npm run export

Getting the following error in production build of next js

```<code>849.02b0292964587ed3.js:1 TypeError: this.props.editor.create is not a function
    at ir._createEditor (849.02b0292964587ed3.js:1:27553)
    at Ge._creator (849.02b0292964587ed3.js:1:27214)
    at 849.02b0292964587ed3.js:1:19557
    at async ir._initializeEditor (849.02b0292964587ed3.js:1:27356)
    at async ir.componentDidMount (849.02b0292964587ed3.js:1:26738)
Object
phase: "initialization"
willEditorRestart: false
[[Prototype]]: Object
</code>```

console.log of editor module return the following

```<code>Module
__esModule: true
Symbol(Symbol.toStringTag): "Module"
</code>```

But it works perfectly in development mode

Body:
Downloaded final build with required plugins from https://ckeditor.com/ckeditor-5/online-builder/

Extracted build content into a folder name ckeditor5 in root of project.

Installed the local package with this command npm add file:./ckeditor5
Used these commands in nextjs to generate production build npm run build and npm run export

Getting the following error in production build of next js

849.02b0292964587ed3.js:1 TypeError: this.props.editor.create is not a function
    at ir._createEditor (849.02b0292964587ed3.js:1:27553)
    at Ge._creator (849.02b0292964587ed3.js:1:27214)
    at 849.02b0292964587ed3.js:1:19557
    at async ir._initializeEditor (849.02b0292964587ed3.js:1:27356)
    at async ir.componentDidMount (849.02b0292964587ed3.js:1:26738)
Object
phase: "initialization"
willEditorRestart: false
[[Prototype]]: Object

console.log of editor module return the following

Module
__esModule: true
Symbol(Symbol.toStringTag): "Module"

But it works perfectly in development mode


问:
Python News title classification imbalanced dataset improve f1 score
I am working on a newspaper headline classification problem, whereby I have a very unbalanced dataset. I am trying various models such as Random Forests, Multinomial Naive Bayes, SVM etc... but my F1 score is still around 65% and for one particular label ie: Environment I am getting an F1 score of 19% or less. Please note this is NOT the smallest labelled category.

I am performing GridSearch for parameter tuning as well.

This is a visualisation of my data:

Is there a way to improve upon my accuracy or F1 score?


问:
react-i18next does not load local translations when the page reloads in the Firefox browser
I have local translations and translations that backend sends. In other browsers everything works correctly and when the page refreshes the bundle contains both local and translations from backend

i18n.js

```<code>i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
    fallbackLng: 'en-US',
    preload: ['en-US', 'es'],
    supportedLngs: ['en-US', 'es'],
    debug: true,
    load: 'currentOnly',
    interpolation: {
      escapeValue: false,
      },
      backend: {
      loadPath: '/locales/{{lng}}/{{ns}}.json',
      },
    saveMissing: true,
    missingKeyHandler: (languages, namespace, key) => {
    const detail = { languages, namespace, key };
    const customEvent = new CustomEvent('onMissingTranslationKey', { detail });
    window.dispatchEvent(customEvent);
   },
 })
export default i18n;
</code>```
```<code>export const setTranslBundle = data => {
  if (Object.keys(data).length > 0) {
    Object.keys(data).forEach(lang => {
      const lang_obj = {
        'en': 'en-US',
        'es': 'es',
        'fr': 'fr',
      };
      i18n.addResourceBundle(lang_obj[lang] ?? 'en-US', 'translation', data[lang], true);
    });
  }
};
</code>```

The Firefox browser doesn't load local resources. When I getBundleResource, I see that there are only backend keys.

When I clear localStorage and reload the page, everything works fine. The bundle gets both local and BO translations, then only BO the next time the page is reloaded

Is it possible that for Mozilla I need to use different settings?

Body:
I have local translations and translations that backend sends. In other browsers everything works correctly and when the page refreshes the bundle contains both local and translations from backend

i18n.js

i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
    fallbackLng: 'en-US',
    preload: ['en-US', 'es'],
    supportedLngs: ['en-US', 'es'],
    debug: true,
    load: 'currentOnly',
    interpolation: {
      escapeValue: false,
      },
      backend: {
      loadPath: '/locales/{{lng}}/{{ns}}.json',
      },
    saveMissing: true,
    missingKeyHandler: (languages, namespace, key) => {
    const detail = { languages, namespace, key };
    const customEvent = new CustomEvent('onMissingTranslationKey', { detail });
    window.dispatchEvent(customEvent);
   },
 })
export default i18n;

export const setTranslBundle = data => {
  if (Object.keys(data).length > 0) {
    Object.keys(data).forEach(lang => {
      const lang_obj = {
        'en': 'en-US',
        'es': 'es',
        'fr': 'fr',
      };
      i18n.addResourceBundle(lang_obj[lang] ?? 'en-US', 'translation', data[lang], true);
    });
  }
};

The Firefox browser doesn't load local resources. When I getBundleResource, I see that there are only backend keys.

When I clear localStorage and reload the page, everything works fine. The bundle gets both local and BO translations, then only BO the next time the page is reloaded

Is it possible that for Mozilla I need to use different settings?


问:
How do I calculate incidence rate ratios for a categorical variable with more than two levels?
I am trying to calculate incidence rate ratio for each level of an an exposure variable in Dtata, but I'm only finding that I can do it when the exposure variable has only two levels.

The exposure variable I am using is "agegroups" which has 5 levels (18-29, 30-39, 40-49, 50-59, 60+). And we are looking at time to symptom onset. I would like to use the 18-29 age category as the referent group and find incidence rate ratios for each level of the agegroup variable.

In Stata I went to Statistics > Survival analysis > Summary statistics, tests, and tables > Person-time, incidence rates, and SMR.

For the categorical variable, I chose agegroups and when I submit, I get an error message that says "variable agegroups takes on more than two values."

Is there I way I can do this calculation for agegroups ans get an IRR for each level of this categorical variable?


问:
Getting OS version from Prometheus node_exporter
I have couple of Vms running CentOS. Preparing a dashboard in Grafana to monitor my all machines with Prometheus node_exporter. I need Exact OS version with decimal point. Like my centos versions are 7.6, 7.8, and 7.9. But from queries node_os_info and node_os_version, I am getting only 7. Is there any way to get 7.8 and so on?


问:
TOP 10 with Dynamic Ranking showing arrows in Power BI
I'm trying to recreate a similar ranking table as this one with my data, where arrows shows, within a TOP 10, which subject rose or dropped in position:

My reasoning was to create a TOP 10 filter, then a measure with RANKX and then another one but only this time using DATEADD to establish a month prior. A third column calculating the difference and a little conditional formating should do the job. Can I achieve it this way?

So far I've tried:

```<code>Ranking = RANKX(ALLSELECTED(ZVC_PB_01[Name]),[Debt],,DESC)
</code>```

and

```<code>Ranking_mes = calculate(RANKX(ALLSELECTED(ZVC_PB_01[Name]),[Debt],,DESC), DATEADD(Calendario2[Date], -1, month))
</code>```

Problem is the second one is not working as intended, since I assume it's only calculating the ranking within the current Top 10 (there are more subjects and some should go in and others go out). How can I work around this?

Thanks in advance!

Body:
I'm trying to recreate a similar ranking table as this one with my data, where arrows shows, within a TOP 10, which subject rose or dropped in position:

My reasoning was to create a TOP 10 filter, then a measure with RANKX and then another one but only this time using DATEADD to establish a month prior. A third column calculating the difference and a little conditional formating should do the job. Can I achieve it this way?

So far I've tried:

Ranking = RANKX(ALLSELECTED(ZVC_PB_01[Name]),[Debt],,DESC)

and

Ranking_mes = calculate(RANKX(ALLSELECTED(ZVC_PB_01[Name]),[Debt],,DESC), DATEADD(Calendario2[Date], -1, month))

Problem is the second one is not working as intended, since I assume it's only calculating the ranking within the current Top 10 (there are more subjects and some should go in and others go out). How can I work around this?

Thanks in advance!


问:
how to activate qt event loop on linux
Is there any way to force the program build on top of qt5 to get into it's QEventDispatcherGlib::processEvent()? Currently I am porting a program from windows to linux and repair its auto-test module, and in windows, there is so many native MSGs to drive the program come into it's NativeEventFilter where the commands read from file will be executed(of course there are other places where the commands will be executed, but that's an important invoke point during auto-test). However in linux, the program just blocked when executing test files because there is no messages or event to awake the poll() call in QEventDispatcherGlib::processEvent(), which will lead to failure during command consumption. I want know if there is some mechanism so that I can wake up the poll() and get into my NativeEventFilters. (simulate key/mouse press event may lead to mistakes, so do not take into consideration).

maybe send some null msg/event via xcb by another thread? if so, example code is highly appreciated. looking forward to your replies, my friends.

Title: how to activate qt event loop on linux


问:
Taxonomy Hierarchy in Dropdown Select
I have managed a dropdown menu for custom taxonomies that allow to jump from one term page to other, but in the dropdown list taxonomies are not hierarchized. Can anybody help to correct the code?

I tried to change some parameters in the Javascript but I'm not really in it. I can work a little with php.

```<code>        <form style="width: 100%;">
                <?php

                $categories = get_categories('taxonomy=city');
                $select = "<select style='margin-top: 15px; width: 100%; height: 30px; font-family : Glegoo; font-size: 12pt' name='cat' id='cat' class='postform'>n";
                $select .= "<option style='height: 10px; font-weight: bold' value='-1'> SELECT ANOTHER CITY </option>n";

                foreach ($categories as $category) {
                    if ($category->count > 0) {
                        $select .= "<option value='" . $category->slug . "'>" . $category->name . "</option>";
                    }
                }

                $select .= "</select>";

                echo $select;
                ?>

                <script type="text/javascript"><!--
                    var dropdown = document.getElementById("cat");

                    function onCatChange() {
                        if (dropdown.options[dropdown.selectedIndex].value != -1) {
                            location.href = "<?php echo home_url();?>/city/" + dropdown.options[dropdown.selectedIndex].value + "/";
                        }
                    }

                    dropdown.onchange = onCatChange;
                    --></script>

    </form>
</code>```

Title: Taxonomy Hierarchy in Dropdown Select

Body:
I have managed a dropdown menu for custom taxonomies that allow to jump from one term page to other, but in the dropdown list taxonomies are not hierarchized. Can anybody help to correct the code?

I tried to change some parameters in the Javascript but I'm not really in it. I can work a little with php.

        <form style="width: 100%;">
                <?php

                $categories = get_categories('taxonomy=city');
                $select = "<select style='margin-top: 15px; width: 100%; height: 30px; font-family : Glegoo; font-size: 12pt' name='cat' id='cat' class='postform'>n";
                $select .= "<option style='height: 10px; font-weight: bold' value='-1'> SELECT ANOTHER CITY </option>n";

                foreach ($categories as $category) {
                    if ($category->count > 0) {
                        $select .= "<option value='" . $category->slug . "'>" . $category->name . "</option>";
                    }
                }

                $select .= "</select>";

                echo $select;
                ?>

    </form>


问:
Wrong predicted values using an custom predict function rather than a Keras built-in for an LSTM network
I use Keras API and stacked Long Short-Term Memory (LSTM) layers to create a one-step ahead predictor fro multivariate time series, thus I fit and tune the following sequential model:

```<code>    n_steps_in = 1 #number of timesteps
    n_features = 3 #number of features
    # X_train_lstm.shape = (None, 1, 3)  |  X_test_lstm.shape = (None, 1, 3)
    # y_train_lstm.shape = (None, 3)     |  y_test_lstm.shape = (None, 3)
    model_1 = Sequential()
    model_1.add(LSTM(5, activation='relu', return_sequences=True, input_shape=(n_steps_in,n_features)))
    model_1.add(LSTM(7, activation='relu'))
    model_1.add(Dense(n_features))
    model_1.compile(optimizer='adam', loss='mse')
    model_1.fit(X_train_lstm, y_train_lstm, epochs=100, validation_data = (X_test_lstm, y_test_lstm),
                verbose=1)
</code>```

Following that, In inference phase, I would like to utilize my own predict function rather than the buit-in predict Keras function. To do so, I first  extracted the weights and bias from the tuned model, and implemented my function that predict only one single step i.e. I feed to the model an input sample with shape (1,1,3) and it returns a forecast value with shape (1,3).
However, when I try to predict the target value that corresponds to x_input feature using the following code snippet :

```<code>begin_i = 1200
end_i = begin_i+1

x_input = X_test_lstm[begin_i:end_i,:]
# x_input is equal to array([[[10.83782137, 19.71025578, 15.03133658]]])
print('\n Real value from ground truth data : \n', y_test_lstm[begin_i:end_i,:]) #This is the target of x_input feature in real data

yhat = model_1.predict(x_input, verbose=0)
print('\n Predicted value using the Keras built-in function : \n',yhat)

yhat_custom = model_predict_LSTM(model_1, x_input)
print('\n Predicted value using my own prediction function : \n',yhat_custom)
</code>```

I got the following result :

```<code> Real value from ground truth data:
 [[11.73898922 20.86669669 16.89794765]]

 Predicted value using the Keras built-in function:
 [[11.8181   20.690315 16.918335]]

 Predicted value using my own prediction function:
 [[-0.14413215 -0.06837276  1.11446429]]
</code>```

Which means that the buitl-in Keras predict function gives a predicted value near to the real one, contrarly to my own predict function. I suspect that the hidden and the cell initial states h_tm1 and c_tm1 (see my my own predict function), which I initialized with zeros, are different from those used by the Keras built-in function that I cannot extract them.

I can not understand where the error is exactly, I would be grateful if someone can help me, Thank you and I apologize for my English.

Body:
I use Keras API and stacked Long Short-Term Memory (LSTM) layers to create a one-step ahead predictor fro multivariate time series, thus I fit and tune the following sequential model:

    n_steps_in = 1 #number of timesteps
    n_features = 3 #number of features
    # X_train_lstm.shape = (None, 1, 3)  |  X_test_lstm.shape = (None, 1, 3)
    # y_train_lstm.shape = (None, 3)     |  y_test_lstm.shape = (None, 3)
    model_1 = Sequential()
    model_1.add(LSTM(5, activation='relu', return_sequences=True, input_shape=(n_steps_in,n_features)))
    model_1.add(LSTM(7, activation='relu'))
    model_1.add(Dense(n_features))
    model_1.compile(optimizer='adam', loss='mse')
    model_1.fit(X_train_lstm, y_train_lstm, epochs=100, validation_data = (X_test_lstm, y_test_lstm),
                verbose=1)

Following that, In inference phase, I would like to utilize my own predict function rather than the buit-in predict Keras function. To do so, I first  extracted the weights and bias from the tuned model, and implemented my function that predict only one single step i.e. I feed to the model an input sample with shape (1,1,3) and it returns a forecast value with shape (1,3).
However, when I try to predict the target value that corresponds to x_input feature using the following code snippet :

begin_i = 1200
end_i = begin_i+1

x_input = X_test_lstm[begin_i:end_i,:]
# x_input is equal to array([[[10.83782137, 19.71025578, 15.03133658]]])
print('\n Real value from ground truth data : \n', y_test_lstm[begin_i:end_i,:]) #This is the target of x_input feature in real data

yhat = model_1.predict(x_input, verbose=0)
print('\n Predicted value using the Keras built-in function : \n',yhat)

yhat_custom = model_predict_LSTM(model_1, x_input)
print('\n Predicted value using my own prediction function : \n',yhat_custom)

I got the following result :

 Real value from ground truth data:
 [[11.73898922 20.86669669 16.89794765]]

 Predicted value using the Keras built-in function:
 [[11.8181   20.690315 16.918335]]

 Predicted value using my own prediction function:
 [[-0.14413215 -0.06837276  1.11446429]]

Which means that the buitl-in Keras predict function gives a predicted value near to the real one, contrarly to my own predict function. I suspect that the hidden and the cell initial states h_tm1 and c_tm1 (see my my own predict function), which I initialized with zeros, are different from those used by the Keras built-in function that I cannot extract them.

I can not understand where the error is exactly, I would be grateful if someone can help me, Thank you and I apologize for my English.


问:
Browser complains about a javascript const value being not defined
I'm having a project, where I'm using a script to save a logged in user to the session and one to get the user from the session, but if the user isn't logged in, it will return undefined.
So I'm making a const of the user from the function and using an if statement to check if the user is undefined.
But there comes an error in the if statement, where the browser tells me the user is not defined, but that is the whole idea that it is not.

```<code>const user = getUser();
if (user !== undefined)
</code>```

Any idea why this is?

Body:
I'm having a project, where I'm using a script to save a logged in user to the session and one to get the user from the session, but if the user isn't logged in, it will return undefined.
So I'm making a const of the user from the function and using an if statement to check if the user is undefined.
But there comes an error in the if statement, where the browser tells me the user is not defined, but that is the whole idea that it is not.

const user = getUser();
if (user !== undefined)

Any idea why this is?


问:
Route the map on image based on pixel's color
I'm looking for the way to implement drawing paths on maps basing on pixel's color. Like on the picture bellow I want to move from point to point mainly on pixels of particular color (in this case - red) and if it is such possibility - omit pixels of different colour. Can You give me a hint which algorithm should I use for this purpose? Maybe do You know any dataset to train AI model? Thank You for help!

To this moment I thought about multi output classification. However I don't think it's a good way to solve the problem and I couldn't find proper dataset.


问:
how to clean vlogs from /var/lib/docker/volumes
We noticed that root partition was filled up on one of our docker VMs
checking what was causing this, we noticed that its due to vlogs under /var/lib/docker/volumes/{some scraper}/_data
see below

```<code>3.6G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_cpt
2.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_kzn
5.2G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_nga
9.7G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_dmm_cpt
940M    /var/lib/docker/volumes/rr-scraper-data-customer-object_dmm_kzn
576M    /var/lib/docker/volumes/rr-scraper-data-customer-object_dmm_nga
1.8G    /var/lib/docker/volumes/rr-scraper-data-customer-object_dmm_sga
2.0G    /var/lib/docker/volumes/rr-scraper-data-customer-object_slm_cpt
2.0G    /var/lib/docker/volumes/rr-scraper-data-customer-object_slm_kzn
910M    /var/lib/docker/volumes/rr-scraper-data-customer-object_slm_nga
3.7G    /var/lib/docker/volumes/rr-scraper-data-customer-object_slm_sga
68M     /var/lib/docker/volumes/rr-scraper-data-customer-saos6_cpt
40M     /var/lib/docker/volumes/rr-scraper-data-customer-saos6_kzn
110M    /var/lib/docker/volumes/rr-scraper-data-customer-saos6_nga
181M    /var/lib/docker/volumes/rr-scraper-data-customer-saos6_sga
2.4G    /var/lib/docker/volumes/rr-scraper-data-customer-saos8_cpt
515M    /var/lib/docker/volumes/rr-scraper-data-customer-saos8_kzn
943M    /var/lib/docker/volumes/rr-scraper-data-customer-saos8_nga
3.8G    /var/lib/docker/volumes/rr-scraper-data-customer-saos8_sga
root@dfarr02:/home/rr_admin# du -sh /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/*
9.7G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data
root@dfarr02:/home/rr_admin# du -sh /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/*
25M     /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000198.sst
0       /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000314.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000353.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000354.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000355.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000356.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000357.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000358.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000359.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000360.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000361.vlog
689M    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000362.vlog
4.0K    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/KEYREGISTRY
4.0K    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/LOCK
4.0K    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/MANIFEST
</code>```

we cleaned it last time using this command
for i in 'll | awk '{print $9}' | grep vlog` ; do >$i; done

but after two days, the root partition was filling up quickly due to vlogs

how can we implement this in a cronjob? is there other way to resolve this?
thanks

Body:
We noticed that root partition was filled up on one of our docker VMs
checking what was causing this, we noticed that its due to vlogs under /var/lib/docker/volumes/{some scraper}/_data
see below

3.6G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_cpt
2.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_kzn
5.2G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_nga
9.7G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_dmm_cpt
940M    /var/lib/docker/volumes/rr-scraper-data-customer-object_dmm_kzn
576M    /var/lib/docker/volumes/rr-scraper-data-customer-object_dmm_nga
1.8G    /var/lib/docker/volumes/rr-scraper-data-customer-object_dmm_sga
2.0G    /var/lib/docker/volumes/rr-scraper-data-customer-object_slm_cpt
2.0G    /var/lib/docker/volumes/rr-scraper-data-customer-object_slm_kzn
910M    /var/lib/docker/volumes/rr-scraper-data-customer-object_slm_nga
3.7G    /var/lib/docker/volumes/rr-scraper-data-customer-object_slm_sga
68M     /var/lib/docker/volumes/rr-scraper-data-customer-saos6_cpt
40M     /var/lib/docker/volumes/rr-scraper-data-customer-saos6_kzn
110M    /var/lib/docker/volumes/rr-scraper-data-customer-saos6_nga
181M    /var/lib/docker/volumes/rr-scraper-data-customer-saos6_sga
2.4G    /var/lib/docker/volumes/rr-scraper-data-customer-saos8_cpt
515M    /var/lib/docker/volumes/rr-scraper-data-customer-saos8_kzn
943M    /var/lib/docker/volumes/rr-scraper-data-customer-saos8_nga
3.8G    /var/lib/docker/volumes/rr-scraper-data-customer-saos8_sga
root@dfarr02:/home/rr_admin# du -sh /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/*
9.7G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data
root@dfarr02:/home/rr_admin# du -sh /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/*
25M     /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000198.sst
0       /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000314.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000353.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000354.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000355.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000356.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000357.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000358.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000359.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000360.vlog
1.1G    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000361.vlog
689M    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/000362.vlog
4.0K    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/KEYREGISTRY
4.0K    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/LOCK
4.0K    /var/lib/docker/volumes/rr-scraper-data-customer-object_bw_sga/_data/MANIFEST

we cleaned it last time using this command
for i in 'll | awk '{print $9}' | grep vlog` ; do >$i; done

but after two days, the root partition was filling up quickly due to vlogs

how can we implement this in a cronjob? is there other way to resolve this?
thanks


问:
No provider for InjectionToken REQUEST! during application shell generation
I'm trying to add app-shell to my angular universal application (angular 14).

but getting the following error.

```<code>✖ Application shell generation failed.
R3InjectorError(AppServerModule)[ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> AuthenticationService -> Router -> Location -> LocationStrategy -> InjectionToken appBaseHref -> InjectionToken NX_BASE_HREF -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]:
  NullInjectorError: No provider for InjectionToken REQUEST!
</code>```

Build (ssr build) without app-shell is working fine and REQUEST token is accessible too, but with app-shell build i'm getting the error.

server.ts

```<code>  server.get('*', (req, res) => {
    res.render(indexHtml, {
      req,
      providers: [
        { provide: APP_BASE_HREF, useValue: req.baseUrl },
        { provide: REQUEST, useValue: req },
        { provide: RESPONSE, useValue: res },
      ],
    });
  });
</code>```

NX_BASE_HREF

```<code>import { REQUEST } from '@nguniversal/express-engine/tokens';

export const NX_BASE_HREF = new InjectionToken<string>('NX_BASE_HREF', {
  factory() {
    const getBasePath = (basePath: string) => {
      const isValidBasePath =
        environment.supportedContries
          .map((country) => country.toLowerCase())
          .indexOf(basePath as SupportedCountry) >= 0;
      return `/${isValidBasePath ? basePath : ''}`;
    };
    const isServer = inject<boolean>(IS_SERVER);
    if (isServer) {
      const basePath = inject(REQUEST).url.split('/')[1];
      return getBasePath(basePath);
    } else {
      const basePath = window.location.pathname.split('/')[1];
      return getBasePath(basePath);
    }
  },
});
</code>```

app.server.module.ts

```<code>const routes: Routes = [{ path: 'shell', component: AppShellComponent }];

@NgModule({
  imports: [AppModule, ServerModule, RouterModule.forRoot(routes)],
  bootstrap: [AppComponent],
  declarations: [AppShellComponent],
})
export class AppServerModule {}
</code>```

Important: Build without app-shell is working fine.

I want to build my universal application with app-shell.

Body:
I'm trying to add app-shell to my angular universal application (angular 14).

but getting the following error.

✖ Application shell generation failed.
R3InjectorError(AppServerModule)[ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> AuthenticationService -> Router -> Location -> LocationStrategy -> InjectionToken appBaseHref -> InjectionToken NX_BASE_HREF -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]:
  NullInjectorError: No provider for InjectionToken REQUEST!

Build (ssr build) without app-shell is working fine and REQUEST token is accessible too, but with app-shell build i'm getting the error.

server.ts

  server.get('*', (req, res) => {
    res.render(indexHtml, {
      req,
      providers: [
        { provide: APP_BASE_HREF, useValue: req.baseUrl },
        { provide: REQUEST, useValue: req },
        { provide: RESPONSE, useValue: res },
      ],
    });
  });

NX_BASE_HREF

import { REQUEST } from '@nguniversal/express-engine/tokens';

export const NX_BASE_HREF = new InjectionToken<string>('NX_BASE_HREF', {
  factory() {
    const getBasePath = (basePath: string) => {
      const isValidBasePath =
        environment.supportedContries
          .map((country) => country.toLowerCase())
          .indexOf(basePath as SupportedCountry) >= 0;
      return `/${isValidBasePath ? basePath : ''}`;
    };
    const isServer = inject<boolean>(IS_SERVER);
    if (isServer) {
      const basePath = inject(REQUEST).url.split('/')[1];
      return getBasePath(basePath);
    } else {
      const basePath = window.location.pathname.split('/')[1];
      return getBasePath(basePath);
    }
  },
});

app.server.module.ts

const routes: Routes = [{ path: 'shell', component: AppShellComponent }];

@NgModule({
  imports: [AppModule, ServerModule, RouterModule.forRoot(routes)],
  bootstrap: [AppComponent],
  declarations: [AppShellComponent],
})
export class AppServerModule {}

Important: Build without app-shell is working fine.

I want to build my universal application with app-shell.


问:
What the problem with background on cordova?
I make a mobile app on iOS in Apache Cordova. I have problem with bad background color. Screenshot Its the screenshot od part of interface. And this is div container and its should be a white background and its work good on iOS 15 but in iOS16 looks like in screenshot and its bad because its looks like Brown not white. What's the problem?
Regards

I try to change the CSS parametr but its not work on iOS 16.


问:
In JAXB, is it possible to define annotations that allow embedding a xs:sequence within a xs:choice?
I am creating a Java class with JAXB annotations, and I'm trying to match the following XSD type definition:

```<code><complexType name="TVAMediaLocatorType">
   <sequence>
      <choice minOccurs="0">
         <sequence>
            <element name="MediaUri" type="tva:ExtendedURIType"/>
            <element name="AuxiliaryUri" type="tva:ExtendedURIType"
                  minOccurs="0" maxOccurs="unbounded"/>
         </sequence>
         <element name="InlineMedia" type="mpeg7:InlineMediaType"/>
      </choice>
      ...
   </sequence>
</complexType>
</code>```

I'm having trouble to understand how to embed a xs:sequence inside the xs:choice using JAXB annotations.

For xs:choice, there's the javax.xml.bind.annotation.XmlElements annotation, but it only accepts one or more javax.xml.bind.annotation.XmlElement, each representing a single XML element, but not a sequence of elements with potentially differing types.
So, having a xs:sequence within a xs:choice is really causing me difficulties here.

I tried the XML schema compiler xjc, and it simply generates a bunch of javax.xml.bind.annotation.XmlElement annotations for each element. On top, all required fields are defaulting to false, which is just plain wrong, since it allows for incorrect XML, such as:

```<code><some-element>
   <AuxiliaryUri .. /> <!-- mandatory MediaUri is missing -->
   <InlineMedia .. /> <!-- not allowed here, since AuxiliaryUri preceeded -->
</some-element>
</code>```

For now, I just use the code xjc generated and create my objects to adhere to the XSD type definition (I have sole control over object creation), so I'm somewhat fine regards writing XML.
But reading incoming XML does not trigger validation errors how it should..

I'd be grateful for any ideas on how I should proceed - any insights for me?

Body:
I am creating a Java class with JAXB annotations, and I'm trying to match the following XSD type definition:

<complexType name="TVAMediaLocatorType">
   <sequence>
      <choice minOccurs="0">
         <sequence>
            <element name="MediaUri" type="tva:ExtendedURIType"/>
            <element name="AuxiliaryUri" type="tva:ExtendedURIType"
                  minOccurs="0" maxOccurs="unbounded"/>
         </sequence>
         <element name="InlineMedia" type="mpeg7:InlineMediaType"/>
      </choice>
      ...
   </sequence>
</complexType>

I'm having trouble to understand how to embed a xs:sequence inside the xs:choice using JAXB annotations.

For xs:choice, there's the javax.xml.bind.annotation.XmlElements annotation, but it only accepts one or more javax.xml.bind.annotation.XmlElement, each representing a single XML element, but not a sequence of elements with potentially differing types.
So, having a xs:sequence within a xs:choice is really causing me difficulties here.

I tried the XML schema compiler xjc, and it simply generates a bunch of javax.xml.bind.annotation.XmlElement annotations for each element. On top, all required fields are defaulting to false, which is just plain wrong, since it allows for incorrect XML, such as:

<some-element>
   <AuxiliaryUri .. />
   <InlineMedia .. />
</some-element>

For now, I just use the code xjc generated and create my objects to adhere to the XSD type definition (I have sole control over object creation), so I'm somewhat fine regards writing XML.
But reading incoming XML does not trigger validation errors how it should..

I'd be grateful for any ideas on how I should proceed - any insights for me?


问:
Mixed JS & TS codebase errors on lint
I have a codebase that is mostly JS however as of recently we have decided to move to TS but we are replacing files as we go.

I have the following example component/folder structure:

```<code>apps:
    example:
        Components:
            Example.js
    shared:
        util.ts
</code>```

Inside Example.js I'm importing a function from util.ts. My IDE reports no errors, when I compile my apps I get no errors, I have setup import aliases in my tsconfig etc, however when I run eslint in the terminal it errors

Cannot find module '/apps/shared/util' from '/apps/example/Components/Example'

Command ./node_modules/.bin/eslint --ext .js,.jsx,.ts,.tsx --format codeframe apps/example --quiet

A stripped-back version of my .eslintrc looks like:

{
    "globals": {...},
    "parser": "babel-eslint",
    "extends": [
        "react-app",
        "airbnb",
        "prettier",
        "plugin:react-hooks/recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:import/typescript"
    ],
    "plugins": [
        "react",
        "prettier",
        "react-hooks",
        "eslint-plugin-import",
        "@typescript-eslint",
        "import"
    ],
    "rules": {
        "import/extensions": [
            "error",
            "ignorePackages",
            {
                "js": "never",
                "jsx": "never",
                "ts": "never",
                "tsx": "never"
            }
        ],
        ...
    },
    "settings": {
        "import/extensions": [".js", ".jsx", ".ts", ".tsx"],
        "import/parsers": {
            "@typescript-eslint/parser": [".ts", ".tsx", ".js", ".jsx"],
            "@typescript-eslint": [".ts", ".tsx", ".js", ".jsx"]
        },
        "import/resolver": {
            "jsconfig": {
                "config": "jsconfig.json"
            },
            "typescript": {
                "config": "tsconfig.json"
            },
            "node": {
                "extensions": [".js", ".jsx", ".ts", ".tsx"]
            }
        }
    },
    "parserOptions": {
        "project": ["./tsconfig.json"]
    }
}
```
<p>I also tried to use overrides as per this</p>
<pre class="lang-json prettyprint-override"><code>{
    "parser": "@babel/eslint-parser",
    "overrides": [
        {
            "files": ["**/*.ts", "**/*.tsx"],
            "env": { "browser": true, "es6": true, "node": true },
            "extends": [
                "plugin:@typescript-eslint/eslint-recommended",
                "plugin:@typescript-eslint/recommended",
                "plugin:import/typescript"
            ],
            "parser": "@typescript-eslint/parser",
            "plugins": ["react", "@typescript-eslint"],
            "parserOptions": {
                "ecmaFeatures": { "jsx": true },
                "ecmaVersion": 2018,
                "sourceType": "module",
                "project": "./tsconfig.json"
            }
        }
    ]
}
</code>```

Title: Mixed JS & TS codebase errors on lint

Body:
I have a codebase that is mostly JS however as of recently we have decided to move to TS but we are replacing files as we go.

I have the following example component/folder structure:

apps:
    example:
        Components:
            Example.js
    shared:
        util.ts

Inside Example.js I'm importing a function from util.ts. My IDE reports no errors, when I compile my apps I get no errors, I have setup import aliases in my tsconfig etc, however when I run eslint in the terminal it errors

Cannot find module '/apps/shared/util' from '/apps/example/Components/Example'

Command ./node_modules/.bin/eslint --ext .js,.jsx,.ts,.tsx --format codeframe apps/example --quiet

A stripped-back version of my .eslintrc looks like:

{
    "globals": {...},
    "parser": "babel-eslint",
    "extends": [
        "react-app",
        "airbnb",
        "prettier",
        "plugin:react-hooks/recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:import/typescript"
    ],
    "plugins": [
        "react",
        "prettier",
        "react-hooks",
        "eslint-plugin-import",
        "@typescript-eslint",
        "import"
    ],
    "rules": {
        "import/extensions": [
            "error",
            "ignorePackages",
            {
                "js": "never",
                "jsx": "never",
                "ts": "never",
                "tsx": "never"
            }
        ],
        ...
    },
    "settings": {
        "import/extensions": [".js", ".jsx", ".ts", ".tsx"],
        "import/parsers": {
            "@typescript-eslint/parser": [".ts", ".tsx", ".js", ".jsx"],
            "@typescript-eslint": [".ts", ".tsx", ".js", ".jsx"]
        },
        "import/resolver": {
            "jsconfig": {
                "config": "jsconfig.json"
            },
            "typescript": {
                "config": "tsconfig.json"
            },
            "node": {
                "extensions": [".js", ".jsx", ".ts", ".tsx"]
            }
        }
    },
    "parserOptions": {
        "project": ["./tsconfig.json"]
    }
}

I also tried to use overrides as per this

{
    "parser": "@babel/eslint-parser",
    "overrides": [
        {
            "files": ["**/*.ts", "**/*.tsx"],
            "env": { "browser": true, "es6": true, "node": true },
            "extends": [
                "plugin:@typescript-eslint/eslint-recommended",
                "plugin:@typescript-eslint/recommended",
                "plugin:import/typescript"
            ],
            "parser": "@typescript-eslint/parser",
            "plugins": ["react", "@typescript-eslint"],
            "parserOptions": {
                "ecmaFeatures": { "jsx": true },
                "ecmaVersion": 2018,
                "sourceType": "module",
                "project": "./tsconfig.json"
            }
        }
    ]
}


问:
What is the data exchange mechanism for Kinesis streams (push/pull or pub/sub)?
Kinesis streams supports various producers and consumers.

What is the data exchange mechanism for Kinesis streams (push/pull or pub/sub)?


问:
Gitlab CI/CD incorrect comparison of variables
I'm trying to use comparison of variables in workflow rule section. My job:

```<code>variables:

  isDBExists: 0
  compareValue: 0

job1:
 stage: createVar
 script:
    - Import-Module C:\SqlServer.21.1.18221\sqlserver
    - $isDBExists = Invoke-sqlcmd -Query "SELECT 1" -ConnectionString $CONNSTR | format-table -property column1 -HideTableHeaders
    - $compareValue = Invoke-sqlcmd -Query "SELECT 1" -ConnectionString $CONNSTR | format-table -property column1 -HideTableHeaders
    - $isDBExists = [int]($isDBExists | Out-String).Trim()
    - $compareValue = [int]($compareValue | Out-String).Trim()

job2:
  stage: compare
  tags:
    - ps
  script:
    - Import-Module C:\SqlServer.21.1.18221\sqlserver
    - Invoke-Sqlcmd -ConnectionString $CONN -InputFile $script
  rules:
    - if: $isDBExists == $compareValue
      when: on_success

</code>```

Why $isDBExists  and $compareValue are not equial?
I tried to compare by strings, checked the data types with the gettype() function, checked the values, they are equal in powershell.
Thanks

Body:
I'm trying to use comparison of variables in workflow rule section. My job:

variables:

  isDBExists: 0
  compareValue: 0

job1:
 stage: createVar
 script:
    - Import-Module C:\SqlServer.21.1.18221\sqlserver
    - $isDBExists = Invoke-sqlcmd -Query "SELECT 1" -ConnectionString $CONNSTR | format-table -property column1 -HideTableHeaders
    - $compareValue = Invoke-sqlcmd -Query "SELECT 1" -ConnectionString $CONNSTR | format-table -property column1 -HideTableHeaders
    - $isDBExists = [int]($isDBExists | Out-String).Trim()
    - $compareValue = [int]($compareValue | Out-String).Trim()

job2:
  stage: compare
  tags:
    - ps
  script:
    - Import-Module C:\SqlServer.21.1.18221\sqlserver
    - Invoke-Sqlcmd -ConnectionString $CONN -InputFile $script
  rules:
    - if: $isDBExists == $compareValue
      when: on_success

Why $isDBExists  and $compareValue are not equial?
I tried to compare by strings, checked the data types with the gettype() function, checked the values, they are equal in powershell.
Thanks


问:
Two test folders, .NET 2.0 and .NET 6.0
I wrote tests logging.Tests, but two test files have come up in testExplorer . look at the image below.
.net 2.0 tests will not run. .net 6.0 tests pass without any issues. But this causing problem with coverage, eventhough i have return tests that cover logging(The tests pass too), coverage tool shows less coverage.

I dont know what to try. I am writing unit tests. But cant increase coverage

Title: Two test folders, .NET 2.0 and .NET 6.0


问:
How to change logo in mobile and desktop, docusaurus being used
I want to change the logo in mobile view and keep a bigger logo in desktop view.
fileName : docusaurus.config

```<code>themeConfig:
        /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
        ({
            navbar: {
                title: "",
                logo: {
                    alt: "Documentation Logo",
                    srcDark:
                        "https://logolink1.png",
                },
                items: [
                    {
                        to: "getting-started",
                        label: "Get Started",
                    },
                    {
                        to: "guides",
                        label: "Guides",
                    },
                    {
                        type: "custom-sidebarBottomMenu",
                    },
                    {
                        type: "custom-userAuthButtons",
                        position: "right",
                    },
                ],
            })
</code>```

in another file declaration is:

```<code>> export type Navbar = { style?: 'dark' | 'primary'; hideOnScroll: boolean; title?: string; items: NavbarItem[]; logo?: NavbarLogo;};
</code>```

I am on my early learning phase, and I am confused how to use Media query as No style sheet is there.
Can anyone please help me with this, with respect to docusaurus module.

Body:
I want to change the logo in mobile view and keep a bigger logo in desktop view.
fileName : docusaurus.config

themeConfig:
        /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
        ({
            navbar: {
                title: "",
                logo: {
                    alt: "Documentation Logo",
                    srcDark:
                        "https://logolink1.png",
                },
                items: [
                    {
                        to: "getting-started",
                        label: "Get Started",
                    },
                    {
                        to: "guides",
                        label: "Guides",
                    },
                    {
                        type: "custom-sidebarBottomMenu",
                    },
                    {
                        type: "custom-userAuthButtons",
                        position: "right",
                    },
                ],
            })

in another file declaration is:

> export type Navbar = { style?: 'dark' | 'primary'; hideOnScroll: boolean; title?: string; items: NavbarItem[]; logo?: NavbarLogo;};

I am on my early learning phase, and I am confused how to use Media query as No style sheet is there.
Can anyone please help me with this, with respect to docusaurus module.


问:
How can I add alias description to git commands
Git has built-in description for native commands (see stash, status, stripspace in picture).

Can I add such description for my custom aliases (like st in picture)?


问:
Limit pull request from a specific branch to target branch - BitBucket
My team is using BitBucket for Git repositories. We plan to go live in next two months and what I want to do is to limit so that the pull requests can be only made from a specific branch to the 'production' branch.

I am aware of the Branch Permission sections of the BitBucket but that solves by limiting the 'Changes without a pull request' only half the issue.

What I want to achieve is that there should be no changes allowed without approved pull request and this pull request can only be made from a specific branch.
If the pull request is made from any other 'random' branch to the 'production' branch the pull request could get automatically denied.

Is such a thing possible? Thanks.