问:
BETWEEN SQL - why is there a gap lock?
```<code>CREATE TABLE justpk
(
    A INT,
    B INT,
    PRIMARY KEY (A)
);

INSERT INTO justpk (A, B) VALUES (1, 1), (4, 1), (5, 1);
+---+------+
| a | b    |
+---+------+
| 1 |    1 |
| 4 |    1 |
| 5 |    1 |
+---+------+
</code>```

Session1:

```<code>begin;
SELECT * FROM justpk WHERE A BETWEEN 1 AND 5 FOR UPDATE;
</code>```

In another random session:

```<code>INSERT INTO lockingreads.justpk (A, B) VALUES (0, 1); # allowed
UPDATE lockingreads.justpk SET B = 2 WHERE A = 1; # blocked
INSERT INTO lockingreads.justpk (A, B) VALUES (2, 1); # blocked
INSERT INTO lockingreads.justpk (A, B) VALUES (3, 1); # blocked
UPDATE lockingreads.justpk SET B = 2 WHERE A = 4; # blocked
UPDATE lockingreads.justpk SET B = 2 WHERE A = 5; # blocked
INSERT INTO lockingreads.justpk (A, B) VALUES (6, 1); # blocked // what?
</code>```

why is there a gap lock after 5 if a = 6 would not be included in the "between" condition?

Title: BETWEEN SQL - why is there a gap lock?

Body:
CREATE TABLE justpk
(
    A INT,
    B INT,
    PRIMARY KEY (A)
);

INSERT INTO justpk (A, B) VALUES (1, 1), (4, 1), (5, 1);
+---+------+
| a | b    |
+---+------+
| 1 |    1 |
| 4 |    1 |
| 5 |    1 |
+---+------+

Session1:

begin;
SELECT * FROM justpk WHERE A BETWEEN 1 AND 5 FOR UPDATE;

In another random session:

INSERT INTO lockingreads.justpk (A, B) VALUES (0, 1); # allowed
UPDATE lockingreads.justpk SET B = 2 WHERE A = 1; # blocked
INSERT INTO lockingreads.justpk (A, B) VALUES (2, 1); # blocked
INSERT INTO lockingreads.justpk (A, B) VALUES (3, 1); # blocked
UPDATE lockingreads.justpk SET B = 2 WHERE A = 4; # blocked
UPDATE lockingreads.justpk SET B = 2 WHERE A = 5; # blocked
INSERT INTO lockingreads.justpk (A, B) VALUES (6, 1); # blocked // what?

why is there a gap lock after 5 if a = 6 would not be included in the "between" condition?


来源: stackexchange

问:
How can the global window object be created before there is a realm in existance?
Background

When a browser opens a new window or tab, a new browsing context is created.

As we can see from the HTML spec, the operation that creates a new browsing context calls another operation that creates a new realm, which in turn calls the operation InitializeHostDefinedRealm defined in the ECMAScript spec.

The HTML spec operation that creates the browsing context states that when a new realm is created it should be done with a new Window object as the global object, and a WindowProxy object as the global this value.

Within InitializeHostDefinedRealm, we see that a new realm is created in step 1. In step 7, the global object is created in a host-defined manner.

If we take a look at the Web IDL spec, we can see how platform objects (instances of interface objects) are created.

For it to be possible for a platform object (like the global object window) to be created, the corresponding interface object (which is a function object) must have been created previously via the operation for creating interface objects. This is because the latter operation creates the interface prototype object for the interface.

Taking it back to the global object, creating the interface object Window will create Window.prototype, which will be used when the platform object window (an instance of interface object Window) is created.

Lastly, we also know from the operation that creates platform objects that the operation requires realm.[[GlobalObject]] to be present, for instance to check if an interface member is Exposed on a realm: Create platform object (see step 10.1) > Add Regular operations that are exposed on Window (see step 1.1)  > exposed definition

Questions

In InitializeHostDefinedRealm, realm.[[GlobalObject]] is not set until after the host has created the new Window object (step 9 vs step 7). realm.[[GlobalObject]] cannot be set without a global object present, and the global object window cannot be created without realm.[[GlobalObject]] present. How is this apparent deadlock solved?

Step 9 of the operation that creates a browsing context states that a new Window object should be created as the global object, without any further details on how that is accomplished. Does it imply that the browser first creates the Window interface object and then the corresponding window platform object?

ContentLicense: CC BY-SA 4.0


问:
Insert prefix to a variable if not empty in shell
I want just one statement to do something like:

pip3 install $([ -n "$PYPI_MIRROR"] && echo "--index-url $PYPI_MIRROR") -r requirements.txt
```
<p>It means it will append <code>--index-url <url></code> arguments only if the <code>$PYPI_MIRROR</code> variable is set.</p>
<p>Then I found that</p>
<pre class="lang-bash prettyprint-override"><code>pip3 install ${PYPI_MIRROR/#/--index-url } -r requirements.txt
</code>```

It works with sh and bash but zsh, zsh will always got --index-url  whether $PYPI_MIRROR is set or not.

And there are some other problems with the 2nd solution, such as PYPI_MIRROR is set but empty.

Is there a way to do this more reliable?

Body:
I want just one statement to do something like:

pip3 install $([ -n "$PYPI_MIRROR"] && echo "--index-url $PYPI_MIRROR") -r requirements.txt

It means it will append --index-url <url> arguments only if the $PYPI_MIRROR variable is set.

Then I found that

pip3 install ${PYPI_MIRROR/#/--index-url } -r requirements.txt

It works with sh and bash but zsh, zsh will always got --index-url  whether $PYPI_MIRROR is set or not.

And there are some other problems with the 2nd solution, such as PYPI_MIRROR is set but empty.

Is there a way to do this more reliable?


问:
Flutter) How can I stop in package file at Visual studio code?
I'm coding flutter with Visual Studio Code.

I use new_version package, and I think the package has error. So When I'm debugging, debugger can't go inside the package TT. Even I make breakpoint inside, it doesn't seem to work. Please help me how can I stop in package file when debebugging.
breakpoint is red in vsc, but it is empty in package file

I made breakpoint in package file, and debug.


