问:
Are API keys and Google Cloud Platform service account credentials safe to store as environment variables in Netlify deploy settings?
I have this app https://github.com/ChristianOConnor/google-cloudfunction-callfromreactapp. It works by simply calling some text via a button press. The text is delivered by a Netlify function. I set up the Netlify function by adding a netlify.toml file to the root directory:

netlify.toml:

```<code>[functions]
  directory = "functions/"
</code>```

and adding this file:

functions/hello-netlify.js:

```<code>exports.handler = async (event) => {
  return {
    statusCode: 200,
    body: process.env.GREETING_TEST,
  };
};
</code>```

I added GREETING_TEST environmental variable in Netlify's deploy settings and set it to "this variable is now working":

The app works perfectly after deploying:

I have a default python Google Cloud Function that simply prints "Hello World!"

The question is, if I replace the test Netlify function that spits out "this variable is now working," with this,

```<code>import { JWT } from "google-auth-library";

exports.handler = async (event) => {
  const client = new JWT({
    email: process.env.CLIENT_EMAIL,
    key: process.env.PRIVATE_KEY
  });
  const url = process.env.RUN_APP_URL;
  const res = await client.request({url});
  const resData = res.data

  return {
    statusCode: 200,
    body: resData,
  };
};
</code>```

set the CLIENT_EMAIL and PRIVATE_KEY to that of my relevant Google Cloud Function service account, and set RUN_APP_URL to the Google Cloud Function's trigger url, would that be safe? My secret environment variables like PRIVATE_KEY would never be visible right?

Body:
I have this app https://github.com/ChristianOConnor/google-cloudfunction-callfromreactapp. It works by simply calling some text via a button press. The text is delivered by a Netlify function. I set up the Netlify function by adding a netlify.toml file to the root directory:

netlify.toml:

[functions]
  directory = "functions/"

and adding this file:

functions/hello-netlify.js:

exports.handler = async (event) => {
  return {
    statusCode: 200,
    body: process.env.GREETING_TEST,
  };
};

I added GREETING_TEST environmental variable in Netlify's deploy settings and set it to "this variable is now working":

The app works perfectly after deploying:

I have a default python Google Cloud Function that simply prints "Hello World!"

The question is, if I replace the test Netlify function that spits out "this variable is now working," with this,

import { JWT } from "google-auth-library";

exports.handler = async (event) => {
  const client = new JWT({
    email: process.env.CLIENT_EMAIL,
    key: process.env.PRIVATE_KEY
  });
  const url = process.env.RUN_APP_URL;
  const res = await client.request({url});
  const resData = res.data

  return {
    statusCode: 200,
    body: resData,
  };
};

set the CLIENT_EMAIL and PRIVATE_KEY to that of my relevant Google Cloud Function service account, and set RUN_APP_URL to the Google Cloud Function's trigger url, would that be safe? My secret environment variables like PRIVATE_KEY would never be visible right?


来源: stackexchange

问:
What is the meaning of "dash+right angle bracket" in Python?
I was checking some Python codes in Github and saw that there are some -> notation in function definitions, something like this:

```<code>def func1(a,b) -> int:
  returen a+b
</code>```

What does it mean exactly? is it related to output type of function?

I searched the stackoverflow but I could not find any specific description about this. It would be appreciated if you could provide any documentation link.

ContentLicense: CC BY-SA 4.0

Body:
I was checking some Python codes in Github and saw that there are some -> notation in function definitions, something like this:

def func1(a,b) -> int:
  returen a+b

What does it mean exactly? is it related to output type of function?

I searched the stackoverflow but I could not find any specific description about this. It would be appreciated if you could provide any documentation link.


问:
Images are in same directory but one is displaying and other is not in laravel
This line of code is working fine and image is displaying:

```<code> <img src="{{asset('storage/students/1670740466.png')}}" width="300" height="300">
</code>```

and this code below is not working although both are in the same directory. Images that are uploaded and stored through the form are not shown. Even if the name of that file is entered manually.

```<code><img src="{{asset('storage/students/'. $members['image'] )}}" width="300" height="300">
</code>```

I have no idea why it is happening.

Body:
This line of code is working fine and image is displaying:

and this code below is not working although both are in the same directory. Images that are uploaded and stored through the form are not shown. Even if the name of that file is entered manually.

I have no idea why it is happening.


问:
Android Vector Drawable with ImageView: the image is being cutted at the bottom
I have the following svg (vector file):

```<code><vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="18dp"
    android:height="3dp"
    android:viewportWidth="8.64"
    android:viewportHeight="1.44">
  <path
      android:fillColor="#363636"
      android:pathData="M0.72,0C0.3223,0 0,0.3224 0,0.72s0.3223,0.72 0.72,0.72 0.72,-0.3224 0.72,-0.72S1.1177,0 0.72,0Z" />
  <path
      android:fillColor="#363636"
      android:pathData="M4.3201,0C3.9224,0 3.6,0.3224 3.6,0.72s0.3224,0.72 0.7201,0.72c0.3976,0 0.72,-0.3224 0.72,-0.72S4.7177,0 4.3201,0Z" />
  <path
      android:fillColor="#363636"
      android:pathData="M7.9199,0C7.5224,0 7.2,0.3224 7.2,0.72s0.3224,0.72 0.72,0.72c0.3977,0 0.7201,-0.3224 0.7201,-0.72S8.3177,0 7.9199,0Z" />
</vector>
</code>```

Used in the ImageView:

```<code><com.google.android.material.appbar.AppBarLayout
        android:background="@color/white"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:elevation="1dp">

        <androidx.appcompat.widget.Toolbar
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:contentInsetStart="0dp"
            app:contentInsetEnd="0dp">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ImageView
                    android:id="@+id/back_button"
                    android:paddingLeft="16dp"
                    android:paddingRight="16dp"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_centerVertical="true"
                    android:src="@drawable/ic_arrow_left_black"
                    android:scaleType="centerInside" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_centerVertical="true"
                    android:text="@string/avatar"
                    android:textColor="#313131"
                    android:textSize="16sp" />

                <ImageView
                    android:id="@+id/menu_button"
                    android:paddingLeft="16dp"
                    android:paddingRight="16dp"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_centerVertical="true"
                    android:layout_alignParentRight="true"
                    android:src="@drawable/ic_menu_more" />

            </RelativeLayout>

        </androidx.appcompat.widget.Toolbar>

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

The preview of vector file looks just fine:

However in ImageView, the vector file looks like it's bottom was cuted and flatened, it's not a cricle any more:

Am I using vector drawable and svg incorrectly?

Body:
I have the following svg (vector file):

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="18dp"
    android:height="3dp"
    android:viewportWidth="8.64"
    android:viewportHeight="1.44">
  <path
      android:fillColor="#363636"
      android:pathData="M0.72,0C0.3223,0 0,0.3224 0,0.72s0.3223,0.72 0.72,0.72 0.72,-0.3224 0.72,-0.72S1.1177,0 0.72,0Z" />
  <path
      android:fillColor="#363636"
      android:pathData="M4.3201,0C3.9224,0 3.6,0.3224 3.6,0.72s0.3224,0.72 0.7201,0.72c0.3976,0 0.72,-0.3224 0.72,-0.72S4.7177,0 4.3201,0Z" />
  <path
      android:fillColor="#363636"
      android:pathData="M7.9199,0C7.5224,0 7.2,0.3224 7.2,0.72s0.3224,0.72 0.72,0.72c0.3977,0 0.7201,-0.3224 0.7201,-0.72S8.3177,0 7.9199,0Z" />
</vector>

Used in the ImageView:

<com.google.android.material.appbar.AppBarLayout
        android:background="@color/white"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:elevation="1dp">

        <androidx.appcompat.widget.Toolbar
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:contentInsetStart="0dp"
            app:contentInsetEnd="0dp">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ImageView
                    android:id="@+id/back_button"
                    android:paddingLeft="16dp"
                    android:paddingRight="16dp"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_centerVertical="true"
                    android:src="@drawable/ic_arrow_left_black"
                    android:scaleType="centerInside" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_centerVertical="true"
                    android:text="@string/avatar"
                    android:textColor="#313131"
                    android:textSize="16sp" />

                <ImageView
                    android:id="@+id/menu_button"
                    android:paddingLeft="16dp"
                    android:paddingRight="16dp"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_centerVertical="true"
                    android:layout_alignParentRight="true"
                    android:src="@drawable/ic_menu_more" />

            </RelativeLayout>

        </androidx.appcompat.widget.Toolbar>

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

The preview of vector file looks just fine:

However in ImageView, the vector file looks like it's bottom was cuted and flatened, it's not a cricle any more:

Am I using vector drawable and svg incorrectly?


问:
404 error, when eclipse and vscode open the same project
make dynamic project in eclipse and open with vscode,

always 404error when run on eclipse..

vscode is not support the Tomcat, but i want develope by vscode.., ㅠ

my vscode settings.json,

```<code>// "java.jdt.ls.java.home": "C:\\Program Files\\Java\\jdk-17.0.5",
</code>```

comment at java.home in settings.json

```<code>"java.jdt.ls.java.home": "C:\\Program Files\\Java\\jdk-17.0.5",
</code>```

Body:
make dynamic project in eclipse and open with vscode,

always 404error when run on eclipse..

vscode is not support the Tomcat, but i want develope by vscode.., ㅠ

my vscode settings.json,

// "java.jdt.ls.java.home": "C:\\Program Files\\Java\\jdk-17.0.5",

comment at java.home in settings.json

"java.jdt.ls.java.home": "C:\\Program Files\\Java\\jdk-17.0.5",


问:
Spotify API Works Sometimes, Stalls Other Times(?)
I'm trying to follow along in a simple tutorial that uses the spotipy api. The code is below:

```<code>from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
import sys
from pprint import pprint
import spotipy
import yaml
from spotipy.oauth2 import SpotifyOAuth
from data_functions import offset_api_limit, get_artists_df, get_tracks_df, get_track_audio_df,\
    get_all_playlist_tracks_df, find_popular_album, get_recommendations_artists, get_recommendations_tracks, get_most_popular_artist,  get_recommendations_genre
