问:
AJAX cart in popup (WooCommerce)
I developing my own WooCommerce theme. I want to realize cart in popup in which all changes will show without reloading.
I already make adding to cart without reloading, but I don't know how to realize my idea about remove items. Now when I remove some item the page is reloading, but I want to remove items and save changes without page refresh.
Tell me, please, how to do it?

My php-code:
(function popup_cart_template() is default code from cart.php customized for my template)

```<code>//ajax adding items
add_filter( 'woocommerce_add_to_cart_fragments', 'cart_popup_fragment', 30, 1 );
function cart_popup_fragment( $fragments ) {
    global $woocommerce;

    ob_start();
    popup_cart_template();
    $fragments['.cart__table'] = ob_get_clean();

    return $fragments;

}

//cart template function
function popup_cart_template() {
    wc_get_template( 'cart/cart-popup.php' );
}

//cart-popup.php content

<table class="cart__table" cellspacing="0">
            <thead>
                <tr>
                    <td></td>
                    <td></td>
                    <td class="cart__header_quantity"><?php esc_html_e( 'QTY', 'woocommerce' ); ?></td>
                    <td class="cart__header_cost"><?php esc_html_e( 'Cost', 'woocommerce' ); ?></td>
                </tr>
            </thead>
            <tbody class="cart__items">
                <?php do_action( 'woocommerce_before_cart_contents' ); ?>

                <?php
                foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
                    $_product   = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
                    $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );

                    if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
                        $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
                        ?>
                        <tr class="cart__item woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">

                            <td class="cart__item_image product-thumbnail">
                                <?php
                                    echo apply_filters('woocommerce_cart_item_remove_link',
                                        sprintf('<a href="%s" class="cart__item-remove remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">
                                            X
                                            </a>',
                                            esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
                                            esc_html__( 'Remove this item', 'woocommerce' ),
                                            esc_attr( $product_id ),
                                            esc_attr( $_product->get_sku() )
                                        ),
                                        $cart_item_key
                                    );

<!-- and other code...:) -->

</code>```

My html-code:

```<code><section class="cart__layout popup" id="cart">
        <div class="cart__body">
            <div class="cart__content popup__content">

                <?php do_action( 'woocommerce_before_cart_table' ); ?>

                <div class="popup-close close-popup">
                    <img src="assets/img/popup/close-icon.png" alt="close-icon" class="popup-close__icon">
                </div>
                <h1 class="cart__title">
                    CART
                </h1>
                <?php popup_cart_template(); ?>
            </div>
        </div>
    </section>

</code>```

Title: AJAX cart in popup (WooCommerce)

Body:
I developing my own WooCommerce theme. I want to realize cart in popup in which all changes will show without reloading.
I already make adding to cart without reloading, but I don't know how to realize my idea about remove items. Now when I remove some item the page is reloading, but I want to remove items and save changes without page refresh.
Tell me, please, how to do it?

My php-code:
(function popup_cart_template() is default code from cart.php customized for my template)

//ajax adding items
add_filter( 'woocommerce_add_to_cart_fragments', 'cart_popup_fragment', 30, 1 );
function cart_popup_fragment( $fragments ) {
    global $woocommerce;

    ob_start();
    popup_cart_template();
    $fragments['.cart__table'] = ob_get_clean();

    return $fragments;

}

//cart template function
function popup_cart_template() {
    wc_get_template( 'cart/cart-popup.php' );
}

//cart-popup.php content

                    <?php esc_html_e( 'QTY', 'woocommerce' ); ?>
                    <?php esc_html_e( 'Cost', 'woocommerce' ); ?>

                <?php do_action( 'woocommerce_before_cart_contents' ); ?>

                <?php
                foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
                    $_product   = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
                    $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );

                    if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
                        $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
                        ?>
                        <tr class="cart__item woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">

                                <?php
                                    echo apply_filters('woocommerce_cart_item_remove_link',
                                        sprintf('
                                            X
                                            ',
                                            esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
                                            esc_html__( 'Remove this item', 'woocommerce' ),
                                            esc_attr( $product_id ),
                                            esc_attr( $_product->get_sku() )
                                        ),
                                        $cart_item_key
                                    );

My html-code:

                <?php do_action( 'woocommerce_before_cart_table' ); ?>

                    CART

                <?php popup_cart_template(); ?>


来源: stackexchange

问:
Policy evaluation not working in sails.js with passport
I've created a small API module, to have authenticated access for certain controllers using JWT.
Using local authentication to get the token, and JWT for subsequent end points

However the policies are not getting evaluated, it looks like middleware is not getting executed and sails is not evaluating the policy isSubscriber.js in the api/policies folder.

Here are the relevant code snippets:

/*
 * Passport login strategy.
 */

const { JsonWebTokenError } = require('jsonwebtoken');

var passport = require('passport'),
    LocalStrategy = require('passport-local').Strategy,
    JwtStrategy = require ('passport-jwt').Strategy,
    ExtractJwt = require ('passport-jwt').ExtractJwt,
    md5 = require('md5');

passport.serializeUser (function(user, done){
    done (null, user.id);
});

passport.deserializeUser(function (id, done){
    Subscriber.findOne ({id: id}, function (err, user){
        done(err, user);
    })
});
var opts = {
    jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
    secrtOrKey : 'xxxxx',
    issuer: 'xxxxxx',
    audience: 'xxxxx'
};

passport.use (new JwtStrategy(opts, function (jwt_payload, done){
    sails.log ("Authenticating with JWT strategy");
    Subscriber.findOne ({id: jwt_payload.id}, function (err, subscriber){
        if (err){
            return done (err, false);
        }
        if (user) {
            return done(null, user);
        } else {
            return done(null, false);
        }
    });
}));

passport.use (new LocalStrategy({
    usernameField: 'phone',
    passwordField: 'password'
},
function (phone, password, done) {
    sails.log ("Locating subscriber: " + phone + " Password: " + password);
    Subscriber.findOne ({phone: phone}, function (err, subscriber){
        if (err) { return done (err);}
        sails.log ("Subscriber : " , subscriber);
        if (!subscriber) {
            sails.log ('User with phone  ' + phone  + ' not found!');
            return done (null, false, {message : 'Subscriber not found.'});
        }
        sails.log ("Checking password: ");
        if (md5(password) != subscriber.password_hash) {
            sails.log ('Password mismatch for user ' +  phone);
            return done (null, false, {message: 'Invalid password'});
        }
        sails.log ("Successfully logged in");
        return done(null, subscriber, {
            message: 'Logged in succesfully.'
        });
    })
}
));

```
<p>Middleware section in http.js</p>
<pre class="lang-js prettyprint-override"><code>middleware:  {
    passportInit: require('passport').initialize(),
    passportSession: require('passport').session(),
    order: [
       'cookieParser',
       'session',
       'passportInit',
       'passportSession',
       'bodyParser',
       'compress',
       'poweredBy',
       'router',
       'www',
       'favicon',
    ]

</code>```

policies:

module.exports.policies = {

  '*': ['isSubscriber'],
  'AuthController': {
    'login': true    // Always allow access to the user login action
  }

};
```
<p>isSubscriber.js:</p>
<pre class="lang-js prettyprint-override"><code>module.exports = function (req, res, next){
    sails.log ("Authenticating using jwt");
    passport.authenticate ('jwt', function (error, user, info){
        if (error) return res.serverError (error);
        if (!user) {
            return res.status(403).send ("Failed to authenticate");
        }
        req.user = user;
        sails.log ("User authenticated, user record: " , req.user);
        next();
    })(req, res);
};
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I've created a small API module, to have authenticated access for certain controllers using JWT.
Using local authentication to get the token, and JWT for subsequent end points

However the policies are not getting evaluated, it looks like middleware is not getting executed and sails is not evaluating the policy isSubscriber.js in the api/policies folder.

Here are the relevant code snippets:

/*
 * Passport login strategy.
 */

const { JsonWebTokenError } = require('jsonwebtoken');

var passport = require('passport'),
    LocalStrategy = require('passport-local').Strategy,
    JwtStrategy = require ('passport-jwt').Strategy,
    ExtractJwt = require ('passport-jwt').ExtractJwt,
    md5 = require('md5');

passport.serializeUser (function(user, done){
    done (null, user.id);
});

passport.deserializeUser(function (id, done){
    Subscriber.findOne ({id: id}, function (err, user){
        done(err, user);
    })
});
var opts = {
    jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
    secrtOrKey : 'xxxxx',
    issuer: 'xxxxxx',
    audience: 'xxxxx'
};

passport.use (new JwtStrategy(opts, function (jwt_payload, done){
    sails.log ("Authenticating with JWT strategy");
    Subscriber.findOne ({id: jwt_payload.id}, function (err, subscriber){
        if (err){
            return done (err, false);
        }
        if (user) {
            return done(null, user);
        } else {
            return done(null, false);
        }
    });
}));

passport.use (new LocalStrategy({
    usernameField: 'phone',
    passwordField: 'password'
},
function (phone, password, done) {
    sails.log ("Locating subscriber: " + phone + " Password: " + password);
    Subscriber.findOne ({phone: phone}, function (err, subscriber){
        if (err) { return done (err);}
        sails.log ("Subscriber : " , subscriber);
        if (!subscriber) {
            sails.log ('User with phone  ' + phone  + ' not found!');
            return done (null, false, {message : 'Subscriber not found.'});
        }
        sails.log ("Checking password: ");
        if (md5(password) != subscriber.password_hash) {
            sails.log ('Password mismatch for user ' +  phone);
            return done (null, false, {message: 'Invalid password'});
        }
        sails.log ("Successfully logged in");
        return done(null, subscriber, {
            message: 'Logged in succesfully.'
        });
    })
}
));

Middleware section in http.js

middleware:  {
    passportInit: require('passport').initialize(),
    passportSession: require('passport').session(),
    order: [
       'cookieParser',
       'session',
       'passportInit',
       'passportSession',
       'bodyParser',
       'compress',
       'poweredBy',
       'router',
       'www',
       'favicon',
    ]

policies:

module.exports.policies = {

  '*': ['isSubscriber'],
  'AuthController': {
    'login': true    // Always allow access to the user login action
  }

};

isSubscriber.js:

module.exports = function (req, res, next){
    sails.log ("Authenticating using jwt");
    passport.authenticate ('jwt', function (error, user, info){
        if (error) return res.serverError (error);
        if (!user) {
            return res.status(403).send ("Failed to authenticate");
        }
        req.user = user;
        sails.log ("User authenticated, user record: " , req.user);
        next();
    })(req, res);
};


问:
Timer unix timestamp countdown
In admin, I saved one to 2 and one to 1. I saved it with the timestamp method. It means one hour in the future and two hours in the future. So it should be shown like this. If I hit 1, it should show 00:59:59. And when I hit 2, it should show 01:59:59.

<!DOCTYPE html>

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

1671052946

1671055531

1671055431

1671054953

1671054531

```

