问:
Pagination is not working inside nested scroll view in android java
I am building an app where i am fetching the data from firestore and want to use pagination but the problem is that the pagination is not working in nested scroll view. the code is something like this

My XML Code is something like this:

```<code><androidx.drawerlayout.widget.DrawerLayout

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeFragment">

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/Theme.AppCompat.Light">

            <TextView
                android:id="@+id/location"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:drawableStart="@drawable/ic_baseline_location_on_24red"
                android:drawableEnd="@drawable/ic_baseline_keyboard_arrow_down_24"
                android:fontFamily="@font/baloo_bhai"
                android:text="Your Location"
                android:textColor="#050505"
                android:textSize="20dp" />

        </androidx.appcompat.widget.Toolbar>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/toolbar"
            android:padding="5dp"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <androidx.appcompat.widget.SearchView
                android:id="@+id/searchbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:background="@drawable/searchbardesign"
                android:focusable="false"
                app:iconifiedByDefault="false"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:queryHint="search here eg. rooms in delhi... " />

        </RelativeLayout>

    </com.google.android.material.appbar.AppBarLayout>

    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipeFreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="?actionBarSize"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <androidx.core.widget.NestedScrollView
            android:id="@+id/nestedScrollView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="?actionBarSize"
            android:clipToPadding="true"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <org.imaginativeworld.whynotimagecarousel.ImageCarousel
                    android:id="@+id/carousel"
                    android:layout_width="match_parent"
                    android:layout_height="150dp"
                    android:layout_marginBottom="10dp"
                    app:autoPlay="false"
                    app:autoPlayDelay="3000"
                    app:autoWidthFixing="true"
                    app:carouselType="SHOWCASE"
                    app:imageScaleType="fitXY"
                    app:infiniteCarousel="true"
                    app:scaleOnScroll="false"
                    app:scalingFactor="0.15"
                    app:showBottomShadow="false"
                    app:showCaption="false"
                    app:showNavigationButtons="false"
                    app:showTopShadow="false"
                    app:touchToPause="true" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/roomsRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                   android:layoutAnimation="@anim/layout_animation_slide_from_bottom"
                    android:orientation="vertical"
                    android:scrollbars="vertical" />

                <ProgressBar
                    android:id="@+id/recyclerView_progress"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:visibility="gone" />

            </LinearLayout>

        </androidx.core.widget.NestedScrollView>
    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

</androidx.drawerlayout.widget.DrawerLayout>
</code>```

My Java code is something like this there is method paginationcode() in which i have written pagination code and then in the oncreate method i have written the other code

```<code>  // this is the code i have written inside onCreate

         recyclerViewRooms.setNestedScrollingEnabled(false);

 nestedScrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
            @Override
            public void onScrollChanged() {

                View view = (View) nestedScrollView.getChildAt(nestedScrollView.getChildCount() - 1);

                int diff = (view.getBottom() - (nestedScrollView.getHeight() + nestedScrollView
                        .getScrollY()));

                if (diff == 0) {
                    // your pagination code

                    paginationCode();

                }
            }
        });

// this is the method code

  public void paginationCode()
   {
    FirebaseFirestore firebaseFirestore = FirebaseFirestore.getInstance();
    Query productsRef =  firebaseFirestore.collectionGroup("room_details");
    Query query = productsRef.orderBy("location", Query.Direction.ASCENDING).limit(limit);

    progressBar.setVisibility(View.VISIBLE);

    query.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
        @Override
        public void onComplete(@NonNull Task<QuerySnapshot> task) {

            if (task.isSuccessful()) {

                for (DocumentSnapshot d : task.getResult()) {
                    RoomsDetails obj = d.toObject(RoomsDetails.class);
                    roomsDetails.add(obj);
                }

                roomsAdapter.notifyDataSetChanged();
            }
            lastVisible = task.getResult().getDocuments().get(task.getResult().size() - 1);

            RecyclerView.OnScrollListener onScrollListener = new RecyclerView.OnScrollListener() {
                @Override
                public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
                    super.onScrollStateChanged(recyclerView, newState);
                    if (newState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
                        isScrolling = true;
                        progressBar.setVisibility(View.GONE);
                    }
                }

                @Override
                public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
                    super.onScrolled(recyclerView, dx, dy);
                    LinearLayoutManager linearLayoutManager = ((LinearLayoutManager) recyclerView.getLayoutManager());
                    int firstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition();
                    int visibleItemCount = linearLayoutManager.getChildCount();
                    int totalItemCount = linearLayoutManager.getItemCount();

                    if (isScrolling && (firstVisibleItemPosition + visibleItemCount == totalItemCount) && !isLastItemReached) {
                        isScrolling = false;

                        progressBar.setVisibility(View.VISIBLE);

                        Query nextQuery = productsRef.orderBy("location", Query.Direction.ASCENDING).startAfter(lastVisible).limit(limit);
                        nextQuery.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
                            @Override
                            public void onComplete(@NonNull Task<QuerySnapshot> t) {

                                if (t.isSuccessful()) {
                                    for (DocumentSnapshot d : t.getResult()) {
                                        RoomsDetails productModel = d.toObject(RoomsDetails.class);
                                        roomsDetails.add(productModel);
                                        Toast.makeText(getContext(), "hey this is", Toast.LENGTH_SHORT).show();
                                    }

                                    progressBar.setVisibility(View.GONE);
                                    roomsAdapter.notifyDataSetChanged();
                                    lastVisible = t.getResult().getDocuments().get(t.getResult().size() - 1);

                                    if (t.getResult().size() < limit) {
                                        isLastItemReached = true;
                                    }
                                }
                            }
                        });

                    }
                }
            };

            recyclerViewRooms.addOnScrollListener(onScrollListener);

        }
    });
}
</code>```

Body:
I am building an app where i am fetching the data from firestore and want to use pagination but the problem is that the pagination is not working in nested scroll view. the code is something like this

My XML Code is something like this:

<androidx.drawerlayout.widget.DrawerLayout

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeFragment">

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/Theme.AppCompat.Light">

            <TextView
                android:id="@+id/location"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:drawableStart="@drawable/ic_baseline_location_on_24red"
                android:drawableEnd="@drawable/ic_baseline_keyboard_arrow_down_24"
                android:fontFamily="@font/baloo_bhai"
                android:text="Your Location"
                android:textColor="#050505"
                android:textSize="20dp" />

        </androidx.appcompat.widget.Toolbar>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/toolbar"
            android:padding="5dp"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <androidx.appcompat.widget.SearchView
                android:id="@+id/searchbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:background="@drawable/searchbardesign"
                android:focusable="false"
                app:iconifiedByDefault="false"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:queryHint="search here eg. rooms in delhi... " />

        </RelativeLayout>

    </com.google.android.material.appbar.AppBarLayout>

    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipeFreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="?actionBarSize"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <androidx.core.widget.NestedScrollView
            android:id="@+id/nestedScrollView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="?actionBarSize"
            android:clipToPadding="true"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <org.imaginativeworld.whynotimagecarousel.ImageCarousel
                    android:id="@+id/carousel"
                    android:layout_width="match_parent"
                    android:layout_height="150dp"
                    android:layout_marginBottom="10dp"
                    app:autoPlay="false"
                    app:autoPlayDelay="3000"
                    app:autoWidthFixing="true"
                    app:carouselType="SHOWCASE"
                    app:imageScaleType="fitXY"
                    app:infiniteCarousel="true"
                    app:scaleOnScroll="false"
                    app:scalingFactor="0.15"
                    app:showBottomShadow="false"
                    app:showCaption="false"
                    app:showNavigationButtons="false"
                    app:showTopShadow="false"
                    app:touchToPause="true" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/roomsRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                   android:layoutAnimation="@anim/layout_animation_slide_from_bottom"
                    android:orientation="vertical"
                    android:scrollbars="vertical" />

                <ProgressBar
                    android:id="@+id/recyclerView_progress"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:visibility="gone" />

            </LinearLayout>

        </androidx.core.widget.NestedScrollView>
    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

</androidx.drawerlayout.widget.DrawerLayout>

My Java code is something like this there is method paginationcode() in which i have written pagination code and then in the oncreate method i have written the other code

  // this is the code i have written inside onCreate

         recyclerViewRooms.setNestedScrollingEnabled(false);

 nestedScrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
            @Override
            public void onScrollChanged() {

                View view = (View) nestedScrollView.getChildAt(nestedScrollView.getChildCount() - 1);

                int diff = (view.getBottom() - (nestedScrollView.getHeight() + nestedScrollView
                        .getScrollY()));

                if (diff == 0) {
                    // your pagination code

                    paginationCode();

                }
            }
        });

