问:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'total_item' cannot be null
I’m trying to create payment integration snap token request, which is a local payment mostly like PayPal. the problem is I couldn’t get request from datatables transactions, and the error output is  Integrity constraint violation: 1048 Column 'total_item' cannot be null.

controller.php

```<code>public function index()
{
    return view('midtrans.index');
}

public function payment(Request $request)
{
    // Set your Merchant Server Key
    \Midtrans\Config::$serverKey = env('MIDTRANS_SERVER_KEY');
    // Set to Development/Sandbox Environment (default). Set to true for Production Environment (accept real transaction).
    \Midtrans\Config::$isProduction = false;
    // Set sanitization on (default)
    \Midtrans\Config::$isSanitized = true;
    // Set 3DS transaction for credit card to true
    \Midtrans\Config::$is3ds = true;

    $penjualan  = Penjualan::find(session('id_penjualan'));
    $detail = PenjualanDetail::where('id_penjualan', $penjualan->id_penjualan)->get();

    $validator = \Validator::make(request()->all(), [
        'id_penjualan' => 'required|string|max:255',
        'id_member' => 'required|string|max:255',
        'total_item' => 'required|string|max:255',
        'total_harga'=> 'required| numeric | min:0.01',
        'ppn' => 'required|numeric|min:1',
        'diskon' => 'required|numeric|min:1',
        'bayar' => 'required|numeric|min:1',
        'diterima' => 'required|int|numeric|min:1',
    ]);

    //   $validated = $request->validated();
    \DB::transaction(function() use($request) {              // use($validated)
        $penjualan = Penjualan::create([
            'id_penjualan' => $request->id_penjualan,   // $validated['id_penjualan']
            'id_member' => $request->id_member,
            'total_item' => $request->total_item,
            'total_harga' => $request->total_harga,
            'ppn' => $request->ppn,
            'diskon' => $request->diskon,
            'bayar' => $request->bayar,
            'diterima' => $request->diterima,
            'id_user'  => auth()->user()->id           // Auth::user()->id,
    ]);

        $params = array(
            'transaction_details' => array(
                'order_id' => rand(),
                'gross_amount' => $penjualan->bayar,
            ),
            'item_details' => array(
                [
                    'id' => $penjualan->id_penjualan,
                    'price' => $penjualan->harga_jual,
                    'quantity' => $penjualan->jumlah,
                    'name' => $penjualan->nama_produk
                ]
            ),
            'customer_details' => array(
                'first_name' => $request->get('uname'),
                'last_name' => '',
                'email' => $request->get('email'),
                'phone' => $request->get('number')
            ),
        );

        $snapToken = \Midtrans\Snap::getSnapToken($params);
        $penjualan->snap_token = $snapToken;
        $penjualan->save();

        $this->response['snap_token'] = $snapToken;
    });
    return view('midtrans.payment', ['snap_token'=>$snapToken]);
}

public function payment_post(Request $request)
{
    $json = json_decode($request->get('json'));
    $penjualan = Penjualan::findOrFail($request->id_penjualan);
    $penjualan->status = $json->transaction_status;
    $penjualan->uname = $request->get('uname');
    $penjualan->email = $request->get('email');
    $penjualan->number = $request->get('number');
    $penjualan->transaction_id = $json->transaction_id;
    $penjualan->order_id = $json->order_id;
    $penjualan->gross_amount = $json->gross_amount;
    $penjualan->payment_type = $json->payment_type;
    $penjualan->payment_code = isset($json->payment_code) ? $json->payment_code : null;
    $penjualan->pdf_url = isset($json->pdf_url) ? $json->pdf_url : null;
    return $order->save() ? redirect(url('/'))->with('alert-success', 'Order berhasil dibuat') : redirect(url('/'))->with('alert-failed', 'Terjadi kesalahan');
}
</code>```

does anyone can help what I’m missing? thanks

Body:
I’m trying to create payment integration snap token request, which is a local payment mostly like PayPal. the problem is I couldn’t get request from datatables transactions, and the error output is  Integrity constraint violation: 1048 Column 'total_item' cannot be null.

controller.php

public function index()
{
    return view('midtrans.index');
}

public function payment(Request $request)
{
    // Set your Merchant Server Key
    \Midtrans\Config::$serverKey = env('MIDTRANS_SERVER_KEY');
    // Set to Development/Sandbox Environment (default). Set to true for Production Environment (accept real transaction).
    \Midtrans\Config::$isProduction = false;
    // Set sanitization on (default)
    \Midtrans\Config::$isSanitized = true;
    // Set 3DS transaction for credit card to true
    \Midtrans\Config::$is3ds = true;

    $penjualan  = Penjualan::find(session('id_penjualan'));
    $detail = PenjualanDetail::where('id_penjualan', $penjualan->id_penjualan)->get();

    $validator = \Validator::make(request()->all(), [
        'id_penjualan' => 'required|string|max:255',
        'id_member' => 'required|string|max:255',
        'total_item' => 'required|string|max:255',
        'total_harga'=> 'required| numeric | min:0.01',
        'ppn' => 'required|numeric|min:1',
        'diskon' => 'required|numeric|min:1',
        'bayar' => 'required|numeric|min:1',
        'diterima' => 'required|int|numeric|min:1',
    ]);

    //   $validated = $request->validated();
    \DB::transaction(function() use($request) {              // use($validated)
        $penjualan = Penjualan::create([
            'id_penjualan' => $request->id_penjualan,   // $validated['id_penjualan']
            'id_member' => $request->id_member,
            'total_item' => $request->total_item,
            'total_harga' => $request->total_harga,
            'ppn' => $request->ppn,
            'diskon' => $request->diskon,
            'bayar' => $request->bayar,
            'diterima' => $request->diterima,
            'id_user'  => auth()->user()->id           // Auth::user()->id,
    ]);

        $params = array(
            'transaction_details' => array(
                'order_id' => rand(),
                'gross_amount' => $penjualan->bayar,
            ),
            'item_details' => array(
                [
                    'id' => $penjualan->id_penjualan,
                    'price' => $penjualan->harga_jual,
                    'quantity' => $penjualan->jumlah,
                    'name' => $penjualan->nama_produk
                ]
            ),
            'customer_details' => array(
                'first_name' => $request->get('uname'),
                'last_name' => '',
                'email' => $request->get('email'),
                'phone' => $request->get('number')
            ),
        );

        $snapToken = \Midtrans\Snap::getSnapToken($params);
        $penjualan->snap_token = $snapToken;
        $penjualan->save();

        $this->response['snap_token'] = $snapToken;
    });
    return view('midtrans.payment', ['snap_token'=>$snapToken]);
}

public function payment_post(Request $request)
{
    $json = json_decode($request->get('json'));
    $penjualan = Penjualan::findOrFail($request->id_penjualan);
    $penjualan->status = $json->transaction_status;
    $penjualan->uname = $request->get('uname');
    $penjualan->email = $request->get('email');
    $penjualan->number = $request->get('number');
    $penjualan->transaction_id = $json->transaction_id;
    $penjualan->order_id = $json->order_id;
    $penjualan->gross_amount = $json->gross_amount;
    $penjualan->payment_type = $json->payment_type;
    $penjualan->payment_code = isset($json->payment_code) ? $json->payment_code : null;
    $penjualan->pdf_url = isset($json->pdf_url) ? $json->pdf_url : null;
    return $order->save() ? redirect(url('/'))->with('alert-success', 'Order berhasil dibuat') : redirect(url('/'))->with('alert-failed', 'Terjadi kesalahan');
}

does anyone can help what I’m missing? thanks


来源: stackexchange

问:
In Django's template, how to access a element in a nested loop by index
Project: I create sudoku 9x9 using Django. After user input value, I will response the result.For user easy to understand, the input element and resolved element will be displayed at different color.

Problem: Try to access the element in a nested loop by index (like matrix_result.row.col), but it does not work.

In views.py has successfully pass to matrix: matrix_input, matrix_result

```<code>            matrix_input1 = [[5, 7, 0, 3, 6, 4, 2, 9, 8],
                            [6, 3, 0, 7, 9, 2, 4, 1, 5],
                            [9, 4, 2, 0, 1, 5, 3, 0, 7],
                            [3, 2, 4, 0, 5, 8, 6, 7, 9],
                            [8, 6, 9, 2, 0, 7, 5, 0, 1],
                            [7, 1, 5, 6, 0, 9, 8, 3, 2],
                            [1, 8, 6, 9, 2, 0, 7, 5, 4],
                            [2, 5, 3, 4, 7, 0, 9, 8, 6],
                            [4, 9, 7, 5, 8, 6, 1, 0, 3]]

            matrix_result1 = [[5, 3, 7, 1, 6, 4, 2, 9, 8],
                            [6, 3, 4, 7, 9, 2, 4, 1, 5],
                            [9, 4, 2, 7, 1, 5, 3, 0, 7],
                            [3, 2, 4, 9, 5, 8, 6, 7, 9],
                            [8, 6, 9, 2, 4, 7, 5, 0, 1],
                            [7, 1, 5, 6, 2, 9, 8, 3, 2],
                            [1, 8, 6, 9, 2, 8, 7, 5, 4],
                            [2, 5, 3, 4, 7, 9, 9, 8, 6],
                            [4, 9, 7, 5, 8, 6, 1, 2, 3]]
return render(request,'sudoku_app/display_sloved_result.html', {'matrix_result1': matrix_result1, 'matrix_input1': matrix_input1})
</code>```

In display_sloved_result.html, the below code was be processed.