问:
coredump can not be located, can anyone has experence about the listed problem?
[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Core was generated by `/home/mogo/autopilot/lib/localization/localization_node --sensor_meta_path=/hom'.

Program terminated with signal SIGSEGV, Segmentation fault.

#0  0x0000007fa6ee3e34 in std::locale::locale() () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6

[Current thread is 1 (Thread 0x7fa2d9deb0 (LWP 3264))]

(gdb) bt

#0  0x0000007fa6ee3e34 in std::locale::locale() () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6

#1  0x0000007fa6ee0390 in std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& std::operator<< <float, wchar_t, std::char_traits<wchar_t> >(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >&, std::complex const&) () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6

#2  0x0000007fa6ed152c in operator new(unsigned long) () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6

#3  0x00000055992240c0 in ?? ()

#4  0x0000007fa712dc90 in boost::detail::sp_counted_impl_pd<ros::MessageDeserializer*, boost::detail::sp_ms_deleterros::MessageDeserializer >::get_local_deleter (this=, ti=...)

```<code>at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:183
</code>```

Backtrace stopped: previous frame identical to this frame (corrupt stack?)

I use gdb, but can not find the crash point.

Body:
[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Core was generated by `/home/mogo/autopilot/lib/localization/localization_node --sensor_meta_path=/hom'.

Program terminated with signal SIGSEGV, Segmentation fault.

#0  0x0000007fa6ee3e34 in std::locale::locale() () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6

[Current thread is 1 (Thread 0x7fa2d9deb0 (LWP 3264))]

(gdb) bt

#0  0x0000007fa6ee3e34 in std::locale::locale() () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6

#1  0x0000007fa6ee0390 in std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& std::operator<< <float, wchar_t, std::char_traits<wchar_t> >(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >&, std::complex const&) () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6

#2  0x0000007fa6ed152c in operator new(unsigned long) () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6

#3  0x00000055992240c0 in ?? ()

#4  0x0000007fa712dc90 in boost::detail::sp_counted_impl_pd<ros::MessageDeserializer*, boost::detail::sp_ms_deleterros::MessageDeserializer >::get_local_deleter (this=, ti=...)

at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:183

Backtrace stopped: previous frame identical to this frame (corrupt stack?)

I use gdb, but can not find the crash point.


问:
Which is the best approach for an app with multiple users using Room database?
I'm developing an app (Android, Kotlin) that allows the user to register different documents with specific information in Room database. I'll implement in the app to only be able to display the files registered if the user is logged in.

It concerns me because if a device is shared, everything you need is to log in to access another user data, which is totally not cool.

I'm using room database and firebase for authentication. I was wondering if every time the user add a new file to room database and it includes the auth.currentUser!!.uid and also every query request for the database, would it be alright? For example:

```<code>@Entity(tableName = "example")
data class Model(
    @PrimaryKey
    var id: Int? = null,
    var title: String? = null,
    val userId: String = Firebase.auth.currentUser!!.uid
)
</code>```

And every request for the database automatically uses the current user to request data from Room. Would it be a bad approach for a case like that? If it is not, how could I separate properly the data from different users in the same database?

Thanks for your help

Body:
I'm developing an app (Android, Kotlin) that allows the user to register different documents with specific information in Room database. I'll implement in the app to only be able to display the files registered if the user is logged in.

It concerns me because if a device is shared, everything you need is to log in to access another user data, which is totally not cool.

I'm using room database and firebase for authentication. I was wondering if every time the user add a new file to room database and it includes the auth.currentUser!!.uid and also every query request for the database, would it be alright? For example:

@Entity(tableName = "example")
data class Model(
    @PrimaryKey
    var id: Int? = null,
    var title: String? = null,
    val userId: String = Firebase.auth.currentUser!!.uid
)

And every request for the database automatically uses the current user to request data from Room. Would it be a bad approach for a case like that? If it is not, how could I separate properly the data from different users in the same database?

Thanks for your help


问:
NPOI Insert a new row like excel to extend chart data
I am trying to insert a new row in Excel to fill in some data to populate a chart from an Excel template.

My first attempt was using worksheet.CreateRow(index);, but it creates an empty row without any style from the previous row or formula for the chart.

I came across a post in StackOverflow that recommend this code to add a new row like excel:

```<code>worksheet.ShiftRows(StartingRow, StartingRow + 1, 1);

for (int rowIndex = StartingRowIndex; rowIndex < StartingRow + 1; rowIndex++)
{
    IRow rowSource = worksheet.GetRow(rowIndex);
    IRow rowInsert = worksheet.CreateRow(rowIndex + 1);
    rowInsert.Height = rowSource.Height;

    for (int colIndex = 0; colIndex < rowSource.LastCellNum; colIndex++)
    {
        ICell cellSource = rowSource.GetCell(colIndex);
        ICell cellInsert = rowInsert.CreateCell(colIndex);
        if (cellSource != null)
        {
            cellInsert.CellStyle = cellSource.CellStyle;
        }
    }
}
</code>```

But still, it didn't work. The chart data from the template will stay at 2 rows and won't grow more even tho more rows were added.

Body:
I am trying to insert a new row in Excel to fill in some data to populate a chart from an Excel template.

My first attempt was using worksheet.CreateRow(index);, but it creates an empty row without any style from the previous row or formula for the chart.

I came across a post in StackOverflow that recommend this code to add a new row like excel:

worksheet.ShiftRows(StartingRow, StartingRow + 1, 1);

for (int rowIndex = StartingRowIndex; rowIndex < StartingRow + 1; rowIndex++)
{
    IRow rowSource = worksheet.GetRow(rowIndex);
    IRow rowInsert = worksheet.CreateRow(rowIndex + 1);
    rowInsert.Height = rowSource.Height;

    for (int colIndex = 0; colIndex < rowSource.LastCellNum; colIndex++)
    {
        ICell cellSource = rowSource.GetCell(colIndex);
        ICell cellInsert = rowInsert.CreateCell(colIndex);
        if (cellSource != null)
        {
            cellInsert.CellStyle = cellSource.CellStyle;
        }
    }
}

But still, it didn't work. The chart data from the template will stay at 2 rows and won't grow more even tho more rows were added.


问:
docker attach Error : Execution engine not called in 120 seconds, consensus client may not be connected
woohyeok@DESKTOP---00:/mnt/c/Users/23412$ docker attach block_chain
2023-01-06 01:46:32.317+00:00 | vert.x-eventloop-thread-0 | WARN  | EngineQosTimer | Execution engine not called in 120 seconds, consensus client may not be connected
2023-01-06 01:48:32.323+00:00 | vert.x-eventloop-thread-0 | WARN  | EngineQosTimer | Execution engine not called in 120 seconds, consensus client may not be connected
2023-01-06 01:50:32.344+00:00 | vert.x-eventloop-thread-0 | WARN  | EngineQosTimer | Execution engine not called in 120 seconds, consensus client may not be connected
2023-01-06 01:52:32.367+00:00 | vert.x-eventloop-thread-0 | WARN  | EngineQosTimer | Execution engine not called in 120 seconds, consensus client may not be connected
2023-01-06 01:54:32.379+00:00 | vert.x-eventloop-thread-0 | WARN  | EngineQosTimer | Execution engine not called in 120 seconds, consensus client may not be connected
2023-01-06 01:56:32.479+00:00 | vert.x-eventloop-thread-0 | WARN  | EngineQosTimer | Execution engine not called in 120 seconds, consensus client may not be connected
2023-01-06 01:58:32.544+00:00 | vert.x-eventloop-thread-0 | WARN  | EngineQosTimer | Execution engine not called in 120 seconds, consensus client may not be connected
2023-01-06 02:00:32.639+00:00 | vert.x-eventloop-thread-0 | WARN  | EngineQosTimer | Execution engine not called in 120 seconds, consensus client may not be connected

I entered the command to enter the container after starting the container into the powerhell wsl, but this warning message came up. What is the problem?
I use the besu image in Docker


问:
chromium build failure on ubuntu-20.04
I wanted to try building Chromium, so I followed this. but I got an error while building.

I just get the code using fetch command with --no-history. of course, I think that the packages with dependencies were properly installed using scripts according to the documentation.
I'm just following the document guide, so I don't know where to start to fix this. I am a chromium newbie.

Here is an error message. How can I solve this?

$ gn gen out/Default
$ autoninja -C out/Default chrome
ninja: Entering directory `out/Default'
[218/26862] ACTION //chrome/browser/resources/side_panel/reading_list:build_ts(//build/toolchain/linux:clang_x64)
FAILED: gen/chrome/browser/resources/side_panel/reading_list/tsconfig_build_ts.json gen/chrome/browser/resources/side_panel/reading_list/build_ts.manifest gen/chrome/browser/resources/side_panel/reading_list/tsc/app.js gen/chrome/browser/resources/side_panel/reading_list/tsc/app.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_item.js gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_item.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_api_proxy.js gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_api_proxy.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/app.html.js gen/chrome/browser/resources/side_panel/reading_list/tsc/app.html.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_item.html.js gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_item.html.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/icons.html.js gen/chrome/browser/resources/side_panel/reading_list/tsc/icons.html.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list.mojom-webui.js gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list.mojom-webui.d.ts
python3 ../../tools/typescript/ts_library.py --root_dir gen/chrome/browser/resources/side_panel/reading_list/preprocessed --gen_dir gen/chrome/browser/resources/side_panel/reading_list --out_dir gen/chrome/browser/resources/side_panel/reading_list/tsc --output_suffix build_ts --in_files app.ts reading_list_item.ts reading_list_api_proxy.ts app.html.ts reading_list_item.html.ts icons.html.ts reading_list.mojom-webui.js --definitions ../../../../../../../../tools/typescript/definitions/metrics_private.d.ts --deps ../../../../../third_party/polymer/v3_0/tsconfig_library.json ../../../../../ui/webui/resources/tsconfig_library.json ../../../../../ui/webui/resources/mojo/tsconfig_library.json --tsconfig_base ../../../../../../../../chrome/browser/resources/side_panel/reading_list/tsconfig_base.json --composite --path_mappings chrome://resources/cr_components/managed_footnote/managed_footnote.js\|../../../../../ui/webui/resources/preprocessed/cr_components/managed_footnote/managed_footnote.d.ts chrome://resources/cr_components/managed_dialog/managed_dialog.js\|../../../../../ui/webui/resources/preprocessed/cr_components/managed_dialog/managed_dialog.d.ts chrome://resources/\*\|../../../../../ui/webui/resources/preprocessed/\* //resources/\*\|../../../../../ui/webui/resources/preprocessed/\* chrome://resources/polymer/v3_0/\*\|../../../../../../../../third_party/polymer/v3_0/components-chromium/\* //resources/polymer/v3_0/\*\|../../../../../../../../third_party/polymer/v3_0/components-chromium/\* chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js\|../../../../../../../../third_party/polymer/v3_0/components-chromium/polymer/polymer.d.ts //resources/polymer/v3_0/polymer/polymer_bundled.min.js\|../../../../../../../../third_party/polymer/v3_0/components-chromium/polymer/polymer.d.ts /tools/typescript/definitions/\*\|../../../../../../../../tools/typescript/definitions/\*
Traceback (most recent call last):
  File "../../tools/typescript/ts_library.py", line 220, in <module>
    main(sys.argv[1:])
  File "../../tools/typescript/ts_library.py", line 183, in main
    node.RunNode([
  File "/home/boram/work/chromium/src/out/Default/../../third_party/node/node.py", line 34, in RunNode
    raise RuntimeError('Command \'%s\' failed\n%s' % (' '.join(cmd), err))
RuntimeError: Command '/home/boram/work/chromium/src/out/Default/../../third_party/node/linux/node-linux-x64/bin/node /home/boram/work/chromium/src/out/Default/../../third_party/node/node_modules/typescript/bin/tsc --project gen/chrome/browser/resources/side_panel/reading_list/tsconfig_build_ts.json' failed
gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:16:57 - error TS2792: Cannot find module 'chrome://resources/cr_components/help_bubble/help_bubble_mixin.js'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?

16 import {HelpBubbleMixin, HelpBubbleMixinInterface} from 'chrome://resources/cr_components/help_bubble/help_bubble_mixin.js';
                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:108:12 - error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'any'.

108   override connectedCallback() {

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:126:14 - error TS4111: Property 'root' comes from an index signature, so it must be accessed with ['root'].

126         this.root!, MARKED_AS_READ_UI_EVENT, this.onMarkedAsRead.bind(this));
                 ~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:129:12 - error
               ~~~~~~~~~~~~~~~~~TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'any'.

129   override disconnectedCallback() {
               ~~~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:138:10 - error TS4111: Property 'unregisterHelpBubble' comes from an index signature, so it must be accessed with ['unregisterHelpBubble'].

138     this.unregisterHelpBubble(READING_LIST_UNREAD_ELEMENT_ID);
             ~~~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:140:47 - error TS4111: Property 'root' comes from an index signature, so it must be accessed with ['root'].

140     this.readingListEventTracker_.remove(this.root!, MARKED_AS_READ_UI_EVENT);
                                                  ~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:143:12 - error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'any'.

143   override ready() {
               ~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:146:10 - error TS4111: Property 'registerHelpBubble' comes from an index signature, so it must be accessed with ['registerHelpBubble'].

146     this.registerHelpBubble(
             ~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:152:20 - error TS4111: Property 'root' comes from an index signature, so it must be accessed with ['root'].

152               this.root!.querySelector('.unread-item') as HTMLElement | null;
                       ~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:154:18 - error TS4111: Property 'registerHelpBubble' comes from an index signature, so it must be accessed with ['registerHelpBubble'].

154             this.registerHelpBubble(
                     ~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:265:10 - error TS4111: Property 'notifyHelpBubbleAnchorCustomEvent' comes from an index signature, so it must be accessed with ['notifyHelpBubbleAnchorCustomEvent'].

265     this.notifyHelpBubbleAnchorCustomEvent(
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:308:49 - error TS2345: Argument of type 'typeof ReadingListAppElement' is not assignable to parameter of type 'CustomElementConstructor'.
  Type 'ReadingListAppElement' is missing the following properties from type 'HTMLElement': accessKey, accessKeyLabel, autocapitalize, dir, and 277 more.

308 customElements.define(ReadingListAppElement.is, ReadingListAppElement);
                                                    ~~~~~~~~~~~~~~~~~~~~~

../../third_party/node/node_modules/typescript/lib/lib.dom.d.ts:4530:101 - error TS2344: Type 'HTMLElementTagNameMap[K]' does not satisfy the constraint 'Element'.
  Type 'HTMLTemplateElement | HTMLElement | HTMLSlotElement | DomModule | HTMLStyleElement | PaperRippleElement | ... 74 more ... | HTMLUListElement' is not assignable to type 'Element'.
    Type 'ReadingListAppElement' is missing the following properties from type 'Element': attributes, classList, className, clientHeight, and 160 more.

4530     getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~

../../third_party/node/node_modules/typescript/lib/lib.dom.d.ts:4818:101 - error TS2344: Type 'HTMLElementTagNameMap[K]' does not satisfy the constraint 'Element'.
  Type 'HTMLTemplateElement | HTMLElement | HTMLSlotElement | DomModule | HTMLStyleElement | PaperRippleElement | ... 74 more ... | HTMLUListElement' is not assignable to type 'Element'.

4818     getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~

../../third_party/node/node_modules/typescript/lib/lib.dom.d.ts:10170:87 - error TS2344: Type 'HTMLElementTagNameMap[K]' does not satisfy the constraint 'Node'.
  Type 'HTMLTemplateElement | HTMLElement | HTMLSlotElement | DomModule | HTMLStyleElement | PaperRippleElement | ... 74 more ... | HTMLUListElement' is not assignable to type 'Node'.
    Type 'ReadingListAppElement' is missing the following properties from type 'Node': baseURI, childNodes, firstChild, isConnected, and 46 more.

10170     querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~

Found 15 errors in 2 files.

Errors  Files
    12  gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:16
     3  ../../third_party/node/node_modules/typescript/lib/lib.dom.d.ts:4530
```

I checked the dependency package installation, and checked the gclient sink again.

Title: chromium build failure on ubuntu-20.04

Body:
I wanted to try building Chromium, so I followed this. but I got an error while building.

I just get the code using fetch command with --no-history. of course, I think that the packages with dependencies were properly installed using scripts according to the documentation.
I'm just following the document guide, so I don't know where to start to fix this. I am a chromium newbie.

Here is an error message. How can I solve this?

$ gn gen out/Default
$ autoninja -C out/Default chrome
ninja: Entering directory `out/Default'
[218/26862] ACTION //chrome/browser/resources/side_panel/reading_list:build_ts(//build/toolchain/linux:clang_x64)
FAILED: gen/chrome/browser/resources/side_panel/reading_list/tsconfig_build_ts.json gen/chrome/browser/resources/side_panel/reading_list/build_ts.manifest gen/chrome/browser/resources/side_panel/reading_list/tsc/app.js gen/chrome/browser/resources/side_panel/reading_list/tsc/app.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_item.js gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_item.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_api_proxy.js gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_api_proxy.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/app.html.js gen/chrome/browser/resources/side_panel/reading_list/tsc/app.html.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_item.html.js gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list_item.html.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/icons.html.js gen/chrome/browser/resources/side_panel/reading_list/tsc/icons.html.d.ts gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list.mojom-webui.js gen/chrome/browser/resources/side_panel/reading_list/tsc/reading_list.mojom-webui.d.ts
python3 ../../tools/typescript/ts_library.py --root_dir gen/chrome/browser/resources/side_panel/reading_list/preprocessed --gen_dir gen/chrome/browser/resources/side_panel/reading_list --out_dir gen/chrome/browser/resources/side_panel/reading_list/tsc --output_suffix build_ts --in_files app.ts reading_list_item.ts reading_list_api_proxy.ts app.html.ts reading_list_item.html.ts icons.html.ts reading_list.mojom-webui.js --definitions ../../../../../../../../tools/typescript/definitions/metrics_private.d.ts --deps ../../../../../third_party/polymer/v3_0/tsconfig_library.json ../../../../../ui/webui/resources/tsconfig_library.json ../../../../../ui/webui/resources/mojo/tsconfig_library.json --tsconfig_base ../../../../../../../../chrome/browser/resources/side_panel/reading_list/tsconfig_base.json --composite --path_mappings chrome://resources/cr_components/managed_footnote/managed_footnote.js\|../../../../../ui/webui/resources/preprocessed/cr_components/managed_footnote/managed_footnote.d.ts chrome://resources/cr_components/managed_dialog/managed_dialog.js\|../../../../../ui/webui/resources/preprocessed/cr_components/managed_dialog/managed_dialog.d.ts chrome://resources/\*\|../../../../../ui/webui/resources/preprocessed/\* //resources/\*\|../../../../../ui/webui/resources/preprocessed/\* chrome://resources/polymer/v3_0/\*\|../../../../../../../../third_party/polymer/v3_0/components-chromium/\* //resources/polymer/v3_0/\*\|../../../../../../../../third_party/polymer/v3_0/components-chromium/\* chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js\|../../../../../../../../third_party/polymer/v3_0/components-chromium/polymer/polymer.d.ts //resources/polymer/v3_0/polymer/polymer_bundled.min.js\|../../../../../../../../third_party/polymer/v3_0/components-chromium/polymer/polymer.d.ts /tools/typescript/definitions/\*\|../../../../../../../../tools/typescript/definitions/\*
Traceback (most recent call last):
  File "../../tools/typescript/ts_library.py", line 220, in <module>
    main(sys.argv[1:])
  File "../../tools/typescript/ts_library.py", line 183, in main
    node.RunNode([
  File "/home/boram/work/chromium/src/out/Default/../../third_party/node/node.py", line 34, in RunNode
    raise RuntimeError('Command \'%s\' failed\n%s' % (' '.join(cmd), err))
RuntimeError: Command '/home/boram/work/chromium/src/out/Default/../../third_party/node/linux/node-linux-x64/bin/node /home/boram/work/chromium/src/out/Default/../../third_party/node/node_modules/typescript/bin/tsc --project gen/chrome/browser/resources/side_panel/reading_list/tsconfig_build_ts.json' failed
gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:16:57 - error TS2792: Cannot find module 'chrome://resources/cr_components/help_bubble/help_bubble_mixin.js'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?

16 import {HelpBubbleMixin, HelpBubbleMixinInterface} from 'chrome://resources/cr_components/help_bubble/help_bubble_mixin.js';
                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:108:12 - error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'any'.

108   override connectedCallback() {

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:126:14 - error TS4111: Property 'root' comes from an index signature, so it must be accessed with ['root'].

126         this.root!, MARKED_AS_READ_UI_EVENT, this.onMarkedAsRead.bind(this));
                 ~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:129:12 - error
               ~~~~~~~~~~~~~~~~~TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'any'.

129   override disconnectedCallback() {
               ~~~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:138:10 - error TS4111: Property 'unregisterHelpBubble' comes from an index signature, so it must be accessed with ['unregisterHelpBubble'].

138     this.unregisterHelpBubble(READING_LIST_UNREAD_ELEMENT_ID);
             ~~~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:140:47 - error TS4111: Property 'root' comes from an index signature, so it must be accessed with ['root'].

140     this.readingListEventTracker_.remove(this.root!, MARKED_AS_READ_UI_EVENT);
                                                  ~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:143:12 - error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'any'.

143   override ready() {
               ~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:146:10 - error TS4111: Property 'registerHelpBubble' comes from an index signature, so it must be accessed with ['registerHelpBubble'].

146     this.registerHelpBubble(
             ~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:152:20 - error TS4111: Property 'root' comes from an index signature, so it must be accessed with ['root'].

152               this.root!.querySelector('.unread-item') as HTMLElement | null;
                       ~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:154:18 - error TS4111: Property 'registerHelpBubble' comes from an index signature, so it must be accessed with ['registerHelpBubble'].

154             this.registerHelpBubble(
                     ~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:265:10 - error TS4111: Property 'notifyHelpBubbleAnchorCustomEvent' comes from an index signature, so it must be accessed with ['notifyHelpBubbleAnchorCustomEvent'].

265     this.notifyHelpBubbleAnchorCustomEvent(
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:308:49 - error TS2345: Argument of type 'typeof ReadingListAppElement' is not assignable to parameter of type 'CustomElementConstructor'.
  Type 'ReadingListAppElement' is missing the following properties from type 'HTMLElement': accessKey, accessKeyLabel, autocapitalize, dir, and 277 more.

308 customElements.define(ReadingListAppElement.is, ReadingListAppElement);
                                                    ~~~~~~~~~~~~~~~~~~~~~

../../third_party/node/node_modules/typescript/lib/lib.dom.d.ts:4530:101 - error TS2344: Type 'HTMLElementTagNameMap[K]' does not satisfy the constraint 'Element'.
  Type 'HTMLTemplateElement | HTMLElement | HTMLSlotElement | DomModule | HTMLStyleElement | PaperRippleElement | ... 74 more ... | HTMLUListElement' is not assignable to type 'Element'.
    Type 'ReadingListAppElement' is missing the following properties from type 'Element': attributes, classList, className, clientHeight, and 160 more.

4530     getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~

../../third_party/node/node_modules/typescript/lib/lib.dom.d.ts:4818:101 - error TS2344: Type 'HTMLElementTagNameMap[K]' does not satisfy the constraint 'Element'.
  Type 'HTMLTemplateElement | HTMLElement | HTMLSlotElement | DomModule | HTMLStyleElement | PaperRippleElement | ... 74 more ... | HTMLUListElement' is not assignable to type 'Element'.

4818     getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~

../../third_party/node/node_modules/typescript/lib/lib.dom.d.ts:10170:87 - error TS2344: Type 'HTMLElementTagNameMap[K]' does not satisfy the constraint 'Node'.
  Type 'HTMLTemplateElement | HTMLElement | HTMLSlotElement | DomModule | HTMLStyleElement | PaperRippleElement | ... 74 more ... | HTMLUListElement' is not assignable to type 'Node'.
    Type 'ReadingListAppElement' is missing the following properties from type 'Node': baseURI, childNodes, firstChild, isConnected, and 46 more.

10170     querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~

Found 15 errors in 2 files.

Errors  Files
    12  gen/chrome/browser/resources/side_panel/reading_list/preprocessed/app.ts:16
     3  ../../third_party/node/node_modules/typescript/lib/lib.dom.d.ts:4530

I checked the dependency package installation, and checked the gclient sink again.


问:
BLE Peripheral created by CoreBluetooth running on my Mac cannot be discovered by iPhone. But it can be discovered by Android Phone
Here's the process of creating the Peripheral:

    // Create a CBPeripheralManager object
    let peripheralManager = CBPeripheralManager()

    // Create a CBMutableService object to represent the service
    let service = CBMutableService(type: CBUUID(string: "0003ABCD-0000-1000-8000-00805F9B0131"), primary: true)

    // Create a CBMutableCharacteristic object to represent the read characteristic
    let readCharacteristic = CBMutableCharacteristic(
        type: CBUUID(string: "00031201-0000-1000-8000-00805F9B0130"),
        properties: .read,
        value: nil,
        permissions: .readable
    )

    // Create a CBMutableCharacteristic object to represent the write characteristic
    let writeCharacteristic = CBMutableCharacteristic(
        type: CBUUID(string: "00031202-0000-1000-8000-00805F9B0130"),
        properties: .write,
        value: nil,
        permissions: .writeable
    )

    // Set the peripheral manager's delegate
    peripheralManager.delegate = self

    let advertisementData = [CBAdvertisementDataLocalNameKey: "BLE Serial", CBAdvertisementDataServiceUUIDsKey: [service.uuid]] as [String : Any]

    peripheralManager.startAdvertising(advertisementData)

    // ...

    // MARK: - CBPeripheralManagerDelegate
    func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
        if peripheral.state == .poweredOn {
            // Add the characteristics to the service
            service.characteristics = [readCharacteristic, writeCharacteristic]

            // Add the service to the peripheral manager
            peripheralManager.add(service)
        }
    }
```

I tried run this program on mac and iPhone.

On my Android phone, the peripheral can be discovered, connected and do read/write jobs. However it can't be discovered by iPhone (while running on mac) or by mac (while running on iPhone).

Body:
Here's the process of creating the Peripheral:

    // Create a CBPeripheralManager object
    let peripheralManager = CBPeripheralManager()

    // Create a CBMutableService object to represent the service
    let service = CBMutableService(type: CBUUID(string: "0003ABCD-0000-1000-8000-00805F9B0131"), primary: true)

    // Create a CBMutableCharacteristic object to represent the read characteristic
    let readCharacteristic = CBMutableCharacteristic(
        type: CBUUID(string: "00031201-0000-1000-8000-00805F9B0130"),
        properties: .read,
        value: nil,
        permissions: .readable
    )

    // Create a CBMutableCharacteristic object to represent the write characteristic
    let writeCharacteristic = CBMutableCharacteristic(
        type: CBUUID(string: "00031202-0000-1000-8000-00805F9B0130"),
        properties: .write,
        value: nil,
        permissions: .writeable
    )

    // Set the peripheral manager's delegate
    peripheralManager.delegate = self

    let advertisementData = [CBAdvertisementDataLocalNameKey: "BLE Serial", CBAdvertisementDataServiceUUIDsKey: [service.uuid]] as [String : Any]

    peripheralManager.startAdvertising(advertisementData)

    // ...

    // MARK: - CBPeripheralManagerDelegate
    func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
        if peripheral.state == .poweredOn {
            // Add the characteristics to the service
            service.characteristics = [readCharacteristic, writeCharacteristic]

            // Add the service to the peripheral manager
            peripheralManager.add(service)
        }
    }