// this is the method code

  public void paginationCode()
   {
    FirebaseFirestore firebaseFirestore = FirebaseFirestore.getInstance();
    Query productsRef =  firebaseFirestore.collectionGroup("room_details");
    Query query = productsRef.orderBy("location", Query.Direction.ASCENDING).limit(limit);

    progressBar.setVisibility(View.VISIBLE);

    query.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
        @Override
        public void onComplete(@NonNull Task<QuerySnapshot> task) {

            if (task.isSuccessful()) {

                for (DocumentSnapshot d : task.getResult()) {
                    RoomsDetails obj = d.toObject(RoomsDetails.class);
                    roomsDetails.add(obj);
                }

                roomsAdapter.notifyDataSetChanged();
            }
            lastVisible = task.getResult().getDocuments().get(task.getResult().size() - 1);

            RecyclerView.OnScrollListener onScrollListener = new RecyclerView.OnScrollListener() {
                @Override
                public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
                    super.onScrollStateChanged(recyclerView, newState);
                    if (newState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
                        isScrolling = true;
                        progressBar.setVisibility(View.GONE);
                    }
                }

                @Override
                public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
                    super.onScrolled(recyclerView, dx, dy);
                    LinearLayoutManager linearLayoutManager = ((LinearLayoutManager) recyclerView.getLayoutManager());
                    int firstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition();
                    int visibleItemCount = linearLayoutManager.getChildCount();
                    int totalItemCount = linearLayoutManager.getItemCount();

                    if (isScrolling && (firstVisibleItemPosition + visibleItemCount == totalItemCount) && !isLastItemReached) {
                        isScrolling = false;

                        progressBar.setVisibility(View.VISIBLE);

                        Query nextQuery = productsRef.orderBy("location", Query.Direction.ASCENDING).startAfter(lastVisible).limit(limit);
                        nextQuery.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
                            @Override
                            public void onComplete(@NonNull Task<QuerySnapshot> t) {

                                if (t.isSuccessful()) {
                                    for (DocumentSnapshot d : t.getResult()) {
                                        RoomsDetails productModel = d.toObject(RoomsDetails.class);
                                        roomsDetails.add(productModel);
                                        Toast.makeText(getContext(), "hey this is", Toast.LENGTH_SHORT).show();
                                    }

                                    progressBar.setVisibility(View.GONE);
                                    roomsAdapter.notifyDataSetChanged();
                                    lastVisible = t.getResult().getDocuments().get(t.getResult().size() - 1);

                                    if (t.getResult().size() < limit) {
                                        isLastItemReached = true;
                                    }
                                }
                            }
                        });

                    }
                }
            };

            recyclerViewRooms.addOnScrollListener(onScrollListener);

        }
    });
}


来源: stackexchange

问:
Error is coming when i am trying to update the database
```<code>app.put('/employees/:employeeId', async(request, response) =>{
    const {employeeId} = request.params;
    const employeeDetails = request.body;
    const {EmployeeId, LastName, FirstName, Title, ReportsTo, BirthDate, HireDate, Address, City, State, Country, PostalCode, Phone, Fax, Email} = employeeDetails;

    const updateQuery = `
    UPDATE employees
    SET
    EmployeeId= ${EmployeeId}, LastName= ${LastName}, FirstName= ${FirstName}, Title= ${Title}, ReportsTo= ${ReportsTo}, BirthDate= ${BirthDate}, HireDate= ${HireDate}, Address= ${Address}, City= ${City}, State= ${State}, Country= ${Country}, PostalCode= ${PostalCode},
    Phone= ${Phone}, Fax= ${Fax}, Email= ${Email}

    WHERE EmployeeId = ${employeeId}`;

    await db.run(updateQuery);
    response.send("Updated Successfully");
});
</code>```

this is my code for updating and when I am trying to update the values with

```<code>{
  "EmployeeId": 1,
  "LastName": "Rahul",
  "FirstName": "Andre",
  "Title": "Sales Manager",
  "ReportsTo": null,
  "BirthDate": "1962-02-17 00:00:00",
  "HireDate": "2002-08-15 00:00:00",
  "Address": "1112 Jasper Ave NW",
  "City": "Edmonto",
  "State": "ABC",
  "Country": "Canadaa",
  "PostalCode": "T5K 2N",
  "Phone": "+1 (780) 428-9483",
  "Fax": "+1 (780) 428-3458",
  "Email": "rahul@chinookcorp.com"
}
</code>```

in thunder client it gives error like this

```<code>node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: SQLITE_ERROR: near "Manager": syntax error] {
  errno: 1,
  code: 'SQLITE_ERROR'
}
</code>```

can someone please help me out?

Tried a lot to understand the problem but couldnt figure it out

ContentLicense: CC BY-SA 4.0

Body:
app.put('/employees/:employeeId', async(request, response) =>{
    const {employeeId} = request.params;
    const employeeDetails = request.body;
    const {EmployeeId, LastName, FirstName, Title, ReportsTo, BirthDate, HireDate, Address, City, State, Country, PostalCode, Phone, Fax, Email} = employeeDetails;

    const updateQuery = `
    UPDATE employees
    SET
    EmployeeId= ${EmployeeId}, LastName= ${LastName}, FirstName= ${FirstName}, Title= ${Title}, ReportsTo= ${ReportsTo}, BirthDate= ${BirthDate}, HireDate= ${HireDate}, Address= ${Address}, City= ${City}, State= ${State}, Country= ${Country}, PostalCode= ${PostalCode},
    Phone= ${Phone}, Fax= ${Fax}, Email= ${Email}

    WHERE EmployeeId = ${employeeId}`;

    await db.run(updateQuery);
    response.send("Updated Successfully");
});

this is my code for updating and when I am trying to update the values with

{
  "EmployeeId": 1,
  "LastName": "Rahul",
  "FirstName": "Andre",
  "Title": "Sales Manager",
  "ReportsTo": null,
  "BirthDate": "1962-02-17 00:00:00",
  "HireDate": "2002-08-15 00:00:00",
  "Address": "1112 Jasper Ave NW",
  "City": "Edmonto",
  "State": "ABC",
  "Country": "Canadaa",
  "PostalCode": "T5K 2N",
  "Phone": "+1 (780) 428-9483",
  "Fax": "+1 (780) 428-3458",
  "Email": "rahul@chinookcorp.com"
}

in thunder client it gives error like this

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: SQLITE_ERROR: near "Manager": syntax error] {
  errno: 1,
  code: 'SQLITE_ERROR'
}

can someone please help me out?

Tried a lot to understand the problem but couldnt figure it out


问:
why the program works on visual studio code but doesn't work on pythonanywhere?
i tried to run this program on pythonanywhere but it doesn't work, why?

```<code>from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("ignore-certificate-errors")
chromeOptions.add_argument('--headless=chrome')
wbe = webdriver.Chrome('/home/Picen22/ODDS_ACTION/chromedriver', options=chromeOptions)

wbe.get("http://m.diretta.it/?d=0&s=1")
sleep(2)
print(wbe.find_elements(By.XPATH,'//div[@id="score-data"]/a'))
</code>```

if I start this program in VS it works, but in pythonanywhere it makes this error:

```<code>/home/Picen22/ODDS_ACTION/prova.py:8: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  wbe = webdriver.Chrome('/home/Picen22/ODDS_ACTION/chromedriver', options=chromeOptions)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 71, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/usr/local/lib/python3.10/subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.10/subprocess.py", line 1845, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/Picen22/ODDS_ACTION/chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/Picen22/ODDS_ACTION/prova.py", line 8, in <module>
    wbe = webdriver.Chrome('/home/Picen22/ODDS_ACTION/chromedriver', options=chromeOptions)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__
    self.service.start()
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 86, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://chromedriver.chromium.org/ho
me
</code>```

Body:
i tried to run this program on pythonanywhere but it doesn't work, why?

from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("ignore-certificate-errors")
chromeOptions.add_argument('--headless=chrome')
wbe = webdriver.Chrome('/home/Picen22/ODDS_ACTION/chromedriver', options=chromeOptions)

wbe.get("http://m.diretta.it/?d=0&s=1")
sleep(2)
print(wbe.find_elements(By.XPATH,'//div[@id="score-data"]/a'))

if I start this program in VS it works, but in pythonanywhere it makes this error:

/home/Picen22/ODDS_ACTION/prova.py:8: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  wbe = webdriver.Chrome('/home/Picen22/ODDS_ACTION/chromedriver', options=chromeOptions)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 71, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/usr/local/lib/python3.10/subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.10/subprocess.py", line 1845, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/Picen22/ODDS_ACTION/chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/Picen22/ODDS_ACTION/prova.py", line 8, in <module>
    wbe = webdriver.Chrome('/home/Picen22/ODDS_ACTION/chromedriver', options=chromeOptions)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__
    self.service.start()
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 86, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://chromedriver.chromium.org/ho
me


问:
Submit for login review. Some of the permissions below have not been approved for use by Facebook
I'm implementing Facebook login for my Flutter app. My backend is AWS Amplify.

When trying to login with my Facebook account, I'm facing this warning message.

My understanding is that the review is only necessary if the app requires information other than profile and email address.

The only information I'm requesting is public_profile and email as you can see from the screenshot below which I took from App Dashboard from Meta for Developers.

I tried downgrading public_profile access level to standard, but still getting the same warning.

I want to request for App review if necessary, but I don't see a menu to do that from App Review section.

What do I have to do to get rid of this warning message? Is this by design? User can tap Continue button to sign in but this warning message doesn't look good from user's perspective. And I don't think I ever saw this message when using Facebook login in other apps.

My app type is Business and App Mode is in Development if these matter.


问:
Can't send data to socket (server) in assembly language (x86_64) on linux
I am trying to send a data to a server using assembly language. In python everything works. Now I want to do that in asm.
The server is local (127.0.0.1) on port 4096.