```<code>{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Hotel_image</title>
</head>
<body>
    <style>
    table { border-collapse: collapse; font-family: Calibri, sans-serif; text-align: center;}
    colgroup, tbody { border: solid medium; }

    td {
        border: solid thin;
        height: 45px;
        width: 45px;
        text-align: center;
        padding: 0;
        font-size: x-large;
        font-weight: 500px;
    }
    .trx{
            border-bottom: solid medium;
            }
    </style>

    <h1>This is the Solved Result</h1>

    <table>
        <colgroup><col><col><col></colgroup>
        <colgroup><col><col><col></colgroup>
        <colgroup><col><col><col></colgroup>
            {% for row in matrix_input1 %}
                {% if forloop.counter0 == 2 or forloop.counter0 == 5 %}
                    <tr class="trx">
                {% else %}
                    <tr>
                {% endif %}

                {% for col in row %}
                    {% if col != 0 %}
                        <td> {{ col }} </td>
                    {% else %}
                       <td>{{matrix_result1.forloop.parentloop.counter0.forloop.counter0}}</td>
                    {% endif %}
                {% endfor %}
                </tr>
            {% endfor %}
    </table>
</body>

</html>
</code>```

Result:
The result is display as attached image .
The problem is

{{matrix_result1.forloop.parentloop.counter0.forloop.counter0}}

do not reply any value.

Question: It is possible to access element in nested loop by index in Django's template

ContentLicense: CC BY-SA 4.0

Body:
Project: I create sudoku 9x9 using Django. After user input value, I will response the result.For user easy to understand, the input element and resolved element will be displayed at different color.

Problem: Try to access the element in a nested loop by index (like matrix_result.row.col), but it does not work.

In views.py has successfully pass to matrix: matrix_input, matrix_result

            matrix_input1 = [[5, 7, 0, 3, 6, 4, 2, 9, 8],
                            [6, 3, 0, 7, 9, 2, 4, 1, 5],
                            [9, 4, 2, 0, 1, 5, 3, 0, 7],
                            [3, 2, 4, 0, 5, 8, 6, 7, 9],
                            [8, 6, 9, 2, 0, 7, 5, 0, 1],
                            [7, 1, 5, 6, 0, 9, 8, 3, 2],
                            [1, 8, 6, 9, 2, 0, 7, 5, 4],
                            [2, 5, 3, 4, 7, 0, 9, 8, 6],
                            [4, 9, 7, 5, 8, 6, 1, 0, 3]]

            matrix_result1 = [[5, 3, 7, 1, 6, 4, 2, 9, 8],
                            [6, 3, 4, 7, 9, 2, 4, 1, 5],
                            [9, 4, 2, 7, 1, 5, 3, 0, 7],
                            [3, 2, 4, 9, 5, 8, 6, 7, 9],
                            [8, 6, 9, 2, 4, 7, 5, 0, 1],
                            [7, 1, 5, 6, 2, 9, 8, 3, 2],
                            [1, 8, 6, 9, 2, 8, 7, 5, 4],
                            [2, 5, 3, 4, 7, 9, 9, 8, 6],
                            [4, 9, 7, 5, 8, 6, 1, 2, 3]]
return render(request,'sudoku_app/display_sloved_result.html', {'matrix_result1': matrix_result1, 'matrix_input1': matrix_input1})

In display_sloved_result.html, the below code was be processed.

{% load static %}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Hotel_image</title>

This is the Solved Result

        <colgroup><col><col><col></colgroup>
        <colgroup><col><col><col></colgroup>
        <colgroup><col><col><col></colgroup>
            {% for row in matrix_input1 %}
                {% if forloop.counter0 == 2 or forloop.counter0 == 5 %}

                {% else %}

                {% endif %}

                {% for col in row %}
                    {% if col != 0 %}
                         {{ col }}
                    {% else %}
                       {{matrix_result1.forloop.parentloop.counter0.forloop.counter0}}
                    {% endif %}
                {% endfor %}

            {% endfor %}

Result:
The result is display as attached image .
The problem is

{{matrix_result1.forloop.parentloop.counter0.forloop.counter0}}

do not reply any value.

Question: It is possible to access element in nested loop by index in Django's template


问:
Type hints for attributes using getattr
I'd like to forward the call of a method to another method, and have the second method's type hints show up in the first method. Probably easier to demonstrate.

When an instance of the class below is called, it looks up the method with the name "num_to_str", calls it, and returns the result. I'd like the type hints for "num_to_str" to show up when you call the object.

class MyClass:

    call_func_name = 'num_to_str'

    def num_to_str(self, num: int) -> str:
        return str(num)

    def __call__(self, *args, **kwds):
        return getattr(self, 'call_func_name')(*args, **kwds)

mc = MyClass()
mc(<tab>. # want type hints for num_to_str to show up
```

I'm using the method name and looking up via getattr rather than just setting __call__ = num_to_start  so that if the num_to_str function is changed (for example, overridden in a subclass), it uses the correct/updated function.

Using Pylance/Pyright in VS Code for autocompletion/type hints.

Title: Type hints for attributes using getattr

Body:
I'd like to forward the call of a method to another method, and have the second method's type hints show up in the first method. Probably easier to demonstrate.

When an instance of the class below is called, it looks up the method with the name "num_to_str", calls it, and returns the result. I'd like the type hints for "num_to_str" to show up when you call the object.

class MyClass:

    call_func_name = 'num_to_str'

    def num_to_str(self, num: int) -> str:
        return str(num)

    def __call__(self, *args, **kwds):
        return getattr(self, 'call_func_name')(*args, **kwds)

mc = MyClass()
mc(<tab>. # want type hints for num_to_str to show up

I'm using the method name and looking up via getattr rather than just setting __call__ = num_to_start  so that if the num_to_str function is changed (for example, overridden in a subclass), it uses the correct/updated function.

Using Pylance/Pyright in VS Code for autocompletion/type hints.


问:
Using google_sign_in, on sign out we are navigated to a screen to choose account, but that account doesn't re-authenticate
Using google_sign_in, I login first time, pick account and then logout.
Now, I try to login again, we are navigated to a screen to choose account, but that account doesn't re-authenticate (meaning ask for password). How do I ensure my previous signout ensures that the user has to re-authenticate(enter password) for next sign in.

I do the following to signout:

```<code> Future<void> signOut() async {
    if (_firebaseAuth.currentUser!.providerData.first.providerId ==
        "google.com") {
      print("signing out from Google");
      await _googleSignIn.signOut();
    }
    return _firebaseAuth.signOut();
  }
</code>```

Body:
Using google_sign_in, I login first time, pick account and then logout.
Now, I try to login again, we are navigated to a screen to choose account, but that account doesn't re-authenticate (meaning ask for password). How do I ensure my previous signout ensures that the user has to re-authenticate(enter password) for next sign in.

I do the following to signout:

 Future<void> signOut() async {
    if (_firebaseAuth.currentUser!.providerData.first.providerId ==
        "google.com") {
      print("signing out from Google");
      await _googleSignIn.signOut();
    }
    return _firebaseAuth.signOut();
  }


问:
Code to scroll to anchor points on one page and highlight anchor menu item not working in Firefox
My home page has 7 anchor points which are the first 7 items on my menu. The last menu item “Reservations" is a separate page.

After a lot of blundering work with minimal knowledge I have javascript that highlights the correct menu item when the home page scrolls to the relevant anchor point. Everything seems to work fine in Chrome and Safari. Works fine for the mobile menu too, at least on iPhone in Safari. (white inactive, red active)

In Firefox it does not work. Scrolling works fine. But anchors all show active (red) when on the homepage. Any thoughts on what would make Firefox unique?

Test website is here https://hotelcasasadev.wpengine.com/

My code is here https://codepen.io/mgason/pen/MWBmBjm?editors=0010

Video of the problem using 3 browsers is here https://www.veed.io/view/a2b10045-5b3f-4ebd-a2d0-5e6b4d16174e?panel=share

```<code>jQuery(document).ready(function( $ ){
(function($){

    $(window).on( 'load', function() {
        $.setMenuActive();
    });

/**
 * Set active anchor links on scroll
 */

$.setMenuActive = function()
{
    //var $menu = $( '#primary-menu' );

var $menu;
    if ($('#main-header').css('display') == 'none') {
              $menu = '#mobile-menu';
            } else {
            $menu = '#primary-menu';
        }
            //console.log($menu);

    if ( !$menu.length )
        return;

    var $menuItems = $( '.menu-anchor', $menu ),
        $lastItem = $menuItems.last(),
          $headerWrapper = $( '#masthead' ),
          adminBarHeight = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).outerHeight() : 0,
      headerHeight = $headerWrapper.outerHeight() + adminBarHeight -1;
    var activeOnScroll = function()
    {
        var cur_pos = $(window).scrollTop();

        $menuItems.each( function()
    {
            var $this = $(this),
          $menuAnchor = $( 'a', this ),
          $target = $(  '#' + $menuAnchor.attr('href').split('#').pop() ),
          offsetTop = $target.offset().top - (headerHeight+2),
          offsetBottom = offsetTop + $target.outerHeight();

            if ( offsetTop <= cur_pos && offsetBottom > cur_pos )
            {
                if ( !$this.hasClass( 'current-menu-item current_page_item' ) )
                {
                    $menuItems.removeClass( 'current-menu-item current_page_item' );
                    $this.addClass( 'current-menu-item' );
                }
            }
            else
            {
                if ( $this.hasClass( 'current-menu-item current_page_item' ) )
          $this.removeClass( 'current-menu-item current_page_item' );
            }

        });

        if (cur_pos + $(window).height() == $(document).height() && !$lastItem.hasClass( 'current-menu-item current_page_item' ))
        {
            $menuItems.removeClass( 'current-menu-item current_page_item' );
            $lastItem.addClass( 'current-menu-item' );
        }
    };

    $(window).on( 'scroll', activeOnScroll );
    activeOnScroll();
};

})(jQuery);
    });
