问:
Run autofix to sort these imports! on eslint simple-import-sort/imports plugin in TypeScript
Eslint is autofixing and cleaning up my code so far. But now I added these two eslint plugins:

```<code>"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
</code>```

https://github.com/lydell/eslint-plugin-simple-import-sort

I used them in .eslintrc.json in the rules section:

```<code>"simple-import-sort/imports": [
  "error",
  {
    "groups": [
      [
        "^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)"
      ],
      ["^\\w"],
      ["^@"],
      ["^\\u0000"],
      ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
      ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"]
    ]
  }
],
"simple-import-sort/exports": [
  "error",
  {
    "groups": [
      [
        "^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)"
      ],
      ["^\\w"],
      ["^@"],
      ["^\\u0000"],
      ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
      ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"]
    ]
  }
],
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error"
</code>```

I also have:

```<code>"plugins": [
  "@typescript-eslint",
  "import",
  "simple-import-sort"
],
</code>```

Why is it not autofixing the imports on save though?

My .vscode/settings.json is like this, which allows fix on save:

```<code>{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true,
  "eslint.format.enable": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "eslint.validate": ["javascript", "typescript"],
  "eslint.nodePath": "./node_modules/eslint",
  "eslint.packageManager": "npm"
}
</code>```

Body:
Eslint is autofixing and cleaning up my code so far. But now I added these two eslint plugins:

"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",

https://github.com/lydell/eslint-plugin-simple-import-sort

I used them in .eslintrc.json in the rules section:

"simple-import-sort/imports": [
  "error",
  {
    "groups": [
      [
        "^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)"
      ],
      ["^\\w"],
      ["^@"],
      ["^\\u0000"],
      ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
      ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"]
    ]
  }
],
"simple-import-sort/exports": [
  "error",
  {
    "groups": [
      [
        "^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)"
      ],
      ["^\\w"],
      ["^@"],
      ["^\\u0000"],
      ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
      ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"]
    ]
  }
],
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error"

I also have:

"plugins": [
  "@typescript-eslint",
  "import",
  "simple-import-sort"
],

Why is it not autofixing the imports on save though?

My .vscode/settings.json is like this, which allows fix on save:

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true,
  "eslint.format.enable": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "eslint.validate": ["javascript", "typescript"],
  "eslint.nodePath": "./node_modules/eslint",
  "eslint.packageManager": "npm"
}


来源: stackexchange

问:
How to achieve multitenancy with postgraphile in NodeJS
I have separate databases for different customers in our project, I want to connect with a specific database on the bases of tenantID (which is already known to me). I have achieved this in Java (spring boot) after going through this documentation
text.
However, I am not finding any examples on how to do it in NodeJS.

The code I have written in Node JS isn't allowing me to connect to different database using tenantID (which is stored in a file).

```<code>const ConnectionFilterPlugin = require("postgraphile-plugin-connection-filter");
const PgAggregatesPlugin = require("@graphile/pg-aggregates").default;
const SubscriptionPlugin = require("@graphile/subscriptions-lds").default;
const http = require("http");
const { postgraphile } = require("postgraphile");
const eurekaHelper = require('./eureka-helper');
http
  .createServer(postgraphile("postgres://"+process.env.DB_USER+":"+process.env.DB_PASSWORD+"@"+process.env.DB_HOST+"/"+process.env.DB_DATABASE,
  schemaName = "graphiql",
  {appendPlugins: [PgAggregatesPlugin, ConnectionFilterPlugin, SubscriptionPlugin], simpleCollections: "both",
  enhanceGraphiql: true, allowExplain: (req) => { return true; }, disableDefaultMutations: true, ignoreRBAC: false,
  dynamicJson: true, enhanceGraphiql: true, watchPg:true, graphiql: true, live: true, graphqlRoute: '/gateway/graphql' }))
  .listen(process.env.PORT);

eurekaHelper.registerWithEureka('graphql-service', process.env.PORT);

</code>```

How can I modify the above code to make the connection multitenant ?

ContentLicense: CC BY-SA 4.0

Body:
I have separate databases for different customers in our project, I want to connect with a specific database on the bases of tenantID (which is already known to me). I have achieved this in Java (spring boot) after going through this documentation
text.
However, I am not finding any examples on how to do it in NodeJS.

The code I have written in Node JS isn't allowing me to connect to different database using tenantID (which is stored in a file).

const ConnectionFilterPlugin = require("postgraphile-plugin-connection-filter");
const PgAggregatesPlugin = require("@graphile/pg-aggregates").default;
const SubscriptionPlugin = require("@graphile/subscriptions-lds").default;
const http = require("http");
const { postgraphile } = require("postgraphile");
const eurekaHelper = require('./eureka-helper');
http
  .createServer(postgraphile("postgres://"+process.env.DB_USER+":"+process.env.DB_PASSWORD+"@"+process.env.DB_HOST+"/"+process.env.DB_DATABASE,
  schemaName = "graphiql",
  {appendPlugins: [PgAggregatesPlugin, ConnectionFilterPlugin, SubscriptionPlugin], simpleCollections: "both",
  enhanceGraphiql: true, allowExplain: (req) => { return true; }, disableDefaultMutations: true, ignoreRBAC: false,
  dynamicJson: true, enhanceGraphiql: true, watchPg:true, graphiql: true, live: true, graphqlRoute: '/gateway/graphql' }))
  .listen(process.env.PORT);

eurekaHelper.registerWithEureka('graphql-service', process.env.PORT);

How can I modify the above code to make the connection multitenant ?


问:
How to conduct an ETH transfer from web3swift?
How do I send GoerliETH from one wallet to considering I have my Wallet Address, Private Key, Infura Goerli API Key and the recipient Wallet Address.

I have tried to get balanceOf for the wallet so far, and that works with the following code I found elsewhere :

```<code>import web3swift
import BigInt

 struct Wallet {
            let address: String
            let data: Data
            let name: String
            let isHD: Bool
        }

        struct HDKey {
            let name: String?
            let address: String
        }
        let password = "SOME_PASSWORD"
</code>```
```<code>        let key = "MY_PRIVATE_KEY" // Some private key
        let formattedKey = key.trimmingCharacters(in: .whitespacesAndNewlines)
        let dataKey = Data.fromHex(formattedKey)!
        let keystore = try! EthereumKeystoreV3(privateKey: dataKey, password: password)!
        let name = "MY_WALLET_NAME"
        let keyData = try! JSONEncoder().encode(keystore.keystoreParams)
        let address = keystore.addresses!.first!.address
        let wallet = Wallet(address: address, data: keyData, name: name, isHD: false)
        let data = wallet.data
        let keystoreManager: KeystoreManager
        if wallet.isHD {
            let keystore = BIP32Keystore(data)!
            keystoreManager = KeystoreManager([keystore])
        } else {
            let keystore = EthereumKeystoreV3(data)!
            keystoreManager = KeystoreManager([keystore])
        }

        let endpoint = "https://goerli.infura.io/v3/MY_API"
        let web3 = web3(provider: Web3HttpProvider(URL(string: endpoint)!)!)

</code>```
```<code>    web3.addKeystoreManager(keystoreManager)
    let coldWalletAddress = EthereumAddress("0xMY_WALLET_ADDRESS")!

    let walletAddress = EthereumAddress(wallet.address)! //

</code>```
```<code>        web3.transactionOptions.from = walletAddress
        web3.transactionOptions.chainID = 5
</code>```
```<code>        let balanceResult = try! web3.eth.getBalance(address: walletAddress)
        let balanceString = Web3.Utils.formatToEthereumUnits(balanceResult, toUnits: .eth, decimals: 3)!
</code>```

I now wish to figure out how I can transfer some of this ETH into another wallet further after this code. I understand this process might require me to create a transaction, sign it with my key and then broadcast this transaction... I just don't know how to. Hoping to get a clear example as an answer!

Body:
How do I send GoerliETH from one wallet to considering I have my Wallet Address, Private Key, Infura Goerli API Key and the recipient Wallet Address.

I have tried to get balanceOf for the wallet so far, and that works with the following code I found elsewhere :