import pandas as pd

urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'

scope = "user-library-read user-follow-read user-top-read playlist-read-private"
with open("spotify/spotify_info.yaml", 'r') as stream:
    spotify_details = yaml.safe_load(stream)
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(
    client_id=spotify_details['client_id'],
    client_secret=spotify_details['client_secret'],
    redirect_uri=spotify_details['redirect_uri'],
    scope=scope,
))

results = sp.search(q='album:' + 'From 2 to 3', type='album')
print(results)
print("\n\n")
items = results['albums']['items']
if len(items) > 0:
    print(items)
    album = items[0]
    print(album)
    print(album['name'], album['id'])

alb = sp.album(album['id']) #issues here
pprint(alb)

</code>```

The code works and pulls the information from spotify until the marked line. I have no idea what's different about this function but when it hits that line it stalls indefinitely. Has anyone encountered this issue?

I've tried changing my authentication configuration and various functions such as albums, related_artists that also don't work.

Body:
I'm trying to follow along in a simple tutorial that uses the spotipy api. The code is below:

from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
import sys
from pprint import pprint
import spotipy
import yaml
from spotipy.oauth2 import SpotifyOAuth
from data_functions import offset_api_limit, get_artists_df, get_tracks_df, get_track_audio_df,\
    get_all_playlist_tracks_df, find_popular_album, get_recommendations_artists, get_recommendations_tracks, get_most_popular_artist,  get_recommendations_genre
import pandas as pd

urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'

scope = "user-library-read user-follow-read user-top-read playlist-read-private"
with open("spotify/spotify_info.yaml", 'r') as stream:
    spotify_details = yaml.safe_load(stream)
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(
    client_id=spotify_details['client_id'],
    client_secret=spotify_details['client_secret'],
    redirect_uri=spotify_details['redirect_uri'],
    scope=scope,
))

results = sp.search(q='album:' + 'From 2 to 3', type='album')
print(results)
print("\n\n")
items = results['albums']['items']
if len(items) > 0:
    print(items)
    album = items[0]
    print(album)
    print(album['name'], album['id'])

alb = sp.album(album['id']) #issues here
pprint(alb)

The code works and pulls the information from spotify until the marked line. I have no idea what's different about this function but when it hits that line it stalls indefinitely. Has anyone encountered this issue?

I've tried changing my authentication configuration and various functions such as albums, related_artists that also don't work.


问:
TVMError: Binary was created using cuda but a loader of that name is not registered
I'm generating tvm and istalling and using it in another docker container

TVM wheel generation code:

```<code>    # install cmake
    RUN yum install -y wget
    RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz -O cmake.tar.gz && \
        mkdir cmake && tar -zxvf cmake.tar.gz -C cmake --strip-components 1 && \
        cd cmake && ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF && make -j8 && make install && cd .. && \
        rm cmake.tar.gz && rm -rf cmake

    RUN echo "CUDA $(ls /lib64/ | grep cu)" > /tmp/build_2.output

    # install tvm
    RUN git clone --recursive https://github.com/apache/incubator-tvm tvm && \
        cd tvm && \
        git reset --hard 338940dc5044885412f9a6045cb8dcdf9fb639a4 && \
        git submodule init && \
        git submodule update && \
        mkdir ./build && \
        cp cmake/config.cmake build && \
        cd build && \
        cmake --debug-output -DUSE_CUDA=ON -DUSE_CUDNN=ON -DUSE_CUBLAS=ON -DUSE_THRUST=ON -DUSE_LLVM=ON .. &>> /tmp/build_2.output && \
        make -j$(nproc) &>> /tmp/build_2.output && \
        cd ../python && python3.8 setup.py bdist_wheel
</code>```

Verified that cuda .so files were created in /tmp/build_2.output

While installing and running the tvm in another place getting below error:

```<code>tvm.runtime.load_module

*TVMError: Binary was created using cuda but a loader of that name is not registered. Available loaders are GraphRuntimeFactory, metadata, GraphExecutorFactory, VMExecutable. Perhaps you need to recompile with this runtime enabled.*
</code>```

How to register cuda loader?

Body:
I'm generating tvm and istalling and using it in another docker container

TVM wheel generation code:

    # install cmake
    RUN yum install -y wget
    RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz -O cmake.tar.gz && \
        mkdir cmake && tar -zxvf cmake.tar.gz -C cmake --strip-components 1 && \
        cd cmake && ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF && make -j8 && make install && cd .. && \
        rm cmake.tar.gz && rm -rf cmake

    RUN echo "CUDA $(ls /lib64/ | grep cu)" > /tmp/build_2.output

    # install tvm
    RUN git clone --recursive https://github.com/apache/incubator-tvm tvm && \
        cd tvm && \
        git reset --hard 338940dc5044885412f9a6045cb8dcdf9fb639a4 && \
        git submodule init && \
        git submodule update && \
        mkdir ./build && \
        cp cmake/config.cmake build && \
        cd build && \
        cmake --debug-output -DUSE_CUDA=ON -DUSE_CUDNN=ON -DUSE_CUBLAS=ON -DUSE_THRUST=ON -DUSE_LLVM=ON .. &>> /tmp/build_2.output && \
        make -j$(nproc) &>> /tmp/build_2.output && \
        cd ../python && python3.8 setup.py bdist_wheel

Verified that cuda .so files were created in /tmp/build_2.output

While installing and running the tvm in another place getting below error:

tvm.runtime.load_module

*TVMError: Binary was created using cuda but a loader of that name is not registered. Available loaders are GraphRuntimeFactory, metadata, GraphExecutorFactory, VMExecutable. Perhaps you need to recompile with this runtime enabled.*

How to register cuda loader?


问:
How can I tell shiny server the location of already R installed packages?
When running my first Shiny app in server, it is showing the error "there is no package called 'xxx'". Though I have all these packages already installed in my machine through R Studio, I tried doing sudo su - shiny then installed the package again. That solves the problem for the package xxx. But then it will ask for a different package yyy.

Do I have to install each of the packages as shiny user? Or is there a way that I can tell shiny server  to look at the location where I have installed all these packages.


问:
Conditionally include in EF Core
I have an object like this:

```<code>public class VendorHotelRoom : BaseEntity
{
    public virtual ICollection<VendorHotelRoomName> VendorHotelRoomNames { get; set; }
    public bool CompleteVendorHotelRoomNames { get; set; }

    public Guid VendorHotelRoomDetailId { get; set; }
    public virtual VendorHotelRoomDetail VendorHotelRoomDetail { get; set; }
    public bool CompleteVendorHotelRoomDetail { get; set; }

    public virtual ICollection<VendorHotelRoomAvailability> VendorHotelRoomAvailabilities { get; set; }
    public bool CompleteVendorHotelRoomAvailabilities { get; set; }

    public virtual ICollection<VendorHotelRoomFacility> VendorHotelRoomFacilities { get; set; }
    public bool CompleteVendorHotelRoomFacilities { get; set; }

    public virtual ICollection<VendorHotelRoomDescription> VendorHotelRoomDescriptions { get; set; }
    public bool CompleteVendorHotelRoomDescriptions { get; set; }
}
</code>```

I want to include objects conditionally based in boolean properties like this

```<code>  var vhr = hotelContext.VendorHotelRooms.Where(c => c.Id == VendorHotelRoomId)
       //if CompleteVendorHotelRoomAvailabilities true .Include(c => c.VendorHotelRoomAvailabilities )
       //if condition(boolean) true     .Include(c => c.VendorHotelRoomDescriptions)
       //if condition(boolean) true     .Include(c => c.VendorHotelRoomDetail)
       //if condition(boolean) true     .Include(c => c.VendorHotelRoomFacilities)
       //if condition(boolean) true     .Include(c => c.VendorHotelRoomNames).FirstOrDefault();