Title: Timer unix timestamp countdown


问:
How to automate Web Scraping with R from a password protected website?
I'm very new in web scraping and automation and for this reason I ask if you can give me a hand with this problem:
I have a dataframe with information about several spanish companies. I want to identify the company sector, extracting CNAE information, and the company size. I want to extract this information from the SABI database, which requires the user and password information (I have a user).

How can I extract the CNAE and company size information from this webpage and add to my current dataframe as new columns?

Thank you very much ;)


问:
Unable to get value from xml file through XmlPullParser in Kotlin
I want to read an xml file using XmlPullParser in Kotlin and output a specific tag.

I've tried writing the code as follows by referring to various codes, but I can't get the value.
No error code is generated either.
What's the matter?

onCreate

```<code>override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(vBinding.root)

        val myInputStream: InputStream = assets.open("corp_code.xml")

        val factory: XmlPullParserFactory? = XmlPullParserFactory.newInstance()
        val parser:XmlPullParser = factory!!.newPullParser()
        parser.setInput(myInputStream, null)
        var event = parser.eventType

        while( event != XmlPullParser.END_DOCUMENT){
            try{
                if(parser.name=="corp_code" && parser.text != null){
                    Log.d("test", parser.text)
                }

            }catch(err:Exception){
                Log.d("test", err.toString())
                Log.d("test", err.stackTraceToString())
            }
        }
}
</code>```

XML

```<code><?xml version="1.0" encoding="UTF-8"?>
<result>
    <list>
        <corp_code>00434003</corp_code>
        <corp_name>dako</corp_name>
        <stock_code> </stock_code>
        <modify_date>20170630</modify_date>
    </list>
    <list>
        <corp_code>00179984</corp_code>
        <corp_name>unionErection</corp_name>
        <stock_code> </stock_code>
        <modify_date>20170630</modify_date>
    </list>
    <list>
        <corp_code>00420143</corp_code>
        <corp_name>brooksRIP</corp_name>
        <stock_code> </stock_code>
        <modify_date>20170630</modify_date>
    </list>
    <list>
        <corp_code>00401111</corp_code>
        <corp_name>IBI</corp_name>
        <stock_code> </stock_code>
        <modify_date>20170630</modify_date>
    </list>
</result>
</code>```

Body:
I want to read an xml file using XmlPullParser in Kotlin and output a specific tag.

I've tried writing the code as follows by referring to various codes, but I can't get the value.
No error code is generated either.
What's the matter?

onCreate

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(vBinding.root)

        val myInputStream: InputStream = assets.open("corp_code.xml")

        val factory: XmlPullParserFactory? = XmlPullParserFactory.newInstance()
        val parser:XmlPullParser = factory!!.newPullParser()
        parser.setInput(myInputStream, null)
        var event = parser.eventType

        while( event != XmlPullParser.END_DOCUMENT){
            try{
                if(parser.name=="corp_code" && parser.text != null){
                    Log.d("test", parser.text)
                }

            }catch(err:Exception){
                Log.d("test", err.toString())
                Log.d("test", err.stackTraceToString())
            }
        }
}

XML

<?xml version="1.0" encoding="UTF-8"?>
<result>
    <list>
        <corp_code>00434003</corp_code>
        <corp_name>dako</corp_name>
        <stock_code> </stock_code>
        <modify_date>20170630</modify_date>
    </list>
    <list>
        <corp_code>00179984</corp_code>
        <corp_name>unionErection</corp_name>
        <stock_code> </stock_code>
        <modify_date>20170630</modify_date>
    </list>
    <list>
        <corp_code>00420143</corp_code>
        <corp_name>brooksRIP</corp_name>
        <stock_code> </stock_code>
        <modify_date>20170630</modify_date>
    </list>
    <list>
        <corp_code>00401111</corp_code>
        <corp_name>IBI</corp_name>
        <stock_code> </stock_code>
        <modify_date>20170630</modify_date>
    </list>
</result>


问:
monitor values that change in curses python
I have a mongo DB document that have a value that get updated with python script (so it change)
I want to monitor this value along with lots of values that changed and get updated all the time in the terminal with curses

I want to know how to view values that change with python and curses


问:
Excel - How do I display the "excel options" dialog using vba?
I want to use vba to display the Save tab from the 'Excel Options' dialog box for our users.
File > Excel Options > Save

I'm familiar with the ExecuteMso method. For example, Application.CommandBars.ExecuteMso ("MacroSecurity") opens the Macro Security dialog.

I have the complete "Office 2016 Fluent Control list" but after much time looking at excelcontrols file, I can't find the control name to use.


问:
Handle Sharp In Controller And Get Id
There was a jsp application. I have just converted to spring boot application. I want to continue to use same links to handle company's information. Old urls are like /Dashboard.jsp#/company/10712. I have tried to handle company id but it didn't wook. How can I handle company id ?

```<code>@GetMapping("/Dashboard.jsp#/company/{id}")
public void try(@PathVariable String id) {
    System.out.println(id);
}
</code>```

I have also tried;
adding

```<code>server.tomcat.relaxed-path-chars=#
</code>```

in application properties.

```<code>@RequestMapping(value = ERROR_PATH, produces = "text/html")
public Object errorHtml(HttpServletRequest request, HttpServletResponse response) {
    if (response.getStatus() == HttpStatus.NOT_FOUND.value()) {
        return new ModelAndView("redirect:" + StringUtils.getBaseUrl(request) + "/?page=error", HttpStatus.FOUND);
    } else {
        return new ModelAndView("redirect:" + StringUtils.getBaseUrl(request) + "/?page=error");
    }
}
</code>```

This function handle 404.

```<code>request.getAttribute("javax.servlet.forward.request_uri")
</code>```

returns /esir/Dashboard.jsp. There is no # and others.

Title: Handle Sharp In Controller And Get Id

Body:
There was a jsp application. I have just converted to spring boot application. I want to continue to use same links to handle company's information. Old urls are like /Dashboard.jsp#/company/10712. I have tried to handle company id but it didn't wook. How can I handle company id ?

@GetMapping("/Dashboard.jsp#/company/{id}")
public void try(@PathVariable String id) {
    System.out.println(id);
}

I have also tried;
adding

server.tomcat.relaxed-path-chars=#

in application properties.

@RequestMapping(value = ERROR_PATH, produces = "text/html")
public Object errorHtml(HttpServletRequest request, HttpServletResponse response) {
    if (response.getStatus() == HttpStatus.NOT_FOUND.value()) {
        return new ModelAndView("redirect:" + StringUtils.getBaseUrl(request) + "/?page=error", HttpStatus.FOUND);
    } else {
        return new ModelAndView("redirect:" + StringUtils.getBaseUrl(request) + "/?page=error");
    }
}

This function handle 404.

request.getAttribute("javax.servlet.forward.request_uri")

returns /esir/Dashboard.jsp. There is no # and others.


问:
While installing Jenkins on Raspberry Pi 4B (sed: -e expression 1st row, 65th character: invalid contrast character)
I am using Ubuntu 22.04 version on my Raspberry Pi 4B(RAM 8GB).

```<code>$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy
</code>```

I tried to install Jenkins here and set it up, but if I do installation, the following error is confirmed.

```<code>$ sudo apt-get install -y jenkins

Reading package list... Completion
Creating dependency tree... Completion
Reading status information... Completion
We will install the next new package:
  jenkins
Zero upgrades, one fresh installation, zero removal, and seven upgrades.
You must receive 0 bytes/92.9 M bytes of archive.
After this operation, 93.6 M bytes of disk space will be used.
Selecting previously unselected package jenkins.
(Reading database...)There are currently 224160 files and directories installed.)
Preparing to unpack .../jenkins_2.375.1_all.deb ...
Unpacking jenkins (2.375.1) ...
Setting jenkins (2.375.1)...
sed: -e expression 1st row, 65th character: invalid contrast character
Created symlink /etc/systemd/system/multi-user.target.wants/jenkins.service → /lib/systemd/system/jenkins.service.
Job for jenkins.service failed because a timeout was exceeded.
See "systemctl status jenkins.service" and "journalctl -xeu jenkins.service" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● ● jenkins.service - Jenkins Continuous Integration Server
     Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: timeout) since Thu 2022-12-15 22:49:44 KST; 24ms ago
    Process: 459913 ExecStart=/usr/bin/jenkins (code=exited, status=143)
   Main PID: 459913 (code=exited, status=143)
     Status: "Jenkins stopped"
        CPU: 3min 20.145s
dpkg: error processing package jenkins (--configure):
 installed jenkins package post-installation script subprocess returned error exit status 1
There was an error processing:
 jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
</code>```

I've tried many things, but I haven't found an answer yet.

If anyone has experienced or solved a similar phenomenon, could you tell me how to solve it?

① I deleted the package and reinstalled it, ② deleted the apt or dpkg cache, and tried to reinstall it, but the same error continues to appear.

In addition, ③ the same error occurs when performing the same operation after rebooting, and if force the Jenkins service to start while installed as above, java accounts for 99% of the CPU and waits indefinitely as shown.

