问:
Android Studio with Flutter doesn't see emulator
When I run Android Studio emulator through "Tools > AVD Manager > Click on run button next to device" and wait until it boots Android Studio still says no device connected. Also when I click on run button in the top right corner of the main Android Studio window to run the default Flutter code instead of running the app on the emulator it shows this error(while I have the emulator running):

When I run "flutter devices" in the cmd it says:

Running different Flutter commands in the cmd

D:\project\Flutter projects\first_app>flutter devices

No devices detected.

Run "flutter emulators" to list and start any available device
emulators.

If you expected your device to be detected, please run "flutter
doctor" to diagnose potential issues. You may also try increasing the
time to wait for connected devices with the --timeout flag. Visit
https://flutter.dev/setup/ for troubleshooting tips.

• Device emulator-5554 is not authorized. You might need to check your
device for an authorization dialog.

When I run "flutter emulators" in the cmd it says:

D:\project\Flutter projects\first_app>flutter emulators

1 available emulator:

Pixel_2_API_28 • Pixel 2 API 28 • Google • android

To run an emulator, run 'flutter emulators --launch '. To
create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links
below:   https://developer.android.com/studio/run/managing-avds

https://developer.android.com/studio/command-line/avdmanager

It doesn't matter if the emulator is running or not the responses to the commands above are the same in both cases.

Running "flutter doctor":

```<code>D:\project\Flutter projects\first_app>flutter doctor

Doctor summary (to see all details, run flutter doctor -v):

[√] Flutter (Channel
 stable, v1.17.3, on Microsoft Windows [Version 10.0.18362.900], locale
 ru-RU)

[!] Android toolchain - develop for Android devices (Android SDK
 version 30.0.0)

! Some Android licenses not accepted.  To resolve this, run: flutter doctor -->android-licenses

[√] Android Studio (version 3.6)

[!] Connected device

! Doctor found issues in 2 categories.
</code>```

When I run "flutter run" with a running emulator it says:

D:\project\Flutter projects\first_app>flutter run

No supported devices connected.

Environmental variables

My environmental variables related to Android Studio are so:

Both user and system variables have:

ANDROID_HOME = D:\Programs\AndroidSDK

ANDROID_SDK_HOME = D:\Programs\AndroidSDK\Home

ANDROID_SDK_ROOT = D:\Programs\AndroidSDK

ANDROID_AVD_HOME = D:\Programs\AndroidSDK\Home.android\avd

"Path" in both system and user variables contains:

%ANDROID_HOME%\platform-tools

%ANDROID_HOME%\tools

Genymotion

I have tried using Genymotion. I have lost all my hope in it and stopped using it when it responded with error window during first launch attempt.

Other forum answers

I have followed many answers from different forums. So:

I have my "Windows Hypervision Platform"(I think its alternative name is "Hyper-V") turned off. Intel VT-X is turned on in the BIOS settings. Memory Integrity is turned off in the Windows Defender, and I don't have any other anti-viruses than Windows Defender. I have tried running "adb kill-server" and then "adb start-server" to restart the server. I don't have VPN. Once I read that port-consuming applications may cause the problem, so I have XAMPP but I don't use it. I have "adb.exe" file in the "platform-tools" folder of Android SDK directory. I have tried reinstalling SDK platform tools. I have changed user name so it has only English characters and is without spaces but with capitals, it helped a bit.

SDK Tools and SDK Platforms

I have Android API 30.0 and Android 9.0 SDK platforms, Android SDK Platform-Tools, Android Emulator, Intel x86 Emulator Accelerator (HAXM installer), Android SDK Command-line Tools, Android Build-Tools 28.0.3 and Android Build-Tools 30.0.0 installed.

The emulator setup I use

My emulator has Android Pie version 9.0 API level 28 x86. The graphics parameter in the Emulated Performance section was "Automatic" when I was creating the device because I can't change it: when I click on the dropdown box nothing happens.

My PC

OS: Windows 10 x64.

CPU: Intel Core i3 6100U.

Device type: Laptop.

System type: x64.

Discreet GPU: NVIDIA GeForce 920MX.

Integrated GPU: Intel HD Graphics 520.

Android Studio: 3.6.3 (but I have tried using 4.0).

Android SDK and Android Studio itself are installed on non-system disk - disk D (HDD). While the disk C (SSD) is the system disk.

Other problems with the emulator

The emulator(and Android Studio itself) is very very laggy. Also it usually throws "X application is not responding" error from time to time and on boot. The application in the error is system application such as: UI, Launcher and etc.

I can't give up on the programming branch just because of some small problem at the beginning of the path, also I have purchased a course.

Thanks in advance for helping!

答:
It generally happens when you update your Android Studio.

run flutter doctor command.

run flutter doctor -->android-licenses command.

it will ask to accept some package license( it might ask one or more times to accept licenses ).

Accept? (y/N): y

run flutter doctor to verify.

Body:
When I run Android Studio emulator through "Tools > AVD Manager > Click on run button next to device" and wait until it boots Android Studio still says no device connected. Also when I click on run button in the top right corner of the main Android Studio window to run the default Flutter code instead of running the app on the emulator it shows this error(while I have the emulator running):

When I run "flutter devices" in the cmd it says:

Running different Flutter commands in the cmd

D:\project\Flutter projects\first_app>flutter devices

No devices detected.

Run "flutter emulators" to list and start any available device
emulators.

If you expected your device to be detected, please run "flutter
doctor" to diagnose potential issues. You may also try increasing the
time to wait for connected devices with the --timeout flag. Visit
https://flutter.dev/setup/ for troubleshooting tips.

• Device emulator-5554 is not authorized. You might need to check your
device for an authorization dialog.

When I run "flutter emulators" in the cmd it says:

D:\project\Flutter projects\first_app>flutter emulators

1 available emulator:

Pixel_2_API_28 • Pixel 2 API 28 • Google • android

To run an emulator, run 'flutter emulators --launch '. To
create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links
below:   https://developer.android.com/studio/run/managing-avds

https://developer.android.com/studio/command-line/avdmanager

It doesn't matter if the emulator is running or not the responses to the commands above are the same in both cases.

Running "flutter doctor":

D:\project\Flutter projects\first_app>flutter doctor

Doctor summary (to see all details, run flutter doctor -v):

[√] Flutter (Channel
 stable, v1.17.3, on Microsoft Windows [Version 10.0.18362.900], locale
 ru-RU)

[!] Android toolchain - develop for Android devices (Android SDK
 version 30.0.0)

! Some Android licenses not accepted.  To resolve this, run: flutter doctor -->android-licenses

[√] Android Studio (version 3.6)

[!] Connected device

! Doctor found issues in 2 categories.

When I run "flutter run" with a running emulator it says:

D:\project\Flutter projects\first_app>flutter run

No supported devices connected.

Environmental variables

My environmental variables related to Android Studio are so:

Both user and system variables have:

ANDROID_HOME = D:\Programs\AndroidSDK

ANDROID_SDK_HOME = D:\Programs\AndroidSDK\Home

ANDROID_SDK_ROOT = D:\Programs\AndroidSDK

ANDROID_AVD_HOME = D:\Programs\AndroidSDK\Home.android\avd

"Path" in both system and user variables contains:

%ANDROID_HOME%\platform-tools

%ANDROID_HOME%\tools

Genymotion

I have tried using Genymotion. I have lost all my hope in it and stopped using it when it responded with error window during first launch attempt.

Other forum answers

I have followed many answers from different forums. So:

I have my "Windows Hypervision Platform"(I think its alternative name is "Hyper-V") turned off. Intel VT-X is turned on in the BIOS settings. Memory Integrity is turned off in the Windows Defender, and I don't have any other anti-viruses than Windows Defender. I have tried running "adb kill-server" and then "adb start-server" to restart the server. I don't have VPN. Once I read that port-consuming applications may cause the problem, so I have XAMPP but I don't use it. I have "adb.exe" file in the "platform-tools" folder of Android SDK directory. I have tried reinstalling SDK platform tools. I have changed user name so it has only English characters and is without spaces but with capitals, it helped a bit.

SDK Tools and SDK Platforms

I have Android API 30.0 and Android 9.0 SDK platforms, Android SDK Platform-Tools, Android Emulator, Intel x86 Emulator Accelerator (HAXM installer), Android SDK Command-line Tools, Android Build-Tools 28.0.3 and Android Build-Tools 30.0.0 installed.

The emulator setup I use

My emulator has Android Pie version 9.0 API level 28 x86. The graphics parameter in the Emulated Performance section was "Automatic" when I was creating the device because I can't change it: when I click on the dropdown box nothing happens.

My PC

OS: Windows 10 x64.

CPU: Intel Core i3 6100U.

Device type: Laptop.

System type: x64.

Discreet GPU: NVIDIA GeForce 920MX.

Integrated GPU: Intel HD Graphics 520.

Android Studio: 3.6.3 (but I have tried using 4.0).

Android SDK and Android Studio itself are installed on non-system disk - disk D (HDD). While the disk C (SSD) is the system disk.

Other problems with the emulator

The emulator(and Android Studio itself) is very very laggy. Also it usually throws "X application is not responding" error from time to time and on boot. The application in the error is system application such as: UI, Launcher and etc.

I can't give up on the programming branch just because of some small problem at the beginning of the path, also I have purchased a course.

Thanks in advance for helping!


来源: stackexchange

问:
How do I use CSS to properly hide a form select element, including the select arrow
I'm using display: none; in the style sheet to hide a number of form fields. When the user clicks the visible First Name or Last Name fields, the rest of the fields display using JavaScript getElementById to display block.

Everything works except the down arrow still displays from the select element when it should be hidden with everything else. I tried CSS:

```<code>select {
    appearance: none;
}
</code>```

but that did not work. Image below of the problem and link here to the test page: Form Test Page

答:
You have three main options:

CSS

```<code>i) display: none;

ii) visibility: hidden;
</code>```

HTML

```<code>iii) hidden
</code>```

Working Example:

select.b {
    display: none;
}