import web3swift
import BigInt

 struct Wallet {
            let address: String
            let data: Data
            let name: String
            let isHD: Bool
        }

        struct HDKey {
            let name: String?
            let address: String
        }
        let password = "SOME_PASSWORD"

        let key = "MY_PRIVATE_KEY" // Some private key
        let formattedKey = key.trimmingCharacters(in: .whitespacesAndNewlines)
        let dataKey = Data.fromHex(formattedKey)!
        let keystore = try! EthereumKeystoreV3(privateKey: dataKey, password: password)!
        let name = "MY_WALLET_NAME"
        let keyData = try! JSONEncoder().encode(keystore.keystoreParams)
        let address = keystore.addresses!.first!.address
        let wallet = Wallet(address: address, data: keyData, name: name, isHD: false)
        let data = wallet.data
        let keystoreManager: KeystoreManager
        if wallet.isHD {
            let keystore = BIP32Keystore(data)!
            keystoreManager = KeystoreManager([keystore])
        } else {
            let keystore = EthereumKeystoreV3(data)!
            keystoreManager = KeystoreManager([keystore])
        }

        let endpoint = "https://goerli.infura.io/v3/MY_API"
        let web3 = web3(provider: Web3HttpProvider(URL(string: endpoint)!)!)

    web3.addKeystoreManager(keystoreManager)
    let coldWalletAddress = EthereumAddress("0xMY_WALLET_ADDRESS")!

    let walletAddress = EthereumAddress(wallet.address)! //

        web3.transactionOptions.from = walletAddress
        web3.transactionOptions.chainID = 5

        let balanceResult = try! web3.eth.getBalance(address: walletAddress)
        let balanceString = Web3.Utils.formatToEthereumUnits(balanceResult, toUnits: .eth, decimals: 3)!

I now wish to figure out how I can transfer some of this ETH into another wallet further after this code. I understand this process might require me to create a transaction, sign it with my key and then broadcast this transaction... I just don't know how to. Hoping to get a clear example as an answer!


问:
Report ViewerTasks - "Design a new report" not showing
I installed the necessary package (nuggets) - Microsoft RDLC Report Designer 2012 - as it was on the tutorial on youtube but seems like its not working on my machine


问:
Spotify API - Audio Player
I am relatively new to Javascript, I am practicing with a program that is able to pull data from Spotify API starting with Genre, then Playlists by Genre, Tracks, Track details, and an audio tag player to play a preview of the track.
I am able to do the Genre, Tracks, Track Details, but can't figure out the audio tag being linked to the track.  The two issues, I have:

How to generate the audio tag based on user selection, and then reset it once a new selection is made

How to Get the Preview for the track based on user selection (for now I have the src for the audio tag as a random track.

```<code>const APIController = (function() {

    const clientId = 'XX';
    const clientSecret = 'XX';

    //Fetch data from spotify api; private methods
    const _getToken = async () => {

        const result = await fetch('https://accounts.spotify.com/api/token', {
            method: 'POST',
            headers: {
                'Content-Type' : 'application/x-www-form-urlencoded',
                'Authorization' : 'Basic ' + btoa( clientId + ':' + clientSecret)
            },
            body: 'grant_type=client_credentials'
        });

        const spot = await result.json();
        return spot.access_token;
    }

    const _getGenres = async (token) => {

        const limit = 10;

        const result = await fetch(`https://api.spotify.com/v1/browse/categories?country=CA&limit=${limit}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot.categories.items;
    }

    const _getPlaylistByGenre = async (token, genreId) => {

        const limit = 10;

        const result = await fetch(`https://api.spotify.com/v1/browse/categories/${genreId}/playlists?limit=${limit}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot.playlists.items;
    }

    const _getTracks = async (token, tracklist) => {

        const limit = 30;

        const result = await fetch(`${tracklist}?limit=${limit}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot.items;
    }

    const _getTrack = async (token, trackdetail) => {

        const result = await fetch(`${trackdetail}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot;
    }

    const _getPreview = async (token, trackpreview) => {

        const result = await fetch(`${trackpreview}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot.preview;
    }

    return {
        getToken() {
            return _getToken();
        },
        getGenres(token) {
            return _getGenres(token);
        },
        getPlaylistByGenre(token, genreId) {
            return _getPlaylistByGenre(token, genreId);
        },
        getTracks(token, tracklist) {
            return _getTracks(token, tracklist);
        },
        getTrack(token, trackdetail) {
            return _getTrack(token, trackdetail);
        },
        getPreview(token, trackpreview) {
            return _getPreview(token, trackpreview);
        }
    }
})();

// UI Module
const UIController = (function() {

    //object to hold references to html selectors
    const DOMElements = {
        selectGenre: '#select_genre',
        selectPlaylist: '#select_playlist',
        buttonSubmit: '#btn_submit',
        divSongDetail: '#song-detail',
        hfToken: '#hidden_token',
        divSonglist: '.song-list',
        preview:'.songpreview'
    }

    //public methods
    return {

        //method to get input fields
        inputField() {
            return {
                genre: document.querySelector(DOMElements.selectGenre),
                playlist: document.querySelector(DOMElements.selectPlaylist),
                tracks: document.querySelector(DOMElements.divSonglist),
                submit: document.querySelector(DOMElements.buttonSubmit),
                songDetail: document.querySelector(DOMElements.divSongDetail),
                songPreview: document.querySelector(DOMElements.preview)
            }
        },

        // need methods to create select list option
        createGenre(text, value) {
            const html = `<option value="${value}">${text}</option>`;
            document.querySelector(DOMElements.selectGenre).insertAdjacentHTML('beforeend', html);
        },

        createPlaylist(text, value) {
            const html = `<option value="${value}">${text}</option>`;
            document.querySelector(DOMElements.selectPlaylist).insertAdjacentHTML('beforeend', html);
        },

        // need method to create a track list group item
        createTrack(id, name) {
            const html = `<a href="#" class="list-group-item list-group-item-action list-group-item-light" id="${id}"onclick="player()">${name} </a>`;
            document.querySelector(DOMElements.divSonglist).insertAdjacentHTML('beforeend', html);
        },

        // need method to create the song detail
        createTrackDetail(img, title, artist) {

            const detailDiv = document.querySelector(DOMElements.divSongDetail);
            // any time user clicks a new song, we need to clear out the song detail div
            detailDiv.innerHTML = '';

            const html =
            `
            <div class="songimg">
                <img src="${img}" alt=""width="100px" height="100px">
            </div>
            <div class="songname"><span>
                <label for="Genre" style="font-size:20px; color:black" class="form-label">${title}</label>
                </span>
            </div>
            <div class="artistname"><span>
                <label for="artist" style="color:blue" class="form-label">${rtist}</label>
            </span></div>
            `;

            detailDiv.insertAdjacentHTML('beforeend', html)

        },

        createPreview() {
            const html = `<audio class="preview" id="newplayer" controls onplay="playtrack()" onpause="pausetrack()" type="audio/mpeg" src="https://p.scdn.co/mp3-preview/ad57003c15e607c0d74c8a25ed7581c770b28a9a?cid=774b29d4f13844c495f206cafdad9c86" preload="auto"></audio>`;
            document.querySelector(DOMElements.songPreview).insertAdjacentHTML('beforeend', html);
        },

        //method to reset fields
        resetPreview() {
            this.inputField().songPreview.innerHTML = '';

        },

        resetTrackDetail() {
            this.inputField().songDetail.innerHTML = '';

        },

        resetTracks() {
            this.inputField().tracks.innerHTML = '';
            this.resetTrackDetail();
            const spotpreview=document.getElementById("newplayer").classList;
            spotpreview.remove("showme");
            document.getElementsByTagName("body")[0].style="background-image:url('hands.jpeg');";
            document.getElementsByTagName("body")[0].class="backgrd3";

        },

        resetPlaylist() {
            this.inputField().playlist.innerHTML = '';
            this.resetTracks();

        },

        storeToken(value) {
            document.querySelector(DOMElements.hfToken).value = value;
        },

        getStoredToken() {
            return {
                token: document.querySelector(DOMElements.hfToken).value
            }
        }
    }

})();