```<code>
section .bss
        sock_fd: resb 4
section .data
        msg: db "Hello World",0
        len equ $ - msg
        struct: dw 2
                db 10h, 00h
                db 7fh, 0, 0, 1
                db 0,0,0,0,0,0,0,0

section .text
global socket
socket:
        mov rax, 41
        mov rdi, 2
        mov rsi, 1
        syscall
    mov [sock_fd], rax
connect:
    mov rax, 42
    mov rdi, [sock_fd]
    mov rsi, struct
    mov rdx, 1024
    syscall
sendto:
        mov rdi, [sock_fd]
        mov rax, 44
        mov rsi, msg
        mov rdx, len
        mov r8, struct
        mov r9, 16
        syscall
exit:
        mov rax, 60
        syscall

</code>```

I am trying to send a data to a server using assembly language. In python everything works. Now I want to do that in asm.
The server is local (127.0.0.1) on port 4096.

Body:
I am trying to send a data to a server using assembly language. In python everything works. Now I want to do that in asm.
The server is local (127.0.0.1) on port 4096.

section .bss
        sock_fd: resb 4
section .data
        msg: db "Hello World",0
        len equ $ - msg
        struct: dw 2
                db 10h, 00h
                db 7fh, 0, 0, 1
                db 0,0,0,0,0,0,0,0

section .text
global socket
socket:
        mov rax, 41
        mov rdi, 2
        mov rsi, 1
        syscall
    mov [sock_fd], rax
connect:
    mov rax, 42
    mov rdi, [sock_fd]
    mov rsi, struct
    mov rdx, 1024
    syscall
sendto:
        mov rdi, [sock_fd]
        mov rax, 44
        mov rsi, msg
        mov rdx, len
        mov r8, struct
        mov r9, 16
        syscall
exit:
        mov rax, 60
        syscall

I am trying to send a data to a server using assembly language. In python everything works. Now I want to do that in asm.
The server is local (127.0.0.1) on port 4096.


问:
PHP DomXPath - misplaced  tag in Entity
I have to write some tests to validate some email html, so I'm using DomXPath to roughly check that dynamic data is correctly displayed in the expected position.

I've built the html using an online visual builder (i.e.: Sendinblue) and checked with another online tool that the generated code is valid/supported for emails, but still getting the error below when loading email body with loadHTML().

The error:

```<code>DOMDocument::loadHTML(): htmlParseStartTag: misplaced <html> tag in Entity
</code>```

My HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="format-detection" content="telephone=no">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title></title>

...
```
<p>Tried to remove the doctype and the error changed to</p>
```DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 2
```
<p>Not really sure what this is about...</p>
<p>Suppressing the warnings with <code>@</code> made the test run but fail, and since I'm looking for specific tag ids with <code>getElementById</code> that I know are present, I just outputted the loaded html with <code>saveHTML()</code> to file, but here's the content:</p>
```<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org=
/TR/xhtml1/DTD/xhtml1-strict.dtd">

=0A=0A
=0A        <meta http-equiv='3D"Conte=' nt-type content='3D"text/html;' charset='3Dutf-8"'>=0A        <meta http-equiv='=3D"X-UA-Compatible"' content='3D"IE=3Dedge"'>=0A        <meta name='3D"format-=' detection content='3D"telephone=3Dno"'>=0A        <meta name='3D"viewport"' co='ntent=3D"width=3Ddevice-width,' initial-scale='3D1.0"'>=0A        <title>=
le>=0A        =0A        =0A =
       =0A        =0A        =0A        =0A        =0A     =
   =0A    =0A    </title>=0A   =

=0A
=0A                =0A
=0A                       =

=0A                            =0A
=0A
=0A                   =
                     =0A               =

=0A                                         =
       =0A
=0A                                             =
       =
=C2=AD	=0A
=0A     =

=0A                         =
                           =0A                          =

=0A                        =

=0A                                =
                                =0A                                    =

=0A                                      =
                                  =0A                              =

=0A                          =
                                                  =0A                                                              =

=0A                                    =

=0A                    =
                                                                    =0A                                           =

=0A                     =
                                                                           =

=0A                                    =
                                                                =C2=AD	=0A       =
                                                                           =

=0A                                                     =

=0A                         =
                                                                           =
   	=0A                        =
                                                                        =
r>=0A                                                                      =

=0A          =
                                                                           =
               =C2=AD	=0A                                                         =

=0A                            =

=0A=
```
<p>As you can see it is weirdly formatted, and there are a lot of <code>'3D</code> and <code>=</code> here and there that should be not.<br />
Not sure if all of this is related to the warning I've suppressed.</p>
<p>Here's my DOM code:</p>
<pre class="lang-php prettyprint-override"><code>$email = tests_retrieve_phpmailer_instance()->get_sent(0);
$dom = new DOMDocument();
$dom->loadXML($email->body);
$element = $dom->getElementById('date');
</code>```

Title: PHP DomXPath - misplaced <html> tag in Entity

Body:
I have to write some tests to validate some email html, so I'm using DomXPath to roughly check that dynamic data is correctly displayed in the expected position.

I've built the html using an online visual builder (i.e.: Sendinblue) and checked with another online tool that the generated code is valid/supported for emails, but still getting the error below when loading email body with loadHTML().

The error:

DOMDocument::loadHTML(): htmlParseStartTag: misplaced  tag in Entity

My HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="format-detection" content="telephone=no">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title></title>

...

Tried to remove the doctype and the error changed to

DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 2

Not really sure what this is about...

Suppressing the warnings with @ made the test run but fail, and since I'm looking for specific tag ids with getElementById that I know are present, I just outputted the loaded html with saveHTML() to file, but here's the content:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org=
/TR/xhtml1/DTD/xhtml1-strict.dtd">

=0A=0A
=0A        <meta http-equiv='3D"Conte=' nt-type content='3D"text/html;' charset='3Dutf-8"'>=0A        <meta http-equiv='=3D"X-UA-Compatible"' content='3D"IE=3Dedge"'>=0A        <meta name='3D"format-=' detection content='3D"telephone=3Dno"'>=0A        <meta name='3D"viewport"' co='ntent=3D"width=3Ddevice-width,' initial-scale='3D1.0"'>=0A        <title>=
le>=0A        =0A        =0A =
       =0A        =0A        =0A        =0A        =0A     =
   =0A    =0A    </title>=0A   =

=0A
=0A                =0A
=0A                       =

=0A                            =0A
=0A
=0A                   =
                     =0A               =

=0A                                         =
       =0A
=0A                                             =
       =
=C2=AD	=0A
=0A     =

=0A                         =
                           =0A                          =

=0A                        =

=0A                                =
                                =0A                                    =

=0A                                      =
                                  =0A                              =

=0A                          =
                                                  =0A                                                              =

=0A                                    =

=0A                    =
                                                                    =0A                                           =

=0A                     =
                                                                           =

=0A                                    =
                                                                =C2=AD	=0A       =
                                                                           =

=0A                                                     =

=0A                         =
                                                                           =
   	=0A                        =
                                                                        =
r>=0A                                                                      =

=0A          =
                                                                           =
               =C2=AD	=0A                                                         =

=0A                            =

=0A=

As you can see it is weirdly formatted, and there are a lot of '3D and = here and there that should be not.

Not sure if all of this is related to the warning I've suppressed.

Here's my DOM code:

$email = tests_retrieve_phpmailer_instance()->get_sent(0);
$dom = new DOMDocument();
$dom->loadXML($email->body);
$element = $dom->getElementById('date');


问:
Loading-Spinner not shown at initial page load
Up in the component hierarchy a Loader component is defined, which should be shown every time something is loaded asynchronously.

```<code>export default function Test() {
  const navigation = useNavigation();
  const isLoading = navigation.state !== "idle";
    <>
      {/* ... */}
      <Loader open={isLoading} />
      <Outlet />
      {/*...*/}
    </>
  );
}
</code>```

When we navigate between the pages or trigger async actions on a page, Loader is shown every time react-router-loader or action is executed. What we miss is the shown Loader on initial rendering of the page (go to website, hit refresh). The above Test component seems to be rendered AFTER the fetch, not during.

react-router version is 6.5.

Body:
Up in the component hierarchy a Loader component is defined, which should be shown every time something is loaded asynchronously.

export default function Test() {
  const navigation = useNavigation();
  const isLoading = navigation.state !== "idle";
    <>
      {/* ... */}
      <Loader open={isLoading} />
      <Outlet />
      {/*...*/}
    </>
  );
}

When we navigate between the pages or trigger async actions on a page, Loader is shown every time react-router-loader or action is executed. What we miss is the shown Loader on initial rendering of the page (go to website, hit refresh). The above Test component seems to be rendered AFTER the fetch, not during.

react-router version is 6.5.


问:
Angular Localize-How to customize i18n key based on domain?
I'm developing an application with multiple domains: "Commercial", "Legal", etc. I'm using Angular/localize to translate my app. I have a service that send me a response based on this domain. My focus is to store this value in my ngrx store and use it like a prefix for my translation.

example

```<code><div [i18n]="`@@${mydomain}.firm`">Firm</div>
</code>```

and in my translation I need to create multiples keys:

```<code>commercial.firm : "Commercial Firm"
legal.firm : "Legal Firm"
</code>```