</code>```

Is there any best practice way to avoid if and else?

Title: Conditionally include in EF Core

Body:
I have an object like this:

public class VendorHotelRoom : BaseEntity
{
    public virtual ICollection<VendorHotelRoomName> VendorHotelRoomNames { get; set; }
    public bool CompleteVendorHotelRoomNames { get; set; }

    public Guid VendorHotelRoomDetailId { get; set; }
    public virtual VendorHotelRoomDetail VendorHotelRoomDetail { get; set; }
    public bool CompleteVendorHotelRoomDetail { get; set; }

    public virtual ICollection<VendorHotelRoomAvailability> VendorHotelRoomAvailabilities { get; set; }
    public bool CompleteVendorHotelRoomAvailabilities { get; set; }

    public virtual ICollection<VendorHotelRoomFacility> VendorHotelRoomFacilities { get; set; }
    public bool CompleteVendorHotelRoomFacilities { get; set; }

    public virtual ICollection<VendorHotelRoomDescription> VendorHotelRoomDescriptions { get; set; }
    public bool CompleteVendorHotelRoomDescriptions { get; set; }
}

I want to include objects conditionally based in boolean properties like this

  var vhr = hotelContext.VendorHotelRooms.Where(c => c.Id == VendorHotelRoomId)
       //if CompleteVendorHotelRoomAvailabilities true .Include(c => c.VendorHotelRoomAvailabilities )
       //if condition(boolean) true     .Include(c => c.VendorHotelRoomDescriptions)
       //if condition(boolean) true     .Include(c => c.VendorHotelRoomDetail)
       //if condition(boolean) true     .Include(c => c.VendorHotelRoomFacilities)
       //if condition(boolean) true     .Include(c => c.VendorHotelRoomNames).FirstOrDefault();

Is there any best practice way to avoid if and else?


问:
Changing the color of value in cell based on condition in Datatables PDF
I have a datatables table that displays student marks. When I open the table it perfectly shows the marks, if the the mark is less than 50% the mark is red in color.

However when I do the print PDF, the PDF does not change the color. Yet i want the marks to be red if they are less than 50%.

I want the marks in the PDF to be red if it is less than 50%

How do I go about adding those conditions specifically for PDF in Datatables


问:
Getting valueError : invalid literal for int() with base 10:''
```<code>Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/store

Django Version: 4.1.3
Python Version: 3.10.7
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'store']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template error:
In template C:\Users\acer\PycharmProjects\Eshop\store\templates\index.html, error at line 40
   invalid literal for int() with base 10: ''
   30 :                 <div class="card mx-auto mb-3" id={{product.id}} style="width: 18rem;">
   31 :                     <img class="card-img-top" src="{{product.image.url}}" alt="Card image cap">
   32 :                     <div class="card-body">
   33 :                         <p class="card-title">{{product.name}}</p>
   34 :                         <p class="card-text"><b>{{product.price|currency}}</b></p>
   35 :
   36 :                     </div>
   37 :
   38 :                     <div class="card-footer p-0 no-gutters">
   39 :
   40 :                          {% if product|is_in_cart:request.session.cart %}
   41 :                         <div class="row no-gutters">
   42 :                             <form action="/#{{product.id}}" class="col-2 " method="post">
   43 :                                 {% csrf_token %}
   44 :                                 <input hidden type="text" name='product' value='{{product.id}}'>
   45 :                                 <input hidden type="text" name='remove' value='True'>
   46 :                                 <input type="submit" value=" - " class="btn btn-block btn-success border-right">
   47 :                             </form>
   48 :                             <div class="text-center col btn btn-success">{{product|cart_quantity:request.session.cart}} in Cart</div>
   49 :                             <form action="/#{{product.id}}" class="col-2 " method="post">
   50 :                                 {% csrf_token %}