const APPController = (function(UICtrl, APICtrl) {

    // get input field object ref
    const DOMInputs = UICtrl.inputField();

    // get genres on page load
    const loadGenres = async () => {
        //get the token
        const token = await APICtrl.getToken();
        //store the token onto the page
        UICtrl.storeToken(token);
        //get the genres
        const genres = await APICtrl.getGenres(token);
        //populate our genres select element
        genres.forEach(element => UICtrl.createGenre(element.name, element.id));
    }

    // create genre change event listener
    DOMInputs.genre.addEventListener('change', async () => {
        //reset the playlist
        UICtrl.resetPlaylist();
        //get the token that's stored on the page
        const token = UICtrl.getStoredToken().token;
        // get the genre select field
        const genreSelect = UICtrl.inputField().genre;
        // get the genre id associated with the selected genre
        const genreId = genreSelect.options[genreSelect.selectedIndex].value;
        // ge the playlist based on a genre
        const playlist = await APICtrl.getPlaylistByGenre(token, genreId);
        // create a playlist list item for every playlist returned
        playlist.forEach(p => UICtrl.createPlaylist(p.name, p.tracks.href));
    });

    // create submit button click event listener
    DOMInputs.submit.addEventListener('click', async (e) => {
        // prevent page reset
        e.preventDefault();
        // clear tracks
        UICtrl.resetTracks();
        //get the token
        const token = UICtrl.getStoredToken().token;
        // get the playlist field
        const playlistSelect = UICtrl.inputField().playlist;
        // get track endpoint based on the selected playlist
        const tracksEndPoint = playlistSelect.options[playlistSelect.selectedIndex].value;
        // get the list of tracks
        const tracks = await APICtrl.getTracks(token, tracksEndPoint);
        // create a track list item
        tracks.forEach(el => UICtrl.createTrack(el.track.href, el.track.name))

    });

    // create song selection click event listener
    DOMInputs.tracks.addEventListener('click', async (e) => {
        // prevent page reset
        e.preventDefault();
        UICtrl.resetTrackDetail();
        // get the token
        const token = UICtrl.getStoredToken().token;
        // get the track endpoint
        const trackEndpoint = e.target.id;
        //get the track object
        const track = await APICtrl.getTrack(token, trackEndpoint);
        // load the track details
        UICtrl.createTrackDetail(track.album.images[2].url, track.name, track.artists[0].name);
    });

        // create song preview selection click event listener
        DOMInputs.songPreview.addEventListener('click', async (e) => {
            // prevent page reset
            e.preventDefault();
            UICtrl.resetPreview();
            // get the token
            const token = UICtrl.getStoredToken().token;
            // get the playlist field
            const previewsong = UICtrl.inputField().songPreview;
            const previewEndPoint = previewsong.options[previewsong.selectedIndex].value;
            // get the list of tracks
            const tracks = await APICtrl.getTracks(token, previewEndPoint);
            // create a track list item
            tracks.forEach(el => UICtrl.createTrack(el.track.href, el.track.name))

        });

    return {
        init() {
            console.log('App is starting');
            loadGenres();
        }
    }

})(UIController, APIController);