As CPU occupancy continues, Jenkins moves to Bad Message 431.

Body:
I am using Ubuntu 22.04 version on my Raspberry Pi 4B(RAM 8GB).

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

I tried to install Jenkins here and set it up, but if I do installation, the following error is confirmed.

$ sudo apt-get install -y jenkins

Reading package list... Completion
Creating dependency tree... Completion
Reading status information... Completion
We will install the next new package:
  jenkins
Zero upgrades, one fresh installation, zero removal, and seven upgrades.
You must receive 0 bytes/92.9 M bytes of archive.
After this operation, 93.6 M bytes of disk space will be used.
Selecting previously unselected package jenkins.
(Reading database...)There are currently 224160 files and directories installed.)
Preparing to unpack .../jenkins_2.375.1_all.deb ...
Unpacking jenkins (2.375.1) ...
Setting jenkins (2.375.1)...
sed: -e expression 1st row, 65th character: invalid contrast character
Created symlink /etc/systemd/system/multi-user.target.wants/jenkins.service → /lib/systemd/system/jenkins.service.
Job for jenkins.service failed because a timeout was exceeded.
See "systemctl status jenkins.service" and "journalctl -xeu jenkins.service" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● ● jenkins.service - Jenkins Continuous Integration Server
     Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: timeout) since Thu 2022-12-15 22:49:44 KST; 24ms ago
    Process: 459913 ExecStart=/usr/bin/jenkins (code=exited, status=143)
   Main PID: 459913 (code=exited, status=143)
     Status: "Jenkins stopped"
        CPU: 3min 20.145s
dpkg: error processing package jenkins (--configure):
 installed jenkins package post-installation script subprocess returned error exit status 1
There was an error processing:
 jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've tried many things, but I haven't found an answer yet.

If anyone has experienced or solved a similar phenomenon, could you tell me how to solve it?

① I deleted the package and reinstalled it, ② deleted the apt or dpkg cache, and tried to reinstall it, but the same error continues to appear.

In addition, ③ the same error occurs when performing the same operation after rebooting, and if force the Jenkins service to start while installed as above, java accounts for 99% of the CPU and waits indefinitely as shown.

As CPU occupancy continues, Jenkins moves to Bad Message 431.


问:
Implementing 2 way calendar sync for custom application
My task is to explore options to implement 2-way calendar sync.
Application is based on calendar events, and there should be a sync with other popular calendars.

Do I understand this correctly, that I need to do separate implementations for each mail client, like Gmail, Outlook, Apple??

Or it's a better option to create some Zapier integration or similar.


问:
Is it possible to use firebase authentication to access google apis?
So I'm writing an iOS app and I need it to interface with google sheets. I am able to get my app to be able to be logged into with google through firebase. However, previously, when I made the android version of the app, I didn't use firebase. Is there a way to use the firebase credential to create the google sheets service for iOS? Thanks!!</p>


问:
SQLAlchemy Inserts dont get Saved
I Am trying to add some Rows to My Table with SQLAlchemy to my local SQLLite File. However the Rows dont get saved. I dont get any Primary Key Errors and i am also commiting my Inserts/Session.

What's really confusing me is that my Code works fine(My Inserts are Saved), when i am changing my Engine to Connect to a local postgresql-Server. I Am Calling the add_values Function from an other File.

```<code>def add_values(offers):
engine = create_engine("sqlite:///mydb.db",echo=True)
Base.metadata.create_all(bind=engine)
Session = sessionmaker(bind=engine)
with Session.begin() as session:
    list_of_offers =[]
    for ele in offers:
        offer = Offer(ele.id,ele.asin,ele.price,ele.currency,ele.condition,ele.seller,ele.datetime,ele.buyboxWinner,ele.numberOfSellers)
        list_of_offers.append(offer)
    session.add_all(list_of_offers)
    session.commit()
</code>```

I Tryed to Change my Database to postgresql-Server.

Title: SQLAlchemy Inserts dont get Saved

Body:
I Am trying to add some Rows to My Table with SQLAlchemy to my local SQLLite File. However the Rows dont get saved. I dont get any Primary Key Errors and i am also commiting my Inserts/Session.

What's really confusing me is that my Code works fine(My Inserts are Saved), when i am changing my Engine to Connect to a local postgresql-Server. I Am Calling the add_values Function from an other File.

def add_values(offers):
engine = create_engine("sqlite:///mydb.db",echo=True)
Base.metadata.create_all(bind=engine)
Session = sessionmaker(bind=engine)
with Session.begin() as session:
    list_of_offers =[]
    for ele in offers:
        offer = Offer(ele.id,ele.asin,ele.price,ele.currency,ele.condition,ele.seller,ele.datetime,ele.buyboxWinner,ele.numberOfSellers)
        list_of_offers.append(offer)
    session.add_all(list_of_offers)
    session.commit()

I Tryed to Change my Database to postgresql-Server.


问:
White line appears on image when image is converted to data using jpegData?

When I convert UIImage to data using jpegData compression it will add a thin line on top of the image, why is that so?
Also I'm using this func for resizing image.
After resizing Im converting to jpegData.

```<code>    func resizeImage(image: UIImage, targetSize: CGSize , percentage:Double) -> UIImage {
        let size = image.size

        let widthRatio  = targetSize.width  / size.width
        let heightRatio = targetSize.height / size.height

        // Figure out what our orientation is, and use that to form the rectangle
        var newSize: CGSize
        if(widthRatio > heightRatio) {
            newSize = CGSize(width: size.width * heightRatio, height: size.height * heightRatio)
        } else {
            newSize = CGSize(width: size.width * widthRatio,  height: size.height * widthRatio)
        }

        // This is the rect that we've calculated out and this is what is actually used below
        let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)

        // Actually do the resizing to the rect using the ImageContext stuff
        UIGraphicsBeginImageContextWithOptions(newSize, false, percentage)
        // UIGraphicsBeginImageContextWithOptions(newSize , false , )
        image.draw(in: rect)
        let newImage = UIGraphicsGetImageFromCurrentImageContext()!
        UIGraphicsEndImageContext()

        return newImage
    }
let image = resizeImage.jpegData(compressionQuality: 0.60)!

</code>```

Body:
When I convert UIImage to data using jpegData compression it will add a thin line on top of the image, why is that so?
Also I'm using this func for resizing image.
After resizing Im converting to jpegData.

    func resizeImage(image: UIImage, targetSize: CGSize , percentage:Double) -> UIImage {
        let size = image.size

        let widthRatio  = targetSize.width  / size.width
        let heightRatio = targetSize.height / size.height

        // Figure out what our orientation is, and use that to form the rectangle
        var newSize: CGSize
        if(widthRatio > heightRatio) {
            newSize = CGSize(width: size.width * heightRatio, height: size.height * heightRatio)
        } else {
            newSize = CGSize(width: size.width * widthRatio,  height: size.height * widthRatio)
        }

        // This is the rect that we've calculated out and this is what is actually used below
        let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)

        // Actually do the resizing to the rect using the ImageContext stuff
        UIGraphicsBeginImageContextWithOptions(newSize, false, percentage)
        // UIGraphicsBeginImageContextWithOptions(newSize , false , )
        image.draw(in: rect)
        let newImage = UIGraphicsGetImageFromCurrentImageContext()!
        UIGraphicsEndImageContext()

        return newImage
    }
let image = resizeImage.jpegData(compressionQuality: 0.60)!


问:
Embedding real-time Grafana dashboards in Django web application
I want to embed a real-time grafana dashboard into my django web application. Currently, I have embedded the individual panels of the dashboard in my django applications using the iframe link that is generated by grafana, but they are just a snapshot of the graph and the individual panels do not scroll automatically to the current time.</p>


问:
Spring Rest Controllers global security filter
I have a REST application with Spring MVC, I would like to set a custom global filter to validate a bearer-token in HTTP request.

How can I write a common authentication filter valid for all controllers and all methods?
It should be able to access the HTTP request data.

I don't want to use Spring security component.


问:
ExpandableListView CustomAdapter app crack
expendablelistview pdf viewer tutorial from youtube.toast message is working.youtube tutorial</p>
```<code>> CustomAdapter.java
</code>```
```<code>@Override
public View getGroupView(int i, boolean b, View view, ViewGroup viewGroup) {

    view= LayoutInflater.from(context).inflate(R.layout.chapter_item,viewGroup,false);
    TextView chapterName = view.findViewById(R.id.chapterTitle);
    chapterName.setText(chapterList.get(i).getChaptername());

    return view;
}
@Override
public View getChildView(int i, int i1, boolean b, View view, ViewGroup viewGroup) {
    view= LayoutInflater.from(context).inflate(R.layout.topics_item,viewGroup,false);
    TextView topicName = (TextView) view.findViewById(R.id.topicTitle);
    topicName.setText(chapterList.get(i).getTopicsList().get(i1).getTopicName());
    CardView cardView=(CardView) view.findViewById(R.id.topicClick);
    cardView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent =(new Intent(context, FullView.class));
            intent.putExtra("fileName",chapterList.get(i).getTopicsList().get(i1).getFileName());
            context.startActivity(intent);
</code>```

Body:
expendablelistview pdf viewer tutorial from youtube.toast message is working.youtube tutorial

> CustomAdapter.java