How can solve this problem? i18n attribute can't permit me to pass variable as key.

Body:
I'm developing an application with multiple domains: "Commercial", "Legal", etc. I'm using Angular/localize to translate my app. I have a service that send me a response based on this domain. My focus is to store this value in my ngrx store and use it like a prefix for my translation.

example

<div [i18n]="`@@${mydomain}.firm`">Firm

and in my translation I need to create multiples keys:

commercial.firm : "Commercial Firm"
legal.firm : "Legal Firm"

How can solve this problem? i18n attribute can't permit me to pass variable as key.


问:
Chrome extension - manifest v3 - service worker keep getting inactive
I call sendMessage a few times from the content script, but it seems like service worker is inactive at the same time and the listener it's not getting triggered.

Any solution?

I've tried to listen to history state change to keep it "awake"
`

```<code>chrome.webNavigation.onHistoryStateUpdated.addListener((details) => {
  console.log('wake me up');
});
</code>```

`

Body:
I call sendMessage a few times from the content script, but it seems like service worker is inactive at the same time and the listener it's not getting triggered.

Any solution?

I've tried to listen to history state change to keep it "awake"
`

chrome.webNavigation.onHistoryStateUpdated.addListener((details) => {
  console.log('wake me up');
});

`


问:
Missing: @vue/shared@3.2.45 from lock file
I'm using Amplify  to host a web app  in Vue js 2.X. which is built through the CI CD.
Tested several times it always break on the

```<code>2022-12-22T11:08:45.885Z [WARNING]: Missing: @vue/shared@3.2.45 from lock file
</code>```

Here the whole log output:

```<code>2022-12-22T11:07:36.371Z [INFO]: # Cloning repository: git@github.com:myaccount/xxxxxxx.git
2022-12-22T11:07:38.446Z [INFO]:
2022-12-22T11:07:38.448Z [INFO]: Cloning into 'xxxxxxx'...
2022-12-22T11:07:38.449Z [INFO]: # Switching to commit: e91284f85e69e69c19ff4f8b4fd93969499823ca
2022-12-22T11:07:38.466Z [INFO]: Note: switching to 'e91284f85e69e69c19ff4f8b4fd93969499823ca'.
                                 You are in 'detached HEAD' state. You can look around, make experimental
                                 changes and commit them, and you can discard any commits you make in this
                                 state without impacting any branches by switching back to a branch.
                                 If you want to create a new branch to retain commits you create, you may
                                 do so (now or later) by using -c with the switch command. Example:
                                 git switch -c <new-branch-name>
                                 Or undo this operation with:
                                 git switch -
                                 Turn off this advice by setting config variable advice.detachedHead to false
                                 HEAD is now at e91284f Changed  the node verison   to "16.13.0
2022-12-22T11:07:38.509Z [INFO]: Successfully cleaned up Git credentials
2022-12-22T11:07:38.509Z [INFO]: # Checking for Git submodules at: /codebuild/output/src294778264/src/xxxxxxxx/.gitmodules
2022-12-22T11:07:38.516Z [INFO]: # Retrieving environment cache...
2022-12-22T11:07:38.555Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2022-12-22T11:07:38.556Z [INFO]: ---- Setting Up SSM Secrets ----
2022-12-22T11:07:38.556Z [INFO]: SSM params {"Path":"/amplify/donzocm1ouro9/master/","WithDecryption":true}
2022-12-22T11:07:38.584Z [WARNING]: !Failed to set up process.env.secrets
2022-12-22T11:07:38.586Z [INFO]: # Defaulting to Node version 16
2022-12-22T11:07:49.681Z [INFO]: # Node version 16 is available for installation
022-12-22T11:07:36.371Z [INFO]: # Cloning repository: git@github.com:bferreirarocha/EP-LadingPage.git
2022-12-22T11:07:38.446Z [INFO]:
2022-12-22T11:07:38.448Z [INFO]: Cloning into 'xxxxxxxx'...
2022-12-22T11:07:38.449Z [INFO]: # Switching to commit: e91284f85e69e69c19ff4f8b4fd93969499823ca
2022-12-22T11:07:38.466Z [INFO]: Note: switching to 'e91284f85e69e69c19ff4f8b4fd93969499823ca'.
                                 You are in 'detached HEAD' state. You can look around, make experimental
                                 changes and commit them, and you can discard any commits you make in this
                                 state without impacting any branches by switching back to a branch.
                                 If you want to create a new branch to retain commits you create, you may
                                 do so (now or later) by using -c with the switch command. Example:
                                 git switch -c <new-branch-name>
                                 Or undo this operation with:
                                 git switch -
                                 Turn off this advice by setting config variable advice.detachedHead to false
                                 HEAD is now at e91284f Changed  the node verison   to "16.13.0
2022-12-22T11:07:38.509Z [INFO]: Successfully cleaned up Git credentials
2022-12-22T11:07:38.509Z [INFO]: # Checking for Git submodules at: /codebuild/output/src294778264/src/EP-LadingPage/.gitmodules
2022-12-22T11:07:38.516Z [INFO]: # Retrieving environment cache...
2022-12-22T11:07:38.555Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2022-12-22T11:07:38.556Z [INFO]: ---- Setting Up SSM Secrets ----
2022-12-22T11:07:38.556Z [INFO]: SSM params {"Path":"/amplify/donzocm1ouro9/master/","WithDecryption":true}
2022-12-22T11:07:38.584Z [WARNING]: !Failed to set up process.env.secrets
2022-12-22T11:07:38.586Z [INFO]: # Defaulting to Node version 16
2022-12-22T11:07:49.681Z [INFO]: # Node version 16 is available for installation
2022-12-22T11:07:49.759Z [INFO]: # Installing Node version 16
2022-12-22T11:07:57.127Z [INFO]: # Now using Node version 16
form@3.2.45 from lock file
                                    npm ERR!
2022-12-22T11:08:45.885Z [WARNING]: Missing: @vue/shared@3.2.45 from lock file
                                    npm ERR! Missing: estree-walker@2.0.2 from lock file
                                    npm ERR! Missing: magic-string@0.25.9 from lock file
                                    npm ERR! Missing: sourcemap-codec@1.4.8 from lock file
                                    npm ERR! Missing: @vue/compiler-sfc@2.7.14 from lock file
                                    npm ERR! Missing: postcss@8.4.20 from lock file
                                    npm ERR! Missing: picocolors@1.0.0 from lock file
                                    npm ERR!
                                    npm ERR! Clean install a project
                                    npm ERR!
                                    npm ERR! Usage:
                                    npm ERR! npm ci
                                    npm ERR!
                                    npm
2022-12-22T11:08:45.886Z [WARNING]: ERR! Options:
                                    npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
                                    npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
                                    npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
                                    npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
                                    npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
                                    npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
                                    npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
                                    npm ERR!
                                    npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
                                    npm ERR!
                                    npm ERR! Run "npm help ci" for more info
2022-12-22T11:08:45.886Z [WARNING]:
2022-12-22T11:08:45.887Z [WARNING]: npm ERR! A complete log of this run can be found in:
                                    npm ERR!     /root/.npm/_logs/2022-12-22T11_08_40_913Z-debug-0.log
2022-12-22T11:08:45.892Z [ERROR]: !!! Build failed
2022-12-22T11:08:45.893Z [ERROR]: !!! Non-Zero Exit Code detected
2022-12-22T11:08:45.893Z [INFO]: # Starting environment caching...
2022-12-22T11:08:45.893Z [INFO]: # Environment caching completed
Terminating logging...
</code>```

Body:
I'm using Amplify  to host a web app  in Vue js 2.X. which is built through the CI CD.
Tested several times it always break on the

2022-12-22T11:08:45.885Z [WARNING]: Missing: @vue/shared@3.2.45 from lock file

Here the whole log output:

2022-12-22T11:07:36.371Z [INFO]: # Cloning repository: git@github.com:myaccount/xxxxxxx.git
2022-12-22T11:07:38.446Z [INFO]:
2022-12-22T11:07:38.448Z [INFO]: Cloning into 'xxxxxxx'...
2022-12-22T11:07:38.449Z [INFO]: # Switching to commit: e91284f85e69e69c19ff4f8b4fd93969499823ca
2022-12-22T11:07:38.466Z [INFO]: Note: switching to 'e91284f85e69e69c19ff4f8b4fd93969499823ca'.
                                 You are in 'detached HEAD' state. You can look around, make experimental
                                 changes and commit them, and you can discard any commits you make in this
                                 state without impacting any branches by switching back to a branch.
                                 If you want to create a new branch to retain commits you create, you may
                                 do so (now or later) by using -c with the switch command. Example:
                                 git switch -c <new-branch-name>
                                 Or undo this operation with:
                                 git switch -
                                 Turn off this advice by setting config variable advice.detachedHead to false
                                 HEAD is now at e91284f Changed  the node verison   to "16.13.0