I tried run this program on mac and iPhone.

On my Android phone, the peripheral can be discovered, connected and do read/write jobs. However it can't be discovered by iPhone (while running on mac) or by mac (while running on iPhone).


问:
Can't pass a list of integers into object for Seeding purposes
After updating the database these objects do appear, but the functions don't get added.

Here is the code to Seed some data (Tea's):

```<code>if (!context.Tea.Any())
                {
                    context.Tea.AddRange(
                        new Tea
                        {
                            Name = "Green Tea",
                            Price = 3.99,
                            FunctionIds = new List<int> { 1, 2 }
                        },
                        new Tea
                        {
                            Name = "Yellow Tea",
                            Price = 2.99,
                            FunctionIds = new List<int> { 1, 3 }
                        }
                        );
                        context.SaveChanges();
                }
</code>```

Here is the model for the Tea:

```<code>namespace Teatastic.Models
{
    public class Tea
    {
        [Key]
        public int Id { get; set; }

        public string Name { get; set; }

        public double Price { get; set; }

        //Relationships
        public List<Function>? Functions { get; set; }

        [NotMapped]
        public List<int> FunctionIds { get; set; }

    }
}
</code>```

And here is the model for the Functions:

```<code>namespace Teatastic.Models
{
    public class Function
    {
        public int Id { get; set; }

        public string Name { get; set; }

        public List<Tea>? Teas { get; set; }
    }
}
</code>```

Why does this part not work?

```<code>FunctionIds = new List<int> { 1, 2 }
</code>```

ps: When I create a new Tea while the app is running, I am able to add functions to my tea through my controller TeasController (HTTP create-POST method).

Body:
After updating the database these objects do appear, but the functions don't get added.

Here is the code to Seed some data (Tea's):

if (!context.Tea.Any())
                {
                    context.Tea.AddRange(
                        new Tea
                        {
                            Name = "Green Tea",
                            Price = 3.99,
                            FunctionIds = new List<int> { 1, 2 }
                        },
                        new Tea
                        {
                            Name = "Yellow Tea",
                            Price = 2.99,
                            FunctionIds = new List<int> { 1, 3 }
                        }
                        );
                        context.SaveChanges();
                }

Here is the model for the Tea:

namespace Teatastic.Models
{
    public class Tea
    {
        [Key]
        public int Id { get; set; }

        public string Name { get; set; }

        public double Price { get; set; }

        //Relationships
        public List<Function>? Functions { get; set; }

        [NotMapped]
        public List<int> FunctionIds { get; set; }

    }
}

And here is the model for the Functions:

namespace Teatastic.Models
{
    public class Function
    {
        public int Id { get; set; }

        public string Name { get; set; }

        public List<Tea>? Teas { get; set; }
    }
}

Why does this part not work?

FunctionIds = new List<int> { 1, 2 }

ps: When I create a new Tea while the app is running, I am able to add functions to my tea through my controller TeasController (HTTP create-POST method).


问:
Webgl doesnt run in background
Im currently developing webgl for PC browser using unity3d. My unity version is 2020.3.30

This webgl project that I made doesnt run when browser is minimized or if i click other tab in same window of this webgl. But at the same time, when i click other window and still window of webgl is in screen so I can see in my monitor, it runs!

and I already setted run in background option to true in player setting, Made it vSyncCount to 0 and targetFrameRate to 0 in Awake in one of the scripts that i run always in game.
I also tried to set targetFrameRate to -1 but i didnt work too...

I know I did something wrong but most of things about this issue that i found just are telling I need to make 'run in background' option to true, which I already set.... And Im using Chrome...

Title: Webgl doesnt run in background


问:
Java Nety tcp server
I've been using the Java framework io.netty for a simple tcp server to accept connections and send messages; so my question is.
Given a TCP server with the Classes ChannelInboundHandler, how can i do for store different remote connections.

public class SimpleTCPChannelHandler extends ChannelInboundHandlerAdapter {

    private final ArrayList<SocketAddress> addresses = new ArrayList<>();

    @Override
    public void channelActive(ChannelHandlerContext ctx) {
        addresses.add(ctx.channel().remoteAddress());
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
        String s = (String) msg;
        System.out.println();
        try {

            ctx.channel().writeAndFlush("welcome\n");
            group.writeAndFlush("hello");
        }catch (Exception e ){
            e.printStackTrace();
        }

    }

}
```

And when a channel is active, store into the array and when the connections receive a message, can see all the different remote addresses connected to my tcp server to send a message to a different remote address

The way to handle multiple connections to my tcp server and can send a message to a specific client and can see the total of addresses connected.

Title: Java Nety tcp server

Body:
I've been using the Java framework io.netty for a simple tcp server to accept connections and send messages; so my question is.
Given a TCP server with the Classes ChannelInboundHandler, how can i do for store different remote connections.

public class SimpleTCPChannelHandler extends ChannelInboundHandlerAdapter {

    private final ArrayList<SocketAddress> addresses = new ArrayList<>();

    @Override
    public void channelActive(ChannelHandlerContext ctx) {
        addresses.add(ctx.channel().remoteAddress());
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
        String s = (String) msg;
        System.out.println();
        try {

            ctx.channel().writeAndFlush("welcome\n");
            group.writeAndFlush("hello");
        }catch (Exception e ){
            e.printStackTrace();
        }

    }

}

And when a channel is active, store into the array and when the connections receive a message, can see all the different remote addresses connected to my tcp server to send a message to a different remote address

The way to handle multiple connections to my tcp server and can send a message to a specific client and can see the total of addresses connected.


问:
Unable to install java in ubuntu 20.10 with the error of Unable to fetch some archives
I am using ubuntu 20.10 and I am trying to install java by the terminal of course. I get the error message E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? I tried both of the commands but they don't help in a thing. The full error message:

```<code>E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-lts/openjdk-11-jdk_11.0.11+9-0ubuntu2~20.10_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]

E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/j/java-atk-wrapper/libatk-wrapper-java_0.38.0-1_all.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/j/java-atk-wrapper/libatk-wrapper-java-jni_0.38.0-1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/x/xorgproto/x11proto-dev_2020.1-1_all.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/libi/libice/libice-dev_1.0.10-1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/x/xorgproto/x11proto-core-dev_2020.1-1_all.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libx11/libx11-dev_1.6.12-1ubuntu0.1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/libx/libxt/libxt-dev_1.2.0-1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
</code>```

I found this post that I think everyone who had the same issue came to this post, but nothing helped me to get out of the problem, in this another post (in Spanish) tells many ways to download, but nothing helps. Any help would be very appreciated.

Body:
I am using ubuntu 20.10 and I am trying to install java by the terminal of course. I get the error message E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? I tried both of the commands but they don't help in a thing. The full error message:

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-lts/openjdk-11-jdk_11.0.11+9-0ubuntu2~20.10_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]

E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/j/java-atk-wrapper/libatk-wrapper-java_0.38.0-1_all.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/j/java-atk-wrapper/libatk-wrapper-java-jni_0.38.0-1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/x/xorgproto/x11proto-dev_2020.1-1_all.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/libi/libice/libice-dev_1.0.10-1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/x/xorgproto/x11proto-core-dev_2020.1-1_all.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libx11/libx11-dev_1.6.12-1ubuntu0.1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://co.archive.ubuntu.com/ubuntu/pool/main/libx/libxt/libxt-dev_1.2.0-1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]

I found this post that I think everyone who had the same issue came to this post, but nothing helped me to get out of the problem, in this another post (in Spanish) tells many ways to download, but nothing helps. Any help would be very appreciated.


问:
How to submit a solved captcha without submit button?
I've already solved the captcha using 2captcha automated resolver, but I can not find any submit button to click. I mean you need to solve the captcha manually to make the "verify" button visible.

By the way, I try doing this on python selenium. Have read almost everything on the internet, and still have not found any relevant answer.

```<code>def solveHcaptcha():
    sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
    api_key = os.getenv('APIKEY_2CAPTCHA', 'MY_API_KEY')

    solver = TwoCaptcha(api_key)

    try:
        result = solver.hcaptcha(
        sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
        url='https://discord.com/register',
        invisible=1,
        )

    except Exception as e:
        print(e)
        return False

    else:
        return result

driver = webdriver.Chrome()
driver.get('https://discord.com/register')

result = solveHcaptcha()
print(result)
if result:
    code = result['code']

    driver.execute_script(
        "document.querySelector(" + "'" + '[name="h-captcha-response"]' + "'" + ").innerHTML = " + "'" + code + "'")

    driver.find_element(
        By.XPATH, "/html/body/div[2]/div[8]").click()
</code>```

Body:
I've already solved the captcha using 2captcha automated resolver, but I can not find any submit button to click. I mean you need to solve the captcha manually to make the "verify" button visible.

By the way, I try doing this on python selenium. Have read almost everything on the internet, and still have not found any relevant answer.

def solveHcaptcha():
    sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
    api_key = os.getenv('APIKEY_2CAPTCHA', 'MY_API_KEY')

    solver = TwoCaptcha(api_key)

    try:
        result = solver.hcaptcha(
        sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
        url='https://discord.com/register',
        invisible=1,
        )

    except Exception as e:
        print(e)
        return False

    else:
        return result

driver = webdriver.Chrome()
driver.get('https://discord.com/register')

result = solveHcaptcha()
print(result)
if result:
    code = result['code']

    driver.execute_script(
        "document.querySelector(" + "'" + '[name="h-captcha-response"]' + "'" + ").innerHTML = " + "'" + code + "'")

    driver.find_element(
        By.XPATH, "/html/body/div[2]/div[8]").click()


问:
I am not understand the behaviour of re-rendering of my functions when clicking back navigation
I am building a small inventory system for a choose your adventure system (I am quite new on react and this project it is for me for learning some basics).

I developed a way that it read from a JSON when to add or remove items in this inventory.
It works nice, until for whatever reason I want to go back to a page with the back button of the navigator and choose another option.

The moment I have an event that change the useState on page load of the inventory, it get triggered, but I thought that with "checkDuplicate" I am able to control to avoid duplication of items, but somehow my function checkEquipment prints twice the same item, even if in the equipmentState it result only 1 item.

I am sure that there is something wrong with the way that I am using the equipmentState.map or on re-rendering of the page.

I am unable to insert checkEquipment inside the useEffect, because I am rendering that value directly in the HTML part of the code.

What am I doing wrong?

```<code>const initialArray = [1];
const [equipmentState, setEquipmentState] = useState(initialArray);

const checkEquipment = () => {
    let myEquip = "The backpack is empty from the start";

    if (equipmentState.length === 0) {
        myEquip = "An empty backpack";
    } else {
        myEquip = equipmentState.map((value) => myItem[value - 1].name).join(", ");
    }

    return myEquip;
};

const checkDuplicate = equipmentState.some((val, i) => equipmentState.indexOf(val) !== i);

useEffect(() => {
    const addOrRemoveEquipment = (itemID, action) => {
        if (itemID && action) {
            if (action === "add") {
                setEquipmentState((equipmentState) => {
                    return [...equipmentState, itemID];
                });
            } else if (action === "remove") {
                setEquipmentState((current) =>
                    current.filter((item) => {
                        return item !== itemID[0];
                    })
                );
            }
        }
    };

    const addOrRemoveItem = (val) => {
        if (val instanceof Array) {
            if (val[0]) {
                addOrRemoveEquipment(val[0], "remove");
            }
            if (val[1]) {
                if (!checkDuplicate) {
                    addOrRemoveEquipment(val[1], "add");
                }
            }
        }
    };

    addOrRemoveItem([myPlace.remove, myPlace.add]);
}, [myPlace.remove, myPlace.add, setEquipmentState, checkDuplicate]);
</code>```

In my html

```<code>    <li>{checkEquipment()}</li>
</code>```

Body:
I am building a small inventory system for a choose your adventure system (I am quite new on react and this project it is for me for learning some basics).

I developed a way that it read from a JSON when to add or remove items in this inventory.
It works nice, until for whatever reason I want to go back to a page with the back button of the navigator and choose another option.

The moment I have an event that change the useState on page load of the inventory, it get triggered, but I thought that with "checkDuplicate" I am able to control to avoid duplication of items, but somehow my function checkEquipment prints twice the same item, even if in the equipmentState it result only 1 item.

I am sure that there is something wrong with the way that I am using the equipmentState.map or on re-rendering of the page.

I am unable to insert checkEquipment inside the useEffect, because I am rendering that value directly in the HTML part of the code.

What am I doing wrong?

const initialArray = [1];
const [equipmentState, setEquipmentState] = useState(initialArray);

const checkEquipment = () => {
    let myEquip = "The backpack is empty from the start";

    if (equipmentState.length === 0) {
        myEquip = "An empty backpack";
    } else {
        myEquip = equipmentState.map((value) => myItem[value - 1].name).join(", ");
    }

    return myEquip;
};

const checkDuplicate = equipmentState.some((val, i) => equipmentState.indexOf(val) !== i);

useEffect(() => {
    const addOrRemoveEquipment = (itemID, action) => {
        if (itemID && action) {
            if (action === "add") {
                setEquipmentState((equipmentState) => {
                    return [...equipmentState, itemID];
                });
            } else if (action === "remove") {
                setEquipmentState((current) =>
                    current.filter((item) => {
                        return item !== itemID[0];
                    })
                );
            }
        }
    };

    const addOrRemoveItem = (val) => {
        if (val instanceof Array) {
            if (val[0]) {
                addOrRemoveEquipment(val[0], "remove");
            }
            if (val[1]) {
                if (!checkDuplicate) {
                    addOrRemoveEquipment(val[1], "add");
                }
            }
        }
    };

    addOrRemoveItem([myPlace.remove, myPlace.add]);
}, [myPlace.remove, myPlace.add, setEquipmentState, checkDuplicate]);

In my html

{checkEquipment()}


问:
Not able to convert python variable in .sql file in aws repo
there is a variable which reads the file from s3 and this s3 file has sql select statement.

select * from {schema_name}.{table_name};

now schema_name and table_name is defined in variable.yml file. but these varaibles are only accessible if i store this sql statement in sql folder of my project.
and call that sql file in glue.yml file which creates glue job.

is there a way to store this sql statement in in sql file at runtime ?

i tried to create a file at runtime in sql folder. but it is not creating.
because i am not sure how i open that file.


问:
Problems with authentication system: I'm not able to retrieve authenticated user's data in controllers - -laravel
I made an auth system using jwt and works correctly, but in others controllers (not about authentication) I'm trying to retrieve user's data (as id, mail etc) using Auth::user() helper
but don't take the interested data...
this is an example of controller:

```<code>class UpdateController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }

    public function updateToProfessional(Request $request)
    {
        $request->validate([
            'services' => ['required', 'string', 'max:255','exists:services'],
        ]);

        $user = User::find(Auth::user()->id);
        $user->removeRole('Regular User');
        $user->assignRole('Professional');

        return $user;
    }