@Override
public View getGroupView(int i, boolean b, View view, ViewGroup viewGroup) {

    view= LayoutInflater.from(context).inflate(R.layout.chapter_item,viewGroup,false);
    TextView chapterName = view.findViewById(R.id.chapterTitle);
    chapterName.setText(chapterList.get(i).getChaptername());

    return view;
}
@Override
public View getChildView(int i, int i1, boolean b, View view, ViewGroup viewGroup) {
    view= LayoutInflater.from(context).inflate(R.layout.topics_item,viewGroup,false);
    TextView topicName = (TextView) view.findViewById(R.id.topicTitle);
    topicName.setText(chapterList.get(i).getTopicsList().get(i1).getTopicName());
    CardView cardView=(CardView) view.findViewById(R.id.topicClick);
    cardView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent =(new Intent(context, FullView.class));
            intent.putExtra("fileName",chapterList.get(i).getTopicsList().get(i1).getFileName());
            context.startActivity(intent);


问:
Managing AWS authentication in Python requests using boto3
I'm using the following method in order to auto-refresh AWS Tokens using IAM role and boto3 (based on, these resources):

```<code>import boto3
from botocore.credentials import RefreshableCredentials
from botocore.session import get_session

def get_aws_credentials():
    aws_role_arn = 'AWS_ROLE_ARN'
    sts_client = boto3.client('sts')
    assumed_role_object = sts_client.assume_role(
        RoleArn = aws_role_arn,
        RoleSessionName = "SessioName",
        DurationSeconds = 900
    )
    return {
        'access_key': assumed_role_object['Credentials']['AccessKeyId'],
        'secret_key': assumed_role_object['Credentials']['SecretAccessKey'],
        'token': assumed_role_object['Credentials']['SessionToken'],
        'expiry_time': assumed_role_object['Credentials']['Expiration'].isoformat()
    }

session_credentials = RefreshableCredentials.create_from_metadata(
    metadata = get_aws_credentials(),
    refresh_using = get_aws_credentials,
    method = 'sts-assume-role'
)

session = get_session()
session._credentials = session_credentials
autorefresh_session = boto3.Session(botocore_session=session)
</code>```

This is fine for managing AWS resources such as a S3 bucket, for which I'm using:

```<code>autorefresh_session.resource('s3')
</code>```

And RefreshableCredentials is managing the job of refreshing the credentials.

However, I have also the need to do some requests like this one:

```<code>import requests

r = requests.post(
    "https://myawsgatewayurl.com/endpoint",
    json=json_message,
    auth=aws_auth
    )
</code>```

Where I would be using:

```<code>from aws_requests_auth.aws_auth import AWSRequestsAuth

generated_credentials = get_aws_credentials()

aws_auth = AWSRequestsAuth(
    aws_access_key=generated_credentials['access_key'],
    aws_secret_access_key=generated_credentials['secret_key'],
    aws_token=generated_credentials['token'],
    aws_host=my_aws_host,
    aws_region=my_aws_region,
    aws_service=my_aws_service
    )
</code>```

However, this approach seems to me not efficient, because I should call get_aws_credentials() each time I do a request, to be sure they are not expired (or check expiration before), while I would like to rely on RefreshableCredentials for this.

Is there a better approach?

Body:
I'm using the following method in order to auto-refresh AWS Tokens using IAM role and boto3 (based on, these resources):

import boto3
from botocore.credentials import RefreshableCredentials
from botocore.session import get_session

def get_aws_credentials():
    aws_role_arn = 'AWS_ROLE_ARN'
    sts_client = boto3.client('sts')
    assumed_role_object = sts_client.assume_role(
        RoleArn = aws_role_arn,
        RoleSessionName = "SessioName",
        DurationSeconds = 900
    )
    return {
        'access_key': assumed_role_object['Credentials']['AccessKeyId'],
        'secret_key': assumed_role_object['Credentials']['SecretAccessKey'],
        'token': assumed_role_object['Credentials']['SessionToken'],
        'expiry_time': assumed_role_object['Credentials']['Expiration'].isoformat()
    }

session_credentials = RefreshableCredentials.create_from_metadata(
    metadata = get_aws_credentials(),
    refresh_using = get_aws_credentials,
    method = 'sts-assume-role'
)

session = get_session()
session._credentials = session_credentials
autorefresh_session = boto3.Session(botocore_session=session)

This is fine for managing AWS resources such as a S3 bucket, for which I'm using:

autorefresh_session.resource('s3')

And RefreshableCredentials is managing the job of refreshing the credentials.

However, I have also the need to do some requests like this one:

import requests

r = requests.post(
    "https://myawsgatewayurl.com/endpoint",
    json=json_message,
    auth=aws_auth
    )

Where I would be using:

from aws_requests_auth.aws_auth import AWSRequestsAuth

generated_credentials = get_aws_credentials()

aws_auth = AWSRequestsAuth(
    aws_access_key=generated_credentials['access_key'],
    aws_secret_access_key=generated_credentials['secret_key'],
    aws_token=generated_credentials['token'],
    aws_host=my_aws_host,
    aws_region=my_aws_region,
    aws_service=my_aws_service
    )

However, this approach seems to me not efficient, because I should call get_aws_credentials() each time I do a request, to be sure they are not expired (or check expiration before), while I would like to rely on RefreshableCredentials for this.

Is there a better approach?


问:
tkinker inserting a csv into treeview
```<code>def read_csv_file(csv='########'):
    # Read the CSV file and create a DataFrame
    df = pd.read_csv(csv, index_col=False)

    # Iterate over the rows of the DataFrame
    for index, row in df.iterrows():
        # Insert the current row into the Treeview widget
        self.tree.insert("", "end", values=row)
</code>```

Hi all, I am using a python function to import a csv via button in tkinter app. but the rows are not reading correctly from the csv format. It should be reading row wise like this for the top row. Is there something going wrong with the tree.insert I am using?

Title: tkinker inserting a csv into treeview

Body:
def read_csv_file(csv='########'):
    # Read the CSV file and create a DataFrame
    df = pd.read_csv(csv, index_col=False)

    # Iterate over the rows of the DataFrame
    for index, row in df.iterrows():
        # Insert the current row into the Treeview widget
        self.tree.insert("", "end", values=row)

Hi all, I am using a python function to import a csv via button in tkinter app. but the rows are not reading correctly from the csv format. It should be reading row wise like this for the top row. Is there something going wrong with the tree.insert I am using?


问:
Time based log level
For one specific logger, I need to have info level logging during 9 to 5 but warning level after that. Can someone help me with logback configuration for something like this?

I couldn't find any time based log level configuration anywhere.

Title: Time based log level


问:
How to ensure correct scale of different categories in R
I have a dataset where I have a simple male/female breakdown, a category (say A, B or C), some kind of location to give me more data points and then a count for each one. E.g.

Basic sample

Obviously performing any kind of analysis on this is a bit meaningless at the moment as the number of males is far higher than females. 7 males is significantly lower than 7 females as it currently stands. The examples I can find online for standardising these are a bit too simple and blanket affect the whole dataset, rather than breaking it down into a particular category. I am looking to do this in R to give me more options when it comes to analysing larger things and I am frustratingly still waiting for my R training!

I have tried this manually and using tutorials online, but they are too basic for my data.


问:
Annotating numeric values on grouped bars chart in pyplot
Good evening all,
I have a pd.dataframe called plot_eigen_vecs_df which is of (3,11) dimension, and I am plotting each column value grouped by rows on a bar chart. I am using the following code:

```<code>plot_eigen_vecs_df.plot(kind='bar', figsize=(12, 8),
                                title='First 3 PCs factor loadings',
                                xlabel='Evects', legend=True)
</code>```

The result is this graph:

enter image description here

I would like to keep the graph (grouped) exactly as it is, but I need to show the numeric value above each bars.

Thank you

I tried the add_label method, but unfortunately I am currently using a version of pyplot which is not the most recent, so .add_label doesn't work for me.  Could you please help on the matter?

Body:
Good evening all,
I have a pd.dataframe called plot_eigen_vecs_df which is of (3,11) dimension, and I am plotting each column value grouped by rows on a bar chart. I am using the following code:

plot_eigen_vecs_df.plot(kind='bar', figsize=(12, 8),
                                title='First 3 PCs factor loadings',
                                xlabel='Evects', legend=True)

The result is this graph:

enter image description here

I would like to keep the graph (grouped) exactly as it is, but I need to show the numeric value above each bars.

Thank you

I tried the add_label method, but unfortunately I am currently using a version of pyplot which is not the most recent, so .add_label doesn't work for me.  Could you please help on the matter?


问:
laravel-websocket is not working on production
I already created many projects with same settings. But for this project, for some reason i cant connect to ws on production.
Connection to WS is always on pending...

Here is all my settings:

broadcasting.php

```<code><?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Broadcaster
    |--------------------------------------------------------------------------
    |
    | This option controls the default broadcaster that will be used by the
    | framework when an event needs to be broadcast. You may set this to
    | any of the connections defined in the "connections" array below.
    |
    | Supported: "pusher", "ably", "redis", "log", "null"
    |
    */

    'default' => env('BROADCAST_DRIVER', 'null'),

    /*
    |--------------------------------------------------------------------------
    | Broadcast Connections
    |--------------------------------------------------------------------------
    |
    | Here you may define all of the broadcast connections that will be used
    | to broadcast events to other systems or over websockets. Samples of
    | each available type of connection are provided inside this array.
    |
    */

    'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
                'port' => env('PUSHER_PORT', 443),
                'scheme' => env('PUSHER_SCHEME', 'https'),
                'encrypted' => env('PUSHER_SCHEME', 'https') === 'https',
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',

                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => 0,
                    CURLOPT_SSL_VERIFYPEER => 0,
                ],
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
        ],

        'ably' => [
            'driver' => 'ably',
            'key' => env('ABLY_KEY'),
        ],

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
        ],

        'log' => [
            'driver' => 'log',
        ],

        'null' => [
            'driver' => 'null',
        ],

    ],

];

</code>```

websocket.php

```<code><?php

use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize;

return [

    /*
     * Set a custom dashboard configuration
     */
    'dashboard' => [
        'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
    ],

    /*
     * This package comes with multi tenancy out of the box. Here you can
     * configure the different apps that can use the webSockets server.
     *
     * Optionally you specify capacity so you can limit the maximum
     * concurrent connections for a specific app.
     *
     * Optionally you can disable client events so clients cannot send
     * messages to each other via the webSockets.
     */
    'apps' => [
        [
            'id' => env('PUSHER_APP_ID'),
            'name' => env('APP_NAME'),
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'path' => env('PUSHER_APP_PATH'),
            'capacity' => null,
            'enable_client_messages' => false,
            'enable_statistics' => false,
        ],
    ],

    /*
     * This class is responsible for finding the apps. The default provider
     * will use the apps defined in this config file.
     *
     * You can create a custom provider by implementing the
     * `AppProvider` interface.
     */
    'app_provider' => BeyondCode\LaravelWebSockets\Apps\ConfigAppProvider::class,

    /*
     * This array contains the hosts of which you want to allow incoming requests.
     * Leave this empty if you want to accept requests from all hosts.
     */
    'allowed_origins' => [
        //
    ],

    /*
     * The maximum request size in kilobytes that is allowed for an incoming WebSocket request.
     */
    'max_request_size_in_kb' => 250,

    /*
     * This path will be used to register the necessary routes for the package.
     */
    'path' => 'laravel-websockets',

    /*
     * Dashboard Routes Middleware
     *
     * These middleware will be assigned to every dashboard route, giving you
     * the chance to add your own middleware to this list or change any of
     * the existing middleware. Or, you can simply stick with this list.
     */
    'middleware' => [
        'web',
        Authorize::class,
    ],

    'statistics' => [
        /*
         * This model will be used to store the statistics of the WebSocketsServer.
         * The only requirement is that the model should extend
         * `WebSocketsStatisticsEntry` provided by this package.
         */
        'model' => \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry::class,

        /**
         * The Statistics Logger will, by default, handle the incoming statistics, store them
         * and then release them into the database on each interval defined below.
         */
        'logger' => BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class,

        /*
         * Here you can specify the interval in seconds at which statistics should be logged.
         */
        'interval_in_seconds' => 60,

        /*
         * When the clean-command is executed, all recorded statistics older than
         * the number of days specified here will be deleted.
         */
        'delete_statistics_older_than_days' => 60,

        /*
         * Use an DNS resolver to make the requests to the statistics logger
         * default is to resolve everything to 127.0.0.1.
         */
        'perform_dns_lookup' => false,
    ],

    /*
     * Define the optional SSL context for your WebSocket connections.
     * You can see all available options at: http://php.net/manual/en/context.ssl.php
     */
    'ssl' => [
        'verify_peer' => false,
        /*
         * Path to local certificate file on filesystem. It must be a PEM encoded file which
         * contains your certificate and private key. It can optionally contain the
         * certificate chain of issuers. The private key also may be contained
         * in a separate file specified by local_pk.
         */
        'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null),

        /*
         * Path to local private key file on filesystem in case of separate files for
         * certificate (local_cert) and private key.
         */
        'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null),

        /*
         * Passphrase for your local_cert file.
         */
        'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null),
    ],

    /*
     * Channel Manager
     * This class handles how channel persistence is handled.
     * By default, persistence is stored in an array by the running webserver.
     * The only requirement is that the class should implement
     * `ChannelManager` interface provided by this package.
     */
    'channel_manager' => \BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager::class,
];

</code>```

.env
here am pointing to the ssl certs
(i checked the files existens)

```<code>
PUSHER_APP_ID=test
PUSHER_APP_KEY=test
PUSHER_APP_SECRET=test
PUSHER_HOST=mysite.com
PUSHER_PORT=6001
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=eu
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=/www/server/panel/vhost/cert/www.domain/fullchain.pem
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=/www/server/panel/vhost/cert/www.domain/privkey.pem

</code>```

my NGINX:
This is the default nginx settings from the laravel offical website (ssl was added automaticly by the host panel)

```<code>server {
    listen 80;
    listen 443 ssl http2;
    listen [::]:80;

    server_name mysite.com;
    root /www/wwwroot/mysite.com/public;

    ssl    on;

    #SSL-START SSL related configuration, do NOT delete or modify the next line of commented-out 404 rules
    #error_page 404/404.html;
    ssl_certificate    /www/server/panel/vhost/cert/www.domain/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/www.domain/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;

    access_log /www/wwwroot/mysite/access.log;
    error_log /www/wwwroot/mysite/error.log;
    #SSL-END
    index index.php index.html;

    charset utf-8;

    # Directory verification related settings for one-click application for SSL certificate
    location ~ \.well-known{
        allow all;
    }

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

}

</code>```

This is how i connect to websocket from Client

```<code>wss://mysite:6001/app/{key}
</code>```

Body:
I already created many projects with same settings. But for this project, for some reason i cant connect to ws on production.
Connection to WS is always on pending...

Here is all my settings:

broadcasting.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Broadcaster
    |--------------------------------------------------------------------------
    |
    | This option controls the default broadcaster that will be used by the
    | framework when an event needs to be broadcast. You may set this to
    | any of the connections defined in the "connections" array below.
    |
    | Supported: "pusher", "ably", "redis", "log", "null"
    |
    */

    'default' => env('BROADCAST_DRIVER', 'null'),

    /*
    |--------------------------------------------------------------------------
    | Broadcast Connections
    |--------------------------------------------------------------------------
    |
    | Here you may define all of the broadcast connections that will be used
    | to broadcast events to other systems or over websockets. Samples of
    | each available type of connection are provided inside this array.
    |
    */

    'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
                'port' => env('PUSHER_PORT', 443),
                'scheme' => env('PUSHER_SCHEME', 'https'),
                'encrypted' => env('PUSHER_SCHEME', 'https') === 'https',
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',

                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => 0,
                    CURLOPT_SSL_VERIFYPEER => 0,
                ],
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
        ],

        'ably' => [
            'driver' => 'ably',
            'key' => env('ABLY_KEY'),
        ],

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
        ],

        'log' => [
            'driver' => 'log',
        ],

        'null' => [
            'driver' => 'null',
        ],

    ],

];