// will need to call a method to load the genres on page load
APPController.init();
</code>```

Title: Spotify API - Audio Player

Body:
I am relatively new to Javascript, I am practicing with a program that is able to pull data from Spotify API starting with Genre, then Playlists by Genre, Tracks, Track details, and an audio tag player to play a preview of the track.
I am able to do the Genre, Tracks, Track Details, but can't figure out the audio tag being linked to the track.  The two issues, I have:

How to generate the audio tag based on user selection, and then reset it once a new selection is made

How to Get the Preview for the track based on user selection (for now I have the src for the audio tag as a random track.

const APIController = (function() {

    const clientId = 'XX';
    const clientSecret = 'XX';

    //Fetch data from spotify api; private methods
    const _getToken = async () => {

        const result = await fetch('https://accounts.spotify.com/api/token', {
            method: 'POST',
            headers: {
                'Content-Type' : 'application/x-www-form-urlencoded',
                'Authorization' : 'Basic ' + btoa( clientId + ':' + clientSecret)
            },
            body: 'grant_type=client_credentials'
        });

        const spot = await result.json();
        return spot.access_token;
    }

    const _getGenres = async (token) => {

        const limit = 10;

        const result = await fetch(`https://api.spotify.com/v1/browse/categories?country=CA&limit=${limit}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot.categories.items;
    }

    const _getPlaylistByGenre = async (token, genreId) => {

        const limit = 10;

        const result = await fetch(`https://api.spotify.com/v1/browse/categories/${genreId}/playlists?limit=${limit}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot.playlists.items;
    }

    const _getTracks = async (token, tracklist) => {

        const limit = 30;

        const result = await fetch(`${tracklist}?limit=${limit}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot.items;
    }

    const _getTrack = async (token, trackdetail) => {

        const result = await fetch(`${trackdetail}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot;
    }

    const _getPreview = async (token, trackpreview) => {

        const result = await fetch(`${trackpreview}`, {
            method: 'GET',
            headers: { 'Authorization' : 'Bearer ' + token}
        });

        const spot = await result.json();
        return spot.preview;
    }

    return {
        getToken() {
            return _getToken();
        },
        getGenres(token) {
            return _getGenres(token);
        },
        getPlaylistByGenre(token, genreId) {
            return _getPlaylistByGenre(token, genreId);
        },
        getTracks(token, tracklist) {
            return _getTracks(token, tracklist);
        },
        getTrack(token, trackdetail) {
            return _getTrack(token, trackdetail);
        },
        getPreview(token, trackpreview) {
            return _getPreview(token, trackpreview);
        }
    }
})();

// UI Module
const UIController = (function() {

    //object to hold references to html selectors
    const DOMElements = {
        selectGenre: '#select_genre',
        selectPlaylist: '#select_playlist',
        buttonSubmit: '#btn_submit',
        divSongDetail: '#song-detail',
        hfToken: '#hidden_token',
        divSonglist: '.song-list',
        preview:'.songpreview'
    }

    //public methods
    return {

        //method to get input fields
        inputField() {
            return {
                genre: document.querySelector(DOMElements.selectGenre),
                playlist: document.querySelector(DOMElements.selectPlaylist),
                tracks: document.querySelector(DOMElements.divSonglist),
                submit: document.querySelector(DOMElements.buttonSubmit),
                songDetail: document.querySelector(DOMElements.divSongDetail),
                songPreview: document.querySelector(DOMElements.preview)
            }
        },

        // need methods to create select list option
        createGenre(text, value) {
            const html = `<option value="${value}">${text}</option>`;
            document.querySelector(DOMElements.selectGenre).insertAdjacentHTML('beforeend', html);
        },

        createPlaylist(text, value) {
            const html = `<option value="${value}">${text}</option>`;
            document.querySelector(DOMElements.selectPlaylist).insertAdjacentHTML('beforeend', html);
        },

        // need method to create a track list group item
        createTrack(id, name) {
            const html = `<a href="#" class="list-group-item list-group-item-action list-group-item-light" id="${id}"onclick="player()">${name} </a>`;
            document.querySelector(DOMElements.divSonglist).insertAdjacentHTML('beforeend', html);
        },

        // need method to create the song detail
        createTrackDetail(img, title, artist) {

            const detailDiv = document.querySelector(DOMElements.divSongDetail);
            // any time user clicks a new song, we need to clear out the song detail div
            detailDiv.innerHTML = '';

            const html =
            `

                ${title}

                ${rtist}

            `;

            detailDiv.insertAdjacentHTML('beforeend', html)

        },

        createPreview() {
            const html = `<audio class="preview" id="newplayer" controls onplay="playtrack()" onpause="pausetrack()" type="audio/mpeg" src="https://p.scdn.co/mp3-preview/ad57003c15e607c0d74c8a25ed7581c770b28a9a?cid=774b29d4f13844c495f206cafdad9c86" preload="auto"></audio>`;
            document.querySelector(DOMElements.songPreview).insertAdjacentHTML('beforeend', html);
        },

        //method to reset fields
        resetPreview() {
            this.inputField().songPreview.innerHTML = '';

        },

        resetTrackDetail() {
            this.inputField().songDetail.innerHTML = '';

        },

        resetTracks() {
            this.inputField().tracks.innerHTML = '';
            this.resetTrackDetail();
            const spotpreview=document.getElementById("newplayer").classList;
            spotpreview.remove("showme");
            document.getElementsByTagName("body")[0].style="background-image:url('hands.jpeg');";
            document.getElementsByTagName("body")[0].class="backgrd3";

        },

        resetPlaylist() {
            this.inputField().playlist.innerHTML = '';
            this.resetTracks();

        },

        storeToken(value) {
            document.querySelector(DOMElements.hfToken).value = value;
        },

        getStoredToken() {
            return {
                token: document.querySelector(DOMElements.hfToken).value
            }
        }
    }

})();

const APPController = (function(UICtrl, APICtrl) {

    // get input field object ref
    const DOMInputs = UICtrl.inputField();

    // get genres on page load
    const loadGenres = async () => {
        //get the token
        const token = await APICtrl.getToken();
        //store the token onto the page
        UICtrl.storeToken(token);
        //get the genres
        const genres = await APICtrl.getGenres(token);
        //populate our genres select element
        genres.forEach(element => UICtrl.createGenre(element.name, element.id));
    }

    // create genre change event listener
    DOMInputs.genre.addEventListener('change', async () => {
        //reset the playlist
        UICtrl.resetPlaylist();
        //get the token that's stored on the page
        const token = UICtrl.getStoredToken().token;
        // get the genre select field
        const genreSelect = UICtrl.inputField().genre;
        // get the genre id associated with the selected genre
        const genreId = genreSelect.options[genreSelect.selectedIndex].value;
        // ge the playlist based on a genre
        const playlist = await APICtrl.getPlaylistByGenre(token, genreId);
        // create a playlist list item for every playlist returned
        playlist.forEach(p => UICtrl.createPlaylist(p.name, p.tracks.href));
    });

    // create submit button click event listener
    DOMInputs.submit.addEventListener('click', async (e) => {
        // prevent page reset
        e.preventDefault();
        // clear tracks
        UICtrl.resetTracks();
        //get the token
        const token = UICtrl.getStoredToken().token;
        // get the playlist field
        const playlistSelect = UICtrl.inputField().playlist;
        // get track endpoint based on the selected playlist
        const tracksEndPoint = playlistSelect.options[playlistSelect.selectedIndex].value;
        // get the list of tracks
        const tracks = await APICtrl.getTracks(token, tracksEndPoint);
        // create a track list item
        tracks.forEach(el => UICtrl.createTrack(el.track.href, el.track.name))

    });

    // create song selection click event listener
    DOMInputs.tracks.addEventListener('click', async (e) => {
        // prevent page reset
        e.preventDefault();
        UICtrl.resetTrackDetail();
        // get the token
        const token = UICtrl.getStoredToken().token;
        // get the track endpoint
        const trackEndpoint = e.target.id;
        //get the track object
        const track = await APICtrl.getTrack(token, trackEndpoint);
        // load the track details
        UICtrl.createTrackDetail(track.album.images[2].url, track.name, track.artists[0].name);
    });

        // create song preview selection click event listener
        DOMInputs.songPreview.addEventListener('click', async (e) => {
            // prevent page reset
            e.preventDefault();
            UICtrl.resetPreview();
            // get the token
            const token = UICtrl.getStoredToken().token;
            // get the playlist field
            const previewsong = UICtrl.inputField().songPreview;
            const previewEndPoint = previewsong.options[previewsong.selectedIndex].value;
            // get the list of tracks
            const tracks = await APICtrl.getTracks(token, previewEndPoint);
            // create a track list item
            tracks.forEach(el => UICtrl.createTrack(el.track.href, el.track.name))

        });

    return {
        init() {
            console.log('App is starting');
            loadGenres();
        }
    }

})(UIController, APIController);

// will need to call a method to load the genres on page load
APPController.init();


问:
Stacking of models giving black image with 0 as peak and minimum value
When I was individually using models, results were pretty good. But while using the below code for stacking models, the result is a black file with 0 as peak value.

The file size of individual results is the same.

estimator_list = [
    ('svm_l',SVC(kernel = 'linear', random_state = 0)),
    ('dt',DecisionTreeClassifier(criterion = 'entropy', random_state = 0)),
    ('rf',RandomForestClassifier(n_estimators=80,n_jobs=-1))]

# Build stack model
stack_model = StackingClassifier(
    estimators=estimator_list, final_estimator=LogisticRegression())

# Train stacked model
stack_model.fit(data, label)
```

result of stacking

Body:
When I was individually using models, results were pretty good. But while using the below code for stacking models, the result is a black file with 0 as peak value.

The file size of individual results is the same.

estimator_list = [
    ('svm_l',SVC(kernel = 'linear', random_state = 0)),
    ('dt',DecisionTreeClassifier(criterion = 'entropy', random_state = 0)),
    ('rf',RandomForestClassifier(n_estimators=80,n_jobs=-1))]

# Build stack model
stack_model = StackingClassifier(
    estimators=estimator_list, final_estimator=LogisticRegression())

# Train stacked model
stack_model.fit(data, label)

result of stacking


问:
Nginx ingress does not able to get real IP with Cloudflare DNS (No proxy)
I am trying to get the Client IP (or Real IP).
I am using a third tier cloud provider with basic services and there is a LB in that.
My current nginx-ingress controller config is:

```<code>data:
  allow-snippet-annotations: "true"
  ssl-protocols: "TLSv1 TLSv1.1 TLSv1.2 TLSv1.3"
  allow-snippet-annotations: "true"

  real_ip_recursive: "on"
  real-ip-header: "X-Real-IP"
  use-proxy-protocol: "false"
  compute-full-forwarded-for: "true"
  use-forwarded-headers: "true"
</code>```

And yes, i alr turned on the below in the service.

```<code>externalTrafficPolicy: Local
</code>```

My ingress resource has this:

```<code> nginx.ingress.kubernetes.io/configuration-snippet: |
      more_set_headers "X-Forwarded-For $remote_addr";
</code>```

However,  I have tried on and off many options above and I could not retrieve the client IP when a pass in, Nginx ingress always gives me the Node private IPv4 as the x-forwaded-header and remote_add. Note that if I turned on the Proxied Cloudflare , it worked fine, if i turned the Proxied option off , it returns the private IPv4 of the k8s node, because I have other DNS management in other DNS tools, so using Cloudflare proxied is not always an option for me.

Body:
I am trying to get the Client IP (or Real IP).
I am using a third tier cloud provider with basic services and there is a LB in that.
My current nginx-ingress controller config is:

data:
  allow-snippet-annotations: "true"
  ssl-protocols: "TLSv1 TLSv1.1 TLSv1.2 TLSv1.3"
  allow-snippet-annotations: "true"

  real_ip_recursive: "on"
  real-ip-header: "X-Real-IP"
  use-proxy-protocol: "false"
  compute-full-forwarded-for: "true"
  use-forwarded-headers: "true"

And yes, i alr turned on the below in the service.

externalTrafficPolicy: Local

My ingress resource has this:

 nginx.ingress.kubernetes.io/configuration-snippet: |
      more_set_headers "X-Forwarded-For $remote_addr";

However,  I have tried on and off many options above and I could not retrieve the client IP when a pass in, Nginx ingress always gives me the Node private IPv4 as the x-forwaded-header and remote_add. Note that if I turned on the Proxied Cloudflare , it worked fine, if i turned the Proxied option off , it returns the private IPv4 of the k8s node, because I have other DNS management in other DNS tools, so using Cloudflare proxied is not always an option for me.


问:
mb_substr return wrong string length
I was using substr for my code to cut exactly 75 characters of my string but I've got some problems with UTF-8 strings that produce characters like "�" so I searched for a solution and found out I could use mb_string but when I use mb_string the string that it returns to me is not 75 characters anymore and its length get change in different strings...

```<code>$title = "hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé ";
if(strlen($title) > 75){
    $title = mb_substr($title , 0 , 72 , 'UTF-8');
    $title = $title."...";
}

echo strlen($title); // 93
</code>```

I think the function add extra data to string that makes its length longer, I dont know but I just want to get a 75 character string , I tried to use lower characters for mb_substr parameter but it doesn't work for every strings

Title: mb_substr return wrong string length

Body:
I was using substr for my code to cut exactly 75 characters of my string but I've got some problems with UTF-8 strings that produce characters like "�" so I searched for a solution and found out I could use mb_string but when I use mb_string the string that it returns to me is not 75 characters anymore and its length get change in different strings...

$title = "hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé hi mémé ";
if(strlen($title) > 75){
    $title = mb_substr($title , 0 , 72 , 'UTF-8');
    $title = $title."...";
}

echo strlen($title); // 93

I think the function add extra data to string that makes its length longer, I dont know but I just want to get a 75 character string , I tried to use lower characters for mb_substr parameter but it doesn't work for every strings


问:
How to use SSL certificate in groovy script with http builder
How I can use SSL (CA) certificate (.pem file) in a Groovy script while using http-builder for making API calls.
I am looking for something like the line below but sslContext is not available in http-builder:0.7.2

```<code>http.client.sslContext = sslContext
</code>```

I have tried the below code

```<code>def health() {
    HTTPBuilder http = new HTTPBuilder(baseURL)

    def sslContext = SSLContext.getInstance('TLS')
    sslContext.init(null, [certificate] as TrustManager[], null)
    **http.client.sslContext = sslContext**

    http.get(path: "/health") { req ->
        response.success = { resp, json ->
            println "Success! ${resp.status}"
        }
        response.failure = { resp, json ->
            println "Request failed with status ${resp.status}"
        }
    }
}
</code>```

Expectation:
HttpBuilder should take SSL certificate and make an API call (GET) to fetch response from the server.

Body:
How I can use SSL (CA) certificate (.pem file) in a Groovy script while using http-builder for making API calls.
I am looking for something like the line below but sslContext is not available in http-builder:0.7.2

http.client.sslContext = sslContext

I have tried the below code

def health() {
    HTTPBuilder http = new HTTPBuilder(baseURL)

    def sslContext = SSLContext.getInstance('TLS')
    sslContext.init(null, [certificate] as TrustManager[], null)
    **http.client.sslContext = sslContext**

    http.get(path: "/health") { req ->
        response.success = { resp, json ->
            println "Success! ${resp.status}"
        }
        response.failure = { resp, json ->
            println "Request failed with status ${resp.status}"
        }
    }
}

Expectation:
HttpBuilder should take SSL certificate and make an API call (GET) to fetch response from the server.


问:
Is it possible to use my QueryDesignView in my User Form or PopUp Form In Access
I want advanced user to have access to the query design view so they can create, run and export their own query in my form view. and i also want back to my Form from QueryDesignView when user click a button like "Back Button"

I found only DoCmd.OpenQuery with acDesignView ---> i don't want that i expect for looking as a queryDesignView in my User Form or Pop Up ---> Is it possible?


问:
any way to tell yarn to compile a package for darwin or linux?
I need something like yarn install foo -arch linux-arm

I need this because I am installing dependencies locally but copying them to a ubuntu container which means that I need to install the Darwin-arm them copy it inside the linux-arm.


问:
How to continue load video after Internet Connection in Exoplayer Android
I need resume load video in exoplayer android kotlin after network connection.</p>
```<code>           override fun onPlaybackStateChanged(playbackState: Int) {
                super.onPlaybackStateChanged(playbackState)
            }

            override fun onPlayerErrorChanged(error: PlaybackException?) {
                super.onPlayerErrorChanged(error)

            }
</code>```

Body:
I need resume load video in exoplayer android kotlin after network connection.

           override fun onPlaybackStateChanged(playbackState: Int) {
                super.onPlaybackStateChanged(playbackState)
            }

            override fun onPlayerErrorChanged(error: PlaybackException?) {
                super.onPlayerErrorChanged(error)

            }


问:
Python cant recognize my installed modules
Code:

```<code>import pygame
</code>```

Error:

```<code>ModuleNotFoundError: No module named 'pygame'

PS C:\Users\tofu\OneDrive\Desktop\PyGame\Zeldaclone> pip install pygame
Requirement already satisfied: pygame in c:\users\tophe\appdata\roaming\python\python39\site-packages (2.1.2)
PS C:\Users\tofu\OneDrive\Desktop\PyGame\Zeldaclone>
</code>```

I tried updating pip and it updated but it gave me this admin permission suggestion, maybe thats something to do with it but I dont have the exact line. I did this on VS Code, ive also noticed that it cant recognize other modules that worked in the past, pls help :(

Body:
Code:

import pygame

Error:

ModuleNotFoundError: No module named 'pygame'

PS C:\Users\tofu\OneDrive\Desktop\PyGame\Zeldaclone> pip install pygame
Requirement already satisfied: pygame in c:\users\tophe\appdata\roaming\python\python39\site-packages (2.1.2)
PS C:\Users\tofu\OneDrive\Desktop\PyGame\Zeldaclone>

I tried updating pip and it updated but it gave me this admin permission suggestion, maybe thats something to do with it but I dont have the exact line. I did this on VS Code, ive also noticed that it cant recognize other modules that worked in the past, pls help :(


问:
My scrollbar doesn't work - tkinter in python
Well, I'm adding many buttons to my Canvas called "itemsFrame" in order to test the ScrollBar, but it doesn't work

Well, I haven't tried much because I don't know about the subject, I've investigated how to do it but it only comes out with small buttons without being able to resize them

```<code>from tkinter import Frame, Label, Button, Entry, messagebox, ttk, Scrollbar, Canvas

import base64
import json

class WatchNewsFrame(Frame):
    name = "WatchNewsFrame"

    def __init__(self, parent):
        super().__init__()
        self.Parent = parent
        self.initializecomponents()
        pass

    def set_news(self):
        data = json.load(open(self.file))["News"]
        cont = 1
        for key in range(10):
            Panel = Button(self.itemsFrame)
            Panel.config(bg="#656565", activebackground="#808080")
            Panel.place(relwidth=.95, relheight=0.245, rely=.028+key*0.25, relx=.5, anchor="n")
        pass

    def initializecomponents(self):
        Frame.__init__(self, self.Parent)

        self.itemsFrame = Canvas(self)
        self.ItemsScrooll = Scrollbar(self, orient="vertical")

        # this frame
        self.config(background=self.Parent["background"])
        self.place(relwidth=0.95, relheight=0.95, relx=0.5, rely=0.5, anchor="center")

        # ItemsScrooll
        self.ItemsScrooll.pack(side="right", fill="y")

        # itemsFrame
        self.itemsFrame.config(bg="#606060", highlightbackground="#FFFFFF", yscrollcommand=self.ItemsScrooll.set)
        self.itemsFrame.place(relheight=0.85, relwidth=0.9, relx=0.5, rely=0.5, anchor="center")
        self.itemsFrame.bind_all("<MouseWheel>", self.on_mouse_wheel)

        self.ItemsScrooll.config(command=self.itemsFrame.yview)

        # events
        self.set_news()
        pass
    pass

</code>```

Body:
Well, I'm adding many buttons to my Canvas called "itemsFrame" in order to test the ScrollBar, but it doesn't work

Well, I haven't tried much because I don't know about the subject, I've investigated how to do it but it only comes out with small buttons without being able to resize them

from tkinter import Frame, Label, Button, Entry, messagebox, ttk, Scrollbar, Canvas

import base64
import json

class WatchNewsFrame(Frame):
    name = "WatchNewsFrame"

    def __init__(self, parent):
        super().__init__()
        self.Parent = parent
        self.initializecomponents()
        pass

    def set_news(self):
        data = json.load(open(self.file))["News"]
        cont = 1
        for key in range(10):
            Panel = Button(self.itemsFrame)
            Panel.config(bg="#656565", activebackground="#808080")
            Panel.place(relwidth=.95, relheight=0.245, rely=.028+key*0.25, relx=.5, anchor="n")
        pass

    def initializecomponents(self):
        Frame.__init__(self, self.Parent)

        self.itemsFrame = Canvas(self)
        self.ItemsScrooll = Scrollbar(self, orient="vertical")

        # this frame
        self.config(background=self.Parent["background"])
        self.place(relwidth=0.95, relheight=0.95, relx=0.5, rely=0.5, anchor="center")

        # ItemsScrooll
        self.ItemsScrooll.pack(side="right", fill="y")

        # itemsFrame
        self.itemsFrame.config(bg="#606060", highlightbackground="#FFFFFF", yscrollcommand=self.ItemsScrooll.set)
        self.itemsFrame.place(relheight=0.85, relwidth=0.9, relx=0.5, rely=0.5, anchor="center")
        self.itemsFrame.bind_all("<MouseWheel>", self.on_mouse_wheel)

        self.ItemsScrooll.config(command=self.itemsFrame.yview)

        # events
        self.set_news()
        pass
    pass


问:
Why is there an infeasible or unbounded solution in the c-plex while incorporating the objective function?
Because I am unable to do it in a single program, the values of pevch [j] [k], pevdis [j] [k], pbat [j], and c [j] are actually input from the outputs of another optimization program. This program's decision variables are pbatch[j][k], pbatnew[j], and so on. </p>
```<code>int nb=14;
int  t=24;
int nv=400;
int l=14;
range  nbus=1..nb;
range tavail =1..t;
range  nport=1..nv;
//soc data
float soc[nport][tavail]=...;
//forcasted load data
float pl[nbus][tavail]=...;
//target load data
float pt[nbus][tavail]=...;
//generation
float pg[nbus][tavail]=...;
//price data
float c[tavail]=[3.5,3.5,2.5,2.5,2.5,2.5,2.5,2.5,3.5,3.5,5,5,5,5,5,5,5,5,3.5,5,5,5,3.5,3.5];
//decision variable charging power
dvar float+ pbat[tavail];
dvar float+ pbatnew[tavail];
dvar float+ pbatch[tavail][nport];

float G[nbus][nbus]=...;
float B[nbus][nbus]=...;
float deltacos[nbus][nbus][tavail];
float deltasin[nbus][nbus][tavail];
float v[tavail][nbus]=...;
float del[tavail][nbus]=...;
float p[nbus][tavail]=...;
float pevch[tavail][nport]=...;
float pevdis[tavail][nport]=...;
execute fill_deltacos
{for(var i in nbus)for (var l in nbus)for(var j in tavail)deltacos[i][l][j]=Math.cos(del[j][i]-del[j][l]);
}
execute fill_deltasin
{for(var i in nbus)for (var l in nbus)for(var j in tavail)deltacos[i][l][j]=Math.sin(del[j][i]-del[j][l]);
}

minimize 0.7*sum(i in nbus)(sum(j in tavail)sum(k in nport)((pt[i][j]*1000000-pl[i][j]*1000000)+sum(k in nport)(pevdis[j][k]-pevch[j][k]-pbatch[j][k])))- 0.15*(sum (j in tavail)(sum (k in nport)(c[j]*pevdis[j][k])))

+0.15* (sum (j in tavail)sum (k in nport)(c[j]*pevch[j][k]+3*pbatch[j][k]));

subject to

{
//constraint for discharging

forall(i in nbus,j in tavail,k in nport)
  {
 pbat[j]==sum (i in nbus) p[i][j]*1000000+  sum(i in nbus)(pl[i][j]-pg[i][j])*1000000+sum (k in nport)(-pevch[j][k]+pevdis[j][k]);

 ct1:if(c[j]==5&&soc[k][j]<0.7)
 {pbatch[j][k]==(0.7-soc[k][j])*100000;
  pbatnew[j]==pbat[j]-(sum (k in nport)pbatch[j][k]);}

}

}
</code>```

Body:
Because I am unable to do it in a single program, the values of pevch [j] [k], pevdis [j] [k], pbat [j], and c [j] are actually input from the outputs of another optimization program. This program's decision variables are pbatch[j][k], pbatnew[j], and so on.

int nb=14;
int  t=24;
int nv=400;
int l=14;
range  nbus=1..nb;
range tavail =1..t;
range  nport=1..nv;
//soc data
float soc[nport][tavail]=...;
//forcasted load data
float pl[nbus][tavail]=...;
//target load data
float pt[nbus][tavail]=...;
//generation
float pg[nbus][tavail]=...;
//price data
float c[tavail]=[3.5,3.5,2.5,2.5,2.5,2.5,2.5,2.5,3.5,3.5,5,5,5,5,5,5,5,5,3.5,5,5,5,3.5,3.5];
//decision variable charging power
dvar float+ pbat[tavail];
dvar float+ pbatnew[tavail];
dvar float+ pbatch[tavail][nport];

float G[nbus][nbus]=...;
float B[nbus][nbus]=...;
float deltacos[nbus][nbus][tavail];
float deltasin[nbus][nbus][tavail];
float v[tavail][nbus]=...;
float del[tavail][nbus]=...;
float p[nbus][tavail]=...;
float pevch[tavail][nport]=...;
float pevdis[tavail][nport]=...;
execute fill_deltacos
{for(var i in nbus)for (var l in nbus)for(var j in tavail)deltacos[i][l][j]=Math.cos(del[j][i]-del[j][l]);
}
execute fill_deltasin
{for(var i in nbus)for (var l in nbus)for(var j in tavail)deltacos[i][l][j]=Math.sin(del[j][i]-del[j][l]);
}

minimize 0.7*sum(i in nbus)(sum(j in tavail)sum(k in nport)((pt[i][j]*1000000-pl[i][j]*1000000)+sum(k in nport)(pevdis[j][k]-pevch[j][k]-pbatch[j][k])))- 0.15*(sum (j in tavail)(sum (k in nport)(c[j]*pevdis[j][k])))

+0.15* (sum (j in tavail)sum (k in nport)(c[j]*pevch[j][k]+3*pbatch[j][k]));

subject to

{
//constraint for discharging

forall(i in nbus,j in tavail,k in nport)
  {
 pbat[j]==sum (i in nbus) p[i][j]*1000000+  sum(i in nbus)(pl[i][j]-pg[i][j])*1000000+sum (k in nport)(-pevch[j][k]+pevdis[j][k]);

 ct1:if(c[j]==5&&soc[k][j]<0.7)
 {pbatch[j][k]==(0.7-soc[k][j])*100000;
  pbatnew[j]==pbat[j]-(sum (k in nport)pbatch[j][k]);}

}

}


问:
Is there a chance that emails are sent in parallel and thus `mail.outbox.clear()` doesn't really clear outbox in my django tests?
I have written django tests to check my outbox emails as shown below

```<code>class TestX(TestCase):
    def setUp(self):
        # Clear outbox.
        mail.outbox.clear()
        super().setUp()

    def tearDown(self):
        # Clear outbox.
        mail.outbox.clear()
        super().tearDown()
</code>```

however, performing assertions e.g
self.assertEqual(len(mail.outbox), 1)
fails with the len(mail.outbox) showing a large number as compared to the emails I've sent using send mail. I know there are other apps also sending emails so I'm wondering if the emails are being sent in parallel and thus my clear isn't effective or what might be the issue?

Body:
I have written django tests to check my outbox emails as shown below

class TestX(TestCase):
    def setUp(self):
        # Clear outbox.
        mail.outbox.clear()
        super().setUp()

    def tearDown(self):
        # Clear outbox.
        mail.outbox.clear()
        super().tearDown()

however, performing assertions e.g
self.assertEqual(len(mail.outbox), 1)
fails with the len(mail.outbox) showing a large number as compared to the emails I've sent using send mail. I know there are other apps also sending emails so I'm wondering if the emails are being sent in parallel and thus my clear isn't effective or what might be the issue?


问:
Python contour clabel created outside the plot
I am plotting 2D contourf, after which I added some contour for some levels.

```<code>CS = ax.contour(XX,YY,Z, levels, colors='k')
ax.clabel(CS, inline=True, fontsize=10)
</code>```

The above simple lines generate the figures below, where the labels are located outside the plot.

While I can fix the (x,y) values with manual, this will not work as generally as I want.

For example, I can try to fix (x) location, e.g. the center of the xlim, and find (y) values for the corresponding contours of each level. But as you can see in the shown figures, it is not general since the 0.100 contour does not have (x) location inside the plot, which is fixed to the center of xlim in this case.

I am pretty sure there is some way to put the labels inside the plot, but it is hard to find.

Any suggestions will be appreciated.

Body:
I am plotting 2D contourf, after which I added some contour for some levels.

CS = ax.contour(XX,YY,Z, levels, colors='k')
ax.clabel(CS, inline=True, fontsize=10)

The above simple lines generate the figures below, where the labels are located outside the plot.

While I can fix the (x,y) values with manual, this will not work as generally as I want.

For example, I can try to fix (x) location, e.g. the center of the xlim, and find (y) values for the corresponding contours of each level. But as you can see in the shown figures, it is not general since the 0.100 contour does not have (x) location inside the plot, which is fixed to the center of xlim in this case.

I am pretty sure there is some way to put the labels inside the plot, but it is hard to find.

Any suggestions will be appreciated.


问:
PySpark error An error occurred while calling count caused by null pointer
I'm getting An error occurred while calling o19972810.count while counting data that i get from JDBC:

```<code>sql_query = "SELECT.... FROM.... "
df = spark.read.format("jdbc").option("url", con_mysql_source) \
        .option("driver", "com.mysql.jdbc.Driver").option("dbtable", f"({sql_query})" sdtable") \
        .option("user", ...).option("password", ...).load()
df.createOrReplaceTempView("df_temp")

counts = df.count()

</code>```

Here is the full log:

```<code>aRise Py4JJavaError(\\\\npy4j.protocol.Py4JJavaError: An error occurred while calling o19972810.count. :
    org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:\\\\nExchange SinglePartition, ENSURE_REQUIREMENTS, [id=#38969584]
    - *(1) HashAggregate(keys=[], functions=[partial_count(1)], output=[count#49033654L])
       +- *(1) Scan JDBCRelation((SELECT updatedate,DATE_FORMAT(transaction_tgl, '%Y%m%d') as partdate, user, outlet transaction_tgl , id, status FROM Transactions WHERE updateDate \\u003e '2022-11-29 20:22:23' AND updateDate\\u003c='2022-11-29 20:27:28' AND transaction_tgl \\u003e '1970-01-01 00:00:00' ) sdtable) [numPartitions=1] [] PushedFilters: [], ReadSchema: struct\\u003c\\u003e\
    at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:56)
    at org.apache.spark.sql.execution.exchange.ShuffleExchangeExec.doExecute(ShuffleExchangeExec.scala:163)
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:180
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:218)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:215)
    at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:176)
    at org.apache.spark.sql.execution.InputAdapter.inputRDD(WholeStageCodegenExec.scala:525)
    at org.apache.spark.sql.execution.InputRDDCodegen.inputRDDs(WholeStageCodegenExec.scala:453)
    at org.apache.spark.sql.execution.InputRDDCodegen.inputRDDs$(WholeStageCodegenExec.scala:452)
    at org.apache.spark.sql.execution.InputAdapter.inputRDDs(WholeStageCodegenExec.scala:496)
    at org.apache.spark.sql.execution.aggregate.HashAggregateExec.inputRDDs(HashAggregateExec.scala:141)
    at org.apache.spark.sql.execution.WholeStageCodegenExec.doExecute(WholeStageCodegenExec.scala:746)
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:180)
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:218)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:215)
    at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:176)
    at org.apache.spark.sql.execution.SparkPlan.getByteArrayRdd(SparkPlan.scala:321)
    at org.apache.spark.sql.execution.SparkPlan.executeCollect(SparkPlan.scala:387)
    at org.apache.spark.sql.Dataset.$anonfun$count$1(Dataset.scala:3019)
    at org.apache.spark.sql.Dataset.$anonfun$count$1$adapted(Dataset.scala:3018)
    at org.apache.spark.sql.Dataset.$anonfun$withAction$1(Dataset.scala:3700)
    at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$5(SQLExecution.scala:103)
    at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:163)
    at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:90)
    at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:775)
    at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:64)
    at org.apache.spark.sql.Dataset.withAction(Dataset.scala:3698)
    at org.apache.spark.sql.Dataset.count(Dataset.scala:3018)
    at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
    at py4j.Gateway.invoke(Gateway.java:282)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.GatewayConnection.run(GatewayConnection.java:238)
    at java.lang.Thread.run(Thread.java:750)
    Caused by: java.lang.NullPointerException
</code>```

Python Version : 3.7

Spark : 3.1.3

mysql driver :  mysql-connector-java-8.0.29

The weird thing is that this error is solved by restarting the VM and it rarely happens, like once a month or once every 2 weeks. We have no clue why it happens since we've crosschecked our database and we certain that the selected column has no null value.

Because of that we're having difficulties reproducing it both in local & staging.

Any help / idea are appreciated. Thanks in Advance!

Update:

Later we found that before this error is produced, we found another error that state GC overhead limit exceeded and org.apache.spark.SparkException: Job 180601 cancelled because SparkContext was shut down then Kibana show the count error.

Is it related & possible produce such error if we trigger the our spark frequently after previous job is finished?

Body:
I'm getting An error occurred while calling o19972810.count while counting data that i get from JDBC:

sql_query = "SELECT.... FROM.... "
df = spark.read.format("jdbc").option("url", con_mysql_source) \
        .option("driver", "com.mysql.jdbc.Driver").option("dbtable", f"({sql_query})" sdtable") \
        .option("user", ...).option("password", ...).load()
df.createOrReplaceTempView("df_temp")

counts = df.count()

Here is the full log:

aRise Py4JJavaError(\\\\npy4j.protocol.Py4JJavaError: An error occurred while calling o19972810.count. :
    org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:\\\\nExchange SinglePartition, ENSURE_REQUIREMENTS, [id=#38969584]
    - *(1) HashAggregate(keys=[], functions=[partial_count(1)], output=[count#49033654L])
       +- *(1) Scan JDBCRelation((SELECT updatedate,DATE_FORMAT(transaction_tgl, '%Y%m%d') as partdate, user, outlet transaction_tgl , id, status FROM Transactions WHERE updateDate \\u003e '2022-11-29 20:22:23' AND updateDate\\u003c='2022-11-29 20:27:28' AND transaction_tgl \\u003e '1970-01-01 00:00:00' ) sdtable) [numPartitions=1] [] PushedFilters: [], ReadSchema: struct\\u003c\\u003e\
    at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:56)
    at org.apache.spark.sql.execution.exchange.ShuffleExchangeExec.doExecute(ShuffleExchangeExec.scala:163)
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:180
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:218)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:215)
    at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:176)
    at org.apache.spark.sql.execution.InputAdapter.inputRDD(WholeStageCodegenExec.scala:525)
    at org.apache.spark.sql.execution.InputRDDCodegen.inputRDDs(WholeStageCodegenExec.scala:453)
    at org.apache.spark.sql.execution.InputRDDCodegen.inputRDDs$(WholeStageCodegenExec.scala:452)
    at org.apache.spark.sql.execution.InputAdapter.inputRDDs(WholeStageCodegenExec.scala:496)
    at org.apache.spark.sql.execution.aggregate.HashAggregateExec.inputRDDs(HashAggregateExec.scala:141)
    at org.apache.spark.sql.execution.WholeStageCodegenExec.doExecute(WholeStageCodegenExec.scala:746)
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:180)
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:218)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:215)
    at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:176)
    at org.apache.spark.sql.execution.SparkPlan.getByteArrayRdd(SparkPlan.scala:321)
    at org.apache.spark.sql.execution.SparkPlan.executeCollect(SparkPlan.scala:387)
    at org.apache.spark.sql.Dataset.$anonfun$count$1(Dataset.scala:3019)
    at org.apache.spark.sql.Dataset.$anonfun$count$1$adapted(Dataset.scala:3018)
    at org.apache.spark.sql.Dataset.$anonfun$withAction$1(Dataset.scala:3700)
    at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$5(SQLExecution.scala:103)
    at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:163)
    at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:90)
    at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:775)
    at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:64)
    at org.apache.spark.sql.Dataset.withAction(Dataset.scala:3698)
    at org.apache.spark.sql.Dataset.count(Dataset.scala:3018)
    at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
    at py4j.Gateway.invoke(Gateway.java:282)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.GatewayConnection.run(GatewayConnection.java:238)
    at java.lang.Thread.run(Thread.java:750)
    Caused by: java.lang.NullPointerException

