问:
Image size for Google AutoML Training
I have some images which are lager than 1024 pixels by 1024 pixels. Following this document: https://cloud.google.com/vertex-ai/docs/image-data/object-detection/prepare-data Image size should be 1024 pixels by 1024 pixels suggested maximum. If I resize images, the quality of images is low.

What should I do?

Do Google AutoML have a function to resize uploaded image or images which are lager than 1024 pixels by 1024 pixels, this function helps Google to train model (which have image size lager than 1024 pixels by 1024 pixels) better? or a solution for this case

Thanks

Title: Image size for Google AutoML Training


来源: stackexchange

问:
Media query hover: none always activated
This probably get flagged as duplicate but I went through all questions and answers and did not find my very simple question answered.
I have this sass for links:

```<code>@base-color: black
:root
  color: $base-color
a
  color: inherit
  text-decoration: none

  @media (hover: none)
    border-bottom: 2px solid $base-color
  &:hover
    border-bottom: 2px solid $base-color
</code>```

Simply enough I want a border-bottom on hover or if no hover is available to show the border-bottom unconditionally. The effect of the above code is an unconditional display of the border on touch and none touch displays.

What can I do to get the required behaviour?

CodePen
For me the link always has a border-bottom.

EDIT: add a codepen:

ContentLicense: CC BY-SA 4.0

Body:
This probably get flagged as duplicate but I went through all questions and answers and did not find my very simple question answered.
I have this sass for links:

@base-color: black
:root
  color: $base-color
a
  color: inherit
  text-decoration: none

  @media (hover: none)
    border-bottom: 2px solid $base-color
  &:hover
    border-bottom: 2px solid $base-color

Simply enough I want a border-bottom on hover or if no hover is available to show the border-bottom unconditionally. The effect of the above code is an unconditional display of the border on touch and none touch displays.

What can I do to get the required behaviour?

CodePen
For me the link always has a border-bottom.

EDIT: add a codepen:


问:
How max_drawdown and max_runup are calculated when multiple exits (take profit) is used
I don't understand how strategy.max_drawdown and strategy.max_runup are calculated on TradingView Pine Script. My problem is the documented calculation just not correct if there are multiple exit points.

I know what is max drawdown and runup, but TradingView calculates different way than it is logical for me.

I have the following pine script:

//@version=5
strategy("StratTest", overlay=true, precision = 10, initial_capital=1000, default_qty_type=strategy.fixed, default_qty_value=100,
         commission_type=strategy.commission.cash_per_contract,
         commission_value=0.033)

var float limit = na
var float stop = na
var float tp1 = na
var float tp2 = na

if bar_index == 860
    limit := math.round_to_mintick(close + 10 * syminfo.mintick)
    stop := math.round_to_mintick(high + 70 * syminfo.mintick)
    tp1 := math.round_to_mintick(low - 20 * syminfo.mintick)
    tp2 := math.round_to_mintick(low - 200 * syminfo.mintick)

    strategy.entry("Entry", strategy.short, limit=limit)
    strategy.exit("Exit/1", "Entry", stop=stop, limit=tp1, qty_percent = 50)
    strategy.exit("Exit/2", "Entry", stop=stop, limit=tp2, qty_percent = 50)

plotchar(strategy.max_drawdown, "max_drawdown", '', location.top, color=color.yellow)
plotchar(strategy.max_runup, "max_runup", '', location.top, color=color.yellow)

plotchar(strategy.opentrades.max_drawdown(0), "opentrades.max_drawdown(0)", '', location.top, color.gray)
plotchar(strategy.opentrades.max_runup(0), "opentrades.max_runup(0)", '', location.top, color.gray)

plotchar(strategy.closedtrades.max_drawdown(0), "closedtrades.max_drawdown(0)", '', location.top, color.white)
plotchar(strategy.closedtrades.max_drawdown(1), "closedtrades.max_drawdown(1)", '', location.top, color.white)
plotchar(strategy.closedtrades.max_runup(0), "closedtrades.max_runup(0)", '', location.top, color.white)
plotchar(strategy.closedtrades.max_runup(1), "closedtrades.max_runup(1)", '', location.top, color.white)

