问:
Can I make a async call for hset in jedis in Apache Flink?
I am using the jedis to insert the records into Redis.
Firstly, I inserted the record into the redis as it came to our system with no delay.
However, I want to change the logic as below.

Instead of inserting the records as it arrives, I want to store it on the memory and want to flush it to the redis at the certain time (for example, the checkpointing time in Apache Flink).

I am using the jedis and made a work that connecting and inserting the records into jedis. And then, as explained above I want to change the logic as above.

I think that the total running time will be more longer because the data size to be inserted in redis is large. Therefore, for that part, I want to apply this logic by using the async function.

As java or scala has the async calls in their libs, so I think that I am able to achieve my scenario by adopting the async function for inserting records using hest function in redis.

Is is possible and easy way to achieve my goal?

Any comments will be appreciated for suggestion or advice for my issue.

Thanks.


来源: stackexchange

问:
Mongoose ObjectId schema type
I saved checkList model as an objectID type in user model.

```<code>export const addCheckList = async(req, res) => {
    const {
        body : { text },
        params : { id }
    } = req;
    console.log(text, id);
    const user = await User.findById(id);
    const checkList = await CheckList.create({
        text,
    })
    user.checkLists.push(checkList._id);
    user.save();
    req.session.user = user;
    console.log("In controller: ", user);
}
</code>```

So far, it is saved as an objectID type like this console.

Console Image

I saved it in session and bring it to locals to use its' data in template.

```<code>export const localsMiddleware = (req, res, next) => {
    res.locals.loggedIn = Boolean(req.session.loggedIn);
    res.locals.loggedInUser = req.session.user || {};
    console.log(`In middleware: ${res.locals.loggedInUser}`);
    next();
}
</code>```

However, when i bring user into locals, its' type changed as a string, so i can't get text data.

Console Image

I captured it before so there's one less id(string).

Here is my mongoose user schema and pug code.

Mongoose User Schema Image

Pug Code Image

How can i get a text data in pug template?

ContentLicense: CC BY-SA 4.0

Title: Mongoose ObjectId schema type

Body:
I saved checkList model as an objectID type in user model.

export const addCheckList = async(req, res) => {
    const {
        body : { text },
        params : { id }
    } = req;
    console.log(text, id);
    const user = await User.findById(id);
    const checkList = await CheckList.create({
        text,
    })
    user.checkLists.push(checkList._id);
    user.save();
    req.session.user = user;
    console.log("In controller: ", user);
}

So far, it is saved as an objectID type like this console.

Console Image

I saved it in session and bring it to locals to use its' data in template.

export const localsMiddleware = (req, res, next) => {
    res.locals.loggedIn = Boolean(req.session.loggedIn);
    res.locals.loggedInUser = req.session.user || {};
    console.log(`In middleware: ${res.locals.loggedInUser}`);
    next();
}

However, when i bring user into locals, its' type changed as a string, so i can't get text data.

Console Image

I captured it before so there's one less id(string).

Here is my mongoose user schema and pug code.

Mongoose User Schema Image

Pug Code Image

How can i get a text data in pug template?


问:
The output to a MaxPool Layer in a FCN
The input to a FCN is a 2D array of dimensions (1,48,28) as shown in the image below. The first layer is a Convulational layer with 64 kernels ans padding "same" and the output thus has the dimensions as that of the input but with 64 channels.

Image of the network

However, in the next MaxPool layer, with a kernel size of 2X2, and padding set to "Same", why is the dimension of the output decreasing. And how much is it?

Here is the first few lines of the code of the layers of the neural network.

```<code>main_input = Input(shape=main_input_shape,name='main_input')
x=Conv2D(64, kernel_size=(3,3),padding='same')(main_input)
x=MaxPooling2D(pool_size=(2,2),padding='same')(x) # 1
x=LeakyReLU(alpha=0.2)(x)
x=BatchNormalization(axis=-1,momentum=0.99,epsilon=0.001,center=True,scale=True,
beta_initializer='zeros', gamma_initializer='ones',  moving_mean_initializer='zeros',
moving_variance_initializer='ones')(x)
x=Conv2D(64, kernel_size=(3,3),padding='same')(x)
x=MaxPooling2D(pool_size=(2,2),padding='same')(x) #2
</code>```

Since the MaxPool layer is set with a padding of same, I was expecting the output of this layer to have the same dimensions as that of the input (48,128,64).

Title: The output to a MaxPool Layer in a FCN

Body:
The input to a FCN is a 2D array of dimensions (1,48,28) as shown in the image below. The first layer is a Convulational layer with 64 kernels ans padding "same" and the output thus has the dimensions as that of the input but with 64 channels.

Image of the network

However, in the next MaxPool layer, with a kernel size of 2X2, and padding set to "Same", why is the dimension of the output decreasing. And how much is it?

Here is the first few lines of the code of the layers of the neural network.

main_input = Input(shape=main_input_shape,name='main_input')
x=Conv2D(64, kernel_size=(3,3),padding='same')(main_input)
x=MaxPooling2D(pool_size=(2,2),padding='same')(x) # 1
x=LeakyReLU(alpha=0.2)(x)
x=BatchNormalization(axis=-1,momentum=0.99,epsilon=0.001,center=True,scale=True,
beta_initializer='zeros', gamma_initializer='ones',  moving_mean_initializer='zeros',
moving_variance_initializer='ones')(x)
x=Conv2D(64, kernel_size=(3,3),padding='same')(x)
x=MaxPooling2D(pool_size=(2,2),padding='same')(x) #2

Since the MaxPool layer is set with a padding of same, I was expecting the output of this layer to have the same dimensions as that of the input (48,128,64).


问:
Unable to import cancelled type of events in my Calendar from ics file on Outlook Office365 live (WEB)
When I tried to import ics file containing some events it got import successfully to my Outlook calendar. But when I tried to cancel/delete those events on Outlook by importing the ics-cancel file, it gives me the message "Could't import calendar. Try again later.Error message".

Error thrown on import cancelled ics file on Outlook Web

The ICS file containing events :-

```<code>BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//<Name>//<Name some version> 1.0//EN
METHOD:PUBLISH
X-PUBLISHED-TTL:PT1H
BEGIN:VEVENT
UID:6391ab4dbd29b38442b2d64f
SUMMARY:Meeting With Max Rob
DTSTAMP:20221208T072700Z
DTSTART:20221220T043000Z
DTEND:20221220T044500Z
SEQUENCE:0
DESCRIPTION:Discuss about mid month charts
LOCATION:<---some link--->
STATUS:CONFIRMED
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
ATTENDEE;RSVP=FALSE;CN=Max Rob:mailto:<---mail id--->
ATTENDEE;RSVP=FALSE;CN=Prasun Verma:mailto:<---mail id--->
END:VEVENT
BEGIN:VEVENT
UID:6391ab73bd29b38442b2d661
SUMMARY:Meeting With Jack Spree
DTSTAMP:20221208T072700Z
DTSTART:20221220T093000Z
DTEND:20221220T094500Z
SEQUENCE:0
DESCRIPTION:Get together meet.
LOCATION:<---some link--->
STATUS:CONFIRMED
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
ATTENDEE;RSVP=FALSE;CN=Jack Spree:mailto:<---mail id--->
ATTENDEE;RSVP=FALSE;CN=Prasun Verma:mailto:<---mail id--->
END:VEVENT
END:VCALENDAR
</code>```

The ICS-cancel file containing cancelled events :-

```<code>BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//<Name>//<Name some version> 1.0//EN
METHOD:CANCEL
X-PUBLISHED-TTL:PT1H
BEGIN:VEVENT
UID:6391ab4dbd29b38442b2d64f
SUMMARY:Meeting With Max Rob
DTSTAMP:20221208T072700Z
DTSTART:20221220T043000Z
DTEND:20221220T044500Z
SEQUENCE:1
STATUS:CANCELLED
END:VEVENT
BEGIN:VEVENT
UID:6391ab73bd29b38442b2d661
SUMMARY:Calendar Blocked
DTSTAMP:20221208T072700Z
DTSTART:20221208T092300Z
SEQUENCE:1
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR
</code>```

I need help how to make the events cancelled in the outlook calendar ? Is there a specific format to make events cancelled in outlook? What is the correct way to cancel events so that they disappear in outlook calendar, like in Google Calendar?
This works fine in Outlook Desktop app, I imported the normal ics file, after that I imported cancelled events ics file, I see it did not delete the event rather it stacked it in the same time slot, for example see the 'Meeting with Max Rob' it has been duplicated after importing the cancelled event ics file.
Importing cancelled event ics after normal ics import on Outlook Desktop

When it didn't work on outlook web, I tried importing it in the Outlook Desktop app, it got imported but I saw it stacked the cancelled event.
I expected after importing the cancelled ics file it would disappear the existing imported events from the calendar, like it does on Google calendar.
How do I need to change my ICS, so it works properly?
I saw various threads on stackoverflow, tried but none of them worked for Outlook web.

Body:
When I tried to import ics file containing some events it got import successfully to my Outlook calendar. But when I tried to cancel/delete those events on Outlook by importing the ics-cancel file, it gives me the message "Could't import calendar. Try again later.Error message".

Error thrown on import cancelled ics file on Outlook Web

The ICS file containing events :-

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//<Name>//<Name some version> 1.0//EN
METHOD:PUBLISH
X-PUBLISHED-TTL:PT1H
BEGIN:VEVENT
UID:6391ab4dbd29b38442b2d64f
SUMMARY:Meeting With Max Rob
DTSTAMP:20221208T072700Z
DTSTART:20221220T043000Z
DTEND:20221220T044500Z
SEQUENCE:0
DESCRIPTION:Discuss about mid month charts
LOCATION:<---some link--->
STATUS:CONFIRMED
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
ATTENDEE;RSVP=FALSE;CN=Max Rob:mailto:<---mail id--->
ATTENDEE;RSVP=FALSE;CN=Prasun Verma:mailto:<---mail id--->
END:VEVENT
BEGIN:VEVENT
UID:6391ab73bd29b38442b2d661
SUMMARY:Meeting With Jack Spree
DTSTAMP:20221208T072700Z
DTSTART:20221220T093000Z
DTEND:20221220T094500Z
SEQUENCE:0
DESCRIPTION:Get together meet.
LOCATION:<---some link--->
STATUS:CONFIRMED
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
ATTENDEE;RSVP=FALSE;CN=Jack Spree:mailto:<---mail id--->
ATTENDEE;RSVP=FALSE;CN=Prasun Verma:mailto:<---mail id--->
END:VEVENT
END:VCALENDAR