</code>```

Body:
My home page has 7 anchor points which are the first 7 items on my menu. The last menu item “Reservations" is a separate page.

After a lot of blundering work with minimal knowledge I have javascript that highlights the correct menu item when the home page scrolls to the relevant anchor point. Everything seems to work fine in Chrome and Safari. Works fine for the mobile menu too, at least on iPhone in Safari. (white inactive, red active)

In Firefox it does not work. Scrolling works fine. But anchors all show active (red) when on the homepage. Any thoughts on what would make Firefox unique?

Test website is here https://hotelcasasadev.wpengine.com/

My code is here https://codepen.io/mgason/pen/MWBmBjm?editors=0010

Video of the problem using 3 browsers is here https://www.veed.io/view/a2b10045-5b3f-4ebd-a2d0-5e6b4d16174e?panel=share

jQuery(document).ready(function( $ ){
(function($){

    $(window).on( 'load', function() {
        $.setMenuActive();
    });

/**
 * Set active anchor links on scroll
 */

$.setMenuActive = function()
{
    //var $menu = $( '#primary-menu' );

var $menu;
    if ($('#main-header').css('display') == 'none') {
              $menu = '#mobile-menu';
            } else {
            $menu = '#primary-menu';
        }
            //console.log($menu);

    if ( !$menu.length )
        return;

    var $menuItems = $( '.menu-anchor', $menu ),
        $lastItem = $menuItems.last(),
          $headerWrapper = $( '#masthead' ),
          adminBarHeight = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).outerHeight() : 0,
      headerHeight = $headerWrapper.outerHeight() + adminBarHeight -1;
    var activeOnScroll = function()
    {
        var cur_pos = $(window).scrollTop();

        $menuItems.each( function()
    {
            var $this = $(this),
          $menuAnchor = $( 'a', this ),
          $target = $(  '#' + $menuAnchor.attr('href').split('#').pop() ),
          offsetTop = $target.offset().top - (headerHeight+2),
          offsetBottom = offsetTop + $target.outerHeight();

            if ( offsetTop <= cur_pos && offsetBottom > cur_pos )
            {
                if ( !$this.hasClass( 'current-menu-item current_page_item' ) )
                {
                    $menuItems.removeClass( 'current-menu-item current_page_item' );
                    $this.addClass( 'current-menu-item' );
                }
            }
            else
            {
                if ( $this.hasClass( 'current-menu-item current_page_item' ) )
          $this.removeClass( 'current-menu-item current_page_item' );
            }

        });

        if (cur_pos + $(window).height() == $(document).height() && !$lastItem.hasClass( 'current-menu-item current_page_item' ))
        {
            $menuItems.removeClass( 'current-menu-item current_page_item' );
            $lastItem.addClass( 'current-menu-item' );
        }
    };

    $(window).on( 'scroll', activeOnScroll );
    activeOnScroll();
};

})(jQuery);
    });


问:
How to make withPageAuthRequired work with Storybook?
I have a React/Next.js component Onboarding where I'm using withPageAuthRequired from @auth0/nextjs-auth0 that looks like

```<code>export default function Onboarding() {
    return (
        <Layout>
            <h2>Onboarding</h2>
        </Layout>
    )
}

export const getServerSideProps = withPageAuthRequired()
</code>```

It works perfectly in the app itself, but Storybook fails to build due to errors such as
node_modules/@auth0/nextjs-auth0/dist/node_modules doesn't exist or is not a directory.

I tried a few Storybook add-ons, but they didn't work at all to make withPageAuthRequired work with Storybook. The only thing that worked was when I made a copy of the Onboarding file where I didn't use withPageAuthRequired and just imported that component into Storybook. However, this is not an optimal solution since the two files are basically copies of each other, and I don't want to do this for every page of my app.

Does anybody know what to do here or if there's a workaround?

Body:
I have a React/Next.js component Onboarding where I'm using withPageAuthRequired from @auth0/nextjs-auth0 that looks like

export default function Onboarding() {
    return (
        <Layout>

Onboarding

        </Layout>
    )
}

export const getServerSideProps = withPageAuthRequired()

It works perfectly in the app itself, but Storybook fails to build due to errors such as
node_modules/@auth0/nextjs-auth0/dist/node_modules doesn't exist or is not a directory.

I tried a few Storybook add-ons, but they didn't work at all to make withPageAuthRequired work with Storybook. The only thing that worked was when I made a copy of the Onboarding file where I didn't use withPageAuthRequired and just imported that component into Storybook. However, this is not an optimal solution since the two files are basically copies of each other, and I don't want to do this for every page of my app.

Does anybody know what to do here or if there's a workaround?


问:
NuGet Package generated from Visual Studio using MSBuild adds fixed path for PDB Sources
I am new to NuGet package creation and not sure where I am going wrong. I have created a nuget package for assembly project and added the below code to .csproj file that lets me create .nupkg (with pdb) and .snupkg file.

As my source code is on bitbucket I have installed Microsoft.SourceLink.Bitbucket.Git (https://www.nuget.org/packages/Microsoft.SourceLink.Bitbucket.Git) and followed their guildelines from https://github.com/dotnet/sourcelink. However, they don't support bitbucket cloud yes and there is open ticket (https://github.com/dotnet/sourcelink/issues/878) that can be seen.

```<code><PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</code>```
```<code><PropertyGroup>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <Configuration Condition="'$(Configuration)'==''">Release</Configuration>
    <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
    <PackageId>TEST</PackageId>
    <PackageVersion>1</PackageVersion>
    <title>TEST</title>
    <Authors>TEST</Authors>
    <PackageIcon>TEST.png</PackageIcon>
    <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
    <PackageDescription>TEST</PackageDescription>
    <PackageTags>TEST</PackageTags>
    <PackageReleaseNotes>TEST.</PackageReleaseNotes>
    <copyright>TEST</copyright>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="TEST_1" Version="1" />
    <None Include="Resources\TEST.png" Pack="true" PackagePath="" />
  </ItemGroup>
</code>```

The problem I am facing here is that when NuGet package gets created it adds bitbucket cloud api url for source link which is due to the nuget package Microsoft.SourceLink.Bitbucket.Git and when I try to source link it fails obviously because of that open ticket I mentioned above, but then it tries to fall back and for some reason there is another PDB source path that is D:\ drive.

This is fixed path how can I change it to be relative so that if any other developer installs this can use it ? Or just don't have any path like this D:\

NuGet Package Definition

Body:
I am new to NuGet package creation and not sure where I am going wrong. I have created a nuget package for assembly project and added the below code to .csproj file that lets me create .nupkg (with pdb) and .snupkg file.

As my source code is on bitbucket I have installed Microsoft.SourceLink.Bitbucket.Git (https://www.nuget.org/packages/Microsoft.SourceLink.Bitbucket.Git) and followed their guildelines from https://github.com/dotnet/sourcelink. However, they don't support bitbucket cloud yes and there is open ticket (https://github.com/dotnet/sourcelink/issues/878) that can be seen.

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<PropertyGroup>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <Configuration Condition="'$(Configuration)'==''">Release</Configuration>
    <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
    <PackageId>TEST</PackageId>
    <PackageVersion>1</PackageVersion>
    <title>TEST</title>
    <Authors>TEST</Authors>
    <PackageIcon>TEST.png</PackageIcon>
    <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
    <PackageDescription>TEST</PackageDescription>
    <PackageTags>TEST</PackageTags>
    <PackageReleaseNotes>TEST.</PackageReleaseNotes>
    <copyright>TEST</copyright>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="TEST_1" Version="1" />
    <None Include="Resources\TEST.png" Pack="true" PackagePath="" />
  </ItemGroup>

The problem I am facing here is that when NuGet package gets created it adds bitbucket cloud api url for source link which is due to the nuget package Microsoft.SourceLink.Bitbucket.Git and when I try to source link it fails obviously because of that open ticket I mentioned above, but then it tries to fall back and for some reason there is another PDB source path that is D:\ drive.

This is fixed path how can I change it to be relative so that if any other developer installs this can use it ? Or just don't have any path like this D:\

NuGet Package Definition


问:
Is coder/code-server still available for EXTENSIONS_GALLERY?
I added EXTENSIONS_GALLERY to /etc/profile. But the repository is still open-vsx. Is EXTENSIONS_GALLERY no longer available?

```<code>export EXTENSIONS_GALLERY='{ "serviceUrl": "API_URL" }'
</code>```

Of course I do source /etc/profile and sudo systemctl restart code-server@$USER.

If EXTENSIONS_GALLERY doesn't seem to work, please let me know if there is another solution.

Body:
I added EXTENSIONS_GALLERY to /etc/profile. But the repository is still open-vsx. Is EXTENSIONS_GALLERY no longer available?

export EXTENSIONS_GALLERY='{ "serviceUrl": "API_URL" }'

Of course I do source /etc/profile and sudo systemctl restart code-server@$USER.

If EXTENSIONS_GALLERY doesn't seem to work, please let me know if there is another solution.


问:
Can I use std::chrono on 2009 x86 Windows?
Is std::chrono available to use when running on a Windows 6.1.7601 x86 PC? (Windows 7 Professional, SP1).

I'm compiling in Visual Studio 2022 (on a new x64 PC) and don't care about other targets.

I just don't know if I'm doing it wrong, or if I'm just totally off base; when running, it goes straight to the "program.exe has stopped working" popup. The latest visual C++ x86 redistributable is installed on both the target and compilation computers.

My program is command-line only, and needs to access file last modified times and the current system time.


问:
Teams desktop cannot open task modules
I try to use task modules to open the html page, and it can be opened on the web side, but it cannot be opened on the desktop version. What is the reason? Thanks!

enter image description here
enter image description here

This is handleTeamsTaskModuleFetch:

```<code>if (cardTaskFetchValue === "feedbackSubmit") {
           taskInfo.url = taskInfo.fallbackUrl = 'https://156e-38-83-110-6.ngrok.io'+'/CustomForm.html';
    this.setTaskInfo(taskInfo, TaskModuleUIConstants.CustomForm);
}
return TaskModuleResponseFactory.toTaskModuleResponse(taskInfo);
</code>```

Title: Teams desktop cannot open task modules

Body:
I try to use task modules to open the html page, and it can be opened on the web side, but it cannot be opened on the desktop version. What is the reason? Thanks!

enter image description here
enter image description here

This is handleTeamsTaskModuleFetch:

if (cardTaskFetchValue === "feedbackSubmit") {
           taskInfo.url = taskInfo.fallbackUrl = 'https://156e-38-83-110-6.ngrok.io'+'/CustomForm.html';
    this.setTaskInfo(taskInfo, TaskModuleUIConstants.CustomForm);
}
return TaskModuleResponseFactory.toTaskModuleResponse(taskInfo);


问:
How to Integrate Listmonk with NodeJS?
I am trying to do a project where I want to send mails to the subscribers using Nodejs and Listmonk.

Whenever user registers to the website I want to add his/her email to Lismonk server and want to automatically send mail whenever some particular conditions are met!

Any idea how I can do that or any reference please share!!!

Thank You..

Title: How to Integrate Listmonk with NodeJS?


问:
How to break a long environment variable text into multiple lines in dotenv file (for docker-compose)
I have a regular docker-compose.yml

```<code>version: "3.9"
services:
  test_service:
    image: some_img:0.1.0
    ...
    ...
    env_file:
      - .env
    ...
    ...