2022-12-22T11:07:38.509Z [INFO]: Successfully cleaned up Git credentials
2022-12-22T11:07:38.509Z [INFO]: # Checking for Git submodules at: /codebuild/output/src294778264/src/xxxxxxxx/.gitmodules
2022-12-22T11:07:38.516Z [INFO]: # Retrieving environment cache...
2022-12-22T11:07:38.555Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2022-12-22T11:07:38.556Z [INFO]: ---- Setting Up SSM Secrets ----
2022-12-22T11:07:38.556Z [INFO]: SSM params {"Path":"/amplify/donzocm1ouro9/master/","WithDecryption":true}
2022-12-22T11:07:38.584Z [WARNING]: !Failed to set up process.env.secrets
2022-12-22T11:07:38.586Z [INFO]: # Defaulting to Node version 16
2022-12-22T11:07:49.681Z [INFO]: # Node version 16 is available for installation
022-12-22T11:07:36.371Z [INFO]: # Cloning repository: git@github.com:bferreirarocha/EP-LadingPage.git
2022-12-22T11:07:38.446Z [INFO]:
2022-12-22T11:07:38.448Z [INFO]: Cloning into 'xxxxxxxx'...
2022-12-22T11:07:38.449Z [INFO]: # Switching to commit: e91284f85e69e69c19ff4f8b4fd93969499823ca
2022-12-22T11:07:38.466Z [INFO]: Note: switching to 'e91284f85e69e69c19ff4f8b4fd93969499823ca'.
                                 You are in 'detached HEAD' state. You can look around, make experimental
                                 changes and commit them, and you can discard any commits you make in this
                                 state without impacting any branches by switching back to a branch.
                                 If you want to create a new branch to retain commits you create, you may
                                 do so (now or later) by using -c with the switch command. Example:
                                 git switch -c <new-branch-name>
                                 Or undo this operation with:
                                 git switch -
                                 Turn off this advice by setting config variable advice.detachedHead to false
                                 HEAD is now at e91284f Changed  the node verison   to "16.13.0
2022-12-22T11:07:38.509Z [INFO]: Successfully cleaned up Git credentials
2022-12-22T11:07:38.509Z [INFO]: # Checking for Git submodules at: /codebuild/output/src294778264/src/EP-LadingPage/.gitmodules
2022-12-22T11:07:38.516Z [INFO]: # Retrieving environment cache...
2022-12-22T11:07:38.555Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2022-12-22T11:07:38.556Z [INFO]: ---- Setting Up SSM Secrets ----
2022-12-22T11:07:38.556Z [INFO]: SSM params {"Path":"/amplify/donzocm1ouro9/master/","WithDecryption":true}
2022-12-22T11:07:38.584Z [WARNING]: !Failed to set up process.env.secrets
2022-12-22T11:07:38.586Z [INFO]: # Defaulting to Node version 16
2022-12-22T11:07:49.681Z [INFO]: # Node version 16 is available for installation
2022-12-22T11:07:49.759Z [INFO]: # Installing Node version 16
2022-12-22T11:07:57.127Z [INFO]: # Now using Node version 16
form@3.2.45 from lock file
                                    npm ERR!
2022-12-22T11:08:45.885Z [WARNING]: Missing: @vue/shared@3.2.45 from lock file
                                    npm ERR! Missing: estree-walker@2.0.2 from lock file
                                    npm ERR! Missing: magic-string@0.25.9 from lock file
                                    npm ERR! Missing: sourcemap-codec@1.4.8 from lock file
                                    npm ERR! Missing: @vue/compiler-sfc@2.7.14 from lock file
                                    npm ERR! Missing: postcss@8.4.20 from lock file
                                    npm ERR! Missing: picocolors@1.0.0 from lock file
                                    npm ERR!
                                    npm ERR! Clean install a project
                                    npm ERR!
                                    npm ERR! Usage:
                                    npm ERR! npm ci
                                    npm ERR!
                                    npm
2022-12-22T11:08:45.886Z [WARNING]: ERR! Options:
                                    npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
                                    npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
                                    npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
                                    npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
                                    npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
                                    npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
                                    npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
                                    npm ERR!
                                    npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
                                    npm ERR!
                                    npm ERR! Run "npm help ci" for more info
2022-12-22T11:08:45.886Z [WARNING]:
2022-12-22T11:08:45.887Z [WARNING]: npm ERR! A complete log of this run can be found in:
                                    npm ERR!     /root/.npm/_logs/2022-12-22T11_08_40_913Z-debug-0.log
2022-12-22T11:08:45.892Z [ERROR]: !!! Build failed
2022-12-22T11:08:45.893Z [ERROR]: !!! Non-Zero Exit Code detected
2022-12-22T11:08:45.893Z [INFO]: # Starting environment caching...
2022-12-22T11:08:45.893Z [INFO]: # Environment caching completed
Terminating logging...


问:
Left slide in animation on entire list when new item is added to the list
On increment in counts, I want to smoothly transition entire list to go left to default position when new count is added. For now this is only appearing for one particular count that is being added.

Codesandbox

App.js

```<code>export default function App() {
  const [counts, setCounts] = React.useState([1]);

  const increment = () => {
    const value = counts.length + 1;
    setCounts((prevState) => [...prevState, value]);
  };

  return (
    <div className="App">
      <button onClick={increment}>Increment</button>
      <div className="wrapper">
        {counts.map((count) => {
          return <p key={count}>{count}</p>;
        })}
      </div>
    </div>
  );
}
</code>```

CSS

```<code>.App {
  font-family: sans-serif;
  text-align: center;
}

.wrapper {
  width: 100%;
  background-color: tomato;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.wrapper > p {
  animation: slideIn 400ms ease;
  position: relative;
}

@keyframes slideIn {
  from {
    left: 20px;
  }
  to {
    left: 0;
  }
}

</code>```

Body:
On increment in counts, I want to smoothly transition entire list to go left to default position when new count is added. For now this is only appearing for one particular count that is being added.

Codesandbox

App.js

export default function App() {
  const [counts, setCounts] = React.useState([1]);

  const increment = () => {
    const value = counts.length + 1;
    setCounts((prevState) => [...prevState, value]);
  };

  return (

      <button onClick={increment}>Increment</button>

        {counts.map((count) => {
          return
{count}
;
        })}

  );
}

CSS

.App {
  font-family: sans-serif;
  text-align: center;
}