```

If I run this on CAPITALCOM:GBPJPY 15 min interval on TradingView, the strategy.max_drawdown will be 6.00. How is it possible?
Without commission strategy.max_drawdown is 3.45. How it is calculated?

My calculations

My start equity is 1000. I sell 100 contracts at 152.873 , high is 152.9, low is 152.823

The order of execution is o→h→l→c

The equity at low price: 1005,  at high: 997.3. -> Runup: 5, drawdown 2.7

This is the same on TradingView so it is OK

Buy back 50 (from 100) contracts at 152.8, high is 152.861 low is 152.794

The order of execution is o→h→l→c

The equity at high is 1000 - 100 * (152.861 - 152.873) = 1001.2

Then the order is executed at 152.8, profit: -50 * (152.8 - 152.873) = 3.65

The remaining reach low, so the equity on low will be: 1000 + 3.65 - 50 * (152.794 - 152.873) = 1007.6

So the max drawdown is still 2.7 but runup changes to 7.6. It is still OK

Buy back 50 (from 50) contracts at 152.969, high is 152.982 low is 152.829

The order of execution is o→l→h→c

So the equity at low is 1000 + 3.65 - 50 * (152.829 - 152.873) = 1005.85

Then the order is executed at 152.969, profit: -50 * (152.969 - 152.873) = -4.8

The equity: 1000 + 3.65 - 4.8 = 998.85

So the max drawdown is still 2.7 and runup is still 7.6 . It is not OK, on TradingView drawdown is 3.45 . How is it possible?

The list of trades when commission is used:

The list of trades without commission:

This is a snapshot image of the problem:

Body:
I don't understand how strategy.max_drawdown and strategy.max_runup are calculated on TradingView Pine Script. My problem is the documented calculation just not correct if there are multiple exit points.

I know what is max drawdown and runup, but TradingView calculates different way than it is logical for me.

I have the following pine script:

//@version=5
strategy("StratTest", overlay=true, precision = 10, initial_capital=1000, default_qty_type=strategy.fixed, default_qty_value=100,
         commission_type=strategy.commission.cash_per_contract,
         commission_value=0.033)

var float limit = na
var float stop = na
var float tp1 = na
var float tp2 = na

if bar_index == 860
    limit := math.round_to_mintick(close + 10 * syminfo.mintick)
    stop := math.round_to_mintick(high + 70 * syminfo.mintick)
    tp1 := math.round_to_mintick(low - 20 * syminfo.mintick)
    tp2 := math.round_to_mintick(low - 200 * syminfo.mintick)

    strategy.entry("Entry", strategy.short, limit=limit)
    strategy.exit("Exit/1", "Entry", stop=stop, limit=tp1, qty_percent = 50)
    strategy.exit("Exit/2", "Entry", stop=stop, limit=tp2, qty_percent = 50)

plotchar(strategy.max_drawdown, "max_drawdown", '', location.top, color=color.yellow)
plotchar(strategy.max_runup, "max_runup", '', location.top, color=color.yellow)

plotchar(strategy.opentrades.max_drawdown(0), "opentrades.max_drawdown(0)", '', location.top, color.gray)
plotchar(strategy.opentrades.max_runup(0), "opentrades.max_runup(0)", '', location.top, color.gray)

plotchar(strategy.closedtrades.max_drawdown(0), "closedtrades.max_drawdown(0)", '', location.top, color.white)
plotchar(strategy.closedtrades.max_drawdown(1), "closedtrades.max_drawdown(1)", '', location.top, color.white)
plotchar(strategy.closedtrades.max_runup(0), "closedtrades.max_runup(0)", '', location.top, color.white)
plotchar(strategy.closedtrades.max_runup(1), "closedtrades.max_runup(1)", '', location.top, color.white)

If I run this on CAPITALCOM:GBPJPY 15 min interval on TradingView, the strategy.max_drawdown will be 6.00. How is it possible?
Without commission strategy.max_drawdown is 3.45. How it is calculated?

My calculations

My start equity is 1000. I sell 100 contracts at 152.873 , high is 152.9, low is 152.823

The order of execution is o→h→l→c

The equity at low price: 1005,  at high: 997.3. -> Runup: 5, drawdown 2.7

This is the same on TradingView so it is OK

Buy back 50 (from 100) contracts at 152.8, high is 152.861 low is 152.794

The order of execution is o→h→l→c

The equity at high is 1000 - 100 * (152.861 - 152.873) = 1001.2

Then the order is executed at 152.8, profit: -50 * (152.8 - 152.873) = 3.65

The remaining reach low, so the equity on low will be: 1000 + 3.65 - 50 * (152.794 - 152.873) = 1007.6

So the max drawdown is still 2.7 but runup changes to 7.6. It is still OK

Buy back 50 (from 50) contracts at 152.969, high is 152.982 low is 152.829

The order of execution is o→l→h→c

So the equity at low is 1000 + 3.65 - 50 * (152.829 - 152.873) = 1005.85

Then the order is executed at 152.969, profit: -50 * (152.969 - 152.873) = -4.8

The equity: 1000 + 3.65 - 4.8 = 998.85

So the max drawdown is still 2.7 and runup is still 7.6 . It is not OK, on TradingView drawdown is 3.45 . How is it possible?

The list of trades when commission is used:

The list of trades without commission:

This is a snapshot image of the problem:


问:
An inline SVG in my CSS file is converted to base64 when is deployed on Vercel
I have a weird behavior when my Next 12 app is deployed on Vercel.

To give more context: we have a design system library that contains an SVG inside a CSS module (basically we have a property mask: url("data:image/svg...). In order to make this mask compliant for safari, this SVG also has 2 attributes width and height both at 100%.

So what's wrong now?

If I build locally, the inline SVG still remains an SVG data:image/svg and that's fine!
But what if I build on Vercel?
Magically, the SVG is no more in the data:image/svg format but in data:image/svg+xml;charset=utf-8;base64,.
So what's the problem here? In this way, the 2 attributes width and height placed on the SVG breaks the mask visualization.

It would be an easy fix if the original URL was not converted but other suggestions will be appreciated


问:
pyTorch nn.Conv2D use twice lead to an error
I am using pytorch training a model. Here is the code:

```<code>def forward(self, x):
        H, W = self.input_resolution
        B_, shuf_size_2, win_size_2, C = x.shape
        shuf_size = int(shuf_size_2 ** 0.5)
        win_size = int(win_size_2 ** 0.5)
        B = B_ // (H//shuf_size//win_size) // (W//shuf_size//win_size)

        msg_token = window_reverse(
            x[:, :, 0].unsqueeze(2), 1, shuf_size, H//win_size, W//win_size, nchw=True)

        msg_token = self.reduction(msg_token).permute(0, 2, 3, 1)
        msg_token = self.norm(msg_token)
        if msg_token.shape[1] >= self.nxt_shuf_size:
            msg_token = window_partition(msg_token, 1, self.nxt_shuf_size)

        x = window_reverse(x[:, :, 1:], win_size, shuf_size, H, W, nchw=True)
        x = self.reduction(x).permute(0, 2, 3, 1)
        x = self.norm(x)

        if x.shape[1] // win_size >= self.nxt_shuf_size:
            x = window_partition(x, win_size, self.nxt_shuf_size)
        else:
            x = window_partition(x, win_size, 1)

        x = torch.cat((msg_token, x), dim=2)

        return x
</code>```

In this code, self.reduction is a Conv2D layer:

```<code>self.reduction = nn.Conv2d(dim, 2 * dim, 3, 2, 1)
</code>```

where dim is 64

the tensor msg_token has the shape of [128,64,8,8] before sent into self.reduction

the tensor x has the shape of [128,64,56,56] before sent into self.reduction

But when the code runs here:

```<code>x = self.reduction(x).permute(0, 2, 3, 1)
</code>```

It raises an error:

```<code>Exception has occurred: IndexError
tuple index out of range
File "/home/yun/Coding/MSG-Transformer/models/msg_transformer.py", line 298, in forward
x = self.reduction(x).permute(0, 2, 3, 1)
File "/home/yun/Coding/MSG-Transformer/models/msg_transformer.py", line 384, in forward
x = self.downsample(x)
File "/home/yun/Coding/MSG-Transformer/models/msg_transformer.py", line 579, in forward_features
x = layer(x)
File "/home/yun/Coding/MSG-Transformer/models/msg_transformer.py", line 585, in forward
x = self.forward_features(x)
File "/home/yun/Coding/MSG-Transformer/main.py", line 168, in train_one_epoch
outputs = model(samples)
File "/home/yun/Coding/MSG-Transformer/main.py", line 134, in main
train_one_epoch(config, model, criterion, data_loader_train, optimizer, epoch, mixup_fn, lr_scheduler)
File "/home/yun/Coding/MSG-Transformer/main.py", line 356, in
main(config)
</code>```

I found that if I sent x into self.reduction before senting msg_token into self.reduction, this error would be raised by msg_token = self.reduction(msg_token).permute(0, 2, 3, 1) instead. Could anyone help?

Body:
I am using pytorch training a model. Here is the code:

def forward(self, x):
        H, W = self.input_resolution
        B_, shuf_size_2, win_size_2, C = x.shape
        shuf_size = int(shuf_size_2 ** 0.5)
        win_size = int(win_size_2 ** 0.5)
        B = B_ // (H//shuf_size//win_size) // (W//shuf_size//win_size)

        msg_token = window_reverse(
            x[:, :, 0].unsqueeze(2), 1, shuf_size, H//win_size, W//win_size, nchw=True)

        msg_token = self.reduction(msg_token).permute(0, 2, 3, 1)
        msg_token = self.norm(msg_token)
        if msg_token.shape[1] >= self.nxt_shuf_size:
            msg_token = window_partition(msg_token, 1, self.nxt_shuf_size)

        x = window_reverse(x[:, :, 1:], win_size, shuf_size, H, W, nchw=True)
        x = self.reduction(x).permute(0, 2, 3, 1)
        x = self.norm(x)

        if x.shape[1] // win_size >= self.nxt_shuf_size:
            x = window_partition(x, win_size, self.nxt_shuf_size)
        else:
            x = window_partition(x, win_size, 1)

        x = torch.cat((msg_token, x), dim=2)

        return x

In this code, self.reduction is a Conv2D layer:

self.reduction = nn.Conv2d(dim, 2 * dim, 3, 2, 1)

where dim is 64

the tensor msg_token has the shape of [128,64,8,8] before sent into self.reduction

the tensor x has the shape of [128,64,56,56] before sent into self.reduction

But when the code runs here:

x = self.reduction(x).permute(0, 2, 3, 1)

It raises an error:

Exception has occurred: IndexError
tuple index out of range
File "/home/yun/Coding/MSG-Transformer/models/msg_transformer.py", line 298, in forward
x = self.reduction(x).permute(0, 2, 3, 1)
File "/home/yun/Coding/MSG-Transformer/models/msg_transformer.py", line 384, in forward
x = self.downsample(x)
File "/home/yun/Coding/MSG-Transformer/models/msg_transformer.py", line 579, in forward_features
x = layer(x)
File "/home/yun/Coding/MSG-Transformer/models/msg_transformer.py", line 585, in forward
x = self.forward_features(x)
File "/home/yun/Coding/MSG-Transformer/main.py", line 168, in train_one_epoch
outputs = model(samples)
File "/home/yun/Coding/MSG-Transformer/main.py", line 134, in main
train_one_epoch(config, model, criterion, data_loader_train, optimizer, epoch, mixup_fn, lr_scheduler)
File "/home/yun/Coding/MSG-Transformer/main.py", line 356, in
main(config)

I found that if I sent x into self.reduction before senting msg_token into self.reduction, this error would be raised by msg_token = self.reduction(msg_token).permute(0, 2, 3, 1) instead. Could anyone help?


问:
MySQL json_table not working 2nd time the Stored proc is run
I am using json_table in 2 mysql stored procs, for both stored procs it works the first time the stored proc is run, but not after that. If I edit the proc and save it again it works again the first time, but not after. I have narrowed it down to being something to do with the json_table.

```<code>CREATE DEFINER=`username`@`%` PROCEDURE `sp_filter_values_add`(_dashboard_filter_id int(11))
BEGIN

insert into us_ui_dashboard_filter_values (dashboard_filter_id,
                    section_id,
                    section_item_id,
                    filter_value,
                    filter_value_text )

        select  dt.dashboard_filter_id,
                x1.section_id,
                x1.section_item_id,
                x1.filter_value,
                x1.filter_value_text
        from    us_ui_dashboard_filter dt,
            json_table( dt.filter_json, '$[*]' columns (
                section_id int(11) PATH '$.section_id',
                section_item_id int(11) PATH '$.section_item_id',
                filter_value int(11) PATH '$.filter_value',
                filter_value_text int(11) PATH '$.filter_value_text'
                                )
                ) x1
        WHERE dt.dashboard_filter_id = _dashboard_filter_id;
END
</code>```

mysql version   8.0.12
Workbench 8.0.23

There is no problem with either of stored procs when they run the first time around the data returned is correct. The value gets returned as null after the first run, and there is no error. Not sure what else to try or even how to find a work-around.

The same code works fine repeatedly in the query windows.

Body:
I am using json_table in 2 mysql stored procs, for both stored procs it works the first time the stored proc is run, but not after that. If I edit the proc and save it again it works again the first time, but not after. I have narrowed it down to being something to do with the json_table.

CREATE DEFINER=`username`@`%` PROCEDURE `sp_filter_values_add`(_dashboard_filter_id int(11))
BEGIN

insert into us_ui_dashboard_filter_values (dashboard_filter_id,
                    section_id,
                    section_item_id,
                    filter_value,
                    filter_value_text )

        select  dt.dashboard_filter_id,
                x1.section_id,
                x1.section_item_id,
                x1.filter_value,
                x1.filter_value_text
        from    us_ui_dashboard_filter dt,
            json_table( dt.filter_json, '$[*]' columns (
                section_id int(11) PATH '$.section_id',
                section_item_id int(11) PATH '$.section_item_id',
                filter_value int(11) PATH '$.filter_value',
                filter_value_text int(11) PATH '$.filter_value_text'
                                )
                ) x1
        WHERE dt.dashboard_filter_id = _dashboard_filter_id;
END

mysql version   8.0.12
Workbench 8.0.23

There is no problem with either of stored procs when they run the first time around the data returned is correct. The value gets returned as null after the first run, and there is no error. Not sure what else to try or even how to find a work-around.

The same code works fine repeatedly in the query windows.


问:
Fetch data from API and save it Liferay using Talend Open Studio
I am trying to create a talend job that fetch data from API usig tRestClient and save the returned data in Liferay Object created for this purpose, but it returns below error when run the job:

```<code>Exception in component tLiferayOutput_1 (testRest)
java.lang.RuntimeException: java.lang.InstantiationException: org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide
    at org.apache.cxf.jaxrs.impl.ConfigurationImpl.createProvider(ConfigurationImpl.java:240)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.register(ConfigurableImpl.java:151)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.register(ConfigurableImpl.java:146)
    at org.apache.cxf.jaxrs.impl.FeatureContextImpl.register(FeatureContextImpl.java:48)
    at org.apache.cxf.jaxrs.impl.FeatureContextImpl.register(FeatureContextImpl.java:27)
    at org.glassfish.jersey.media.multipart.MultiPartFeature.configure(MultiPartFeature.java:67)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.doRegister(ConfigurableImpl.java:183)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.doRegister(ConfigurableImpl.java:174)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.register(ConfigurableImpl.java:151)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.register(ConfigurableImpl.java:146)
    at org.apache.cxf.jaxrs.client.spec.ClientImpl.register(ClientImpl.java:189)
    at org.apache.cxf.jaxrs.client.spec.ClientImpl.register(ClientImpl.java:54)
    at com.liferay.talend.runtime.client.LiferayClient.<init>(LiferayClient.java:229)
    at com.liferay.talend.runtime.client.LiferayClient.<init>(LiferayClient.java:62)
    at com.liferay.talend.runtime.client.LiferayClient$Builder.build(LiferayClient.java:131)
    at com.liferay.talend.runtime.LiferaySourceOrSink.getLiferayClient(LiferaySourceOrSink.java:139)
    at com.liferay.talend.runtime.LiferaySourceOrSink.initialize(LiferaySourceOrSink.java:228)
    at com.liferay.talend.runtime.LiferaySourceOrSink.initialize(LiferaySourceOrSink.java:59)
    at local_project.testrest_0_1.testRest.tRESTClient_1Process(testRest.java:1494)
    at local_project.testrest_0_1.testRest.runJobInTOS(testRest.java:2744)
    at local_project.testrest_0_1.testRest.main(testRest.java:2581)
Caused by: java.lang.InstantiationException: org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide
    at java.lang.Class.newInstance(Class.java:427)
    at org.apache.cxf.jaxrs.impl.ConfigurationImpl.createProvider(ConfigurationImpl.java:238)
    ... 20 more
Caused by: java.lang.NoSuchMethodException: org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide.<init>()
    at java.lang.Class.getConstructor0(Class.java:3082)
    at java.lang.Class.newInstance(Class.java:412)
    ... 21 more
</code>```

I am using:

Liferay 7.4 update 55

TOS 7.1

tLiferayConnection to establish the connection.

tRestClient to Fetch data from API

tExtractJson and tMap to extract the fields and map it to the liferay object fields

tLiferayOutput to save the data

Thank you!

Body:
I am trying to create a talend job that fetch data from API usig tRestClient and save the returned data in Liferay Object created for this purpose, but it returns below error when run the job:

Exception in component tLiferayOutput_1 (testRest)
java.lang.RuntimeException: java.lang.InstantiationException: org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide
    at org.apache.cxf.jaxrs.impl.ConfigurationImpl.createProvider(ConfigurationImpl.java:240)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.register(ConfigurableImpl.java:151)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.register(ConfigurableImpl.java:146)
    at org.apache.cxf.jaxrs.impl.FeatureContextImpl.register(FeatureContextImpl.java:48)
    at org.apache.cxf.jaxrs.impl.FeatureContextImpl.register(FeatureContextImpl.java:27)
    at org.glassfish.jersey.media.multipart.MultiPartFeature.configure(MultiPartFeature.java:67)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.doRegister(ConfigurableImpl.java:183)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.doRegister(ConfigurableImpl.java:174)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.register(ConfigurableImpl.java:151)
    at org.apache.cxf.jaxrs.impl.ConfigurableImpl.register(ConfigurableImpl.java:146)
    at org.apache.cxf.jaxrs.client.spec.ClientImpl.register(ClientImpl.java:189)
    at org.apache.cxf.jaxrs.client.spec.ClientImpl.register(ClientImpl.java:54)
    at com.liferay.talend.runtime.client.LiferayClient.<init>(LiferayClient.java:229)
    at com.liferay.talend.runtime.client.LiferayClient.<init>(LiferayClient.java:62)
    at com.liferay.talend.runtime.client.LiferayClient$Builder.build(LiferayClient.java:131)
    at com.liferay.talend.runtime.LiferaySourceOrSink.getLiferayClient(LiferaySourceOrSink.java:139)
    at com.liferay.talend.runtime.LiferaySourceOrSink.initialize(LiferaySourceOrSink.java:228)
    at com.liferay.talend.runtime.LiferaySourceOrSink.initialize(LiferaySourceOrSink.java:59)
    at local_project.testrest_0_1.testRest.tRESTClient_1Process(testRest.java:1494)
    at local_project.testrest_0_1.testRest.runJobInTOS(testRest.java:2744)
    at local_project.testrest_0_1.testRest.main(testRest.java:2581)
Caused by: java.lang.InstantiationException: org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide
    at java.lang.Class.newInstance(Class.java:427)
    at org.apache.cxf.jaxrs.impl.ConfigurationImpl.createProvider(ConfigurationImpl.java:238)
    ... 20 more
Caused by: java.lang.NoSuchMethodException: org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide.<init>()
    at java.lang.Class.getConstructor0(Class.java:3082)
    at java.lang.Class.newInstance(Class.java:412)
    ... 21 more

I am using:

Liferay 7.4 update 55

TOS 7.1

tLiferayConnection to establish the connection.

tRestClient to Fetch data from API

tExtractJson and tMap to extract the fields and map it to the liferay object fields

tLiferayOutput to save the data

Thank you!


问:
React Native android bundling with dev bundle instead of staging
I have a react native project that works fine if I am running the dev/debug version of the app
I have created a staging build type for android added this to the build.gradle

```<code>project.ext.react = [
        bundleInStaging: true,
        enableHermes   : false,  // clean and rebuild if changing
        devDisabledInStaging: true,
]
</code>```

It still fires off metro if it's not running but also bundles the JS to the expected folder however when I run the app I get an error where it cannot find the

java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.

Let me know if you need anymore information from me

React Native version 0.70.5

Tried to do a clean and build, restarted computer and cleaned emulators but still the same also happens in the pipelines

Body:
I have a react native project that works fine if I am running the dev/debug version of the app
I have created a staging build type for android added this to the build.gradle

project.ext.react = [
        bundleInStaging: true,
        enableHermes   : false,  // clean and rebuild if changing
        devDisabledInStaging: true,
]

It still fires off metro if it's not running but also bundles the JS to the expected folder however when I run the app I get an error where it cannot find the

java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.

Let me know if you need anymore information from me

React Native version 0.70.5

Tried to do a clean and build, restarted computer and cleaned emulators but still the same also happens in the pipelines


问:
update specific item in viewPager2 at same time without affecting other items

STORY:-

I'm making app like Instagram Reels, with viewPager2 with RecyclerViewAdapter, all functionality working fine,

only one problem I'm facing right now is when I click on comment button the Comment screen is opening in another activity and when I getting back on reels activity after commenting or without commenting,

video playing again and mixing with current audio that means notifyItemChanged is not working properly in my case,

I just want to update that comment count only without affecting whole adapter items.

Class- AdapterClass : RecyclerView.Adapter

onClickListener for Comment button

```<code>binding.ivComment.setOnClickListener(View.OnClickListener {
            if (Utility.isOnline(context)) {
                itemClick(post)
            } else {
                val toast: Toast = Toast.makeText(
                    context,
                    R.string.msg_no_internet,
                    Toast.LENGTH_SHORT
                )
                toast.show()
            }
        })

fun itemClick(postList: PostList?) {
    if (Utility.isOnline(context)) {
        val intent = Intent(context, BitesCommentActivity::class.java)
        intent.putExtra(PostList.SENDEXTRA, postList)
        context.startActivity(intent)
    } else {
        val toast: Toast = Toast.makeText(context, R.string.msg_no_internet, Toast.LENGTH_SHORT)
        toast.show()
    }
}
</code>```

Class- Activity Class

Using BroadcastReceiver for update comment count from CommentActivity

```<code>private val mMessageReceiver: BroadcastReceiver = object : BroadcastReceiver() {
        override fun onReceive(context: Context, intent: Intent) {
            val isActivityInForeground = this@BitesSwappableVideosActivity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)
            if (!isActivityInForeground) {
                val message = intent.getStringExtra("message")
                val epost_id = intent.extras!!
                    .getLong(Constant.ScreenExtras.EPOST_ID, -1)
                val action = intent.extras!!.getInt(Constant.ScreenExtras.ACTION)

                for (i in fav.indices) {
                    val postList: PostList = fav[i]
                    val updateIndex: Int

                    if (action == Constant.COMMENT) {
                        if (postList.postId == epost_id) {
                            postList.totalComment = postList.totalComment + 1
                            eBiteReels_adapter.notifyItemChanged(i)
                            break
                        }
                    }
                }
            } else {
                val message = intent.getStringExtra("message")
                val epost_id = intent.extras!!
                    .getLong(Constant.ScreenExtras.EPOST_ID, -1)
                val action = intent.extras!!.getInt(Constant.ScreenExtras.ACTION)
                for (i in fav.indices) {
                    val postList: PostList = fav[i]
                    if (action == Constant.COMMENT) {
                        if (postList.postId == epost_id) {
                            postList.totalComment = postList.totalComment + 1
                            eBiteReels_adapter.notifyItemChanged(i)
                            break
                        }
                    }
                }
            }
        }
    }