</code>```

here, I am loading environment variables using a .env file. In the file I have an environment variable with a long string value.

```<code># .env
SPACE=test
SPECIFICS=packageA,packageB,packageC,packageD,...
</code>```

I want SPECIFICS to parsed as above(SPECIFICS=packageA,packageB,packageC,packageD,... ) but would like to break it down into multiple lines for easy reading, may be like below (with or without indentation)

```<code>SPECIFICS=packageA,
          packageB,
          packageC,
          packageD,
          ...
</code>```

I do not want to use environment: section in docker-compose.yml because I am loading quite a few environment variables which will bloat the corresponding section.

Can anyone suggest a solution for this

CHeers,
DD.

Body:
I have a regular docker-compose.yml

version: "3.9"
services:
  test_service:
    image: some_img:0.1.0
    ...
    ...
    env_file:
      - .env
    ...
    ...

here, I am loading environment variables using a .env file. In the file I have an environment variable with a long string value.

# .env
SPACE=test
SPECIFICS=packageA,packageB,packageC,packageD,...

I want SPECIFICS to parsed as above(SPECIFICS=packageA,packageB,packageC,packageD,... ) but would like to break it down into multiple lines for easy reading, may be like below (with or without indentation)

SPECIFICS=packageA,
          packageB,
          packageC,
          packageD,
          ...

I do not want to use environment: section in docker-compose.yml because I am loading quite a few environment variables which will bloat the corresponding section.

Can anyone suggest a solution for this

CHeers,
DD.


问:
The code is not showing any sort of output
```<code>from nltk_utils import tokenize, stem, bag_of_words;
import json
with open('intents.json') as json_data:
    intents = json.load(json_data)

all_words=[];
tags=[];
xy=[];
for intent in intents['intents']:
    tag = intent['tag']
    tags.append(tag);
    for pattern in intent['patterns']:
        w = tokenize(pattern);
        all_words.extend(w);
        xy.append((w, tag));

ignore_words = ['?', '.', ',', '!'];
print(ignore_words);
print(all_words);
</code>```

This code is not displaying any type of output, I have imported the files properly, please suggest solutions

Body:
from nltk_utils import tokenize, stem, bag_of_words;
import json
with open('intents.json') as json_data:
    intents = json.load(json_data)

all_words=[];
tags=[];
xy=[];
for intent in intents['intents']:
    tag = intent['tag']
    tags.append(tag);
    for pattern in intent['patterns']:
        w = tokenize(pattern);
        all_words.extend(w);
        xy.append((w, tag));

ignore_words = ['?', '.', ',', '!'];
print(ignore_words);
print(all_words);

This code is not displaying any type of output, I have imported the files properly, please suggest solutions


问:
Multiplication issue in Google Apps Script
I tried running the following code in Google Apps Script:

```<code>Logger.log (12345*12345)
</code>```

and this was the result:

```<code>1.52399025E8
</code>```

when it should be

```<code>152,399,025
</code>```

Trying Logger.log (BigInt(12345*12345)) works, but why would I have to use it?
(It makes my whole project much more complicated).

Body:
I tried running the following code in Google Apps Script:

Logger.log (12345*12345)

and this was the result:

1.52399025E8

when it should be

152,399,025

Trying Logger.log (BigInt(12345*12345)) works, but why would I have to use it?
(It makes my whole project much more complicated).


问:
How we can know esc key press in onExist() event in introJS
How we know esc key press in onExist() event in introJS + Angular 2+.
I have tried many way like get key press key using hostlistner but hostlistner call after onExist() event call but no luck.

On esc key press, then onExit() method call and inside that method i am calling showSnoozeDialog() method which is used for opening primeng modal, that time dialogRef.onClose.subscribe method also executing (that should not be execute), so modal is open a while and close it, i want to open that modal.

enter image description here


问:
Adding Columns basis conditions in the dataframe
Existing Dataframe :

```<code>Id         status        Trans_Amt
01         success         $1.0
02         success         $4.0
03         failed          $10.0
04         decline         $15.0
05         decline         $1.0
06         success         $10.0
</code>```

Expected Dataframe:

```<code>Id    status   Trans_Amt   Total_Trans  success decline failed $_success $_decline $_failed
01    success    $1.0          6           3       2      1       $15.0    $16.0     $10.0
02    success    $4.0          6           3       2      1       $15.0    $16.0     $10.0
03    failed     $10.0         6           3       2      1       $15.0    $16.0     $10.0
04    decline    $15.0         6           3       2      1       $15.0    $16.0     $10.0
05    decline    $1.0          6           3       2      1       $15.0    $16.0     $10.0
06    success    $10.0         6           3       2      1       $15.0    $16.0     $10.0
</code>```

Total_Trans :total number of transactions happened , success : count of success transactions , decline : count of decline transactions , failed : count of failed transactions , $_success : sum of Trans_amt where status == success similarly for $_decline & $_failed.

i know how to calculate them individually but is there a other convenient way to do this..?

Body:
Existing Dataframe :

Id         status        Trans_Amt
01         success         $1.0
02         success         $4.0
03         failed          $10.0
04         decline         $15.0
05         decline         $1.0
06         success         $10.0

Expected Dataframe:

Id    status   Trans_Amt   Total_Trans  success decline failed $_success $_decline $_failed
01    success    $1.0          6           3       2      1       $15.0    $16.0     $10.0
02    success    $4.0          6           3       2      1       $15.0    $16.0     $10.0
03    failed     $10.0         6           3       2      1       $15.0    $16.0     $10.0
04    decline    $15.0         6           3       2      1       $15.0    $16.0     $10.0
05    decline    $1.0          6           3       2      1       $15.0    $16.0     $10.0
06    success    $10.0         6           3       2      1       $15.0    $16.0     $10.0

Total_Trans :total number of transactions happened , success : count of success transactions , decline : count of decline transactions , failed : count of failed transactions , $_success : sum of Trans_amt where status == success similarly for $_decline & $_failed.

i know how to calculate them individually but is there a other convenient way to do this..?


问:
why typescript build not found handlebar file?
I am using the nodemailer-express-handlebars extension to send nodemailer mail using .hbs (handlebars) extension files. I currently have the following folder structure:

```<code>-driver-adapter
   -adapters
      -nodemailer
          -handlebars
              regiterTemplate.hbs
          -nodemailer-adapter.ts
</code>```

But when I do the typescript build and try to send emails I get the following error

```<code>{
    "data": {
        "errno": -2,
        "code": "ENOENT",
        "syscall": "open",
        "path": "/app/dist/infrastructure/driven-adapters/adapters/nodemailer/handlebars/resetPassword.hbs"
    }
}
</code>```

Going into the dist/ folder I see that I don't have the .hbs files and that's why it can't find them.

I am sharing the code that I am using for the generation and sending of the mail, I would like to understand why it is not taking the .hbs files when doing the build

```<code>export class NodeMailerAdapter implements ISendEmail {
  private readonly transporter: Mail
  constructor () {
    const hbsConfig = {
      viewEngine: {
        extName: '.hbs',
        partialsDir: path.join(__dirname, './handlebars/'),
        layoutsDir: path.join(__dirname, './handlebars/'),
        defaultLayout: ''
      },
      viewPath: path.join(__dirname, './handlebars/'),
      extName: '.hbs'
    }

    this.transporter = nodemailer.createTransport({
      host: CONFIG_NODEMAILER.host,
      port: 2525,
      auth: {
        user: CONFIG_NODEMAILER.user,
        pass: CONFIG_NODEMAILER.pass
      }
    })

    this.transporter.use('compile', hbs(hbsConfig))
  }

  async sendMail (message: IMessage): Promise<string> {
    const baseUrl = CONFIG_URL_BASE_TOKEN.baseUrl
    const token = 'HERE_IS_TOKEN'
    console.log(message)
    const email = {
      to: {
        name: message.to.name,
        address: message.to.email
      },
      from: {
        name: CONFIG_EMAIL_SENDER.name,
        address: CONFIG_EMAIL_SENDER.email
      },
      subject: message.subject,
      template: 'resetPassword',
      context: { baseUrl,token }
    }

    return await this.transporter.sendMail(email).catch(error => {
      return error
    })
  }
}
</code>```

Body:
I am using the nodemailer-express-handlebars extension to send nodemailer mail using .hbs (handlebars) extension files. I currently have the following folder structure:

-driver-adapter
   -adapters
      -nodemailer
          -handlebars
              regiterTemplate.hbs
          -nodemailer-adapter.ts

But when I do the typescript build and try to send emails I get the following error

{
    "data": {
        "errno": -2,
        "code": "ENOENT",
        "syscall": "open",
        "path": "/app/dist/infrastructure/driven-adapters/adapters/nodemailer/handlebars/resetPassword.hbs"
    }
}

Going into the dist/ folder I see that I don't have the .hbs files and that's why it can't find them.

I am sharing the code that I am using for the generation and sending of the mail, I would like to understand why it is not taking the .hbs files when doing the build

export class NodeMailerAdapter implements ISendEmail {
  private readonly transporter: Mail
  constructor () {
    const hbsConfig = {
      viewEngine: {
        extName: '.hbs',
        partialsDir: path.join(__dirname, './handlebars/'),
        layoutsDir: path.join(__dirname, './handlebars/'),
        defaultLayout: ''
      },
      viewPath: path.join(__dirname, './handlebars/'),
      extName: '.hbs'
    }

    this.transporter = nodemailer.createTransport({
      host: CONFIG_NODEMAILER.host,
      port: 2525,
      auth: {
        user: CONFIG_NODEMAILER.user,
        pass: CONFIG_NODEMAILER.pass
      }
    })

    this.transporter.use('compile', hbs(hbsConfig))
  }

  async sendMail (message: IMessage): Promise<string> {
    const baseUrl = CONFIG_URL_BASE_TOKEN.baseUrl
    const token = 'HERE_IS_TOKEN'
    console.log(message)
    const email = {
      to: {
        name: message.to.name,
        address: message.to.email
      },
      from: {
        name: CONFIG_EMAIL_SENDER.name,
        address: CONFIG_EMAIL_SENDER.email
      },
      subject: message.subject,
      template: 'resetPassword',
      context: { baseUrl,token }
    }

    return await this.transporter.sendMail(email).catch(error => {
      return error
    })
  }
}


问:
Unable to install node-rdkafka package
I am unable to install node-rdkafka in any of my projects recently by using

```<code>npm i node-rdkafka
</code>```

or if I had a package-lock.json using

```<code>npm ci
</code>```

this is the error I am getting with node 14 and npm 6.14.17 -

```<code>npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> @newrelic/native-metrics@7.1.1 install /Users/subhrangshu/Documents/MyProject/node_modules/@newrelic/native-metrics
> node ./lib/pre-build.js install native_metrics