</code>```

Testing the api on postman it suggested me to install laravl/ui package and add auth::routes in my api.php file I know that this create the route for the auth controller but I've already made them using jwt, how can I solve this?
I'll show my routes

```<code>Route::post('auth/register', 'App\Http\Controllers\Api\Auth\RegisterController@action');
Route::post('auth/login', 'App\Http\Controllers\api\auth\LoginController');
Route::POST('auth/login/google', 'App\Http\Controllers\api\auth\LoginController@loginByGoogle');
route::post('auth/logout', 'App\Http\Controllers\api\auth\LogoutController');

Route::group(['middleware' => 'auth'], function () {
    Route::post('auth/update/professional', 'App\Http\Controllers\Api\UpdateController@updateToProfessional');
    Route::post('auth/update/user', 'App\Http\Controllers\Api\UpdateController@updateToUser');
    Route::post('auth/edit/data', 'App\Http\Controllers\Api\Auth\EditDataController@updateName');
    Route::post('auth/edit/phone/number', 'App\Http\Controllers\Api\Auth\EditDataController@updatePhoneNumber');
    Route::post('auth/edit/password', 'App\Http\Controllers\Api\Auth\EditDataController@updatePassword');
    Route::post('auth/forget/password', 'App\Http\Controllers\Api\Auth\ForgotPasswordController@submitForgetPasswordForm');
    Route::post('auth/reset/password', 'App\Http\Controllers\Api\Auth\ForgotPasswordController@submitResetPasswordForm');
    Route::post('create/order', 'App\Http\Controllers\Api\CustomerOrderController@create');
    Route::post('update/order', 'App\Http\Controllers\Api\CustomerOrderController@update');
    Route::post('delete/order', 'App\Http\Controllers\Api\CustomerOrderController@delete');
});
</code>```

Body:
I made an auth system using jwt and works correctly, but in others controllers (not about authentication) I'm trying to retrieve user's data (as id, mail etc) using Auth::user() helper
but don't take the interested data...
this is an example of controller:

class UpdateController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }

    public function updateToProfessional(Request $request)
    {
        $request->validate([
            'services' => ['required', 'string', 'max:255','exists:services'],
        ]);

        $user = User::find(Auth::user()->id);
        $user->removeRole('Regular User');
        $user->assignRole('Professional');

        return $user;
    }

Testing the api on postman it suggested me to install laravl/ui package and add auth::routes in my api.php file I know that this create the route for the auth controller but I've already made them using jwt, how can I solve this?
I'll show my routes

Route::post('auth/register', 'App\Http\Controllers\Api\Auth\RegisterController@action');
Route::post('auth/login', 'App\Http\Controllers\api\auth\LoginController');
Route::POST('auth/login/google', 'App\Http\Controllers\api\auth\LoginController@loginByGoogle');
route::post('auth/logout', 'App\Http\Controllers\api\auth\LogoutController');

Route::group(['middleware' => 'auth'], function () {
    Route::post('auth/update/professional', 'App\Http\Controllers\Api\UpdateController@updateToProfessional');
    Route::post('auth/update/user', 'App\Http\Controllers\Api\UpdateController@updateToUser');
    Route::post('auth/edit/data', 'App\Http\Controllers\Api\Auth\EditDataController@updateName');
    Route::post('auth/edit/phone/number', 'App\Http\Controllers\Api\Auth\EditDataController@updatePhoneNumber');
    Route::post('auth/edit/password', 'App\Http\Controllers\Api\Auth\EditDataController@updatePassword');
    Route::post('auth/forget/password', 'App\Http\Controllers\Api\Auth\ForgotPasswordController@submitForgetPasswordForm');
    Route::post('auth/reset/password', 'App\Http\Controllers\Api\Auth\ForgotPasswordController@submitResetPasswordForm');
    Route::post('create/order', 'App\Http\Controllers\Api\CustomerOrderController@create');
    Route::post('update/order', 'App\Http\Controllers\Api\CustomerOrderController@update');
    Route::post('delete/order', 'App\Http\Controllers\Api\CustomerOrderController@delete');
});


问:
Tkinter Programmatically hide and Show widget behaviour
I'm just starting out and this is a bit newbie:
So I have a Sorting Visualizer app with Tkinter.

I want to pack and unpack(Hide) a widget programmatically After a certain function finishes.

here is the code for one of the sections that I want to have this functionality:

```<code>def pick_algo(curr_algo,lines,canv,root,ind):

    #appear
    ind.pack(side = RIGHT)

    #some function
    val = curr_algo['text']
    algos[val](lines,canv,root,0,len(lines) if val != 'Quick Sort' else len(lines)-1)

    #hide
    ind.pack_forget()