</code>```

I've tried

```<code>eBiteReels_adapter.notifyItemChanged(i)
</code>```

but it cause problem with another items especially with videoplayer.

if I remove notifyItemChanged from my code it refreshes comment count when I restart my SwipableVideoActivity

Body:
STORY:-

I'm making app like Instagram Reels, with viewPager2 with RecyclerViewAdapter, all functionality working fine,

only one problem I'm facing right now is when I click on comment button the Comment screen is opening in another activity and when I getting back on reels activity after commenting or without commenting,

video playing again and mixing with current audio that means notifyItemChanged is not working properly in my case,

I just want to update that comment count only without affecting whole adapter items.

Class- AdapterClass : RecyclerView.Adapter

onClickListener for Comment button

binding.ivComment.setOnClickListener(View.OnClickListener {
            if (Utility.isOnline(context)) {
                itemClick(post)
            } else {
                val toast: Toast = Toast.makeText(
                    context,
                    R.string.msg_no_internet,
                    Toast.LENGTH_SHORT
                )
                toast.show()
            }
        })

fun itemClick(postList: PostList?) {
    if (Utility.isOnline(context)) {
        val intent = Intent(context, BitesCommentActivity::class.java)
        intent.putExtra(PostList.SENDEXTRA, postList)
        context.startActivity(intent)
    } else {
        val toast: Toast = Toast.makeText(context, R.string.msg_no_internet, Toast.LENGTH_SHORT)
        toast.show()
    }
}

Class- Activity Class

Using BroadcastReceiver for update comment count from CommentActivity

private val mMessageReceiver: BroadcastReceiver = object : BroadcastReceiver() {
        override fun onReceive(context: Context, intent: Intent) {
            val isActivityInForeground = this@BitesSwappableVideosActivity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)
            if (!isActivityInForeground) {
                val message = intent.getStringExtra("message")
                val epost_id = intent.extras!!
                    .getLong(Constant.ScreenExtras.EPOST_ID, -1)
                val action = intent.extras!!.getInt(Constant.ScreenExtras.ACTION)

                for (i in fav.indices) {
                    val postList: PostList = fav[i]
                    val updateIndex: Int

                    if (action == Constant.COMMENT) {
                        if (postList.postId == epost_id) {
                            postList.totalComment = postList.totalComment + 1
                            eBiteReels_adapter.notifyItemChanged(i)
                            break
                        }
                    }
                }
            } else {
                val message = intent.getStringExtra("message")
                val epost_id = intent.extras!!
                    .getLong(Constant.ScreenExtras.EPOST_ID, -1)
                val action = intent.extras!!.getInt(Constant.ScreenExtras.ACTION)
                for (i in fav.indices) {
                    val postList: PostList = fav[i]
                    if (action == Constant.COMMENT) {
                        if (postList.postId == epost_id) {
                            postList.totalComment = postList.totalComment + 1
                            eBiteReels_adapter.notifyItemChanged(i)
                            break
                        }
                    }
                }
            }
        }
    }

I've tried

eBiteReels_adapter.notifyItemChanged(i)

but it cause problem with another items especially with videoplayer.

if I remove notifyItemChanged from my code it refreshes comment count when I restart my SwipableVideoActivity


问:
Correct typing for numpy array with Drake expressions
I making a numpy array of Drake expressions, and I am trying to type hint them correctly. This is what I am currently doing:

```<code>import numpy as np
import numpy.typing as npt
import pydrake.symbolic