Python Version : 3.7

Spark : 3.1.3

mysql driver :  mysql-connector-java-8.0.29

The weird thing is that this error is solved by restarting the VM and it rarely happens, like once a month or once every 2 weeks. We have no clue why it happens since we've crosschecked our database and we certain that the selected column has no null value.

Because of that we're having difficulties reproducing it both in local & staging.

Any help / idea are appreciated. Thanks in Advance!

Update:

Later we found that before this error is produced, we found another error that state GC overhead limit exceeded and org.apache.spark.SparkException: Job 180601 cancelled because SparkContext was shut down then Kibana show the count error.

Is it related & possible produce such error if we trigger the our spark frequently after previous job is finished?


问:
I have an issue with running npm run dev after updating npm to 8.19.2. Im currently using nuxt 3
After updating my npm to 8.19.2 I am no longer able to run npm run dev
In my terminal.

I get a response that says digital envelope routines::unsupported when I try to run the nuxt.js project for development.

```<code>
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported

</code>```
```<code>ode:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
</code>```

I have tried downgrading to npm 8.12.0 and below but It does nothing to fix the problem.

Body:
After updating my npm to 8.19.2 I am no longer able to run npm run dev
In my terminal.

I get a response that says digital envelope routines::unsupported when I try to run the nuxt.js project for development.