</code>```

what can be the issue?

for some reason it works for the first time where ind(indicator) apears then hides after function but after subsequent calls the label doesnt apear any more.

I tried using using root.update and update_idletasks  everywhere inside but I couldnt make it work.

Body:
I'm just starting out and this is a bit newbie:
So I have a Sorting Visualizer app with Tkinter.

I want to pack and unpack(Hide) a widget programmatically After a certain function finishes.

here is the code for one of the sections that I want to have this functionality:

def pick_algo(curr_algo,lines,canv,root,ind):

    #appear
    ind.pack(side = RIGHT)

    #some function
    val = curr_algo['text']
    algos[val](lines,canv,root,0,len(lines) if val != 'Quick Sort' else len(lines)-1)

    #hide
    ind.pack_forget()

what can be the issue?

for some reason it works for the first time where ind(indicator) apears then hides after function but after subsequent calls the label doesnt apear any more.

I tried using using root.update and update_idletasks  everywhere inside but I couldnt make it work.


问:
How do I fix this while loop?
Look, I'm a newbie here, and I have no idea what I'm doing. I'm trying to write a program that finds where the line of a graph hits a certain point on the Y-axis, and it's just not working. I have no idea why. I've troubleshooted for a while but I am having a hard time fixing this bug. I plan on elaborating on this and making it better once I have the basics down, but well, I don't. so...

```<code>numfind = int(input("Where do you want to find where the graph hits?"))
go = True
start = int(input("Where do you want to start analyzing?"))
x = start
end = int(input("Where do you want to end analyzing?"))
y1 = " "
y2 = " "
num = " "
equation = x - 10
equation2 = (x + 1) - 10

