问:
Reverse Children by parentId in sequlize
here is my code:

```<code>const Category = database.define("Category", {
    id: {
        type: sequelize.DataTypes.UUID, defaultValue: sequelize.UUIDV4, primaryKey: true
    },
    name: {
        type: sequelize.DataTypes.STRING(127),
        allowNull: false,
        validate: {
            notNull: true,
            len: {
                args: [2, 127],
                msg: "نام باید بین ۳ و ۱۲۷ کاراکتر باشد",
            }
        }
    },
    parentId: {
        type: sequelize.DataTypes.UUID,
    },

}, {paranoid: true});

Category.hasMany(Category, {foreignKey: "parentId", as: "children"})

await Category.findAll({
                attributes: ["id", "name"],
                include: [{
                    model: Category,
                    as: 'children',
                    attributes: ["id", "name"],
                    include: [{
                        model: Category,
                        as: 'children',
                        attributes: ["id", "name"],
                        include: [{
                            model: Category,
                            as: 'children',
                            attributes: ["id", "name"],
                            include: [{
                                model: Category,
                                as: 'children',
                                attributes: ["id", "name"],
                            }]
                        }]
                    }]
                }]
            });
</code>```

and here is my response:

```<code>[
        {
            "id": "0883a4ab-27c9-4274-aa3a-8bfb41ef97d3",
            "name": "GRAND FATHER",
            "children": [
                {
                    "id": "29ac2409-50f8-45a7-823f-d9f3447724c4",
                    "name": "FATHER",
                    "children": [
                        {
                            "id": "fd3acd72-2c5c-48c9-b3b1-57b35890a841",
                            "name": "Child",
                            "children": []
                        }
                    ]
                }
            ]
        },
        {
            "id": "29ac2409-50f8-45a7-823f-d9f3447724c4",
            "name": "FATHER",
            "children": [
                {
                    "id": "fd3acd72-2c5c-48c9-b3b1-57b35890a841",
                    "name": "Child",
                    "children": []
                }
            ]
        },
        {
            "id": "fd3acd72-2c5c-48c9-b3b1-57b35890a841",
            "name": "Child",
            "children": []
        }
    ]
</code>```

what I need to do is to reverse this. here I'm showing a parent with all its childrens. but I need to show children and all it's parents inside it.

Body:
here is my code:

const Category = database.define("Category", {
    id: {
        type: sequelize.DataTypes.UUID, defaultValue: sequelize.UUIDV4, primaryKey: true
    },
    name: {
        type: sequelize.DataTypes.STRING(127),
        allowNull: false,
        validate: {
            notNull: true,
            len: {
                args: [2, 127],
                msg: "نام باید بین ۳ و ۱۲۷ کاراکتر باشد",
            }
        }
    },
    parentId: {
        type: sequelize.DataTypes.UUID,
    },

}, {paranoid: true});

Category.hasMany(Category, {foreignKey: "parentId", as: "children"})

await Category.findAll({
                attributes: ["id", "name"],
                include: [{
                    model: Category,
                    as: 'children',
                    attributes: ["id", "name"],
                    include: [{
                        model: Category,
                        as: 'children',
                        attributes: ["id", "name"],
                        include: [{
                            model: Category,
                            as: 'children',
                            attributes: ["id", "name"],
                            include: [{
                                model: Category,
                                as: 'children',
                                attributes: ["id", "name"],
                            }]
                        }]
                    }]
                }]
            });

and here is my response:

[
        {
            "id": "0883a4ab-27c9-4274-aa3a-8bfb41ef97d3",
            "name": "GRAND FATHER",
            "children": [
                {
                    "id": "29ac2409-50f8-45a7-823f-d9f3447724c4",
                    "name": "FATHER",
                    "children": [
                        {
                            "id": "fd3acd72-2c5c-48c9-b3b1-57b35890a841",
                            "name": "Child",
                            "children": []
                        }
                    ]
                }
            ]
        },
        {
            "id": "29ac2409-50f8-45a7-823f-d9f3447724c4",
            "name": "FATHER",
            "children": [
                {
                    "id": "fd3acd72-2c5c-48c9-b3b1-57b35890a841",
                    "name": "Child",
                    "children": []
                }
            ]
        },
        {
            "id": "fd3acd72-2c5c-48c9-b3b1-57b35890a841",
            "name": "Child",
            "children": []
        }
    ]

what I need to do is to reverse this. here I'm showing a parent with all its childrens. but I need to show children and all it's parents inside it.


来源: stackexchange

问:
Connection failed: Connection refused in ubuntu
when I am trying to connect my php with mysql this I am getting error called connection failled. Please review the phpo code and suggest me what could be the issue is ?</p>
```<code>
<?php
$db = mysqli_connect("test", "root", "password", "testing");
if (!$db) {
    die("Connection failed: " . mysqli_connect_error());
}

$sql = "SELECT * FROM testing";

$result = mysqli_query($db, $sql);

if (!$result) {
    die("Query failed: " . mysqli_error($db));
}

echo "Bank Name" . “\t”;
echo "City, State" . “\t”;
echo "Swift Code" . "\n";
while ($row = mysqli_fetch_array($result)) {
    echo $row['test1'] . “\t”;
    echo $row['tet2'] . “\t”;
    echo $row['test3'] . "\n";
}

mysqli_close($db);

?>

</code>```

ContentLicense: CC BY-SA 4.0

Body:
when I am trying to connect my php with mysql this I am getting error called connection failled. Please review the phpo code and suggest me what could be the issue is ?

<?php
$db = mysqli_connect("test", "root", "password", "testing");
if (!$db) {
    die("Connection failed: " . mysqli_connect_error());
}

$sql = "SELECT * FROM testing";

$result = mysqli_query($db, $sql);

if (!$result) {
    die("Query failed: " . mysqli_error($db));
}

echo "Bank Name" . “\t”;
echo "City, State" . “\t”;
echo "Swift Code" . "\n";
while ($row = mysqli_fetch_array($result)) {
    echo $row['test1'] . “\t”;
    echo $row['tet2'] . “\t”;
    echo $row['test3'] . "\n";
}

mysqli_close($db);

?>


问:
Are the HTML tags and elements the same thing?
Difference between tags and elements in html

yesterday one of my friend asked me question about the difference between tags and elements in HTML/
I reached out internet but I didn't understood.


问:
Using Sys.sleep breaks rvest scrape
I am trying to scrape a website that has hundreds of pages. I have been using the following code to get through all pages, but in order to not overwhelm the website, there must be a pause between scrapes. I have been trying to induce this pause using Sys.sleep(15), but this causes the final dataframe to come out empty. Any ideas why this is happening?

Version one:

```<code>a <- lapply(paste0("https://website.com/page/",1:500),
                function(url){
                  url %>% read_html() %>%
                    html_nodes(".text") %>%
                    html_text()
                    Sys.sleep(15)
                })

raw_posts <- unlist(a)
a <- data.frame(raw_posts)
</code>```

This simply returns empty data frame.

Version two:

```<code>url_base <- "https://website.com/page/"

map_df(1:500, function(i) {

  Sys.sleep(15)
  cat(" bababooeey ")

  pg <- read_html(sprintf(url_base, i))

  data.frame(text=html_text(html_nodes(pg, ".text")),
             date=html_text(html_nodes(pg, "time")),
             stringsAsFactors=FALSE)

}) -> b
</code>```

This just pastes the same set of results found on the same page over and over.

Does anything stand out as being wrongly coded?

Title: Using Sys.sleep breaks rvest scrape

Body:
I am trying to scrape a website that has hundreds of pages. I have been using the following code to get through all pages, but in order to not overwhelm the website, there must be a pause between scrapes. I have been trying to induce this pause using Sys.sleep(15), but this causes the final dataframe to come out empty. Any ideas why this is happening?

Version one:

a <- lapply(paste0("https://website.com/page/",1:500),
                function(url){
                  url %>% read_html() %>%
                    html_nodes(".text") %>%
                    html_text()
                    Sys.sleep(15)
                })

raw_posts <- unlist(a)
a <- data.frame(raw_posts)

This simply returns empty data frame.

Version two:

url_base <- "https://website.com/page/"

map_df(1:500, function(i) {

  Sys.sleep(15)
  cat(" bababooeey ")

  pg <- read_html(sprintf(url_base, i))

  data.frame(text=html_text(html_nodes(pg, ".text")),
             date=html_text(html_nodes(pg, "time")),
             stringsAsFactors=FALSE)

}) -> b

This just pastes the same set of results found on the same page over and over.

Does anything stand out as being wrongly coded?


问:
Watcher resets when data is filled in other inputs
I have a form where the user enters data and sends it to the server, there are 2 selects, the options of which are filled with data from the server, there are 2 selects: 1 for countries, the other for cities, when a country is selected, the select is updated with the cities of the corresponding country. To do this, I created a watcher that is responsible for updating the list of cities:

```<code>'form.countryID': function(){
        this.cities = this.COUNTRIES.filter(item => {
            return item.id == this.form.countryID;
        })[0].cities;
    }
</code>```

COUNTRIES is a getter from vuex, I make a get request in the store.
This is my select with cities:

```<code>                <select
                    type="text"
                    class="questionnaire__questions-input questionnaire__input"
                    v-model="form.cityID"
                    :class="$v.form.cityID.$error ? 'questionnaire-input-invalid' : ''">
                    <option value="">Выберите город</option>

                    <option v-for="city in cities" :key="city.id" :value="form.cityID">{{city.name}}</option>

                </select>
</code>```

The problem is that I have other inputs in the form, and when I enter a value there, my select with cities is reset, I don’t understand what could be the problem? Other inputs are not tied to the select, or to the value of the cities.

Body:
I have a form where the user enters data and sends it to the server, there are 2 selects, the options of which are filled with data from the server, there are 2 selects: 1 for countries, the other for cities, when a country is selected, the select is updated with the cities of the corresponding country. To do this, I created a watcher that is responsible for updating the list of cities:

'form.countryID': function(){
        this.cities = this.COUNTRIES.filter(item => {
            return item.id == this.form.countryID;
        })[0].cities;
    }

COUNTRIES is a getter from vuex, I make a get request in the store.
This is my select with cities:

                <select
                    type="text"
                    class="questionnaire__questions-input questionnaire__input"
                    v-model="form.cityID"
                    :class="$v.form.cityID.$error ? 'questionnaire-input-invalid' : ''">
                    <option value="">Выберите город</option>

                    <option v-for="city in cities" :key="city.id" :value="form.cityID">{{city.name}}</option>

                </select>

The problem is that I have other inputs in the form, and when I enter a value there, my select with cities is reset, I don’t understand what could be the problem? Other inputs are not tied to the select, or to the value of the cities.