websocket.php

<?php

use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize;

return [

    /*
     * Set a custom dashboard configuration
     */
    'dashboard' => [
        'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
    ],

    /*
     * This package comes with multi tenancy out of the box. Here you can
     * configure the different apps that can use the webSockets server.
     *
     * Optionally you specify capacity so you can limit the maximum
     * concurrent connections for a specific app.
     *
     * Optionally you can disable client events so clients cannot send
     * messages to each other via the webSockets.
     */
    'apps' => [
        [
            'id' => env('PUSHER_APP_ID'),
            'name' => env('APP_NAME'),
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'path' => env('PUSHER_APP_PATH'),
            'capacity' => null,
            'enable_client_messages' => false,
            'enable_statistics' => false,
        ],
    ],

    /*
     * This class is responsible for finding the apps. The default provider
     * will use the apps defined in this config file.
     *
     * You can create a custom provider by implementing the
     * `AppProvider` interface.
     */
    'app_provider' => BeyondCode\LaravelWebSockets\Apps\ConfigAppProvider::class,

    /*
     * This array contains the hosts of which you want to allow incoming requests.
     * Leave this empty if you want to accept requests from all hosts.
     */
    'allowed_origins' => [
        //
    ],

    /*
     * The maximum request size in kilobytes that is allowed for an incoming WebSocket request.
     */
    'max_request_size_in_kb' => 250,

    /*
     * This path will be used to register the necessary routes for the package.
     */
    'path' => 'laravel-websockets',

    /*
     * Dashboard Routes Middleware
     *
     * These middleware will be assigned to every dashboard route, giving you
     * the chance to add your own middleware to this list or change any of
     * the existing middleware. Or, you can simply stick with this list.
     */
    'middleware' => [
        'web',
        Authorize::class,
    ],

    'statistics' => [
        /*
         * This model will be used to store the statistics of the WebSocketsServer.
         * The only requirement is that the model should extend
         * `WebSocketsStatisticsEntry` provided by this package.
         */
        'model' => \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry::class,

        /**
         * The Statistics Logger will, by default, handle the incoming statistics, store them
         * and then release them into the database on each interval defined below.
         */
        'logger' => BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class,

        /*
         * Here you can specify the interval in seconds at which statistics should be logged.
         */
        'interval_in_seconds' => 60,

        /*
         * When the clean-command is executed, all recorded statistics older than
         * the number of days specified here will be deleted.
         */
        'delete_statistics_older_than_days' => 60,

        /*
         * Use an DNS resolver to make the requests to the statistics logger
         * default is to resolve everything to 127.0.0.1.
         */
        'perform_dns_lookup' => false,
    ],

    /*
     * Define the optional SSL context for your WebSocket connections.
     * You can see all available options at: http://php.net/manual/en/context.ssl.php
     */
    'ssl' => [
        'verify_peer' => false,
        /*
         * Path to local certificate file on filesystem. It must be a PEM encoded file which
         * contains your certificate and private key. It can optionally contain the
         * certificate chain of issuers. The private key also may be contained
         * in a separate file specified by local_pk.
         */
        'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null),

        /*
         * Path to local private key file on filesystem in case of separate files for
         * certificate (local_cert) and private key.
         */
        'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null),

        /*
         * Passphrase for your local_cert file.
         */
        'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null),
    ],

    /*
     * Channel Manager
     * This class handles how channel persistence is handled.
     * By default, persistence is stored in an array by the running webserver.
     * The only requirement is that the class should implement
     * `ChannelManager` interface provided by this package.
     */
    'channel_manager' => \BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager::class,
];

.env
here am pointing to the ssl certs
(i checked the files existens)

PUSHER_APP_ID=test
PUSHER_APP_KEY=test
PUSHER_APP_SECRET=test
PUSHER_HOST=mysite.com
PUSHER_PORT=6001
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=eu
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=/www/server/panel/vhost/cert/www.domain/fullchain.pem
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=/www/server/panel/vhost/cert/www.domain/privkey.pem

my NGINX:
This is the default nginx settings from the laravel offical website (ssl was added automaticly by the host panel)