node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported

ode:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);

I have tried downgrading to npm 8.12.0 and below but It does nothing to fix the problem.


问:
Laravel makes API get data from database using authurization token
I am trying to make an API that will fetch a paticual users all data when token is passed in headers as authorization token.

I am new to Laravel and back-end I have generated token using Laravel passport.

api.php
Route::get('/{user}', [userData::class, 'get_all']);

userData.php

what I have tried is passing the id but I don't want that

public function get_all(User $user)
{

 dd($user);
 $user = User::where('id', $user)->first();
 return response()->json([
    'user' => $user,
 ]);
}
}
```


问:
hiding button by click other button in html
I create div for selecting minimum and maximum values by click the button. Now I have to achieve that if I select the minimum value 15 then in the maximum div from start to 10 value of button hide or if I select the maximum value 10 then  in the minimum div from 15 to up to so on value of button hide.

My View:

```<code><div style="display:flex">
  <div style="display:inline-block;margin-left:20px;overflow-x:hidden;overflow-y:auto; width:80px;height:120px;border-style:solid ;border-color: black;border:1px;">
    <button type="button" id="p1" value="5" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">5</button><br />
    <button type="button" id="p2" value="10" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">10</button><br />
    <button type="button" id="p3" value="15" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">15</button><br />
    <button type="button" id="p4" value="20" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">20</button><br />
    <button type="button" id="p5" value="25" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">25</button><br />
    <button type="button" id="p6" value="30" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">30</button><br />
    <button type="button" id="p7" value="35" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">35</button><br />
    <button type="button" id="p8" value="40" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">40</button><br />
    <button type="button" id="p9" value="45" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">45</button><br />
    <button type="button" id="p10" value="50" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">50</button><br />

  </div>
  <div style="display:inline-block;margin-left:15px;overflow-x:hidden;overflow-y:auto;width:80px;height:120px;border-style:solid ;border-color: black;border:1px;">
    <button type="button" id="t1" value="5" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">5</button><br />
    <button type="button" id="t2" value="10" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">10</button><br />
    <button type="button" id="t3" value="15" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">15</button><br />
    <button type="button" id="t4" value="20" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">20</button><br />
    <button type="button" id="t5" value="25" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">25</button><br />
    <button type="button" id="t6" value="30" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">30</button><br />
    <button type="button" id="t7" value="35" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">35</button><br />
    <button type="button" id="t8" value="40" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">40</button><br />
    <button type="button" id="t9" value="45" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">45</button><br />
    <button type="button" id="t10" value="50" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">50</button><br /> `
  </div>