while go and x < end:
    y1 = equation
    y2 = equation2
    if y1 < numfind and y2 > numfind:
        print("The point where f(x) = " + numfind + " is between " + y1 + " and " + y2)
        go = False
    elif y1 > numfind and y2 < numfind:
        print("The point where f(x) = " + numfind + " is between " + y2 + " and " + y1)
        go = False
    elif y2 == 0:
        print("The point where f(x) = " + numfind + " is " + y1)
    else:
        x += 1

</code>```

I wanted to use two variables (y1 and y2) that would ladder through a certain range, checking to see if a y-value is between them. However, for some reason, it never finds the point. this confuses me.

Title: How do I fix this while loop?

Body:
Look, I'm a newbie here, and I have no idea what I'm doing. I'm trying to write a program that finds where the line of a graph hits a certain point on the Y-axis, and it's just not working. I have no idea why. I've troubleshooted for a while but I am having a hard time fixing this bug. I plan on elaborating on this and making it better once I have the basics down, but well, I don't. so...

numfind = int(input("Where do you want to find where the graph hits?"))
go = True
start = int(input("Where do you want to start analyzing?"))
x = start
end = int(input("Where do you want to end analyzing?"))
y1 = " "
y2 = " "
num = " "
equation = x - 10
equation2 = (x + 1) - 10

while go and x < end:
    y1 = equation
    y2 = equation2
    if y1 < numfind and y2 > numfind:
        print("The point where f(x) = " + numfind + " is between " + y1 + " and " + y2)
        go = False
    elif y1 > numfind and y2 < numfind:
        print("The point where f(x) = " + numfind + " is between " + y2 + " and " + y1)
        go = False
    elif y2 == 0:
        print("The point where f(x) = " + numfind + " is " + y1)
    else:
        x += 1

I wanted to use two variables (y1 and y2) that would ladder through a certain range, checking to see if a y-value is between them. However, for some reason, it never finds the point. this confuses me.


问:
Android - wrap text view's width does not change when the holder is updated using the payload of the RecycleVview
First, please understand that my English is not good. sry...

I have RecyclerView that use ListAdapter, DiffUtil with Payload (use payload to not trigger the change animation)
and holder has ViewGroup and TextView

Item Holder xml

```<code><layout>
    <data>
        <import type="android.view.View" />
        <variable
            name="model"
            type="com.pine_template.TextGoneData" />
    </data>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/dp_10"
            android:background="@color/gray_2">

            <LinearLayout
                android:id="@+id/llTest"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#ff0000"
                android:visibility="@{model.visible ? View.VISIBLE : View.GONE}">

                <TextView
                    android:id="@+id/tvText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="#87ceeb"
                    android:text="@{model.text}" />

            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</layout>
</code>```

The problem is that if the visibility of the ViewGroup(id.llTest) is changed to View.VISIBLE after View.GONE, the text of the newly set TextView(id.tvText) is entered, but the width does not change.

[before gone text]
(https://i.stack.imgur.com/xtE9i.png)

[after gone text with new text]
(https://i.stack.imgur.com/r9NYO.png)

Is there any way to make the TextView have the correct width?

Instead of using a payload, I set the change animation duration to '0'.
it's do not trigger change animation and apply correct text view's width. (to be precise, can't feel the animation.)
I think this is incorrect.

UPDATE

I found a detailed path to reproduce.

input string to TextView [12345]

set visibilty to gone TextView's parent

input less than leghth string like [123]

change visibility to visible

execute 1~5 by ListAdapter.submitList

Body:
First, please understand that my English is not good. sry...

I have RecyclerView that use ListAdapter, DiffUtil with Payload (use payload to not trigger the change animation)
and holder has ViewGroup and TextView

Item Holder xml

<layout>
    <data>
        <import type="android.view.View" />
        <variable
            name="model"
            type="com.pine_template.TextGoneData" />
    </data>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/dp_10"
            android:background="@color/gray_2">

            <LinearLayout
                android:id="@+id/llTest"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#ff0000"
                android:visibility="@{model.visible ? View.VISIBLE : View.GONE}">

                <TextView
                    android:id="@+id/tvText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="#87ceeb"
                    android:text="@{model.text}" />

            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</layout>

The problem is that if the visibility of the ViewGroup(id.llTest) is changed to View.VISIBLE after View.GONE, the text of the newly set TextView(id.tvText) is entered, but the width does not change.

[before gone text]
(https://i.stack.imgur.com/xtE9i.png)

[after gone text with new text]
(https://i.stack.imgur.com/r9NYO.png)

Is there any way to make the TextView have the correct width?

Instead of using a payload, I set the change animation duration to '0'.
it's do not trigger change animation and apply correct text view's width. (to be precise, can't feel the animation.)
I think this is incorrect.

UPDATE

I found a detailed path to reproduce.

input string to TextView [12345]

set visibilty to gone TextView's parent

input less than leghth string like [123]

change visibility to visible

execute 1~5 by ListAdapter.submitList


问:
Customizing Button Commands in Python Tkinter
I've recently started learning how to use Tkinter. I'm working on the front-end for a small project to design an Enigma Machine, and a part of it involves creating a keyboard-like layout of buttons to simulate the plugboard. When clicking one button, I want it to go to a method I've created to handle all button presses and tell the method which letter the button corresponds to, and act accordingly. The main task right now is to make it so that pressing one button and then pressing another button after that draws a line between both buttons.

What I've added below is a scuffed version of the actual program to cut out repeated code like the button declarations.

```<code>from tkinter import *
from tkinter import ttk
from PIL import ImageTk, Image

class Steckerbrett:
    root = Tk()

    frm = ttk.Frame(root, padding=10)
    frm.grid(row=0, column=0)
    ttk.Label(frm, text="Enigma Machine").grid(column=0, row=0)
    ttk.Label(frm, text="Steckerbrett").grid(column=0, row=1)
    ttk.Label(frm, text="").grid(column=0, row=2)

    # plugboard keys row 1
    frm1 = ttk.Frame(root, padding=10)
    frm1.grid(row=1, column=0)
    ttk.Button(frm1, text="Q", command=connection).grid(column=0, row=0)
    ttk.Button(frm1, text="W", command=connection).grid(column=1, row=0)
    # i have declarations like this for all 26 letters

    root.mainloop()

    def connection(self, letter):
        ttk.Label(self.frm, text=letter).grid(column=0, row=2)