Traceback (most recent call last):
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\acer\PycharmProjects\Eshop\store\views\home.py", line 57, in store
    return render(request, 'index.html', data)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\backends\django.py", line 62, in render
    return self.template.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 175, in render
    return self._render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 167, in _render
    return self.nodelist.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\loader_tags.py", line 157, in render
    return compiled_parent._render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 167, in _render
    return self.nodelist.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\loader_tags.py", line 63, in render
    result = block.nodelist.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\defaulttags.py", line 238, in render
    nodelist.append(node.render_annotated(context))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\defaulttags.py", line 315, in render
    match = condition.eval(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\defaulttags.py", line 878, in eval
    return self.value.resolve(context, ignore_failures=True)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 742, in resolve
    new_obj = func(obj, *arg_vals)
  File "C:\Users\acer\PycharmProjects\Eshop\store\templatetags\cart.py", line 7, in is_in_cart
    if int(id) == product.id:

Exception Type: ValueError at /store
Exception Value: invalid literal for int() with base 10: ''

</code>```

I was trying to run the website but it is showing the following error message:

ValueError at /store

invalid literal for int() with base 10: ''

Request Method:     GET
Request URL:    http://127.0.0.1:8000/store
Django Version:     4.1.3
Exception Type:     ValueError
Exception Value:

invalid literal for int() with base 10: ''

Exception Location:     C:\Users\acer\PycharmProjects\Eshop\store\templatetags\cart.py, line 7, in is_in_cart
Raised during:  store.views.home.store
Python Executable:  C:\Users\acer\PycharmProjects\Eshop\venv\Scripts\python.exe
Python Version:     3.10.7
Python Path:

['C:\Users\acer\PycharmProjects\Eshop',
'C:\Users\acer\AppData\Local\Programs\Python\Python310\python310.zip',
'C:\Users\acer\AppData\Local\Programs\Python\Python310\DLLs',
'C:\Users\acer\AppData\Local\Programs\Python\Python310\lib',
'C:\Users\acer\AppData\Local\Programs\Python\Python310',
'C:\Users\acer\PycharmProjects\Eshop\venv',
'C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages']

Server time:    Sun, 11 Dec 2022 07:08:14 +0000
Error during template rendering

In template C:\Users\acer\PycharmProjects\Eshop\store\templates\index.html, error at line 40
invalid literal for int() with base 10: ''
30
31
32
33                          {{product.name}}

34                          {{product.price|currency}}

35

36
37

38
39

40                          {% if product|is_in_cart:request.session.cart %}
41
42
43                                  {% csrf_token %}
44
45
46
47
48                              {{product|cart_quantity:request.session.cart}} in Cart
49
50                                  {% csrf_token %}

Body:
Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/store

Django Version: 4.1.3
Python Version: 3.10.7
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'store']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template error:
In template C:\Users\acer\PycharmProjects\Eshop\store\templates\index.html, error at line 40
   invalid literal for int() with base 10: ''
   30 :

   31 :
   32 :

   33 :
{{product.name}}

   34 :
{{product.price|currency}}

   35 :
   36 :

   37 :
   38 :

   39 :
   40 :                          {% if product|is_in_cart:request.session.cart %}
   41 :

   42 :                             <form action="/#{{product.id}}" class="col-2 " method="post">
   43 :                                 {% csrf_token %}
   44 :                                 <input hidden type="text" name='product' value='{{product.id}}'>
   45 :                                 <input hidden type="text" name='remove' value='True'>
   46 :                                 <input type="submit" value=" - " class="btn btn-block btn-success border-right">
   47 :                             </form>
   48 :
{{product|cart_quantity:request.session.cart}} in Cart

   49 :                             <form action="/#{{product.id}}" class="col-2 " method="post">
   50 :                                 {% csrf_token %}

Traceback (most recent call last):
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\acer\PycharmProjects\Eshop\store\views\home.py", line 57, in store
    return render(request, 'index.html', data)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\backends\django.py", line 62, in render
    return self.template.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 175, in render
    return self._render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 167, in _render
    return self.nodelist.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\loader_tags.py", line 157, in render
    return compiled_parent._render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 167, in _render
    return self.nodelist.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\loader_tags.py", line 63, in render
    result = block.nodelist.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\defaulttags.py", line 238, in render
    nodelist.append(node.render_annotated(context))
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\defaulttags.py", line 315, in render
    match = condition.eval(context)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\defaulttags.py", line 878, in eval
    return self.value.resolve(context, ignore_failures=True)
  File "C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages\django\template\base.py", line 742, in resolve
    new_obj = func(obj, *arg_vals)
  File "C:\Users\acer\PycharmProjects\Eshop\store\templatetags\cart.py", line 7, in is_in_cart
    if int(id) == product.id:

Exception Type: ValueError at /store
Exception Value: invalid literal for int() with base 10: ''

I was trying to run the website but it is showing the following error message:

ValueError at /store

invalid literal for int() with base 10: ''

Request Method:     GET
Request URL:    http://127.0.0.1:8000/store
Django Version:     4.1.3
Exception Type:     ValueError
Exception Value:

invalid literal for int() with base 10: ''

Exception Location:     C:\Users\acer\PycharmProjects\Eshop\store\templatetags\cart.py, line 7, in is_in_cart
Raised during:  store.views.home.store
Python Executable:  C:\Users\acer\PycharmProjects\Eshop\venv\Scripts\python.exe
Python Version:     3.10.7
Python Path:

['C:\Users\acer\PycharmProjects\Eshop',
'C:\Users\acer\AppData\Local\Programs\Python\Python310\python310.zip',
'C:\Users\acer\AppData\Local\Programs\Python\Python310\DLLs',
'C:\Users\acer\AppData\Local\Programs\Python\Python310\lib',
'C:\Users\acer\AppData\Local\Programs\Python\Python310',
'C:\Users\acer\PycharmProjects\Eshop\venv',
'C:\Users\acer\PycharmProjects\Eshop\venv\lib\site-packages']

Server time:    Sun, 11 Dec 2022 07:08:14 +0000
Error during template rendering

In template C:\Users\acer\PycharmProjects\Eshop\store\templates\index.html, error at line 40
invalid literal for int() with base 10: ''
30
31
32
33                          {{product.name}}

34                          {{product.price|currency}}

35

36
37

38
39

40                          {% if product|is_in_cart:request.session.cart %}
41
42
43                                  {% csrf_token %}
44
45
46
47
48                              {{product|cart_quantity:request.session.cart}} in Cart
49
50                                  {% csrf_token %}


问:
How can I force VS Code to be consistent for indentation?
I have two docker-compose.yml files in two different projects.

For one, VS Code uses 2 spaces as the indentation space, for the other it uses 4 spaces.

This happens for almost all of file types. .js files and .jsx files and .html files.

We want to make it deterministics for all files regardless of their types and extensions.

We want to force VS Code to indent each new line by 4 spaces, or a simple tab.

Is that possible?

We looked at Edior: Tab Size and it already says 4. So, where does 2 spaces come from?


问:
How to solve Build failed in react native?
here is my problem or error I'm facing please click here to see...

Here is my node error in metro bundler..

```<code>                    #######
               ################
            #########     #########
        #########             ##########
    #########        ######        #########
   ##########################################
  #####      #####################       #####
  #####          ##############          #####
  #####    ###       ######       ###    #####
  #####    #######            #######    #####
  #####    ###########    ###########    #####
  #####    ##########################    #####
  #####    ##########################    #####
  #####      ######################     ######
   ######        #############        #######
     #########        ####       #########
          #########          #########
              ######### #########
                   #########

                Welcome to Metro!
          Fast - Scalable - Integrated
</code>```

To reload the app press "r"
To open developer menu press "d"

Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:140:10)
at stableHash (D:\EMproject\eMembership-React-Native\node_modules\metro-cache\src\stableHash.js:19:8)
at Object.getCacheKey (D:\EMproject\eMembership-React-Native\node_modules\metro-transform-worker\src\index.js:593:7)
at getTransformCacheKey (D:\EMproject\eMembership-React-Native\node_modules\metro\src\DeltaBundler\getTransformCacheKey.js:24:19)
at new Transformer (D:\EMproject\eMembership-React-Native\node_modules\metro\src\DeltaBundler\Transformer.js:48:9)
at D:\EMproject\eMembership-React-Native\node_modules\metro\src\Bundler.js:22:29 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

This is an error I'm getting ...

PS D:\EMproject\eMembership-React-Native> npm run android

eMembershipCard@0.0.4 android
react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 3139 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...

FAILURE: Build failed with an exception.

What went wrong:
A problem occurred configuring root project 'eMembershipCard'.

Could not resolve all files for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7: 1.7.20.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/ 1.7.20/kotlin-stdlib-jre7- 1.7.20.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/ 1.7.20/kotlin-stdlib-jre7- 1.7.20.pom

Required by:
project :

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 15s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

What went wrong:
A problem occurred configuring root project 'eMembershipCard'.

Could not resolve all files for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7: 1.7.20.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/ 1.7.20/kotlin-stdlib-jre7- 1.7.20.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/ 1.7.20/kotlin-stdlib-jre7- 1.7.20.pom
Required by:
project :

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 15s

```<code>at makeError (D:\EMproject\eMembership-React-Native\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at D:\EMproject\eMembership-React-Native\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (D:\EMproject\eMembership-React-Native\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\EMproject\eMembership-React-Native\node_modules\@react-native-community\cli\build\index.js:192:9)
</code>```

info Run CLI with --verbose flag for more details.
PS D:\EMproject\eMembership-React-Native>

Here is my package.json file...

```<code>{
  "name": "eMembershipCard",
  "version": "0.0.4",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "android_emembershipcard": "react-native run-android --variant=emembershipcardDebug  --appIdSuffix = 'membershipdemo' ",
    "android_omaha": "react-native run-android --variant=omahaDebug  --appIdSuffix = 'ocm' ",
    "android_magichouse": "react-native run-android --variant=magichouseDebug  --appIdSuffix = 'magichouse' ",
    "ios_emembershipcard": "react-native run-ios --scheme eMembershipCard --configuration eMembershipCard",
    "ios_omaha": "react-native run-ios --scheme omaha --configuration omaha",
    "ios_magichouse": "react-native run-ios --scheme magichouse --configuration magichouse",
    "emembership-build": "cd android && ./gradlew assembleemembershipcardRelease",
    "emembership-build-debug": "cd android && ./gradlew assembleemembershipcardDebug",
    "omaha-build-debug": "cd android && ./gradlew assembleomahaDebug",
    "magichouse-build-debug": "cd android && ./gradlew assemblemagichouseDebug",
    "emembership-build-debug-bundle": "cd android && ./gradlew bundleemembershipcardDebug",
    "omaha-build-debug-bundle": "cd android && ./gradlew bundleomahaDebug",
    "magichouse-build-debug-bundle": "cd android && ./gradlew bundlemagichouseDebug"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.16.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^7.1.5",
    "@react-native-firebase/app": "^14.12.0",
    "@react-native-firebase/messaging": "^14.2.2",
    "@react-navigation/drawer": "^6.1.8",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "android": "^0.0.8",
    "axios": "^0.24.0",
    "linkify-html": "^3.0.5",
    "moment": "^2.29.1",
    "react": "17.0.2",
    "react-native": "0.66.4",
    "react-native-barcode-builder": "^2.0.0",
    "react-native-camera": "^4.2.1",
    "react-native-collapsible": "^1.6.0",
    "react-native-config": "^1.4.11",
    "react-native-dots-pagination": "^0.2.0",
    "react-native-flash-message": "^0.2.0",
    "react-native-floating-action": "^1.22.0",
    "react-native-geolocation-service": "^5.3.0-beta.4",
    "react-native-gesture-handler": "^2.0.0",
    "react-native-gradient-buttons": "^2.0.2",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-hyperlink": "^0.0.19",
    "react-native-image-pan-zoom": "^2.1.12",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-marquee": "^0.3.2",
    "react-native-material-menu": "^2.0.0",
    "react-native-modal": "^13.0.1",
    "react-native-open-maps": "^0.4.0",
    "react-native-pager-view": "^5.4.9",
    "react-native-permissions": "^3.2.0",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-qrcode-scanner": "^1.5.4",
    "react-native-qrcode-svg": "^6.1.2",
    "react-native-reanimated": "^2.2.4",
    "react-native-render-html": "^6.3.1",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.0",
    "react-native-share": "^7.3.5",
    "react-native-splash-screen": "^3.3.0",
    "react-native-sqlite-storage": "^6.0.1",
    "react-native-svg": "^12.1.1",
    "react-native-unimodules": "^0.14.10",
    "react-native-uuid": "^2.0.1",
    "react-native-viewpager": "^0.2.13",
    "react-native-wallet": "^1.0.8",
    "react-native-webview": "^11.15.0",
    "rn-fetch-blob": "^0.12.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

</code>```

What I have tried...

I think the commands which is necessary to solve the error I have tried ...

And also I have set the environment setup very properly as the react native setup docs says ...

I have updated gradle version , kotlin version, react native version , npm version , node version etc...

I have also updated Firebase app , Firebase message and Firebase.. where Firebase app and messages version should be same...

I have also set up the SDK TOOLS, Android SDK in Android studio ...

I have uninstalled the nodes, vs code and again reinstalled it but again facing the same issue i.e.     Build Failed....

**Here is my android/build.gradle ...

`

```<code>buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 31
        ndkVersion = "21.4.7075529"
        kotlin_version = '1.7.20'
        android_plugin_version = '7.3.1'
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:7.3.1')
        classpath 'com.google.gms:google-services:4.3.10'
        classpath "org.jetbrains.kotlin:kotlin-stdlib-jre7: 1.7.20"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
    }
}

</code>```

`

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

Body:
here is my problem or error I'm facing please click here to see...

Here is my node error in metro bundler..

                    #######
               ################
            #########     #########
        #########             ##########
    #########        ######        #########
   ##########################################
  #####      #####################       #####
  #####          ##############          #####
  #####    ###       ######       ###    #####
  #####    #######            #######    #####
  #####    ###########    ###########    #####
  #####    ##########################    #####
  #####    ##########################    #####
  #####      ######################     ######
   ######        #############        #######
     #########        ####       #########
          #########          #########
              ######### #########
                   #########

                Welcome to Metro!
          Fast - Scalable - Integrated

To reload the app press "r"
To open developer menu press "d"

Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:140:10)
at stableHash (D:\EMproject\eMembership-React-Native\node_modules\metro-cache\src\stableHash.js:19:8)
at Object.getCacheKey (D:\EMproject\eMembership-React-Native\node_modules\metro-transform-worker\src\index.js:593:7)
at getTransformCacheKey (D:\EMproject\eMembership-React-Native\node_modules\metro\src\DeltaBundler\getTransformCacheKey.js:24:19)
at new Transformer (D:\EMproject\eMembership-React-Native\node_modules\metro\src\DeltaBundler\Transformer.js:48:9)
at D:\EMproject\eMembership-React-Native\node_modules\metro\src\Bundler.js:22:29 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

This is an error I'm getting ...

PS D:\EMproject\eMembership-React-Native> npm run android

eMembershipCard@0.0.4 android
react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 3139 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...

FAILURE: Build failed with an exception.

What went wrong:
A problem occurred configuring root project 'eMembershipCard'.

Could not resolve all files for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7: 1.7.20.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/ 1.7.20/kotlin-stdlib-jre7- 1.7.20.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/ 1.7.20/kotlin-stdlib-jre7- 1.7.20.pom

Required by:
project :

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 15s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

What went wrong:
A problem occurred configuring root project 'eMembershipCard'.

Could not resolve all files for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7: 1.7.20.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/ 1.7.20/kotlin-stdlib-jre7- 1.7.20.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/ 1.7.20/kotlin-stdlib-jre7- 1.7.20.pom
Required by:
project :

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 15s

at makeError (D:\EMproject\eMembership-React-Native\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at D:\EMproject\eMembership-React-Native\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (D:\EMproject\eMembership-React-Native\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\EMproject\eMembership-React-Native\node_modules\@react-native-community\cli\build\index.js:192:9)

info Run CLI with --verbose flag for more details.
PS D:\EMproject\eMembership-React-Native>

Here is my package.json file...

{
  "name": "eMembershipCard",
  "version": "0.0.4",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "android_emembershipcard": "react-native run-android --variant=emembershipcardDebug  --appIdSuffix = 'membershipdemo' ",
    "android_omaha": "react-native run-android --variant=omahaDebug  --appIdSuffix = 'ocm' ",
    "android_magichouse": "react-native run-android --variant=magichouseDebug  --appIdSuffix = 'magichouse' ",
    "ios_emembershipcard": "react-native run-ios --scheme eMembershipCard --configuration eMembershipCard",
    "ios_omaha": "react-native run-ios --scheme omaha --configuration omaha",
    "ios_magichouse": "react-native run-ios --scheme magichouse --configuration magichouse",
    "emembership-build": "cd android && ./gradlew assembleemembershipcardRelease",
    "emembership-build-debug": "cd android && ./gradlew assembleemembershipcardDebug",
    "omaha-build-debug": "cd android && ./gradlew assembleomahaDebug",
    "magichouse-build-debug": "cd android && ./gradlew assemblemagichouseDebug",
    "emembership-build-debug-bundle": "cd android && ./gradlew bundleemembershipcardDebug",
    "omaha-build-debug-bundle": "cd android && ./gradlew bundleomahaDebug",
    "magichouse-build-debug-bundle": "cd android && ./gradlew bundlemagichouseDebug"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.16.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^7.1.5",
    "@react-native-firebase/app": "^14.12.0",
    "@react-native-firebase/messaging": "^14.2.2",
    "@react-navigation/drawer": "^6.1.8",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "android": "^0.0.8",
    "axios": "^0.24.0",
    "linkify-html": "^3.0.5",
    "moment": "^2.29.1",
    "react": "17.0.2",
    "react-native": "0.66.4",
    "react-native-barcode-builder": "^2.0.0",
    "react-native-camera": "^4.2.1",
    "react-native-collapsible": "^1.6.0",
    "react-native-config": "^1.4.11",
    "react-native-dots-pagination": "^0.2.0",
    "react-native-flash-message": "^0.2.0",
    "react-native-floating-action": "^1.22.0",
    "react-native-geolocation-service": "^5.3.0-beta.4",
    "react-native-gesture-handler": "^2.0.0",
    "react-native-gradient-buttons": "^2.0.2",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-hyperlink": "^0.0.19",
    "react-native-image-pan-zoom": "^2.1.12",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-marquee": "^0.3.2",
    "react-native-material-menu": "^2.0.0",
    "react-native-modal": "^13.0.1",
    "react-native-open-maps": "^0.4.0",
    "react-native-pager-view": "^5.4.9",
    "react-native-permissions": "^3.2.0",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-qrcode-scanner": "^1.5.4",
    "react-native-qrcode-svg": "^6.1.2",
    "react-native-reanimated": "^2.2.4",
    "react-native-render-html": "^6.3.1",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.0",
    "react-native-share": "^7.3.5",
    "react-native-splash-screen": "^3.3.0",
    "react-native-sqlite-storage": "^6.0.1",
    "react-native-svg": "^12.1.1",
    "react-native-unimodules": "^0.14.10",
    "react-native-uuid": "^2.0.1",
    "react-native-viewpager": "^0.2.13",
    "react-native-wallet": "^1.0.8",
    "react-native-webview": "^11.15.0",
    "rn-fetch-blob": "^0.12.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

What I have tried...

I think the commands which is necessary to solve the error I have tried ...

And also I have set the environment setup very properly as the react native setup docs says ...

I have updated gradle version , kotlin version, react native version , npm version , node version etc...

I have also updated Firebase app , Firebase message and Firebase.. where Firebase app and messages version should be same...

I have also set up the SDK TOOLS, Android SDK in Android studio ...

I have uninstalled the nodes, vs code and again reinstalled it but again facing the same issue i.e.     Build Failed....

**Here is my android/build.gradle ...

`

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 31
        ndkVersion = "21.4.7075529"
        kotlin_version = '1.7.20'
        android_plugin_version = '7.3.1'
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:7.3.1')
        classpath 'com.google.gms:google-services:4.3.10'
        classpath "org.jetbrains.kotlin:kotlin-stdlib-jre7: 1.7.20"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
    }
}

`


问:
I have a problem with node js rtsp streaming server
I made rtsp cctv streaming server with nodjs.

But it is not stable.

Some cctvs works well but others are not.

First I thought rtsp url has its own problem, but it may not.
Because the url worked well in vlc player.

I don't know what I'm missing.

below is my whole code related cctv streaming.

var express = require('express');
var router = express.Router();
var kill  = require('tree-kill');
var fs = require('fs');
var path = require('path');

var ffmpeg = require('fluent-ffmpeg');
var ffmpegInstaller = require('@ffmpeg-installer/ffmpeg');
ffmpeg.setFfmpegPath(ffmpegInstaller.path)

var streams = {};

//start cctv
router.post('/', (req, res) => {

  var cname = req.body.cname;
  var url = req.body.url;

  //if there is same cctv name
  if(streams[cname] != null) {
    res.status(409).send("duplicate name");
    return;
  };

  //create dir as given cctv name;
  mkdir(cname);

  stream = ffmpeg(url).addOptions([
    '-hls_time 5',
    '-hls_list_size 10',
    '-hls_flags delete_segments',
    '-f hls'
  ]).output('./public/video/' + cname + '/'  + cname + '.m3u8'); //save path

  console.log("Start cctv streaming");
  stream.on('error', function(err, stdout, stderr) {
    console.log("cctv has been stoped");
    console.log(err);
  });

  stream.run();

  streams[cname] = stream;
  res.status(201).send("OK");
});

//bring cctv pid by cctv name
router.get('/:cname', (req, res) => {
  var cname = req.params.cname;

  if(streams[cname] == null) {
    res.status(404).send("not found such a cctv");
    return;
  };

  var pid = streams[cname].ffmpegProc.pid;
  res.send({"pid": pid});
});

//stop cctv by pid
router.delete('/:cname', async (req, res) => {
  var cname = req.params.cname;

  //no cctv
  if(streams[cname] == null) {
    res.status(404).send("not found such a cctv");
    return;
  };

  //del dir
  var filePath = './public/video/' +  cname;
  fs.rmdir(filePath, { recursive: true }, (err) => {
    if (err) {
      console.log(err)
    } else {
      console.log('dir is deleted.');
    }
  });

  //var pid = streams[cname].ffmpegProc.pid;
  streams[cname].kill();
  res.status(204).send("OK");
});

const mkdir = (name) => {
  var root = './public/video/';
  if(!fs.existsSync(root + name)){
    fs.mkdirSync(root + name);
  }
}```

And this is ts file save folder.
cctv1 dosen't work well but cctv2 works well.
(cctv1 started first but created less ts file than cctv2.)

Body:
I made rtsp cctv streaming server with nodjs.

But it is not stable.

Some cctvs works well but others are not.

First I thought rtsp url has its own problem, but it may not.
Because the url worked well in vlc player.

I don't know what I'm missing.

below is my whole code related cctv streaming.

var express = require('express');
var router = express.Router();
var kill  = require('tree-kill');
var fs = require('fs');
var path = require('path');

var ffmpeg = require('fluent-ffmpeg');
var ffmpegInstaller = require('@ffmpeg-installer/ffmpeg');
ffmpeg.setFfmpegPath(ffmpegInstaller.path)

var streams = {};

//start cctv
router.post('/', (req, res) => {

  var cname = req.body.cname;
  var url = req.body.url;

  //if there is same cctv name
  if(streams[cname] != null) {
    res.status(409).send("duplicate name");
    return;
  };

  //create dir as given cctv name;
  mkdir(cname);

  stream = ffmpeg(url).addOptions([
    '-hls_time 5',
    '-hls_list_size 10',
    '-hls_flags delete_segments',
    '-f hls'
  ]).output('./public/video/' + cname + '/'  + cname + '.m3u8'); //save path

  console.log("Start cctv streaming");
  stream.on('error', function(err, stdout, stderr) {
    console.log("cctv has been stoped");
    console.log(err);
  });

  stream.run();

  streams[cname] = stream;
  res.status(201).send("OK");
});

//bring cctv pid by cctv name
router.get('/:cname', (req, res) => {
  var cname = req.params.cname;

  if(streams[cname] == null) {
    res.status(404).send("not found such a cctv");
    return;
  };

  var pid = streams[cname].ffmpegProc.pid;
  res.send({"pid": pid});
});

//stop cctv by pid
router.delete('/:cname', async (req, res) => {
  var cname = req.params.cname;

  //no cctv
  if(streams[cname] == null) {
    res.status(404).send("not found such a cctv");
    return;
  };

  //del dir
  var filePath = './public/video/' +  cname;
  fs.rmdir(filePath, { recursive: true }, (err) => {
    if (err) {
      console.log(err)
    } else {
      console.log('dir is deleted.');
    }
  });

  //var pid = streams[cname].ffmpegProc.pid;
  streams[cname].kill();
  res.status(204).send("OK");
});

const mkdir = (name) => {
  var root = './public/video/';
  if(!fs.existsSync(root + name)){
    fs.mkdirSync(root + name);
  }
}

And this is ts file save folder.
cctv1 dosen't work well but cctv2 works well.
(cctv1 started first but created less ts file than cctv2.)


问:
Missing Keyword Error in Oracle SQL Database
I have created my table emp1 which is
create TABLE emp1(

id INTEGER Not NULL,
PRIMARY KEY (id),
fname VARCHAR(20),
lname VARCHAR(20),
salary NUMBER(8,2),
streetadd VARCHAR(20),
city VARCHAR(20),
country VARCHAR(20)
);

and also I have inserted on it

INSERT INTO emp1 values(1,'ahmed','hamza',20000,'shah faisal colony','karachi','Pakistan');
INSERT INTO emp1 values(2,'Laiba','khaliq',30000,'shah faisal colony','karachi','Pakistan');
INSERT INTO emp1 values(3,'Anas','Khaliq',40000,'shah faisal colony','karachi','Pakistan');
INSERT INTO emp1 values(4,'Laiba','Shakeel',50000,'shah faisal colony','karachi','Pakistan');
INSERT INTO emp1 values(5,'Summer','Shah',60000,'shah faisal colony','karachi','Pakistan');
INSERT INTO emp1 values(6,'Ali','Haider',70000,'shah faisal colony','karachi','Pakistan');
INSERT INTO emp1 values(7,'Umer','Farooq',80000,'shah faisal colony','karachi','Pakistan');

But Then I want to add a new column on which is auto generated oracle is giving me error which is "missing keyword"
This modification I have to do
ALTER TABLE emp1 add ssn INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 0 INCREMENT BY 1 ) NOT NULL ;