server {
    listen 80;
    listen 443 ssl http2;
    listen [::]:80;

    server_name mysite.com;
    root /www/wwwroot/mysite.com/public;

    ssl    on;

    #SSL-START SSL related configuration, do NOT delete or modify the next line of commented-out 404 rules
    #error_page 404/404.html;
    ssl_certificate    /www/server/panel/vhost/cert/www.domain/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/www.domain/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;

    access_log /www/wwwroot/mysite/access.log;
    error_log /www/wwwroot/mysite/error.log;
    #SSL-END
    index index.php index.html;

    charset utf-8;

    # Directory verification related settings for one-click application for SSL certificate
    location ~ \.well-known{
        allow all;
    }

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

}

This is how i connect to websocket from Client

wss://mysite:6001/app/{key}


问:
Unable to connect mongoDB server with my node.js file, getting MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 constantly

mongod database process running

Local server connected to mongoDB compass

created mongooseTut Folder

npm init

mongoose and node installed

when i try to connect to server by writing node .\index.js, it thorws the error shown in picture, i.e.-MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
P.S.: Have already tried each and every solution mentioned in all relevant replies on stackoverflow.

Tried connecting node.js to mongoDb server and got error MongooseServerSelectionError: connect ECONNREFUSED ::1:27017


问:
CDK Java - Referencing nested json context values within a Stack
So I'm just getting started with CDK using Java & I'd like to find how to extract context info from the cdk.context.json.
Essentially looking to hold parameters externally from the Stack relative to the environment (dev, test etc).
So will be looking at incorporating into a pipeline (probably Gitlab) so the cdk.context.json will be version controlled.
For instance, a cut of my context is as follows;

```<code>{
  "vpc-provider:account=999999999:filter.isDefault=true:filter.vpc-id=vpc-w4w4w4w4w4:region=eu-west-2:returnAsymmetricSubnets=true": {
    "vpcId": "vpc-w4w4w4w4w4",
    .......
  "environments": {
    "dev": {
      "documentDb": [
        {
          "port": "27017"
        }
      ],
      "subnetGroups": [
        {
          "name": "Private",
          "type": "Private",
          "subnets": [
            {
              "cidr": "10.0.1.0/24/24",
              "availabilityZone": "eu-west-2a"
            },
            {
              "cidr": "10.0.2.0/24",
              "availabilityZone": "eu-west-2b"
            }
          ]
        }
      ]
    },
    "prod": {
      "documentDb": [
        {
          "port": "27018"
        }
      ],
      "subnetGroups": [
        {
          "name": "Private",
          "type": "Private",
          "subnets": [
            {
              "cidr": "20.0.1.0/24/24",
              "availabilityZone": "eu-west-2a"
            },
            {
              "cidr": "20.0.2.0/24",
              "availabilityZone": "eu-west-2b"
            }
          ]
        }
      ]
    }
  }
}
</code>```

I'd like to extract the values for dev --> documentDb --> port for instance in the most elegant CDK way.  If in my Stack I use;

this.getNode().tryGetContext("environments")

I am returned the whole JSON block;

```<code>{dev={documentDb=[{port=27017], subnetGroups=[{name=Private, type=Private, subnets=[{cidr=10.0.1.0/24/24, availabilityZone=eu-west-2a}, {cidr=10.0.2.0/24, availabilityZone=eu-west-2b}]}]}, prod={documentDb=[{port=27018], subnetGroups=..............
</code>```

& not sure how to progress up the tree.  If I synch passing in the config;

```<code>cdk synth -c config=environments > target/DocumentDbAppStack.yaml
</code>```

& in my Stack;

```<code>this.getNode().tryGetContext("config")
</code>```

I get "environments".

I can parse the LinkedHashMap using a JSON parser but that's obviously the wrong approach.  I have looked at loads of examples / AWS documentation etc but can't seem to find the answer.  There seems to be a wealth of info using Typescript (think that was the first language used for CDK), but I've never used it.

Thanks in advance.

Detailed above in description.

Body:
So I'm just getting started with CDK using Java & I'd like to find how to extract context info from the cdk.context.json.
Essentially looking to hold parameters externally from the Stack relative to the environment (dev, test etc).
So will be looking at incorporating into a pipeline (probably Gitlab) so the cdk.context.json will be version controlled.
For instance, a cut of my context is as follows;