def some_function(expr: pydrake.symbolic.expression) -> npt.NDArray[pydrake.symbolic.expression]:
   return np.array([expr])
</code>```

where I am using type hints as above. However, I am getting the following error message:

```<code>Could not specialize type "NDArray[ScalarType@NDArray]"
Type "Expression" cannot be assigned to type "generic"
"Expression" is incompatible with "generic"
</code>```

The same error message shows for different Drake objects like pydrake.symbolic.Formula etc.

For the record, I know I can use npt.ArrayLike instead of npt.NDArray[...], and this does not throw an error. However, I would like to find a solution that shows explicitly what the contents of the numpy arrays will be.

Body:
I making a numpy array of Drake expressions, and I am trying to type hint them correctly. This is what I am currently doing:

import numpy as np
import numpy.typing as npt
import pydrake.symbolic

def some_function(expr: pydrake.symbolic.expression) -> npt.NDArray[pydrake.symbolic.expression]:
   return np.array([expr])

where I am using type hints as above. However, I am getting the following error message:

Could not specialize type "NDArray[ScalarType@NDArray]"
Type "Expression" cannot be assigned to type "generic"
"Expression" is incompatible with "generic"

The same error message shows for different Drake objects like pydrake.symbolic.Formula etc.

For the record, I know I can use npt.ArrayLike instead of npt.NDArray[...], and this does not throw an error. However, I would like to find a solution that shows explicitly what the contents of the numpy arrays will be.


问:
How to Render RTSP Streams within a React App
how to embed RTSP stream in react js?

how to stream RTSP video input to your React frontend.

RTSP video is generally from your ip camera but it is a type of video format. I struggled with doing this whole project but i can`t.

for testing it is a public network URL: rtsp://zephyr.rtsp.stream/movie?streamKey=8075879583bba2ccb5017488e5530edb

Need help!

I cant find any react NPM package.

Using the VLC player, i can play the video streaming via RTSP protocol. Launch the VLC player and open network stream, type in the URL. Then you can see the video streaming.


问:
Not able to create a java8 neo4j hello world example
I have to integrate into a current java8 container some limited neo4j functionality but I'm not able to build a simple hello world example.

Created a simple demo app

gradle init \
--project-name neo-question \
--type java-application \
--package neo.question \
--test-framework junit \
--dsl groovy
```
<p>I have added source and target compatibility with java 8 and also a dependency to the <code>org.neo4j.driver:neo4j-java-driver:1.7.6</code> and this is how my <code>build.gradle</code> looks like</p>
```plugins {
    id 'application'
}

sourceCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8

repositories {
    jcenter()
}

dependencies {
    testImplementation 'junit:junit:4.13'
    implementation 'com.google.guava:guava:29.0-jre'
    implementation 'org.neo4j.driver:neo4j-java-driver:1.7.6'
}

application {
    mainClass = 'neo.question.App'
}

```
<p>This is how I start my neo docker to perform this test and I can connect to it from a java11 compatible code</p>
<pre class="lang-bash prettyprint-override"><code>docker run \
    --name testneo4j \
    -p7474:7474 -p7687:7687 \
    -d \
    -v $HOME/neo4j/data:/data \
    -v $HOME/neo4j/logs:/logs \
    -v $HOME/neo4j/import:/var/lib/neo4j/import \
    -v $HOME/neo4j/plugins:/plugins \
    --env NEO4J_dbms_security_auth__minimum__password__length=4 \
    --env NEO4J_AUTH=neo4j/test \
    neo4j:latest
</code>```

I'm using this example for 1.7.6 driver on how to connect: 1.7.6 overview

This is my java8 HelloWorldExample.Java class

package neo.question;

import org.neo4j.driver.v1.*;

import static org.neo4j.driver.v1.Values.parameters;

public class HelloWorldExample implements AutoCloseable{
    private final Driver driver;

    public HelloWorldExample(String uri, String user, String password )
    {
        driver = GraphDatabase.driver( uri, AuthTokens.basic( user, password ) );
    }

    @Override
    public void close() throws Exception
    {
        driver.close();
    }

    public void printGreeting( final String message )
    {
        try ( Session session = driver.session() )
        {
            String greeting = session.writeTransaction( new TransactionWork<String>()
            {
                @Override
                public String execute( Transaction tx )
                {
                    StatementResult result = tx.run( "CREATE (a:Greeting) " +
                                    "SET a.message = $message " +
                                    "RETURN a.message + ', from node ' + id(a)",
                            parameters( "message", message ) );
                    return result.single().get( 0 ).asString();
                }
            } );
            System.out.println( greeting );
        }
    }

    public static void main( String... args ) throws Exception
    {
        try ( HelloWorldExample greeter = new HelloWorldExample( "bolt://localhost:7687", "neo4j", "test" ) )
        {
            greeter.printGreeting( "hello, world" );
        }
    }
}

```
<p>When I try to run the HelloWorldExample this is what I get</p>
```Jan 10, 2023 11:11:03 AM org.neo4j.driver.internal.logging.JULogger info
INFO: Direct driver instance 1113619023 created for server address localhost:7687
Jan 10, 2023 11:11:04 AM org.neo4j.driver.internal.logging.JULogger info
INFO: Closing connection pool towards localhost:7687
Exception in thread "main" org.neo4j.driver.v1.exceptions.ServiceUnavailableException: Connection to the database terminated. This can happen due to network instabilities, or due to restarts of the database
    at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:123)
    at org.neo4j.driver.internal.DriverFactory.verifyConnectivity(DriverFactory.java:349)
    at org.neo4j.driver.internal.DriverFactory.newInstance(DriverFactory.java:95)
    at org.neo4j.driver.v1.GraphDatabase.driver(GraphDatabase.java:141)
    at org.neo4j.driver.v1.GraphDatabase.driver(GraphDatabase.java:124)
    at org.neo4j.driver.v1.GraphDatabase.driver(GraphDatabase.java:99)
    at neo.question.HelloWorldExample.<init>(HelloWorldExample.java:12)
    at neo.question.HelloWorldExample.main(HelloWorldExample.java:43)
    Suppressed: org.neo4j.driver.internal.util.ErrorUtil$InternalExceptionCause
        at org.neo4j.driver.internal.util.ErrorUtil.newConnectionTerminatedError(ErrorUtil.java:50)
        at org.neo4j.driver.internal.async.HandshakeHandler.channelInactive(HandshakeHandler.java:81)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
        at org.neo4j.driver.internal.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:392)
        at org.neo4j.driver.internal.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:357)
        at org.neo4j.driver.internal.shaded.io.netty.handler.ssl.SslHandler.channelInactive(SslHandler.java:1074)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
        at org.neo4j.driver.internal.shaded.io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:81)
        at org.neo4j.driver.internal.shaded.io.netty.handler.timeout.IdleStateHandler.channelInactive(IdleStateHandler.java:277)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
        at org.neo4j.driver.internal.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1405)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
        at org.neo4j.driver.internal.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:901)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:813)
        at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
        at org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
        at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
        at org.neo4j.driver.internal.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:829)

> Task :app:HelloWorldExample.main() FAILED

```

Body:
I have to integrate into a current java8 container some limited neo4j functionality but I'm not able to build a simple hello world example.

Created a simple demo app

gradle init \
--project-name neo-question \
--type java-application \
--package neo.question \
--test-framework junit \
--dsl groovy

I have added source and target compatibility with java 8 and also a dependency to the org.neo4j.driver:neo4j-java-driver:1.7.6 and this is how my build.gradle looks like

plugins {
    id 'application'
}

sourceCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8

repositories {
    jcenter()
}

dependencies {
    testImplementation 'junit:junit:4.13'
    implementation 'com.google.guava:guava:29.0-jre'
    implementation 'org.neo4j.driver:neo4j-java-driver:1.7.6'
}

application {
    mainClass = 'neo.question.App'
}

This is how I start my neo docker to perform this test and I can connect to it from a java11 compatible code

docker run \
    --name testneo4j \
    -p7474:7474 -p7687:7687 \
    -d \
    -v $HOME/neo4j/data:/data \
    -v $HOME/neo4j/logs:/logs \
    -v $HOME/neo4j/import:/var/lib/neo4j/import \
    -v $HOME/neo4j/plugins:/plugins \
    --env NEO4J_dbms_security_auth__minimum__password__length=4 \
    --env NEO4J_AUTH=neo4j/test \
    neo4j:latest

I'm using this example for 1.7.6 driver on how to connect: 1.7.6 overview

This is my java8 HelloWorldExample.Java class

package neo.question;

import org.neo4j.driver.v1.*;

import static org.neo4j.driver.v1.Values.parameters;

public class HelloWorldExample implements AutoCloseable{
    private final Driver driver;

    public HelloWorldExample(String uri, String user, String password )
    {
        driver = GraphDatabase.driver( uri, AuthTokens.basic( user, password ) );
    }

    @Override
    public void close() throws Exception
    {
        driver.close();
    }

    public void printGreeting( final String message )
    {
        try ( Session session = driver.session() )
        {
            String greeting = session.writeTransaction( new TransactionWork<String>()
            {
                @Override
                public String execute( Transaction tx )
                {
                    StatementResult result = tx.run( "CREATE (a:Greeting) " +
                                    "SET a.message = $message " +
                                    "RETURN a.message + ', from node ' + id(a)",
                            parameters( "message", message ) );
                    return result.single().get( 0 ).asString();
                }
            } );
            System.out.println( greeting );
        }
    }

    public static void main( String... args ) throws Exception
    {
        try ( HelloWorldExample greeter = new HelloWorldExample( "bolt://localhost:7687", "neo4j", "test" ) )
        {
            greeter.printGreeting( "hello, world" );
        }
    }
}

When I try to run the HelloWorldExample this is what I get

Jan 10, 2023 11:11:03 AM org.neo4j.driver.internal.logging.JULogger info
INFO: Direct driver instance 1113619023 created for server address localhost:7687
Jan 10, 2023 11:11:04 AM org.neo4j.driver.internal.logging.JULogger info
INFO: Closing connection pool towards localhost:7687
Exception in thread "main" org.neo4j.driver.v1.exceptions.ServiceUnavailableException: Connection to the database terminated. This can happen due to network instabilities, or due to restarts of the database
    at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:123)
    at org.neo4j.driver.internal.DriverFactory.verifyConnectivity(DriverFactory.java:349)
    at org.neo4j.driver.internal.DriverFactory.newInstance(DriverFactory.java:95)
    at org.neo4j.driver.v1.GraphDatabase.driver(GraphDatabase.java:141)
    at org.neo4j.driver.v1.GraphDatabase.driver(GraphDatabase.java:124)
    at org.neo4j.driver.v1.GraphDatabase.driver(GraphDatabase.java:99)
    at neo.question.HelloWorldExample.<init>(HelloWorldExample.java:12)
    at neo.question.HelloWorldExample.main(HelloWorldExample.java:43)
    Suppressed: org.neo4j.driver.internal.util.ErrorUtil$InternalExceptionCause
        at org.neo4j.driver.internal.util.ErrorUtil.newConnectionTerminatedError(ErrorUtil.java:50)
        at org.neo4j.driver.internal.async.HandshakeHandler.channelInactive(HandshakeHandler.java:81)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
        at org.neo4j.driver.internal.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:392)
        at org.neo4j.driver.internal.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:357)
        at org.neo4j.driver.internal.shaded.io.netty.handler.ssl.SslHandler.channelInactive(SslHandler.java:1074)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
        at org.neo4j.driver.internal.shaded.io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:81)
        at org.neo4j.driver.internal.shaded.io.netty.handler.timeout.IdleStateHandler.channelInactive(IdleStateHandler.java:277)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
        at org.neo4j.driver.internal.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1405)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
        at org.neo4j.driver.internal.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:901)
        at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:813)
        at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
        at org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
        at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
        at org.neo4j.driver.internal.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:829)

> Task :app:HelloWorldExample.main() FAILED


问:
am trying to import a ModuleWithProviders in my standalone component but am getting errors, is there another way of importing them

am trying to import TranslateModule.forRoot({}) in my standalone component but it is giving me the error below

```<code>Type 'ModuleWithProviders<TranslateModule>' is not assignable to type 'readonly any[] | Type<any>
</code>```

here is my component.ts

```<code>        @Component({
          selector: 'app-navbar',
          templateUrl: './navbar.component.html',
          styleUrls: ['./navbar.component.scss'],
          standalone:true,
          imports:[
            CommonModule,
            FormsModule,

            // ModuleWithProviders
            TranslateModule.forRoot({
              loader:{
                provide:TranslateLoader,
                useFactory:TranslateHttpLoader,
                deps:[HttpClient]
              }
            })

          ]
        })