问:
I want push notification at the time set by the user while they add a task. After they set the Date and time I want to show notification
I want to send the user notification on that particular time and date after the user choose it while adding a new task. I want to get the notification title and description from the Firebase database and I want to display notification for every individual task.

Here is my code (HOW USER SELECT THE TIME AND DATE)

```<code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_new_task);
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    mAuth = FirebaseAuth.getInstance();
    mUser = mAuth.getCurrentUser () ;
    OnlineUserID = mUser.getUid() ;

    // Other Features Stuff
    long Sysdate = System.currentTimeMillis();

    SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
    String dateString = sdf.format(Sysdate);

    timePickerBTN = findViewById(R.id.TimePickerBTN);
    datePickerBTN = findViewById(R.id.DatePickerBTN);
    calendar = Calendar.getInstance();
    dateFormat = new SimpleDateFormat("dd/MM/yy");
    date = (String) android.text.format.DateFormat.format("hh:mm aa", calendar);
    timePickerBTN.setText(date);
    datePickerBTN.setText(dateString);

    timePickerBTN.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            TimePickerDialog timePickerDialog =  new TimePickerDialog(NewTaskActivity.this, new TimePickerDialog.OnTimeSetListener() {

                @Override
                public void onTimeSet(TimePicker timePicker, int hourOfDay, int Minute) {
                    TimeHour = hourOfDay;
                    TimeMinute = Minute;

                    Calendar calendarTime = Calendar.getInstance();
                    calendarTime.set(0,0,0, TimeHour, TimeMinute);
                    timePickerBTN.setText(android.text.format.DateFormat.format("hh:mm aa", calendarTime));
                    FINAL_TIME = timePickerBTN.getText().toString();

                }

            },12,0,false);

            timePickerDialog.updateTime(TimeHour, TimeMinute);
            timePickerDialog.show();

        }

    });
</code>```

AND THE FOLLOWING CODE IS FOR SENDING DATA TO FIREBASE

```<code>
DBrefrence = FirebaseDatabase.getInstance().getReference().child("tasks").child(OnlineUserID);
pdLoader = new ProgressDialog(this);
final EditText tskTitle = findViewById(R.id.taskTitle);
final EditText tskDescription = findViewById(R.id.taskDescription);
Button saveButton = findViewById(R.id.SaveTask_BTN);

datePickerBTN.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        DialogFragment datePicker = new com.veria.task.DatePicker();
        datePicker.show(getSupportFragmentManager() ,"Pick a date");
    }
});

saveButton.setOnClickListener((v) -> {

    String mTask = tskTitle.getText().toString().trim();
    String mDescription = tskDescription.getText().toString().trim();
    String id = DBrefrence.push().getKey();

    if (currentDate == null)
    {
        dateCurrentSelected = DateFormat.getDateInstance().format(new Date());
    }
    else if (currentDate!= null)
    {
        dateCurrentSelected = currentDate;
    }
    if (FINAL_TIME == null)
    {
        TimeCurrent = timePickerBTN.getText().toString();
    }
    else if (FINAL_TIME != null)
    {
        TimeCurrent = FINAL_TIME;
    }

    String Time = FINAL_TIME;

    if (TextUtils.isEmpty(mTask))
    {
        tskTitle.setError("Title Required");
        return;
    }
    if (TextUtils.isEmpty(mDescription))
    {
        tskDescription.setError("Description Required");
        return;
    }
    else
    {
    pdLoader.setTitle("Task");
    pdLoader.setMessage("Please wait");
    pdLoader.setCanceledOnTouchOutside(false);
    pdLoader.show();

    Model model = new Model(mTask, mDescription, id, dateCurrentSelected, TimeCurrent);
    DBrefrence.child(id).setValue(model).addOnCompleteListener(new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful())
            {
                Intent intent = new Intent(NewTaskActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
                Toast.makeText(NewTaskActivity.this, "Task has been successfully added", Toast.LENGTH_SHORT).show();
                pdLoader.dismiss();
            }
            else
            {
                Toast.makeText(NewTaskActivity.this, "Failed To Add Task", Toast.LENGTH_SHORT).show();
                pdLoader.dismiss();
            }

        }
    });

    }

        });
</code>```

I don't know how to send notification on the time and date selected by user

Body:
I want to send the user notification on that particular time and date after the user choose it while adding a new task. I want to get the notification title and description from the Firebase database and I want to display notification for every individual task.

Here is my code (HOW USER SELECT THE TIME AND DATE)

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_new_task);
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    mAuth = FirebaseAuth.getInstance();
    mUser = mAuth.getCurrentUser () ;
    OnlineUserID = mUser.getUid() ;

    // Other Features Stuff
    long Sysdate = System.currentTimeMillis();

    SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
    String dateString = sdf.format(Sysdate);

    timePickerBTN = findViewById(R.id.TimePickerBTN);
    datePickerBTN = findViewById(R.id.DatePickerBTN);
    calendar = Calendar.getInstance();
    dateFormat = new SimpleDateFormat("dd/MM/yy");
    date = (String) android.text.format.DateFormat.format("hh:mm aa", calendar);
    timePickerBTN.setText(date);
    datePickerBTN.setText(dateString);

    timePickerBTN.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            TimePickerDialog timePickerDialog =  new TimePickerDialog(NewTaskActivity.this, new TimePickerDialog.OnTimeSetListener() {

                @Override
                public void onTimeSet(TimePicker timePicker, int hourOfDay, int Minute) {
                    TimeHour = hourOfDay;
                    TimeMinute = Minute;

                    Calendar calendarTime = Calendar.getInstance();
                    calendarTime.set(0,0,0, TimeHour, TimeMinute);
                    timePickerBTN.setText(android.text.format.DateFormat.format("hh:mm aa", calendarTime));
                    FINAL_TIME = timePickerBTN.getText().toString();

                }

            },12,0,false);

            timePickerDialog.updateTime(TimeHour, TimeMinute);
            timePickerDialog.show();

        }

    });

AND THE FOLLOWING CODE IS FOR SENDING DATA TO FIREBASE

DBrefrence = FirebaseDatabase.getInstance().getReference().child("tasks").child(OnlineUserID);
pdLoader = new ProgressDialog(this);
final EditText tskTitle = findViewById(R.id.taskTitle);
final EditText tskDescription = findViewById(R.id.taskDescription);
Button saveButton = findViewById(R.id.SaveTask_BTN);

datePickerBTN.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        DialogFragment datePicker = new com.veria.task.DatePicker();
        datePicker.show(getSupportFragmentManager() ,"Pick a date");
    }
});

saveButton.setOnClickListener((v) -> {

    String mTask = tskTitle.getText().toString().trim();
    String mDescription = tskDescription.getText().toString().trim();
    String id = DBrefrence.push().getKey();

    if (currentDate == null)
    {
        dateCurrentSelected = DateFormat.getDateInstance().format(new Date());
    }
    else if (currentDate!= null)
    {
        dateCurrentSelected = currentDate;
    }
    if (FINAL_TIME == null)
    {
        TimeCurrent = timePickerBTN.getText().toString();
    }
    else if (FINAL_TIME != null)
    {
        TimeCurrent = FINAL_TIME;
    }

    String Time = FINAL_TIME;

    if (TextUtils.isEmpty(mTask))
    {
        tskTitle.setError("Title Required");
        return;
    }
    if (TextUtils.isEmpty(mDescription))
    {
        tskDescription.setError("Description Required");
        return;
    }
    else
    {
    pdLoader.setTitle("Task");
    pdLoader.setMessage("Please wait");
    pdLoader.setCanceledOnTouchOutside(false);
    pdLoader.show();

    Model model = new Model(mTask, mDescription, id, dateCurrentSelected, TimeCurrent);
    DBrefrence.child(id).setValue(model).addOnCompleteListener(new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful())
            {
                Intent intent = new Intent(NewTaskActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
                Toast.makeText(NewTaskActivity.this, "Task has been successfully added", Toast.LENGTH_SHORT).show();
                pdLoader.dismiss();
            }
            else
            {
                Toast.makeText(NewTaskActivity.this, "Failed To Add Task", Toast.LENGTH_SHORT).show();
                pdLoader.dismiss();
            }

        }
    });

    }

        });

I don't know how to send notification on the time and date selected by user


问:
502 gateway error | sentence-transformer package not working correctly
Hello I'm trying to solve this problem from last 5days if anyone know the solution please reply.

My website is working properly but one page giving 502 gateway error on post request. The code is working properly on local server but not working on nginx live server.

I thought it could be giving error cause that post request take long time to process so i increase timeout in nginx.server file but still it's not working

```<code>/etc/nginx/sites-available/myproject

server {
    listen 80;
    server_name 54.199.217.173;

    client_max_body_size 20M;

    location = /favicon.ico { access_log off; log_not_found off; }

    location /static/ {
        root /home/ubuntu/bankproject/Live-Banking-Solutions-Applications;
    }

    location /media/ {
        root /home/ubuntu/bankproject/Live-Banking-Solutions-Applications;
    }

    location / {
        include proxy_params;
        proxy_read_timeout 600s;
        proxy_connect_timeout 600s;
        proxy_pass http://unix:/run/gunicorn.sock;
}

}

</code>```

Nginx error.log file giving this error

For that page

```<code>
2022/12/26 07:21:57 [error] 2197#2197: *2 upstream prematurely closed connection while reading response header from upstream, client: 106.211.97.247, server: 54.199.217.173, request: "POST /admin/scaning_signature HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/admin/scaning_signature", host: "54.199.217.173", referrer: "http://54.199.217.173/admin/get_signature"

</code>```

I mentioned sentence-tranformers in question cause only that page is giving error where i use sentence-transformer. other pages post requests are working correctly

Body:
Hello I'm trying to solve this problem from last 5days if anyone know the solution please reply.

My website is working properly but one page giving 502 gateway error on post request. The code is working properly on local server but not working on nginx live server.

I thought it could be giving error cause that post request take long time to process so i increase timeout in nginx.server file but still it's not working

/etc/nginx/sites-available/myproject

server {
    listen 80;
    server_name 54.199.217.173;

    client_max_body_size 20M;

    location = /favicon.ico { access_log off; log_not_found off; }

    location /static/ {
        root /home/ubuntu/bankproject/Live-Banking-Solutions-Applications;
    }

    location /media/ {
        root /home/ubuntu/bankproject/Live-Banking-Solutions-Applications;
    }

    location / {
        include proxy_params;
        proxy_read_timeout 600s;
        proxy_connect_timeout 600s;
        proxy_pass http://unix:/run/gunicorn.sock;
}

}

Nginx error.log file giving this error

For that page