============================================================================
Attempting install in native-metrics module. Please note that this is an
OPTIONAL dependency, and any resultant errors in this process will not
affect the general performance of the New Relic agent, but event loop and
garbage collection metrics will not be collected.
============================================================================

> /Users/subhrangshu/.nvm/versions/node/v14.21.2/bin/node /Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
> /Users/subhrangshu/.nvm/versions/node/v14.21.2/bin/node /Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 4 native_metrics
  CXX(target) Release/obj.target/native_metrics/src/GCBinder.o
  CXX(target) Release/obj.target/native_metrics/src/native_metrics.o
  CXX(target) Release/obj.target/native_metrics/src/LoopChecker.o
  CXX(target) Release/obj.target/native_metrics/src/RUsageMeter.o
In file included from ../src/GCBinder.cpp:7:
../src/GCBinder.hpp:8:10: fatal error: map: No such file or directory
    8 | #include <map>
      |          ^~~~~
../src/LoopChecker.cpp:7:10: fatal error: algorithm: No such file or directory
    7 | #include <algorithm>
      |          ^~~~~~~~~~~
../src/RUsageMeter.cpp:7:10: fatal error: cstring: No such file or directory
    7 | #include <cstring>
      |          ^~~~~~~~~
compilation terminated.
compilation terminated.
compilation terminated.
make: *** [Release/obj.target/native_metrics/src/GCBinder.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Release/obj.target/native_metrics/src/LoopChecker.o] Error 1
make: *** [Release/obj.target/native_metrics/src/RUsageMeter.o] Error 1
In file included from /Users/subhrangshu/Library/Caches/node-gyp/14.21.2/include/node/node.h:67,
                 from ../../../nan/nan.h:58,
                 from ../src/native_metrics.cpp:7:
/Users/subhrangshu/Library/Caches/node-gyp/14.21.2/include/node/v8.h:22:10: fatal error: memory: No such file or directory
   22 | #include <memory>
      |          ^~~~~~~~