</div>
</code>```

Body:
I create div for selecting minimum and maximum values by click the button. Now I have to achieve that if I select the minimum value 15 then in the maximum div from start to 10 value of button hide or if I select the maximum value 10 then  in the minimum div from 15 to up to so on value of button hide.

My View:

    <button type="button" id="p1" value="5" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">5</button>

    <button type="button" id="p2" value="10" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">10</button>

    <button type="button" id="p3" value="15" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">15</button>

    <button type="button" id="p4" value="20" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">20</button>

    <button type="button" id="p5" value="25" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">25</button>

    <button type="button" id="p6" value="30" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">30</button>

    <button type="button" id="p7" value="35" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">35</button>

    <button type="button" id="p8" value="40" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">40</button>

    <button type="button" id="p9" value="45" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">45</button>

    <button type="button" id="p10" value="50" class="userbutton w-button" onclick="document.getElementById('userInput1').value = this.value;document.getElementById('min').value = this.value; RunGame();" style="width:70px;">50</button>

    <button type="button" id="t1" value="5" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">5</button>

    <button type="button" id="t2" value="10" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">10</button>

    <button type="button" id="t3" value="15" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">15</button>

    <button type="button" id="t4" value="20" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">20</button>

    <button type="button" id="t5" value="25" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">25</button>

    <button type="button" id="t6" value="30" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">30</button>

    <button type="button" id="t7" value="35" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">35</button>

    <button type="button" id="t8" value="40" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">40</button>

    <button type="button" id="t9" value="45" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">45</button>

    <button type="button" id="t10" value="50" class="userbutton w-button" onclick="document.getElementById('userInput2').value = this.value;document.getElementById('max').value = this.value; RunGame();" style="width:70px;">50</button>
 `