2022/12/26 07:21:57 [error] 2197#2197: *2 upstream prematurely closed connection while reading response header from upstream, client: 106.211.97.247, server: 54.199.217.173, request: "POST /admin/scaning_signature HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/admin/scaning_signature", host: "54.199.217.173", referrer: "http://54.199.217.173/admin/get_signature"

I mentioned sentence-tranformers in question cause only that page is giving error where i use sentence-transformer. other pages post requests are working correctly


问:
Searching index in pyspark
search index data based on data in pyspark?

i already have index column in my dataset

i try this code:

```<code>from pyspark.sql.functions import monotonically_increasing_id

index_movies = movies.filter(movies["title"] == close_match) \
          .select(monotonically_increasing_id().alias("index_movies")) \
          .first()["index_movies"]
print(index_movies)
</code>```

but, the result is 0. The close_match is the title of movie

Title: Searching index in pyspark

Body:
search index data based on data in pyspark?

i already have index column in my dataset

i try this code:

from pyspark.sql.functions import monotonically_increasing_id

index_movies = movies.filter(movies["title"] == close_match) \
          .select(monotonically_increasing_id().alias("index_movies")) \
          .first()["index_movies"]
print(index_movies)

but, the result is 0. The close_match is the title of movie


问:
ERD to django models ? Many to many relatioship with attribut
How should I translate this Entity Relationship Diagram to Django models ?


问:
my code is Recycler view inside a Nested Scroll view. I try to first in view in image view. but there is first view to video view?
my code  is  Recycler view inside a Nested Scroll view. I try to first in view in image view. but there is first view to video view .I want to first view to image view. any one have a solution.</p>


问:
"self-signed certificate in certificate chain" while attempting to install an extension via command line
My aim is to install multiple vscode extensions at once in a windows machine programmatically.

I developed a batch file to install these extensions.
When trying to install any vscode extension from cmd using the following command:
code --install-extension <extension-identifier>

I am facing the following issue:

I am able to install extensions using the same above command after disabling Proxy Strict SSL (File->preferences->settings) setting in vscode GUI.

To disable it programmatically I need to edit settings.json file and set "http.proxyStrictSSL": false.

Extension installation is failing on few machines even after Disabling Proxy Strict SSL in vscode gui is and editing settings.json through batch file is getting very complex.

Is there any alternative clean way to install vscode extensions programmatically, is there a better mechanism than batch script?


问:
I would like to place a .png image file on a QLabel. But doesn't show up (PyQt6/PyQt5)
I building an application and let's say it will have its logo placed in the middle. I would like to know how I can paste the image into the label.
For context, I'm not using the QT designer and hard-coding the entire application. So, I won't be able to generate any resource file (heard people talk about it in other forums).

class mainWindow(QMainWindow):

    def __init__(self):
        super().__init__()

        self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
        self.setFixedSize(1000, 550)

        self.displayImage()

    def displayImage(self):
        aWidgetForFun = QWidget(self)
           aWidgetForFun.setFixedSize(100, 100)
           #Let's assume the image is of size 50 x 50

        theImageLabel = QLabel(aWidgetForFun)
        theImageItself = QPixmap('Images\aLogo.png')
        #That was the location of the image (I'm using Windows, not Linux env)
        #I'm not placing the entire path as I thought it pay cause problem while converting it to an executable using pyinstaller
        #If I only wanted to paste the location form currentdirectory, how do I do it?
        theImageLabel.setPixmap(theImageItself)

        theImageLabel.resize(70, 70) #I wanted to resize the image (This one might be wrong)

application = QApplication()
applicationInitializer = mainWindow()
applicationInitializer.show()
exit(application.exec())
```

This code displays the 'aWidgetForFun' widget as well, but doesn't display the image. There were no errors as well.

I would also like help in pasting an SVG image in place of the .png image.

Body:
I building an application and let's say it will have its logo placed in the middle. I would like to know how I can paste the image into the label.
For context, I'm not using the QT designer and hard-coding the entire application. So, I won't be able to generate any resource file (heard people talk about it in other forums).

class mainWindow(QMainWindow):

    def __init__(self):
        super().__init__()

        self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
        self.setFixedSize(1000, 550)

        self.displayImage()

    def displayImage(self):
        aWidgetForFun = QWidget(self)
           aWidgetForFun.setFixedSize(100, 100)
           #Let's assume the image is of size 50 x 50

        theImageLabel = QLabel(aWidgetForFun)
        theImageItself = QPixmap('Images\aLogo.png')
        #That was the location of the image (I'm using Windows, not Linux env)
        #I'm not placing the entire path as I thought it pay cause problem while converting it to an executable using pyinstaller
        #If I only wanted to paste the location form currentdirectory, how do I do it?
        theImageLabel.setPixmap(theImageItself)

        theImageLabel.resize(70, 70) #I wanted to resize the image (This one might be wrong)

application = QApplication()
applicationInitializer = mainWindow()
applicationInitializer.show()
exit(application.exec())

This code displays the 'aWidgetForFun' widget as well, but doesn't display the image. There were no errors as well.

I would also like help in pasting an SVG image in place of the .png image.


问:
UserNotificationListener: The remote procedure call failed
I could not figure out why I get error on second line. On some PC everything works on other not.

I use WPF with Microsoft.Windows.SDK.Contracts 10.0.22621.755 installed.

```<code>UserNotificationListener notifiacationListener = UserNotificationListener.Current;
notifiacationListener.NotificationChanged += Listener_NotificationChanged;
</code>```

System.Exception: 'The remote procedure call failed. (Exception from HRESULT: 0x800706BE)'

I can request notification access without any trouble, but when I try to subscribe I will get the error.

```<code>UserNotificationListener notifiacationListener = UserNotificationListener.Current;
if (notifiacationListener.GetAccessStatus() == UserNotificationListenerAccessStatus.Allowed)
{
     notifiacationListener.NotificationChanged += Listener_NotificationChanged;
}
</code>```

I also tried called this before notification usage.

```<code>notificationStatus = await notifiacationListener.RequestAccessAsync()
</code>```

Body:
I could not figure out why I get error on second line. On some PC everything works on other not.

I use WPF with Microsoft.Windows.SDK.Contracts 10.0.22621.755 installed.

UserNotificationListener notifiacationListener = UserNotificationListener.Current;
notifiacationListener.NotificationChanged += Listener_NotificationChanged;

System.Exception: 'The remote procedure call failed. (Exception from HRESULT: 0x800706BE)'

I can request notification access without any trouble, but when I try to subscribe I will get the error.

UserNotificationListener notifiacationListener = UserNotificationListener.Current;
if (notifiacationListener.GetAccessStatus() == UserNotificationListenerAccessStatus.Allowed)
{
     notifiacationListener.NotificationChanged += Listener_NotificationChanged;
}

I also tried called this before notification usage.

notificationStatus = await notifiacationListener.RequestAccessAsync()


问:
I wanted shift connection from class to application.properties/yaml how to do is there any example for subscribing that data

String clientEndpoint = ""

String clientId = "";

String awsSecretAccessKey=

String awsAccessKeyId

i wanted to subscribe aws iot message where connection are  present application properties/yaml while i have working  code doing same with connection in class

```<code></code>```


问:
Error importing seaborn module: AttributeError
I installed seaborn as

```<code>!pip install seaborn --upgrade --quiet
</code>```

but when i tried to import it using

```<code>import seaborn as sns
</code>```

I get the following error.

```<code>---------------------------------------------------------------------------
AttributeError
Traceback (most recent call last)
<ipython-input-92-a84c0541e888> in <module>
----> 1 import seaborn as sns

14 frames
/usr/local/lib/python3.8/dist-packages/numpy/__init__.py in __getattr__(attr)
    311             x = ones(2, dtype=float32)
    312             if not abs(x.dot(x) - float32(2.0)) < 1e-5:
--> 313                 raise AssertionError()
    314         except AssertionError:
    315             msg = ("The current Numpy installation ({!r}) fails to "

AttributeError: module 'numpy' has no attribute '_no_nep50_warning'
</code>```

I tried uninstalling and re-installing but it didn't work.
Also, closed and started the notebook but it issue remains same.

Body:
I installed seaborn as

!pip install seaborn --upgrade --quiet

but when i tried to import it using

import seaborn as sns

I get the following error.

---------------------------------------------------------------------------
AttributeError
Traceback (most recent call last)
<ipython-input-92-a84c0541e888> in <module>
----> 1 import seaborn as sns

14 frames
/usr/local/lib/python3.8/dist-packages/numpy/__init__.py in __getattr__(attr)
    311             x = ones(2, dtype=float32)
    312             if not abs(x.dot(x) - float32(2.0)) < 1e-5:
--> 313                 raise AssertionError()
    314         except AssertionError:
    315             msg = ("The current Numpy installation ({!r}) fails to "

AttributeError: module 'numpy' has no attribute '_no_nep50_warning'

I tried uninstalling and re-installing but it didn't work.
Also, closed and started the notebook but it issue remains same.


问:
Facebook login through Instagram: Error validating verification code
I am using a web view (in an iOS Swift app) to let the users to login to their Instagram account or Facebook account to later get their display name to use it in my app.

I have an Instagram app (added inside a Facebook app in Meta for Developers console's dashboard), I finished setup for this Instagram app in the section: Instagram Basic Display -> Basic Display in the dashboard, and I got it to work well ONLY if I login with an Instagram account (added in the Instagram Test Users section), but when I try to login using Facebook (by pressing on the "Login with Facebook" button) and finish the login flow, calling the method https://api.instagram.com/oauth/access_token fails with the following error:

```<code>{
    "error_type": "OAuthException",
    "code": 400,
    "error_message": "Error validating verification code. \
  Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request"
}
</code>```

I double checked that I use the same redirect uri in both methods:
https://api.instagram.com/oauth/authorize
and
https://api.instagram.com/oauth/access_token

which is simply as this one: "https://my-domain.com/" (with a trailing slash)

I also set the same exact redirect uri in Facebook Login and Instagram Basic display in the console's dashboard.

The following options are enabled in Facebook login console:
Enforce HTTPS, Embedded Browser OAuth Login, Client OAuth login, Use Strict Mode for redirect URIs, Web OAuth login and Login from Devices.

I tried to use the Facebook client id and secret instead of IG's but to no avail.

any thoughts are appreciated.

Body:
I am using a web view (in an iOS Swift app) to let the users to login to their Instagram account or Facebook account to later get their display name to use it in my app.

I have an Instagram app (added inside a Facebook app in Meta for Developers console's dashboard), I finished setup for this Instagram app in the section: Instagram Basic Display -> Basic Display in the dashboard, and I got it to work well ONLY if I login with an Instagram account (added in the Instagram Test Users section), but when I try to login using Facebook (by pressing on the "Login with Facebook" button) and finish the login flow, calling the method https://api.instagram.com/oauth/access_token fails with the following error:

{
    "error_type": "OAuthException",
    "code": 400,
    "error_message": "Error validating verification code. \
  Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request"
}

I double checked that I use the same redirect uri in both methods:
https://api.instagram.com/oauth/authorize
and
https://api.instagram.com/oauth/access_token

which is simply as this one: "https://my-domain.com/" (with a trailing slash)

I also set the same exact redirect uri in Facebook Login and Instagram Basic display in the console's dashboard.

The following options are enabled in Facebook login console:
Enforce HTTPS, Embedded Browser OAuth Login, Client OAuth login, Use Strict Mode for redirect URIs, Web OAuth login and Login from Devices.

I tried to use the Facebook client id and secret instead of IG's but to no avail.

any thoughts are appreciated.


问:
AWS Glue - Getting partition information into a dynamic frame column
I am writing a Glue ETL job that takes an array of paths as an argument to create a DynamicFrame. The job will read data from the specified paths and create a DynamicFrame for further processing.

Having the following s3 folder structure:

```<code>s3://my_bucket/root/dt=2022-24-12/file.parquet
s3://my_bucket/root/dt=2022-25-12/file.parquet
s3://my_bucket/root/dt=2022-26-12/file.parquet ..
</code>```

.

I've created a Glue job script using glueContext.create_dynamic_frame.from_options to load the data like so:

```<code>dynamic_frame = glueContext.create_dynamic_frame.from_options(
    connection_type="s3",
    format='parquet',
    connection_options={
        "paths": ["s3://my_bucket/root/"], # <---- provided as an argument
        "recurse": True,
    },
    transformation_ctx="S3bucket_node1",
)
</code>```

which reads the DF correctly and produce the following DF:

column_A
Column_B

data
data

data
data

How can I add the partition data (dt) to the data frame, without using a catalog DB so the output would be:

column_A
Column_B
dt

data
data
2022-24-12

data
data
2022-24-12

I.E all data from a specific partition would get the correct date

Body:
I am writing a Glue ETL job that takes an array of paths as an argument to create a DynamicFrame. The job will read data from the specified paths and create a DynamicFrame for further processing.

Having the following s3 folder structure:

s3://my_bucket/root/dt=2022-24-12/file.parquet
s3://my_bucket/root/dt=2022-25-12/file.parquet
s3://my_bucket/root/dt=2022-26-12/file.parquet ..

.

I've created a Glue job script using glueContext.create_dynamic_frame.from_options to load the data like so:

dynamic_frame = glueContext.create_dynamic_frame.from_options(
    connection_type="s3",
    format='parquet',
    connection_options={
        "paths": ["s3://my_bucket/root/"], # <---- provided as an argument
        "recurse": True,
    },
    transformation_ctx="S3bucket_node1",
)

which reads the DF correctly and produce the following DF:

column_A
Column_B

data
data

data
data

How can I add the partition data (dt) to the data frame, without using a catalog DB so the output would be:

column_A
Column_B
dt

data
data
2022-24-12

data
data
2022-24-12

I.E all data from a specific partition would get the correct date


问:
write a hive query to get below output
0

how to get ipaddress values 10.223.128.154, 127.0.0.1, fe80::2888:420:810f:caf9, ::1 from [{'ipAddress': '10.223.128.154', 'macAddress': 'A4AE122BE234', 'type': 'Ethernet', 'operationalStatus': 'Up'}, {'ipAddress': 'fe80::2888:420:810f:caf9', 'macAddress': 'A4AE122BE234', 'type': 'Ethernet', 'operationalStatus': 'Up'}, {'ipAddress': '127.0.0.1', 'macAddress': None, 'type': 'SoftwareLoopback', 'operationalStatus': 'Up'}, {'ipAddress': '::1', 'macAddress': None, 'type': 'SoftwareLoopback', 'operationalStatus': 'Up'}] using hive

answer for above query

Title: write a hive query to get below output


问:
Is there a way to connect a high quality mic to qwiic connector
I am developing an microcontroller project which requires recording audio the only ports free are QWIIC and MCP3008 ADC is there any way to integrate the mic into the system so that the os recognises it
Thanks in advance

I tried searching on Google to fing some solution expecting to geta converter but found nothing as a result


问:
Timeline CSS alignment issue
I have created a timeline with CSS where the challenge is to maintain equal spacing between the years.

```<code>.timeline-2-header-wrapper {
   display: grid;
   grid-template-columns: 1fr 1fr;
   grid-gap: 10%;
}

.l-r-event-timeline-2,.l-event-r-blank-timeline-2,.l-blank-r-event-timeline-2 {
   display: grid;
   grid-template-columns: 1fr 1fr;
   grid-gap: 10%;
   margin: 1em 0px;
}
</code>```

.box {
  border: 1px solid black;
}

.timeline-background {
  background: aliceblue;
  padding: 30px 6.25% 20px;
  border-top: 1px solid #005b8e;
  border-bottom: 1px solid #005b8e;
  margin-bottom: 50px;
}

.timeline-2-main-wrapper {
  position: relative;
  margin: 40px 0px;
}

.timeline-2-main-wrapper::after {
  border-left: 1px solid #2B6085;
  position: absolute;
  left: 15px;
  top: 0px;
  bottom: 0px;
  content: "";
  z-index: 1;
}

.timeline-2-header-wrapper {
  font-weight: bold;
  position: relative;
  z-index: 5;
  background: white;
  padding: 0px 0px 1px;
}

.timeline-2-hcolumn-right,
.timeline-2-hcolumn-left {
  color: white;
  text-transform: uppercase;
  background: #005aab;
  padding: 10px 15px;
  width: 100%;
  text-align: center;
  letter-spacing: 1px;
}

.timeline-2-hcolumn-left {
  background: #707070;
}

.timeline-2-main-date {
  display: inline-flex;
  color: black;
  padding: 10px;
  font-weight: bold;
  justify-content: center;
  margin: 15px auto;
  border: 1px solid #355C90;
  background: white;
  z-index: 3;
  position: relative;
}

h2.timeline-2-main-date,
h3.timeline-2-main-date,
h4.timeline-2-main-date {
  font-size: 1.125em;
}

/* 3 different blocks - custom patterns for drag and drop */

.l-r-event-timeline-2,
.l-event-r-blank-timeline-2,
.l-blank-r-event-timeline-2 {
  margin: 1em 0px 1em 50px;
}

/* seperate events */

.l-event,
.r-event {
  border: 1px solid black;
  padding: 10px;
  position: relative;
  align-self: start;
  background: white;
}

.l-event {
  grid-column-start: 1;
  grid-column-end: 2;
}

.r-event {
  margin-top: 1em;
}

.l-event::before,
.r-event::before {
  position: absolute;
  content: "";
  border-radius: 9px;
  background: #005aab;
  box-shadow: 0px 0px 2px 8px aliceblue;
  width: 9px;
  height: 9px;
  z-index: 3;
  top: 24px;
}

.l-event::before {
  left: -40px;
  background: #707070;
}

.r-event::before {
  left: -40px;
}

.l-event-date,
.r-event-date {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 7px 10px 0px;
  background: white;
  color: black;
  font-weight: bold;
  margin-bottom: 0px;
  font-size: 1.125em;
}

.l-event-date {
  margin-left: -10px;
}

.l-event p,
.r-event p {
  margin-top: 0px;
}

.l-event-date span:first-of-type,
.r-event-date span:first-of-type {
  background: #005aab;
  color: white;
  padding: 5px 10px;
  margin: -3px 0px 10px -10px;
}

.l-event-date span:first-of-type {
  background: #707070;
  margin-right: -10px;
}

.l-event-date span:nth-of-type(2) {
  margin-left: -10px;
}

.r-event-date {
  margin-left: -10px;
  padding-right: 0px;
}

.l-event-date::before,
.r-event-date::before {
  position: absolute;
  content: "";
  width: 0px;
  height: 0px;
  top: 6px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-right: 15px solid #005aab;
  left: -18px;
  z-index: 4;
}

.l-event-date::before {
  border-right: 15px solid #707070;
}

.l-event h4,
.r-event h4,
.l-event h5,
.r-event h5 {
  text-transform: none;
  font-weight: bold;
  font-size: 1.125em;
  letter-spacing: 0.5;
  margin-bottom: 0px;
}

.r-event-date abbr {
  color: white;
  font-weight: bold;
}

/*--- MEDIA QUERY --- TIMELINE -- MEDIA QUERY TIMELINE ----*/

@media (min-width: 576px) {
  /* Small devices (landscape phones, 576px and up) */
  /* TIMELINE -- VERTICAL -- 2 LEVEL */
  .wrapper-olp {
    /* project specific body margins */
    margin: 0px;
  }
  .timeline-2-main-wrapper {
    display: flex;
    flex-direction: column;
    margin: 20px 0px 40px;
    max-width: 700px;
  }
  .timeline-2-main-wrapper::after {
    border-left: 1px solid #2B6085;
    position: absolute;
    left: 50%;
    top: 0px;
    bottom: 0px;
    content: "";
    z-index: 1;
  }
  .timeline-2-header-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 10%;
  }
  /* 3 different blocks - custom patterns for drag and drop */
  .l-r-event-timeline-2,
  .l-event-r-blank-timeline-2,
  .l-blank-r-event-timeline-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 10%;
    margin: 1em 0px;
  }
  /* seperate events */
  .l-event,
  .r-event {
    padding: 10px;
  }
  .l-event {
    grid-column-start: 1;
    grid-column-end: 2;
  }
  .r-event {
    grid-column-start: 2;
    grid-column-end: 3;
    margin-top: 0px;
  }
  .l-event::before,
  .r-event::before {
    background: #37474f;
  }
  .l-event::before {
    left: 110%;
  }
  .r-event::before {
    right: calc(110% + 2px);
    left: auto;
  }
  .l-event-date {
    margin-right: -10px;
  }
  .l-event-date::before {
    border-left: 18px solid #707070;
    border-right: none;
    right: -21px;
    left: auto;
  }
  .r-event-date::before {
    left: -18px;
  }
  .l-event-date span:first-of-type {
    margin-left: 0px;
  }
  .mt-70-ch {
    margin-top: -70px;
  }
}

/*-------------------------------------------------
TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy ENDS here ------- TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy ENDS here
-------------------------------------------------*/

@media (min-width: 768px) {
  /* iPad portrait */
  body {
    margin: 60px 45px;
  }
  .wrapper {
    width: 100vw;
    margin-left: -45px;
  }
  /* TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy starts here ------- TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy starts here */
  .timeline-background {
    padding: 30px 45px 20px;
  }
  .timeline-background h2 {
    max-width: 700px;
  }
  /* TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy starts here ------- TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy ENDS here */
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="timeline-background">
  <article class="timeline-2-main-wrapper">
    <h3 class="timeline-2-main-date">1850</h3>
    <h3 class="timeline-2-main-date">1860</h3>
    <h3 class="timeline-2-main-date">1870</h3>
    <div class="l-event-r-blank-timeline-2">
      <div class="l-event">
        <h4 class="l-event-date">
          <span class="sub-date">1876</span></h4>
        <p><b>France starts building the Statue.</b></p>
      </div>
    </div>
    <h3 class="timeline-2-main-date">1880</h3>
    <div class="l-blank-r-event-timeline-2">
      <div class="r-event">
        <h4 class="r-event-date">
          <span class="sub-date">1883</span></h4>
        <img alt="" src="../../img/chapter03/rc1_u03_l03_006p-899406.jpg" />
        <p class="text-center"><b>It takes a long time to build it.</b></p>
      </div>
    </div>
    <div class="l-event-r-blank-timeline-2 mt-70-ch">
      <div class="l-event">
        <h4 class="l-event-date">
          <span class="sub-date">1885</span></h4>
        <img alt="" src="../../img/chapter03/rc1_u03_l03_005p-899406.jpg" />
        <p class="dpg--text--bold">The Statue gets to America.</p>
      </div>
    </div>
    <div class="l-blank-r-event-timeline-2 mt-70-ch">
      <div class="r-event">
        <h4 class="r-event-date">
          <span class="sub-date">1886</span></h4>
        <img alt="" src="../../img/chapter03/na_rc1_c03_l03_005p-692872.jpg" />
        <p class="text-center dpg--text--bold">It opens!</p>
      </div>
    </div>
    <h3 class="timeline-2-main-date">1890</h3>
    <h3 class="timeline-2-main-date">1900</h3>
    <div class="l-r-event-timeline-2">
      <div class="l-event">
        <h4 class="l-event-date">
          <span class="sub-date">1903</span></h4>
        <p class="dpg--text--bold">The poem is put on the base.</p>
      </div>
    </div>
    <h3 class="timeline-2-main-date">1910</h3>
  </article>
</div></code>```

(Jsfiddle)

I tried with positioning and it doesn't work.

Title: Timeline CSS alignment issue

Body:
I have created a timeline with CSS where the challenge is to maintain equal spacing between the years.

.timeline-2-header-wrapper {
   display: grid;
   grid-template-columns: 1fr 1fr;
   grid-gap: 10%;
}

.l-r-event-timeline-2,.l-event-r-blank-timeline-2,.l-blank-r-event-timeline-2 {
   display: grid;
   grid-template-columns: 1fr 1fr;
   grid-gap: 10%;
   margin: 1em 0px;
}

.box {
  border: 1px solid black;
}

.timeline-background {
  background: aliceblue;
  padding: 30px 6.25% 20px;
  border-top: 1px solid #005b8e;
  border-bottom: 1px solid #005b8e;
  margin-bottom: 50px;
}

.timeline-2-main-wrapper {
  position: relative;
  margin: 40px 0px;
}

.timeline-2-main-wrapper::after {
  border-left: 1px solid #2B6085;
  position: absolute;
  left: 15px;
  top: 0px;
  bottom: 0px;
  content: "";
  z-index: 1;
}

.timeline-2-header-wrapper {
  font-weight: bold;
  position: relative;
  z-index: 5;
  background: white;
  padding: 0px 0px 1px;
}

.timeline-2-hcolumn-right,
.timeline-2-hcolumn-left {
  color: white;
  text-transform: uppercase;
  background: #005aab;
  padding: 10px 15px;
  width: 100%;
  text-align: center;
  letter-spacing: 1px;
}

.timeline-2-hcolumn-left {
  background: #707070;
}

.timeline-2-main-date {
  display: inline-flex;
  color: black;
  padding: 10px;
  font-weight: bold;
  justify-content: center;
  margin: 15px auto;
  border: 1px solid #355C90;
  background: white;
  z-index: 3;
  position: relative;
}

h2.timeline-2-main-date,
h3.timeline-2-main-date,
h4.timeline-2-main-date {
  font-size: 1.125em;
}

/* 3 different blocks - custom patterns for drag and drop */

.l-r-event-timeline-2,
.l-event-r-blank-timeline-2,
.l-blank-r-event-timeline-2 {
  margin: 1em 0px 1em 50px;
}

/* seperate events */

.l-event,
.r-event {
  border: 1px solid black;
  padding: 10px;
  position: relative;
  align-self: start;
  background: white;
}

.l-event {
  grid-column-start: 1;
  grid-column-end: 2;
}

.r-event {
  margin-top: 1em;
}

.l-event::before,
.r-event::before {
  position: absolute;
  content: "";
  border-radius: 9px;
  background: #005aab;
  box-shadow: 0px 0px 2px 8px aliceblue;
  width: 9px;
  height: 9px;
  z-index: 3;
  top: 24px;
}

.l-event::before {
  left: -40px;
  background: #707070;
}

.r-event::before {
  left: -40px;
}

.l-event-date,
.r-event-date {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 7px 10px 0px;
  background: white;
  color: black;
  font-weight: bold;
  margin-bottom: 0px;
  font-size: 1.125em;
}

.l-event-date {
  margin-left: -10px;
}

.l-event p,
.r-event p {
  margin-top: 0px;
}

.l-event-date span:first-of-type,
.r-event-date span:first-of-type {
  background: #005aab;
  color: white;
  padding: 5px 10px;
  margin: -3px 0px 10px -10px;
}

.l-event-date span:first-of-type {
  background: #707070;
  margin-right: -10px;
}

.l-event-date span:nth-of-type(2) {
  margin-left: -10px;
}

.r-event-date {
  margin-left: -10px;
  padding-right: 0px;
}

.l-event-date::before,
.r-event-date::before {
  position: absolute;
  content: "";
  width: 0px;
  height: 0px;
  top: 6px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-right: 15px solid #005aab;
  left: -18px;
  z-index: 4;
}

.l-event-date::before {
  border-right: 15px solid #707070;
}

.l-event h4,
.r-event h4,
.l-event h5,
.r-event h5 {
  text-transform: none;
  font-weight: bold;
  font-size: 1.125em;
  letter-spacing: 0.5;
  margin-bottom: 0px;
}

.r-event-date abbr {
  color: white;
  font-weight: bold;
}

/*--- MEDIA QUERY --- TIMELINE -- MEDIA QUERY TIMELINE ----*/

@media (min-width: 576px) {
  /* Small devices (landscape phones, 576px and up) */
  /* TIMELINE -- VERTICAL -- 2 LEVEL */
  .wrapper-olp {
    /* project specific body margins */
    margin: 0px;
  }
  .timeline-2-main-wrapper {
    display: flex;
    flex-direction: column;
    margin: 20px 0px 40px;
    max-width: 700px;
  }
  .timeline-2-main-wrapper::after {
    border-left: 1px solid #2B6085;
    position: absolute;
    left: 50%;
    top: 0px;
    bottom: 0px;
    content: "";
    z-index: 1;
  }
  .timeline-2-header-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 10%;
  }
  /* 3 different blocks - custom patterns for drag and drop */
  .l-r-event-timeline-2,
  .l-event-r-blank-timeline-2,
  .l-blank-r-event-timeline-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 10%;
    margin: 1em 0px;
  }
  /* seperate events */
  .l-event,
  .r-event {
    padding: 10px;
  }
  .l-event {
    grid-column-start: 1;
    grid-column-end: 2;
  }
  .r-event {
    grid-column-start: 2;
    grid-column-end: 3;
    margin-top: 0px;
  }
  .l-event::before,
  .r-event::before {
    background: #37474f;
  }
  .l-event::before {
    left: 110%;
  }
  .r-event::before {
    right: calc(110% + 2px);
    left: auto;
  }
  .l-event-date {
    margin-right: -10px;
  }
  .l-event-date::before {
    border-left: 18px solid #707070;
    border-right: none;
    right: -21px;
    left: auto;
  }
  .r-event-date::before {
    left: -18px;
  }
  .l-event-date span:first-of-type {
    margin-left: 0px;
  }
  .mt-70-ch {
    margin-top: -70px;
  }
}