compilation terminated.
make: *** [Release/obj.target/native_metrics/src/native_metrics.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 22.2.0
gyp ERR! command "/Users/subhrangshu/.nvm/versions/node/v14.21.2/bin/node" "/Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "-j" "4" "native_metrics"
gyp ERR! cwd /Users/subhrangshu/Documents/MyProject/node_modules/@newrelic/native-metrics
gyp ERR! node -v v14.21.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
Failed to execute native-metrics install: No pre-built artifacts for your OS/architecture.

> node-rdkafka@2.14.0 install /Users/subhrangshu/Documents/MyProject/node_modules/node-rdkafka
> node-gyp rebuild

  CXX(target) Release/obj.target/node-librdkafka/src/binding.o
../src/binding.cc:10:10: fatal error: iostream: No such file or directory
   10 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [Release/obj.target/node-librdkafka/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 22.2.0
gyp ERR! command "/Users/subhrangshu/.nvm/versions/node/v14.21.2/bin/node" "/Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/subhrangshu/Documents/MyProject/node_modules/node-rdkafka
gyp ERR! node -v v14.21.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@7.1.1 (node_modules/@newrelic/native-metrics):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@7.1.1 install: `node ./lib/pre-build.js install native_metrics`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-rdkafka@2.14.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-rdkafka@2.14.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/subhrangshu/.npm/_logs/2023-01-13T04_21_16_920Z-debug.log
</code>```

based on this question -
GYP ERR! build error. stack Error: 'make' failed with exit code 2
and other similar articles -

Have tried upgrading to macOS 13.1

Tried installing using node 16, node 15, node 18 and node 14

Removed the package-lock.json and node_modules folder and reinstalled using npm i instead.

Removed and reinstalled xcode-select --install

Even though the error shown is - it is unable to read c++ headers, have tried compiling a Hello World C++ program using g++ main.cpp -o main or make main and both compiled the program successfully

Have updated and upgraded brew

Current versions -

Title: Unable to install node-rdkafka package

Body:
I am unable to install node-rdkafka in any of my projects recently by using

npm i node-rdkafka

or if I had a package-lock.json using

npm ci

this is the error I am getting with node 14 and npm 6.14.17 -

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> @newrelic/native-metrics@7.1.1 install /Users/subhrangshu/Documents/MyProject/node_modules/@newrelic/native-metrics
> node ./lib/pre-build.js install native_metrics

============================================================================
Attempting install in native-metrics module. Please note that this is an
OPTIONAL dependency, and any resultant errors in this process will not
affect the general performance of the New Relic agent, but event loop and
garbage collection metrics will not be collected.
============================================================================

> /Users/subhrangshu/.nvm/versions/node/v14.21.2/bin/node /Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
> /Users/subhrangshu/.nvm/versions/node/v14.21.2/bin/node /Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 4 native_metrics
  CXX(target) Release/obj.target/native_metrics/src/GCBinder.o
  CXX(target) Release/obj.target/native_metrics/src/native_metrics.o
  CXX(target) Release/obj.target/native_metrics/src/LoopChecker.o
  CXX(target) Release/obj.target/native_metrics/src/RUsageMeter.o
In file included from ../src/GCBinder.cpp:7:
../src/GCBinder.hpp:8:10: fatal error: map: No such file or directory
    8 | #include <map>
      |          ^~~~~
../src/LoopChecker.cpp:7:10: fatal error: algorithm: No such file or directory
    7 | #include <algorithm>
      |          ^~~~~~~~~~~
../src/RUsageMeter.cpp:7:10: fatal error: cstring: No such file or directory
    7 | #include <cstring>
      |          ^~~~~~~~~
compilation terminated.
compilation terminated.
compilation terminated.
make: *** [Release/obj.target/native_metrics/src/GCBinder.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Release/obj.target/native_metrics/src/LoopChecker.o] Error 1
make: *** [Release/obj.target/native_metrics/src/RUsageMeter.o] Error 1
In file included from /Users/subhrangshu/Library/Caches/node-gyp/14.21.2/include/node/node.h:67,
                 from ../../../nan/nan.h:58,
                 from ../src/native_metrics.cpp:7:
/Users/subhrangshu/Library/Caches/node-gyp/14.21.2/include/node/v8.h:22:10: fatal error: memory: No such file or directory
   22 | #include <memory>
      |          ^~~~~~~~
compilation terminated.
make: *** [Release/obj.target/native_metrics/src/native_metrics.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 22.2.0
gyp ERR! command "/Users/subhrangshu/.nvm/versions/node/v14.21.2/bin/node" "/Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "-j" "4" "native_metrics"
gyp ERR! cwd /Users/subhrangshu/Documents/MyProject/node_modules/@newrelic/native-metrics
gyp ERR! node -v v14.21.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
Failed to execute native-metrics install: No pre-built artifacts for your OS/architecture.

> node-rdkafka@2.14.0 install /Users/subhrangshu/Documents/MyProject/node_modules/node-rdkafka
> node-gyp rebuild

  CXX(target) Release/obj.target/node-librdkafka/src/binding.o
../src/binding.cc:10:10: fatal error: iostream: No such file or directory
   10 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [Release/obj.target/node-librdkafka/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 22.2.0
gyp ERR! command "/Users/subhrangshu/.nvm/versions/node/v14.21.2/bin/node" "/Users/subhrangshu/.nvm/versions/node/v14.21.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/subhrangshu/Documents/MyProject/node_modules/node-rdkafka
gyp ERR! node -v v14.21.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@7.1.1 (node_modules/@newrelic/native-metrics):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@7.1.1 install: `node ./lib/pre-build.js install native_metrics`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-rdkafka@2.14.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-rdkafka@2.14.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/subhrangshu/.npm/_logs/2023-01-13T04_21_16_920Z-debug.log

based on this question -
GYP ERR! build error. stack Error: 'make' failed with exit code 2
and other similar articles -

Have tried upgrading to macOS 13.1

Tried installing using node 16, node 15, node 18 and node 14

Removed the package-lock.json and node_modules folder and reinstalled using npm i instead.

Removed and reinstalled xcode-select --install

Even though the error shown is - it is unable to read c++ headers, have tried compiling a Hello World C++ program using g++ main.cpp -o main or make main and both compiled the program successfully

Have updated and upgraded brew

Current versions -


问:
boto3 s3 resource, bucket.objects.filter why is this so slow and takes so long
I am trying to get the object list from a bucket I have that has probably billions of objects in it, in hundreds of folders, each with xx millions of objects.

The question I have is, why does using s3 resource.objects.filter take so long? And is there a way to use it and still get the same result as using client?

test results below

```<code>s3 = boto3.resource("s3")
s3bucket = s3.Bucket("myBucket")
s3objects = s3bucket.objects.filter(Prefix="folder1/hello09_") # Also tried adding page_size(1000) no change
# folder1/ has xxx million objects
# folder1/hello09_ has xx million objects in it (ex. s3://myBucket/folder1/hello09_file0000001)

# takes about 21 minutes
tmp = [s3obj.key for s3obj in s3objects]

# also takes about 20 minutes
tmp = []
   for s3obj in s3obj_list:
   tmp.append(s3obj.key)

# takes about 2 minutes
# wrote a s3client loop that gets 1000 files at a time
# client = boto3.client('s3')
# client.list_objects_v2(Bucket="myBucket",Prefix="folder1/hello09_")
# loop with NextContinuationToken until no more, 1000 objects each

# takes about 31 minutes
# same s3 client loop but this time changed the prefix to be only up to the deliminator
# The extra 10 minutes might be due to appending the results into an array, key by key?
# client = boto3.client('s3')
# client.list_objects_v2(Bucket="myBucket",Prefix="folder1/")
# loop with NextContinuationToken until no more, 1000 objects each
</code>```

My best guess is that bucket.objects.filter queries ALL objects up to the last deliminator(folder1/) and THEN filters with whatever is after the last deliminator(hello09_). Instead of straight up querying the whole filter path(folder1/hello09_) like client does.

I thought resource was only querying 1 file at a time or something when used like an array or looped over instead of batch grabbing 1000 files from it (can you do that?). But I had a similar situation where I had dozens of subPrefixes each with 1 file in it, and resource.bucket.objects.filter performed the same as client.list_objects_v2.

Is this a bug in the boto3 filter code, or a feature that can be circumvented so resource can still be used with the same performance as client.

UPDATE:

I didn't know I could get such detailed logs, thanks Anon Coward.
So I guess I was wrong, it was sending the correct filtered request.
No idea how to read the log, but the various errors, retry requests, region redirectors, dns checks, etc are there. I don't think that those should cause the extra 18 minutes. But I have no idea anyways. Maybe some sort of background overhead work or prep of data so that it can be consumed? Vs Client where there are no errors.

Also no option to use S3 Inventory Report at the moment. Being too slow and not being realtime being one of problems.

So does that mean the only options are to use client? As S3 resource has some sort of internal efficiency or overhead problems when dealing with large number of objects, since it seems to work fine with small number of objects (same speed as client)?

I was hoping some sort of settings change could make resource as performant, but if its deep internal then maybe no go. Which is a shame considering how easy it is use Resource and not needing to manage multiple calls with continuationTokens.

```<code>botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=GET,
url=https://myBucket.s3.xxxx.amazonaws.com/?prefix=myFolder1%2Fhello09_&encoding-type=url,
headers={'User-Agent': b'Boto3/1.20.24 Python/3.8.0 Windows Botocore/1.27.59 Resource', 'X-Amz-Date': b'xxx',
'X-Amz-Content-SHA256': b'xxx', 'Authorization': b'xxx', 'amz-sdk-invocation-id': b'xxx', 'amz-sdk-request': b'attempt=1'}>
...
botocore.parsers [DEBUG] Response headers: ...
...
[DEBUG] Event needs-retry.s3.ListObjects: calling handler <botocore.retryhandler.RetryHandler object at 0x000000????>
botocore.retryhandler [DEBUG] No retry needed.
</code>```

UPDATE2:

Just for some closure I looked really closely at the http requests of both resource and client and there are differences. Resource does not specify which list, and uses markers instead of continuation Tokens, maybe S3 calculating where to continue from contributes to the slowness? Maybe the list method contributes to the slowness? (especially if list_objectsv1 is slower than v2 or harder to consume). Then there is what AnonCoward said, that resource inherently is slower because it performs more API calls and creates millions of (unneeded?) objects.

```<code># client
url=https://myBucket.s3.xxx.amazonaws.com/
?list-type=2&
prefix=myFolder1%2Fhello_&
continuation-token=xxx
encoding-type=url,
</code>```
```<code># resource
url=https://myBucket.s3.xxx.amazonaws.com/
?
prefix=myFolder1%2Fhello_&
marker=myFolder1%2Fhello_world001&
encoding-type=url,
</code>```

Body:
I am trying to get the object list from a bucket I have that has probably billions of objects in it, in hundreds of folders, each with xx millions of objects.

The question I have is, why does using s3 resource.objects.filter take so long? And is there a way to use it and still get the same result as using client?

test results below

s3 = boto3.resource("s3")
s3bucket = s3.Bucket("myBucket")
s3objects = s3bucket.objects.filter(Prefix="folder1/hello09_") # Also tried adding page_size(1000) no change
# folder1/ has xxx million objects
# folder1/hello09_ has xx million objects in it (ex. s3://myBucket/folder1/hello09_file0000001)

# takes about 21 minutes
tmp = [s3obj.key for s3obj in s3objects]

# also takes about 20 minutes
tmp = []
   for s3obj in s3obj_list:
   tmp.append(s3obj.key)

# takes about 2 minutes
# wrote a s3client loop that gets 1000 files at a time
# client = boto3.client('s3')
# client.list_objects_v2(Bucket="myBucket",Prefix="folder1/hello09_")
# loop with NextContinuationToken until no more, 1000 objects each

# takes about 31 minutes
# same s3 client loop but this time changed the prefix to be only up to the deliminator
# The extra 10 minutes might be due to appending the results into an array, key by key?
# client = boto3.client('s3')
# client.list_objects_v2(Bucket="myBucket",Prefix="folder1/")
# loop with NextContinuationToken until no more, 1000 objects each

My best guess is that bucket.objects.filter queries ALL objects up to the last deliminator(folder1/) and THEN filters with whatever is after the last deliminator(hello09_). Instead of straight up querying the whole filter path(folder1/hello09_) like client does.

I thought resource was only querying 1 file at a time or something when used like an array or looped over instead of batch grabbing 1000 files from it (can you do that?). But I had a similar situation where I had dozens of subPrefixes each with 1 file in it, and resource.bucket.objects.filter performed the same as client.list_objects_v2.

Is this a bug in the boto3 filter code, or a feature that can be circumvented so resource can still be used with the same performance as client.

UPDATE:

I didn't know I could get such detailed logs, thanks Anon Coward.
So I guess I was wrong, it was sending the correct filtered request.
No idea how to read the log, but the various errors, retry requests, region redirectors, dns checks, etc are there. I don't think that those should cause the extra 18 minutes. But I have no idea anyways. Maybe some sort of background overhead work or prep of data so that it can be consumed? Vs Client where there are no errors.

Also no option to use S3 Inventory Report at the moment. Being too slow and not being realtime being one of problems.

So does that mean the only options are to use client? As S3 resource has some sort of internal efficiency or overhead problems when dealing with large number of objects, since it seems to work fine with small number of objects (same speed as client)?

I was hoping some sort of settings change could make resource as performant, but if its deep internal then maybe no go. Which is a shame considering how easy it is use Resource and not needing to manage multiple calls with continuationTokens.

botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=GET,
url=https://myBucket.s3.xxxx.amazonaws.com/?prefix=myFolder1%2Fhello09_&encoding-type=url,
headers={'User-Agent': b'Boto3/1.20.24 Python/3.8.0 Windows Botocore/1.27.59 Resource', 'X-Amz-Date': b'xxx',
'X-Amz-Content-SHA256': b'xxx', 'Authorization': b'xxx', 'amz-sdk-invocation-id': b'xxx', 'amz-sdk-request': b'attempt=1'}>
...
botocore.parsers [DEBUG] Response headers: ...
...
[DEBUG] Event needs-retry.s3.ListObjects: calling handler <botocore.retryhandler.RetryHandler object at 0x000000????>
botocore.retryhandler [DEBUG] No retry needed.

UPDATE2:

Just for some closure I looked really closely at the http requests of both resource and client and there are differences. Resource does not specify which list, and uses markers instead of continuation Tokens, maybe S3 calculating where to continue from contributes to the slowness? Maybe the list method contributes to the slowness? (especially if list_objectsv1 is slower than v2 or harder to consume). Then there is what AnonCoward said, that resource inherently is slower because it performs more API calls and creates millions of (unneeded?) objects.

# client
url=https://myBucket.s3.xxx.amazonaws.com/
?list-type=2&
prefix=myFolder1%2Fhello_&
continuation-token=xxx
encoding-type=url,

# resource
url=https://myBucket.s3.xxx.amazonaws.com/
?
prefix=myFolder1%2Fhello_&
marker=myFolder1%2Fhello_world001&
encoding-type=url,


问:
In Wireshark I connected to my remote interface but I didn't get any packets from remote system
This is what I'm getting after I connected to my remote interface

I want to monitor my office employees logs. So I try connected to my remote interface it successfully connected but it didn't send any packets.


问:
Unable to access another site hosted with a different host name with kubernetes NGINX ingress
My modern application hosted within kubernetes works based on the host and the path app.dev.sandbox.com/ (root / path). I need access external legacy application hosted on EC2/VM with host name app-legacy.dev.sandbox.com via the kubernetes ingress. I want to be able to access the legacy sites pages with the same host name of application deployed on kubernetes like this app.dev.sandbox.com/nbs/login or app.dev.sandbox.com/nbs/homepage.do should actually request app-legacy.dev.sandbox.com/abc/login or app-legacy.dev.sandbox.com/nbs/homepage.do but preserve the modern hostname of app.dev.sandbox.com  when displaying the page.
This is needed because, we are using strangler fig pattern to navigate between legacy and modern pages seamlessly. The request needs to be captured by the kubernetes ingress when the user clicks on certain links on the legacy pages. I am currently using the following external service and ingress resource.

```<code>apiVersion: v1
kind: Service
metadata:
 name: nbs-legacy
spec:
  type: ExternalName
  externalName: app-legacy.dev.sandbox.com
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-resource
  annotations:
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: "letsencrypt-production"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/preserve-host: "true"
spec:
 ingressClassName: nginx
 tls:
 - secretName: app.dev.sandbox.com
   hosts:
   - app.dev.sandbox.com
 rules:
 - host: app.dev.sandbox.com
   http:
    paths:
    - path: /nbs     #I would like the path to be appened to the nbs-legacy request. For example /nbs/login should be appened while requesting app-legacy.dev.sandbox.com/nbs/login
      pathType: Exact
      backend:
       service:
       name: nbs-legacy
       port:
         number: 80
    - path: /
      pathType: Prefix
      backend:
        service:
        name: modern-service
        port:
         number: 80
</code>```

I am using nginx ingress. I tried with the above manifests but did not work.
I am expecting the following:

Navigate to external legacy application seamlessly while preserving the host name of the kubernetes.

Capture path from the request and pass that to legacy host name request. For example, /nbs/login or /nbs/dashboard should be passed when requesting legacy application pages.

Avoid routing of anything that starts with /nbs(eg: /nbs/abc) to the default root / path.

Body:
My modern application hosted within kubernetes works based on the host and the path app.dev.sandbox.com/ (root / path). I need access external legacy application hosted on EC2/VM with host name app-legacy.dev.sandbox.com via the kubernetes ingress. I want to be able to access the legacy sites pages with the same host name of application deployed on kubernetes like this app.dev.sandbox.com/nbs/login or app.dev.sandbox.com/nbs/homepage.do should actually request app-legacy.dev.sandbox.com/abc/login or app-legacy.dev.sandbox.com/nbs/homepage.do but preserve the modern hostname of app.dev.sandbox.com  when displaying the page.
This is needed because, we are using strangler fig pattern to navigate between legacy and modern pages seamlessly. The request needs to be captured by the kubernetes ingress when the user clicks on certain links on the legacy pages. I am currently using the following external service and ingress resource.

apiVersion: v1
kind: Service
metadata:
 name: nbs-legacy
spec:
  type: ExternalName
  externalName: app-legacy.dev.sandbox.com
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-resource
  annotations:
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: "letsencrypt-production"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/preserve-host: "true"
spec:
 ingressClassName: nginx
 tls:
 - secretName: app.dev.sandbox.com
   hosts:
   - app.dev.sandbox.com
 rules:
 - host: app.dev.sandbox.com
   http:
    paths:
    - path: /nbs     #I would like the path to be appened to the nbs-legacy request. For example /nbs/login should be appened while requesting app-legacy.dev.sandbox.com/nbs/login
      pathType: Exact
      backend:
       service:
       name: nbs-legacy
       port:
         number: 80
    - path: /
      pathType: Prefix
      backend:
        service:
        name: modern-service
        port:
         number: 80

I am using nginx ingress. I tried with the above manifests but did not work.
I am expecting the following:

Navigate to external legacy application seamlessly while preserving the host name of the kubernetes.

Capture path from the request and pass that to legacy host name request. For example, /nbs/login or /nbs/dashboard should be passed when requesting legacy application pages.

Avoid routing of anything that starts with /nbs(eg: /nbs/abc) to the default root / path.


问:
How to keep discord bot on replit alive
I'm very new to replit and python.
I'm using this Github Project to host my own discord bot on replit.

The project is working fine but I just cannot get to stay alive, the moment I close
my replit project, then the bot goes offline.

How can I fix this?

I'm using this code to try and keep it alive but it is not working.

keep_alive.py

```<code>from flask import Flask
from threading import Thread

app = Flask('')

@app.route('/')
def home():
  return "I'm alive"

def run():
  app.run(host='0.0.0.0', port=8080)

def keep_alive():
  t = Thread(target=run)
  t.start()
</code>```

main.py

```<code>from src import keep_alive
from src import bot
import sys

def check_verion() -> None:
  import pkg_resources
  import src.log

  # init loggger
  logger = src.log.setup_logger(__name__)

  # Read the requirements.txt file and add each line to a list
  with open('requirements.txt') as f:
    required = f.read().splitlines()

  # For each library listed in requirements.txt, check if the corresponding version is installed
  for package in required:
    # Use the pkg_resources library to get information about the installed version of the library
    package_name, package_verion = package.split('==')
    installed = pkg_resources.get_distribution(package_name)
    # Extract the library name and version number
    name, version = installed.project_name, installed.version
    # Compare the version number to see if it matches the one in requirements.txt
    if package != f'{name}=={version}':
      logger.error(
        f'{name} version {version} is installed but does not match the requirements'
      )
      sys.exit()

if __name__ == '__main__':
  check_verion()
  bot.run_discord_bot()
  keep_alive()
</code>```

Title: How to keep discord bot on replit alive

Body:
I'm very new to replit and python.
I'm using this Github Project to host my own discord bot on replit.

The project is working fine but I just cannot get to stay alive, the moment I close
my replit project, then the bot goes offline.

How can I fix this?

I'm using this code to try and keep it alive but it is not working.

keep_alive.py

from flask import Flask
from threading import Thread

app = Flask('')

@app.route('/')
def home():
  return "I'm alive"

def run():
  app.run(host='0.0.0.0', port=8080)

def keep_alive():
  t = Thread(target=run)
  t.start()

main.py

from src import keep_alive
from src import bot
import sys

def check_verion() -> None:
  import pkg_resources
  import src.log

  # init loggger
  logger = src.log.setup_logger(__name__)

  # Read the requirements.txt file and add each line to a list
  with open('requirements.txt') as f:
    required = f.read().splitlines()

  # For each library listed in requirements.txt, check if the corresponding version is installed
  for package in required:
    # Use the pkg_resources library to get information about the installed version of the library
    package_name, package_verion = package.split('==')
    installed = pkg_resources.get_distribution(package_name)
    # Extract the library name and version number
    name, version = installed.project_name, installed.version
    # Compare the version number to see if it matches the one in requirements.txt
    if package != f'{name}=={version}':
      logger.error(
        f'{name} version {version} is installed but does not match the requirements'
      )
      sys.exit()

if __name__ == '__main__':
  check_verion()
  bot.run_discord_bot()
  keep_alive()


问:
PHP : Sort an array by value based on another array
I have two array and I want to arrange one of them based on the other one.

```<code>$sortMe = Array
(
    [0] => 100
    [1] => 1
    [2] => 10
    [3] => 1000
)

$example = Array
(
  [0] => 1
  [1] => 1000
  [2] => 100
  [3] => 10
)
</code>```

how can I sort the $sortMe array based on $example to:

```<code>$sortMe = Array
(
    [1] => 1
    [3] => 1000
    [0] => 100
    [2] => 10
)
</code>```

Body:
I have two array and I want to arrange one of them based on the other one.

$sortMe = Array
(
    [0] => 100
    [1] => 1
    [2] => 10
    [3] => 1000
)

$example = Array
(
  [0] => 1
  [1] => 1000
  [2] => 100
  [3] => 10
)

how can I sort the $sortMe array based on $example to:

$sortMe = Array
(
    [1] => 1
    [3] => 1000
    [0] => 100
    [2] => 10
)


问:
Inverse of Standard Scaler transform
I have some missing values in my features. To impute them, I am using KNN imputer in python.

before using KNN imputer I am using standard scaler for scaling of features. After imputing missing values, I am again doing inverse transform to convert back to original data. I am confused whether the converted data is correct or not because in the original data, I did not missing values filled.

Title: Inverse of Standard Scaler transform


问:
Having both chisq.test and fisher.test in a tbl_summary table
Is it possible to have a tbl_summary table with a "chisq.test" when expected cell counts >=5 and "fisher.test" when expected cell counts <5 without merging two separate tables? If so, how would script it?</p>


问:
vuejs-rails: TypeError: Cannot read properties of undefined (reading '_transitionClasses')
i have 1 button using @click="next"
next() code as below

```<code>     next() {
       if (this.currentSlideID < this.newSpaces.length - 1) {
         this.currentSlideID = this.currentSlideID + 1
       } else if (this.currentSlideID === this.newSpaces.length - 1) {
         this.currentSlideID = 0
       }
     },
</code>```

when I click, on the laptop screen, there is no error, but on the mobile screen, the following error is generated:
TypeError: Cannot read properties of undefined (reading '_transitionClasses')

I tried searching but still can't find a way to avoid this error

Body:
i have 1 button using @click="next"
next() code as below

     next() {
       if (this.currentSlideID < this.newSpaces.length - 1) {
         this.currentSlideID = this.currentSlideID + 1
       } else if (this.currentSlideID === this.newSpaces.length - 1) {
         this.currentSlideID = 0
       }
     },

when I click, on the laptop screen, there is no error, but on the mobile screen, the following error is generated:
TypeError: Cannot read properties of undefined (reading '_transitionClasses')

I tried searching but still can't find a way to avoid this error


问:
How to use lambda function in a Python data frame for multilayer loops?
I want to use a lambda function for Pandas dataframe because for loops in large dataset will cause out of memory.

I want to assign numbers corresponding to multiple columns of one data frame to another data frame.

For example in the dataframe above,say dataframe called "census", there are float type data in columns pct_bb_2018, pct_bb_2019, pct_bb_2020, and pct_bb_2021 that are specific to the numbers in the cfips column of census, respectively.

for reference, pct_bb is the broadband penetration rate and 2018, 2019, 2020, 2021 are corresponging year.

I want to assign this to only the cells corresponding to cfips and 2018 in another dataframe as shown as below.

enter image description here

What I've tried:

```<code>df_train["cfips"].map(lambda x: census[census["cfips"] == x]["pct_bb_2018"].iloc[-1])

</code>```

I have come up with the above code so far, but this would assign 2018 data to all years...
Is there any way to separate them by year?

Body:
I want to use a lambda function for Pandas dataframe because for loops in large dataset will cause out of memory.

I want to assign numbers corresponding to multiple columns of one data frame to another data frame.

For example in the dataframe above,say dataframe called "census", there are float type data in columns pct_bb_2018, pct_bb_2019, pct_bb_2020, and pct_bb_2021 that are specific to the numbers in the cfips column of census, respectively.

for reference, pct_bb is the broadband penetration rate and 2018, 2019, 2020, 2021 are corresponging year.

I want to assign this to only the cells corresponding to cfips and 2018 in another dataframe as shown as below.

enter image description here

What I've tried:

df_train["cfips"].map(lambda x: census[census["cfips"] == x]["pct_bb_2018"].iloc[-1])

I have come up with the above code so far, but this would assign 2018 data to all years...
Is there any way to separate them by year?


问:
Is there any other way to add angular compilers to build bit components?
I have tried running the following command:

$ bit import bit.envs/compilers/angular --compiler

I get the following error (refer image)


问:
pdf-creator-node can not generate ul li with 2 column
i've problem when convert html to pdf with pdf-creator-node. when i uses ul li with column=2, in preview html is look good. but when i generated to pdf always preview in one column. may i help me ? this is my css

```<code>.itenerary ul{
    display: block;
    list-style-type: disc;
    margin-left: 0;
    margin-right: 0;
    padding-left: 40px;
    line-height:1.6 ;

    columns: 2;

  -webkit-columns: 2;
  -moz-columns: 2;
}
</code>```

i want to get tips and trick to solve my problems

Body:
i've problem when convert html to pdf with pdf-creator-node. when i uses ul li with column=2, in preview html is look good. but when i generated to pdf always preview in one column. may i help me ? this is my css

.itenerary ul{
    display: block;
    list-style-type: disc;
    margin-left: 0;
    margin-right: 0;
    padding-left: 40px;
    line-height:1.6 ;

    columns: 2;

  -webkit-columns: 2;
  -moz-columns: 2;
}

i want to get tips and trick to solve my problems


问:
How to derive multidimensional array direction vectors?
For leetcode problem https://leetcode.com/problems/walls-and-gates/solution/

The BFS solution has

```<code>.......
private static final List<int[]> DIRECTIONS = Arrays.asList(
        new int[] { 1,  0},
        new int[] {-1,  0},
        new int[] { 0,  1},
        new int[] { 0, -1}
);
.....
</code>```

This is to take turn right while traversing the matrix.  Does anyone know how to derive these vectors without memorizing them?

My understanding is you do a cross product with (x,y,0) X (0,0,1) which gives R = yX -xY + 0Z.
I think you take a partial derivative here but I'm unsure of the math proof which gives the directions.

Please explain mathematically how to get vectors {1,0} , {-1, 0}, {0,1} , {0,-1}

My understanding is you do a cross product with (x,y,0) X (0,0,1) which gives R = yX -xY + 0Z.
I think you take a partial derivative here but I'm unsure of the math proof which gives the directions.

Body:
For leetcode problem https://leetcode.com/problems/walls-and-gates/solution/

The BFS solution has

.......
private static final List<int[]> DIRECTIONS = Arrays.asList(
        new int[] { 1,  0},
        new int[] {-1,  0},
        new int[] { 0,  1},
        new int[] { 0, -1}
);
.....

This is to take turn right while traversing the matrix.  Does anyone know how to derive these vectors without memorizing them?

My understanding is you do a cross product with (x,y,0) X (0,0,1) which gives R = yX -xY + 0Z.
I think you take a partial derivative here but I'm unsure of the math proof which gives the directions.

Please explain mathematically how to get vectors {1,0} , {-1, 0}, {0,1} , {0,-1}

My understanding is you do a cross product with (x,y,0) X (0,0,1) which gives R = yX -xY + 0Z.
I think you take a partial derivative here but I'm unsure of the math proof which gives the directions.


问:
'xmlParseEntityRef: no name'
I've spent several days trying to resolve this issue, but all advices from Internet does not work. You are my last hope
I have xml file:

<yml_catalog date="2023-01-10T10:35:13.797">

```<code><shop>

    <name>test</name>

    <company>test</company>

    <url>test</url>

    <currencies>

        <currency id="RUB" rate="1"/>

    </currencies>

    <categories>

        <category id="1" parentId="3"></category>

    </categories>

    <offers>

        <offer id="111" type="test" available="true">

            <name>test</name>

            <publisher>test</publisher>

            <ISBN>2</ISBN>

            <page_extent>268</page_extent>

            <language>test</language>

            <age unit="year"></age>

            <author>test</author>

            <series>test</series>

            <url>test</url>

            <price>249.99</price>

            <currencyId>RUB</currencyId>

            <categoryId>750</categoryId>

            <picture>test</picture>

            <delivery>false</delivery>

            <pickup>false</pickup>

            <store>false</store>

            <downloadable>true</downloadable>

        </offer>

    </offers>

</shop>
</code>```

</yml_catalog>`

Every other xml parcer is reading it good, no problems, but that one, that I need return error

xmlParseEntityRef: no name :  line 6: column 21
xmlParseEntityRef: no name :  line 6: column 22
xmlParseEntityRef: no name :  line 7: column 51
xmlParseEntityRef: no name :  line 7: column 52

I read that these errors can be caused by &, <, > and other spec.symbols, but there are no simbols like these. Where the problem can be?

I've tried to google this problem, but everyone speaks about spec.symbols

Title: 'xmlParseEntityRef: no name'

Body:
I've spent several days trying to resolve this issue, but all advices from Internet does not work. You are my last hope
I have xml file:

<yml_catalog date="2023-01-10T10:35:13.797">

<shop>

    <name>test</name>

    <company>test</company>

    <url>test</url>

    <currencies>

        <currency id="RUB" rate="1"/>

    </currencies>

    <categories>

        <category id="1" parentId="3"></category>

    </categories>

    <offers>

        <offer id="111" type="test" available="true">

            <name>test</name>

            <publisher>test</publisher>

            <ISBN>2</ISBN>

            <page_extent>268</page_extent>

            <language>test</language>

            <age unit="year"></age>

            <author>test</author>

            <series>test</series>

            <url>test</url>

            <price>249.99</price>

            <currencyId>RUB</currencyId>

            <categoryId>750</categoryId>

            <picture>test</picture>

            <delivery>false</delivery>

            <pickup>false</pickup>

            <store>false</store>

            <downloadable>true</downloadable>

        </offer>

    </offers>

</shop>

</yml_catalog>`

Every other xml parcer is reading it good, no problems, but that one, that I need return error

xmlParseEntityRef: no name :  line 6: column 21
xmlParseEntityRef: no name :  line 6: column 22
xmlParseEntityRef: no name :  line 7: column 51
xmlParseEntityRef: no name :  line 7: column 52

I read that these errors can be caused by &, <, > and other spec.symbols, but there are no simbols like these. Where the problem can be?

I've tried to google this problem, but everyone speaks about spec.symbols


问:
-EnTT-what diffrent entt::basic_view and entt::basic_group?
```<code>    auto view = m_Registry.view<Transform>();
    for (auto ent : view)
    {
        Transform& transform = m_Registry.get<Transform>(ent);
    }

    auto group = m_Registry.group<Transform>(entt::get<Transform>);
    for (auto ent : group)
    {
        Transform& transform = m_Registry.get<Transform>(ent);
    }
</code>```

What are the differences other than being able to tour all of the entities in the specified data type?

Body:
    auto view = m_Registry.view<Transform>();
    for (auto ent : view)
    {
        Transform& transform = m_Registry.get<Transform>(ent);
    }

    auto group = m_Registry.group<Transform>(entt::get<Transform>);
    for (auto ent : group)
    {
        Transform& transform = m_Registry.get<Transform>(ent);
    }

What are the differences other than being able to tour all of the entities in the specified data type?


问:
File become blob download with inertia laravel
How to download file with inertia, vue and laravel? I have make my inertia get function for access route Laravel to download file.

My inertia code:

```<code>           Inertia.get('/publikasi/file/' + confirmForm.download_id, {
                name: confirmForm.name,
                email: confirmForm.email,
                download_id: confirmForm.download_id,
            },
</code>```

And my laravel controller:

```<code>public function download_file(Request $request)
    {
        $download = Download::where('id', $request->download_id)->with('user')->get();
        Inertia::setRootView('frontend');

        if (count($download) > 0) {
            Download::where('id', $request->download_id)->first()->update([
                'hits' => $download[0]->hits + 1
            ]);

            DownloadHistory::create([
                'download_id' => $request->download_id,
                'name' => $request->name,
                'email' => $request->email,
            ]);

            return response()->download(public_path('storage/downloads/' . $download[0]->file));
        } else {
            return redirect()->route('frontend.not_found');
        }
    }
</code>```

But when i access the route, its return Blob code like this:

How to fix this, and then i can direct download file after input downloadHistory.

Body:
How to download file with inertia, vue and laravel? I have make my inertia get function for access route Laravel to download file.

My inertia code:

           Inertia.get('/publikasi/file/' + confirmForm.download_id, {
                name: confirmForm.name,
                email: confirmForm.email,
                download_id: confirmForm.download_id,
            },

And my laravel controller:

public function download_file(Request $request)
    {
        $download = Download::where('id', $request->download_id)->with('user')->get();
        Inertia::setRootView('frontend');

        if (count($download) > 0) {
            Download::where('id', $request->download_id)->first()->update([
                'hits' => $download[0]->hits + 1
            ]);

            DownloadHistory::create([
                'download_id' => $request->download_id,
                'name' => $request->name,
                'email' => $request->email,
            ]);

            return response()->download(public_path('storage/downloads/' . $download[0]->file));
        } else {
            return redirect()->route('frontend.not_found');
        }
    }

But when i access the route, its return Blob code like this:

How to fix this, and then i can direct download file after input downloadHistory.