sb = Steckerbrett()
</code>```

The issue here is that since 'command' doesn't allow entering a function with arguments, I can't pass the letter to the function, and I can not make a custom method for every single button, because I would need to process first button presses and second button presses differently to make the connections. Is there a way to use a single function in the command but customize it to each button? Alternatively, if there isn't, are there any other solutions I can try? I am willing to try using other graphics packages as well.

Body:
I've recently started learning how to use Tkinter. I'm working on the front-end for a small project to design an Enigma Machine, and a part of it involves creating a keyboard-like layout of buttons to simulate the plugboard. When clicking one button, I want it to go to a method I've created to handle all button presses and tell the method which letter the button corresponds to, and act accordingly. The main task right now is to make it so that pressing one button and then pressing another button after that draws a line between both buttons.

What I've added below is a scuffed version of the actual program to cut out repeated code like the button declarations.

from tkinter import *
from tkinter import ttk
from PIL import ImageTk, Image

class Steckerbrett:
    root = Tk()

    frm = ttk.Frame(root, padding=10)
    frm.grid(row=0, column=0)
    ttk.Label(frm, text="Enigma Machine").grid(column=0, row=0)
    ttk.Label(frm, text="Steckerbrett").grid(column=0, row=1)
    ttk.Label(frm, text="").grid(column=0, row=2)

    # plugboard keys row 1
    frm1 = ttk.Frame(root, padding=10)
    frm1.grid(row=1, column=0)
    ttk.Button(frm1, text="Q", command=connection).grid(column=0, row=0)
    ttk.Button(frm1, text="W", command=connection).grid(column=1, row=0)
    # i have declarations like this for all 26 letters

    root.mainloop()

    def connection(self, letter):
        ttk.Label(self.frm, text=letter).grid(column=0, row=2)

sb = Steckerbrett()

The issue here is that since 'command' doesn't allow entering a function with arguments, I can't pass the letter to the function, and I can not make a custom method for every single button, because I would need to process first button presses and second button presses differently to make the connections. Is there a way to use a single function in the command but customize it to each button? Alternatively, if there isn't, are there any other solutions I can try? I am willing to try using other graphics packages as well.


问:
unable to find index for $geoNear query using nestjs and mongoose
I keep getting the "unable to find index for $geoNear query" error.  I'm using nestjs and mongoose. Below is the original code when I first got the error.  I then tried adding "this.locationModel.createIndexes({ location: "2dsphere" });"  (mongoose version of createIndex)  That didn't work either. Same error.

```<code>import { Injectable } from "@nestjs/common";
import { InjectModel } from "@nestjs/mongoose";
import { Model } from "mongoose";
import { Location } from "src/types/location";

@Injectable()
export class LocationService {
  constructor(
    @InjectModel("Location") private locationModel: Model<Location>
  ) {}

  async getNearbyLocations(lon, lat, pageSize, pageNum) {
    const locations = await this.locationModel
      .find({
        location: {
          $near: {
            $geometry: { type: "Point", coordinates: [lon, lat] },
            $minDistance: 0,
            $maxDistance: 20000,
          },
        },
      })
    return locations;
  }
</code>```

Here is the location Document file

```<code>import { Document } from "mongoose";

export interface Location extends Document {
  description: String;
  city: String;
  state: String;
  location: {
    type: String;
    coordinates: Array<Number>;
  };
}
</code>```

Body:
I keep getting the "unable to find index for $geoNear query" error.  I'm using nestjs and mongoose. Below is the original code when I first got the error.  I then tried adding "this.locationModel.createIndexes({ location: "2dsphere" });"  (mongoose version of createIndex)  That didn't work either. Same error.

import { Injectable } from "@nestjs/common";
import { InjectModel } from "@nestjs/mongoose";
import { Model } from "mongoose";
import { Location } from "src/types/location";

@Injectable()
export class LocationService {
  constructor(
    @InjectModel("Location") private locationModel: Model<Location>
  ) {}

  async getNearbyLocations(lon, lat, pageSize, pageNum) {
    const locations = await this.locationModel
      .find({
        location: {
          $near: {
            $geometry: { type: "Point", coordinates: [lon, lat] },
            $minDistance: 0,
            $maxDistance: 20000,
          },
        },
      })
    return locations;
  }

Here is the location Document file

import { Document } from "mongoose";

export interface Location extends Document {
  description: String;
  city: String;
  state: String;
  location: {
    type: String;
    coordinates: Array<Number>;
  };
}


问:
MediaStore query for non-MIME type files by file type(ex: m4b)
I want to query for non-MIME type by file type, in particular audible and apple audiobooks with file types like aa, aax and m4b.

Tried querying by audiobook genre but MediaStore does not classify this file-types as audiobooks.

I found this previous post about querying non media types but the selectionArgs used pull from MimeTypeMap that doesn't include any of the above mentioned types.


问:
Thread execution time seems incorrect
I trying to poll an API and then time how long it takes to make a file available

def main():
    pool = ThreadPoolExecutor(max_workers=8)
    for filename in os.listdir(data_dir):
      pool.submit(poll_status, filename)

def poll_status(filename: str):
    start_time = perf_counter()
    for i in range(30):
        logging.info(f"Attempt {i}")
        resp = requests.get(f"https://api/{filename}/statuses")
        if resp.status_code == 404:
            # Wait 3 seconds and try again on next attempt
            time.sleep(3)
        elif resp.status_code == 200:
            end_time = perf_counter()
            logging.info(
                f'{filename} took {end_time - start_time: 0.2f} seconds to complete. (Attempt {i})')
```
<p>Printing times taken for each file to become available seem to be increasing while the attempts are not.</p>
```INFO:root:f1 took  0.19 seconds to complete. (Attempt 0)
INFO:root:f2 took  4.79 seconds to complete. (Attempt 0)
INFO:root:f3 took  7.43 seconds to complete. (Attempt 0)
INFO:root:f4 took  7.99 seconds to complete. (Attempt 0)
INFO:root:f5 took  12.11 seconds to complete. (Attempt 0)
INFO:root:f6 took  15.84 seconds to complete. (Attempt 0)
INFO:root:f7 took 16.54 seconds to complete. (Attempt 0)
INFO:root:f8 took  16.35 seconds to complete. (Attempt 0)
```

If an attempt took 16 seconds I would expect it to be Attempt 5? (as there should be a 3 second wait after each attempt)

Am I using Thread Pool incorrectly or is there a problem with how I am timing each attempt?

Title: Thread execution time seems incorrect

Body:
I trying to poll an API and then time how long it takes to make a file available

def main():
    pool = ThreadPoolExecutor(max_workers=8)
    for filename in os.listdir(data_dir):
      pool.submit(poll_status, filename)

def poll_status(filename: str):
    start_time = perf_counter()
    for i in range(30):
        logging.info(f"Attempt {i}")
        resp = requests.get(f"https://api/{filename}/statuses")
        if resp.status_code == 404:
            # Wait 3 seconds and try again on next attempt
            time.sleep(3)
        elif resp.status_code == 200:
            end_time = perf_counter()
            logging.info(
                f'{filename} took {end_time - start_time: 0.2f} seconds to complete. (Attempt {i})')

Printing times taken for each file to become available seem to be increasing while the attempts are not.

INFO:root:f1 took  0.19 seconds to complete. (Attempt 0)
INFO:root:f2 took  4.79 seconds to complete. (Attempt 0)
INFO:root:f3 took  7.43 seconds to complete. (Attempt 0)
INFO:root:f4 took  7.99 seconds to complete. (Attempt 0)
INFO:root:f5 took  12.11 seconds to complete. (Attempt 0)
INFO:root:f6 took  15.84 seconds to complete. (Attempt 0)
INFO:root:f7 took 16.54 seconds to complete. (Attempt 0)
INFO:root:f8 took  16.35 seconds to complete. (Attempt 0)

If an attempt took 16 seconds I would expect it to be Attempt 5? (as there should be a 3 second wait after each attempt)

Am I using Thread Pool incorrectly or is there a problem with how I am timing each attempt?


问:
Problem after Google Services Version Change
Problem after change from google-services version 4.3.10 to 4.3.14

classpath 'com.google.gms:google-services:4.3.10' -> no problem

classpath 'com.google.gms:google-services:4.3.14' -> build error

build error message :

Execution failed for task ':unityLibrary:processDebugGoogleServices'.

No matching client found for package name 'com.unity3d.player'

```<code>//----------------------------
//build.gradle (project : ---)
//----------------------------

    allprojects {
        buildscript {
            repositories {
                google()
            jcenter()
        }

        dependencies {
            classpath 'com.android.tools.build:gradle:7.3.1'
            classpath 'com.google.gms:google-services:4.3.10'
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
        }
    }

    repositories {
        google()
        jcenter()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

</code>```

I hope it will be fixed in the next version.thank you.

Body:
Problem after change from google-services version 4.3.10 to 4.3.14

classpath 'com.google.gms:google-services:4.3.10' -> no problem

classpath 'com.google.gms:google-services:4.3.14' -> build error

build error message :

Execution failed for task ':unityLibrary:processDebugGoogleServices'.

No matching client found for package name 'com.unity3d.player'

//----------------------------
//build.gradle (project : ---)
//----------------------------