问:
What is the best way to handle Coreference Resolution in NLP
For example,

Context: I am Yash and he is Jay who is my close friend.
Generated Question: Who is Jay?
Generated Answer: my close friend.

But the Answer should be something like following:

Yash's close friend.

Jay is a cose friend of Yash.

I have tried out AllenNLP and other Standford-NLP solutions but didn't work out at all.


问:
Fitting a table inside a container in Flutter app
In my flutter project I have a container and a table inside of it. I am trying to make the table columns to fit in the container but for some reason it width is so small text are showing on 2 lines.

Here is the code:

```<code>                Container(
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                      color: const Color(0xFFF4F6FD)),
                  padding:
                      const EdgeInsets.symmetric(horizontal: 60, vertical: 10),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      FutureBuilder<List<Some_Model>>(
                        future: futureSome,
                        builder: (BuildContext context,
                            AsyncSnapshot<List<Some_Model>> snapshot) {
                          if (snapshot.hasData) {
                            return Column(
                              children: List.generate(
                                snapshot.data!.length,
                                (index) => Column(
                                  children: [
                                    Text(
                                      snapshot.data![index].name,
                                      textAlign: TextAlign.start,
                                      style: const TextStyle(
                                        fontSize: 24,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                    Table(
                                      defaultColumnWidth: MaxColumnWidth(
                                        FractionColumnWidth(1.0 / 4.0),
                                        FractionColumnWidth(1.0 / 4.0),
                                      ),
                                      children: [
                                        // Iterate over the list and display the information
                                        for (var details
                                            in snapshot.data![index].details)
                                          TableRow(children: [
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'No: ${details.no}',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'Size: ${details.size}',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'Color: ${details.color}',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'Your size: ....',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'Your fit: ....',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                          ])
                                      ],
                                    )
                                  ],
                                ),
                              ),
                            );
                          } else if (snapshot.hasError) {
                            print(snapshot.error);
                            return Text('${snapshot.error}');
                          }
                          return const CircularProgressIndicator();
                        },
                      )
                    ],
                  ),
                ),
</code>```

Here is the snapshot:

My question how can I get the table to fit the container and make the columns wide enough

Body:
In my flutter project I have a container and a table inside of it. I am trying to make the table columns to fit in the container but for some reason it width is so small text are showing on 2 lines.

Here is the code:

                Container(
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                      color: const Color(0xFFF4F6FD)),
                  padding:
                      const EdgeInsets.symmetric(horizontal: 60, vertical: 10),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      FutureBuilder<List<Some_Model>>(
                        future: futureSome,
                        builder: (BuildContext context,
                            AsyncSnapshot<List<Some_Model>> snapshot) {
                          if (snapshot.hasData) {
                            return Column(
                              children: List.generate(
                                snapshot.data!.length,
                                (index) => Column(
                                  children: [
                                    Text(
                                      snapshot.data![index].name,
                                      textAlign: TextAlign.start,
                                      style: const TextStyle(
                                        fontSize: 24,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                    Table(
                                      defaultColumnWidth: MaxColumnWidth(
                                        FractionColumnWidth(1.0 / 4.0),
                                        FractionColumnWidth(1.0 / 4.0),
                                      ),
                                      children: [
                                        // Iterate over the list and display the information
                                        for (var details
                                            in snapshot.data![index].details)
                                          TableRow(children: [
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'No: ${details.no}',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'Size: ${details.size}',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'Color: ${details.color}',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'Your size: ....',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  const EdgeInsets.all(8.0),
                                              child: Text(
                                                'Your fit: ....',
                                                style: const TextStyle(
                                                  fontSize: 18,
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.black,
                                                ),
                                              ),
                                            ),
                                          ])
                                      ],
                                    )
                                  ],
                                ),
                              ),
                            );
                          } else if (snapshot.hasError) {
                            print(snapshot.error);
                            return Text('${snapshot.error}');
                          }
                          return const CircularProgressIndicator();
                        },
                      )
                    ],
                  ),
                ),

Here is the snapshot:

My question how can I get the table to fit the container and make the columns wide enough


问:
shap.DeepExplainer Error : TFDeep' object has no attribute ' between_tensors' Exception encountered when calling layer lstm
I use shap.DeepExplainer and I got an error

I open issue on https://github.com/slundberg/shap/issues/2808

```<code>    AttributeError: Exception encountered when calling layer "lstm" "                 f"(type LSTM).

    'TFDeep' object has no attribute 'between_tensors'

    Call arguments received by layer "lstm" "                 f"(type LSTM):
      • inputs=tf.Tensor(shape=(4184, 44, 4), dtype=float32)
      • mask=None
      • training=False
      • initial_state=None

</code>```

This is my code , the part of model construction   and invoking Shap

```<code>model = Sequential()

n_neurons = x_train.shape[1] * x_train.shape[2]
print(n_neurons, x_train.shape[1], x_train.shape[2])

model.add(LSTM(n_neurons, return_sequences=False, input_shape=(x_train.shape[1], x_train.shape[2])))
model.add(Dense(1))

model.compile(optimizer='adam',loss='mean_squared_error')

history = model.fit(x_train, y_train,
                        batch_size=batch_size,
                        epochs=epochs,shuffle=False,
                        validation_data=(x_test, y_test)
                       )

</code>```
```<code>import shap
# Use the training data for deep explainer => can use fewer instances
explainer_ = shap.DeepExplainer(model, x_train)
shap_values_ = explainer_.shap_values(x_test)

</code>```

Body:
I use shap.DeepExplainer and I got an error

I open issue on https://github.com/slundberg/shap/issues/2808

    AttributeError: Exception encountered when calling layer "lstm" "                 f"(type LSTM).

    'TFDeep' object has no attribute 'between_tensors'

    Call arguments received by layer "lstm" "                 f"(type LSTM):
      • inputs=tf.Tensor(shape=(4184, 44, 4), dtype=float32)
      • mask=None
      • training=False
      • initial_state=None

This is my code , the part of model construction   and invoking Shap

model = Sequential()

n_neurons = x_train.shape[1] * x_train.shape[2]
print(n_neurons, x_train.shape[1], x_train.shape[2])

model.add(LSTM(n_neurons, return_sequences=False, input_shape=(x_train.shape[1], x_train.shape[2])))
model.add(Dense(1))

model.compile(optimizer='adam',loss='mean_squared_error')

history = model.fit(x_train, y_train,
                        batch_size=batch_size,
                        epochs=epochs,shuffle=False,
                        validation_data=(x_test, y_test)
                       )

import shap
# Use the training data for deep explainer => can use fewer instances
explainer_ = shap.DeepExplainer(model, x_train)
shap_values_ = explainer_.shap_values(x_test)