/*-------------------------------------------------
TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy ENDS here ------- TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy ENDS here
-------------------------------------------------*/

@media (min-width: 768px) {
  /* iPad portrait */
  body {
    margin: 60px 45px;
  }
  .wrapper {
    width: 100vw;
    margin-left: -45px;
  }
  /* TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy starts here ------- TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy starts here */
  .timeline-background {
    padding: 30px 45px 20px;
  }
  .timeline-background h2 {
    max-width: 700px;
  }
  /* TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy starts here ------- TIMELINE -- VERTICAL -- TIMELEINE 2 LEVEL -- final timeline - copy ENDS here */
}

1850

1860

1870

          1876

France starts building the Statue.

1880

          1883

It takes a long time to build it.

          1885

The Statue gets to America.

          1886

It opens!

1890

1900

          1903

The poem is put on the base.

1910

(Jsfiddle)

I tried with positioning and it doesn't work.


问:
search value in multi array
I have an array like this (this example shows only key 0, there are more than one key):

```<code>Array
(
    [0] => Array
        (
            [additional] => Array
                (
                    [contact_detail] => Array
                        (
                            [adr] => Array
                                (
                                    [0] => Array
                                        (
                                            [data] => Array
                                                (
                                                    [city] =>
                                                    [country] =>
                                                    [extended] =>
                                                    [post_office_box] =>
                                                    [postal_code] =>
                                                    [region] =>
                                                    [street] =>
                                                )

                                            [is_readonly] =>
                                        )

                                )

                            [full_name] =>
                            [mail] => Array
                                (
                                    [0] => Array
                                        (
                                            [data] =>
                                            [is_readonly] =>
                                        )

                                )

                            [name] => Array
                                (
                                    [additional_name] =>
                                    [family_name] =>
                                    [given_name] => Max
                                    [prefix] =>
                                    [suffix] =>
                                )

                            [note] =>
                            [photo] =>
                            [tel] => Array
                                (
                                    [0] => Array
                                        (
                                            [data] =>
                                            [is_readonly] =>
                                        )

                                )

                            [title] => 1234
                        )

                    [label] => Array
                        (
                            [0] => Array
                                (
                                    [color] =>
                                    [id] =>
                                    [name] =>
                                    [type] =>
                                )

                        )

                )

            [addressbook_id] =>
            [company] =>
            [department] =>
            [full_name] =>
            [id] =>
            [is_editable] =>
            [is_hidden] =>
            [photo] =>
            [primary_mail] =>
            [primary_tel] =>
            [title] =>
            [usage_frequency] =>
        )
)
</code>```