The ICS-cancel file containing cancelled events :-

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//<Name>//<Name some version> 1.0//EN
METHOD:CANCEL
X-PUBLISHED-TTL:PT1H
BEGIN:VEVENT
UID:6391ab4dbd29b38442b2d64f
SUMMARY:Meeting With Max Rob
DTSTAMP:20221208T072700Z
DTSTART:20221220T043000Z
DTEND:20221220T044500Z
SEQUENCE:1
STATUS:CANCELLED
END:VEVENT
BEGIN:VEVENT
UID:6391ab73bd29b38442b2d661
SUMMARY:Calendar Blocked
DTSTAMP:20221208T072700Z
DTSTART:20221208T092300Z
SEQUENCE:1
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR

I need help how to make the events cancelled in the outlook calendar ? Is there a specific format to make events cancelled in outlook? What is the correct way to cancel events so that they disappear in outlook calendar, like in Google Calendar?
This works fine in Outlook Desktop app, I imported the normal ics file, after that I imported cancelled events ics file, I see it did not delete the event rather it stacked it in the same time slot, for example see the 'Meeting with Max Rob' it has been duplicated after importing the cancelled event ics file.
Importing cancelled event ics after normal ics import on Outlook Desktop

When it didn't work on outlook web, I tried importing it in the Outlook Desktop app, it got imported but I saw it stacked the cancelled event.
I expected after importing the cancelled ics file it would disappear the existing imported events from the calendar, like it does on Google calendar.
How do I need to change my ICS, so it works properly?
I saw various threads on stackoverflow, tried but none of them worked for Outlook web.


问:
How can i input 2 columns using foreach
I have added a 3 new columns for bravo_book_others table the columns are other_name, gender, and other_address. I have a case like this :
User1 want to buy 4 holiday package for user1 friends, so user1 have to input 3 of user1 friends like this :

```<code>Gender#1 : male
Name#1 : a
Email#1 : a@gmail.com
Address#1 : a street
</code>```
```<code>Gender#2 : female
Name#2 : b
Email#2 : b@gmail.com
Address#2 : b street
</code>```
```<code>Gender#3 : male
Name#3 : c
Email#3 : c@gmail.com
Address#3 : c street
</code>```

I already done it with the email in the controller like this :

```<code>foreach ($request->input('other_emails') as $email){
            BookOther::create([
                'booking_id'=>$booking->id,
                'user_id'=>$booking->customer_id,
                'other_emails'=>$email
            ]);
            Mail::to($email)->send(new OthersEmail($isi_email1));
        }
</code>```

How can i put the other_name, gender, and other_address and store it into the database??

The Model :

```<code>class BookOther extends Model
{
    use HasFactory;
    protected $table = 'bravo_book_others';

    protected $fillable = [
        'booking_id',
        'user_id',
        'gender',
        'other_name',
        'other_address',
        'other_emails'
    ];

    public function booking(){
        return $this->belongsTo('Modules\Booking\Models\Booking', 'booking_id', 'id');
    }

    public function user(){
        return $this->belongsTo('App\User', 'user_id', 'id');
    }
}
</code>```

The Controller :

```<code>foreach ($request->input('other_emails') as $email){
            BookOther::create([
                'booking_id'=>$booking->id,
                'user_id'=>$booking->customer_id,
                'other_emails'=>$email
            ]);
            Mail::to($email)->send(new OthersEmail($isi_email1));
        }
</code>```

Title: How can i input 2 columns using foreach

Body:
I have added a 3 new columns for bravo_book_others table the columns are other_name, gender, and other_address. I have a case like this :
User1 want to buy 4 holiday package for user1 friends, so user1 have to input 3 of user1 friends like this :

Gender#1 : male
Name#1 : a
Email#1 : a@gmail.com
Address#1 : a street

Gender#2 : female
Name#2 : b
Email#2 : b@gmail.com
Address#2 : b street

Gender#3 : male
Name#3 : c
Email#3 : c@gmail.com
Address#3 : c street

I already done it with the email in the controller like this :

foreach ($request->input('other_emails') as $email){
            BookOther::create([
                'booking_id'=>$booking->id,
                'user_id'=>$booking->customer_id,
                'other_emails'=>$email
            ]);
            Mail::to($email)->send(new OthersEmail($isi_email1));
        }

How can i put the other_name, gender, and other_address and store it into the database??

The Model :

class BookOther extends Model
{
    use HasFactory;
    protected $table = 'bravo_book_others';

    protected $fillable = [
        'booking_id',
        'user_id',
        'gender',
        'other_name',
        'other_address',
        'other_emails'
    ];

    public function booking(){
        return $this->belongsTo('Modules\Booking\Models\Booking', 'booking_id', 'id');
    }

    public function user(){
        return $this->belongsTo('App\User', 'user_id', 'id');
    }
}

The Controller :

foreach ($request->input('other_emails') as $email){
            BookOther::create([
                'booking_id'=>$booking->id,
                'user_id'=>$booking->customer_id,
                'other_emails'=>$email
            ]);
            Mail::to($email)->send(new OthersEmail($isi_email1));
        }


问:
Pandas - Find the rolling minimum up to the date in a dataframe
I have this dataframe which shows the kind of gems, shapes, sizes, quality, date of purchase, and price paid.

Gem
shape
size
quality
date
price

Ruby
Oval
2
1
01-01-2021
2500

Emerald
Heart
3
2
09-06-2020
2500

Ruby
Oval
2
1
15-01-2021
1500

Ruby
Heart
2
1
03-01-2021
3000

Ruby
Oval
2
1
20-02-2021
2500

Emerald
Oval
2
2
01-01-2021
2500

Ruby
Oval
2
1
20-06-2021
1000

Emerald
Oval
3
3
01-01-2021
2500

What I wanted to do is to group the gem according to shape, size, quality and find the minimum price up to  the date another gem that was acquired which belongs to the same group, like below:

Gem
shape
size
quality
date
price
minimum price to date

Ruby
Oval
2
1
01-01-2021
2500
2500

Ruby
Oval
2
1
03-01-2021
1500
1500

Ruby
Oval
2
1
20-02-2021
2500
1500

Ruby
Oval
2
1
20-06-2021
1000
1000

Ruby
Heart
2
1
03-01-2021
3000
3000

df['minimum price to date'] = df.groupby(['gem','shape','size','quality'])['price'].min() gives me the absolute minimum prices of the gems of groups.  I can't figure out how to find the rolling minimum price.  Any suggestion?


问:
How to onboard sellers to accept payment from my site using paypal?
I used laravel to integrate paypal payment gateway.
Payment processing and order capturing all working correctly.

But, now I want dircetly transfer payment to seller's account and want to apply platform fee as my commission.

I already created merchant app into paypal. But I don't know how to onboard the seller so that I can apply "payee" and "platform_fee" to create order.

The whole concept is that, seller on my site provides the digital goods and when customer buy it, seller should get payment directly to thier account and I should get a commission in my account.

It is very helpful if someone guides me or share any video tutorial link.

Following is my order placing code:

```<code>$provider = new PayPal;

$token = $provider->getAccessToken();
$provider->setAccessToken($token);

$data = [
    "intent" => "CAPTURE",
    "purchase_units" => [
        [
            "amount" => [
                "currency_code" => "USD",
                "value" => "100",
                "breakdown" => [
                    "item_total" => [
                        "currency_code" => "USD",
                        "value" => "100",
                    ]
                ]
            ],
            "description" => "2022-11-07 testing 100$",
            'items' => [
                [
                    'name' => "Quiz extra time",
                    'unit_amount' => [
                        "currency_code" => "USD",
                        "value" => "100"
                    ],
                    'quantity' => 1,
                    'description' => "Purchase an extra time for quiz",
                    'category' => 'DIGITAL_GOODS',
                ]
            ],
            "payee" => [
                "email_address" => "sb-some-email@business.example.com"
            ],
            "payment_instruction" => [
                "disbursement_mode" => "INSTANT",
                "platform_fees" => [
                    [
                        "amount" => [
                            "currency_code" => "USD",
                            "value" => "10.00"
                        ],
                    ],
                ],
            ],
        ]
    ]
];

$order = $provider->createOrder($data);
</code>```

This will gives me the following output:

```<code>{
    "error": {
        "name": "NOT_AUTHORIZED",
        "details": [
            {
                "issue": "PAYEE_NOT_CONSENTED",
                "description": "Payee does not have appropriate consent to allow the API caller to process this type of transaction on their behalf. Your current setup requires the 'payee' to provide a consent before this transaction can be processed successfully."
            }
        ],
        "message": "Authorization failed due to insufficient permissions.",
        "debug_id": "2a4ac8f16fe7b",
        "links": [
            {
                "href": "https://developer.paypal.com/docs/api/orders/v2/#error-PAYEE_NOT_CONSENTED",
                "rel": "information_link",
                "method": "GET"
            }
        ]
    }
}
</code>```

Body:
I used laravel to integrate paypal payment gateway.
Payment processing and order capturing all working correctly.

But, now I want dircetly transfer payment to seller's account and want to apply platform fee as my commission.

I already created merchant app into paypal. But I don't know how to onboard the seller so that I can apply "payee" and "platform_fee" to create order.

The whole concept is that, seller on my site provides the digital goods and when customer buy it, seller should get payment directly to thier account and I should get a commission in my account.

It is very helpful if someone guides me or share any video tutorial link.

Following is my order placing code:

$provider = new PayPal;

$token = $provider->getAccessToken();
$provider->setAccessToken($token);

$data = [
    "intent" => "CAPTURE",
    "purchase_units" => [
        [
            "amount" => [
                "currency_code" => "USD",
                "value" => "100",
                "breakdown" => [
                    "item_total" => [
                        "currency_code" => "USD",
                        "value" => "100",
                    ]
                ]
            ],
            "description" => "2022-11-07 testing 100$",
            'items' => [
                [
                    'name' => "Quiz extra time",
                    'unit_amount' => [
                        "currency_code" => "USD",
                        "value" => "100"
                    ],
                    'quantity' => 1,
                    'description' => "Purchase an extra time for quiz",
                    'category' => 'DIGITAL_GOODS',
                ]
            ],
            "payee" => [
                "email_address" => "sb-some-email@business.example.com"
            ],
            "payment_instruction" => [
                "disbursement_mode" => "INSTANT",
                "platform_fees" => [
                    [
                        "amount" => [
                            "currency_code" => "USD",
                            "value" => "10.00"
                        ],
                    ],
                ],
            ],
        ]
    ]
];

$order = $provider->createOrder($data);

This will gives me the following output:

{
    "error": {
        "name": "NOT_AUTHORIZED",
        "details": [
            {
                "issue": "PAYEE_NOT_CONSENTED",
                "description": "Payee does not have appropriate consent to allow the API caller to process this type of transaction on their behalf. Your current setup requires the 'payee' to provide a consent before this transaction can be processed successfully."
            }
        ],
        "message": "Authorization failed due to insufficient permissions.",
        "debug_id": "2a4ac8f16fe7b",
        "links": [
            {
                "href": "https://developer.paypal.com/docs/api/orders/v2/#error-PAYEE_NOT_CONSENTED",
                "rel": "information_link",
                "method": "GET"
            }
        ]
    }
}


问:
Moving the Facet wrap label below the x-axis affects the y-axis of the bottom plot when using Patchwork
I stumbled across this yesterday and traced the issue to the relocation of the facet wrap label below the x-axis code. More specifically, to this segments of the code:

```<code>theme(strip.placement = "outside")
</code>```

If this is not done, patchwork has no problem combining plots and does not affect y-axis of the bottom plot. On their own, plots are fine, the problem emerges when doing the procedure as described. Does anyone have an idea how to fix this?

With the strip.placement = "outside":

Without the strip.placement = "outside":

Body:
I stumbled across this yesterday and traced the issue to the relocation of the facet wrap label below the x-axis code. More specifically, to this segments of the code:

theme(strip.placement = "outside")

If this is not done, patchwork has no problem combining plots and does not affect y-axis of the bottom plot. On their own, plots are fine, the problem emerges when doing the procedure as described. Does anyone have an idea how to fix this?

With the strip.placement = "outside":

Without the strip.placement = "outside":


问:
How to modify the background drawable of Android's status_bar_expended as shown in the picture
Based on android12

picture here

I have modified the width of the PanelView, but can't modify this background, does anyone know where this background is defined (A and B)


问:
split.js, gutter not connected, double shading
when attempt to make a more complex split.js, why is there a double shading, a different background color(it should be grey in .content) in the gutter, and seems not connected well in #i & #j ? other attempt is to use split.js grid but i've not succeeded as well.

this is what I'm currently in

```<code><!DOCTYPE html>
<html>

<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <link rel="stylesheet" type="text/css" href="splitjs.css">
</head>

<body>
  <div id="a" class="split content"></div>
  <div id="b" class="split">
    <div id="d" class="split content split-horizontal">
      <div id="i" class="split content"></div>
      <div id="j" class="split content"></div>
    </div>
    <div id="e" class="split content split-horizontal"></div>
    <div id="f" class="split content split-horizontal"></div>
  </div>
  <div id="c" class="split">
    <div id="g" class="split content split-horizontal"></div>
    <div id="h" class="split content split-horizontal"></div>
  </div>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/split.js/1.3.5/split.min.js"></script>
  <script>
    Split(['#a', '#b', '#c'], {
      sizes: [15, 40, 45],
      gutterSize: 8,
      cursor: 'pointer',
      direction: 'vertical',
      snapOffset: 0,
    });
    Split(['#d', '#e', '#f'], {
      sizes: [35, 40, 25],
      gutterSize: 8,
      cursor: 'row-resize',
      snapOffset: 0,
    });
    Split(['#g', '#h'], {
      sizes: [50, 50],
      gutterSize: 8,
      cursor: 'row-resize',
      snapOffset: 0,
    });
    Split(['#i', '#j'], {
      sizes: [50, 50],
      gutterSize: 8,
      cursor: 'pointer',
      direction: 'vertical',
      snapOffset: 0,
    });

  </script>
</body>

</html>
</code>```

Body:
when attempt to make a more complex split.js, why is there a double shading, a different background color(it should be grey in .content) in the gutter, and seems not connected well in #i & #j ? other attempt is to use split.js grid but i've not succeeded as well.

this is what I'm currently in

<!DOCTYPE html>

  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <link rel="stylesheet" type="text/css" href="splitjs.css">


问:
C# wpf how to add dynamically columns to datagrid
I have DataGrid with for example 2 columns. I have a button "Open", I use it to select text files from chamber tests (files from temperatures). The number of files can be different. I want read errors (10 points) from them and show them in the data grid. One column with errors for every temperature.

I would like to add dynamically new columns for every temperature (file). I know how to do that using the name of the data grid (in file xxxxx.xaml.cs), but I would like to do that with bindings in my ViewModel.cs file.

Analyzer.xaml:

```<code><DataGrid Name="DataGridAnalyzer" ItemsSource="{Binding DataGridAnalyzerData, UpdateSourceTrigger=PropertyChanged}"
          AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="False"
          GridLinesVisibility="All" Width="Auto" Height="200" Margin="10" >
    <DataGrid.Columns>
        <DataGridTemplateColumn Header="Address" Width="*" IsReadOnly="True" >
            <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
        <Label Content="{Binding Address, UpdateSourceTrigger=PropertyChanged}"
               VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
        </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
        <DataGridTemplateColumn Header="Type" Width="*" IsReadOnly="True" >
            <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
        <Label Content="{Binding Type, UpdateSourceTrigger=PropertyChanged}"
               VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
        </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
    </DataGrid.Columns>
</DataGrid>
<Button  Command="{Binding OpenCommand}" Content="Open"/>
</code>```

Data binding: AnalyzerVM.cs

public class AnalyzerVM : BindableBase
{
    public DelegateCommand OpenCommand { get; set; }
    public AnalyzerVM(Action<Action> runOnUI)
    {
        OpenCommand = new DelegateCommand(OpenHandler);
    }
    private void OpenHandler()
    {
        List<string> fileNames = SelectFiles();
        GetDataOpenFile(fileNames);

    }
    ........
}
```

Body:
I have DataGrid with for example 2 columns. I have a button "Open", I use it to select text files from chamber tests (files from temperatures). The number of files can be different. I want read errors (10 points) from them and show them in the data grid. One column with errors for every temperature.

I would like to add dynamically new columns for every temperature (file). I know how to do that using the name of the data grid (in file xxxxx.xaml.cs), but I would like to do that with bindings in my ViewModel.cs file.

Analyzer.xaml:

<DataGrid Name="DataGridAnalyzer" ItemsSource="{Binding DataGridAnalyzerData, UpdateSourceTrigger=PropertyChanged}"
          AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="False"
          GridLinesVisibility="All" Width="Auto" Height="200" Margin="10" >
    <DataGrid.Columns>
        <DataGridTemplateColumn Header="Address" Width="*" IsReadOnly="True" >
            <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>

        </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
        <DataGridTemplateColumn Header="Type" Width="*" IsReadOnly="True" >
            <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>

        </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
    </DataGrid.Columns>
</DataGrid>
<Button  Command="{Binding OpenCommand}" Content="Open"/>

Data binding: AnalyzerVM.cs

public class AnalyzerVM : BindableBase
{
    public DelegateCommand OpenCommand { get; set; }
    public AnalyzerVM(Action<Action> runOnUI)
    {
        OpenCommand = new DelegateCommand(OpenHandler);
    }
    private void OpenHandler()
    {
        List<string> fileNames = SelectFiles();
        GetDataOpenFile(fileNames);

    }
    ........
}


问:
Convert list into rows based on previous condition
I Have a datase like this

Column A
Column B

Cell 1
[ 1, 2 ,3 , 4]

Cell 2
[a,b,c]

but i want to convert it to like below
using pyhton

Column A
Column B

Cell 1
1

Cell 1
2

Cell 1
3

Cell 1
4

Cell 2
a

Cell 2
b

Cell 2
c


问:
Getting 502 Bad gateway errors intermittently in Azure kubernetes(AKS)
we have recently shifted production instance of our app from VM into Kubernetes environment and very randomly at some times it's giving 502 bad gateway error. The app frontend runs on React and backend we are using 11-12 node js microservices. Only one microservice is giving this 502 error which is under more load compared to the other microservices. I have tried to check the kubernetes pod logs of that microservice but it doesn't give any helpful info as you can see

As some of articles on internet suggested there might be issue with new pods created under autoscaling might be showing as available to kube scheduler before they are actually ready and requests going to that new pod before it can run requests might be giving 502. I have increased the minimum count of pods to 10 for that microservice but still the same issue repeats.

we are using nginx ingress controller. I tried to check ingress logs, I can see the 502 errors but nothing helpful to debug there also. as you can see

```<code>24.171.57.159 - - [08/Dec/2022:21:40:27 +0000] "POST /lender/api/v1/dealer/getUserDetailsById HTTP/2.0" 502 150 "https://portal.leverauto.com/Admin" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15" 402 51.967 [default-lever-lender-service-5009] [] 10.240.0.155:5009 0 51.935 502 b8a41fdba7930aea0a9b22780024bd65
</code>```

I am also attaching full file of ingress logs here, if it is helpful to see what might be the issue here

Also here is my both ingress files, we are using 2 ingress as backend needs rewrite annotation while frontend doesn't need that rewrite hence.

ingress-r.yaml

```<code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-r
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "360"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "360"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "360"
    nginx.ingress.kubernetes.io/affinity: cookie

spec:
  tls:
  - hosts:
    - portal.leverauto.com
    secretName: lever-ssl
  defaultBackend:
    service:
      name: lever-webapp-service
      port:
        number: 80
  rules:
  - host: portal.leverauto.com
    http: &http_rules
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: lever-webapp-service
            port:
              number: 80
</code>```

ingress-srv.yaml

```<code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-srv
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "360"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "360"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "360"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/affinity: cookie