**I just want to know why it is giving me error on modification **


问:
Cluster ploynomial plots
I have a dataset containg images of first order to 5th order polynomails and I want to cluster them, using unsupervised machine learning.

Can any one help me to do so?

I already tried VGG16 to extract features but I guess since my images are just lines, it can not work properly.

Title: Cluster ploynomial plots


问:
Is this considered a cycle?
Regarding precedence graphs and conflict serializability, is it considered a cycle when two nodes are connected by a cycle but each arrow refers to a different object?  For example:

Thanks!

Title: Is this considered a cycle?


问:
Rotating User-Agents in python web-scraping script for Google Scholar website but still I am not able to get any data(Laravel)
This is my Python Script

```<code>import sys
import pandas as pd
from bs4 import BeautifulSoup
import requests

import requests, random

user_agent_list = [
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36',
  'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36',
  'Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.18',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36 OPR/84.0.4316.14',
  'Opera/9.80 (Linux armv7l) Presto/2.12.407 Version/12.51 , D50u-D1-UHD/V1.5.16-UHD (Vizio, D50u-D1, Wireless)',
  'Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14',
  'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 OPR/42.0.2393.94',
  'Mozilla/5.0 (Linux; U; Android 8.1.0; zh-CN; EML-AL00 Build/HUAWEIEML-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 baidu.sogo.uc.UCBrowser/11.9.4.974 UWS/2.13.1.48 Mobile Safari/537.36 AliApp(DingTalk/4.5.11) com.alibaba.android.rimet/10487439 Channel/227200 language/zh-CN',
  'Mozilla/5.0 (X11; U; Linux i686; en-US) U2/1.0.0 UCBrowser/9.3.1.344',
  'Mozilla/5.0 (Linux; U; Android 10; en-US; RMX1901 Build/QKQ1.190918.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 UCBrowser/13.4.0.1306 Mobile Safari/537.36',
  'UCWEB/2.0 (Java; U; MIDP-2.0; Nokia203/20.37) U2/1.0.0 UCBrowser/8.7.0.218 U2/1.0.0 Mobile'
]

for _ in user_agent_list:
  #Pick a random user agent
  user_agent = random.choice(user_agent_list)

  #Set the headers
  headers = {'User-Agent': user_agent}

url  = 'https://scholar.google.com/citations?user=EnegzCwAAAAJ&hl=&view_op=list_works&cstart=0&pagesize=100'

response=requests.get(url,headers=headers)

soup=BeautifulSoup(response.text,'lxml')

table = soup.find('table',{'id':'gsc_a_t'})

titles = []
for item in table.find_all(class_='gsc_a_at'):
  title = item.text
  titles.append(title)

print(titles)

</code>```