How can I found the key of this array, where given_name == max or title == 1234?
I didn't found an working example yet :(

Title: search value in multi array

Body:
I have an array like this (this example shows only key 0, there are more than one key):

Array
(
    [0] => Array
        (
            [additional] => Array
                (
                    [contact_detail] => Array
                        (
                            [adr] => Array
                                (
                                    [0] => Array
                                        (
                                            [data] => Array
                                                (
                                                    [city] =>
                                                    [country] =>
                                                    [extended] =>
                                                    [post_office_box] =>
                                                    [postal_code] =>
                                                    [region] =>
                                                    [street] =>
                                                )

                                            [is_readonly] =>
                                        )

                                )

                            [full_name] =>
                            [mail] => Array
                                (
                                    [0] => Array
                                        (
                                            [data] =>
                                            [is_readonly] =>
                                        )

                                )

                            [name] => Array
                                (
                                    [additional_name] =>
                                    [family_name] =>
                                    [given_name] => Max
                                    [prefix] =>
                                    [suffix] =>
                                )

                            [note] =>
                            [photo] =>
                            [tel] => Array
                                (
                                    [0] => Array
                                        (
                                            [data] =>
                                            [is_readonly] =>
                                        )

                                )

                            [title] => 1234
                        )

                    [label] => Array
                        (
                            [0] => Array
                                (
                                    [color] =>
                                    [id] =>
                                    [name] =>
                                    [type] =>
                                )

                        )

                )

            [addressbook_id] =>
            [company] =>
            [department] =>
            [full_name] =>
            [id] =>
            [is_editable] =>
            [is_hidden] =>
            [photo] =>
            [primary_mail] =>
            [primary_tel] =>
            [title] =>
            [usage_frequency] =>
        )
)

How can I found the key of this array, where given_name == max or title == 1234?
I didn't found an working example yet :(


问:
buildozer build not progressing when building a simple kivy app
I'm trying to build an extremely basic kivy hello world program using buildozer for Android, and it's been stuck for an hour.

This is the program code:

```<code>import kivy
kivy.require("2.1.0")

from kivy.uix.label import Label
from kivy.app import App

class HelloWorldApp(App):
    def build(self):
        return Label(text="Hello World")

if __name__ == "__main__":
    HelloWorldApp().run()

</code>```

After creating the spec file with buildozer init, I edited the title, package.name and package.domain

I then run the command

```<code>buildozer -v android debug

</code>```

It then runs for bit, before getting stuck. I've left the terminal open for an hour and it hasn't progressed at all

This is the entire terminal output after I pressed ctrl c and ran buildozer -v android debug again

```<code># Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
/bin/sh: dpkg: command not found
# Search for Git (git)
#  -> found at /opt/homebrew/Cellar/git/2.39.0/bin/git
# Search for Cython (cython)
#  -> found at /Users/leonlee/Library/Python/3.10/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url'
# Cwd /Users/leonlee/Documents/Programming/Python/Kivy/hello_world/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /Users/leonlee/Documents/Programming/Python/Kivy/hello_world/.buildozer/android/platform/python-for-android
* master cc6481b0 [origin/master] Merge pull request #2718 from kivy/release-2022.12.20
# Run '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -m pip install -q --user \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'sh>=1.10; sys_platform!="nt"\' \'pep517\' \'toml\' \'packaging\''
# Cwd None
# Apache ANT found at /Users/leonlee/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /Users/leonlee/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 25b
# Android NDK found at /Users/leonlee/.buildozer/android/platform/android-ndk-r25b
# Read available permissions from api-versions.xml
# Run '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -m pythonforandroid.toolchain aab -h --color=always --storage-dir="/Users/leonlee/Documents/Programming/Python/Kivy/hello_world/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a" --ndk-api=21 --ignore-setup-py --debug'
# Cwd /Users/leonlee/Documents/Programming/Python/Kivy/hello_world/.buildozer/android/platform/python-for-android
</code>```

The first time I run buildozer -v android debug, it had some different lines, but ends up getting stuck at the same place.

I've tried removing the spec file and the .buildozer folder and rerunning buildozer init, but it does the same thing.

I've also tried adding kivy==2.1.0 in the application requirements line of the spec.

Both of these things don't fix the issue.

I've also tried searching for other posts with this issue, but haven't been able to find one with my issue. All the posts I've found actually give an error message, while my terminal just does nothing

My laptop is a Macbook Pro with an M1 Pro running the latest version of macOS Ventura, and I'm using Python 3.10.0. I'm also using openjdk 1.8.0_292

Body:
I'm trying to build an extremely basic kivy hello world program using buildozer for Android, and it's been stuck for an hour.

This is the program code:

import kivy
kivy.require("2.1.0")

from kivy.uix.label import Label
from kivy.app import App

class HelloWorldApp(App):
    def build(self):
        return Label(text="Hello World")

if __name__ == "__main__":
    HelloWorldApp().run()

After creating the spec file with buildozer init, I edited the title, package.name and package.domain

I then run the command

buildozer -v android debug

It then runs for bit, before getting stuck. I've left the terminal open for an hour and it hasn't progressed at all

This is the entire terminal output after I pressed ctrl c and ran buildozer -v android debug again

# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
/bin/sh: dpkg: command not found
# Search for Git (git)
#  -> found at /opt/homebrew/Cellar/git/2.39.0/bin/git
# Search for Cython (cython)
#  -> found at /Users/leonlee/Library/Python/3.10/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url'
# Cwd /Users/leonlee/Documents/Programming/Python/Kivy/hello_world/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /Users/leonlee/Documents/Programming/Python/Kivy/hello_world/.buildozer/android/platform/python-for-android
* master cc6481b0 [origin/master] Merge pull request #2718 from kivy/release-2022.12.20
# Run '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -m pip install -q --user \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'sh>=1.10; sys_platform!="nt"\' \'pep517\' \'toml\' \'packaging\''
# Cwd None
# Apache ANT found at /Users/leonlee/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /Users/leonlee/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 25b
# Android NDK found at /Users/leonlee/.buildozer/android/platform/android-ndk-r25b
# Read available permissions from api-versions.xml
# Run '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -m pythonforandroid.toolchain aab -h --color=always --storage-dir="/Users/leonlee/Documents/Programming/Python/Kivy/hello_world/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a" --ndk-api=21 --ignore-setup-py --debug'
# Cwd /Users/leonlee/Documents/Programming/Python/Kivy/hello_world/.buildozer/android/platform/python-for-android

The first time I run buildozer -v android debug, it had some different lines, but ends up getting stuck at the same place.

I've tried removing the spec file and the .buildozer folder and rerunning buildozer init, but it does the same thing.

I've also tried adding kivy==2.1.0 in the application requirements line of the spec.

Both of these things don't fix the issue.

I've also tried searching for other posts with this issue, but haven't been able to find one with my issue. All the posts I've found actually give an error message, while my terminal just does nothing

My laptop is a Macbook Pro with an M1 Pro running the latest version of macOS Ventura, and I'm using Python 3.10.0. I'm also using openjdk 1.8.0_292


问:
Why OpenGL 3D texture sampling to wrong color?
I have some trouble when using 3D-LUT in GLSL shader, so I'm trying to test a minimal 3D-LUT, which is of size 2x2x2, totally 8 colors. My pixel data is

```<code>static const unsigned char lutData222[] = {
  0,  0,  0,    255,  0,  0,
  0,255,  0,    255,255,  0,
  0,  0,255,    255,  0,255,
  0,255,255,    255,255,255,
};
</code>```

The 3D-texture settings are

```<code>m_lut.create();
m_lut.bind();
m_lut.setFormat(QOpenGLTexture::TextureFormat::RGB8_UNorm);
m_lut.setMinificationFilter(QOpenGLTexture::Filter::Nearest);
m_lut.setMagnificationFilter(QOpenGLTexture::Filter::Nearest);
m_lut.setWrapMode(QOpenGLTexture::WrapMode::ClampToEdge);
m_lut.setSize(LUT_EXTENT,LUT_EXTENT,LUT_EXTENT);
m_lut.allocateStorage(QOpenGLTexture::PixelFormat::RGB,
                      QOpenGLTexture::PixelType::UInt8);
m_lut.setData(QOpenGLTexture::PixelFormat::RGB,
              QOpenGLTexture::PixelType::UInt8,
              lutData222);
m_lut.release();
</code>```

where m_lut is of type QOpenGLTexture, Yes this a Qt project. Blow is my fragment shader, it just using the texture coordinates plus a third dimension to sample the lut. So I can change the third dimension to be 0 or 1, to see if the color is as expected.

```<code>#version 330 core
in vec2 uv;
uniform sampler3D lut;
out vec4 FragColor;
void main() {
  vec4 col = texture(lut, vec3(uv, 0));
  col.a = 1;
  FragColor = col;
};
</code>```

But it is not. When the third dimension is 0, the reuslt picture is

And when the third dimension is 1, the reuslt picture is

Body:
I have some trouble when using 3D-LUT in GLSL shader, so I'm trying to test a minimal 3D-LUT, which is of size 2x2x2, totally 8 colors. My pixel data is

static const unsigned char lutData222[] = {
  0,  0,  0,    255,  0,  0,
  0,255,  0,    255,255,  0,
  0,  0,255,    255,  0,255,
  0,255,255,    255,255,255,
};

The 3D-texture settings are

m_lut.create();
m_lut.bind();
m_lut.setFormat(QOpenGLTexture::TextureFormat::RGB8_UNorm);
m_lut.setMinificationFilter(QOpenGLTexture::Filter::Nearest);
m_lut.setMagnificationFilter(QOpenGLTexture::Filter::Nearest);
m_lut.setWrapMode(QOpenGLTexture::WrapMode::ClampToEdge);
m_lut.setSize(LUT_EXTENT,LUT_EXTENT,LUT_EXTENT);
m_lut.allocateStorage(QOpenGLTexture::PixelFormat::RGB,
                      QOpenGLTexture::PixelType::UInt8);
m_lut.setData(QOpenGLTexture::PixelFormat::RGB,
              QOpenGLTexture::PixelType::UInt8,
              lutData222);
m_lut.release();

where m_lut is of type QOpenGLTexture, Yes this a Qt project. Blow is my fragment shader, it just using the texture coordinates plus a third dimension to sample the lut. So I can change the third dimension to be 0 or 1, to see if the color is as expected.

#version 330 core
in vec2 uv;
uniform sampler3D lut;
out vec4 FragColor;
void main() {
  vec4 col = texture(lut, vec3(uv, 0));
  col.a = 1;
  FragColor = col;
};

But it is not. When the third dimension is 0, the reuslt picture is

And when the third dimension is 1, the reuslt picture is