select.c {
    visibility: hidden;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><select class="a">
  <option>Option A1</option>
  <option>Option A2</option>
  <option>Option A3</option>
  <option>Option A4</option>
  <option>Option A5</option>
</select>

<select class="b">
  <option>Option B1</option>
  <option>Option B2</option>
  <option>Option B3</option>
  <option>Option B4</option>
  <option>Option B5</option>
</select>

<select class="c">
  <option>Option C1</option>
  <option>Option C2</option>
  <option>Option C3</option>
  <option>Option C4</option>
  <option>Option C5</option>
</select>

<select class="d" hidden>
  <option>Option D1</option>
  <option>Option D2</option>
  <option>Option D3</option>
  <option>Option D4</option>
  <option>Option D5</option>
</select></code>```

Further Reading:

https://developer.mozilla.org/en-US/docs/Web/CSS/display

https://developer.mozilla.org/en-US/docs/Web/CSS/visibility

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden

ContentLicense: CC BY-SA 4.0

Body:
I'm using display: none; in the style sheet to hide a number of form fields. When the user clicks the visible First Name or Last Name fields, the rest of the fields display using JavaScript getElementById to display block.

Everything works except the down arrow still displays from the select element when it should be hidden with everything else. I tried CSS:

select {
    appearance: none;
}

but that did not work. Image below of the problem and link here to the test page: Form Test Page

Body:
You have three main options:

CSS

i) display: none;

ii) visibility: hidden;

HTML

iii) hidden

Working Example:

select.b {
    display: none;
}

select.c {
    visibility: hidden;
}

<select class="a">
  <option>Option A1</option>
  <option>Option A2</option>
  <option>Option A3</option>
  <option>Option A4</option>
  <option>Option A5</option>
</select>

<select class="b">
  <option>Option B1</option>
  <option>Option B2</option>
  <option>Option B3</option>
  <option>Option B4</option>
  <option>Option B5</option>
</select>

<select class="c">
  <option>Option C1</option>
  <option>Option C2</option>
  <option>Option C3</option>
  <option>Option C4</option>
  <option>Option C5</option>
</select>

<select class="d" hidden>
  <option>Option D1</option>
  <option>Option D2</option>
  <option>Option D3</option>
  <option>Option D4</option>
  <option>Option D5</option>
</select>

Further Reading:

https://developer.mozilla.org/en-US/docs/Web/CSS/display

https://developer.mozilla.org/en-US/docs/Web/CSS/visibility

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden


问:
I want to access the products with total amount
I have 2 tables. One is product(id, name). another is In(id, amount, products_id).
I am trying to get product name with total amount.
Example:
Aerobat-34
God of war-3
Rs537-15

I Joined the tables. Now output is

```<code>[{"name":"Aerobat","amount":"10"},{"name":"Aerobat","amount":null},{"name":"Aerobat","amount":null},{"name":"Aerobat","amount":null},{"name":"Aerobat","amount":"2"},{"name":"Aerobat","amount":"56"},{"name":"Aerobat","amount":"56"},{"name":"god of war","amount":"7"},{"name":"god of war","amount":"23"},{"name":"Rs537","amount":null},{"name":"Rs537","amount":null},{"name":"Rs537","amount":null}]
</code>```
```<code>public function index()
    {
        $product = DB::table('Products')
            ->join('ins', 'products.id', '=', 'ins.products_id')
            ->select('Products.name', 'ins.amount')
            ->get();
        echo $product;
    }
</code>```

How to find the expected result?

答:
you could get it like this</p>
```<code>    public function index()
    {
        $product = DB::table('Products')
            ->join('ins', 'products.id', '=', 'ins.products_id')
            ->select('Products.name', 'ins.amount',DB::raw('sum(ins.amount) as total'))
            ->get();
        echo $product;
    }
</code>```

Body:
I have 2 tables. One is product(id, name). another is In(id, amount, products_id).
I am trying to get product name with total amount.
Example:
Aerobat-34
God of war-3
Rs537-15

I Joined the tables. Now output is

[{"name":"Aerobat","amount":"10"},{"name":"Aerobat","amount":null},{"name":"Aerobat","amount":null},{"name":"Aerobat","amount":null},{"name":"Aerobat","amount":"2"},{"name":"Aerobat","amount":"56"},{"name":"Aerobat","amount":"56"},{"name":"god of war","amount":"7"},{"name":"god of war","amount":"23"},{"name":"Rs537","amount":null},{"name":"Rs537","amount":null},{"name":"Rs537","amount":null}]

public function index()
    {
        $product = DB::table('Products')
            ->join('ins', 'products.id', '=', 'ins.products_id')
            ->select('Products.name', 'ins.amount')
            ->get();
        echo $product;
    }

How to find the expected result?

Body:
you could get it like this

    public function index()
    {
        $product = DB::table('Products')
            ->join('ins', 'products.id', '=', 'ins.products_id')
            ->select('Products.name', 'ins.amount',DB::raw('sum(ins.amount) as total'))
            ->get();
        echo $product;
    }


问:
pip install arcade keeps giving "Could not find module 'geos_c.dll' (or one of it dependencies). geos.dll and geos_c.dll unfindable
Long post for one error I keep getting:

PC, Windows 10, I have used PyCharm, VS Code, Powershell for pip installations, virtual environments as well as normal.

I am trying to get the arcade library installed, so I can get to building a platform type game with a friend. Having done research on what libraries to use, we came across Arcade, looking perfect for our idea for the platformer.

https://api.arcade.academy/en/latest/examples/platform_tutorial/step_01.html

And

https://api.arcade.academy/en/latest/install/windows.html

Now here's the crux. I have followed all the steps, have tried installing it in various ways (virtual environments as well), but I keep getting the same error code (please continue reading after the error codes, as I've tried various solutions already):

```<code>PS C:\Users\Grace\AppData\Local\Programs\Python\Python310> pip install arcade
Collecting arcade
  Using cached arcade-2.6.3-py3-none-any.whl (39.2 MB)
Collecting shapely==1.7.1
  Using cached Shapely-1.7.1.tar.gz (383 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Grace\AppData\Local\Programs\Python\Python310\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Grace\\AppData\\Local\\Temp\\pip-install-labiwb90\\shapely_c43a03848a5e4619a6d0372e22fc4a7c\\setup.py'"'"'; __file__='"'"'C:\\Users\\Grace\\AppData\\Local\\Temp\\pip-install-labiwb90\\shapely_c43a03848a5e4619a6d0372e22fc4a7c\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Grace\AppData\Local\Temp\pip-pip-egg-info-0b2ppic9'
       cwd: C:\Users\Grace\AppData\Local\Temp\pip-install-labiwb90\shapely_c43a03848a5e4619a6d0372e22fc4a7c\
  Complete output (9 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Grace\AppData\Local\Temp\pip-install-labiwb90\shapely_c43a03848a5e4619a6d0372e22fc4a7c\setup.py", line 85, in <module>
      from shapely._buildcfg import geos_version_string, geos_version, \
    File "C:\Users\Grace\AppData\Local\Temp\pip-install-labiwb90\shapely_c43a03848a5e4619a6d0372e22fc4a7c\shapely\_buildcfg.py", line 205, in <module>
      lgeos = CDLL("geos_c.dll")
    File "C:\Users\Grace\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
      self._handle = _dlopen(self._name, mode)
  FileNotFoundError: Could not find module 'geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/42/f3/0e1bc2c4f15e05e30c6b99322b9ddaa2babb3f43bc7df2698efdc1553439/Shapely-1.7.1.tar.gz#sha256=1641724c1055459a7e2b8bbe47ba25bdc89554582e62aec23cb3f3ca25f9b129 (from https://pypi.org/simple/shapely/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
</code>```

Having already tried to research this (and finding many questions for the shapely lib, as that's where it is coming from by the looks of it) and many, many different solutions, I keep still getting the same error.

I have tried installing shapely, but each line gives me the following error, all the way to version 1.5.9.tar.gz

```<code>PS E:\GAME\project> pip install shapely
Collecting shapely
  Using cached Shapely-1.8.0.tar.gz (278 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'e:\my virtual env\this one\scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Grace\\AppData\\Local\\Temp\\p
ip-install-sly8ntwk\\shapely_e4ed214432664ba8b60621c78133751b\\setup.py'"'"'; __file__='"'"'C:\\Users\\Grace\\AppData\\Local\\Temp\\pip-install-sly8ntwk\\shapely_e4ed
214432664ba8b60621c78133751b\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools impo
rt setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Grace\AppData\Local\Temp\pip-pip-egg-info-a5sb9s6p'
       cwd: C:\Users\Grace\AppData\Local\Temp\pip-install-sly8ntwk\shapely_e4ed214432664ba8b60621c78133751b\
  Complete output (9 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Grace\AppData\Local\Temp\pip-install-sly8ntwk\shapely_e4ed214432664ba8b60621c78133751b\setup.py", line 74, in <module>
      from shapely._buildcfg import geos_version_string, geos_version, \
    File "C:\Users\Grace\AppData\Local\Temp\pip-install-sly8ntwk\shapely_e4ed214432664ba8b60621c78133751b\shapely\_buildcfg.py", line 204, in <module>
      lgeos = CDLL("geos_c.dll")
    File "C:\Users\Grace\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
      self._handle = _dlopen(self._name, mode)
  FileNotFoundError: Could not find module 'geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/1c/0c/454c80f71bd5ece52fb06d2905bf956b9122f4be539d5ae5df4b10dd3e14/Shapely-1.8.0.tar.gz#sha256=f5307ee14ba41
99f8bbcf6532ca33064661c1433960c432c84f0daa73b47ef9c (from https://pypi.org/simple/shapely/) (requires-python:>=3.6). Command errored out with exit status 1: python setu
p.py egg_info Check the logs for full command output.
  Using cached Shapely-1.7.1.tar.gz (383 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
</code>```

Solutions tried:

I have gone to the geos website, downloaded and installed OSGeo4W. This file is installed and exists on my C drive and has both dll files in it.

I've added several paths as well, directing to various places these dll files can now be found in as they are on my PC.

We have even looked in the geos.py file to figure out what it does and where it goes wrong. The code will error out and say it cannot find geos.dll in a folder where the actual file is.

So now I'm stuck, my friend and I have exhausted all possible solutions he and I could come up with or find to try and resolve it, and I am unable to find a way to code using arcade due to this geos.dll and geos_c.dll file errors.

答: Shapely never upgraded to work on Windows with Python 3.10. The current versions of Arcade make Shapely optional and fall back to non-shapely Python code.</p>

Body:
Long post for one error I keep getting:

PC, Windows 10, I have used PyCharm, VS Code, Powershell for pip installations, virtual environments as well as normal.

I am trying to get the arcade library installed, so I can get to building a platform type game with a friend. Having done research on what libraries to use, we came across Arcade, looking perfect for our idea for the platformer.

https://api.arcade.academy/en/latest/examples/platform_tutorial/step_01.html

And

https://api.arcade.academy/en/latest/install/windows.html

Now here's the crux. I have followed all the steps, have tried installing it in various ways (virtual environments as well), but I keep getting the same error code (please continue reading after the error codes, as I've tried various solutions already):

PS C:\Users\Grace\AppData\Local\Programs\Python\Python310> pip install arcade
Collecting arcade
  Using cached arcade-2.6.3-py3-none-any.whl (39.2 MB)
Collecting shapely==1.7.1
  Using cached Shapely-1.7.1.tar.gz (383 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Grace\AppData\Local\Programs\Python\Python310\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Grace\\AppData\\Local\\Temp\\pip-install-labiwb90\\shapely_c43a03848a5e4619a6d0372e22fc4a7c\\setup.py'"'"'; __file__='"'"'C:\\Users\\Grace\\AppData\\Local\\Temp\\pip-install-labiwb90\\shapely_c43a03848a5e4619a6d0372e22fc4a7c\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Grace\AppData\Local\Temp\pip-pip-egg-info-0b2ppic9'
       cwd: C:\Users\Grace\AppData\Local\Temp\pip-install-labiwb90\shapely_c43a03848a5e4619a6d0372e22fc4a7c\
  Complete output (9 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Grace\AppData\Local\Temp\pip-install-labiwb90\shapely_c43a03848a5e4619a6d0372e22fc4a7c\setup.py", line 85, in <module>
      from shapely._buildcfg import geos_version_string, geos_version, \
    File "C:\Users\Grace\AppData\Local\Temp\pip-install-labiwb90\shapely_c43a03848a5e4619a6d0372e22fc4a7c\shapely\_buildcfg.py", line 205, in <module>
      lgeos = CDLL("geos_c.dll")
    File "C:\Users\Grace\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
      self._handle = _dlopen(self._name, mode)
  FileNotFoundError: Could not find module 'geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/42/f3/0e1bc2c4f15e05e30c6b99322b9ddaa2babb3f43bc7df2698efdc1553439/Shapely-1.7.1.tar.gz#sha256=1641724c1055459a7e2b8bbe47ba25bdc89554582e62aec23cb3f3ca25f9b129 (from https://pypi.org/simple/shapely/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Having already tried to research this (and finding many questions for the shapely lib, as that's where it is coming from by the looks of it) and many, many different solutions, I keep still getting the same error.

I have tried installing shapely, but each line gives me the following error, all the way to version 1.5.9.tar.gz

PS E:\GAME\project> pip install shapely
Collecting shapely
  Using cached Shapely-1.8.0.tar.gz (278 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'e:\my virtual env\this one\scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Grace\\AppData\\Local\\Temp\\p
ip-install-sly8ntwk\\shapely_e4ed214432664ba8b60621c78133751b\\setup.py'"'"'; __file__='"'"'C:\\Users\\Grace\\AppData\\Local\\Temp\\pip-install-sly8ntwk\\shapely_e4ed
214432664ba8b60621c78133751b\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools impo
rt setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Grace\AppData\Local\Temp\pip-pip-egg-info-a5sb9s6p'
       cwd: C:\Users\Grace\AppData\Local\Temp\pip-install-sly8ntwk\shapely_e4ed214432664ba8b60621c78133751b\
  Complete output (9 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Grace\AppData\Local\Temp\pip-install-sly8ntwk\shapely_e4ed214432664ba8b60621c78133751b\setup.py", line 74, in <module>
      from shapely._buildcfg import geos_version_string, geos_version, \
    File "C:\Users\Grace\AppData\Local\Temp\pip-install-sly8ntwk\shapely_e4ed214432664ba8b60621c78133751b\shapely\_buildcfg.py", line 204, in <module>
      lgeos = CDLL("geos_c.dll")
    File "C:\Users\Grace\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
      self._handle = _dlopen(self._name, mode)
  FileNotFoundError: Could not find module 'geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/1c/0c/454c80f71bd5ece52fb06d2905bf956b9122f4be539d5ae5df4b10dd3e14/Shapely-1.8.0.tar.gz#sha256=f5307ee14ba41
99f8bbcf6532ca33064661c1433960c432c84f0daa73b47ef9c (from https://pypi.org/simple/shapely/) (requires-python:>=3.6). Command errored out with exit status 1: python setu
p.py egg_info Check the logs for full command output.
  Using cached Shapely-1.7.1.tar.gz (383 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:

Solutions tried:

I have gone to the geos website, downloaded and installed OSGeo4W. This file is installed and exists on my C drive and has both dll files in it.

I've added several paths as well, directing to various places these dll files can now be found in as they are on my PC.

We have even looked in the geos.py file to figure out what it does and where it goes wrong. The code will error out and say it cannot find geos.dll in a folder where the actual file is.

So now I'm stuck, my friend and I have exhausted all possible solutions he and I could come up with or find to try and resolve it, and I am unable to find a way to code using arcade due to this geos.dll and geos_c.dll file errors.


问:
Different Unicode value for same string
I am trying to convert arabic characters to unicode. But for the same string, I am getting different unicodes.

Here is the Unicode for "hello" in Arabic translated using google translate: مرحبا
The unicode for that is: "%u0645%u0631%u062D%u0628%u0627"

Here is the Unicode for "hello" in Arabic translated using deep translator in python: ﻣﺮﺣﺒﺎ
The unicode for that is: "%uFEE3%uFEAE%uFEA3%uFE92%uFE8E"

Why a I getting different unicodes for the same thing? I am getting different font over here but if you try to convert these unicodes you get the same thing as shown in the image below.

I want the unicode to start with "%u06" only and not "%uFE".

答:
I cannot tell you why there are different ways to encode this Arabic text snippet in Unicode, because I know almost nothing about the Arabic writing system.
But since you tagged your question with python, I may give you some tooling to investigate further:

```<code>>>> import unicodedata as ud
>>> for l in 'مرحبا':
...     print(ud.name(l))
ARABIC LETTER MEEM
ARABIC LETTER REH
ARABIC LETTER HAH
ARABIC LETTER BEH
ARABIC LETTER ALEF

>>> for l in 'ﻣﺮﺣﺒﺎ':
...     print(ud.name(l))
ARABIC LETTER MEEM INITIAL FORM
ARABIC LETTER REH FINAL FORM
ARABIC LETTER HAH INITIAL FORM
ARABIC LETTER BEH MEDIAL FORM
ARABIC LETTER ALEF FINAL FORM
</code>```

So, to me it looks like there are different codepoints for typographic variants of the letters (similar to the separate Unicode codepoints for ligatures like "œ" and "ﬁ" in the Latin script). But there might be a different reason for the differences.

Title: Different Unicode value for same string

Body:
I cannot tell you why there are different ways to encode this Arabic text snippet in Unicode, because I know almost nothing about the Arabic writing system.
But since you tagged your question with python, I may give you some tooling to investigate further:

>>> import unicodedata as ud
>>> for l in 'مرحبا':
...     print(ud.name(l))
ARABIC LETTER MEEM
ARABIC LETTER REH
ARABIC LETTER HAH
ARABIC LETTER BEH
ARABIC LETTER ALEF

>>> for l in 'ﻣﺮﺣﺒﺎ':
...     print(ud.name(l))
ARABIC LETTER MEEM INITIAL FORM
ARABIC LETTER REH FINAL FORM
ARABIC LETTER HAH INITIAL FORM
ARABIC LETTER BEH MEDIAL FORM
ARABIC LETTER ALEF FINAL FORM

So, to me it looks like there are different codepoints for typographic variants of the letters (similar to the separate Unicode codepoints for ligatures like "œ" and "ﬁ" in the Latin script). But there might be a different reason for the differences.


问:
Convert an optional field from (RelatedModel | undefined)[] to RelatedModel[] using filter
I'm having trouble satisfying typescript in the following scenario.

interface Part {
  id: number
  relatedModel?: RelatedModel
}

const parts: Part[] = [ /* list of parts ... */ ]

const relatedModels = parts
  .map(part => part.relatedModel)
  .filter(relatedModel => relatedModel)
```
<p>Typescript thinks relatedModels has type (RelatedModel | undefined)[] but should be RelatedModel[] due to the filter. I believe what I've done is valid but Typescript isn't understanding the filter().</p>
<p>Is there some other way of doing this?</p>
<p>Note, the following works but is just a lot more verbose.</p>
<pre class="lang-js prettyprint-override"><code>const relatedModels = parts
  .map(part => part.relatedModel)

const newRelatedModels: RelatedModel[] = []

for (const relatedModel of relatedModels) {
  if (relatedModel) {
    newRelatedModels.push(relatedModel)
  }
}
</code>```

答:
Use a type guard (TS Playground):</p>
```<code>const relatedModels = parts
  .map(part => part.relatedModel)
  .filter((relatedModel): relatedModel is RelatedModel => !!relatedModel)
</code>```

Body:
I'm having trouble satisfying typescript in the following scenario.

interface Part {
  id: number
  relatedModel?: RelatedModel
}

const parts: Part[] = [ /* list of parts ... */ ]

const relatedModels = parts
  .map(part => part.relatedModel)
  .filter(relatedModel => relatedModel)

Typescript thinks relatedModels has type (RelatedModel | undefined)[] but should be RelatedModel[] due to the filter. I believe what I've done is valid but Typescript isn't understanding the filter().

Is there some other way of doing this?

Note, the following works but is just a lot more verbose.

const relatedModels = parts
  .map(part => part.relatedModel)

const newRelatedModels: RelatedModel[] = []

for (const relatedModel of relatedModels) {
  if (relatedModel) {
    newRelatedModels.push(relatedModel)
  }
}

Body:
Use a type guard (TS Playground):

const relatedModels = parts
  .map(part => part.relatedModel)
  .filter((relatedModel): relatedModel is RelatedModel => !!relatedModel)


问:
Creating duplicating rank over multiple columns
I have data as below where for one customer ID there are several orders (KEY) which is the primary key. I have also have a activity flag as below (either 0 or 1).

```<code>CUST_ID KEY FLAG
1       1   1
1       2   1
1       3   1
1       4   0
1       5   0
1       6   1
1       7   1
1       8   0
1       9   0
</code>```

Now I want to create ranks as below based on the FLAG. The idea is to give same Rank as preceding row if the FLAG is same as preceding row. The Rank increments if the current value is different from preceding value.

```<code>CUST_ID KEY FLAG RN
1       1   1    1
1       2   1    1
1       3   1    1
1       4   0    2
1       5   0    2
1       6   1    3
1       7   1    3
1       8   0    4
1       9   0    4
</code>```

I'm new to SQL, so please let me know if I need to reframe my question.

答:
Use LAG() window function to get each row's previous flag and then use SUM() window function to create the rankings:

```<code>SELECT CUST_ID, KEY, FLAG,
       SUM(CASE WHEN FLAG <> prev_FLAG THEN 1 END) OVER (PARTITION BY CUST_ID ORDER BY KEY) RN
FROM (
  SELECT *, LAG(FLAG, 1, FLAG - 1) OVER (PARTITION BY CUST_ID ORDER BY KEY) prev_FLAG
  FROM tablename
) t;
</code>```

See the demo.

The code could be simplified, depending on the specific database that you use.

Body:
I have data as below where for one customer ID there are several orders (KEY) which is the primary key. I have also have a activity flag as below (either 0 or 1).

CUST_ID KEY FLAG
1       1   1
1       2   1
1       3   1
1       4   0
1       5   0
1       6   1
1       7   1
1       8   0
1       9   0

Now I want to create ranks as below based on the FLAG. The idea is to give same Rank as preceding row if the FLAG is same as preceding row. The Rank increments if the current value is different from preceding value.

CUST_ID KEY FLAG RN
1       1   1    1
1       2   1    1
1       3   1    1
1       4   0    2
1       5   0    2
1       6   1    3
1       7   1    3
1       8   0    4
1       9   0    4

I'm new to SQL, so please let me know if I need to reframe my question.

Body:
Use LAG() window function to get each row's previous flag and then use SUM() window function to create the rankings:

SELECT CUST_ID, KEY, FLAG,
       SUM(CASE WHEN FLAG <> prev_FLAG THEN 1 END) OVER (PARTITION BY CUST_ID ORDER BY KEY) RN
FROM (
  SELECT *, LAG(FLAG, 1, FLAG - 1) OVER (PARTITION BY CUST_ID ORDER BY KEY) prev_FLAG
  FROM tablename
) t;

See the demo.

The code could be simplified, depending on the specific database that you use.


问:
filter column from a list on another sheet
Trying to filter column D on sheet1 with information in column A on sheet "Lg" but nothing seems to happen.  I don't even get an error</p>
```<code>Sub Filter()
'
' Filter Macro
'

'
    Columns("D:D").Select 'in Sheet 1
    Range("C1:C636").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
        Sheets("Lg").Columns("A:A"), Unique:=False
End Sub
</code>```

答:
Advanced Filter Example (2 Worksheets)

Before

After

It is assumed that your data starts in cell A1 and CurrentRegion works for referencing the complete range.

The titles (headers) of the destination criteria column D on worksheet Sheet1 and of the source criteria column A on worksheet Lg need to be the same.

Option Explicit

Sub TestAdvancedFilter()

    Dim wb As Workbook: Set wb = ThisWorkbook

    ' Source (contains filter values)
    Dim sws As Worksheet: Set sws = wb.Worksheets("Lg")
    Dim slRow As Long: slRow = sws.Cells(sws.Rows.Count, "A").End(xlUp).Row
    If slRow = 1 Then Exit Sub ' no data
    Dim srg As Range: Set srg = sws.Range("A1:A" & slRow)

    ' Destination (is being filtered)
    Dim dws As Worksheet: Set dws = wb.Worksheets("Sheet1")
    If dws.FilterMode Then dws.ShowAllData
    Dim drg As Range: Set drg = dws.Range("A1").CurrentRegion

    drg.AdvancedFilter xlFilterInPlace, srg

End Sub
```

Body:
Trying to filter column D on sheet1 with information in column A on sheet "Lg" but nothing seems to happen.  I don't even get an error

Sub Filter()
'
' Filter Macro
'

'
    Columns("D:D").Select 'in Sheet 1
    Range("C1:C636").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
        Sheets("Lg").Columns("A:A"), Unique:=False
End Sub


问:
Store .jks file in google secret manager without getting non UTF-8 file?
Thank you for all the replies, I am still facing the issue, just to add more clarity I've given all the details of cloudbuild.yaml and build.gradle and key property details, please let me know if the configuration is correct and let me know how to fix the JKS issue.

I am working on integrating the CI\CD pipeline to a flutter project using GCP, which I am trying to store.JKS file in google secret manager and call it from inside the code, but it is giving an error saying secret env variable cannot be the non-UTF-8 format.

So I tried a couple of things,

I tried to convert the.JKS file to txt viewable - after that it gave me an error saying secret env variable cannot have null values.

I tried to store the JKS file in cloud storage - but the code is not able to get the content of the JKS even if I give the link and all the necessary permissions for cloud build.

Please suggest some fix or alternate storage area in GCP.

I am adding the code for more clarity.
------------------------------------------***-----------------------------------------

APPROACH 1: TRYING TO ACCESS JKS FILE FROM SECRET MANAGER

```<code>Secret Manager KEY VALUE structure

key                      value
KEYSTORE_PASSWORD       xxxxxxxxxxxx
KEY_PASSWORD            xxxxxxxxxxxx
KEY_ALIAS               upload
JKS                     fe ed fe ed 00 00 00.....
</code>```

build.sh

```<code>cd /workspace/$1
VERSION_NAME=$(git describe)
VERSION_CODE=$(git rev-list --count master)
flutter build apk --build-name=$VERSION_NAME --build-number=$VERSION_CODE
</code>```

```<code>cloudbuild.yaml:
</code>```

```<code># Flutter CD configuration file with Cloud build

steps:

  # clone the latest source codes
  - name: 'gcr.io/cloud-builders/git'
    args: ['clone', 'https://XXXXX:ACCOUNT_PASSWORD@bitbucket.org/XXXXXXXX/XX.git']
    dir: '/workspace'

  # using flutter builder Docker image we have built previously to compile the repo
  - name: 'gcr.io/$PROJECT_ID/flutter'
    entrypoint: 'bash'
    args: [ 'build.sh']
    secretEnv: ['KEYSTORE_PASSWORD','KEY_PASSWORD', 'KEY_ALIAS', 'JKS']

  # Push the APK Output to your GCS Bucket with Short Commit SHA.
  - name: 'gcr.io/cloud-builders/gsutil'
    args: [ 'cp', 'build/app/outputs/flutter-apk/app-release.apk', 'gs://BUCKET_NAME' ]

availableSecrets:
  secretManager:
  - versionName: projects/xxxxxx/secrets/KEYSTORE_PASSWORD/versions/1
    env: 'KEYSTORE_PASSWORD'
  - versionName: projects/xxxxxxx/secrets/KEY_PASSWORD/versions/1
    env: 'KEY_PASSWORD'
  - versionName: projects/xxxxxx/secrets/KEY_ALIAS/versions/1
    env: 'KEY_ALIAS'
  - versionName: projects/xxxxxxx/secrets/upload-keystore-jks/versions/1
    env: 'JKS'
</code>```

```<code>build.gradle:
</code>```

```<code>def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion flutter.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.XXX.XXX"
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            keyAlias System.getenv("KEY_ALIAS")
            keyPassword System.getenv("KEY_PASSWORD")
            storePassword System.getenv("KEYSTORE_PASSWORD")
            storeFile System.getenv("JKS")
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

ERROR
==============================================================================================================
build step 1 "gcr.io/buildtrial-1/flutter" failed: secret projects/xxxxxxx/secrets/upload-keystore-jks/versions/1 value is not valid UTF-8

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

```<code>NOTE:
1.build.gradle file is same for both the approches, as the JKS variable name is conssistent in both the approches
2. I've verified that, 'KEYSTORE_PASSWORD','KEY_PASSWORD', 'KEY_ALIAS' is working properly, only problem is with accessing JKS file in both the approches.
</code>```

-------------------------------------------------------------------------**********-----------------------------------------------------------------------------------------------------------------------

APPROCH 2: TRYING TO ACCESS JKS FILE FROM CLOUD STORAGE.

```<code>cloudbuild.yaml:
</code>```

```<code># Flutter CD configuration file with Cloud build

steps:

  # clone the latest source codes
  - name: 'gcr.io/cloud-builders/git'
    args: ['clone', 'https://XXXXX:ACCOUNT_PASSWORD@bitbucket.org/XXXXXXXX/XX.git']
    dir: '/workspace'

  #accessing the JKS file stored in cloud storage through environment variable
  - name: 'gcr.io/cloud-builders/gsutil'
    env:
      - 'JKS=gs://BUCKET_NAME/KEYSTORE.jks'

  # using flutter builder Docker image we have built previously to compile the repo
  - name: 'gcr.io/$PROJECT_ID/flutter'
    entrypoint: 'bash'
    args: [ 'build.sh']
    secretEnv: ['KEYSTORE_PASSWORD','KEY_PASSWORD', 'KEY_ALIAS']

  # Push the APK Output to your GCS Bucket with Short Commit SHA.
  - name: 'gcr.io/cloud-builders/gsutil'
    args: [ 'cp', 'build/app/outputs/flutter-apk/app-release.apk', 'gs://BUCKET_NAME' ]

availableSecrets:
  secretManager:
  - versionName: projects/xxxxxx/secrets/KEYSTORE_PASSWORD/versions/1
    env: 'KEYSTORE_PASSWORD'
  - versionName: projects/xxxxxxx/secrets/KEY_PASSWORD/versions/1
    env: 'KEY_PASSWORD'
  - versionName: projects/xxxxxx/secrets/KEY_ALIAS/versions/1
    env: 'KEY_ALIAS'
</code>```

=============================================================================
ERROR

```<code>Step #2: Execution failed for task ':app:validateSigningRelease'.
Step #2: > Keystore file not set for signing config release
</code>```

=============================================================================

答:
When you have binary files, you have to convert them in base64 and then to store them encoded.

In your application, read the base64 content of Secret Manager, decode it, and use it.

Body:
Thank you for all the replies, I am still facing the issue, just to add more clarity I've given all the details of cloudbuild.yaml and build.gradle and key property details, please let me know if the configuration is correct and let me know how to fix the JKS issue.

I am working on integrating the CI\CD pipeline to a flutter project using GCP, which I am trying to store.JKS file in google secret manager and call it from inside the code, but it is giving an error saying secret env variable cannot be the non-UTF-8 format.

So I tried a couple of things,

I tried to convert the.JKS file to txt viewable - after that it gave me an error saying secret env variable cannot have null values.

I tried to store the JKS file in cloud storage - but the code is not able to get the content of the JKS even if I give the link and all the necessary permissions for cloud build.

Please suggest some fix or alternate storage area in GCP.

I am adding the code for more clarity.
------------------------------------------***-----------------------------------------

APPROACH 1: TRYING TO ACCESS JKS FILE FROM SECRET MANAGER

Secret Manager KEY VALUE structure

key                      value
KEYSTORE_PASSWORD       xxxxxxxxxxxx
KEY_PASSWORD            xxxxxxxxxxxx
KEY_ALIAS               upload
JKS                     fe ed fe ed 00 00 00.....

build.sh

cd /workspace/$1
VERSION_NAME=$(git describe)
VERSION_CODE=$(git rev-list --count master)
flutter build apk --build-name=$VERSION_NAME --build-number=$VERSION_CODE

cloudbuild.yaml:

# Flutter CD configuration file with Cloud build

steps:

  # clone the latest source codes
  - name: 'gcr.io/cloud-builders/git'
    args: ['clone', 'https://XXXXX:ACCOUNT_PASSWORD@bitbucket.org/XXXXXXXX/XX.git']
    dir: '/workspace'

  # using flutter builder Docker image we have built previously to compile the repo
  - name: 'gcr.io/$PROJECT_ID/flutter'
    entrypoint: 'bash'
    args: [ 'build.sh']
    secretEnv: ['KEYSTORE_PASSWORD','KEY_PASSWORD', 'KEY_ALIAS', 'JKS']

  # Push the APK Output to your GCS Bucket with Short Commit SHA.
  - name: 'gcr.io/cloud-builders/gsutil'
    args: [ 'cp', 'build/app/outputs/flutter-apk/app-release.apk', 'gs://BUCKET_NAME' ]

availableSecrets:
  secretManager:
  - versionName: projects/xxxxxx/secrets/KEYSTORE_PASSWORD/versions/1
    env: 'KEYSTORE_PASSWORD'
  - versionName: projects/xxxxxxx/secrets/KEY_PASSWORD/versions/1
    env: 'KEY_PASSWORD'
  - versionName: projects/xxxxxx/secrets/KEY_ALIAS/versions/1
    env: 'KEY_ALIAS'
  - versionName: projects/xxxxxxx/secrets/upload-keystore-jks/versions/1
    env: 'JKS'

build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion flutter.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.XXX.XXX"
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            keyAlias System.getenv("KEY_ALIAS")
            keyPassword System.getenv("KEY_PASSWORD")
            storePassword System.getenv("KEYSTORE_PASSWORD")
            storeFile System.getenv("JKS")
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

ERROR
==============================================================================================================
build step 1 "gcr.io/buildtrial-1/flutter" failed: secret projects/xxxxxxx/secrets/upload-keystore-jks/versions/1 value is not valid UTF-8

==============================================================================================================

NOTE:
1.build.gradle file is same for both the approches, as the JKS variable name is conssistent in both the approches
2. I've verified that, 'KEYSTORE_PASSWORD','KEY_PASSWORD', 'KEY_ALIAS' is working properly, only problem is with accessing JKS file in both the approches.

-------------------------------------------------------------------------**********-----------------------------------------------------------------------------------------------------------------------

APPROCH 2: TRYING TO ACCESS JKS FILE FROM CLOUD STORAGE.

cloudbuild.yaml:

# Flutter CD configuration file with Cloud build

steps:

  # clone the latest source codes
  - name: 'gcr.io/cloud-builders/git'
    args: ['clone', 'https://XXXXX:ACCOUNT_PASSWORD@bitbucket.org/XXXXXXXX/XX.git']
    dir: '/workspace'

  #accessing the JKS file stored in cloud storage through environment variable
  - name: 'gcr.io/cloud-builders/gsutil'
    env:
      - 'JKS=gs://BUCKET_NAME/KEYSTORE.jks'

  # using flutter builder Docker image we have built previously to compile the repo
  - name: 'gcr.io/$PROJECT_ID/flutter'
    entrypoint: 'bash'
    args: [ 'build.sh']
    secretEnv: ['KEYSTORE_PASSWORD','KEY_PASSWORD', 'KEY_ALIAS']

  # Push the APK Output to your GCS Bucket with Short Commit SHA.
  - name: 'gcr.io/cloud-builders/gsutil'
    args: [ 'cp', 'build/app/outputs/flutter-apk/app-release.apk', 'gs://BUCKET_NAME' ]

availableSecrets:
  secretManager:
  - versionName: projects/xxxxxx/secrets/KEYSTORE_PASSWORD/versions/1
    env: 'KEYSTORE_PASSWORD'
  - versionName: projects/xxxxxxx/secrets/KEY_PASSWORD/versions/1
    env: 'KEY_PASSWORD'
  - versionName: projects/xxxxxx/secrets/KEY_ALIAS/versions/1
    env: 'KEY_ALIAS'

=============================================================================
ERROR

Step #2: Execution failed for task ':app:validateSigningRelease'.
Step #2: > Keystore file not set for signing config release

=============================================================================


问:
Which version of ECMAScript does the Google Apps Script V8 Runtime use?
When you crate a new Google Apps Script, it seems to support the v8 runtime by default. The documentation states:

Apps Script supports two JavaScript runtimes: the modern V8 runtime and an older one powered by Mozilla's Rhino JavaScript interpreter.

The V8 runtime supports modern ECMAScript syntax and features.

The V8 runtime documentation states:

You can use modern ECMAScript syntax in scripts that are powered by the V8 runtime. This syntax includes let, const, and many other popular features.

In both cases, they are very vague as to which ECMAScript version is supported, simply stating "modern ECMAScript syntax". This is problematic because there are 7 versions that were released between 2015 and 2021. Thus "modern" could refer to any one of these versions.

For example, I could easily assume that "modern" refers to the latest, 12th edition (2022) of ECMAScript, and end up writing code like this:

```<code>let a = 1_000;
</code>```

However, attempting to use that syntax leads to the error:

Syntax error: ParseError: Unexpected token ILLEGAL line: ...

Rather than manually go through each of the remaining 6 versions until I find the latest one supported, it would be great to find documentation that explicitly states which ECMAScript version is supported.

Note: The previous related question (Which Edition of ECMA-262 Does Google Apps Script Support?) is not helpful since those answers also refer to "modern ECMAScript" rather than a definitive, specific version.

Which version of ECMAScript is supported by the V8 runtime?

答:
Why does let a = 1_000; produce a Syntax Error?

Just to expand on @jmrk's answer about new features not supported by the parser.

```<code>function test2564(){
  //let a = 1_000; throws syntax error by the parser
  console.info(eval(`1_000`));// correctly logs 1000
}
</code>```

The underlying V8 engine is good and supports the latest features, but the parser won't allow you to save or execute the project with those features, as it considers them as syntax errors.

Body:
When you crate a new Google Apps Script, it seems to support the v8 runtime by default. The documentation states:

Apps Script supports two JavaScript runtimes: the modern V8 runtime and an older one powered by Mozilla's Rhino JavaScript interpreter.

The V8 runtime supports modern ECMAScript syntax and features.

The V8 runtime documentation states:

You can use modern ECMAScript syntax in scripts that are powered by the V8 runtime. This syntax includes let, const, and many other popular features.

In both cases, they are very vague as to which ECMAScript version is supported, simply stating "modern ECMAScript syntax". This is problematic because there are 7 versions that were released between 2015 and 2021. Thus "modern" could refer to any one of these versions.

For example, I could easily assume that "modern" refers to the latest, 12th edition (2022) of ECMAScript, and end up writing code like this:

let a = 1_000;

However, attempting to use that syntax leads to the error:

Syntax error: ParseError: Unexpected token ILLEGAL line: ...

Rather than manually go through each of the remaining 6 versions until I find the latest one supported, it would be great to find documentation that explicitly states which ECMAScript version is supported.

Note: The previous related question (Which Edition of ECMA-262 Does Google Apps Script Support?) is not helpful since those answers also refer to "modern ECMAScript" rather than a definitive, specific version.

Which version of ECMAScript is supported by the V8 runtime?

Body:
Why does let a = 1_000; produce a Syntax Error?

Just to expand on @jmrk's answer about new features not supported by the parser.

function test2564(){
  //let a = 1_000; throws syntax error by the parser
  console.info(eval(`1_000`));// correctly logs 1000
}

The underlying V8 engine is good and supports the latest features, but the parser won't allow you to save or execute the project with those features, as it considers them as syntax errors.


问:
Cannot perform a non-multi update on a time-series collection
Hi I am using newly Timeseries mongodb collection. My mongodb version is 5.0.6. I am following this tutorial. I create a collection like this.

```<code>   db.createCollection("ticker", {
     timeseries: {
        timeField: "time",
        metaField: "metadata",
    },
});
</code>```

I inserted the sample document like this.

```<code>db.ticker.insertOne({
 time: ISODate("20210101T01:00:00"),
 symbol: "BTC-USD",
 price: 34114.1145,
 metadata: { a: ""}
});
</code>```

When I am trying to update metadata field it gives above error. As mentioned here is limitation you can only update metaField but still it is giving above error. Here is the update code

```<code>db.ticker.update({ "metadata.a": "a" }, { $set: { "metadata.d": "a" } })

write failed with error: {
    "nMatched" : 0,
    "nUpserted" : 0,
    "nModified" : 0,
    "writeError" : {
        "code" : 72,
        "errmsg" : "Cannot perform a non-multi update on a time-series collection"
    }
}
</code>```

Need help what I am doing wrong.

答:
Try adding { multi: true } config.

If you check the docs, there are still some limitations for updating time-series collections.

Update commands must meet the following requirements:

The query may only match on metaField field values.

The update command may only modify the metaField field value.

The update must be performed with an update document that contains only update operator expressions.

The update command may not limit the number of documents to be updated. You must use an update command with multi: true or the
updateMany() method.

The update command may not set upsert: true.

Body:
Hi I am using newly Timeseries mongodb collection. My mongodb version is 5.0.6. I am following this tutorial. I create a collection like this.

   db.createCollection("ticker", {
     timeseries: {
        timeField: "time",
        metaField: "metadata",
    },
});

I inserted the sample document like this.

db.ticker.insertOne({
 time: ISODate("20210101T01:00:00"),
 symbol: "BTC-USD",
 price: 34114.1145,
 metadata: { a: ""}
});

When I am trying to update metadata field it gives above error. As mentioned here is limitation you can only update metaField but still it is giving above error. Here is the update code

db.ticker.update({ "metadata.a": "a" }, { $set: { "metadata.d": "a" } })

write failed with error: {
    "nMatched" : 0,
    "nUpserted" : 0,
    "nModified" : 0,
    "writeError" : {
        "code" : 72,
        "errmsg" : "Cannot perform a non-multi update on a time-series collection"
    }
}

Need help what I am doing wrong.


问:
React: How to pass a pointer to one component to a second component
How can you pass a pointer to component 1 to component 2 (so that you can work with component 1 inside component 2, e.g. get its properties)

```<code><Component1 />
<Component2 target = {Component1} />
</code>```

In part, this problem can be solved by handling events from component 1, because in this case a зpointer to it (event.target) will be available, but what about before such an event occurs?

答:
Instead of passing throw props just import your component 1 in component2 if you want to use content of component1 in component2
and your good to go

Or if you what to use component2 as wrapper you can use children props

For example:

function Component2(props) {
  return (

      {props.children}

  );
}
export default Component2
```
<p>and use it</p>
<pre class="lang-js prettyprint-override"><code>
import Component2 from './component2'
import Component1 from './component1'
function App() {
  return (
    <Component2>
       <Component1/>
    </Component2>
  );
}
export default App
</code>```

Body:
How can you pass a pointer to component 1 to component 2 (so that you can work with component 1 inside component 2, e.g. get its properties)

<Component1 />
<Component2 target = {Component1} />

In part, this problem can be solved by handling events from component 1, because in this case a зpointer to it (event.target) will be available, but what about before such an event occurs?

Body:
Instead of passing throw props just import your component 1 in component2 if you want to use content of component1 in component2
and your good to go

Or if you what to use component2 as wrapper you can use children props

For example:

function Component2(props) {
  return (
    <div className={'component2'}>
      {props.children}
    </div>
  );
}
export default Component2

and use it

import Component2 from './component2'
import Component1 from './component1'
function App() {
  return (
    <Component2>
       <Component1/>
    </Component2>
  );
}
export default App


问:
I am trying to webscrape from Zomato, however it returns with an output of "None" and Attribute Error
Whenever i try to extract the data, it returns an output of "None" which I am not sure of is it the code (I followed the rules of using bs4) or is it just the website that's different to scrape?

My code:

```<code>import requests
import bs4 as bs

url = 'https://www.zomato.com/jakarta/pondok-indah-restaurants'
req = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'})
html = req.text

soup = bs.BeautifulSoup(html, "html.parser")

listings = soup.find('div', class_='sc-gAmQfK fKxEbD')
rest_name = listings.find('h4', class_='sc-1hp8d8a-0 sc-eTyWNx gKsZcT').text

##Output: AttributeError: 'NoneType' object has no attribute 'find'

print(listings)
##returns None
</code>```

Here is the inspected tag of the website which i try to get the h4 class showing the restaurant's name:

inspected element

答:
What happens?

Classes are generated dynamically and may differ from your inspections via developer tools - So you won't find what you are looking for.

How to fix?

It would be a better approach to select your targets via tag or id if available, cause these are more static than css classes.

```<code>listings = soup.select('a:has(h4)')
</code>```

Example

Iterating listings and scrape several infromation:

```<code>import requests
import bs4 as bs

url = 'https://www.zomato.com/jakarta/pondok-indah-restaurants'
req = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'})
html = req.text
soup = bs.BeautifulSoup(html, "html.parser")

data = []
for item in soup.select('a:has(h4)'):
    data.append({
        'title':item.h4.text,
        'url':item['href'],
        'etc':'...'
    })
print(data)
</code>```

Output

```<code>[{'title': 'Radio Dalam Diner', 'url': '/jakarta/radio-dalam-diner-pondok-indah/info', 'etc': '...'}, {'title': 'Aneka Bubur 786', 'url': '/jakarta/aneka-bubur-786-pondok-indah/info', 'etc': '...'}, {'title': "McDonald's", 'url': '/jakarta/mcdonalds-pondok-indah/info', 'etc': '...'}, {'title': 'KOPIKOBOY', 'url': '/jakarta/kopikoboy-pondok-indah/info', 'etc': '...'}, {'title': 'Kopitelu', 'url': '/jakarta/kopitelu-pondok-indah/info', 'etc': '...'}, {'title': 'KFC', 'url': '/jakarta/kfc-pondok-indah/info', 'etc': '...'}, {'title': 'HokBen Delivery', 'url': '/jakarta/hokben-delivery-pondok-indah/info', 'etc': '...'}, {'title': 'PHD', 'url': '/jakarta/phd-pondok-indah/info', 'etc': '...'}, {'title': 'Casa De Jose', 'url': '/jakarta/casa-de-jose-pondok-indah/info', 'etc': '...'}]
</code>```

Body:
Whenever i try to extract the data, it returns an output of "None" which I am not sure of is it the code (I followed the rules of using bs4) or is it just the website that's different to scrape?

My code:

import requests
import bs4 as bs

url = 'https://www.zomato.com/jakarta/pondok-indah-restaurants'
req = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'})
html = req.text

soup = bs.BeautifulSoup(html, "html.parser")

listings = soup.find('div', class_='sc-gAmQfK fKxEbD')
rest_name = listings.find('h4', class_='sc-1hp8d8a-0 sc-eTyWNx gKsZcT').text

##Output: AttributeError: 'NoneType' object has no attribute 'find'

print(listings)
##returns None

Here is the inspected tag of the website which i try to get the h4 class showing the restaurant's name:

inspected element

Body:
What happens?

Classes are generated dynamically and may differ from your inspections via developer tools - So you won't find what you are looking for.

How to fix?

It would be a better approach to select your targets via tag or id if available, cause these are more static than css classes.

listings = soup.select('a:has(h4)')

Example

Iterating listings and scrape several infromation:

import requests
import bs4 as bs

url = 'https://www.zomato.com/jakarta/pondok-indah-restaurants'
req = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'})
html = req.text
soup = bs.BeautifulSoup(html, "html.parser")

data = []
for item in soup.select('a:has(h4)'):
    data.append({
        'title':item.h4.text,
        'url':item['href'],
        'etc':'...'
    })
print(data)

Output

[{'title': 'Radio Dalam Diner', 'url': '/jakarta/radio-dalam-diner-pondok-indah/info', 'etc': '...'}, {'title': 'Aneka Bubur 786', 'url': '/jakarta/aneka-bubur-786-pondok-indah/info', 'etc': '...'}, {'title': "McDonald's", 'url': '/jakarta/mcdonalds-pondok-indah/info', 'etc': '...'}, {'title': 'KOPIKOBOY', 'url': '/jakarta/kopikoboy-pondok-indah/info', 'etc': '...'}, {'title': 'Kopitelu', 'url': '/jakarta/kopitelu-pondok-indah/info', 'etc': '...'}, {'title': 'KFC', 'url': '/jakarta/kfc-pondok-indah/info', 'etc': '...'}, {'title': 'HokBen Delivery', 'url': '/jakarta/hokben-delivery-pondok-indah/info', 'etc': '...'}, {'title': 'PHD', 'url': '/jakarta/phd-pondok-indah/info', 'etc': '...'}, {'title': 'Casa De Jose', 'url': '/jakarta/casa-de-jose-pondok-indah/info', 'etc': '...'}]


问:
Understanding java command line
Can someone help me understand what the java cmd line is doing below (broken down so easier to read)? I found this in our AV and have no clue what this cmd does as a whole.

From my googling, I found that for -DACTIVE=true, the -D sets a system property value. In this case, my understaning is that it's setting the ACTIVE value to true..?

I also understand that -classpath searches for class files in the specified directories.

Unfortunately for com.zerog.lax.LAX , I can't find what it does/is. Any help is apreciated.

```<code>    "C:\Users\user\AppData\Local\Temp\I1644615473\Windows\resource\jre\bin\java.exe" -DACTIVE=true

    -classpath "C:\Users\user\AppData\Local\Temp\I1644615473\InstallerData\IAClasses.zip;

    C:\Users\user\AppData\Local\Temp\I1644615473\InstallerData\Execute.zip;

    C:\Users\user\AppData\Local\Temp\I1644615473\Windows\InstallerData\Execute.zip;

C:\Users\user\AppData\Local\Temp\I1644615473\InstallerData\Resource1.zip;

    C:\Users\user\AppData\Local\Temp\I1644615473\Windows\InstallerData\Resource1.zip;

    C:\Users\user\AppData\Local\Temp\I1644615473\InstallerData;

    C:\Users\user\AppData\Local\Temp\I1644615473\Windows\InstallerData;"

    com.zerog.lax.LAX

    "C:/Users/user/AppData/Local/Temp/I1644615473/Windows/setup.lax"

    "C:/Users/user/AppData/Local/Temp/laxF375.tmp"
</code>```

答:
Directly from java -help:

```<code>C:\Users\Hector>java -help
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -server       to select the "server" VM
                  The default VM is server.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
</code>```

-D<name>=<value> Sets a system property. In your case: ACTIVE=true
Here's the thing: If "ACTIVE" is not a known system property, you must define it somewhere. For Maven projects, I would set them up in the POM. Here's how you do that in Maven: https://stackoverflow.com/a/3231981/2851311

-classpath or -cp is the preferred way to specify the classpath for the application being run. Why is this the preferred way? Simply because, if you want to execute a program from many machines, you would have to either set the classpath on every single one, OR simply create a script with the -classpath or -cp option in the command line instruction and you will not have to worry about the targeted system not being correctly configured to find the compiled unit being executed. Here's more on the topic of using these options:
https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

How is this information useful to you?

When you want to execute java.exe from a directory, the Operating System (OS) must know  where to find this executable file. You could have many files with the same name in the system. The OS resolves this in this matter. First, it assumes the .exe file is in the same directory from where you attempted to execute it. Then, if it cannot find it there, it will go to all the directories listed in the classpath set on the file system in the order they appear and will execute the first one it finds. If no match is found, it throws an error.

You can, alternatively, provide the full path of the location of the .exe file. This is the most reliable way to execute the .exe file that you want to use.

I used this illustration to help you understand that this is the same with the program you want to launch. When you execute something like

C:\My Directory\> java HelloWorld

The OS expects that either the compiled unit is in "My Directory" or it can find it somewhere in the classpath. Java provides a mechanism to give you the flexibility to find the compiled unit. And this is by using either the -cp or -classpath option. All that said, this only works if your compiled unit is simple and don't have any dependencies and/or the compiled unit is not in a JAR file.

If your program has dependencies, the same concept applies: The OS must be able to find these dependencies in order to load them at runtime. If the program is inside a JAR file, you must execute the JAR instead of the compiled (main) class directly. To execute the JAR, you must use the -jar option.

java -jar Example.jar

If your program requires arguments, you need to pass them from the command line as well. More on this topic can be found here: https://www.baeldung.com/java-run-jar-with-arguments

Title: Understanding java command line

Body:
Can someone help me understand what the java cmd line is doing below (broken down so easier to read)? I found this in our AV and have no clue what this cmd does as a whole.

From my googling, I found that for -DACTIVE=true, the -D sets a system property value. In this case, my understaning is that it's setting the ACTIVE value to true..?

I also understand that -classpath searches for class files in the specified directories.

Unfortunately for com.zerog.lax.LAX , I can't find what it does/is. Any help is apreciated.

    "C:\Users\user\AppData\Local\Temp\I1644615473\Windows\resource\jre\bin\java.exe" -DACTIVE=true

    -classpath "C:\Users\user\AppData\Local\Temp\I1644615473\InstallerData\IAClasses.zip;

    C:\Users\user\AppData\Local\Temp\I1644615473\InstallerData\Execute.zip;

    C:\Users\user\AppData\Local\Temp\I1644615473\Windows\InstallerData\Execute.zip;

C:\Users\user\AppData\Local\Temp\I1644615473\InstallerData\Resource1.zip;

    C:\Users\user\AppData\Local\Temp\I1644615473\Windows\InstallerData\Resource1.zip;

    C:\Users\user\AppData\Local\Temp\I1644615473\InstallerData;

    C:\Users\user\AppData\Local\Temp\I1644615473\Windows\InstallerData;"

    com.zerog.lax.LAX

    "C:/Users/user/AppData/Local/Temp/I1644615473/Windows/setup.lax"

    "C:/Users/user/AppData/Local/Temp/laxF375.tmp"

Body:
Directly from java -help:

C:\Users\Hector>java -help
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -server       to select the "server" VM
                  The default VM is server.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

-D<name>=<value> Sets a system property. In your case: ACTIVE=true
Here's the thing: If "ACTIVE" is not a known system property, you must define it somewhere. For Maven projects, I would set them up in the POM. Here's how you do that in Maven: https://stackoverflow.com/a/3231981/2851311

-classpath or -cp is the preferred way to specify the classpath for the application being run. Why is this the preferred way? Simply because, if you want to execute a program from many machines, you would have to either set the classpath on every single one, OR simply create a script with the -classpath or -cp option in the command line instruction and you will not have to worry about the targeted system not being correctly configured to find the compiled unit being executed. Here's more on the topic of using these options:
https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

How is this information useful to you?

When you want to execute java.exe from a directory, the Operating System (OS) must know  where to find this executable file. You could have many files with the same name in the system. The OS resolves this in this matter. First, it assumes the .exe file is in the same directory from where you attempted to execute it. Then, if it cannot find it there, it will go to all the directories listed in the classpath set on the file system in the order they appear and will execute the first one it finds. If no match is found, it throws an error.

You can, alternatively, provide the full path of the location of the .exe file. This is the most reliable way to execute the .exe file that you want to use.

I used this illustration to help you understand that this is the same with the program you want to launch. When you execute something like

C:\My Directory\> java HelloWorld

The OS expects that either the compiled unit is in "My Directory" or it can find it somewhere in the classpath. Java provides a mechanism to give you the flexibility to find the compiled unit. And this is by using either the -cp or -classpath option. All that said, this only works if your compiled unit is simple and don't have any dependencies and/or the compiled unit is not in a JAR file.

If your program has dependencies, the same concept applies: The OS must be able to find these dependencies in order to load them at runtime. If the program is inside a JAR file, you must execute the JAR instead of the compiled (main) class directly. To execute the JAR, you must use the -jar option.

java -jar Example.jar

If your program requires arguments, you need to pass them from the command line as well. More on this topic can be found here: https://www.baeldung.com/java-run-jar-with-arguments


问:
Remove tablespace info from Materialized View DDL
Using the following SQL, the DDL for a given materialized view can be obtained.

```<code>BEGIN
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'STORAGE', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'TABLESPACE', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'SEGMENT_ATTRIBUTES', FALSE);
END;
SELECT DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW', 'OBJECT_NAME', 'SCHEMA_NAME') FROM DUAL;
</code>```

I am having difficulty retrieving the DDL without the tablespace information. The SET_TRANSFORM_PARAM directives are actually documented as being specific to tables and indexes (not materialized views). The STORAGE one does actually work whereas the TABLESPACE and SEGMENT_ATTRIBUTES ones have no effect. Is there any way to omit the tablespace info from the generated DDL?

答:
You need to set the object_type in the calls to SET_TRANSFORM_PARAM to MATERIALIZED_VIEW. In my example below, the tablespace is no mentioned:</p>

```<code>create materialized view mv
as select * from large_t where rownum < 100;

begin DBMS_METADATA.SET_TRANSFORM_PARAM (
              transform_handle => dbms_metadata.session_transform,
              name             => 'TABLESPACE',
              value            => false,
              object_type      => 'MATERIALIZED_VIEW');
end;
/

select dbms_metadata.get_ddl(
           'MATERIALIZED_VIEW',
           'MV',
           user)
         from dual;

CREATE MATERIALIZED VIEW "SODONNEL"."MV" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY", "NAMESPACE", "EDITION_NAME")
  ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  BUILD IMMEDIATE
  USING INDEX
  REFRESH FORCE ON DEMAND
  USING DEFAULT LOCAL ROLLBACK SEGMENT
  USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
  AS select * from large_t where rownum < 100
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Using the following SQL, the DDL for a given materialized view can be obtained.

BEGIN
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'STORAGE', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'TABLESPACE', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'SEGMENT_ATTRIBUTES', FALSE);
END;
SELECT DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW', 'OBJECT_NAME', 'SCHEMA_NAME') FROM DUAL;

I am having difficulty retrieving the DDL without the tablespace information. The SET_TRANSFORM_PARAM directives are actually documented as being specific to tables and indexes (not materialized views). The STORAGE one does actually work whereas the TABLESPACE and SEGMENT_ATTRIBUTES ones have no effect. Is there any way to omit the tablespace info from the generated DDL?

Body:
You need to set the object_type in the calls to SET_TRANSFORM_PARAM to MATERIALIZED_VIEW. In my example below, the tablespace is no mentioned:

create materialized view mv
as select * from large_t where rownum < 100;

begin DBMS_METADATA.SET_TRANSFORM_PARAM (
              transform_handle => dbms_metadata.session_transform,
              name             => 'TABLESPACE',
              value            => false,
              object_type      => 'MATERIALIZED_VIEW');
end;
/

select dbms_metadata.get_ddl(
           'MATERIALIZED_VIEW',
           'MV',
           user)
         from dual;

CREATE MATERIALIZED VIEW "SODONNEL"."MV" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY", "NAMESPACE", "EDITION_NAME")
  ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  BUILD IMMEDIATE
  USING INDEX
  REFRESH FORCE ON DEMAND
  USING DEFAULT LOCAL ROLLBACK SEGMENT
  USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
  AS select * from large_t where rownum < 100


问:
Spark cluster is not dynamically allocating resources to jobs
The cluster is HDInsight 4.0 and has 250 GB RAM and 75 VCores.

I am running only one job and the cluster is always allocating 66 GB, 7 VCores and 7 Containers to the job even though we have 250 GB and 75 VCores available for use. This is not particular to one job. I have ran 3 different jobs and all have this issue. when I run 3 jobs in parallel , the cluster is still allocating 66 GB RAM to each job. Looks like there is some static setting configured.

The following is the queue setup

I am using a tool called Talend(ETL tool similar to informatica) where I have a GUI to create a job . The tool is eclipse based and below is the code generated for spark configuration. This is then given to LIVY for submission in the cluster.

```<code>sparkConfiguration.set("spark.hadoop.talendStudioTimeZone", java.util.TimeZone.getDefault().getID());
    sparkConfiguration.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer");
    sparkConfiguration.set("spark.kryo.registrator", TalendKryoRegistrator.class.getName());
    sparkConfiguration.set("spark.yarn.submit.waitAppCompletion", "true");

    tuningConf.put("spark.yarn.maxAppAttempts", "1");

    tuningConf.put("spark.scheduler.mode", "FIFO");
</code>```

This is the screen shot of spark defaults

答:
The behavior is expected as 6 execuors * 10 GB per executor memory = 60G.

If want to use allocate more resources, try to increase exeucotr number such as 24

Body:
The cluster is HDInsight 4.0 and has 250 GB RAM and 75 VCores.

I am running only one job and the cluster is always allocating 66 GB, 7 VCores and 7 Containers to the job even though we have 250 GB and 75 VCores available for use. This is not particular to one job. I have ran 3 different jobs and all have this issue. when I run 3 jobs in parallel , the cluster is still allocating 66 GB RAM to each job. Looks like there is some static setting configured.

The following is the queue setup

I am using a tool called Talend(ETL tool similar to informatica) where I have a GUI to create a job . The tool is eclipse based and below is the code generated for spark configuration. This is then given to LIVY for submission in the cluster.

sparkConfiguration.set("spark.hadoop.talendStudioTimeZone", java.util.TimeZone.getDefault().getID());
    sparkConfiguration.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer");
    sparkConfiguration.set("spark.kryo.registrator", TalendKryoRegistrator.class.getName());
    sparkConfiguration.set("spark.yarn.submit.waitAppCompletion", "true");

    tuningConf.put("spark.yarn.maxAppAttempts", "1");

    tuningConf.put("spark.scheduler.mode", "FIFO");

This is the screen shot of spark defaults


问:
C# For Loop with LIST using LINQ
I'm using LINQ and returning a list to my Business Logic Layer. I'mtrying to change one of the values in the list (changing the 'star' rating to an image with the number of stars).

Although the counter (i) appears to be working, the FOR loop is not working correctly.  The first time through it stops at the correct IF but then it pops out at the ELSE statement for everything and all values end up with "star0.png."  It appears as though I'm not cycling through the list???  Thanks in advance!

```<code>    for (int i = 0; i < ReviewList.Count; i++)
    {
        string serviceCode = ReviewList[i].SERVICE.SERVICE_DESC;
        if (serviceCode == "*")
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star1.png";
        }
        else if (serviceCode == "**")
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star2.png";
        }
        else if (serviceCode == "***")
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star3.png";
        }
        else if (serviceCode == "****")
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star4.png";
        }
        else
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star0.png";
        }
    }
</code>```

答:
I dont think its an issue of the for loop working properly... your syntax is good and as written will iterate ReviewList.Count # of times.

I would step through and verify the contents of ReviewList first.

Let me know what you find

Title: C# For Loop with LIST using LINQ

Body:
I'm using LINQ and returning a list to my Business Logic Layer. I'mtrying to change one of the values in the list (changing the 'star' rating to an image with the number of stars).

Although the counter (i) appears to be working, the FOR loop is not working correctly.  The first time through it stops at the correct IF but then it pops out at the ELSE statement for everything and all values end up with "star0.png."  It appears as though I'm not cycling through the list???  Thanks in advance!

    for (int i = 0; i < ReviewList.Count; i++)
    {
        string serviceCode = ReviewList[i].SERVICE.SERVICE_DESC;
        if (serviceCode == "*")
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star1.png";
        }
        else if (serviceCode == "**")
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star2.png";
        }
        else if (serviceCode == "***")
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star3.png";
        }
        else if (serviceCode == "****")
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star4.png";
        }
        else
        {
            ReviewList[i].SERVICE.SERVICE_DESC = "star0.png";
        }
    }


问:
from_stream not a member of std::chrono
I am currently working on a small home project for some data processing in C++. My input data contains timestamps, e.g. "2022-02-11T16:05:05+01:00". As I need to do some arithmetic on it (e.g. subtracting and adding minutes), I would like to convert this to a date/time format.

I came across this answer on Stack Overflow. I copy-pasted the exact same code into my code editor (Visual Studio 17.0.6), which produces buckets of errors, two of these being:

```<code>C2039   'sys_time': is not a member of 'std::chrono'
C2039   'from_stream': is not a member of 'std::chrono'
</code>```

I then tried Wandbox with the latest GCC and Clang compilers, again with many errors (although the sys_time error has disappeared).

I haven't used C++ that much in the last couple of years, so I am not entirely familiar with
all the additions to the recent versions. However, I see that the chrono library has been implemented in all of these compilers as part of the C++20 additions. Why do I keep getting these errors?

答:
There is a free, open source preview that I can recommend: Take a look at HowardHinnant</p>
```<code>std::chrono::sys_time<std::chrono::microseconds> timestamp;
std::stringstream ss = foo();
ss >> date::parse("%Y-%m-%d %T", timestamp);
</code>```

Title: from_stream not a member of std::chrono

Body:
I am currently working on a small home project for some data processing in C++. My input data contains timestamps, e.g. "2022-02-11T16:05:05+01:00". As I need to do some arithmetic on it (e.g. subtracting and adding minutes), I would like to convert this to a date/time format.

I came across this answer on Stack Overflow. I copy-pasted the exact same code into my code editor (Visual Studio 17.0.6), which produces buckets of errors, two of these being:

C2039   'sys_time': is not a member of 'std::chrono'
C2039   'from_stream': is not a member of 'std::chrono'

I then tried Wandbox with the latest GCC and Clang compilers, again with many errors (although the sys_time error has disappeared).

I haven't used C++ that much in the last couple of years, so I am not entirely familiar with
all the additions to the recent versions. However, I see that the chrono library has been implemented in all of these compilers as part of the C++20 additions. Why do I keep getting these errors?

Body:
There is a free, open source preview that I can recommend: Take a look at HowardHinnant

std::chrono::sys_time<std::chrono::microseconds> timestamp;
std::stringstream ss = foo();
ss >> date::parse("%Y-%m-%d %T", timestamp);


问:
How to implement a constrained linear fit in Python?
I'm trying to fit a linear model to a set of data, with the constraint that all the residuals (model - data) are positive - in other words, the model should be the "best overestimate".  Without this constraint, linear models can be easily found with numpy's polyfit as shown below.

```<code>import numpy as np
import matplotlib.pyplot as plt

x = [-4.12179107e-01, -1.40664082e-01, -5.52301563e-06,  1.82898473e-01]
y = [-4.14846251, -3.31607886, -3.57827245, -5.09914559]

plt.scatter(x,y)
coeff = np.polyfit(x,y,1)
plt.plot(x,np.polyval(coeff,x),c='r',label='numpy-polyval')
plt.plot(x,np.polyval([-2,-3.6],x),c='g',label='desired-fit') #a rough guess of the desired result
plt.legend()
</code>```

example1

Is there an efficient way to implement a linear fit with this type of constraint?

答:
This is a quadratic programming problem. There are several libraries (CVXOPT, quadprog etc.) that can be used to solve it. Here is an example using quadprog:

```<code>import numpy as np
import matplotlib.pyplot as plt
import quadprog

x = [-4.12179107e-01, -1.40664082e-01, -5.52301563e-06, 1.82898473e-01]
y = [-4.14846251, -3.31607886, -3.57827245, -5.09914559]

A = np.c_[x, np.ones(len(x))]
y = np.array(y)
G = A.T @ A
a = A.T @ y
C = A.T
b = y
coeffs = quadprog.solve_qp(G, a, C, b)[0]

plt.scatter(x, y)
plt.plot(x, np.polyval(coeffs, x), c='r')
plt.show()
</code>```

This gives:

See e.g. this post for more information. In describes, in particular, how to set up a linear regression problem as a quadratic programming problem.

As a side note, the optimal line will always pass through one data point, but it need not pass through two such points. For example, take x = [-1., 0., 1.] and y = [1., 2., 1.].

Body:
I'm trying to fit a linear model to a set of data, with the constraint that all the residuals (model - data) are positive - in other words, the model should be the "best overestimate".  Without this constraint, linear models can be easily found with numpy's polyfit as shown below.

import numpy as np
import matplotlib.pyplot as plt

x = [-4.12179107e-01, -1.40664082e-01, -5.52301563e-06,  1.82898473e-01]
y = [-4.14846251, -3.31607886, -3.57827245, -5.09914559]

plt.scatter(x,y)
coeff = np.polyfit(x,y,1)
plt.plot(x,np.polyval(coeff,x),c='r',label='numpy-polyval')
plt.plot(x,np.polyval([-2,-3.6],x),c='g',label='desired-fit') #a rough guess of the desired result
plt.legend()

example1

Is there an efficient way to implement a linear fit with this type of constraint?

Body:
This is a quadratic programming problem. There are several libraries (CVXOPT, quadprog etc.) that can be used to solve it. Here is an example using quadprog:

import numpy as np
import matplotlib.pyplot as plt
import quadprog

x = [-4.12179107e-01, -1.40664082e-01, -5.52301563e-06, 1.82898473e-01]
y = [-4.14846251, -3.31607886, -3.57827245, -5.09914559]

A = np.c_[x, np.ones(len(x))]
y = np.array(y)
G = A.T @ A
a = A.T @ y
C = A.T
b = y
coeffs = quadprog.solve_qp(G, a, C, b)[0]

plt.scatter(x, y)
plt.plot(x, np.polyval(coeffs, x), c='r')
plt.show()

This gives:

See e.g. this post for more information. In describes, in particular, how to set up a linear regression problem as a quadratic programming problem.

As a side note, the optimal line will always pass through one data point, but it need not pass through two such points. For example, take x = [-1., 0., 1.] and y = [1., 2., 1.].