This is the error I am getting because it is not able to find that classes as it doesn't get the main website in response

Traceback (most recent call last):   File "D:\Research
SPIT\scraper\public\title.py", line 44, in
for item in table.find_all(class_='gsc_a_at'): AttributeError: 'NoneType' object has no attribute 'find_all'

This is my controller

```<code>$process = new Process(['python', public_path() . '/title.py'], null, ['SYSTEMROOT' => getenv('SYSTEMROOT'), 'PATH' => getenv("PATH")]);

        $process->run();

        if (!$process->isSuccessful()) {
            dd($process->getErrorOutput());
        }

        dd($process->getOutput());
</code>```

Tried multiple fake-user agents nothing is working for me, Any help would be really appreciated

Body:
This is my Python Script

import sys
import pandas as pd
from bs4 import BeautifulSoup
import requests

import requests, random

user_agent_list = [
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36',
  'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36',
  'Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.18',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36 OPR/84.0.4316.14',
  'Opera/9.80 (Linux armv7l) Presto/2.12.407 Version/12.51 , D50u-D1-UHD/V1.5.16-UHD (Vizio, D50u-D1, Wireless)',
  'Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14',
  'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 OPR/42.0.2393.94',
  'Mozilla/5.0 (Linux; U; Android 8.1.0; zh-CN; EML-AL00 Build/HUAWEIEML-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 baidu.sogo.uc.UCBrowser/11.9.4.974 UWS/2.13.1.48 Mobile Safari/537.36 AliApp(DingTalk/4.5.11) com.alibaba.android.rimet/10487439 Channel/227200 language/zh-CN',
  'Mozilla/5.0 (X11; U; Linux i686; en-US) U2/1.0.0 UCBrowser/9.3.1.344',
  'Mozilla/5.0 (Linux; U; Android 10; en-US; RMX1901 Build/QKQ1.190918.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 UCBrowser/13.4.0.1306 Mobile Safari/537.36',
  'UCWEB/2.0 (Java; U; MIDP-2.0; Nokia203/20.37) U2/1.0.0 UCBrowser/8.7.0.218 U2/1.0.0 Mobile'
]

for _ in user_agent_list:
  #Pick a random user agent
  user_agent = random.choice(user_agent_list)

  #Set the headers
  headers = {'User-Agent': user_agent}

url  = 'https://scholar.google.com/citations?user=EnegzCwAAAAJ&hl=&view_op=list_works&cstart=0&pagesize=100'

response=requests.get(url,headers=headers)

soup=BeautifulSoup(response.text,'lxml')

table = soup.find('table',{'id':'gsc_a_t'})

titles = []
for item in table.find_all(class_='gsc_a_at'):
  title = item.text
  titles.append(title)

print(titles)

This is the error I am getting because it is not able to find that classes as it doesn't get the main website in response

Traceback (most recent call last):   File "D:\Research
SPIT\scraper\public\title.py", line 44, in
for item in table.find_all(class_='gsc_a_at'): AttributeError: 'NoneType' object has no attribute 'find_all'

This is my controller

$process = new Process(['python', public_path() . '/title.py'], null, ['SYSTEMROOT' => getenv('SYSTEMROOT'), 'PATH' => getenv("PATH")]);

        $process->run();

        if (!$process->isSuccessful()) {
            dd($process->getErrorOutput());
        }

        dd($process->getOutput());