问:
How to add legend in altair plots in python made with tranform_filter?
I have created a different kind of density plot with altair in python, using transform_filter.
I got the expected plot, but cannot add the legend in that plot.

The code written by me and the plot I got are :

```<code>import pandas as pd
import altair as alt
from altair import datum

def density_box_plot(
    data : pd.DataFrame,
    feature : str,
    base_color_scheme : str='coral',
    q1_color_scheme : str='red',
    q12_color_scheme : str='green',
    q23_color_scheme : str='yellow',
    q3_color_scheme : str='blue',
    box_plot_color_scheme : str='ForestGreen',
    figsize : tuple = (500,500),
    box_height : int = 50
) :

    # Calculating Q1 and Q3 for the feature passed as input
    q1 = data[feature].quantile(0.25)
    q2 = data[feature].quantile(0.50)
    q3 = data[feature].quantile(0.75)

    # Configuring the base density plot
    base = alt.Chart(data).transform_density(
                        density = feature,
                        as_ = [feature, 'density']
                    ).mark_area(
                        color = base_color_scheme
                    ).encode(
                        alt.X(
                            shorthand=feature,
                            type='quantitative',
                            axis = alt.Axis(
                                        grid = False,
                                        ticks=False,
                                        labels=False,
                                        title=None,
                                        domain=False
                                    ),
                            scale = alt.Scale(zero=False)
                        ),
                        alt.Y(
                            shorthand='density',
                            type='quantitative',
                            axis = alt.Axis(
                                        grid = False,
                                        ticks=False,
                                        labels=False,
                                        domain=False
                                    ),
                            scale = alt.Scale(zero=False)
                        )
                    )

    # Transforming the base density plot to Q1 area
    q1_area=base.mark_area(
                    color=q1_color_scheme
                ).transform_filter(
                    (datum[feature] > 0) & (datum[feature] < q1)
                )#.encode(color=alt.Color(shorthand=feature, type='quantitative',legend=alt.Legend(title="Q1 area")))

    q12_area=base.mark_area(
                        color=q12_color_scheme
                    ).transform_filter(
                        (datum[feature] >= q1) & (datum[feature] <= q2)
                    )

    q23_area=base.mark_area(
                        color=q23_color_scheme
                    ).transform_filter(
                        (datum[feature] >= q2) & (datum[feature] <= q3)
                    )

    # Transforming the base density plot to Q3 area
    q3_area=base.mark_area(
                    color=q3_color_scheme
                ).transform_filter(
                    (datum[feature] > q3)
                )

    # Configuring the final plot with Q1 area, Q3 area and Inter-quartile area
    density=(base+q1_area+q3_area).properties(
                                        title='Distribution of '+feature,
                                        width=figsize[0],
                                        height=figsize[1]
                                    )

    # Configuring for the Mean and Median lines
    selection = alt.selection_multi(fields=['series'], bind='legend')
    aggregates = alt.Chart(data).transform_aggregate(
        mean='mean('+feature+')',
        median='median('+feature+')'
    ).transform_fold(
        ['mean', 'median']
    ).mark_rule().encode(
        alt.X(
            shorthand='value',
            type='quantitative'
        ),
        color=alt.Color(
                    shorthand='key',
                    type='nominal',
                    legend=alt.Legend(title='Aggregates')
                )
    )

    # Configuration for box plot
    box_plot = alt.Chart(data).mark_boxplot(
                    color=box_plot_color_scheme
                ).encode(
                        alt.X(
                            shorthand=feature,
                            type="quantitative",
                            axis=alt.Axis(
                                        title=feature,
                                        grid=False
                                    )
                        ),
                        tooltip=alt.Tooltip(
                                    shorthand=feature,
                                    type = "quantitative"
                                )
                    ).properties(
                        width = figsize[0],
                        height = box_height
                    ).interactive()

    return (density+aggregates & box_plot).configure(concat=alt.CompositionConfig(spacing=0))

</code>```

Final Output
The first part shows the area within the 1st Quartile, the middle part shows the area of the Inter-quartile-region and the last part shows the area after the 3rd Quartile. The areas are marked with different colors.
How to add legend for the colors marking these areas?

Body:
I have created a different kind of density plot with altair in python, using transform_filter.
I got the expected plot, but cannot add the legend in that plot.

The code written by me and the plot I got are :

import pandas as pd
import altair as alt
from altair import datum

def density_box_plot(
    data : pd.DataFrame,
    feature : str,
    base_color_scheme : str='coral',
    q1_color_scheme : str='red',
    q12_color_scheme : str='green',
    q23_color_scheme : str='yellow',
    q3_color_scheme : str='blue',
    box_plot_color_scheme : str='ForestGreen',
    figsize : tuple = (500,500),
    box_height : int = 50
) :

    # Calculating Q1 and Q3 for the feature passed as input
    q1 = data[feature].quantile(0.25)
    q2 = data[feature].quantile(0.50)
    q3 = data[feature].quantile(0.75)

    # Configuring the base density plot
    base = alt.Chart(data).transform_density(
                        density = feature,
                        as_ = [feature, 'density']
                    ).mark_area(
                        color = base_color_scheme
                    ).encode(
                        alt.X(
                            shorthand=feature,
                            type='quantitative',
                            axis = alt.Axis(
                                        grid = False,
                                        ticks=False,
                                        labels=False,
                                        title=None,
                                        domain=False
                                    ),
                            scale = alt.Scale(zero=False)
                        ),
                        alt.Y(
                            shorthand='density',
                            type='quantitative',
                            axis = alt.Axis(
                                        grid = False,
                                        ticks=False,
                                        labels=False,
                                        domain=False
                                    ),
                            scale = alt.Scale(zero=False)
                        )
                    )

    # Transforming the base density plot to Q1 area
    q1_area=base.mark_area(
                    color=q1_color_scheme
                ).transform_filter(
                    (datum[feature] > 0) & (datum[feature] < q1)
                )#.encode(color=alt.Color(shorthand=feature, type='quantitative',legend=alt.Legend(title="Q1 area")))

    q12_area=base.mark_area(
                        color=q12_color_scheme
                    ).transform_filter(
                        (datum[feature] >= q1) & (datum[feature] <= q2)
                    )

    q23_area=base.mark_area(
                        color=q23_color_scheme
                    ).transform_filter(
                        (datum[feature] >= q2) & (datum[feature] <= q3)
                    )

    # Transforming the base density plot to Q3 area
    q3_area=base.mark_area(
                    color=q3_color_scheme
                ).transform_filter(
                    (datum[feature] > q3)
                )

    # Configuring the final plot with Q1 area, Q3 area and Inter-quartile area
    density=(base+q1_area+q3_area).properties(
                                        title='Distribution of '+feature,
                                        width=figsize[0],
                                        height=figsize[1]
                                    )

    # Configuring for the Mean and Median lines
    selection = alt.selection_multi(fields=['series'], bind='legend')
    aggregates = alt.Chart(data).transform_aggregate(
        mean='mean('+feature+')',
        median='median('+feature+')'
    ).transform_fold(
        ['mean', 'median']
    ).mark_rule().encode(
        alt.X(
            shorthand='value',
            type='quantitative'
        ),
        color=alt.Color(
                    shorthand='key',
                    type='nominal',
                    legend=alt.Legend(title='Aggregates')
                )
    )

    # Configuration for box plot
    box_plot = alt.Chart(data).mark_boxplot(
                    color=box_plot_color_scheme
                ).encode(
                        alt.X(
                            shorthand=feature,
                            type="quantitative",
                            axis=alt.Axis(
                                        title=feature,
                                        grid=False
                                    )
                        ),
                        tooltip=alt.Tooltip(
                                    shorthand=feature,
                                    type = "quantitative"
                                )
                    ).properties(
                        width = figsize[0],
                        height = box_height
                    ).interactive()

    return (density+aggregates & box_plot).configure(concat=alt.CompositionConfig(spacing=0))

Final Output
The first part shows the area within the 1st Quartile, the middle part shows the area of the Inter-quartile-region and the last part shows the area after the 3rd Quartile. The areas are marked with different colors.
How to add legend for the colors marking these areas?


问:
How can I make a product slider?
I want to create a javascript product slider that moves 150px every 5s and returns to the first slide when the slider is finished.
like this picture: https://magerta.ir/wp-content/uploads/2021/09/WordPress-WooCommerce-Product-Slider-Plugins-Cover.jpg

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

```
</div>
</div>
</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let thumbnail = document.querySelectorAll(".best-Books .slider .thumbnail");
let slider = document.querySelector(".slider");
let prev = document.querySelector("#left-arrow");
let next = document.querySelector("#right-arrow");
let maxSlide = slider.scrollWidth;

const maxScrollLeft = slider.scrollWidth - slider.clientWidth;

console.log(maxScrollLeft , slider.scrollLeft);
function autoPlay() {
  if(slider.scrollLeft > (maxScrollLeft - 1)){
    slider.scrollLeft -= maxScrollLeft;
  }
  else{
    slider.scrollLeft += 70;
  }
}

 prev.addEventListener("click", () => {
  slider.scrollLeft -= 100;
});
next.addEventListener("click", () => {
  slider.scrollLeft += 300;
});
let play = setInterval(autoPlay, 50);
for (let i = 0; i < thumbnail.length; i++) {
  thumbnail[i].addEventListener("mouseover", () => {
    clearInterval(play);
  });
  thumbnail[i].addEventListener("mouseout", () => {
    return (play = setInterval(autoPlay, 50));
  });
}</code>```

I made this myself, but where I had a problem was the slider repetition part.

Title: How can I make a product slider?

Body:
I want to create a javascript product slider that moves 150px every 5s and returns to the first slide when the slider is finished.
like this picture: https://magerta.ir/wp-content/uploads/2021/09/WordPress-WooCommerce-Product-Slider-Plugins-Cover.jpg

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

آسمان خراش

نویسنده

150 تومان200 تومان

let thumbnail = document.querySelectorAll(".best-Books .slider .thumbnail");
let slider = document.querySelector(".slider");
let prev = document.querySelector("#left-arrow");
let next = document.querySelector("#right-arrow");
let maxSlide = slider.scrollWidth;

const maxScrollLeft = slider.scrollWidth - slider.clientWidth;

console.log(maxScrollLeft , slider.scrollLeft);
function autoPlay() {
  if(slider.scrollLeft > (maxScrollLeft - 1)){
    slider.scrollLeft -= maxScrollLeft;
  }
  else{
    slider.scrollLeft += 70;
  }
}

 prev.addEventListener("click", () => {
  slider.scrollLeft -= 100;
});
next.addEventListener("click", () => {
  slider.scrollLeft += 300;
});
let play = setInterval(autoPlay, 50);
for (let i = 0; i < thumbnail.length; i++) {
  thumbnail[i].addEventListener("mouseover", () => {
    clearInterval(play);
  });
  thumbnail[i].addEventListener("mouseout", () => {
    return (play = setInterval(autoPlay, 50));
  });
}