spec:
  tls:
  - hosts:
    - portal.leverauto.com
    secretName: lever-ssl
  defaultBackend:
    service:
      name: lever-webapp-service
      port:
        number: 80
  rules:
  - host: portal.leverauto.com
    http: &http_rules
      paths:
      - path: /auth(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-authentication-service
            port:
              number: 5000
      - path: /auction(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-auction-service
            port:
              number: 5010
      - path: /audit(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-audits-service
            port:
              number: 5005
      - path: /inventory(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-inventory-service
            port:
              number: 5006
      - path: /lender(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-lender-service
            port:
              number: 5009
      - path: /payment(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-payments-service
            port:
              number: 5002
      - path: /report(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-reports-service
            port:
              number: 5003
      - path: /sopraData(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-sopra-datapull-service
            port:
              number: 5011
      - path: /sopra(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-sopra-service
            port:
              number: 5008
      - path: /vehicle(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-vehicle-service
            port:
              number: 5001
      - path: /workflow(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-workflow-service
            port:
              number: 5004

</code>```

This is a critical Production issue, any help would be greatly appreciated.

Body:
we have recently shifted production instance of our app from VM into Kubernetes environment and very randomly at some times it's giving 502 bad gateway error. The app frontend runs on React and backend we are using 11-12 node js microservices. Only one microservice is giving this 502 error which is under more load compared to the other microservices. I have tried to check the kubernetes pod logs of that microservice but it doesn't give any helpful info as you can see

As some of articles on internet suggested there might be issue with new pods created under autoscaling might be showing as available to kube scheduler before they are actually ready and requests going to that new pod before it can run requests might be giving 502. I have increased the minimum count of pods to 10 for that microservice but still the same issue repeats.

we are using nginx ingress controller. I tried to check ingress logs, I can see the 502 errors but nothing helpful to debug there also. as you can see

24.171.57.159 - - [08/Dec/2022:21:40:27 +0000] "POST /lender/api/v1/dealer/getUserDetailsById HTTP/2.0" 502 150 "https://portal.leverauto.com/Admin" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15" 402 51.967 [default-lever-lender-service-5009] [] 10.240.0.155:5009 0 51.935 502 b8a41fdba7930aea0a9b22780024bd65

I am also attaching full file of ingress logs here, if it is helpful to see what might be the issue here

Also here is my both ingress files, we are using 2 ingress as backend needs rewrite annotation while frontend doesn't need that rewrite hence.

ingress-r.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-r
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "360"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "360"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "360"
    nginx.ingress.kubernetes.io/affinity: cookie

spec:
  tls:
  - hosts:
    - portal.leverauto.com
    secretName: lever-ssl
  defaultBackend:
    service:
      name: lever-webapp-service
      port:
        number: 80
  rules:
  - host: portal.leverauto.com
    http: &http_rules
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: lever-webapp-service
            port:
              number: 80

ingress-srv.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-srv
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "360"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "360"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "360"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/affinity: cookie

spec:
  tls:
  - hosts:
    - portal.leverauto.com
    secretName: lever-ssl
  defaultBackend:
    service:
      name: lever-webapp-service
      port:
        number: 80
  rules:
  - host: portal.leverauto.com
    http: &http_rules
      paths:
      - path: /auth(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-authentication-service
            port:
              number: 5000
      - path: /auction(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-auction-service
            port:
              number: 5010
      - path: /audit(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-audits-service
            port:
              number: 5005
      - path: /inventory(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-inventory-service
            port:
              number: 5006
      - path: /lender(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-lender-service
            port:
              number: 5009
      - path: /payment(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-payments-service
            port:
              number: 5002
      - path: /report(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-reports-service
            port:
              number: 5003
      - path: /sopraData(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-sopra-datapull-service
            port:
              number: 5011
      - path: /sopra(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-sopra-service
            port:
              number: 5008
      - path: /vehicle(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-vehicle-service
            port:
              number: 5001
      - path: /workflow(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: lever-workflow-service
            port:
              number: 5004

This is a critical Production issue, any help would be greatly appreciated.


问:
has been blocked by CORS policy React Api consumption
I am trying to consume a login endpoint and I am getting the error in my console
has been blocked by CORS policy.

here is my function that handles login

```<code>async function loginUser(credentials) {
    return fetch('https://visbackend.herokuapp.com/auth/login', {
      method: 'POST',
      mode: 'cors',
      headers: {
         'Content-Type': 'application/json',
        // 'Access-Control-Allow-Origin': '*',
        // "Access-Control-Allow-Headers": "X-Requested-With"
        // 'Access-Control-Allow-Origin':  'http://127.0.0.1:3000',
        // 'Access-Control-Allow-Methods': 'POST',
        // 'Access-Control-Allow-Headers': 'Content-Type, Authorization'

      },

      body: JSON.stringify(credentials)
    })
      .then(data => data.json())
   }
</code>```

i understand i am supposed to allow cors , but i have gone through every sample as you can see, i have some lines of code commented out , but the error still persists.

please what am i doing wrong, thanks in advance.

Body:
I am trying to consume a login endpoint and I am getting the error in my console
has been blocked by CORS policy.

here is my function that handles login

async function loginUser(credentials) {
    return fetch('https://visbackend.herokuapp.com/auth/login', {
      method: 'POST',
      mode: 'cors',
      headers: {
         'Content-Type': 'application/json',
        // 'Access-Control-Allow-Origin': '*',
        // "Access-Control-Allow-Headers": "X-Requested-With"
        // 'Access-Control-Allow-Origin':  'http://127.0.0.1:3000',
        // 'Access-Control-Allow-Methods': 'POST',
        // 'Access-Control-Allow-Headers': 'Content-Type, Authorization'

      },

      body: JSON.stringify(credentials)
    })
      .then(data => data.json())
   }

i understand i am supposed to allow cors , but i have gone through every sample as you can see, i have some lines of code commented out , but the error still persists.

please what am i doing wrong, thanks in advance.


问:
How to open Whatsapp to share image from url in Swift App?
i want to use Whatsapp share image in my Swift app using Xcode, the image will be downloaded from url , its working fine but the problem is that when i click on Whatsapp share button it doesn't open Whatsapp directly but open event where i can see all apps to share ,,, look this image

i want when user click on whatsapp it should open just whatsapp directly...

this is my code in button click

```<code> let urlWhats = "whatsapp://app"
                           if let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters:CharacterSet.urlQueryAllowed) {
                               if let whatsappURL = URL(string: urlString) {

                                   if UIApplication.shared.canOpenURL(whatsappURL as URL) {

                                       // Set your image's URL into here
                                       let url = URL(string: "https://www.punjabidharti.com/wp-content/uploads/2022/11/1662625125251-600x600.jpg")!
                                       data(from: url) { data, response, error in
                                           guard let data = data, error == nil else { return }
                                           DispatchQueue.main.async() { [self] in

                                               let image = UIImage(data: data)
                                               if let imageData = image?.jpegData(compressionQuality: 1.0) {
                                                   let tempFile = URL(fileURLWithPath: NSHomeDirectory()).appendingPathComponent("Documents/whatsAppTmp.wai")
                                                   do {
                                                       try imageData.write(to: tempFile, options: .atomic)
                                                       self.documentInteractionController = UIDocumentInteractionController(url: tempFile)
                                                       self.documentInteractionController.uti = "net.whatsapp.image"
                                                       self.documentInteractionController.presentOpenInMenu(from: CGRect.zero, in: self.view, animated: true)

                                                   } catch {
                                                       print(error)
                                                   }
                                               }
                                           }
                                       }

                                   } else {
                                       self.showToast(message: "Whatsapp Not Installed")
                                   }
                               }
                           }
</code>```

Body:
i want to use Whatsapp share image in my Swift app using Xcode, the image will be downloaded from url , its working fine but the problem is that when i click on Whatsapp share button it doesn't open Whatsapp directly but open event where i can see all apps to share ,,, look this image

i want when user click on whatsapp it should open just whatsapp directly...

this is my code in button click

 let urlWhats = "whatsapp://app"
                           if let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters:CharacterSet.urlQueryAllowed) {
                               if let whatsappURL = URL(string: urlString) {

                                   if UIApplication.shared.canOpenURL(whatsappURL as URL) {

                                       // Set your image's URL into here
                                       let url = URL(string: "https://www.punjabidharti.com/wp-content/uploads/2022/11/1662625125251-600x600.jpg")!
                                       data(from: url) { data, response, error in
                                           guard let data = data, error == nil else { return }
                                           DispatchQueue.main.async() { [self] in

                                               let image = UIImage(data: data)
                                               if let imageData = image?.jpegData(compressionQuality: 1.0) {
                                                   let tempFile = URL(fileURLWithPath: NSHomeDirectory()).appendingPathComponent("Documents/whatsAppTmp.wai")
                                                   do {
                                                       try imageData.write(to: tempFile, options: .atomic)
                                                       self.documentInteractionController = UIDocumentInteractionController(url: tempFile)
                                                       self.documentInteractionController.uti = "net.whatsapp.image"
                                                       self.documentInteractionController.presentOpenInMenu(from: CGRect.zero, in: self.view, animated: true)

                                                   } catch {
                                                       print(error)
                                                   }
                                               }
                                           }
                                       }

                                   } else {
                                       self.showToast(message: "Whatsapp Not Installed")
                                   }
                               }
                           }


问:
how to reconnect to redis, when connection is open but not ready?
I am using redis(AWS elastic cache) with node and AWS lambdas.

node version - 14
redis library - 4.1.1

```<code>this.logger.debug(`Is connection open ${this.client.isOpen} ready ${this.client.isReady}`);

returns - Is connection open true ready false

</code>```

since connection is not ready, I am not able to query redis, and I am also not able to call client.connect/disconnect. how should I handle this scenario?

Body:
I am using redis(AWS elastic cache) with node and AWS lambdas.

node version - 14
redis library - 4.1.1

this.logger.debug(`Is connection open ${this.client.isOpen} ready ${this.client.isReady}`);

returns - Is connection open true ready false

since connection is not ready, I am not able to query redis, and I am also not able to call client.connect/disconnect. how should I handle this scenario?


问:
Terraform cloud build trigger - ignore changes
So I have a very simple Terraform block that defines a cloud build trigger to build a Docker image from a Github respository. This image is then used to create a Cloud Run revision.

The problem is that terraform plan shows a change in Cloud Build even when I don't change anything in code. And weirdly enough, that change is somehow related to Cloud Run service revision name.

So these things ALWAYS apprear in terraform plan regardless of whether there were any changes in the code or not:

(This is the output from Terraform Cloud)

What life cycle element I need to ignore, or otherwise what else I need to do so that these things do not appear.


问:
SPRING class file has wrong version 60.0, should be 55.0
so i get this error

/Users/apple/Downloads/Seasalt-Konsumen/src/main/java/com/seasalt/repository/KonsumenRepository.java:4:47 java: cannot access org.springframework.data.jpa.repository.JpaRepository   bad class file: /Users/apple/.m2/repository/org/springframework/data/spring-data-jpa/3.0.0/spring-data-jpa-3.0.0.jar!/org/springframework/data/jpa/repository/JpaRepository.class     class file has wrong version 60.0, should be 55.0     Please remove or make sure it appears in the correct subdirectory of the classpath.

and

/Users/apple/Downloads/Seasalt-Konsumen/src/main/java/com/seasalt/repository/KonsumenRepository.java:5:38 java: cannot access org.springframework.stereotype.Repository   bad class file: /Users/apple/.m2/repository/org/springframework/spring-context/6.0.2/spring-context-6.0.2.jar!/org/springframework/stereotype/Repository.class     class file has wrong version 61.0, should be 55.0     Please remove or make sure it appears in the correct subdirectory of the classpath.

my javac version is 11 and java is 11
and my project structure is already configured too on version 11

i try to run springboot and run like usual but i changed laptop and install everything

java version
project structur


问:
Number of ways to insert keys into an AVL tree such that there are no rotations
How many ways can we insert keys { 1, 2, 3, .... 7 } to make an AVL tree so that it does not have any rotation?

The goal is to find all the permutations of the keys such that when inserted into an AVL tree in sequence from first to last(consider permutation is {3,2,4,1,6,7,5} we will insert first key 3 then key 2 and then key 4 and so on) there will not be any rotation.

I broke it down into 2 cases:

Case 1: height of tree = 2, (a complete binary tree) only 1 structure possible.

case 2: height of tree = 3, there will be 16 structures possible.(there will not be an AVL tree of height 4 or more as AVL trees of height 4 require at least 12 nodes)

I have the possible structures but I need to find the sequence of insertion into this structure. If I solve like this the problem computation increases when the number of keys increases as my structures will increase, looking for alternate approaches to this solve it or an idea on how I could make my approach simpler to find the sequence of insertion.


问:
How do I write into an array in Assembly?
I want to write into an array using input from a keyboard. I am using a loop to do this but it gives me a 'Segmentation fault (core dumped)' error. I don't really understand how am i supposed to do it.
Here is the relevant code:

```<code>.data
array: .space 400
array_len: .space 4
inputFormat: .asciz "%d"
.text
.global main
main:

pushl $array_len
pushl $inputFormat
call scanf
popl %ebx
popl %ebx

xorl %ecx, %ecx
lea array, %edi

l_loop:
cmp %ecx, array_len
je l_exit

pushl %eax
pushl $inputFormat
call scanf
popl %eax
popl %eax
molv %eax, (%edi, %ecx, 4)

incl %ecx
jmp l_loop
...
</code>```

I figured out that the problem comes from the line:
movl %eax, (%edi, %ecx, 4) in the (%edi, %ecx, 4) part

I tried changing the (%edi, %ecx, 4) part to something else (like %ebx) and it worked. Also, everything works well when i comment that line. Am i missing something?

Body:
I want to write into an array using input from a keyboard. I am using a loop to do this but it gives me a 'Segmentation fault (core dumped)' error. I don't really understand how am i supposed to do it.
Here is the relevant code:

.data
array: .space 400
array_len: .space 4
inputFormat: .asciz "%d"
.text
.global main
main:

pushl $array_len
pushl $inputFormat
call scanf
popl %ebx
popl %ebx

xorl %ecx, %ecx
lea array, %edi

l_loop:
cmp %ecx, array_len
je l_exit

pushl %eax
pushl $inputFormat
call scanf
popl %eax
popl %eax
molv %eax, (%edi, %ecx, 4)

incl %ecx
jmp l_loop
...

I figured out that the problem comes from the line:
movl %eax, (%edi, %ecx, 4) in the (%edi, %ecx, 4) part

I tried changing the (%edi, %ecx, 4) part to something else (like %ebx) and it worked. Also, everything works well when i comment that line. Am i missing something?


问:
How to mark on google map flutter fireabse
i have some coordinates latitude and loongtitud and i just want to mark those those places in  google map and i donts select all the docs coordinates i just filter and get coordinates

```<code>    Future<void> markSetss() async {
    QuerySnapshot querySnapshot = await FirebaseFirestore.instance
        .collection('stations')
        .where('norequest', isGreaterThanOrEqualTo: 5)
        .get();

    List<Map<String?, dynamic>> results =
        querySnapshot.docs.map((doc) => {} as Map<String, dynamic>).toList();

    print(results[0]['coor'].latitude);
  }
</code>```

Body:
i have some coordinates latitude and loongtitud and i just want to mark those those places in  google map and i donts select all the docs coordinates i just filter and get coordinates

    Future<void> markSetss() async {
    QuerySnapshot querySnapshot = await FirebaseFirestore.instance
        .collection('stations')
        .where('norequest', isGreaterThanOrEqualTo: 5)
        .get();

    List<Map<String?, dynamic>> results =
        querySnapshot.docs.map((doc) => {} as Map<String, dynamic>).toList();

    print(results[0]['coor'].latitude);
  }


问:
How to insert insert elements (links) correctly using JS?
When I click on the link for the first time - the click event works well. But when I remove (mouseout event) the cursor from the link and then I'll click on the link again, that click event is no longer triggered.

Why? how do I make it work on vanilla JS?

const elCollection = document.getElementsByClassName('wrapper');
const paragraph = document.getElementsByClassName('catalog');

for(var i = 0; i < elCollection.length; i++) {
    var elem = elCollection[i];
    const count = i;

    paragraph[count].querySelector('.link-buy').addEventListener('click', function() {
      console.log('qwertty');
    })

    elem.addEventListener('mouseout', function(e) {
       paragraph[count].innerHTML = 'And here the link is no working link.';
    })
 }```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.catalog {
    margin: 200px;
    padding: 0;
    font-style: normal;
    font-weight: 400;
    font-size: 13px;
    line-height: 15px;
    margin-bottom: 15px;
    color: #000;
  }

  .link-buy {
    color: #1996d7;
    text-decoration: none;
    border-bottom: 1px dashed;
  }

  .link-buy:hover {
    color: #22A7E9;
  }</code>```

you need to click on the link

```

Body:
When I click on the link for the first time - the click event works well. But when I remove (mouseout event) the cursor from the link and then I'll click on the link again, that click event is no longer triggered.

Why? how do I make it work on vanilla JS?

const elCollection = document.getElementsByClassName('wrapper');
const paragraph = document.getElementsByClassName('catalog');

for(var i = 0; i < elCollection.length; i++) {
    var elem = elCollection[i];
    const count = i;

    paragraph[count].querySelector('.link-buy').addEventListener('click', function() {
      console.log('qwertty');
    })

    elem.addEventListener('mouseout', function(e) {
       paragraph[count].innerHTML = 'And here the link is no working link.';
    })
 }

.catalog {
    margin: 200px;
    padding: 0;
    font-style: normal;
    font-weight: 400;
    font-size: 13px;
    line-height: 15px;
    margin-bottom: 15px;
    color: #000;
  }

  .link-buy {
    color: #1996d7;
    text-decoration: none;
    border-bottom: 1px dashed;
  }

  .link-buy:hover {
    color: #22A7E9;
  }

you need to click on the link


问:
Multistep inter-page communication with json
I am creating my textbox and labels with Json. Now I am trying to do something like this. On the Multistep screen, I enter the properties of a device in the first place. According to the device I selected from the dropdown menu. This was step 1. Now I want to get the "test and control" statements of the device connected to that select. I have to do this in step 2 too. How can I keep these test and control statements in json. In other words, I will proceed as next > next, but all the steps that will take place depending on the features of one device.</p>


问:
Building React native Rocket chat Project in Android
I have downloaded the React Native project v4.32.0 from below link:
 https://github.com/RocketChat/Rocket.Chat.ReactNative

I tried to run the project using Android Studio but it is producing lot of errors.

I tried to run the same project using VS Code it runs on the Android Device without any issue,
But when i try to build the release APK by the following command it gives me lot of errors.

```<code>cd android
./gradlew assembleRelease
</code>```

If anyone can reproduce the steps and can tell me what has to be done to run the project and build APK from Android Studio without errors.

I am using React-native 1.2.0 version

Android Studio Dolphin 2021.3.1

Gradle Plugin Version 7.0.4

```<code>buildToolsVersion 31.0.0
minSdkVersion   23
compileSdkVersion   31
targetSdkVersion    31
glideVersion    4.11.0
kotlin_version  1.6.10
kotlinVersion   1.6.10
supportLibVersion   28.0.0
libre_build null
jitsi_url   https://github.com/RocketChat/jitsi-maven-repository/raw/master/releases
jitsi_version   3.7.0
</code>```

I have

```<code>java 17.0.4.1 2022-08-18 LTS
Java(TM) SE Runtime Environment (build 17.0.4.1+1-LTS-2)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.4.1+1-LTS-2, mixed mode, sharing)
</code>```

and also i tried with older version of JAVA  by adding in android - app - build.gradle file

```<code>android {
    ............
 compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
 .................
 }
</code>```

But can not able to run the project on Android Device.

I just want to try and build the release APK of this project myself.

Body:
I have downloaded the React Native project v4.32.0 from below link:
 https://github.com/RocketChat/Rocket.Chat.ReactNative

I tried to run the project using Android Studio but it is producing lot of errors.

I tried to run the same project using VS Code it runs on the Android Device without any issue,
But when i try to build the release APK by the following command it gives me lot of errors.

cd android
./gradlew assembleRelease

If anyone can reproduce the steps and can tell me what has to be done to run the project and build APK from Android Studio without errors.

I am using React-native 1.2.0 version

Android Studio Dolphin 2021.3.1

Gradle Plugin Version 7.0.4

buildToolsVersion 31.0.0
minSdkVersion   23
compileSdkVersion   31
targetSdkVersion    31
glideVersion    4.11.0
kotlin_version  1.6.10
kotlinVersion   1.6.10
supportLibVersion   28.0.0
libre_build null
jitsi_url   https://github.com/RocketChat/jitsi-maven-repository/raw/master/releases
jitsi_version   3.7.0

I have

java 17.0.4.1 2022-08-18 LTS
Java(TM) SE Runtime Environment (build 17.0.4.1+1-LTS-2)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.4.1+1-LTS-2, mixed mode, sharing)

and also i tried with older version of JAVA  by adding in android - app - build.gradle file

android {
    ............
 compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
 .................
 }

But can not able to run the project on Android Device.

I just want to try and build the release APK of this project myself.


问:
How to download a file without displaying directory selection UI when calling StorageAccessFramework in expo-file-system
I'm making a function to save a file downloaded from a server via expo-file-system.
In this code, when you click the download button on Android, the file selection UI appears, and when you select a file, the file is downloaded. However, I want files to be automatically downloaded in a specific directory without user selection, like a normal application.

When using requestDirectoryPermissionAsync, is it possible to directly download a file to a specific path without SelectionUI? If StorageAccessFramework doesn't have such a way, is there a way to solve this problem in expo-file-system?

code

```<code>import * as FileSystem from "expo-file-system";

const { StorageAccessFramework } = FileSystem;

const saveAndroidFile = async (fileUri, fileName, contentType) => {
    try {
        const fileDir = StorageAccessFramework.getUriForDirectoryInRoot("Download");

        // This function calls the UI in the image below
        const permissions = await StorageAccessFramework.requestDirectoryPermissionsAsync(fileDir);
        if (!permissions.granted) {
            return;
        }

        try {
            await StorageAccessFramework.createFileAsync(fileDir, fileName, contentType)
                .then(async (uri) => {
                    await FileSystem.writeAsStringAsync(uri, fileString, { encoding: FileSystem.EncodingType.Base64 });
                    alert("Report Downloaded Successfully");
                })
                .catch((e) => {
                    console.log(e);
                });
        } catch (e) {
            throw new Error(e);
        }
    } catch (err) {}
};
</code>```

Folder SelectionUI, which opens whenever requestDirectoryPermissionAsync is called

Body:
I'm making a function to save a file downloaded from a server via expo-file-system.
In this code, when you click the download button on Android, the file selection UI appears, and when you select a file, the file is downloaded. However, I want files to be automatically downloaded in a specific directory without user selection, like a normal application.

When using requestDirectoryPermissionAsync, is it possible to directly download a file to a specific path without SelectionUI? If StorageAccessFramework doesn't have such a way, is there a way to solve this problem in expo-file-system?

code

import * as FileSystem from "expo-file-system";

const { StorageAccessFramework } = FileSystem;

const saveAndroidFile = async (fileUri, fileName, contentType) => {
    try {
        const fileDir = StorageAccessFramework.getUriForDirectoryInRoot("Download");

        // This function calls the UI in the image below
        const permissions = await StorageAccessFramework.requestDirectoryPermissionsAsync(fileDir);
        if (!permissions.granted) {
            return;
        }

        try {
            await StorageAccessFramework.createFileAsync(fileDir, fileName, contentType)
                .then(async (uri) => {
                    await FileSystem.writeAsStringAsync(uri, fileString, { encoding: FileSystem.EncodingType.Base64 });
                    alert("Report Downloaded Successfully");
                })
                .catch((e) => {
                    console.log(e);
                });
        } catch (e) {
            throw new Error(e);
        }
    } catch (err) {}
};

Folder SelectionUI, which opens whenever requestDirectoryPermissionAsync is called


问:
PayloadTooLargeError: request entity too large react native
```<code>Android Running app on sdk_gphone_x86
Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
Sentry Logger [log]: Integration installed: Release
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: Breadcrumbs
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: Dedupe
Sentry Logger [log]: Integration installed: HttpContext
Sentry Logger [log]: Integration installed: EventOrigin
Sentry Logger [log]: Integration installed: SdkInfo
Sentry Logger [log]: Integration installed: DebugSymbolicator
Sentry Logger [log]: Integration installed: RewriteFrames
Sentry Logger [log]: Integration installed: ExpoManagedIntegration
device
false
PayloadTooLargeError: request entity too large
    at readStream (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\raw-body\index.js:155:17)
    at getRawBody (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\raw-body\index.js:108:12)
    at read (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\body-parser\lib\read.js:77:3)
    at jsonParser (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\body-parser\lib\types\json.js:135:5)
    at call (D:\personal\teleMed-master\node_modules\connect\index.js:239:7)
    at next (D:\personal\teleMed-master\node_modules\connect\index.js:183:5)
    at remoteDevtoolsCorsMiddleware (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\src\middleware\remoteDevtoolsCorsMiddleware.ts:31:3)
    at call (D:\personal\teleMed-master\node_modules\connect\index.js:239:7)
    at next (D:\personal\teleMed-master\node_modules\connect\index.js:183:5)
    at serveStatic (D:\personal\teleMed-master\node_modules\serve-static\index.js:75:16)

</code>```

I get this after expo start as soon as I run my app from iPhone. What is extra weird is that it's running code I've commented out, and is also running in some sort of infinite loop.

I'm unable to solve in react native can some one please help me out this issue enter image description here

Body:
Android Running app on sdk_gphone_x86
Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
Sentry Logger [log]: Integration installed: Release
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: Breadcrumbs
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: Dedupe
Sentry Logger [log]: Integration installed: HttpContext
Sentry Logger [log]: Integration installed: EventOrigin
Sentry Logger [log]: Integration installed: SdkInfo
Sentry Logger [log]: Integration installed: DebugSymbolicator
Sentry Logger [log]: Integration installed: RewriteFrames
Sentry Logger [log]: Integration installed: ExpoManagedIntegration
device
false
PayloadTooLargeError: request entity too large
    at readStream (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\raw-body\index.js:155:17)
    at getRawBody (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\raw-body\index.js:108:12)
    at read (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\body-parser\lib\read.js:77:3)
    at jsonParser (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\body-parser\lib\types\json.js:135:5)
    at call (D:\personal\teleMed-master\node_modules\connect\index.js:239:7)
    at next (D:\personal\teleMed-master\node_modules\connect\index.js:183:5)
    at remoteDevtoolsCorsMiddleware (C:\Users\hassn\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\src\middleware\remoteDevtoolsCorsMiddleware.ts:31:3)
    at call (D:\personal\teleMed-master\node_modules\connect\index.js:239:7)
    at next (D:\personal\teleMed-master\node_modules\connect\index.js:183:5)
    at serveStatic (D:\personal\teleMed-master\node_modules\serve-static\index.js:75:16)

I get this after expo start as soon as I run my app from iPhone. What is extra weird is that it's running code I've commented out, and is also running in some sort of infinite loop.

I'm unable to solve in react native can some one please help me out this issue enter image description here


问:
how to fix Web compatibility issue
```<code>npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@2.0.0: This functionality has been moved to @npmcli/fs
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated core-js@3.20.3: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of
hing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
</code>```

project is compiled successfully but ui is not working (like continously refreshing)

Title: how to fix Web compatibility issue

Body:
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@2.0.0: This functionality has been moved to @npmcli/fs
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated core-js@3.20.3: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of
hing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

project is compiled successfully but ui is not working (like continously refreshing)


问:
not able to query through an array in mongodb aggregation
this is the collection "Record"  :

```<code>{
    "_id" : "883f6174-fbbb-47f8-b280-7a798e8c0664",
    "history" : [
        {
            "_id" : "6bdd2919-9fe5-48b8-a009-5dec0efc10c3",
            "oldStatus" : "-NA-",
            "newStatus" : "IN_PROGRESS",
            "createdAt" : ISODate("2022-07-22T20:58:30.361Z")
        },
        {
            "_id" : "eedb3775-93e2-4f0d-afda-0032b7b343dd",
            "oldStatus" : "IN_PROGRESS",
            "newStatus" : "ACCEPTED",
            "createdAt" : ISODate("2022-10-10T16:30:04.781Z")
        }
    ],
    "source" : {
        "$ref" : "Source",
        "$id" : "65268f59-2a92-4414-8a79-c454c8059005"
    },
    "pipelineCreatedAt" : ISODate("2022-07-22T20:58:30.361Z")
}
</code>```

I tried

```<code>{$addFields: {inProgressDate : {$cond:{if:{$and: [{ $eq: [ "$history.oldStatus", '-NA-' ] },{ $eq: [ "$history.newStatus", 'IN_PROGRESS' ] }]},then:"$history.createdAt",else:null}}}}
</code>```

Expecting

My goal is :

```<code>WHERE progress time =  oldStatus : "-NA-" and newStatus : "IN_PROGRESS"
 and accepted time = oldStatus : "IN_PROGRESS" and newStatus : "ACCEPTED"
</code>```

Body:
this is the collection "Record"  :

{
    "_id" : "883f6174-fbbb-47f8-b280-7a798e8c0664",
    "history" : [
        {
            "_id" : "6bdd2919-9fe5-48b8-a009-5dec0efc10c3",
            "oldStatus" : "-NA-",
            "newStatus" : "IN_PROGRESS",
            "createdAt" : ISODate("2022-07-22T20:58:30.361Z")
        },
        {
            "_id" : "eedb3775-93e2-4f0d-afda-0032b7b343dd",
            "oldStatus" : "IN_PROGRESS",
            "newStatus" : "ACCEPTED",
            "createdAt" : ISODate("2022-10-10T16:30:04.781Z")
        }
    ],
    "source" : {
        "$ref" : "Source",
        "$id" : "65268f59-2a92-4414-8a79-c454c8059005"
    },
    "pipelineCreatedAt" : ISODate("2022-07-22T20:58:30.361Z")
}

I tried

{$addFields: {inProgressDate : {$cond:{if:{$and: [{ $eq: [ "$history.oldStatus", '-NA-' ] },{ $eq: [ "$history.newStatus", 'IN_PROGRESS' ] }]},then:"$history.createdAt",else:null}}}}

Expecting

My goal is :

WHERE progress time =  oldStatus : "-NA-" and newStatus : "IN_PROGRESS"
 and accepted time = oldStatus : "IN_PROGRESS" and newStatus : "ACCEPTED"


问:
Avalonia Datagrid MouseEvent Binding
I am a newbie to Avalonia, and I'v searched for many reference.

My purpose is to achieve a recent file lists and it will open the file when I click it.
I tried the DataGrid and it displays my data well, but I wonder how to bind MouseEvent to it.
For key event, I can use KeyBindings to handle, but I don't find such a MouseBindings or Command properties.

Maybe I get into a dead end that I should use ItemRepeater and Button to do such?

```<code><DataGrid Margin="16" RowHeight="24" Items="{Binding $parent[Window].DataContext.RecentFiles}" IsReadOnly="True" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False">
    <DataGrid.Columns>
        <DataGridTextColumn Width="*" Binding="{Binding Name}"/>
        <DataGridTextColumn Width="96" Binding="{Binding LastModifiedString}"/>
    </DataGrid.Columns>
</DataGrid>
</code>```

Title: Avalonia Datagrid MouseEvent Binding

Body:
I am a newbie to Avalonia, and I'v searched for many reference.

My purpose is to achieve a recent file lists and it will open the file when I click it.
I tried the DataGrid and it displays my data well, but I wonder how to bind MouseEvent to it.
For key event, I can use KeyBindings to handle, but I don't find such a MouseBindings or Command properties.

Maybe I get into a dead end that I should use ItemRepeater and Button to do such?

<DataGrid Margin="16" RowHeight="24" Items="{Binding $parent[Window].DataContext.RecentFiles}" IsReadOnly="True" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False">
    <DataGrid.Columns>
        <DataGridTextColumn Width="*" Binding="{Binding Name}"/>
        <DataGridTextColumn Width="96" Binding="{Binding LastModifiedString}"/>
    </DataGrid.Columns>
</DataGrid>


问:
art3d.pathpatch_2d_to_3d of paches.arc gives a full circle
I tried to draw an NBA court using matplotlib. I found the code from here but it's a 2D drawing. I modified a few lines and using art3d.pathpatch_2d_to_3d to transform all patches to a 3d plot. Everything works well except for Arc which shows a full circle.

from matplotlib.patches import Circle, Rectangle, Arc
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import art3d

def draw_court(ax=None, color='black', lw=2, outer_lines=False, ax_3d=False):
    # If an axes object isn't provided to plot onto, just get current one
    if ax is None:
        ax = plt.gca()

    # Create the various parts of an NBA basketball court

    # Create the basketball hoop
    # Diameter of a hoop is 18" so it has a radius of 9", which is a value
    # 7.5 in our coordinate system
    hoop = Circle((0, 0), radius=7.5, linewidth=lw, color=color, fill=False)

    # Create backboard
    backboard = Rectangle((-30, -7.5), 60, -1, linewidth=lw, color=color)

    # The paint
    # Create the outer box 0f the paint, width=16ft, height=19ft
    outer_box = Rectangle((-80, -47.5), 160, 190, linewidth=lw, color=color,
                          fill=False)
    # Create the inner box of the paint, widt=12ft, height=19ft
    inner_box = Rectangle((-60, -47.5), 120, 190, linewidth=lw, color=color,
                          fill=False)

    # Create free throw top arc
    top_free_throw = Arc((0, 142.5), 120, 120, theta1=0, theta2=180,
                         linewidth=lw, color=color, fill=False)
    # Create free throw bottom arc
    bottom_free_throw = Arc((0, 142.5), 120, 120, theta1=180, theta2=0,
                            linewidth=lw, color=color, linestyle='dashed')
    # Restricted Zone, it is an arc with 4ft radius from center of the hoop
    restricted = Arc((0, 0), 80, 80, theta1=0, theta2=180, linewidth=lw,
                     color=color)

    # Three point line
    # Create the side 3pt lines, they are 14ft long before they begin to arc
    corner_three_a = Rectangle((-220, -47.5), 0, 140, linewidth=lw,
                               color=color)
    corner_three_b = Rectangle((220, -47.5), 0, 140, linewidth=lw, color=color)
    # 3pt arc - center of arc will be the hoop, arc is 23'9" away from hoop
    # I just played around with the theta values until they lined up with the
    # threes
    three_arc = Arc((0, 0), 475, 475, theta1=22, theta2=158, linewidth=lw,
                    color=color)

    # Center Court
    center_outer_arc = Arc((0, 422.5), 120, 120, theta1=180, theta2=0,
                           linewidth=lw, color=color)
    center_inner_arc = Arc((0, 422.5), 40, 40, theta1=180, theta2=0,
                           linewidth=lw, color=color)

    # List of the court elements to be plotted onto the axes
    court_elements = [hoop, backboard, outer_box, inner_box, top_free_throw,
                      bottom_free_throw, restricted, corner_three_a,
                      corner_three_b, three_arc, center_outer_arc,
                      center_inner_arc]

    if outer_lines:
        # Draw the half court line, baseline and side out bound lines
        outer_lines = Rectangle((-250, -47.5), 500, 470, linewidth=lw,
                                color=color, fill=False)
        court_elements.append(outer_lines)

    # Add the court elements onto the axes
    for element in court_elements:
        ax.add_patch(element)
        if ax_3d:
            art3d.patch_2d_to_3d(element, z=0, zdir="z")

    return ax

if __name__ == "__main__":
    fig = plt.figure()
    ax = fig.add_subplot(121, projection='3d')
    ax.set(xlim3d=(-300, 500), xlabel='X')
    ax.set(ylim3d=(-300, 500), ylabel='Y')
    ax.set(zlim3d=(0, 300), zlabel='Z')
    draw_court(lw=1, outer_lines=True, ax_3d=True)

    ax2 = fig.add_subplot(122)
    ax2.set_xlim(-300, 500)
    ax2.set_ylim(-100, 500)
    draw_court(outer_lines=True)
    plt.show()
```
<p>Result:</p>
<p><img src="https://i.stack.imgur.com/ewUyT.png" alt="enter image description here" /></p>
<p>Version:</p>
<ul>
<li>matplotlib 3.5.3</li>
</ul>
<p>I found the same problem here which is a known bug. However, I can not find the solution.</p>
<p>Edited:</p>
<p>I found the solution from the discussion here.</p>
<p>I just edited patches.py and added</p>
```self._path = Path.arc(self.theta1, self.theta2)
```

to the Arc class init function. (in my case, line 1913).

Edited result:

However, following the discuss, they said the arc length is incorrect. In my case, the problem is that, there is additional line from one end to another end of the Arc.

Is there another solution for this problem?

Thank you.

Body:
I tried to draw an NBA court using matplotlib. I found the code from here but it's a 2D drawing. I modified a few lines and using art3d.pathpatch_2d_to_3d to transform all patches to a 3d plot. Everything works well except for Arc which shows a full circle.

from matplotlib.patches import Circle, Rectangle, Arc
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import art3d

def draw_court(ax=None, color='black', lw=2, outer_lines=False, ax_3d=False):
    # If an axes object isn't provided to plot onto, just get current one
    if ax is None:
        ax = plt.gca()

    # Create the various parts of an NBA basketball court

    # Create the basketball hoop
    # Diameter of a hoop is 18" so it has a radius of 9", which is a value
    # 7.5 in our coordinate system
    hoop = Circle((0, 0), radius=7.5, linewidth=lw, color=color, fill=False)

    # Create backboard
    backboard = Rectangle((-30, -7.5), 60, -1, linewidth=lw, color=color)

    # The paint
    # Create the outer box 0f the paint, width=16ft, height=19ft
    outer_box = Rectangle((-80, -47.5), 160, 190, linewidth=lw, color=color,
                          fill=False)
    # Create the inner box of the paint, widt=12ft, height=19ft
    inner_box = Rectangle((-60, -47.5), 120, 190, linewidth=lw, color=color,
                          fill=False)

    # Create free throw top arc
    top_free_throw = Arc((0, 142.5), 120, 120, theta1=0, theta2=180,
                         linewidth=lw, color=color, fill=False)
    # Create free throw bottom arc
    bottom_free_throw = Arc((0, 142.5), 120, 120, theta1=180, theta2=0,
                            linewidth=lw, color=color, linestyle='dashed')
    # Restricted Zone, it is an arc with 4ft radius from center of the hoop
    restricted = Arc((0, 0), 80, 80, theta1=0, theta2=180, linewidth=lw,
                     color=color)

    # Three point line
    # Create the side 3pt lines, they are 14ft long before they begin to arc
    corner_three_a = Rectangle((-220, -47.5), 0, 140, linewidth=lw,
                               color=color)
    corner_three_b = Rectangle((220, -47.5), 0, 140, linewidth=lw, color=color)
    # 3pt arc - center of arc will be the hoop, arc is 23'9" away from hoop
    # I just played around with the theta values until they lined up with the
    # threes
    three_arc = Arc((0, 0), 475, 475, theta1=22, theta2=158, linewidth=lw,
                    color=color)

    # Center Court
    center_outer_arc = Arc((0, 422.5), 120, 120, theta1=180, theta2=0,
                           linewidth=lw, color=color)
    center_inner_arc = Arc((0, 422.5), 40, 40, theta1=180, theta2=0,
                           linewidth=lw, color=color)

    # List of the court elements to be plotted onto the axes
    court_elements = [hoop, backboard, outer_box, inner_box, top_free_throw,
                      bottom_free_throw, restricted, corner_three_a,
                      corner_three_b, three_arc, center_outer_arc,
                      center_inner_arc]

    if outer_lines:
        # Draw the half court line, baseline and side out bound lines
        outer_lines = Rectangle((-250, -47.5), 500, 470, linewidth=lw,
                                color=color, fill=False)
        court_elements.append(outer_lines)

    # Add the court elements onto the axes
    for element in court_elements:
        ax.add_patch(element)
        if ax_3d:
            art3d.patch_2d_to_3d(element, z=0, zdir="z")

    return ax

if __name__ == "__main__":
    fig = plt.figure()
    ax = fig.add_subplot(121, projection='3d')
    ax.set(xlim3d=(-300, 500), xlabel='X')
    ax.set(ylim3d=(-300, 500), ylabel='Y')
    ax.set(zlim3d=(0, 300), zlabel='Z')
    draw_court(lw=1, outer_lines=True, ax_3d=True)

    ax2 = fig.add_subplot(122)
    ax2.set_xlim(-300, 500)
    ax2.set_ylim(-100, 500)
    draw_court(outer_lines=True)
    plt.show()

Result:

Version:

matplotlib 3.5.3

I found the same problem here which is a known bug. However, I can not find the solution.

Edited:

I found the solution from the discussion here.

I just edited patches.py and added

self._path = Path.arc(self.theta1, self.theta2)

to the Arc class init function. (in my case, line 1913).

Edited result:

However, following the discuss, they said the arc length is incorrect. In my case, the problem is that, there is additional line from one end to another end of the Arc.

Is there another solution for this problem?

Thank you.


问:
Is it guaranteed that the integer part of a double will not lose precision?
I was reading this SO question on the biggest integer than can be stored in a double and I have a related question.

The Wikipedia article on double states that:

Between 2^52=4,503,599,627,370,496 and 2^53=9,007,199,254,740,992 the representable numbers are exactly the integers. For the next range, from 2^53 to 2^54, everything is multiplied by 2, so the representable numbers are the even ones, etc. Conversely, for the previous range from 2^51 to 2^52, the spacing is 0.5, etc.

The spacing as a fraction of the numbers in the range from 2^n to 2^(n+1) is 2^(n−52).

Assuming the information above is correct, and wrt the other SO question, can I take it that below 2^53, the integer part of a double will not lose precision?

I need to handle (as in perform arithmetic operations on) large real numbers (below 2^53) storing them as a double and am willing to lose precision in the fractional part but not in the integer part. Hence the question.


问:
character error when uploading high size file
I have a large .sql file and when I try to upload it I get an error like this

```<code>mysql -u root -p --default-character-set=utf8 db_name < file.sql
</code>```

The error i got;

```<code>ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: 'SQLite format 3'.
</code>```

I also tried different installation attempts but without success.

```<code>mysql -hlocalhost -r -uroot -p --binary-mode -o db_name < file.sql
</code>```
```<code>mysqldump -p -u root db_name --hex-blob > file.sql
</code>```

Body:
I have a large .sql file and when I try to upload it I get an error like this

mysql -u root -p --default-character-set=utf8 db_name < file.sql

The error i got;

ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: 'SQLite format 3'.

I also tried different installation attempts but without success.

mysql -hlocalhost -r -uroot -p --binary-mode -o db_name < file.sql

mysqldump -p -u root db_name --hex-blob > file.sql


问:
libawt_xawt.so: libXtst.so.6 in redhat 8.3 yum

I am try to install oracle manager server in linux redhat 8.3  oprating system but getting error where try to install this package also not able to install help please any one

I am try to install oracle manager server in linux redhat 8.3  oprating system but getting error where try to install this package also not able to install help please any one


问:
Why is the first line after the try statement printing twice when the loop restarts?
```<code>while (true) {
    try {
        System.out.println("Choose a player or type quit: Nirvaan(" + player1.getMoney() + ") or Faris(" + player2.getMoney() + ")");
        String chosenPlayer = scanner.nextLine();

        if (chosenPlayer.equalsIgnoreCase("quit")) {
            break;
        }

        Player player = null;
        if (chosenPlayer.equalsIgnoreCase(player1.getName())) {
            player = player1;
        } else if (chosenPlayer.equalsIgnoreCase(player2.getName())) {
            player = player2;
        }

        System.out.println("Which game would " + player.getName() + " like to play? ");
        System.out.println("1. Balloon Darts");
        System.out.println("2. Ring Toss");
        System.out.println("3. Break a Plate");
        System.out.println("4. Quit");
        System.out.print("> ");

        int choice = scanner.nextInt();

        // Check if the user chose to quit
        if (choice == 4) {
            break;
        }

        // Get the chosen game
        GameBooth game = games.get(choice - 1);

        // Let the players play the game
        System.out.println(player.getName() + " goes to " + game.getName());
        game.playGame(player);

    } catch (Exception e) {

    }
}
</code>```

OUTPUT//

```<code>Choose a player or type quit: Nirvaan(5.0) or Faris(3.0)
nirvaan
Which game would Nirvaan like to play?
1. Balloon Darts
2. Ring Toss
3. Break a Plate
4. Quit
> 1
Nirvaan goes to Balloon Darts
Nirvaan won a Sticker
Choose a player or type quit: Nirvaan(3.0) or Faris(3.0)
Choose a player or type quit: Nirvaan(3.0) or Faris(3.0)
</code>```

I tried moving the choose player line out of the try statment but that did not work, it kept on doing the same thing.

Body:
while (true) {
    try {
        System.out.println("Choose a player or type quit: Nirvaan(" + player1.getMoney() + ") or Faris(" + player2.getMoney() + ")");
        String chosenPlayer = scanner.nextLine();

        if (chosenPlayer.equalsIgnoreCase("quit")) {
            break;
        }

        Player player = null;
        if (chosenPlayer.equalsIgnoreCase(player1.getName())) {
            player = player1;
        } else if (chosenPlayer.equalsIgnoreCase(player2.getName())) {
            player = player2;
        }

        System.out.println("Which game would " + player.getName() + " like to play? ");
        System.out.println("1. Balloon Darts");
        System.out.println("2. Ring Toss");
        System.out.println("3. Break a Plate");
        System.out.println("4. Quit");
        System.out.print("> ");

        int choice = scanner.nextInt();

        // Check if the user chose to quit
        if (choice == 4) {
            break;
        }

        // Get the chosen game
        GameBooth game = games.get(choice - 1);

        // Let the players play the game
        System.out.println(player.getName() + " goes to " + game.getName());
        game.playGame(player);

    } catch (Exception e) {

    }
}

OUTPUT//

Choose a player or type quit: Nirvaan(5.0) or Faris(3.0)
nirvaan
Which game would Nirvaan like to play?
1. Balloon Darts
2. Ring Toss
3. Break a Plate
4. Quit
> 1
Nirvaan goes to Balloon Darts
Nirvaan won a Sticker
Choose a player or type quit: Nirvaan(3.0) or Faris(3.0)
Choose a player or type quit: Nirvaan(3.0) or Faris(3.0)

I tried moving the choose player line out of the try statment but that did not work, it kept on doing the same thing.


问:
Is it possible to define an efficient hyper-operation sequence as a recursive squaring function over 2-adics in Haskell?
Let's define a 2-adic in Haskell as its infinite binary expansion:

data Adic = O Adic | I Adic deriving Show
```
<p>We can represent finite numbers as follows:</p>
<pre class="lang-hs prettyprint-override"><code>zero = O zero
one  = I zero
neg1 = I neg1
</code>```

And we can easily define Inc and Add for Adic:

inc :: Adic -> Adic
inc (O a) = I a
inc (I a) = O (Inc a)

add :: Adic -> Adic -> Adic
add (O a) (O b) = O (add a b)
add (O a) (I b) = I (add a b)
add (I a) (O b) = I (add a b)
add (I a) (I b) = I (inc (add a b))
```
<p>We can convert adics to ints follows:</p>
<pre class="lang-hs prettyprint-override"><code>a2i :: Int -> Adic -> Int
a2i 1 (O x) = 0
a2i 0 (I x) = -1
a2i s (O x) = 2 * i2a (s - 1) x
a2i s (I x) = 2 * i2a (s - 1) x + 1
</code>```

This allows us to do basic arithmetic. For example:

```<code>print $ a2i 64 (add one neg1)
</code>```

Would print 0, after computing 1 + -1 on 2-adics.

Now, I'm interested in the hyper-operation sequence function, i.e.:

hyp :: Int -> Adic -> Adic -> Adic
hyp 0 a b = add a b
hyp 1 a b = mul a b
hyp 2 a b = exp a b
hyp 3 a b = tet a b
...
```
<p>An efficient way to implement it is by generalizing the exponentiation by squaring algorithm, as follows:</p>
<pre class="lang-hs prettyprint-override"><code>hyp :: Int -> Adic -> Adic -> Adic
hyp 0 a b = add a b
hyp s a 1 = a
hyp s a (O b) = let r = hyp s a b       in hyp (s - 1) r r
hyp s a (I b) = let r = hyp s a (Inc b) in hyp (s - 1) r r
</code>```

To visualize the function above, below is the evaluation of hyp 2 4 4, i.e., 4^4:

```<code>4^4 =
4^2 * 4^2 =
4^1 * 4^1 * 4^1 * 4^1 =
4   * 4   * 4   * 4   =

4*4 * 4*4 =
(4*2 + 4*2) * (4*2 * 4*2) =
(4*1 + 4*1 + 4*1 + 4*1) * (4*1 + 4*1 + 4*1 + 4*1) =
(4   + 4   + 4   + 4)   * (4   + 4   + 4   + 4)   =

16*16 =
16*8 + 16*8 =
16*4 + 16*4 + 16*4 + 16*4 =
16*2 + 16*2 + 16*2 + 16*2 + 16*2 + 16*2 + 16*2 + 16*2 =
16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 =
16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   =

256
</code>```

Sadly, the function above doesn't actually work, because the hyp s a 1 = a line attempts to match an Adic against the Int 1, which makes no sense. What it should do, instead, is match against the 2-adic number 1. The problem is: 2-adics are infinite, so we can't match them. We can't even create an is one function. As such, while the function above seems elegant and efficient, it, as far as I can tell, can't be constructed. My question is: am I right in concluding hyp can't be implemented that way, or am I missing something? Is there an alternative approach that would let this work?

Body:
Let's define a 2-adic in Haskell as its infinite binary expansion:

data Adic = O Adic | I Adic deriving Show

We can represent finite numbers as follows:

zero = O zero
one  = I zero
neg1 = I neg1

And we can easily define Inc and Add for Adic:

inc :: Adic -> Adic
inc (O a) = I a
inc (I a) = O (Inc a)

add :: Adic -> Adic -> Adic
add (O a) (O b) = O (add a b)
add (O a) (I b) = I (add a b)
add (I a) (O b) = I (add a b)
add (I a) (I b) = I (inc (add a b))

We can convert adics to ints follows:

a2i :: Int -> Adic -> Int
a2i 1 (O x) = 0
a2i 0 (I x) = -1
a2i s (O x) = 2 * i2a (s - 1) x
a2i s (I x) = 2 * i2a (s - 1) x + 1

This allows us to do basic arithmetic. For example:

print $ a2i 64 (add one neg1)

Would print 0, after computing 1 + -1 on 2-adics.

Now, I'm interested in the hyper-operation sequence function, i.e.:

hyp :: Int -> Adic -> Adic -> Adic
hyp 0 a b = add a b
hyp 1 a b = mul a b
hyp 2 a b = exp a b
hyp 3 a b = tet a b
...

An efficient way to implement it is by generalizing the exponentiation by squaring algorithm, as follows:

hyp :: Int -> Adic -> Adic -> Adic
hyp 0 a b = add a b
hyp s a 1 = a
hyp s a (O b) = let r = hyp s a b       in hyp (s - 1) r r
hyp s a (I b) = let r = hyp s a (Inc b) in hyp (s - 1) r r

To visualize the function above, below is the evaluation of hyp 2 4 4, i.e., 4^4:

4^4 =
4^2 * 4^2 =
4^1 * 4^1 * 4^1 * 4^1 =
4   * 4   * 4   * 4   =

4*4 * 4*4 =
(4*2 + 4*2) * (4*2 * 4*2) =
(4*1 + 4*1 + 4*1 + 4*1) * (4*1 + 4*1 + 4*1 + 4*1) =
(4   + 4   + 4   + 4)   * (4   + 4   + 4   + 4)   =

16*16 =
16*8 + 16*8 =
16*4 + 16*4 + 16*4 + 16*4 =
16*2 + 16*2 + 16*2 + 16*2 + 16*2 + 16*2 + 16*2 + 16*2 =
16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 + 16*1 =
16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   + 16   =

256

Sadly, the function above doesn't actually work, because the hyp s a 1 = a line attempts to match an Adic against the Int 1, which makes no sense. What it should do, instead, is match against the 2-adic number 1. The problem is: 2-adics are infinite, so we can't match them. We can't even create an is one function. As such, while the function above seems elegant and efficient, it, as far as I can tell, can't be constructed. My question is: am I right in concluding hyp can't be implemented that way, or am I missing something? Is there an alternative approach that would let this work?


问:
SQL Query String Showing Up in Web Console Local Storage
While debugging a web application on Firefox web browser, I was surprised to see an SQL Database Query string showing up in the web-console log under Local-Storage sub-category autoSavedSql_xxxx. How is this even possible? Wrong echo at the PHP back-end? It even has the database-name and the search value! Any pointers to why this is happening will be highly appreciated - I don't think it is normal behavior to be doing this.

The backed uses PHP 7.2, MariaDB 10, on Rocky Linux 8; the front is on the usual mix plus jQuery. No other frameworks. Shown string:

```<code>SELECT * from 'real-table-name' WHRE Column-name = 'real-search-value';
</code>```

I was not expecting to see these database search details on a web-console like this.

Body:
While debugging a web application on Firefox web browser, I was surprised to see an SQL Database Query string showing up in the web-console log under Local-Storage sub-category autoSavedSql_xxxx. How is this even possible? Wrong echo at the PHP back-end? It even has the database-name and the search value! Any pointers to why this is happening will be highly appreciated - I don't think it is normal behavior to be doing this.

The backed uses PHP 7.2, MariaDB 10, on Rocky Linux 8; the front is on the usual mix plus jQuery. No other frameworks. Shown string:

SELECT * from 'real-table-name' WHRE Column-name = 'real-search-value';

I was not expecting to see these database search details on a web-console like this.