</code>```

Body:
am trying to import TranslateModule.forRoot({}) in my standalone component but it is giving me the error below

Type 'ModuleWithProviders<TranslateModule>' is not assignable to type 'readonly any[] | Type<any>

here is my component.ts

        @Component({
          selector: 'app-navbar',
          templateUrl: './navbar.component.html',
          styleUrls: ['./navbar.component.scss'],
          standalone:true,
          imports:[
            CommonModule,
            FormsModule,

            // ModuleWithProviders
            TranslateModule.forRoot({
              loader:{
                provide:TranslateLoader,
                useFactory:TranslateHttpLoader,
                deps:[HttpClient]
              }
            })

          ]
        })


问:
Why is VS Code running python files but in certain window highlighting syntax only half-way and not linting
For a couple of days now my vs code (on mac) stopped linting and half-way syntax highlighting python files. I usually work with 3 windows and the weird thing is that it is happing only inside one of them. The code runs by the way. But no auto-completion, variables are grey etc..
I changed the python env, I disabled diverse extension, but it doesn't help.
Sometimes I observe vs code analysing 1 file - feels like it does it forever..

What could be the problem?

Here's a screenshot of the imported modules - they should be green

Here's a screenshot of some code:


问:
Changing cell color based on date from another cell in another tab, on the smae google sheet
#So, I have 2 tabs, on one tab, is a "Server List" tab and the other tab "Hard Drives"

On the HARD DRIVES tab is a list of hard drives, with ID numbers and warranty expiration Date.

On the SERVER tab, I have cells that have to display the ID of the hard drive.

I want to display on the SERVERS tab in the cells, the ID of a hard drive and also to change color from  white to red, based on the proximity of the expiration date.

Any thoughts or help is appreciated.

I can't seem to figure it out with conditional formatting.


问:
npm dev run generates huge main.js file
I have a Django application and trying to rewrite my JS frontend to React. I found some tutorial how to organize the structure of React app:

frontend/

static/frontend/main.js/main.js

src/

index.js

components/App.js

package.json

```<code>    {
  "name": "frontend",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "presets": [
    "@babel/preset-env",
    "@babel/preset-react"
  ],
  "scripts": {
    "dev": "webpack --mode development ./src/index.js --output-path ./static/frontend/main.js",
    "build": "webpack --mode production ./src/index.js --output-path ./static/frontend/main.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.20.12",
    "@babel/preset-env": "^7.20.2",
    "@babel/preset-react": "^7.18.6",
    "babel-loader": "^9.1.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "webpack": "^5.75.0",
    "webpack-cli": "^5.0.1"
  },
  "dependencies": {
    "fs-promise": "^2.0.3"
  }
}
</code>```

webpack.config.js

```<code>module.exports = {
  devtool: false,
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: { presets: ['@babel/env','@babel/preset-react'] },
        }
      }
    ]
  }
};
</code>```

index.html

```<code><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Django REST with React</title>
</head>
<body>
<h1>Anything</h1>
<div id="app">
    <!-- React will load here -->
</div>
</body>
{% load static %}
<script src="{% static "frontend/main.js/main.js" %}"></script>
</html>
</code>```

sample code in App.js

```<code>import React from 'react';
import ReactDOM from 'react-dom';

 function App() {
       const [value, setValue] = React.useState(0);

       function increment() {
         setValue(value + 1);
       }

       return (
         <div className="app">
           <h1>{value}</h1>
           <button onClick={increment}>+1</button>
         </div>
       );
     }

     ReactDOM.render(
       <div>
         <App />
       </div>,
       document.getElementById("root")
     );

const container = document.getElementById("app");
ReactDOM.render(<App />, container);
</code>```

If I got it right, any React component imported in index.js will be compiled to js code in main.js which is included to index.html. I created a simple code in App.js just to try it and it does work, but it generates a 30k lines main.js file. Is it normal? I guess it shouldn't be like this since it consumes much more resources than my 400-lines js code, so what am I doing wrong ?part of code in main.js

Title: npm dev run generates huge main.js file

Body:
I have a Django application and trying to rewrite my JS frontend to React. I found some tutorial how to organize the structure of React app:

frontend/

static/frontend/main.js/main.js

src/

index.js

components/App.js

package.json

    {
  "name": "frontend",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "presets": [
    "@babel/preset-env",
    "@babel/preset-react"
  ],
  "scripts": {
    "dev": "webpack --mode development ./src/index.js --output-path ./static/frontend/main.js",
    "build": "webpack --mode production ./src/index.js --output-path ./static/frontend/main.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.20.12",
    "@babel/preset-env": "^7.20.2",
    "@babel/preset-react": "^7.18.6",
    "babel-loader": "^9.1.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "webpack": "^5.75.0",
    "webpack-cli": "^5.0.1"
  },
  "dependencies": {
    "fs-promise": "^2.0.3"
  }
}

webpack.config.js

module.exports = {
  devtool: false,
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: { presets: ['@babel/env','@babel/preset-react'] },
        }
      }
    ]
  }
};

index.html

<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Django REST with React</title>

Anything

{% load static %}

sample code in App.js

import React from 'react';
import ReactDOM from 'react-dom';

 function App() {
       const [value, setValue] = React.useState(0);

       function increment() {
         setValue(value + 1);
       }

       return (

{value}

           <button onClick={increment}>+1</button>

       );
     }

     ReactDOM.render(

         <App />

,
       document.getElementById("root")
     );

const container = document.getElementById("app");
ReactDOM.render(<App />, container);

If I got it right, any React component imported in index.js will be compiled to js code in main.js which is included to index.html. I created a simple code in App.js just to try it and it does work, but it generates a 30k lines main.js file. Is it normal? I guess it shouldn't be like this since it consumes much more resources than my 400-lines js code, so what am I doing wrong ?part of code in main.js


问:
How to set Focus on new row after TAB Pressed in the last row in C# WPF DataGrid?
I'm using C# WPF ,
I have a DataGrid that is bound to an ObservableCollection , I want to keep focus on DataGrid's row when user is entering value with keyboard on DataGrid, I mean when last row is focused after value entered , instead of lost focus on Datagrid let's go to focus on the next row

also I want to use enter instead of TAB

but these solutions in stack overflow doesn't work for me ! :
WPF DataGrid - How to stay focused on the bottom of the DataGrid as new rows are added?

.

What have I tried :

1- First case:

```<code>private void DGR_SUB_INVOLST_LoadingRow(object sender, DataGridRowEventArgs e)
{

  if (YOUR_DATA_GRID.Items.Count > 0 && YOUR_DATA_GRID != null)
    {
         //___________This piece of code is to go to the next line with enter for a single line that is entered for the first time and not to focus on the new line.
             bool ISOK = true;
             //If there is no more than one line
             // The reason for minus 2 is that because we gave something to it in Add New Item, a new line is added, so if we see 1 line
             //It means that the number of items is 2, item zero, the first line, item 1, a new line named New Place Holder
            if (YOUR_DATA_GRID.Items.Count - 2 <= 2)
            {
               //Don't get null error from where you delete the line and then refresh
                if (!(YOUR_DATA_GRID.Items[0] as CUSTOM_MODEL is null))
                {
                   // if is new
                    if ((YOUR_DATA_GRID.Items[0] as CUSTOM_MODEL).id is null)
                    {
                        ISOK = false;
                        return;
                    }
                }
            }
           //If the above condition is not met and there is also the last line, let's put the focus on the new line
            if (ISOK)
            {
                if ((YOUR_DATA_GRID.Items.Count - 2) == CURRENT_ROW_INDEX)
                {
                    e.Row.Loaded += Row_Loaded;
                }
            }
        }

        }
        void Row_Loaded(object sender, RoutedEventArgs e)
        {
            YOUR_DATA_GRID.SelectedItem = YOUR_DATA_GRID.Items[YOUR_DATA_GRID.Items.Count - 1];
            YOUR_DATA_GRID.ScrollIntoView(YOUR_DATA_GRID.Items[YOUR_DATA_GRID.Items.Count - 1]);
            DataGridRow dgrow = (DataGridRow)YOUR_DATA_GRID.ItemContainerGenerator.ContainerFromItem(YOUR_DATA_GRID.Items[YOUR_DATA_GRID.Items.Count - 1]);
            dgrow.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
        }