I made this myself, but where I had a problem was the slider repetition part.


问:
Do I have to backup the full dataset of NebulaGraph database on the AWS cloud every time?
I am using Nebula Graph on AWS and need to back up the data every day in case any data is lost. I use the Backup & Restore feature to do this but it does not support incremental data backup. I really don't want to back up all the data every time.
Is there a way to do the backup based on the latest backup?
I searched for their documentation but got nothing.</p>


问:
Node path of hierarchy tree - recursive cte
I would like to create a json path for every node in the tree,
The goal of every path is to store all the ancestors of the current node.

I've already found a solution to solve this matter in this question:
Nested leaf node.

However, it only works for leaf nodes, and I need a query for every single node in the tree.
Looking for a solution in pgsql.

I did try to solve it on my own by the query I found mentioned above, and could not figure it out.

Glad for any hel


问:
MUI System - Styled component
I have created MyComponent( called 'InnerContainer' ) by using MUI system; styled-component. But onClick under the styled component is not working. It is working outside 'InnerContainer' but not working inside 'InnerContainer'. Don't know the reason.. please help me why it's not working.</p>
```<code>import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { styled } from "@mui/system";
// import styled from '@emotion/styled'
import DeleteIcon from "@mui/icons-material/Delete";

function DraggableBox(props) {
  const { attributes, listeners, setNodeRef, transform, transition } =
    useSortable({ id: props.id });

  // console.log("props", props);

  const outerContainer = {
    transform: CSS.Transform.toString(transform),
    transition,
    backgroundColor: props.color,
    width: "20%",
    height: "25%",
    display: "inline-block",
  };

  const InnerContainer = styled("div")({
    width: "100%",
    height: "100%",
    display: "flex",
    justifyContent: "space-between",
    alignItems: "end",
    fontWeight: "600",
    "&:hover svg": {
      color: "white",
      transform: "scale(1.3)",
      transition: "0.5s",
    },
    " .inBoxName": {
      marginLeft: "0.5rem",
    },
    " .inBoxTrash": {
      marginRight: "0.5rem",
    },
  });

  return (
    <div style={outerContainer} ref={setNodeRef} {...attributes} {...listeners}>
      <InnerContainer>
        <div className="inBoxName">{props.name}</div>
        <div className="inBoxTrash">
          <DeleteIcon onClick={() => props.removeColorBox(props.id)} />
        </div>
      </InnerContainer>
    </div>
  );
}

export default DraggableBox;
</code>```

Title: MUI System - Styled component

Body:
I have created MyComponent( called 'InnerContainer' ) by using MUI system; styled-component. But onClick under the styled component is not working. It is working outside 'InnerContainer' but not working inside 'InnerContainer'. Don't know the reason.. please help me why it's not working.

import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { styled } from "@mui/system";
// import styled from '@emotion/styled'
import DeleteIcon from "@mui/icons-material/Delete";

function DraggableBox(props) {
  const { attributes, listeners, setNodeRef, transform, transition } =
    useSortable({ id: props.id });

  // console.log("props", props);

  const outerContainer = {
    transform: CSS.Transform.toString(transform),
    transition,
    backgroundColor: props.color,
    width: "20%",
    height: "25%",
    display: "inline-block",
  };

  const InnerContainer = styled("div")({
    width: "100%",
    height: "100%",
    display: "flex",
    justifyContent: "space-between",
    alignItems: "end",
    fontWeight: "600",
    "&:hover svg": {
      color: "white",
      transform: "scale(1.3)",
      transition: "0.5s",
    },
    " .inBoxName": {
      marginLeft: "0.5rem",
    },
    " .inBoxTrash": {
      marginRight: "0.5rem",
    },
  });

  return (

      <InnerContainer>

{props.name}

          <DeleteIcon onClick={() => props.removeColorBox(props.id)} />

      </InnerContainer>

  );
}

export default DraggableBox;


问:
Criteria API Differentiate Column for Two Entities that Shared the Same Base Entity
For example I have these entities:

```<code>@Getter
@Setter
@MappedSuperclass
public class BaseEntity {

  @Id
  @Column(name = "id")
  private String id = UUID.randomUUID().toString();

  @Column(name = "soft_delete", nullable = false)
  private Boolean softDelete = false;

}

public class Entity1 extends BaseEntity {

  @Column(name = "name", nullable = false, unique = true)
  private String name;

}

public class Entity2 extends BaseEntity {

  @Column(name = "other_attribute", nullable = false, unique = true)
  private String otherAttribute;

}
</code>```

And I tried to create pseudo-queries like:

```<code>SELECT * FROM entity1 JOIN entity2 on entity1.id = entity2.other_id
WHERE entity1.softDelete IS FALSE
AND entity2.softDelete IS FALSE
</code>```

What I've created using Criteria API is as follow:

private Class repoClass() {

    public void getEntity1() {
      CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
      CriteriaQuery<Entity1> query =
          criteriaBuilder.createQuery(Entity1.class);
      Root<Entity1> entity1Root = query.from(Entity1.class);

      List<Predicate> predicates = new ArrayList<>();
      Join<Entity1, Entity2> entityJoin =
          entity1Root.join(Entity1_.Entity2);
      predicates.add(builder.isFalse(entity1Root.get(Entity1_.softDelete)));
      predicates.add(builder.isFalse(entityJoin.get(Entity2_.softDelete)));

      query.select(entity1Root).where(predicates.toArray(new Predicate[0]));
      this.entityManager.createQuery(query).getResultList();
    }
  }
```
<p>This does not work, because rather than getting these predicates,</p>
```WHERE entity1.softDelete IS FALSE
AND entity2.softDelete IS FALSE
```
<p>the result that I got is,</p>
```WHERE entity1.softDelete IS FALSE
```

I know this because the query still selects Entity1 where the Entity2 softDelete is True.

Is Criteria API able to differ columns with same name but different source? Or is my code wrong?

I tried looking at other questions such as these but none of them matches my question:

JPA Criteria Query over an entity hierarchy using single table inheritance

Problem with jpa criteriabuilder multiple joins

Body:
For example I have these entities:

@Getter
@Setter
@MappedSuperclass
public class BaseEntity {

  @Id
  @Column(name = "id")
  private String id = UUID.randomUUID().toString();

  @Column(name = "soft_delete", nullable = false)
  private Boolean softDelete = false;

}

public class Entity1 extends BaseEntity {

  @Column(name = "name", nullable = false, unique = true)
  private String name;

}

public class Entity2 extends BaseEntity {

  @Column(name = "other_attribute", nullable = false, unique = true)
  private String otherAttribute;

}

And I tried to create pseudo-queries like:

SELECT * FROM entity1 JOIN entity2 on entity1.id = entity2.other_id
WHERE entity1.softDelete IS FALSE
AND entity2.softDelete IS FALSE

What I've created using Criteria API is as follow:

private Class repoClass() {

    public void getEntity1() {
      CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
      CriteriaQuery<Entity1> query =
          criteriaBuilder.createQuery(Entity1.class);
      Root<Entity1> entity1Root = query.from(Entity1.class);

      List<Predicate> predicates = new ArrayList<>();
      Join<Entity1, Entity2> entityJoin =
          entity1Root.join(Entity1_.Entity2);
      predicates.add(builder.isFalse(entity1Root.get(Entity1_.softDelete)));
      predicates.add(builder.isFalse(entityJoin.get(Entity2_.softDelete)));

      query.select(entity1Root).where(predicates.toArray(new Predicate[0]));
      this.entityManager.createQuery(query).getResultList();
    }
  }

This does not work, because rather than getting these predicates,

WHERE entity1.softDelete IS FALSE
AND entity2.softDelete IS FALSE

the result that I got is,

WHERE entity1.softDelete IS FALSE

I know this because the query still selects Entity1 where the Entity2 softDelete is True.

Is Criteria API able to differ columns with same name but different source? Or is my code wrong?

I tried looking at other questions such as these but none of them matches my question:

JPA Criteria Query over an entity hierarchy using single table inheritance

Problem with jpa criteriabuilder multiple joins


问:
Render issue when print html page using Chrome
Here is the simple HTML and style I used:

First Title

Second Title

```
<pre class="lang-css prettyprint-override"><code>        .p1 {
            width: 100%;
            display: inline-block;
            border: 1px solid black;
            height: 860px;
        }
        .p2 {
            margin-top: 10px;
            border: 1px dashed black;
        }
</code>```

When I open the page in the Chrome browser, everything is fine:

However, when I try to save it as PDF by using Chrome print functionality layout changed, it seems the first paragraph and the second paragraph overlapped:

Why this happened and how can I solve this issue?

Here is the demo online: https://codepen.io/hh54188/pen/LYBpBKq

Body:
Here is the simple HTML and style I used:

First Title

Second Title

        .p1 {
            width: 100%;
            display: inline-block;
            border: 1px solid black;
            height: 860px;
        }
        .p2 {
            margin-top: 10px;
            border: 1px dashed black;
        }

When I open the page in the Chrome browser, everything is fine:

However, when I try to save it as PDF by using Chrome print functionality layout changed, it seems the first paragraph and the second paragraph overlapped:

Why this happened and how can I solve this issue?

Here is the demo online: https://codepen.io/hh54188/pen/LYBpBKq


问:
Time difference between MySQL Workbench and using Java, why？
When I use a JDBC conneciton with MyBatis in Java like this

```<code>dao.queryByCondition();
</code>```

It takes about 300 ms to get the result, but when I use MySQL Workbench. The same SQL takes about 70 ms to get the result. I wonder about the difference between them. Why does MySQL Workbench take less?

I think Java use JDBC connection, and MySQL Workbench use MySQL client to connect to server. Do different protocols lead to different times?

Body:
When I use a JDBC conneciton with MyBatis in Java like this

dao.queryByCondition();

It takes about 300 ms to get the result, but when I use MySQL Workbench. The same SQL takes about 70 ms to get the result. I wonder about the difference between them. Why does MySQL Workbench take less?

I think Java use JDBC connection, and MySQL Workbench use MySQL client to connect to server. Do different protocols lead to different times?


问:
Consistent spark cluster on eks
I used spark-submit as described in the spark docs.

But I was looking for something else for my deployment. I want a cluster that is always on. Meaning that the master and the workers are always up. I want to connect to the spark master from inside a python script with the masters' IP.

What is the best way to achieve this with EKS ? Is the spark operator a good option ?

EDIT: using PySpark

Title: Consistent spark cluster on eks