Tried multiple fake-user agents nothing is working for me, Any help would be really appreciated


问:
Issue with Formview blocking the main view in react native android application
```<code><View style={styles.bottomContainer} >
        <Animated.View style = {buttonAnimatedStyle}>
        <Pressable style={styles.button} onPress = {loginHandler} >
          <Text style={styles.buttontext} >LOG IN</Text>
        </Pressable>
        </Animated.View>
        <Animated.View style = {buttonAnimatedStyle}>
        <Pressable style={styles.button} >
          <Text style={styles.buttontext} onPress = {registerHandler} >REGISTER</Text>
        </Pressable>
        </Animated.View>

        <Animated.View style={[styles.inputformcontainer, formAnimatedStyle ]}>
        <TextInput placeholder="Email"
         placeholderTextColor="#9b1306"
          style={styles.textinput}/>
        <TextInput placeholder="Full Name"
         placeholderTextColor="#9b1306"
          style={styles.textinput}/>
        <TextInput placeholder="Password"
         placeholderTextColor="#9b1306"
          style={styles.textinput}/>
        <View style = {styles.formButton}>
          <Text style={styles.buttontext}> LOG IN </Text>
        </View>
      </Animated.View>

    </View>
</code>```

Here is the Styling of above views:

```<code> bottomContainer: {
        justifyContent: 'center',
        height: height / 3,
    },
</code>```
```<code>inputformcontainer:{
        backgroundColor:'grey',
        color: '#000',
        marginBottom: 70,
        ...StyleSheet.absoluteFill,
        justifyContent : "center",
    },
</code>```

DETAILS OF THE CODE
so basically I am trying to create an aninated view where the "forminput" container should pop up when user taps on log in or register button. But the problem is that my buttons dont work when because the forminput container lands on top of them somehow (eventho it is invisible). The person I am following used
zIndex: -1
to place it underneath the view but it does not work in android.
PS: I have also tried "elevation" Prop but that doest seem to work either.

Body:
<View style={styles.bottomContainer} >
        <Animated.View style = {buttonAnimatedStyle}>
        <Pressable style={styles.button} onPress = {loginHandler} >
          <Text style={styles.buttontext} >LOG IN</Text>
        </Pressable>
        </Animated.View>
        <Animated.View style = {buttonAnimatedStyle}>
        <Pressable style={styles.button} >
          <Text style={styles.buttontext} onPress = {registerHandler} >REGISTER</Text>
        </Pressable>
        </Animated.View>

        <Animated.View style={[styles.inputformcontainer, formAnimatedStyle ]}>
        <TextInput placeholder="Email"
         placeholderTextColor="#9b1306"
          style={styles.textinput}/>
        <TextInput placeholder="Full Name"
         placeholderTextColor="#9b1306"
          style={styles.textinput}/>
        <TextInput placeholder="Password"
         placeholderTextColor="#9b1306"
          style={styles.textinput}/>
        <View style = {styles.formButton}>
          <Text style={styles.buttontext}> LOG IN </Text>
        </View>
      </Animated.View>

    </View>

Here is the Styling of above views:

 bottomContainer: {
        justifyContent: 'center',
        height: height / 3,
    },

inputformcontainer:{
        backgroundColor:'grey',
        color: '#000',
        marginBottom: 70,
        ...StyleSheet.absoluteFill,
        justifyContent : "center",
    },

DETAILS OF THE CODE
so basically I am trying to create an aninated view where the "forminput" container should pop up when user taps on log in or register button. But the problem is that my buttons dont work when because the forminput container lands on top of them somehow (eventho it is invisible). The person I am following used
zIndex: -1
to place it underneath the view but it does not work in android.
PS: I have also tried "elevation" Prop but that doest seem to work either.


问:
Using backstage
I'd like to attempt to start using Spotify's Backstage at my job, but, I'm a bit clueless on how to start exactly...

I currently want to use it for two main tasks we have in our infrastructure - I want to add documentation to the Backstage platform, it can be even handwritten markdown files that will get centralized there - seems like it supports MkDocs so this should be doable...

Then, I want to embed in the Backstage platform a custom script/docker image we use to create DB replicas for local development.

Essentially, I want to start unifying in a central location some of our infrastructure and documentation concerns which I think is exactly what Backstage aims to solve.

I've managed to download and start the docker image. But, any more practical hands-on tutorials on how to embed and run custom docker images from the platform together with some docs?

Title: Using backstage


问:
How to mock an inject repository with Jest and NestJS?
In a NestJS project using Jest test the service case. I created a find method and use it in a resolver(GraphQL) function. When test the resolver, it can't find the find method in the service.

src/serivce/post.ts

    import { Injectable } from '@nestjs/common';
    import { InjectRepository } from '@nestjs/typeorm';

    import { AbstractPostRepository } from '@abstractRepository/AbstractPostRepository';
    import { PostRepository } from '@repository/PostRepository';

    @Injectable()
    export class PostService {
      constructor(
        @InjectRepository(PostRepository)
        private postRepo: AbstractPostRepository,
      ) {}

      async findById(id: string) {
        const posts = await this.postRepo.findById(id);

        ......
        return posts;
      }
    }
```
<p>src/resolver/query/post.ts</p>
<pre class="lang-js prettyprint-override"><code>    import { Args, Query, Resolver } from '@nestjs/graphql';

    import { Authorized } from '@lib/auth/authorized';
    import { PermissionScope } from '@lib/auth/permissionScope';
    import { PostService } from '@service/postService';

    @Resolver()
    export class PostsResolver {
      constructor(private postService: PostService) {}

      @PermissionScope()
      @Authorized([
        PermissionEnum.READ_MANAGEMENT,
      ])
      @Query()
      async findPosts() {
         return await this.postService.findById(id);
      }
    }
</code>```

The unit test for a resolver related this service:

test/unit/resolver/post.spec.ts

    import { Test, TestingModule } from '@nestjs/testing';

    import { PERMISSION_MANAGER } from '@lib/auth/permissionManager.module';
    import { PostsResolver } from '@resolver/query/post';
    import { PostService } from '@service/postService';

    describe('PostsResolver', () => {
      let resolver: PostsResolver;

      beforeEach(async () => {
        const module: TestingModule = await Test.createTestingModule({
          providers: [
            PostsResolver,
            {
              provide: PERMISSION_MANAGER,
              useValue: jest.fn(),
            },
            {
              provide: PostService,
              useFactory: () => ({
                findById: jest.fn(() => [
                  {
                    id: '11111111-1111-1111-1111-111111111111',
                    name: 'name1',
                  },
                ]),
              }),
            },
          ],
        }).compile();

        resolver = module.get<PostsResolver>(PostsResolver);
      });

      describe('findPosts', () => {
        it('should return data', async () => {
          const posts = await resolver.findPosts({
            id: '11111111-1111-1111-1111-111111111111',
          });

          const expected = [
            {
              id: '11111111-1111-1111-1111-111111111111',
              name: 'name1',
            },
          ];

          expect(posts).toEqual(expected);
        });
      });
    });
```
<p>When run this test got error:</p>
<pre class="lang-bash prettyprint-override"><code>  ● PostsResolver › findPosts › should return data

    TypeError: Cannot read properties of undefined (reading 'findById')

      22 |     { id }: FindPostsInput,
      23 |   ) {
    > 24 |     return await this.postService.findById(
         |                                         ^
      25 |       id,
      26 |     );

      at PostsResolver.findPosts (src/resolver/query/post.ts:24:41)
      at Object.<anonymous> (test/unit/resolver/post.spec.ts:59:42)
</code>```

It seems the mock service findById in the Test.createTestingModule doesn't work. How to mock correctly? Is it related some inject reasons?

Body:
In a NestJS project using Jest test the service case. I created a find method and use it in a resolver(GraphQL) function. When test the resolver, it can't find the find method in the service.

src/serivce/post.ts

    import { Injectable } from '@nestjs/common';
    import { InjectRepository } from '@nestjs/typeorm';

    import { AbstractPostRepository } from '@abstractRepository/AbstractPostRepository';
    import { PostRepository } from '@repository/PostRepository';

    @Injectable()
    export class PostService {
      constructor(
        @InjectRepository(PostRepository)
        private postRepo: AbstractPostRepository,
      ) {}

      async findById(id: string) {
        const posts = await this.postRepo.findById(id);

        ......
        return posts;
      }
    }

src/resolver/query/post.ts

    import { Args, Query, Resolver } from '@nestjs/graphql';

    import { Authorized } from '@lib/auth/authorized';
    import { PermissionScope } from '@lib/auth/permissionScope';
    import { PostService } from '@service/postService';

    @Resolver()
    export class PostsResolver {
      constructor(private postService: PostService) {}

      @PermissionScope()
      @Authorized([
        PermissionEnum.READ_MANAGEMENT,
      ])
      @Query()
      async findPosts() {
         return await this.postService.findById(id);
      }
    }

The unit test for a resolver related this service:

test/unit/resolver/post.spec.ts

    import { Test, TestingModule } from '@nestjs/testing';

    import { PERMISSION_MANAGER } from '@lib/auth/permissionManager.module';
    import { PostsResolver } from '@resolver/query/post';
    import { PostService } from '@service/postService';

    describe('PostsResolver', () => {
      let resolver: PostsResolver;

      beforeEach(async () => {
        const module: TestingModule = await Test.createTestingModule({
          providers: [
            PostsResolver,
            {
              provide: PERMISSION_MANAGER,
              useValue: jest.fn(),
            },
            {
              provide: PostService,
              useFactory: () => ({
                findById: jest.fn(() => [
                  {
                    id: '11111111-1111-1111-1111-111111111111',
                    name: 'name1',
                  },
                ]),
              }),
            },
          ],
        }).compile();

        resolver = module.get<PostsResolver>(PostsResolver);
      });

      describe('findPosts', () => {
        it('should return data', async () => {
          const posts = await resolver.findPosts({
            id: '11111111-1111-1111-1111-111111111111',
          });

          const expected = [
            {
              id: '11111111-1111-1111-1111-111111111111',
              name: 'name1',
            },
          ];

          expect(posts).toEqual(expected);
        });
      });
    });

When run this test got error:

  ● PostsResolver › findPosts › should return data

    TypeError: Cannot read properties of undefined (reading 'findById')

      22 |     { id }: FindPostsInput,
      23 |   ) {
    > 24 |     return await this.postService.findById(
         |                                         ^
      25 |       id,
      26 |     );

      at PostsResolver.findPosts (src/resolver/query/post.ts:24:41)
      at Object.<anonymous> (test/unit/resolver/post.spec.ts:59:42)

It seems the mock service findById in the Test.createTestingModule doesn't work. How to mock correctly? Is it related some inject reasons?


问:
React | React is not rendering anything in my project
this is my first question on Stackoverflow. I am trying to make a simple 'Hello World' project using React and Node. But it appears the browser is just not executing my code. I feel so stupid. Please help.

I expected to print 'Hello world' on a blue background. There is a blue background but no 'hello world'.

Installed React using the terminal: npm i react
Installed ReactDom: npm i react-dom

index.html file:

```<code><html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="styles.css">
    <script src="index.js" type = "text/jsx " defer></script>
</head>
<body>
    <div id="root">

    </div>

</body>
</html>
</code>```

index.js file:

```<code>import React from "react";
import ReactDOM from "react-dom";
ReactDOM.render(<p>hello world</p>, document.getElementById("root"));

</code>```

server.js file:

```<code>
const express=require("express");
const app = express();
app.use(express.static('public'));

app.get("/", function(req,res) {
    res.sendFile(__dirname+"/index.html");
});

app.listen(3000, function(){
    console.log("server running");
});

</code>```

styles.css file:

```<code>
body {
    background-color: blue;
}

</code>```

package.json file:

```<code>{
  "name": "try",
  "version": "1.0.0",
  "description": "Trial to check if everything--html,css,js,server-- connects.",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "author": "Rohit",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.2",
    "nodemon": "^2.0.20",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.19.3",
    "@babel/core": "^7.20.5"
  }
}
</code>```

Message in console:

Message in Chrome console

Node version:

v18.12.0

Body:
this is my first question on Stackoverflow. I am trying to make a simple 'Hello World' project using React and Node. But it appears the browser is just not executing my code. I feel so stupid. Please help.

I expected to print 'Hello world' on a blue background. There is a blue background but no 'hello world'.

Installed React using the terminal: npm i react
Installed ReactDom: npm i react-dom

index.html file:

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="styles.css">

index.js file:

import React from "react";
import ReactDOM from "react-dom";
ReactDOM.render(
hello world
, document.getElementById("root"));

server.js file:

const express=require("express");
const app = express();
app.use(express.static('public'));

app.get("/", function(req,res) {
    res.sendFile(__dirname+"/index.html");
});

app.listen(3000, function(){
    console.log("server running");
});

styles.css file:

body {
    background-color: blue;
}

package.json file:

{
  "name": "try",
  "version": "1.0.0",
  "description": "Trial to check if everything--html,css,js,server-- connects.",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "author": "Rohit",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.2",
    "nodemon": "^2.0.20",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.19.3",
    "@babel/core": "^7.20.5"
  }
}

Message in console:

Message in Chrome console

Node version:

v18.12.0


问:
Screen goes black after rotating the device only in ios 16
Some pages in the app support landscape mode.
After the ios 16 version was released
When turning the device horizontally, the screen becomes black, and only after turning horizontally again to the other side does the screen return to itself and the buttons function.
It is important to note that when I run on a device with iOS version 16 everything works great
I tried everything and could not find a solution
Has anyone tried this?

In my viewController:

```<code>    var orientationType : UIInterfaceOrientationMask
    {
        guard let parent = self.parent  else { return .allButUpsideDown }
        guard parent is BaseChannelViewController else { return .allButUpsideDown }

        return .portrait
    }

</code>```
```<code>public func animate(fullscreenPresentation completionBlock : AnimationCompletion?)
    {
        guard displayMode != .fullscreen else { completionBlock?(); return }
        guard !isDisplayedModaly         else { completionBlock?(); return }

        switch transitionType
        {
        case .default    : fallthrough
        case .minimizable: fallthrough
        case .interactive:

            guard let transition   = customTransitioningDelegate as? GAVideoPlayerZoomTransition           else { break }
            guard let presentingVC = dataSource?.presentingViewController(for: self)                       else { break }
            let originFrame = dataSource?.initialFrameForTransitionToFullScreenDisplay(from: displayMode.initialScreenMode, for: self) ?? self.view.frame

            transition.currentFrame = originFrame

            NotificationCenter.default.post(name: .GAVideoPlayerViewControllerWillEnterFullscreen, object: self)

            hideControlsNoAnimation()

            if let _ = parent
            {
                removeFromParent()
            }

            // FIXME - Need this to prevent bad access crash, will show un balanced animation calls in the logger
            view.removeFromSuperview()

            let clientOrientationRawValue = clientOrientation.rawValue

            presentingVC.present(self, animated: true) { [weak self] in

                self?.displayMode = .fullscreen
                let currentOrientationRawValue = UIDevice.current.orientation.rawValue
                UIDevice.current.setValue(clientOrientationRawValue, forKey: "orientation")
                UIDevice.current.setValue(currentOrientationRawValue, forKey: "orientation")

                completionBlock?()
            }
            break

        default: break
        }
    }
</code>```
```<code>    fileprivate var clientOrientation: UIDeviceOrientation
    {
        return UIDeviceOrientation(interfaceOrientationMask: clientSupportedInterfaceOrientations)
    }

</code>```

In AppDelegate:

```<code>    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask
    {
        guard let viewController = UIApplication.shared.topViewController() as? CustomOrientationViewController else { return .portrait }
        return viewController.orientationType
    }

</code>```

Body:
Some pages in the app support landscape mode.
After the ios 16 version was released
When turning the device horizontally, the screen becomes black, and only after turning horizontally again to the other side does the screen return to itself and the buttons function.
It is important to note that when I run on a device with iOS version 16 everything works great
I tried everything and could not find a solution
Has anyone tried this?

In my viewController:

    var orientationType : UIInterfaceOrientationMask
    {
        guard let parent = self.parent  else { return .allButUpsideDown }
        guard parent is BaseChannelViewController else { return .allButUpsideDown }

        return .portrait
    }

public func animate(fullscreenPresentation completionBlock : AnimationCompletion?)
    {
        guard displayMode != .fullscreen else { completionBlock?(); return }
        guard !isDisplayedModaly         else { completionBlock?(); return }

        switch transitionType
        {
        case .default    : fallthrough
        case .minimizable: fallthrough
        case .interactive:

            guard let transition   = customTransitioningDelegate as? GAVideoPlayerZoomTransition           else { break }
            guard let presentingVC = dataSource?.presentingViewController(for: self)                       else { break }
            let originFrame = dataSource?.initialFrameForTransitionToFullScreenDisplay(from: displayMode.initialScreenMode, for: self) ?? self.view.frame

            transition.currentFrame = originFrame

            NotificationCenter.default.post(name: .GAVideoPlayerViewControllerWillEnterFullscreen, object: self)

            hideControlsNoAnimation()

            if let _ = parent
            {
                removeFromParent()
            }

            // FIXME - Need this to prevent bad access crash, will show un balanced animation calls in the logger
            view.removeFromSuperview()

            let clientOrientationRawValue = clientOrientation.rawValue

            presentingVC.present(self, animated: true) { [weak self] in

                self?.displayMode = .fullscreen
                let currentOrientationRawValue = UIDevice.current.orientation.rawValue
                UIDevice.current.setValue(clientOrientationRawValue, forKey: "orientation")
                UIDevice.current.setValue(currentOrientationRawValue, forKey: "orientation")

                completionBlock?()
            }
            break

        default: break
        }
    }

    fileprivate var clientOrientation: UIDeviceOrientation
    {
        return UIDeviceOrientation(interfaceOrientationMask: clientSupportedInterfaceOrientations)
    }

In AppDelegate:

    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask
    {
        guard let viewController = UIApplication.shared.topViewController() as? CustomOrientationViewController else { return .portrait }
        return viewController.orientationType
    }