</code>```

2- Second case:

Using below method in these events :

RowEditEnding

AddingNewItem

interestingly this code doesn't work to focus on the next row !:

```<code> var IIDEX = CURRENT_ROW_INDEX + 1;

        if (IIDEX > YOUR_DATA_GRID.Items.Count - 1)
        {
            IIDEX = 0;
        }
        DataGridRow row = (DataGridRow)YOUR_DATA_GRID.ItemContainerGenerator.ContainerFromIndex(IIDEX);
        if (row is null)
        {
            YOUR_DATA_GRID.ScrollIntoView(YOUR_DATA_GRID.Items[IIDEX]);
            row = (DataGridRow)YOUR_DATA_GRID.ItemContainerGenerator.ContainerFromIndex(IIDEX);
            object item = YOUR_DATA_GRID.Items[IIDEX];
            YOUR_DATA_GRID.SelectedItem = item;
            row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

        }
        else
        {
            object item = YOUR_DATA_GRID.Items[IIDEX];
            YOUR_DATA_GRID.SelectedItem = item;
            YOUR_DATA_GRID.ScrollIntoView(item);
            row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
        }
</code>```

all of thing's that I've tried, didn't work

My Full Source code + Database SQL Server:
https://mega.nz/file/w5ZyzbzZ#26LW3lHyO72EJnVKlzldpCczB9ePQl7gmf0xQMKEV2k

NOTE:↑ in that source code I removed my tries for Focus On next row ,

please guide me how do I do that

Body:
I'm using C# WPF ,
I have a DataGrid that is bound to an ObservableCollection , I want to keep focus on DataGrid's row when user is entering value with keyboard on DataGrid, I mean when last row is focused after value entered , instead of lost focus on Datagrid let's go to focus on the next row

also I want to use enter instead of TAB

but these solutions in stack overflow doesn't work for me ! :
WPF DataGrid - How to stay focused on the bottom of the DataGrid as new rows are added?

.

What have I tried :

1- First case:

private void DGR_SUB_INVOLST_LoadingRow(object sender, DataGridRowEventArgs e)
{

  if (YOUR_DATA_GRID.Items.Count > 0 && YOUR_DATA_GRID != null)
    {
         //___________This piece of code is to go to the next line with enter for a single line that is entered for the first time and not to focus on the new line.
             bool ISOK = true;
             //If there is no more than one line
             // The reason for minus 2 is that because we gave something to it in Add New Item, a new line is added, so if we see 1 line
             //It means that the number of items is 2, item zero, the first line, item 1, a new line named New Place Holder
            if (YOUR_DATA_GRID.Items.Count - 2 <= 2)
            {
               //Don't get null error from where you delete the line and then refresh
                if (!(YOUR_DATA_GRID.Items[0] as CUSTOM_MODEL is null))
                {
                   // if is new
                    if ((YOUR_DATA_GRID.Items[0] as CUSTOM_MODEL).id is null)
                    {
                        ISOK = false;
                        return;
                    }
                }
            }
           //If the above condition is not met and there is also the last line, let's put the focus on the new line
            if (ISOK)
            {
                if ((YOUR_DATA_GRID.Items.Count - 2) == CURRENT_ROW_INDEX)
                {
                    e.Row.Loaded += Row_Loaded;
                }
            }
        }

        }
        void Row_Loaded(object sender, RoutedEventArgs e)
        {
            YOUR_DATA_GRID.SelectedItem = YOUR_DATA_GRID.Items[YOUR_DATA_GRID.Items.Count - 1];
            YOUR_DATA_GRID.ScrollIntoView(YOUR_DATA_GRID.Items[YOUR_DATA_GRID.Items.Count - 1]);
            DataGridRow dgrow = (DataGridRow)YOUR_DATA_GRID.ItemContainerGenerator.ContainerFromItem(YOUR_DATA_GRID.Items[YOUR_DATA_GRID.Items.Count - 1]);
            dgrow.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
        }

2- Second case:

Using below method in these events :

RowEditEnding

AddingNewItem

interestingly this code doesn't work to focus on the next row !:

 var IIDEX = CURRENT_ROW_INDEX + 1;

        if (IIDEX > YOUR_DATA_GRID.Items.Count - 1)
        {
            IIDEX = 0;
        }
        DataGridRow row = (DataGridRow)YOUR_DATA_GRID.ItemContainerGenerator.ContainerFromIndex(IIDEX);
        if (row is null)
        {
            YOUR_DATA_GRID.ScrollIntoView(YOUR_DATA_GRID.Items[IIDEX]);
            row = (DataGridRow)YOUR_DATA_GRID.ItemContainerGenerator.ContainerFromIndex(IIDEX);
            object item = YOUR_DATA_GRID.Items[IIDEX];
            YOUR_DATA_GRID.SelectedItem = item;
            row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

        }
        else
        {
            object item = YOUR_DATA_GRID.Items[IIDEX];
            YOUR_DATA_GRID.SelectedItem = item;
            YOUR_DATA_GRID.ScrollIntoView(item);
            row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
        }

all of thing's that I've tried, didn't work

My Full Source code + Database SQL Server:
https://mega.nz/file/w5ZyzbzZ#26LW3lHyO72EJnVKlzldpCczB9ePQl7gmf0xQMKEV2k

NOTE:↑ in that source code I removed my tries for Focus On next row ,

please guide me how do I do that


问:
Shrink inner grid column to zero if it has no content
In the following example mid-left and mid-right should equally share space left by all other elements. But if there is only one of them, it should take all this space. It's not known which of them would be present. Supporting of gap is NOT needed.

I can make this only via :has selector. How can I make the same thing without it?

Markup should NOT be changed. Otherwice I would wrap mid-left and mid-right into container and used flex or grid-auto-columns: 1fr on it.

Here are 5 examples how it should work:

section {
  display: grid;
  grid-template: "l t  t  t" 2em
                 "l mt mt r" 1fr
                 "l ml mr r" 1fr / 5em 1fr 1fr 5em;
  min-height: 8em;
}

section + section {
  margin-top: 2em;
}

div {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.left      { grid-area: l;  background: antiquewhite; }
.top       { grid-area: t;  background: silver;       }
.right     { grid-area: r;  background: antiquewhite; }
.mid-top   { grid-area: mt; background: yellow;       }
.mid-left  { grid-area: ml; background: aquamarine;   }
.mid-right { grid-area: mr; background: lightsalmon;  }

section:not(:has(.mid-left)) {
  grid-template-columns: 5em 0 1fr 5em;
}

section:not(:has(.mid-right)) {
  grid-template-columns: 5em 1fr 0 5em;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><section>
  <div class="left">Left</div>
  <div class="top">Top</div>
  <div class="right">Right</div>

  <div class="mid-top">Mid top</div>
  <div class="mid-left">Mid left takes half of space</div>
  <div class="mid-right">Mid right takes half of space</div>
</section>

<section>
  <div class="left">Left</div>
  <div class="top">Top</div>
  <div class="right">Right</div>

  <div class="mid-top">Mid top</div>
  <div class="mid-left">Mid left should take all width</div>
</section>

<section>
  <div class="left">Left</div>
  <div class="top">Top</div>
  <div class="right">Right</div>

  <div class="mid-top">Mid top</div>
  <div class="mid-right">Mid right should take all width</div>
</section>

<section>
  <div class="left">Left</div>
  <div class="top">Top</div>
  <div class="right">Right</div>

  <div class="mid-top">Mid top</div>
  <div class="mid-left">Mid left should have equal width even if it has more content</div>
  <div class="mid-right">Mid right</div>
</section>

<section>
  <div class="left">Left</div>
  <div class="top">Top</div>
  <div class="right">Right</div>

  <div class="mid-top">Mid top</div>
  <div class="mid-left">Mid left</div>
  <div class="mid-right">Mid right should have equal width even if it has more content</div>
</section></code>```

PS: Actually I have several divs with display: contents on them and the elements mid-left and mid-right are not on the same level.

PPS: Anyway, I think answers based on provided markup are usefull for future viewers or maybe even for me if I could adopt selectors.

Actually I was not going to add examples with wrappers into the question, but as I was asked, here they are:

section {
  display: grid;
  grid-template: "l t  t  t" 2em
                 "l mt mt r" 1fr
                 "l ml mr r" 1fr / 5em 1fr 1fr 5em;
  min-height: 8em;
}

section + section {
  margin-top: 2em;
}