    allprojects {
        buildscript {
            repositories {
                google()
            jcenter()
        }

        dependencies {
            classpath 'com.android.tools.build:gradle:7.3.1'
            classpath 'com.google.gms:google-services:4.3.10'
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
        }
    }

    repositories {
        google()
        jcenter()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I hope it will be fixed in the next version.thank you.


问:
Multiple SQL transaction in one with unique key
I need to revert 3 SQL inserts, but since I need the key generated in the first insert, I don't not know how to do the transaction.

Example:

Begin Transaction

Insert to TABLE A - get the ID generated

Insert to Table B the ID from Table A to FK

Insert to Table C
Commit transaction.

doing in Node js:

```<code>const rs = await pool
                 .request()
                 .query(`BEGIN TRANSACTION;Insert....
</code>```

but I need to run in 3 requests. Is this possible?

Body:
I need to revert 3 SQL inserts, but since I need the key generated in the first insert, I don't not know how to do the transaction.

Example:

Begin Transaction

Insert to TABLE A - get the ID generated

Insert to Table B the ID from Table A to FK

Insert to Table C
Commit transaction.

doing in Node js:

const rs = await pool
                 .request()
                 .query(`BEGIN TRANSACTION;Insert....

but I need to run in 3 requests. Is this possible?


问:
How to prevent RCP exit failure?
When I was writing a program yesterday, I failed to exit Eclipse. The UI is closed, but the console is still running (eclipsec.exe). This kind of problem is not common. I checked the error log and found no reason.

How can I avoid this kind of problem if I develop an RCP? Can I check the thread when the Display is destroyed, and force exit (System.exit) after the specified time

Is my method feasible?

Title: How to prevent RCP exit failure?


问:
Is ordering of Typescript parameter properties guaranteed by Object.keys?
Ordering of keys is guaranteed on a (modern) literal Javascript object:

```<code>>> const sophie = {name: 'Sophie', age: 17, color: 'black'}
>> Object.keys(sophie)
['name', 'age', 'color']
</code>```

Is it also guaranteed for Javascript/Typescript class constructor args?

```<code>class Cat {
  constructor(
    public name:  string,
    public age:   number,
    public color: string
  ) {}
}

>> const sophie = new Cat('Sophie', 17, 'black')
>> Object.keys(sophie)
['name', 'age', 'color'] <- is this order guaranteed?
</code>```

Body:
Ordering of keys is guaranteed on a (modern) literal Javascript object:

>> const sophie = {name: 'Sophie', age: 17, color: 'black'}
>> Object.keys(sophie)
['name', 'age', 'color']

Is it also guaranteed for Javascript/Typescript class constructor args?

class Cat {
  constructor(
    public name:  string,
    public age:   number,
    public color: string
  ) {}
}

>> const sophie = new Cat('Sophie', 17, 'black')
>> Object.keys(sophie)
['name', 'age', 'color'] <- is this order guaranteed?


问:
How can I set up reviewdog for android and jetpack compose?
```<code>name: reviewdog
on: [ pull_request ]

jobs:
    ktlint:
        name: Ktlint Check Code Quality
        runs-on: ubuntu-latest

        steps:
            -   name: Clone repo
                uses: actions/checkout@main
                with:
                    fetch-depth: 1

            -   name: ktlint
                uses: ScaCap/action-ktlint@master
                with:
                    github_token: ${{ secrets.github_token }}
                    reporter: github-pr-review
                    android: true
                    fail_on_error: true
                    level: warning

    detekt:
        name: Check Code Quality
        runs-on: ubuntu-latest

        steps:
            -   name: Clone repo
                uses: actions/checkout@v2
                with:
                    fetch-depth: 1
                    ref: ${{ github.head_ref }}

            -   name: detekt
                uses: alaegin/Detekt-Action@v1.22.0
                with:
                    github_token: ${{ secrets.github_token }}
                    detekt_config: detekt-config.yml # Change config path
</code>```

And the result

```<code>182 kotlin files were analyzed.
Complexity Report:
    - 11,105 lines of code (loc)
    - 9,579 source lines of code (sloc)
    - 6,240 logical lines of code (lloc)
    - 223 comment lines of code (cloc)
    - 669 cyclomatic complexity (mcc)
    - 247 cognitive complexity
    - 0 number of total code smells
    - 2% comment source ratio
    - 107 mcc per 1,000 lloc
    - 0 code smells per 1,000 lloc

Project Statistics:
    - number of properties: 794
    - number of functions: 414
    - number of classes: 156
    - number of packages: 54
    - number of kt files: 182
</code>```

I can't be 0 code smell. Is there any problem?

And I am curious about detekt-config.yml. Is it generated by reviewdog or is it local file that I created?

Body:
name: reviewdog
on: [ pull_request ]

jobs:
    ktlint:
        name: Ktlint Check Code Quality
        runs-on: ubuntu-latest

        steps:
            -   name: Clone repo
                uses: actions/checkout@main
                with:
                    fetch-depth: 1

            -   name: ktlint
                uses: ScaCap/action-ktlint@master
                with:
                    github_token: ${{ secrets.github_token }}
                    reporter: github-pr-review
                    android: true
                    fail_on_error: true
                    level: warning

    detekt:
        name: Check Code Quality
        runs-on: ubuntu-latest

        steps:
            -   name: Clone repo
                uses: actions/checkout@v2
                with:
                    fetch-depth: 1
                    ref: ${{ github.head_ref }}

            -   name: detekt
                uses: alaegin/Detekt-Action@v1.22.0
                with:
                    github_token: ${{ secrets.github_token }}
                    detekt_config: detekt-config.yml # Change config path

And the result

182 kotlin files were analyzed.
Complexity Report:
    - 11,105 lines of code (loc)
    - 9,579 source lines of code (sloc)
    - 6,240 logical lines of code (lloc)
    - 223 comment lines of code (cloc)
    - 669 cyclomatic complexity (mcc)
    - 247 cognitive complexity
    - 0 number of total code smells
    - 2% comment source ratio
    - 107 mcc per 1,000 lloc
    - 0 code smells per 1,000 lloc

Project Statistics:
    - number of properties: 794
    - number of functions: 414
    - number of classes: 156
    - number of packages: 54
    - number of kt files: 182

I can't be 0 code smell. Is there any problem?

And I am curious about detekt-config.yml. Is it generated by reviewdog or is it local file that I created?


问:
Python script not running using crontabs
I'm using a droplet in order to run a script every minute, I have configured my cronjob like this

```<code>* * * * * /home/automatedmailing/src/myenv/bin/python  /home/automatedmailing/src/app.py
</code>```

the problem is that my script is not running, I have a logger inside my src folder in order to handle exceptions but there is no new changes inside that file, when I try to run the script from my terminal it runs fine, I also tried by running a test file like

```<code>* * * * * /home/automatedmailing/src/myenv/bin/python  /home/automatedmailing/src/test.py >> home/cron.log
</code>```

and the log file was showing the expected output

this is my script full code
import pandas as pd
import logging
import smtplib
import ssl
import os
import csv

```<code>from dotenv import load_dotenv
from email.message import EmailMessage
from exceptions import alreadySent

# setting up the logger
logging.basicConfig(format='%(asctime)s %(message)s',filename = "logger.log",level =
logging.DEBUG)

load_dotenv()
# getting sheet as csv and then reading it as a dataframe
df = pd.read_csv(URL)

email_sender = "*"
# reading password from .env file
email_password = os.getenv('password')
email_recievers = ["*"]

subject =  "TRACKING"

# getting selected users
pendingUsers = df[df['Enviar'] == 1]

context = ssl.create_default_context()

for index,row in pendingUsers.iterrows():
  name = row['Nombre']
  petName = row['Nombre del Cachorro']
  email = row['Correo Electrónico']
  trackID = row['Guía']

# duplicated status
duplicated = False
# reading db
with open('db.txt','r') as f:
    lines = list(map(lambda x: x.replace('\n',''),f.readlines()))
    try:
        if email in lines:
            raise alreadySent
            print("duplicated hmmm")
    except alreadySent:
        duplicated = True
        logging.error(f"Email already sent to user with email:{email} (skipping email) ")

if not duplicated:
# writing into db
    print("about to send email...")

    body = f"""
    <html>
    <body>
    <h1>Hola {name}!</h1>
    <h5>El número de tu guía es {trackID}</h5>
    </body>
    </html>

    """
    # setting up email
    em = EmailMessage()
    em['From'] = email_password
    em['To'] = email
    em['Subject'] = subject
    em.set_content(body,subtype = 'html')

    # sed
    with smtplib.SMTP_SSL("smtp.gmail.com",465,context = context) as smtp:
        try:
            smtp.login(email_sender,email_password)
            smtp.send_message(em)
            logging.info(f"Email sended to: {email} succesfully")
            with open('db.txt','a') as f:
                print(email,file = f)
        except Exception as e:
            logging.error(str(e))
        #smtp.sendmail(email_sender,email,em.as_string())

</code>```

Body:
I'm using a droplet in order to run a script every minute, I have configured my cronjob like this

* * * * * /home/automatedmailing/src/myenv/bin/python  /home/automatedmailing/src/app.py

the problem is that my script is not running, I have a logger inside my src folder in order to handle exceptions but there is no new changes inside that file, when I try to run the script from my terminal it runs fine, I also tried by running a test file like

* * * * * /home/automatedmailing/src/myenv/bin/python  /home/automatedmailing/src/test.py >> home/cron.log

and the log file was showing the expected output

this is my script full code
import pandas as pd
import logging
import smtplib
import ssl
import os
import csv

from dotenv import load_dotenv
from email.message import EmailMessage
from exceptions import alreadySent

# setting up the logger
logging.basicConfig(format='%(asctime)s %(message)s',filename = "logger.log",level =
logging.DEBUG)

load_dotenv()
# getting sheet as csv and then reading it as a dataframe
df = pd.read_csv(URL)

email_sender = "*"
# reading password from .env file
email_password = os.getenv('password')
email_recievers = ["*"]

subject =  "TRACKING"

# getting selected users
pendingUsers = df[df['Enviar'] == 1]

context = ssl.create_default_context()

for index,row in pendingUsers.iterrows():
  name = row['Nombre']
  petName = row['Nombre del Cachorro']
  email = row['Correo Electrónico']
  trackID = row['Guía']

# duplicated status
duplicated = False
# reading db
with open('db.txt','r') as f:
    lines = list(map(lambda x: x.replace('\n',''),f.readlines()))
    try:
        if email in lines:
            raise alreadySent
            print("duplicated hmmm")
    except alreadySent:
        duplicated = True
        logging.error(f"Email already sent to user with email:{email} (skipping email) ")

if not duplicated:
# writing into db
    print("about to send email...")

    body = f"""

Hola {name}!

El número de tu guía es {trackID}

    """
    # setting up email
    em = EmailMessage()
    em['From'] = email_password
    em['To'] = email
    em['Subject'] = subject
    em.set_content(body,subtype = 'html')

    # sed
    with smtplib.SMTP_SSL("smtp.gmail.com",465,context = context) as smtp:
        try:
            smtp.login(email_sender,email_password)
            smtp.send_message(em)
            logging.info(f"Email sended to: {email} succesfully")
            with open('db.txt','a') as f:
                print(email,file = f)
        except Exception as e:
            logging.error(str(e))
        #smtp.sendmail(email_sender,email,em.as_string())