{
  "vpc-provider:account=999999999:filter.isDefault=true:filter.vpc-id=vpc-w4w4w4w4w4:region=eu-west-2:returnAsymmetricSubnets=true": {
    "vpcId": "vpc-w4w4w4w4w4",
    .......
  "environments": {
    "dev": {
      "documentDb": [
        {
          "port": "27017"
        }
      ],
      "subnetGroups": [
        {
          "name": "Private",
          "type": "Private",
          "subnets": [
            {
              "cidr": "10.0.1.0/24/24",
              "availabilityZone": "eu-west-2a"
            },
            {
              "cidr": "10.0.2.0/24",
              "availabilityZone": "eu-west-2b"
            }
          ]
        }
      ]
    },
    "prod": {
      "documentDb": [
        {
          "port": "27018"
        }
      ],
      "subnetGroups": [
        {
          "name": "Private",
          "type": "Private",
          "subnets": [
            {
              "cidr": "20.0.1.0/24/24",
              "availabilityZone": "eu-west-2a"
            },
            {
              "cidr": "20.0.2.0/24",
              "availabilityZone": "eu-west-2b"
            }
          ]
        }
      ]
    }
  }
}

I'd like to extract the values for dev --> documentDb --> port for instance in the most elegant CDK way.  If in my Stack I use;

this.getNode().tryGetContext("environments")

I am returned the whole JSON block;

{dev={documentDb=[{port=27017], subnetGroups=[{name=Private, type=Private, subnets=[{cidr=10.0.1.0/24/24, availabilityZone=eu-west-2a}, {cidr=10.0.2.0/24, availabilityZone=eu-west-2b}]}]}, prod={documentDb=[{port=27018], subnetGroups=..............

& not sure how to progress up the tree.  If I synch passing in the config;

cdk synth -c config=environments > target/DocumentDbAppStack.yaml

& in my Stack;

this.getNode().tryGetContext("config")

I get "environments".

I can parse the LinkedHashMap using a JSON parser but that's obviously the wrong approach.  I have looked at loads of examples / AWS documentation etc but can't seem to find the answer.  There seems to be a wealth of info using Typescript (think that was the first language used for CDK), but I've never used it.

Thanks in advance.

Detailed above in description.


问:
Populating a shelf in python using a text box for input in Tkinter
When using a radio button in the GUI I am able to launch a text box for input which calls a function set_name
When I look at the .dir file that the shelf contains it will not have any of the input
My code is below thanks for any help

```<code>from tkinter import *
import shelve

class MyFrame (Frame):
    def __init__(self):
        Frame.__init__(self)
        self.master.geometry("600x600")
        self.master.title("Student Scores")
        self.grid()

        #open text file
        student_scores = shelve.open('student_name', 'c')

        #Display menue here here
        self.student_name = StringVar()

        # Prompt, Entry and Button
        self.prompt = Label(self, text = "Select one of the 3 menu options")
        self.prompt.grid(row = 0, column = 0)

        #Radio Button Menu options
        self.button_selected = IntVar()
        self.menu_button = Radiobutton(self, text = "Add student name",
                        variable = self.button_selected, value=1,
                        command = self.set_name)
        self.menu_button.grid(row = 3, column = 0)

        print(list(student_scores.keys()))

        #close test file
        student_scores.close()

    #Create functions for radio button
    def set_name(self):
        self.prompt = Label(self, text = "Enter students name: ")
        self.prompt.grid(row = 7, column = 0)

        self.input = Entry(self)
        self.input.grid(row = 7, column = 1)

        self.button_submit = Button(self, text = "Submit",
                                command = self.submit_click)
        self.button_submit.grid(row = 7, column = 2)

    def submit_click(self):

        #self.student_name.set(self.input.get())
        print("button clicked")

asn_frame = MyFrame()
asn_frame.mainloop()

</code>```

Im just expecting to do a simple populating of a text box input as entered  and have it populate a shelf in python

Body:
When using a radio button in the GUI I am able to launch a text box for input which calls a function set_name
When I look at the .dir file that the shelf contains it will not have any of the input
My code is below thanks for any help

from tkinter import *
import shelve

class MyFrame (Frame):
    def __init__(self):
        Frame.__init__(self)
        self.master.geometry("600x600")
        self.master.title("Student Scores")
        self.grid()

        #open text file
        student_scores = shelve.open('student_name', 'c')

        #Display menue here here
        self.student_name = StringVar()

        # Prompt, Entry and Button
        self.prompt = Label(self, text = "Select one of the 3 menu options")
        self.prompt.grid(row = 0, column = 0)

        #Radio Button Menu options
        self.button_selected = IntVar()
        self.menu_button = Radiobutton(self, text = "Add student name",
                        variable = self.button_selected, value=1,
                        command = self.set_name)
        self.menu_button.grid(row = 3, column = 0)

        print(list(student_scores.keys()))

        #close test file
        student_scores.close()

    #Create functions for radio button
    def set_name(self):
        self.prompt = Label(self, text = "Enter students name: ")
        self.prompt.grid(row = 7, column = 0)

        self.input = Entry(self)
        self.input.grid(row = 7, column = 1)

        self.button_submit = Button(self, text = "Submit",
                                command = self.submit_click)
        self.button_submit.grid(row = 7, column = 2)

    def submit_click(self):

        #self.student_name.set(self.input.get())
        print("button clicked")

asn_frame = MyFrame()
asn_frame.mainloop()

Im just expecting to do a simple populating of a text box input as entered  and have it populate a shelf in python


问:
Error when reading in a .txt file and splitting it into columns in MATLAB
I am new to MATLAB.

My question has 2 parts:

Part 1: I am trying to import .out / .txt file into matlab. I want to eliminate the top text and want to have only the UPPER COLUMN values "Eigenvalues computed with ARPACK in double precision". and then it should treat it in a column structure.

Part 2: then I wanted to find the position of Mode Counter 23, it should return 1, for 7 it should return 2, for 56 it should return 3, and for 26 it should return 4....

enter image description here

Currently I am copying only the UPPER COLUMN and then pasting it in Excel. But this method seems to be good for few values and hectic for various values


问:
How can I get the value from the heading variable in initState()?
I want to take value heading from void initState() to store them in a local database. But I failed. Do you have any idea how to handle this. I am new to dart and tried for days to solve that problem but can't do it.</p>
```<code>class _CompassViewState extends State<CompassView> {

double heading = 0;

@override
void initState() {
FlutterCompass.events?.listen((event) {
if (mounted){
setState(() {
heading = event.heading!;
// bruecke().Kompass = heading;
if (heading < 0) {
[
heading = 360 + heading,
];
}
}
);}
}
);
super.initState();
}
</code>```

Body:
I want to take value heading from void initState() to store them in a local database. But I failed. Do you have any idea how to handle this. I am new to dart and tried for days to solve that problem but can't do it.

class _CompassViewState extends State<CompassView> {

double heading = 0;

@override
void initState() {
FlutterCompass.events?.listen((event) {
if (mounted){
setState(() {
heading = event.heading!;
// bruecke().Kompass = heading;
if (heading < 0) {
[
heading = 360 + heading,
];
}
}
);}
}
);
super.initState();
}


问:
Angular component not showing template
I downloaded angular form https://angular.io/quick-start and then added a file to the app folder "tutoriel.component.ts" and wrote the following code

```<code>import { Component } from "@angular/core";
@Component({
    selector: 'tutoriel',
    template: '<h2>Tutoriel</h2>'
})
export class TutorielComp{

}
</code>```

and then changed this in the app.module

```<code>@NgModule({
  declarations: [
    AppComponent,
    TutorielComp
  ],
</code>```

and the class got imported
import { TutorielComp } from './tutoriel.component';
The problem is when I deleted all the code in the app.component.html and wrote

```<code><tutoriel></tutoriel>
</code>```

It did not show.

Title: Angular component not showing template

Body:
I downloaded angular form https://angular.io/quick-start and then added a file to the app folder "tutoriel.component.ts" and wrote the following code

import { Component } from "@angular/core";
@Component({
    selector: 'tutoriel',
    template: '
Tutoriel
'
})
export class TutorielComp{

}

and then changed this in the app.module

@NgModule({
  declarations: [
    AppComponent,
    TutorielComp
  ],

and the class got imported
import { TutorielComp } from './tutoriel.component';
The problem is when I deleted all the code in the app.component.html and wrote

<tutoriel></tutoriel>

It did not show.


问:
Created an android virtual device using command line tools but unable to run it
I have created android virtual device using the command lines tools. I have used below command to create the avd.

```<code>avdmanager create avd -n TestDevice -k "system-images;android-33;google_apis;x86_64" -d pixel_6
</code>```

when trying to run this avd using emulator getting an error. Here is the command used to run the avd and the error I'm getting.

```<code>D:\android_sdk\emulator>emulator @TestDevice
INFO    | Android emulator version 31.3.14.0 (build_id 9322596) (CL:N/A)
emulator: INFO: Found systemPath D:\android_sdk\system-images\android-33\google_apis\x86_64\
INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
INFO    | IPv4 server found: 168.63.129.16
WARNING | Failed to process .ini file C:\Users\AzureLocalAdmin\.android\avd\TestDevice.avd\quickbootChoice.ini for reading.
</code>```

Please help me to run the emulator.

Body:
I have created android virtual device using the command lines tools. I have used below command to create the avd.

avdmanager create avd -n TestDevice -k "system-images;android-33;google_apis;x86_64" -d pixel_6

when trying to run this avd using emulator getting an error. Here is the command used to run the avd and the error I'm getting.

D:\android_sdk\emulator>emulator @TestDevice
INFO    | Android emulator version 31.3.14.0 (build_id 9322596) (CL:N/A)
emulator: INFO: Found systemPath D:\android_sdk\system-images\android-33\google_apis\x86_64\
INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
INFO    | IPv4 server found: 168.63.129.16
WARNING | Failed to process .ini file C:\Users\AzureLocalAdmin\.android\avd\TestDevice.avd\quickbootChoice.ini for reading.

Please help me to run the emulator.


问:
How do I pick the time in an MUI DateTimePicker using @testing-library/react and @testing-library/user-event?
I'm trying to write a test involving the DateTimePicker using @testing-library/react/@testing-library/user-event.

This is how I'm opening the picker and picking a date:

it('test picker', () => {
    jest.useFakeTimers().setSystemTime(new Date('2022-12-15T14:03:23Z'));
    render((
        <LocalizationProvider dateAdapter={AdapterDateFns as any}>
            <MyComponentContainingADateTimePicker />
        </LocalizationProvider>
    ));

    // Open the picker
    userEvent.click(screen.getByRole('button', {name: 'Choose date'}));
    // Pick a day in the current month
    userEvent.click(screen.getByRole('gridcell', {name: '16'}));
    // Pick hours
    userEvent.selectOptions(
        screen.getByRole('listbox'),
        screen.getByRole('option', {name: '20 hours'}),
        undefined,
        {skipPointerEventsCheck: true},
    );
    // Pick minutes
    userEvent.selectOptions(
        screen.getByRole('listbox'),
        screen.getByRole('option', {name: '00 minutes'}),
        undefined,
        {skipPointerEventsCheck: true},
    );
});
```

Problem 1: I have to use skipPointerEventsCheck: true because the listbox and options aren't clickable.

Problem 2: The picker doesn't advance to the minutes when I pick the hours (probably because of problem 1)

Body:
I'm trying to write a test involving the DateTimePicker using @testing-library/react/@testing-library/user-event.

This is how I'm opening the picker and picking a date:

it('test picker', () => {
    jest.useFakeTimers().setSystemTime(new Date('2022-12-15T14:03:23Z'));
    render((
        <LocalizationProvider dateAdapter={AdapterDateFns as any}>
            <MyComponentContainingADateTimePicker />
        </LocalizationProvider>
    ));

    // Open the picker
    userEvent.click(screen.getByRole('button', {name: 'Choose date'}));
    // Pick a day in the current month
    userEvent.click(screen.getByRole('gridcell', {name: '16'}));
    // Pick hours
    userEvent.selectOptions(
        screen.getByRole('listbox'),
        screen.getByRole('option', {name: '20 hours'}),
        undefined,
        {skipPointerEventsCheck: true},
    );
    // Pick minutes
    userEvent.selectOptions(
        screen.getByRole('listbox'),
        screen.getByRole('option', {name: '00 minutes'}),
        undefined,
        {skipPointerEventsCheck: true},
    );
});

Problem 1: I have to use skipPointerEventsCheck: true because the listbox and options aren't clickable.

Problem 2: The picker doesn't advance to the minutes when I pick the hours (probably because of problem 1)


问:
Spring boot Jackson Deserializer for ZonedDateTime Not working
I have overridden configuration for objectMapper.

```<code>@Bean
  @Primary
  public ObjectMapper serializingObjectMapper() {
    return getObjectMapper();
  }

  public static ObjectMapper getObjectMapper() {
    ObjectMapper objectMapper = new ObjectMapper();
    JavaTimeModule javaTimeModule = new JavaTimeModule();
    DateTimeFormatter dateTimeFormatter = ofPattern("yyyy-MM-dd'T'HH:mm:ss");
    DateTimeFormatter dateFormatter = ofPattern("yyyy-MM-dd");

    javaTimeModule.addSerializer(LocalDateTime.class,
        new LocalDateTimeSerializer(dateTimeFormatter));
    javaTimeModule.addDeserializer(LocalDateTime.class,
        new LocalDateTimeDeserializer(dateTimeFormatter));

    javaTimeModule.addSerializer(LocalDate.class,
        new LocalDateSerializer(dateFormatter));
    javaTimeModule.addDeserializer(LocalDate.class,
        new LocalDateDeserializer(dateFormatter));

    javaTimeModule.addSerializer(ZonedDateTime.class, ZonedDateTimeSerializer.INSTANCE);
    javaTimeModule.addDeserializer(ZonedDateTime.class, InstantDeserializer.ZONED_DATE_TIME);

    objectMapper.registerModule(javaTimeModule);
    objectMapper.setSerializationInclusion(Include.NON_NULL);
    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    return objectMapper;
  }
</code>```

I have LocalDateTime and ZonedDateTime. LocalDateTime correctly coming. But ZonedDateTimeis not coming in ISO format

```<code>"zonedIdField": 1658829622.000000000,
"localDateTimeField": "2022-12-15T15:35:27",
</code>```

Am I missing something. ZonedDateTimeis coming as number

Body:
I have overridden configuration for objectMapper.

@Bean
  @Primary
  public ObjectMapper serializingObjectMapper() {
    return getObjectMapper();
  }

  public static ObjectMapper getObjectMapper() {
    ObjectMapper objectMapper = new ObjectMapper();
    JavaTimeModule javaTimeModule = new JavaTimeModule();
    DateTimeFormatter dateTimeFormatter = ofPattern("yyyy-MM-dd'T'HH:mm:ss");
    DateTimeFormatter dateFormatter = ofPattern("yyyy-MM-dd");

    javaTimeModule.addSerializer(LocalDateTime.class,
        new LocalDateTimeSerializer(dateTimeFormatter));
    javaTimeModule.addDeserializer(LocalDateTime.class,
        new LocalDateTimeDeserializer(dateTimeFormatter));

    javaTimeModule.addSerializer(LocalDate.class,
        new LocalDateSerializer(dateFormatter));
    javaTimeModule.addDeserializer(LocalDate.class,
        new LocalDateDeserializer(dateFormatter));

    javaTimeModule.addSerializer(ZonedDateTime.class, ZonedDateTimeSerializer.INSTANCE);
    javaTimeModule.addDeserializer(ZonedDateTime.class, InstantDeserializer.ZONED_DATE_TIME);

    objectMapper.registerModule(javaTimeModule);
    objectMapper.setSerializationInclusion(Include.NON_NULL);
    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    return objectMapper;
  }

I have LocalDateTime and ZonedDateTime. LocalDateTime correctly coming. But ZonedDateTimeis not coming in ISO format

"zonedIdField": 1658829622.000000000,
"localDateTimeField": "2022-12-15T15:35:27",

Am I missing something. ZonedDateTimeis coming as number


问:
Creating Issue Labels with Terraform using the Github Provider
I'm trying to automate my repository setup with terraform. First thing is creating issue labels for a bunch of repos using the Terraform Guthub provider.

It works when I explicitly state the repo and the labels:

```<code>terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "~> 5.0"
    }
  }
}

# Use env-var
provider "github" {}

data "github_repository" "trashbox" {
  full_name = "sebastian-sommerfeld-io/trashbox"
}

resource "github_issue_label" "bug" {
  repository  = data.github_repository.trashbox.id
  name        = "bug"
  description = "Something is not working"
  color       = "B60205"
}

resource "github_issue_label" "security" {
  repository  = data.github_repository.trashbox.id
  name        = "security"
  description = "CVEs, code scan violations, etc."
  color       = "cd3ad7"
}
</code>```

But this would mean that I would have to duplicate everything for another repo. Or at least that I need to update my terraform config manually when I add another repo. I'd prever to have all relevant repos auto-detected.

Auto-detecting works with this snippet ... this returns all repos I want to configure.

```<code>data "github_repositories" "repos" {
  query           = "user:sebastian-sommerfeld-io archived:false"
  include_repo_id = true
}
</code>```

But now I cannot create the labels. When I run terraform apply I always get this error:

```<code>Error: POST https://api.github.com/repos/sebastian-sommerfeld-io/sebastian-sommerfeld-io/website-sommerfeld-io/labels: 404 Not Found []

  with github_issue_label.bug["sebastian-sommerfeld-io/website-sommerfeld-io"],
  on issues.tf line 1, in resource "github_issue_label" "bug":
   1: resource "github_issue_label" "bug" {
</code>```

The odd thing is, that terraform plan does not hint at any error:

```<code># github_issue_label.bug["sebastian-sommerfeld-io/website-sommerfeld-io"] will be created
+ resource "github_issue_label" "bug" {
    + color       = "B60205"
    + description = "Something is not working"
    + etag        = (known after apply)
    + id          = (known after apply)
    + name        = "bug"
    + repository  = "sebastian-sommerfeld-io/website-sommerfeld-io"
    + url         = (known after apply)
  }
</code>```

My complete Terraform config which generates the outputs from terraform plan and terraform apply is this:

```<code>terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "~> 5.0"
    }
  }
}

# Use env-var
provider "github" {}

data "github_repositories" "repos" {
  query           = "user:sebastian-sommerfeld-io archived:false"
  include_repo_id = true
}

resource "github_issue_label" "bug" {
  for_each    = toset(data.github_repositories.repos.full_names)
  repository  = each.value
  name        = "bug"
  description = "Something is not working"
  color       = "B60205"
}
</code>```

The repositories are queried correctly. I confirmed this via:

```<code>output "affected_repos" {
  value       = data.github_repositories.repos.full_names
  description = "Github Repos"
}
</code>```

This lists all repos correctly:

```<code>affected_repos = tolist([
  "sebastian-sommerfeld-io/website-sommerfeld-io",
  "sebastian-sommerfeld-io/jarvis",
  "sebastian-sommerfeld-io/github-action-generate-docs",
  "sebastian-sommerfeld-io/configs",
  "sebastian-sommerfeld-io/website-tafelboy-de",
  "sebastian-sommerfeld-io/website-numero-uno-de",
  "sebastian-sommerfeld-io/website-masterblender-de",
  "sebastian-sommerfeld-io/monitoring",
  "sebastian-sommerfeld-io/github-action-update-antora-yml",
  "sebastian-sommerfeld-io/github-action-generate-readme",
  "sebastian-sommerfeld-io/docker-image-tf-graph-beautifier",
  "sebastian-sommerfeld-io/docker-image-jq",
  "sebastian-sommerfeld-io/docker-image-git",
  "sebastian-sommerfeld-io/docker-image-ftp-client",
  "sebastian-sommerfeld-io/docker-image-folderslint",
  "sebastian-sommerfeld-io/docker-image-adoc-antora",
  "sebastian-sommerfeld-io/trashbox",
  "sebastian-sommerfeld-io/provinzial",
])
</code>```

I guess I don't get the for_each stuff right. Can anyone help me? I want to query all my repos taht fit my criteria and add labels to them.

UPDATE: I just detected that with my static approach I pass id, not full_name. I updated my code to this (snippet from above):

```<code>resource "github_issue_label" "bug" {
  for_each    = data.github_repositories.repos.repo_ids
  repository  = each.value
  name        = "bug"
  description = "Something is not working"
  color       = "B60205"
}
</code>```

Now at least the error message is different:

```<code>│ Error: Invalid for_each argument
│
│   on issues.tf line 2, in resource "github_issue_label" "bug":
│    2:   for_each    = data.github_repositories.repos.repo_ids
│     ├────────────────
│     │ data.github_repositories.repos.repo_ids is list of number with 18 elements
│
│ The given "for_each" argument value is unsuitable: the "for_each" argument
│ must be a map, or set of strings, and you have provided a value of type
│ list of number.
</code>```

Body:
I'm trying to automate my repository setup with terraform. First thing is creating issue labels for a bunch of repos using the Terraform Guthub provider.

It works when I explicitly state the repo and the labels:

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "~> 5.0"
    }
  }
}

# Use env-var
provider "github" {}

data "github_repository" "trashbox" {
  full_name = "sebastian-sommerfeld-io/trashbox"
}

resource "github_issue_label" "bug" {
  repository  = data.github_repository.trashbox.id
  name        = "bug"
  description = "Something is not working"
  color       = "B60205"
}

resource "github_issue_label" "security" {
  repository  = data.github_repository.trashbox.id
  name        = "security"
  description = "CVEs, code scan violations, etc."
  color       = "cd3ad7"
}

But this would mean that I would have to duplicate everything for another repo. Or at least that I need to update my terraform config manually when I add another repo. I'd prever to have all relevant repos auto-detected.

Auto-detecting works with this snippet ... this returns all repos I want to configure.

data "github_repositories" "repos" {
  query           = "user:sebastian-sommerfeld-io archived:false"
  include_repo_id = true
}

But now I cannot create the labels. When I run terraform apply I always get this error:

Error: POST https://api.github.com/repos/sebastian-sommerfeld-io/sebastian-sommerfeld-io/website-sommerfeld-io/labels: 404 Not Found []

  with github_issue_label.bug["sebastian-sommerfeld-io/website-sommerfeld-io"],
  on issues.tf line 1, in resource "github_issue_label" "bug":
   1: resource "github_issue_label" "bug" {

The odd thing is, that terraform plan does not hint at any error:

# github_issue_label.bug["sebastian-sommerfeld-io/website-sommerfeld-io"] will be created
+ resource "github_issue_label" "bug" {
    + color       = "B60205"
    + description = "Something is not working"
    + etag        = (known after apply)
    + id          = (known after apply)
    + name        = "bug"
    + repository  = "sebastian-sommerfeld-io/website-sommerfeld-io"
    + url         = (known after apply)
  }

My complete Terraform config which generates the outputs from terraform plan and terraform apply is this:

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "~> 5.0"
    }
  }
}

# Use env-var
provider "github" {}

data "github_repositories" "repos" {
  query           = "user:sebastian-sommerfeld-io archived:false"
  include_repo_id = true
}

resource "github_issue_label" "bug" {
  for_each    = toset(data.github_repositories.repos.full_names)
  repository  = each.value
  name        = "bug"
  description = "Something is not working"
  color       = "B60205"
}

The repositories are queried correctly. I confirmed this via:

output "affected_repos" {
  value       = data.github_repositories.repos.full_names
  description = "Github Repos"
}

This lists all repos correctly:

affected_repos = tolist([
  "sebastian-sommerfeld-io/website-sommerfeld-io",
  "sebastian-sommerfeld-io/jarvis",
  "sebastian-sommerfeld-io/github-action-generate-docs",
  "sebastian-sommerfeld-io/configs",
  "sebastian-sommerfeld-io/website-tafelboy-de",
  "sebastian-sommerfeld-io/website-numero-uno-de",
  "sebastian-sommerfeld-io/website-masterblender-de",
  "sebastian-sommerfeld-io/monitoring",
  "sebastian-sommerfeld-io/github-action-update-antora-yml",
  "sebastian-sommerfeld-io/github-action-generate-readme",
  "sebastian-sommerfeld-io/docker-image-tf-graph-beautifier",
  "sebastian-sommerfeld-io/docker-image-jq",
  "sebastian-sommerfeld-io/docker-image-git",
  "sebastian-sommerfeld-io/docker-image-ftp-client",
  "sebastian-sommerfeld-io/docker-image-folderslint",
  "sebastian-sommerfeld-io/docker-image-adoc-antora",
  "sebastian-sommerfeld-io/trashbox",
  "sebastian-sommerfeld-io/provinzial",
])

I guess I don't get the for_each stuff right. Can anyone help me? I want to query all my repos taht fit my criteria and add labels to them.

UPDATE: I just detected that with my static approach I pass id, not full_name. I updated my code to this (snippet from above):

resource "github_issue_label" "bug" {
  for_each    = data.github_repositories.repos.repo_ids
  repository  = each.value
  name        = "bug"
  description = "Something is not working"
  color       = "B60205"
}

Now at least the error message is different:

│ Error: Invalid for_each argument
│
│   on issues.tf line 2, in resource "github_issue_label" "bug":
│    2:   for_each    = data.github_repositories.repos.repo_ids
│     ├────────────────
│     │ data.github_repositories.repos.repo_ids is list of number with 18 elements
│
│ The given "for_each" argument value is unsuitable: the "for_each" argument
│ must be a map, or set of strings, and you have provided a value of type
│ list of number.