.wrapper {
  width: 100%;
  background-color: tomato;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.wrapper > p {
  animation: slideIn 400ms ease;
  position: relative;
}

@keyframes slideIn {
  from {
    left: 20px;
  }
  to {
    left: 0;
  }
}


问:
one pycharm proj with two venv
I have pycharm project. Imagine I have main.py, A.py, B.py scripts there.

in main.py I have code launching two another scripts

```<code>A.run() #running A.py function
B.run() #running B.py function
</code>```

The problem is that A.py and B.py scripts needs different venvs for work

Is that possible to adjust in pycharm somehow that A.py and B.py will use different venvs ( within one pycharm project -- without splitting on two pycharm projects )? Or that not possible using pycharm tool?

Title: one pycharm proj with two venv

Body:
I have pycharm project. Imagine I have main.py, A.py, B.py scripts there.

in main.py I have code launching two another scripts

A.run() #running A.py function
B.run() #running B.py function

The problem is that A.py and B.py scripts needs different venvs for work

Is that possible to adjust in pycharm somehow that A.py and B.py will use different venvs ( within one pycharm project -- without splitting on two pycharm projects )? Or that not possible using pycharm tool?


问:
PostgreSQL QueryError when upserting into a table using a composite key using Prisma
I'm encountering a frustrating error trying to upsert some data into a table with records that use composite keys. I'm using Prisma as an ORM.

```<code>{ user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42702), message: "column reference \"userIds\" is ambiguous", detail: None, hint: None, position: Some(Original(139)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("parse_relation.c"), line: Some(898), routine: Some("colNameToVar") }) }) }
</code>```

I think the important part of this is the message: "column reference \"userIds\" is ambiguous", which I guess is saying that userIds isn't unique enough for PostgreSQL to know which record to update?

The SQL query being performed in the background is:

INSERT INTO "public"."Vote" ("filmId", "userIds", "roomName")
VALUES
  ($1, $2, $3) ON CONFLICT ("roomName", "filmId") DO
UPDATE
SET
  "userIds" = "userIds" || $4
WHERE
  (
    (
      "public"."Vote"."roomName" = $5
      AND "public"."Vote"."filmId" = $6
    )
    AND 1 = 1
  ) RETURNING "public"."Vote"."roomName",
  "public"."Vote"."filmId",
  "public"."Vote"."userIds"

```
<p>My database schema looks like this:</p>
<p><strong>Schema</strong></p>
```model Room {
  ownerId String
  name    String   @id
  films   String[]
  users   String[]
  votes   Vote[]
}

model Vote {
  room     Room     @relation(fields: [roomName], references: [name])
  filmId   String
  userIds  String[]
  roomName String

  @@unique([roomName, filmId])
}
```
<p>And the snippet I want to use is the following:</p>
```const votes = await db.vote.upsert({
  where: {
    roomName_filmId: {
      roomName: roomId,
        filmId: filmId,
      },
    },
    update: {
      userIds: {
        push: socket.id,
      },
    },
    create: {
      filmId,
      roomName: roomId,
      userIds: [socket.id],
    },
});
```
<p>Hopefully I've provided enough information for this to be a useful question. Am I misunderstanding how upserts work, or maybe how keys are being referenced inside the table?</p>
<p>I was able to get the code working by manually searching for the record first with a <code>findUnique</code> and then handling that to either create or update the record:</p>
```const votes = hasVoteRecord
      ? await db.vote.update({
          where: {
            roomName_filmId: {
              roomName: roomId,
              filmId: filmId,
            },
          },
          data: {
            userIds: {
              push: socket.id,
            },
          },
        })
      : await db.vote.create({
          data: {
            roomName: roomId,
            filmId,
            userIds: [socket.id],
          },
        });
```

However, this looks a lot messier to me and is essentially recreating what I expected upsert to be doing, so I really just want to use upsert. Any thoughts?

Body:
I'm encountering a frustrating error trying to upsert some data into a table with records that use composite keys. I'm using Prisma as an ORM.

{ user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42702), message: "column reference \"userIds\" is ambiguous", detail: None, hint: None, position: Some(Original(139)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("parse_relation.c"), line: Some(898), routine: Some("colNameToVar") }) }) }

I think the important part of this is the message: "column reference \"userIds\" is ambiguous", which I guess is saying that userIds isn't unique enough for PostgreSQL to know which record to update?

The SQL query being performed in the background is:

INSERT INTO "public"."Vote" ("filmId", "userIds", "roomName")
VALUES
  ($1, $2, $3) ON CONFLICT ("roomName", "filmId") DO
UPDATE
SET
  "userIds" = "userIds" || $4
WHERE
  (
    (
      "public"."Vote"."roomName" = $5
      AND "public"."Vote"."filmId" = $6
    )
    AND 1 = 1
  ) RETURNING "public"."Vote"."roomName",
  "public"."Vote"."filmId",
  "public"."Vote"."userIds"

My database schema looks like this:

Schema

model Room {
  ownerId String
  name    String   @id
  films   String[]
  users   String[]
  votes   Vote[]
}

model Vote {
  room     Room     @relation(fields: [roomName], references: [name])
  filmId   String
  userIds  String[]
  roomName String

  @@unique([roomName, filmId])
}

And the snippet I want to use is the following:

const votes = await db.vote.upsert({
  where: {
    roomName_filmId: {
      roomName: roomId,
        filmId: filmId,
      },
    },
    update: {
      userIds: {
        push: socket.id,
      },
    },
    create: {
      filmId,
      roomName: roomId,
      userIds: [socket.id],
    },
});

Hopefully I've provided enough information for this to be a useful question. Am I misunderstanding how upserts work, or maybe how keys are being referenced inside the table?

I was able to get the code working by manually searching for the record first with a findUnique and then handling that to either create or update the record:

const votes = hasVoteRecord
      ? await db.vote.update({
          where: {
            roomName_filmId: {
              roomName: roomId,
              filmId: filmId,
            },
          },
          data: {
            userIds: {
              push: socket.id,
            },
          },
        })
      : await db.vote.create({
          data: {
            roomName: roomId,
            filmId,
            userIds: [socket.id],
          },
        });

However, this looks a lot messier to me and is essentially recreating what I expected upsert to be doing, so I really just want to use upsert. Any thoughts?


问:
Buy X and Get X Woocomerce Cart page
Im trying to add a funtion to buy x product for example with ID=32 price=20$ and I want to update cart quantity to 2 but the price will be 20$ again and If I add 2 the cart quantity will be 4...
Im trying a function to add like a gift but doesnt work with same ID. Anybody helps me?</p>
```<code>function bbloomer_add_gift_if_id_in_cart() {

   if ( is_admin() ) return;
   if ( WC()->cart->is_empty() ) return;

   $product_bought_id = 32;
   $product_gifted_id = 32;

   // see if product id in cart
   $product_bought_cart_id = WC()->cart->generate_cart_id( $product_bought_id );
   $product_bought_in_cart = WC()->cart->find_product_in_cart( $product_bought_cart_id );

   // see if gift id in cart
   $product_gifted_cart_id = WC()->cart->generate_cart_id( $product_gifted_id );
   $product_gifted_in_cart = WC()->cart->find_product_in_cart( $product_gifted_cart_id );

   // if not in cart remove gift, else add gift
   if ( ! $product_bought_in_cart ) {
      if ( $product_gifted_in_cart ) WC()->cart->remove_cart_item( $product_gifted_in_cart );
   } else {
      if ( ! $product_gifted_in_cart ) WC()->cart->add_to_cart( $product_gifted_id );
   }
}
</code>```

Title: Buy X and Get X Woocomerce Cart page

Body:
Im trying to add a funtion to buy x product for example with ID=32 price=20$ and I want to update cart quantity to 2 but the price will be 20$ again and If I add 2 the cart quantity will be 4...
Im trying a function to add like a gift but doesnt work with same ID. Anybody helps me?

function bbloomer_add_gift_if_id_in_cart() {

   if ( is_admin() ) return;
   if ( WC()->cart->is_empty() ) return;

   $product_bought_id = 32;
   $product_gifted_id = 32;

   // see if product id in cart
   $product_bought_cart_id = WC()->cart->generate_cart_id( $product_bought_id );
   $product_bought_in_cart = WC()->cart->find_product_in_cart( $product_bought_cart_id );

   // see if gift id in cart
   $product_gifted_cart_id = WC()->cart->generate_cart_id( $product_gifted_id );
   $product_gifted_in_cart = WC()->cart->find_product_in_cart( $product_gifted_cart_id );

   // if not in cart remove gift, else add gift
   if ( ! $product_bought_in_cart ) {
      if ( $product_gifted_in_cart ) WC()->cart->remove_cart_item( $product_gifted_in_cart );
   } else {
      if ( ! $product_gifted_in_cart ) WC()->cart->add_to_cart( $product_gifted_id );
   }
}


问:
Spring boot specification search across multiple-columns with joins
I have a requirement to implement advanced search for a table that has some value columns and some columns with relations to other tables.

I used Spring JPA specification to make the search dynamic as possible, but now I have an issue.
I want to add a searchKeyword that searches across multiple columns in this table and some of the columns

```<code>@AllArgsConstructor
public class SearchKeywordSpecification implements Specification<Customer> {

    private String searchKeyword;
    @Override
    public Predicate toPredicate(Root<Customer> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {

        query.distinct(true);
        return criteriaBuilder.or(
                criteriaBuilder.like(root.get("generatedCode"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("customerType").join("customerTypeTranslations")
                        .get("type"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("region").join("regionTranslations")
                        .get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("district").join("districtTranslations")
                        .get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("city").join("cityTranslations")
                        .get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("area").join("areaTranslations")
                        .get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("route").join("routeTranslations")
                        .get("name"), "%" + searchKeyword + "%"));
    }
}

</code>```

So any one have suggestions to improve this, I thought about storing the search keywords in another table with the table ID but still the idea isn't complete.

Body:
I have a requirement to implement advanced search for a table that has some value columns and some columns with relations to other tables.

I used Spring JPA specification to make the search dynamic as possible, but now I have an issue.
I want to add a searchKeyword that searches across multiple columns in this table and some of the columns

@AllArgsConstructor
public class SearchKeywordSpecification implements Specification<Customer> {

    private String searchKeyword;
    @Override
    public Predicate toPredicate(Root<Customer> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {

        query.distinct(true);
        return criteriaBuilder.or(
                criteriaBuilder.like(root.get("generatedCode"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("customerType").join("customerTypeTranslations")
                        .get("type"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("region").join("regionTranslations")
                        .get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("district").join("districtTranslations")
                        .get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("city").join("cityTranslations")
                        .get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("area").join("areaTranslations")
                        .get("name"), "%" + searchKeyword + "%"),
                criteriaBuilder.like(root.join("route").join("routeTranslations")
                        .get("name"), "%" + searchKeyword + "%"));
    }
}

So any one have suggestions to improve this, I thought about storing the search keywords in another table with the table ID but still the idea isn't complete.


问:
python - error executing python script using cryptography lib on MacOS
I'm trying to run a python script (see the code below) that uses the 'cryptography' lib, on MacOS Monterey (version 12.6) but, selecting the option 3 of the script (Create new password file) I'm getting - "TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'".
Running the same script on Windows platform it works fine.
The python version is 3.9.10

Thanks for any hint.

```<code>from cryptography.fernet import Fernet

class PasswordManager:

    def __init__(self) -> None:
        self.key = None
        self.password_file = None
        self.password_dict = {}

    def create_key(self, path):
        self.key = Fernet.generate_key()
        with open(path, 'wb') as f:
            f.write(self.key)

    def load_key(self, path):
        with open(path, 'rb') as f:
            self.key = f.read()

    def create_password_file(self, path, initial_values=None):
        self.password_file=path

        if initial_values is not None:
            for key, value in initial_values.items():
                self.add_password(key, value)

    def load_password_file(self, path):
        self.password_file=path

        with open(path, 'r') as f:
            for line in f:
                site, encrypted = line.split(":")
                self.password_dict[site] = Fernet(self.key).decrypt(encrypted.encode()).decode()

    def add_password(self, site, password):
        print("password ", password)
        print(type(password))
        self.password_dict[site] = password

        if self.password_file is not None:
            with open(self.password_file, 'a+') as f:
                encrypted = Fernet(self.key).encrypt(password.encode())
                f.write(site + ":" + encrypted.decode() + "\n")

    def get_password(self, site):
        return self.password_dict[site]

def main():
    password = {
        "email": "1234567",
        "facebook": "myfbpassword",
        "youtube": "helloworld123",
        "something": "myfavoritepassword_123"
    }

    pm = PasswordManager()

    print("""What do you want to do?
    (1) Create a new key
    (2) Load an existing key
    (3) Create new password file
    (4) Load existing password file
    (5) Add a new password
    (6) Get a password
    (q) Quit
    """)

    done = False

    while not done:

        choice = input("Enter your choice: ")
        if choice == "1":
            path = input("Enter path: ")
            pm.create_key(path)
        elif choice == "2":
            path = input("Enter path: ")
            pm.load_key(path)
        elif choice == "3":
            path = input("Enter path: ")
            pm.create_password_file(path, password)
        elif choice == "4":
            path = input("Enter path: ")
            pm.load_password_file(path)
        elif choice == "5":
            site = input("Enter the site: ")
            password = input("Enter the password: ")
            pm.add_password(site, password)
        elif choice == "6":
            site = input("What site do you want: ")
            print(f"Password for {site} is {pm.get_password(site)}")
        elif choice == "q":
            done = True
            print("Bye")
        else:
            print("Invalid choice!")

if __name__ == "__main__":
    main()
</code>```

Body:
I'm trying to run a python script (see the code below) that uses the 'cryptography' lib, on MacOS Monterey (version 12.6) but, selecting the option 3 of the script (Create new password file) I'm getting - "TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'".
Running the same script on Windows platform it works fine.
The python version is 3.9.10

Thanks for any hint.

from cryptography.fernet import Fernet

class PasswordManager:

    def __init__(self) -> None:
        self.key = None
        self.password_file = None
        self.password_dict = {}

    def create_key(self, path):
        self.key = Fernet.generate_key()
        with open(path, 'wb') as f:
            f.write(self.key)

    def load_key(self, path):
        with open(path, 'rb') as f:
            self.key = f.read()

    def create_password_file(self, path, initial_values=None):
        self.password_file=path

        if initial_values is not None:
            for key, value in initial_values.items():
                self.add_password(key, value)

    def load_password_file(self, path):
        self.password_file=path

        with open(path, 'r') as f:
            for line in f:
                site, encrypted = line.split(":")
                self.password_dict[site] = Fernet(self.key).decrypt(encrypted.encode()).decode()

    def add_password(self, site, password):
        print("password ", password)
        print(type(password))
        self.password_dict[site] = password

        if self.password_file is not None:
            with open(self.password_file, 'a+') as f:
                encrypted = Fernet(self.key).encrypt(password.encode())
                f.write(site + ":" + encrypted.decode() + "\n")

    def get_password(self, site):
        return self.password_dict[site]

def main():
    password = {
        "email": "1234567",
        "facebook": "myfbpassword",
        "youtube": "helloworld123",
        "something": "myfavoritepassword_123"
    }

    pm = PasswordManager()

    print("""What do you want to do?
    (1) Create a new key
    (2) Load an existing key
    (3) Create new password file
    (4) Load existing password file
    (5) Add a new password
    (6) Get a password
    (q) Quit
    """)

    done = False

    while not done:

        choice = input("Enter your choice: ")
        if choice == "1":
            path = input("Enter path: ")
            pm.create_key(path)
        elif choice == "2":
            path = input("Enter path: ")
            pm.load_key(path)
        elif choice == "3":
            path = input("Enter path: ")
            pm.create_password_file(path, password)
        elif choice == "4":
            path = input("Enter path: ")
            pm.load_password_file(path)
        elif choice == "5":
            site = input("Enter the site: ")
            password = input("Enter the password: ")
            pm.add_password(site, password)
        elif choice == "6":
            site = input("What site do you want: ")
            print(f"Password for {site} is {pm.get_password(site)}")
        elif choice == "q":
            done = True
            print("Bye")
        else:
            print("Invalid choice!")

if __name__ == "__main__":
    main()


问:
Can we pass multiple params in a route ? vue-router - vue 3
Can we pass more than 1 param in vue-router ?
I have a list of movies and when i click on one of them, it shows the movie details by fetching the data from an Api
My route for the movie details is like this:

```<code>{
      path: '/movies/:id',
      name: 'movie-details',
      component: MovieDetailsView,
      props: true
}
</code>```

Sending the props with RouterLink:

```<code><RouterLink :to="{ name: 'movie-details', params: { id: movie.id } }" class="link">
</code>```

Everything works fine, but what i want is, to send the ID and the SLUG of a single movie so i can use the id
to fetch the data from the API( api accept only id to fetch data ) and the slug to use it in the route, cause i don't want to show the movie's id.

I tried something like

```<code><RouterLink :to="{ name: 'movie-details', params: { id: movie.id, slug: movie.slug } }" class="link">
</code>```

then getting the slug in my component from props

```<code>const props = defineProps(['id','slug'])
</code>```

but the slug is always undefined

How it can be done ? is it even possible ?

Body:
Can we pass more than 1 param in vue-router ?
I have a list of movies and when i click on one of them, it shows the movie details by fetching the data from an Api
My route for the movie details is like this:

{
      path: '/movies/:id',
      name: 'movie-details',
      component: MovieDetailsView,
      props: true
}

Sending the props with RouterLink:

<RouterLink :to="{ name: 'movie-details', params: { id: movie.id } }" class="link">

Everything works fine, but what i want is, to send the ID and the SLUG of a single movie so i can use the id
to fetch the data from the API( api accept only id to fetch data ) and the slug to use it in the route, cause i don't want to show the movie's id.

I tried something like

<RouterLink :to="{ name: 'movie-details', params: { id: movie.id, slug: movie.slug } }" class="link">

then getting the slug in my component from props

const props = defineProps(['id','slug'])

but the slug is always undefined

How it can be done ? is it even possible ?


问:
Docker private registry not working over HTTPs
I setup a docker private registry, tried it one time with Ubuntu 22, and another time on CentOS 8. Both same problem.
I need the registry to be opened with HTTPs, not HTTP.

I followed the following tutorial: https://www.learnitguide.net/2018/07/create-your-own-private-docker-registry.html

```<code>sudo docker run -d -p 5000:5000 \
-v /docker_data/images:/var/lib/registry \
-v /docker_data/certs:/certs \
-e registry_http_tls_certificate=/certs/domain.crt \
-e registry_http_tls_key=/certs/domain.key \
--restart=always \
--name registry \
</code>```

I am using self-signed certificate.

This is the error I am getting when I login with docker:

Error response from daemon: Get "https://FQDN:5000/v2/": http: server gave HTTP response to HTTPS client

Appreciate your help.

Body:
I setup a docker private registry, tried it one time with Ubuntu 22, and another time on CentOS 8. Both same problem.
I need the registry to be opened with HTTPs, not HTTP.

I followed the following tutorial: https://www.learnitguide.net/2018/07/create-your-own-private-docker-registry.html

sudo docker run -d -p 5000:5000 \
-v /docker_data/images:/var/lib/registry \
-v /docker_data/certs:/certs \
-e registry_http_tls_certificate=/certs/domain.crt \
-e registry_http_tls_key=/certs/domain.key \
--restart=always \
--name registry \

I am using self-signed certificate.

This is the error I am getting when I login with docker:

Error response from daemon: Get "https://FQDN:5000/v2/": http: server gave HTTP response to HTTPS client

Appreciate your help.


问:
How to remove spacing in Open Editor in VSCode
Is it possible to remove the spacing in the 'Open Editor'? Where do I need to tweak this?

vscode open editor spacing

I tried searching in VSCode settings but all it has is the actual editor.


问:
RTK Query: wait until all 'dependent' requests are finished
For example, I have this code

```<code>setMode(mode_name).then( start )
</code>```

where setMode mutation invalidates several tags which are provided by queries queryA, queryB etc.

Is it possible to wait until not only setMode is finished before start launches but also all those other requests that are triggered on tag invalidation?
of course I can set timeout

```<code>setMode(mode_name).then( () => setTimeout(() => {
            start()
        }, 1000) )
</code>```

but it doesn't guarantee anything ( queryA, queryB etc could take too long for some reason)

Body:
For example, I have this code

setMode(mode_name).then( start )

where setMode mutation invalidates several tags which are provided by queries queryA, queryB etc.

Is it possible to wait until not only setMode is finished before start launches but also all those other requests that are triggered on tag invalidation?
of course I can set timeout

setMode(mode_name).then( () => setTimeout(() => {
            start()
        }, 1000) )

but it doesn't guarantee anything ( queryA, queryB etc could take too long for some reason)


问:
Installation of python3-sip-dev fails
I ran into a trouble with installing python3-sip-dev package for ros installation. Whenever I try to install it I get the following error:

```<code>~/ros2_crystal$ sudo apt-get install python3-sip-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-sip-dev : Depends: sip-dev (= 4.19.7+dfsg-1) but 4.19.7+dfsg-1ubuntu0.1 is to be installed
E: Unable to correct problems, you have held broken packages.

</code>```

What will be the best solution to resolve it?

On the internet I found package it asks for python3-sip-dev_4.19.7+dfsg-1ubuntu0.1_amd64.deb , but installation guide for that package asks to run again:

```<code>sudo apt-get install python3-sip-dev
</code>```

Which recurses me to the same error

Title: Installation of python3-sip-dev fails

Body:
I ran into a trouble with installing python3-sip-dev package for ros installation. Whenever I try to install it I get the following error:

~/ros2_crystal$ sudo apt-get install python3-sip-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-sip-dev : Depends: sip-dev (= 4.19.7+dfsg-1) but 4.19.7+dfsg-1ubuntu0.1 is to be installed
E: Unable to correct problems, you have held broken packages.

What will be the best solution to resolve it?

On the internet I found package it asks for python3-sip-dev_4.19.7+dfsg-1ubuntu0.1_amd64.deb , but installation guide for that package asks to run again:

sudo apt-get install python3-sip-dev

Which recurses me to the same error


问:
Python transform synchronous request into asynchronous to download image (httpio)
I'm using synchronous responses to get image data from a url into bytes format. But I would like to make it an asynchronous process. My approach is changing python requests for httpio. to achieve it.

My original code, which is working throws the following result

My Dataframe

```<code>df = pd.DataFrame({
            "uuid": {
                0: 86240171628346,
                1: 165887752774427,
                2: 175393314389900,
                3: 273714316578343,
                4: 167563092160852,
            },
            "raw_logo_url": {
                0: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTOYM0psiirjiZltDUm5xPtxtsdEUVIEIR4UGZMDMxNEmS8Fmr1N4ttV5db5lpJOeI0d64&usqp=CAU",
                1: "https://cdn.logojoy.com/wp-content/uploads/2018/05/01104813/1268-768x591.png",
                2: "https://res.cloudinary.com/crunchbase-production/image/upload/c_lpad,f_auto,q_auto:eco,dpr_1/v1444818641/snpqz6rutxy7azidex5w.png",
                3: "https://res.cloudinary.com/crunchbase-production/image/upload/c_lpad,f_auto,q_auto:eco,dpr_1/uymioczowxzwibevii1b",
                4: "https://www.companyfolders.com/blog/media/2015/01/adidas-300x207.jpg",
            },
            "version": {0: 0, 1: 0, 2: 0, 3: 0, 4: 0},
        }
        )
</code>```

Synchronous version

```<code>def get_image_from_url(url: str) -> Union[PngImagePlugin.PngImageFile, JpegImagePlugin.JpegImageFile]:
    response = requests.get(url)
    if response.status_code == 200:
        # print(response.content[:100])
        return Image.open(io.BytesIO(response.content))
    print(response.status_code)
    return None

def convert_image_to_bytes(image: Union[PngImagePlugin.PngImageFile, JpegImagePlugin.JpegImageFile]) -> bytes:
    """
    Receives a PIL image file and returns a bytes object
    """
    b = io.BytesIO()
    image.save(b, 'png')
    image_bytes = b.getvalue()
    return image_bytes

def process_image_from_url(url: str) -> bytes:
    image = get_image_from_url(url)
    return convert_image_to_bytes(image)

df["company_logo"] = df["raw_logo_url"].apply(process_image_from_url)
</code>```

Asynchronous version, not working

```<code>import asyncio
import aiohttp
import pandas as pd

async def get_image_from_url_(url: str) -> Union[PngImagePlugin.PngImageFile, JpegImagePlugin.JpegImageFile]:

    async with aiohttp.ClientSession() as session:
        response = await session.get(url)

        if response.status == 200:
            print(response.__dict__.keys())
            return response.text()
            # return Image.open(io.BytesIO(response.read()))
    print(response.status)
    return None

async def process_image(df: pd.DataFrame, input_column: str = 'raw_logo_url', output_column: str = 'company_logo'):
    df[output_column] = await asyncio.gather(*[get_image_from_url(v) for v in df[input_column]])
    print(df)

df2 = asyncio.run(process_image(df))
</code>```

Issue

In the async response I cannot get the response.content that I want to transform into an image to make a bytes object later.

```<code>*** TypeError: unhashable type: 'JpegImageFile'
</code>```

Notice that every image is transformed into PNG in the original execution

Body:
I'm using synchronous responses to get image data from a url into bytes format. But I would like to make it an asynchronous process. My approach is changing python requests for httpio. to achieve it.

My original code, which is working throws the following result

My Dataframe

df = pd.DataFrame({
            "uuid": {
                0: 86240171628346,
                1: 165887752774427,
                2: 175393314389900,
                3: 273714316578343,
                4: 167563092160852,
            },
            "raw_logo_url": {
                0: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTOYM0psiirjiZltDUm5xPtxtsdEUVIEIR4UGZMDMxNEmS8Fmr1N4ttV5db5lpJOeI0d64&usqp=CAU",
                1: "https://cdn.logojoy.com/wp-content/uploads/2018/05/01104813/1268-768x591.png",
                2: "https://res.cloudinary.com/crunchbase-production/image/upload/c_lpad,f_auto,q_auto:eco,dpr_1/v1444818641/snpqz6rutxy7azidex5w.png",
                3: "https://res.cloudinary.com/crunchbase-production/image/upload/c_lpad,f_auto,q_auto:eco,dpr_1/uymioczowxzwibevii1b",
                4: "https://www.companyfolders.com/blog/media/2015/01/adidas-300x207.jpg",
            },
            "version": {0: 0, 1: 0, 2: 0, 3: 0, 4: 0},
        }
        )

Synchronous version

def get_image_from_url(url: str) -> Union[PngImagePlugin.PngImageFile, JpegImagePlugin.JpegImageFile]:
    response = requests.get(url)
    if response.status_code == 200:
        # print(response.content[:100])
        return Image.open(io.BytesIO(response.content))
    print(response.status_code)
    return None

def convert_image_to_bytes(image: Union[PngImagePlugin.PngImageFile, JpegImagePlugin.JpegImageFile]) -> bytes:
    """
    Receives a PIL image file and returns a bytes object
    """
    b = io.BytesIO()
    image.save(b, 'png')
    image_bytes = b.getvalue()
    return image_bytes

def process_image_from_url(url: str) -> bytes:
    image = get_image_from_url(url)
    return convert_image_to_bytes(image)

df["company_logo"] = df["raw_logo_url"].apply(process_image_from_url)

Asynchronous version, not working

import asyncio
import aiohttp
import pandas as pd

async def get_image_from_url_(url: str) -> Union[PngImagePlugin.PngImageFile, JpegImagePlugin.JpegImageFile]:

    async with aiohttp.ClientSession() as session:
        response = await session.get(url)

        if response.status == 200:
            print(response.__dict__.keys())
            return response.text()
            # return Image.open(io.BytesIO(response.read()))
    print(response.status)
    return None

async def process_image(df: pd.DataFrame, input_column: str = 'raw_logo_url', output_column: str = 'company_logo'):
    df[output_column] = await asyncio.gather(*[get_image_from_url(v) for v in df[input_column]])
    print(df)

df2 = asyncio.run(process_image(df))

Issue

In the async response I cannot get the response.content that I want to transform into an image to make a bytes object later.

*** TypeError: unhashable type: 'JpegImageFile'

Notice that every image is transformed into PNG in the original execution


问:
How to auto refresh the Cognito ID token in Angular app using AWS Amplify
I have integrated the AWS amplify SDK in my Angular web app. Using the signIn method, I am able to receive the ID, refresh and Access token from Cognito.

However, the ID token gets expired after 60 mins, and the subsequent APIG calls using the token start failing. Is there a way to auto-configure the SDK, so that the SDK auto-refreshes the ID token before it expires?

This AWS link here says that the mobile SDKs do it automatically but says nothing for JS SDK. Any ideas


问:
JSpdf using size of data is longer than page width so that displayed text is fit in page and ignoring the rest
I am using the Jspdf script in order to convert the HTML form to a PDF file. It is converted to a PDF file but size of data is longer than page width so that displayed text had fit on the page and ignores the rest.

My Code:

$("#save-img").on("click", function () {
    var doc = new jsPDF();

    // Source HTMLElement or a string containing HTML.
    var elementHTML = document.querySelector("#Saftyinspecmodal");

    doc.html(elementHTML, {
        callback: function (doc) {
            // Save the PDF
            doc.save("document-html.pdf");
        },
        // Adjust your margins here (left, top, right ,bottom)
        //margin: [0, 0, 40, 0],
        //autoPaging: 'text',
        //x: 0,
        //y: 0,
        //width: doc.internal.pageSize.getWidth(), //target width in the PDF document
        //windowWidth: 1000 //window width in CSS pixels
    });
});
```


问:
How to display Label in Wijmo map(wj-Flex-Pie-data-label not working)
```<code>wj-flex-map #map header="Average Temperature By State" [tooltipContent]="tooltipContent" class="d-inline-block">
        <wj-geo-map-layer #layer url="assets/US.json"  [itemFormatter]="myItemFormatter"  (itemsSourceChanged)="zoomTo(layer)" >
            <wj-color-scale [colors]="colors" [binding]="binding" [scale]="scale" format='n0"°F"'></wj-color-scale>
        </wj-geo-map-layer>
        <wj-flex-chart-legend position="Left"></wj-flex-chart-legend>
    </wj-flex-map>
</code>```
```<code><!-- <wj-flex-pie-data-label [itemFormatter]="states"></wj-flex-pie-data-label>  --
</code>```

I have tried with this one but its still not working. Kindly help somebody.