div {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

some-wrapper {
  display: contents;
}

.left      { grid-area: l;  background: antiquewhite; }
.top       { grid-area: t;  background: silver;       }
.right     { grid-area: r;  background: antiquewhite; }
.mid-top   { grid-area: mt; background: yellow;       }
.mid-left  { grid-area: ml; background: aquamarine;   }
.mid-right { grid-area: mr; background: lightsalmon;  }

section:not(:has(.mid-left)) {
  grid-template-columns: 5em 0 1fr 5em;
}

section:not(:has(.mid-right)) {
  grid-template-columns: 5em 1fr 0 5em;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><section>
  <div class="left">Left</div>

  <some-wrapper>
    <div class="top">Top</div>
    <div class="right">Right</div>
    <div class="mid-top">Mid top</div>
    <div class="mid-right">Mid right</div>
  </some-wrapper>

  <some-wrapper>
    <div class="mid-left">Mid left</div>
  </some-wrapper>
</section>

<section>
  <div class="left">Left</div>

  <some-wrapper>
    <div class="top">Top</div>
    <div class="right">Right</div>
    <div class="mid-top">Mid top</div>
  </some-wrapper>

  <some-wrapper>
    <div class="mid-left">Mid left</div>
  </some-wrapper>
</section>

<section>
  <div class="left">Left</div>

  <some-wrapper>
    <div class="top">Top</div>
    <div class="right">Right</div>
    <div class="mid-top">Mid top</div>
    <div class="mid-right">Mid right</div>
  </some-wrapper>

  <some-wrapper>
  </some-wrapper>
</section>

<section>
  <div class="left">Left</div>

  <some-wrapper>
    <div class="mid-right">Mid right</div>
    <div class="mid-top">Mid top</div>
    <div class="top">Top</div>
  </some-wrapper>

  <div class="right">Right</div>
</section>

<section>
  <div class="left">Left</div>
  <div class="top">Top</div>

  <some-wrapper>
    <div class="mid-right">Mid right</div>
    <div class="mid-top">Mid top</div>
  </some-wrapper>

  <some-wrapper>
    <div class="mid-left">Mid left</div>
  </some-wrapper>

  <div class="right">Right</div>
</section></code>```

Same question in Russian.

Body:
In the following example mid-left and mid-right should equally share space left by all other elements. But if there is only one of them, it should take all this space. It's not known which of them would be present. Supporting of gap is NOT needed.

I can make this only via :has selector. How can I make the same thing without it?

Markup should NOT be changed. Otherwice I would wrap mid-left and mid-right into container and used flex or grid-auto-columns: 1fr on it.

Here are 5 examples how it should work:

section {
  display: grid;
  grid-template: "l t  t  t" 2em
                 "l mt mt r" 1fr
                 "l ml mr r" 1fr / 5em 1fr 1fr 5em;
  min-height: 8em;
}

section + section {
  margin-top: 2em;
}

div {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.left      { grid-area: l;  background: antiquewhite; }
.top       { grid-area: t;  background: silver;       }
.right     { grid-area: r;  background: antiquewhite; }
.mid-top   { grid-area: mt; background: yellow;       }
.mid-left  { grid-area: ml; background: aquamarine;   }
.mid-right { grid-area: mr; background: lightsalmon;  }

section:not(:has(.mid-left)) {
  grid-template-columns: 5em 0 1fr 5em;
}

section:not(:has(.mid-right)) {
  grid-template-columns: 5em 1fr 0 5em;
}

Left

Top

Right

Mid top

Mid left takes half of space

Mid right takes half of space

Left

Top

Right

Mid top

Mid left should take all width

Left

Top

Right

Mid top

Mid right should take all width

Left

Top

Right

Mid top

Mid left should have equal width even if it has more content

Mid right

Left

Top

Right

Mid top

Mid left

Mid right should have equal width even if it has more content

PS: Actually I have several divs with display: contents on them and the elements mid-left and mid-right are not on the same level.

PPS: Anyway, I think answers based on provided markup are usefull for future viewers or maybe even for me if I could adopt selectors.

Actually I was not going to add examples with wrappers into the question, but as I was asked, here they are:

section {
  display: grid;
  grid-template: "l t  t  t" 2em
                 "l mt mt r" 1fr
                 "l ml mr r" 1fr / 5em 1fr 1fr 5em;
  min-height: 8em;
}

section + section {
  margin-top: 2em;
}

div {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

some-wrapper {
  display: contents;
}

.left      { grid-area: l;  background: antiquewhite; }
.top       { grid-area: t;  background: silver;       }
.right     { grid-area: r;  background: antiquewhite; }
.mid-top   { grid-area: mt; background: yellow;       }
.mid-left  { grid-area: ml; background: aquamarine;   }
.mid-right { grid-area: mr; background: lightsalmon;  }

section:not(:has(.mid-left)) {
  grid-template-columns: 5em 0 1fr 5em;
}

section:not(:has(.mid-right)) {
  grid-template-columns: 5em 1fr 0 5em;
}

Left

  <some-wrapper>

Top

Right

Mid top

Mid right

  </some-wrapper>

  <some-wrapper>

Mid left

  </some-wrapper>

Left

  <some-wrapper>

Top

Right

Mid top

  </some-wrapper>

  <some-wrapper>

Mid left

  </some-wrapper>

Left

  <some-wrapper>

Top

Right

Mid top

Mid right

  </some-wrapper>

  <some-wrapper>
  </some-wrapper>

Left

  <some-wrapper>

Mid right

Mid top

Top

  </some-wrapper>

Right

Left

Top

  <some-wrapper>

Mid right

Mid top

  </some-wrapper>

  <some-wrapper>

Mid left

  </some-wrapper>

Right

Same question in Russian.


问:
Error "Expecting value: line 1 column 1 (char 0)" in postman while generating token through a post Api
```<code>@api_view(["POST"])
@permission_classes([AllowAny])
def LoginView(request):

        data = {}
        details = request.body
        reqBody = json.loads(details)
        username = reqBody['username']
        password = reqBody['password']

</code>```

Inside 'details' I am getting a Form-Data instead of string due to which getting above error
if any suggestion . How to convert 'form-data' in 'string' Or directly convert 'form-data' to 'string'

I tried

```<code>details = request.body
reqBody = json.loads(details.decode('utf-8')
</code>```

But it gives the same error .

Body:
@api_view(["POST"])
@permission_classes([AllowAny])
def LoginView(request):

        data = {}
        details = request.body
        reqBody = json.loads(details)
        username = reqBody['username']
        password = reqBody['password']

Inside 'details' I am getting a Form-Data instead of string due to which getting above error
if any suggestion . How to convert 'form-data' in 'string' Or directly convert 'form-data' to 'string'

I tried

details = request.body
reqBody = json.loads(details.decode('utf-8')

But it gives the same error .


问:
Installing package with pnpm broke Next.js (or corrupted pnpm install)
I just installed a new package (Radix-UI) in a Next.js project I was working on with no issues and suddenly all Next imports throw cannot find module errors and I cannot launch the project.

*edit: Just noticed other imports such as fs, path or css modules don't work either and JSX elements say JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

I did the following:

pnpm install @radix-ui/react-popover@latest -E

This threw two errors while installing:

```<code>ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/pnpm: request to https://registry.npmjs.org/pnpm failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/@radix-ui%2Freact-popover: request to https://registry.npmjs.org/@radix-ui%2Freact-popover failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
</code>```

I believe at this point the Next.js imports were already broken.

After noticing nothing had changed in package.json and remembering the pnpm equivalent of "npm install" is actually "npm add" I did the following:

pnpm add @radix-ui/react-popover@latest -E

This got me another error:

```<code>ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/eslint-config-prettier: request to https://registry.npmjs.org/eslint-config-prettier failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
</code>```

Since no changes are reflected in the code (and therefore git reset HEAD --hard does nothing), I am assuming something got corrupted with pnpm, but I am very new to both Next and pnpm, so I am a bit clueless here. Any idea what might be the problem?

*If relevant, I am working in a WSL2 Ubuntu instance.

Body:
I just installed a new package (Radix-UI) in a Next.js project I was working on with no issues and suddenly all Next imports throw cannot find module errors and I cannot launch the project.

*edit: Just noticed other imports such as fs, path or css modules don't work either and JSX elements say JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

I did the following:

pnpm install @radix-ui/react-popover@latest -E

This threw two errors while installing:

ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/pnpm: request to https://registry.npmjs.org/pnpm failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/@radix-ui%2Freact-popover: request to https://registry.npmjs.org/@radix-ui%2Freact-popover failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

I believe at this point the Next.js imports were already broken.

After noticing nothing had changed in package.json and remembering the pnpm equivalent of "npm install" is actually "npm add" I did the following:

pnpm add @radix-ui/react-popover@latest -E

This got me another error:

ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/eslint-config-prettier: request to https://registry.npmjs.org/eslint-config-prettier failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

Since no changes are reflected in the code (and therefore git reset HEAD --hard does nothing), I am assuming something got corrupted with pnpm, but I am very new to both Next and pnpm, so I am a bit clueless here. Any idea what might be the problem?

*If relevant, I am working in a WSL2 Ubuntu instance.


问:
navigation bar shifting to down right when changing to mobile view
Every time I change to mobile view the navigation bar shifts a bit to down right.

I´m relative new to web development and I am really at a loss here I have tried a bunch of things but I end up encountering the similar problem. Here is what I have tried so far.

```<code>header nav ul{
  list-style: none;
  display: inline-block;
  padding: 0 22px;
  margin: 0;
  justify-content: space-between;
  text-align: right;
  position: relative;
}

.navbar{
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px;
background-color: rgb(192, 192, 192);
color: #fff;
}

nav ul li a{
  color: #000000;
  text-decoration: none;
  font-size: 1.2rem;
  text-transform: uppercase;
}
</code>```

Body:
Every time I change to mobile view the navigation bar shifts a bit to down right.

I´m relative new to web development and I am really at a loss here I have tried a bunch of things but I end up encountering the similar problem. Here is what I have tried so far.

header nav ul{
  list-style: none;
  display: inline-block;
  padding: 0 22px;
  margin: 0;
  justify-content: space-between;
  text-align: right;
  position: relative;
}

.navbar{
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px;
background-color: rgb(192, 192, 192);
color: #fff;
}

nav ul li a{
  color: #000000;
  text-decoration: none;
  font-size: 1.2rem;
  text-transform: uppercase;
}


问:
AutoMapper map additional object
I have a CustomerGroupDTO with the properties:

```<code>public string Type { get; set; }

public string Code { get; set; }

public string CustomerType { get; set; }
</code>```

This DTO is being used when sending the API request. As you can see, the CustomerType here is a string!

Now when the request is being processed, I'm checking if the CustomerType (ID, this is not mentioned here, but in fact, it is kind of a guid) already exists. If it doesn't exist, I'm returning a badrequest. If it exists, I'm browsing the database and find the CustomerType and collect the CustomerType Object, which consists of.

```<code>[Key]
public int Id { get; set; }

[Required]
public string ...TypeName { get; set; }

[Required]
public string ....TypeName { get; set; }

public List<...Group> ...Groups { get; set; }
</code>```

Until here, everything is fine and works, but now I want to Map the CustomerGroupDTO to the CustomerGroup Object. The CustomerGroup object itself contains the following:

```<code>public string Code { get; set; }

public bool IsDynamic { get; set; }

public List<Company> Companies { get; set; }

[Required]
public CustomerType CustomerType { get; set; }
</code>```

You can see, it expects a CustomerType Object and not just the string, which I do have in my DTO. So my question now is, HOW do I pass in the mapping to the CustomerType Object I have created within the POST Request. I did not find any information on how to pass in a parameter (in my case an Object) and map it to the destination. CustomerType attribute?

Title: AutoMapper map additional object

Body:
I have a CustomerGroupDTO with the properties:

public string Type { get; set; }

public string Code { get; set; }

public string CustomerType { get; set; }

This DTO is being used when sending the API request. As you can see, the CustomerType here is a string!

Now when the request is being processed, I'm checking if the CustomerType (ID, this is not mentioned here, but in fact, it is kind of a guid) already exists. If it doesn't exist, I'm returning a badrequest. If it exists, I'm browsing the database and find the CustomerType and collect the CustomerType Object, which consists of.

[Key]
public int Id { get; set; }

[Required]
public string ...TypeName { get; set; }

[Required]
public string ....TypeName { get; set; }

public List<...Group> ...Groups { get; set; }

Until here, everything is fine and works, but now I want to Map the CustomerGroupDTO to the CustomerGroup Object. The CustomerGroup object itself contains the following:

public string Code { get; set; }

public bool IsDynamic { get; set; }

public List<Company> Companies { get; set; }

[Required]
public CustomerType CustomerType { get; set; }

You can see, it expects a CustomerType Object and not just the string, which I do have in my DTO. So my question now is, HOW do I pass in the mapping to the CustomerType Object I have created within the POST Request. I did not find any information on how to pass in a parameter (in my case an Object) and map it to the destination. CustomerType attribute?


问:
PrismicRichText not displaying anything
I have the following barebones component:

```<code><template>
  <div v-for="blog in blogs">
    <h1 class="text-lg font-medium">{{ blog.title[0].text }}</h1>
    <div v-if="blog">
      <PrismicRichText :field="blog.body" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import { usePrismic } from "@prismicio/vue";
import { PrismicRichText } from "@prismicio/vue";

const { client, predicate } = usePrismic();

const blogs = ref({});
async function getContent() {
  const res = await client.getByType("post");
  blogs.value = res.results.map((blog: any) => blog.data);
}

onMounted(getContent);
</script>

<style scoped></style>
</code>```

When running this, the title is displayed just fine, but the body isn't displayed at all. I see the two nested div's being displayed, but there's no content. When logging the body, it is looking correctly, an array of objects. What am I doing wrong here?

Title: PrismicRichText not displaying anything

Body:
I have the following barebones component:

<template>

{{ blog.title[0].text }}

      <PrismicRichText :field="blog.body" />

</template>

When running this, the title is displayed just fine, but the body isn't displayed at all. I see the two nested div's being displayed, but there's no content. When logging the body, it is looking correctly, an array of objects. What am I doing wrong here?


问:
Do I have to explicitly dispose a Microsoft.Extensions.Logging.BeginScope?
I have got a series of hangfire jobs and I put in the constructor this piece of code, to use with Serilog/Seq

```<code> public CheckoutExternalToursBookingJob(
      ...omiss...
        ILogger<CheckoutExternalToursBookingJob> logger,
        IEmailSender emailSender)
    {
      ...omiss...
        _logger = logger;
        _emailSender = emailSender;

        _logger.BeginScope(new Dictionary<string, object>
        {
            [CoreConstants.ApplicationName] = CoreConstants.HangFireApplicationName,
            [CoreConstants.HangFireJob] = JobName
        });
    }
</code>```

Now I use this to have for all the _logger.* logs that information filled.

Since the BeginScope returns an IDisposable should I save it to a local variable, then implement in my jobs the IDisposable interface and do scope.Dispose()?

Body:
I have got a series of hangfire jobs and I put in the constructor this piece of code, to use with Serilog/Seq

 public CheckoutExternalToursBookingJob(
      ...omiss...
        ILogger<CheckoutExternalToursBookingJob> logger,
        IEmailSender emailSender)
    {
      ...omiss...
        _logger = logger;
        _emailSender = emailSender;

        _logger.BeginScope(new Dictionary<string, object>
        {
            [CoreConstants.ApplicationName] = CoreConstants.HangFireApplicationName,
            [CoreConstants.HangFireJob] = JobName
        });
    }

Now I use this to have for all the _logger.* logs that information filled.

Since the BeginScope returns an IDisposable should I save it to a local variable, then implement in my jobs the IDisposable interface and do scope.Dispose()?


问:
How to make set choices with easygui from a list of files
python easygui glob

I am beginner in Python and try to write a script that would help the user to choose between existing files in a given folder and its sub-folders having a common format (bib files in that case).
I use easygui module to prompt a choicebox but meet the following issue :

The filenames added to the list are not translated into options in the easygui choicebox.

```<code>import os.path
filesPathList = []  # bib file path list
    fileNames = [] # file names list
    for file in Path(path).rglob('*.bib'): #search recursively bib files in folders under path
        if file:
            filesPathList.append(os.path.join(path, file)) # Add file paths to their list
            fileNames.append(os.path.basename(file)) # Add file names to their list
            print(fileNames)
            from easygui import *
            choices = fileNames
            msg = "choose your bib file"
            title = "bib file options"
            reply = choicebox(msg, choices = fileNames)
        else:
            print("no bib file found")
</code>```

I would have expected a box with these kind of options : file1.bib / file2.bib / file3.bib, etc.

But what I get is :

 File "C:\Program Files\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 43, in choicebox
    mb = ChoiceBox(msg, title, choices, preselect=preselect,
  File "C:\Program Files\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 125, in __init__
    self.choices = self.to_list_of_str(choices)
  File "C:\Program Files\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 184, in to_list_of_str
    raise ValueError('at least two choices need to be specified')
ValueError: at least two choices need to be specified

how could it be possible to set different bib files found in folder path and subfolders as options in the easygui box ?

Thank you in advance for your advice

Body:
python easygui glob

I am beginner in Python and try to write a script that would help the user to choose between existing files in a given folder and its sub-folders having a common format (bib files in that case).
I use easygui module to prompt a choicebox but meet the following issue :

The filenames added to the list are not translated into options in the easygui choicebox.

import os.path
filesPathList = []  # bib file path list
    fileNames = [] # file names list
    for file in Path(path).rglob('*.bib'): #search recursively bib files in folders under path
        if file:
            filesPathList.append(os.path.join(path, file)) # Add file paths to their list
            fileNames.append(os.path.basename(file)) # Add file names to their list
            print(fileNames)
            from easygui import *
            choices = fileNames
            msg = "choose your bib file"
            title = "bib file options"
            reply = choicebox(msg, choices = fileNames)
        else:
            print("no bib file found")

I would have expected a box with these kind of options : file1.bib / file2.bib / file3.bib, etc.

But what I get is :

 File "C:\Program Files\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 43, in choicebox
    mb = ChoiceBox(msg, title, choices, preselect=preselect,
  File "C:\Program Files\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 125, in __init__
    self.choices = self.to_list_of_str(choices)
  File "C:\Program Files\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 184, in to_list_of_str
    raise ValueError('at least two choices need to be specified')
ValueError: at least two choices need to be specified

how could it be possible to set different bib files found in folder path and subfolders as options in the easygui box ?

Thank you in advance for your advice


问:
jetpack compose ui self upgrade or hot fix
I am writing ui of an android game helper app. The ui must have the capacity of

self upgrade or hot fix. (not via app store)

smooth on low-end phones, usually android 7.0.
The app also has a jni lib, which can be upgrade from server then load.

I first tried webview for ui, because web tech can be serialized and upgrade, but the performance is bad on chrome 51(used in android 7.0). I also noticed flutter and RN are not as performant as jetpack compose. I tried compose, it's good and feature rich.

The problem is how to self upgrade compose ui. Compose is kotlin only and can't be constructed via jni. Compose will compiled into class.dex. I don't know how to upgrade class.dex to a new version.


问:
How to connect to amazon mysql aurora from google cloud function?
I need to fetch data from amazon mysql aurora inside google cloud function. How can I connect to mysql aurora from cloud function to do the same?

I am able to connect to mysql from my local system using mysql connector in python as below.

```<code>import mysql.connector
</code>```
```<code>cnx = mysql.connector.connect(user='user', password='password',host='host', database='db')
c_list = cnx.cursor()c_list.execute('select id, type from table ch limit 1')
</code>```

But it is not working inside cloud function.

Body:
I need to fetch data from amazon mysql aurora inside google cloud function. How can I connect to mysql aurora from cloud function to do the same?

I am able to connect to mysql from my local system using mysql connector in python as below.

import mysql.connector

cnx = mysql.connector.connect(user='user', password='password',host='host', database='db')
c_list = cnx.cursor()c_list.execute('select id, type from table ch limit 1')

But it is not working inside cloud function.


问:
merge node-list and edge-list in gephi
I have a question about Gephi.

I'm doing a project for my school, where I analyze a website using python. I decided to look into the moviesdatabase.org website. From the https://www.themoviedb.org website I extracted the most popular movies and out of these, I extracted the nodes. For the edges I considered the genre as a relationship (eg two films that share a genre, for example horror, are united by a relationship). Note: for simplicity I have considered only the first page of the most popular movies, in fact I have 20 as the number of nodes. In the node list I have 20 nodes and 0 arcs. In the edge list I have 15 nodes and 150 edges.

The problem is when I upload the node list first and then the edge list it doesn't recognize the node list on the edge list.

I have for example this:

and in the data laboratory I have this:

it is as if the node-list is separate from the edge-list. Why is this happening?

Title: merge node-list and edge-list in gephi


问:
docker run -v throws permission denied error
I am running a docker container with a volume mounted (-v) which is a mounted directory on network (NAS). This mount point has write access provisioned to the user which runs docker process on the server.
However when I run the container as docker run -v path1:path2:z  I get permission denied error on path1.

Error - docker: Error response from daemon: error while creating mount source path 'path1': mkdir 'path1': Permission Denied


问:
Mark as Resolved all alerts in gitlab project
How can i mark all gitlab alters as Resolved for my project?

There's no button to select and mark all alerts in monitor -> alerts


问:
Unexpected Visual C++ linker behavior regarding function exports, when an inline function is involved
We build a static library with Visual C++ (version 15 is used), and this library that has the following functions:

```<code>extern "C" void __stdcall Internal()
{
...
}

class SomeClass {
  inline void SomeFunc()
  {
    Internal(); // calling Internal here
  }
}
</code>```

When this static library is linked to an EXE, Internal gets exported from the EXE (i.e., one can see Internal in the EXE's exports). If we make SomeFunc not inline, Internal doesn't get exported.

Does anybody know why the "inline" modifier has an effect of an undesired export being generated?

Body:
We build a static library with Visual C++ (version 15 is used), and this library that has the following functions:

extern "C" void __stdcall Internal()
{
...
}

class SomeClass {
  inline void SomeFunc()
  {
    Internal(); // calling Internal here
  }
}

When this static library is linked to an EXE, Internal gets exported from the EXE (i.e., one can see Internal in the EXE's exports). If we make SomeFunc not inline, Internal doesn't get exported.

Does anybody know why the "inline" modifier has an effect of an undesired export being generated?


问:
How to point GCP Vertex AI training pipeline to new data location?
Is it possible to provide an argument to a GCP Vertex AI training pipeline that means it will take data from a new data source/location?

For example if you want to use one GBQ table for one run and another for the next run, is it possible to run the pipeline using the new table? Or should you create a different pipeline for the new table?