问:
Import Cookies in Selenium to login to Tiktok
I want to import my TikTok Cookies in Selenium, so I can login without E-mail etc. I have my TikTok Cookies in json format. I got them with the Cookie Editor Extension. They look like this: (They don't work anymore, you can't steal my account)

```<code>[
    {
        "name": "ak_bmsc",
        "value": "8212602E930E6F64AA0624DD6E863C50~000000000000000000000000000000~YAAQDkhnaHKTwhaFAQAAEIRhpxJcYa0shIEWLBmNGIiqgWbNUircx0QW4jdNl7F89wAEX8WzhDq5jvRnPvdpQPfRnF+CP/ICnJFmCue4JUra0oFm7nzRiYPXTGeqwIcmlgv+7B727AcUG9qs47fWGeF86muhpkRb6f1/FE7OfM3QnmonaDERcIaylhWE8/hHewg1TpqVdfTuXNv+U0RxiKz0zoYh3k5FusVB8Gi0NxgwbldEEKgXQDL9/xtBduCowdUP0zL55IA1kFeiwT9z+BYFzFZ4fP8Dc7HCjdhpiHGzfBfBltgHKwJjZIlZSxNGZL3hDt3O79BdMQSRMxobCbhePnCJ7SECkdGzPl7gTOrK6H7W+AXsjVfMpxOXJjh6dKC+7elGpJgL97M=",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673557663,
        "storeId": null
    },
    {
        "name": "tt-target-idc-sign",
        "value": "5YxdfGLosvFdMgb1bXdwl1-FZzvdNya7FUu1ZT4HWrv3D_Cr3CMmxz92HBhdxocXBzBsdfOjE7ZCnwB8tEHmE7TO_Y7bRfD5X8a1FXR3CSgZrSu-Yh4m0g4VO3vxm9ZW4kUyNo8crey7ykJDvPerk_WXtmWHC2olcfK95CFMGSh2P12HmjK2bkCNwd8G67zIB9ruq8l3g6yP_wRwwe22TdU9seMC9Ej68Iv_aaOqvOLjjySEtKGgAITjeO7ILsZEeNcRRMzgs0zKlS5oHv0u34UY5BULmUq_u93KQsVhtD0MV918EjnXxyL0P0nzW3P14MD7o82iaHnhsYqgKGdQ2IuaUAt9-WRlZCEKjlz1qyGF7lMzJYAAcpdWeFvY8ngYrMweWs1FBUoUXdi2NC4abeH9-GA5hyDpufFG2gIpMJtduaN9_mbhqCsA5hzsUfKF5fHD5-PsTWGhk687sJA65pJODXhejGIh9pj7OO2kctvw0pMw7HIGp6rSq3W6t7Nd",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086503,
        "storeId": null
    },
    {
        "name": "_abck",
        "value": "42D3C2D28425227E6C0BDE47B2356740~-1~YAAQBUhnaI4KwwWFAQAAhyhipwnW4qoS/PamAGRt5U3gP+fne8dib2iaTTsXfhJt27uYiaZHC8/Sj2nlhfx7w2rz9vVgfNYUpErbI+EvNCdrCitdoV1NDVaIQ4tjyP3ZOrsB9+CEtLbin+O9IfPHfxBdmU/9sbL73sM+4ht2uM55xsp4KSN7F/n6POqT7M+C73aPwmZJytQlzXLjIFLAGTFslRfr5yvMnwmlcxprokEMLUVCqunJ8qg2u9WPuoOkWzsD9qZn4CbwUQUz+PhXZl3/+niSB7ulOrDM3XQCR8YRivIr2JQT1V6uuxkKEfgGGKcDg0VJsITwY8/qzYYnbgM9cUl/7Ej29truMJiYDMUzNEPzMbcwYDl1nhMuIT2AIgoQEvmm7o/A7myM9F03vpbCrF+k/SyWAA==~0~-1~-1",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086507,
        "storeId": null
    },
    {
        "name": "csrf_session_id",
        "value": "9d94d54a439c43831d2ebb24e4023dbf",
        "domain": "www.tiktok.com",
        "hostOnly": true,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": true,
        "firstPartyDomain": "",
        "partitionKey": null,
        "storeId": null
    },
    {
        "name": "msToken",
        "value": "XD8GanFPqieP0PjK7ge-Odbup5gE6fYywLLdO8rQ_Uaz7_6QNkH36wNRlP898x8jixXc9lwofmuvzuZvimtWKg8UDIQw_XGDBzzzuIJj2uKx9NxnWIbMaWWrXl5qHPapTroL",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1674414517,
        "storeId": null
    },
    {
        "name": "sid_guard",
        "value": "e5a873636ed0a691ad7b3ebe42b0b248%7C1673550501%7C5184000%7CMon%2C+13-Mar-2023+19%3A08%3A21+GMT",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1704654503,
        "storeId": null
    },
    {
        "name": "ttwid",
        "value": "1%7CXYPMCdx97YCDwX5eXxScLqbcnCfWSV0NYr7S2XFUKYc%7C1673550510%7Cf31acce5c15c82d72348276034d4cc6ce6c9d43816c09f00e533b861d68081a0",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086511,
        "storeId": null
    },
    {
        "name": "store-country-code-src",
        "value": "uid",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734502,
        "storeId": null
    },
    {
        "name": "cookie-consent",
        "value": "{%22ga%22:false%2C%22af%22:false%2C%22fbp%22:false%2C%22lip%22:false%2C%22bing%22:false%2C%22ttads%22:false%2C%22reddit%22:false%2C%22criteo%22:false%2C%22version%22:%22v9%22}",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1704296770,
        "storeId": null
    },
    {
        "name": "uid_tt",
        "value": "ce2fbdf69c460a3daae4993581f1c1071a7d96da8a90bb7065a49f608177b88c",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "passport_csrf_token_default",
        "value": "521b10a4b8f43cbf5c6aea8119647675",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1674764431,
        "storeId": null
    },
    {
        "name": "msToken",
        "value": "XD8GanFPqieP0PjK7ge-Odbup5gE6fYywLLdO8rQ_Uaz7_6QNkH36wNRlP898x8jixXc9lwofmuvzuZvimtWKg8UDIQw_XGDBzzzuIJj2uKx9NxnWIbMaWWrXl5qHPapTroL",
        "domain": "www.tiktok.com",
        "hostOnly": true,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1681326519,
        "storeId": null
    },
    {
        "name": "s_v_web_id",
        "value": "verify_lcm0ddcs_0DcAH7sq_9nJU_43jE_A6QK_ghq0EToUMZdj",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": true,
        "firstPartyDomain": "",
        "partitionKey": null,
        "storeId": null
    },
    {
        "name": "store-idc",
        "value": "maliva",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734502,
        "storeId": null
    },
    {
        "name": "ssid_ucp_v1",
        "value": "1.0.0-KDk3ZjJhZTNkYzM0ZmNiNzg5YjAzZTdjNTM5NjZiYTU0N2U4NWRjZmEKHwiFiK2cnM-mtl8QpbWBngYYswsgDDCRtrL7BTgIQBIQAxoGbWFsaXZhIiBlNWE4NzM2MzZlZDBhNjkxYWQ3YjNlYmU0MmIwYjI0OA",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "tiktok_webapp_theme",
        "value": "light",
        "domain": ".www.tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1699470509,
        "storeId": null
    },
    {
        "name": "__tea_cache_tokens_1988",
        "value": "{%22_type_%22:%22default%22%2C%22user_unique_id%22:%227170793161920546309%22%2C%22timestamp%22:1669580405594}",
        "domain": ".www.tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1674155310,
        "storeId": null
    },
    {
        "name": "_tea_utm_cache_2643",
        "value": "undefined",
        "domain": ".www.tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1672415954,
        "storeId": null
    },
    {
        "name": "bm_mi",
        "value": "2030D375CF747A8B159C50AD67CD9418~YAAQw882F3ylm/CEAQAAuWStjBIwllCZO1L7WjSeIVaJc2Kj3d9ca5OeYKd6V62x9l7atKASNLV4YMWI/A70aVb8/dIIeeAM6MmC2mvrGxIEgaSGNv9nRjZ6gAZUl8i2w/is6pvGX5q3ZMWPOXSLfXlT+lJFVMiFPsZQq3FL7fOBQ709q482di7y1S3bBrGJmKyK9Um7QoQ/Ko40g0R+Bk0lxkiUJXw11AWq3Gz6N5r5bFD7STibHp0i8gZTlPB+z0ndZVdfHfcvxF1S9UbJ5gagzlQO9RIYYdtNtkizEw3nzUgMLd74R7QVd9bcjXhAzKKQS9OcuQ==~1",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673106957,
        "storeId": null
    },
    {
        "name": "bm_sv",
        "value": "3F3B5DEE26756D70E68A9A13F04E6CC4~YAAQBUhnaJUKwwWFAQAA7V9ipxLydOaVu1dTtKoNtpWlMpoq5YYZXH+ViZ/K/KwtJnSviKaYv2Hh/LpJRg+/z4++gUhkoq3AF43/rsTBFWBQ7vzI/vnveu2cX5LwbMXAPY5/cdykiDMeFc6/wHh7w4AsuDESMwGHNExvgJW4ll97FXnZA4rczD4v7kKi2S7gt0L650Q8POBWcSNOQxJErU62gG+IycZ0OD7UMZEbI76HsAM6lESFqTzQNrT5k17q~1",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673557711,
        "storeId": null
    },
    {
        "name": "bm_sz",
        "value": "B3CD421535E3ECAC5684BCE9FD5843F8~YAAQDkhnaHSTwhaFAQAAEIRhpxIzFkyZFUC0BE1leEQqpUQUCJWy7G5PV8Dcp2PvPJ/QxwcrULqnA2qtT11JnzhWPQKyVbg2mdZxyD3vPD6Xzk3jj0x1QswYTt6en646vXEUeSHy+cjXgFulgMO27Zw/OJDqRpp3wbgVd0vFqW9YVzd4MIzd+EZsS6jFgMswfhGOrXns8uiVHdUYeNDH3sTEAeSQ/DTs0WdaP0Uw/vfNBxXbwcTlwVLR6nEV7h0PrNG9Mh/T5EaX+5w7SCXTpvxUfhpHM3t67w6aM3S/VoRBC+U=~3749186~3293746",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673564863,
        "storeId": null
    },
    {
        "name": "cmpl_token",
        "value": "AgQQAPOJF-RO0o9SdN5LuZ08-eJfUMmMP4cCYMoD6A",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "d_ticket",
        "value": "104fb2bea810b5a081aa9711d93bf4e4dc3b6",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086501,
        "storeId": null
    },
    {
        "name": "odin_tt",
        "value": "d202f5ea5cf2ba6774b02e1e1769dd372ba33f3c07c06c58bd1fd8f10eb381efdfb87e52db7b88f6340dca372e04bc34226db263ef5185bdad429b4bb6ee8fa318da837cba849c3f6eed37d113cc31cf",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086515,
        "storeId": null
    },
    {
        "name": "passport_auth_status",
        "value": "4c9d9171576cd640966ba95641afe9da%2C748dfc5c46868df08354d280de4b48ee",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1676142503,
        "storeId": null
    },
    {
        "name": "passport_auth_status_ss",
        "value": "4c9d9171576cd640966ba95641afe9da%2C748dfc5c46868df08354d280de4b48ee",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1676142503,
        "storeId": null
    },
    {
        "name": "passport_csrf_token",
        "value": "521b10a4b8f43cbf5c6aea8119647675",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1674764431,
        "storeId": null
    },
    {
        "name": "passport_fe_beating_status",
        "value": "true",
        "domain": ".www.tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": true,
        "firstPartyDomain": "",
        "partitionKey": null,
        "storeId": null
    },
    {
        "name": "sessionid",
        "value": "e5a873636ed0a691ad7b3ebe42b0b248",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "sessionid_ss",
        "value": "e5a873636ed0a691ad7b3ebe42b0b248",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "sid_tt",
        "value": "e5a873636ed0a691ad7b3ebe42b0b248",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "sid_ucp_v1",
        "value": "1.0.0-KDk3ZjJhZTNkYzM0ZmNiNzg5YjAzZTdjNTM5NjZiYTU0N2U4NWRjZmEKHwiFiK2cnM-mtl8QpbWBngYYswsgDDCRtrL7BTgIQBIQAxoGbWFsaXZhIiBlNWE4NzM2MzZlZDBhNjkxYWQ3YjNlYmU0MmIwYjI0OA",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "store-country-code",
        "value": "at",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734502,
        "storeId": null
    },
    {
        "name": "tt-target-idc",
        "value": "useast1a",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734502,
        "storeId": null
    },
    {
        "name": "tt_chain_token",
        "value": "bNh130YMkpdYrSobdL0/zQ==",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673572106,
        "storeId": null
    },
    {
        "name": "tt_csrf_token",
        "value": "1KPKsC8C-DV_gbCsZAXu5Vtc1G70rk0pa0BU",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "lax",
        "session": true,
        "firstPartyDomain": "",
        "partitionKey": null,
        "storeId": null
    },
    {
        "name": "uid_tt_ss",
        "value": "ce2fbdf69c460a3daae4993581f1c1071a7d96da8a90bb7065a49f608177b88c",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    }
]
</code>```

I tried this code, but it just didn't work:

```<code>from selenium import webdriver
import json

print('get cookie')

driver=webdriver.Chrome()
driver.get("https://stackoverflow.com/")
cookies = driver.get_cookies()
with open('cookietest.json', 'w', newline='') as outputdata:
    json.dump(cookies, outputdata)

print('send cookie')

import json
from selenium import webdriver
with open('cookietest.json', 'r', newline='') as inputdata:
    cookies = json.load(inputdata)
curcookie = cookies[0]
driver=webdriver.Chrome()
driver.get("https://stackoverflow.com/")
driver.add_cookie(curcookie)
</code>```

Can you help me?

Body:
I want to import my TikTok Cookies in Selenium, so I can login without E-mail etc. I have my TikTok Cookies in json format. I got them with the Cookie Editor Extension. They look like this: (They don't work anymore, you can't steal my account)

[
    {
        "name": "ak_bmsc",
        "value": "8212602E930E6F64AA0624DD6E863C50~000000000000000000000000000000~YAAQDkhnaHKTwhaFAQAAEIRhpxJcYa0shIEWLBmNGIiqgWbNUircx0QW4jdNl7F89wAEX8WzhDq5jvRnPvdpQPfRnF+CP/ICnJFmCue4JUra0oFm7nzRiYPXTGeqwIcmlgv+7B727AcUG9qs47fWGeF86muhpkRb6f1/FE7OfM3QnmonaDERcIaylhWE8/hHewg1TpqVdfTuXNv+U0RxiKz0zoYh3k5FusVB8Gi0NxgwbldEEKgXQDL9/xtBduCowdUP0zL55IA1kFeiwT9z+BYFzFZ4fP8Dc7HCjdhpiHGzfBfBltgHKwJjZIlZSxNGZL3hDt3O79BdMQSRMxobCbhePnCJ7SECkdGzPl7gTOrK6H7W+AXsjVfMpxOXJjh6dKC+7elGpJgL97M=",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673557663,
        "storeId": null
    },
    {
        "name": "tt-target-idc-sign",
        "value": "5YxdfGLosvFdMgb1bXdwl1-FZzvdNya7FUu1ZT4HWrv3D_Cr3CMmxz92HBhdxocXBzBsdfOjE7ZCnwB8tEHmE7TO_Y7bRfD5X8a1FXR3CSgZrSu-Yh4m0g4VO3vxm9ZW4kUyNo8crey7ykJDvPerk_WXtmWHC2olcfK95CFMGSh2P12HmjK2bkCNwd8G67zIB9ruq8l3g6yP_wRwwe22TdU9seMC9Ej68Iv_aaOqvOLjjySEtKGgAITjeO7ILsZEeNcRRMzgs0zKlS5oHv0u34UY5BULmUq_u93KQsVhtD0MV918EjnXxyL0P0nzW3P14MD7o82iaHnhsYqgKGdQ2IuaUAt9-WRlZCEKjlz1qyGF7lMzJYAAcpdWeFvY8ngYrMweWs1FBUoUXdi2NC4abeH9-GA5hyDpufFG2gIpMJtduaN9_mbhqCsA5hzsUfKF5fHD5-PsTWGhk687sJA65pJODXhejGIh9pj7OO2kctvw0pMw7HIGp6rSq3W6t7Nd",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086503,
        "storeId": null
    },
    {
        "name": "_abck",
        "value": "42D3C2D28425227E6C0BDE47B2356740~-1~YAAQBUhnaI4KwwWFAQAAhyhipwnW4qoS/PamAGRt5U3gP+fne8dib2iaTTsXfhJt27uYiaZHC8/Sj2nlhfx7w2rz9vVgfNYUpErbI+EvNCdrCitdoV1NDVaIQ4tjyP3ZOrsB9+CEtLbin+O9IfPHfxBdmU/9sbL73sM+4ht2uM55xsp4KSN7F/n6POqT7M+C73aPwmZJytQlzXLjIFLAGTFslRfr5yvMnwmlcxprokEMLUVCqunJ8qg2u9WPuoOkWzsD9qZn4CbwUQUz+PhXZl3/+niSB7ulOrDM3XQCR8YRivIr2JQT1V6uuxkKEfgGGKcDg0VJsITwY8/qzYYnbgM9cUl/7Ej29truMJiYDMUzNEPzMbcwYDl1nhMuIT2AIgoQEvmm7o/A7myM9F03vpbCrF+k/SyWAA==~0~-1~-1",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086507,
        "storeId": null
    },
    {
        "name": "csrf_session_id",
        "value": "9d94d54a439c43831d2ebb24e4023dbf",
        "domain": "www.tiktok.com",
        "hostOnly": true,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": true,
        "firstPartyDomain": "",
        "partitionKey": null,
        "storeId": null
    },
    {
        "name": "msToken",
        "value": "XD8GanFPqieP0PjK7ge-Odbup5gE6fYywLLdO8rQ_Uaz7_6QNkH36wNRlP898x8jixXc9lwofmuvzuZvimtWKg8UDIQw_XGDBzzzuIJj2uKx9NxnWIbMaWWrXl5qHPapTroL",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1674414517,
        "storeId": null
    },
    {
        "name": "sid_guard",
        "value": "e5a873636ed0a691ad7b3ebe42b0b248%7C1673550501%7C5184000%7CMon%2C+13-Mar-2023+19%3A08%3A21+GMT",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1704654503,
        "storeId": null
    },
    {
        "name": "ttwid",
        "value": "1%7CXYPMCdx97YCDwX5eXxScLqbcnCfWSV0NYr7S2XFUKYc%7C1673550510%7Cf31acce5c15c82d72348276034d4cc6ce6c9d43816c09f00e533b861d68081a0",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086511,
        "storeId": null
    },
    {
        "name": "store-country-code-src",
        "value": "uid",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734502,
        "storeId": null
    },
    {
        "name": "cookie-consent",
        "value": "{%22ga%22:false%2C%22af%22:false%2C%22fbp%22:false%2C%22lip%22:false%2C%22bing%22:false%2C%22ttads%22:false%2C%22reddit%22:false%2C%22criteo%22:false%2C%22version%22:%22v9%22}",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1704296770,
        "storeId": null
    },
    {
        "name": "uid_tt",
        "value": "ce2fbdf69c460a3daae4993581f1c1071a7d96da8a90bb7065a49f608177b88c",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "passport_csrf_token_default",
        "value": "521b10a4b8f43cbf5c6aea8119647675",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1674764431,
        "storeId": null
    },
    {
        "name": "msToken",
        "value": "XD8GanFPqieP0PjK7ge-Odbup5gE6fYywLLdO8rQ_Uaz7_6QNkH36wNRlP898x8jixXc9lwofmuvzuZvimtWKg8UDIQw_XGDBzzzuIJj2uKx9NxnWIbMaWWrXl5qHPapTroL",
        "domain": "www.tiktok.com",
        "hostOnly": true,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1681326519,
        "storeId": null
    },
    {
        "name": "s_v_web_id",
        "value": "verify_lcm0ddcs_0DcAH7sq_9nJU_43jE_A6QK_ghq0EToUMZdj",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": true,
        "firstPartyDomain": "",
        "partitionKey": null,
        "storeId": null
    },
    {
        "name": "store-idc",
        "value": "maliva",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734502,
        "storeId": null
    },
    {
        "name": "ssid_ucp_v1",
        "value": "1.0.0-KDk3ZjJhZTNkYzM0ZmNiNzg5YjAzZTdjNTM5NjZiYTU0N2U4NWRjZmEKHwiFiK2cnM-mtl8QpbWBngYYswsgDDCRtrL7BTgIQBIQAxoGbWFsaXZhIiBlNWE4NzM2MzZlZDBhNjkxYWQ3YjNlYmU0MmIwYjI0OA",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "tiktok_webapp_theme",
        "value": "light",
        "domain": ".www.tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1699470509,
        "storeId": null
    },
    {
        "name": "__tea_cache_tokens_1988",
        "value": "{%22_type_%22:%22default%22%2C%22user_unique_id%22:%227170793161920546309%22%2C%22timestamp%22:1669580405594}",
        "domain": ".www.tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1674155310,
        "storeId": null
    },
    {
        "name": "_tea_utm_cache_2643",
        "value": "undefined",
        "domain": ".www.tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1672415954,
        "storeId": null
    },
    {
        "name": "bm_mi",
        "value": "2030D375CF747A8B159C50AD67CD9418~YAAQw882F3ylm/CEAQAAuWStjBIwllCZO1L7WjSeIVaJc2Kj3d9ca5OeYKd6V62x9l7atKASNLV4YMWI/A70aVb8/dIIeeAM6MmC2mvrGxIEgaSGNv9nRjZ6gAZUl8i2w/is6pvGX5q3ZMWPOXSLfXlT+lJFVMiFPsZQq3FL7fOBQ709q482di7y1S3bBrGJmKyK9Um7QoQ/Ko40g0R+Bk0lxkiUJXw11AWq3Gz6N5r5bFD7STibHp0i8gZTlPB+z0ndZVdfHfcvxF1S9UbJ5gagzlQO9RIYYdtNtkizEw3nzUgMLd74R7QVd9bcjXhAzKKQS9OcuQ==~1",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673106957,
        "storeId": null
    },
    {
        "name": "bm_sv",
        "value": "3F3B5DEE26756D70E68A9A13F04E6CC4~YAAQBUhnaJUKwwWFAQAA7V9ipxLydOaVu1dTtKoNtpWlMpoq5YYZXH+ViZ/K/KwtJnSviKaYv2Hh/LpJRg+/z4++gUhkoq3AF43/rsTBFWBQ7vzI/vnveu2cX5LwbMXAPY5/cdykiDMeFc6/wHh7w4AsuDESMwGHNExvgJW4ll97FXnZA4rczD4v7kKi2S7gt0L650Q8POBWcSNOQxJErU62gG+IycZ0OD7UMZEbI76HsAM6lESFqTzQNrT5k17q~1",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673557711,
        "storeId": null
    },
    {
        "name": "bm_sz",
        "value": "B3CD421535E3ECAC5684BCE9FD5843F8~YAAQDkhnaHSTwhaFAQAAEIRhpxIzFkyZFUC0BE1leEQqpUQUCJWy7G5PV8Dcp2PvPJ/QxwcrULqnA2qtT11JnzhWPQKyVbg2mdZxyD3vPD6Xzk3jj0x1QswYTt6en646vXEUeSHy+cjXgFulgMO27Zw/OJDqRpp3wbgVd0vFqW9YVzd4MIzd+EZsS6jFgMswfhGOrXns8uiVHdUYeNDH3sTEAeSQ/DTs0WdaP0Uw/vfNBxXbwcTlwVLR6nEV7h0PrNG9Mh/T5EaX+5w7SCXTpvxUfhpHM3t67w6aM3S/VoRBC+U=~3749186~3293746",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673564863,
        "storeId": null
    },
    {
        "name": "cmpl_token",
        "value": "AgQQAPOJF-RO0o9SdN5LuZ08-eJfUMmMP4cCYMoD6A",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "d_ticket",
        "value": "104fb2bea810b5a081aa9711d93bf4e4dc3b6",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086501,
        "storeId": null
    },
    {
        "name": "odin_tt",
        "value": "d202f5ea5cf2ba6774b02e1e1769dd372ba33f3c07c06c58bd1fd8f10eb381efdfb87e52db7b88f6340dca372e04bc34226db263ef5185bdad429b4bb6ee8fa318da837cba849c3f6eed37d113cc31cf",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1705086515,
        "storeId": null
    },
    {
        "name": "passport_auth_status",
        "value": "4c9d9171576cd640966ba95641afe9da%2C748dfc5c46868df08354d280de4b48ee",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1676142503,
        "storeId": null
    },
    {
        "name": "passport_auth_status_ss",
        "value": "4c9d9171576cd640966ba95641afe9da%2C748dfc5c46868df08354d280de4b48ee",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1676142503,
        "storeId": null
    },
    {
        "name": "passport_csrf_token",
        "value": "521b10a4b8f43cbf5c6aea8119647675",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1674764431,
        "storeId": null
    },
    {
        "name": "passport_fe_beating_status",
        "value": "true",
        "domain": ".www.tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": false,
        "sameSite": "no_restriction",
        "session": true,
        "firstPartyDomain": "",
        "partitionKey": null,
        "storeId": null
    },
    {
        "name": "sessionid",
        "value": "e5a873636ed0a691ad7b3ebe42b0b248",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "sessionid_ss",
        "value": "e5a873636ed0a691ad7b3ebe42b0b248",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "sid_tt",
        "value": "e5a873636ed0a691ad7b3ebe42b0b248",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "sid_ucp_v1",
        "value": "1.0.0-KDk3ZjJhZTNkYzM0ZmNiNzg5YjAzZTdjNTM5NjZiYTU0N2U4NWRjZmEKHwiFiK2cnM-mtl8QpbWBngYYswsgDDCRtrL7BTgIQBIQAxoGbWFsaXZhIiBlNWE4NzM2MzZlZDBhNjkxYWQ3YjNlYmU0MmIwYjI0OA",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    },
    {
        "name": "store-country-code",
        "value": "at",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734502,
        "storeId": null
    },
    {
        "name": "tt-target-idc",
        "value": "useast1a",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": false,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734502,
        "storeId": null
    },
    {
        "name": "tt_chain_token",
        "value": "bNh130YMkpdYrSobdL0/zQ==",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1673572106,
        "storeId": null
    },
    {
        "name": "tt_csrf_token",
        "value": "1KPKsC8C-DV_gbCsZAXu5Vtc1G70rk0pa0BU",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "lax",
        "session": true,
        "firstPartyDomain": "",
        "partitionKey": null,
        "storeId": null
    },
    {
        "name": "uid_tt_ss",
        "value": "ce2fbdf69c460a3daae4993581f1c1071a7d96da8a90bb7065a49f608177b88c",
        "domain": ".tiktok.com",
        "hostOnly": false,
        "path": "/",
        "secure": true,
        "httpOnly": true,
        "sameSite": "no_restriction",
        "session": false,
        "firstPartyDomain": "",
        "partitionKey": null,
        "expirationDate": 1678734503,
        "storeId": null
    }
]

I tried this code, but it just didn't work:

from selenium import webdriver
import json

print('get cookie')

driver=webdriver.Chrome()
driver.get("https://stackoverflow.com/")
cookies = driver.get_cookies()
with open('cookietest.json', 'w', newline='') as outputdata:
    json.dump(cookies, outputdata)

print('send cookie')

import json
from selenium import webdriver
with open('cookietest.json', 'r', newline='') as inputdata:
    cookies = json.load(inputdata)
curcookie = cookies[0]
driver=webdriver.Chrome()
driver.get("https://stackoverflow.com/")
driver.add_cookie(curcookie)

Can you help me?


来源: stackexchange

问:
How to get rid of HEX_DUMP in log4j logs coming from "io.netty.handler.logging"
I'm using the dependency that has a dependency on io.netty. I want to get logs from io.netty.handler.logging, so I've created a log4j logger in my app and it seems to be fine.

The only problem is that the logs, I'm receiving contain hex data, which I wouldn't like to see.

I think there are 3 possible values: HEX_DUMP, SIMPLE, and TEXTUAL.

How can I change the value from default HEX_DUMP to any other using log4j, if that's possible at all?

ContentLicense: CC BY-SA 4.0


问:
Ionic6 Angular using angularFire 7 errors when injecting Firebase in a component
Help, please... I have an Ionic 6 app using Angular and Firebase. I know Firebase is set up correctly because Firebase authentication works. So why when my first component loads after authentication (which injects my service ) do I get the error "FirebaseError: Firebase: Need to provide options, when not being deployed to hosting via source. (app/no-options).".

component.ts

```<code>import {Component} from '@angular/core';
import {ClientsService} from "../views/clients/services/service";

@Component({
    selector: 'app-home',
    templateUrl: 'home.page.html',
    styleUrls: ['home.page.scss']
})
export class HomePage {

    constructor(
        private service: Service
    ) {
    }

}
</code>```

service.ts

```<code>import {Injectable} from '@angular/core';
import {CollectionEnum} from '../../../shared/enums/collection.enum';
import {collection, CollectionReference, Firestore} from '@angular/fire/firestore';

@Injectable( { providedIn: 'root'})
export class Service {

    private readonly clientsCollectionRef: CollectionReference;

    constructor(
        private firestore: Firestore // ERRORS HERE
    ) {
        this.clientsCollectionRef = collection(this.firestore, CollectionEnum.CLIENTS);
    }

}
</code>```

app.module.ts

```<code>@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        IonicModule.forRoot(),
        AppRoutingModule,
        provideFirebaseApp(() => initializeApp(environment.firebase, 'mydb')),
        provideAuth( () => {
           if ( Capacitor.isNativePlatform() ) {
               return initializeAuth(getApp(), {
                   persistence: indexedDBLocalPersistence
               })
           } else {
               return getAuth(getApp('mydb'))
           }
        }),
        provideDatabase(() => getDatabase()),
        provideFirestore(() => getFirestore())
    ],
    providers: [
        {provide: RouteReuseStrategy, useClass: IonicRouteStrategy}
    ],
    bootstrap: [
        AppComponent
    ],
})
export class AppModule {
}
</code>```

ng version

```<code>Angular CLI: 15.1.0
Node: 16.14.2
Package Manager: npm 8.6.0
OS: win32 x64

Angular: 15.1.0
... cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.0
@angular-devkit/build-angular   15.1.0
@angular-devkit/core            15.1.0
@angular-devkit/schematics      15.1.0
@angular/fire                   7.5.0
@schematics/angular             15.1.0
rxjs                            7.5.7
typescript                      4.8.4
</code>```

Body:
Help, please... I have an Ionic 6 app using Angular and Firebase. I know Firebase is set up correctly because Firebase authentication works. So why when my first component loads after authentication (which injects my service ) do I get the error "FirebaseError: Firebase: Need to provide options, when not being deployed to hosting via source. (app/no-options).".

component.ts

import {Component} from '@angular/core';
import {ClientsService} from "../views/clients/services/service";

@Component({
    selector: 'app-home',
    templateUrl: 'home.page.html',
    styleUrls: ['home.page.scss']
})
export class HomePage {

    constructor(
        private service: Service
    ) {
    }

}

service.ts

import {Injectable} from '@angular/core';
import {CollectionEnum} from '../../../shared/enums/collection.enum';
import {collection, CollectionReference, Firestore} from '@angular/fire/firestore';

@Injectable( { providedIn: 'root'})
export class Service {

    private readonly clientsCollectionRef: CollectionReference;

    constructor(
        private firestore: Firestore // ERRORS HERE
    ) {
        this.clientsCollectionRef = collection(this.firestore, CollectionEnum.CLIENTS);
    }

}

app.module.ts

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        IonicModule.forRoot(),
        AppRoutingModule,
        provideFirebaseApp(() => initializeApp(environment.firebase, 'mydb')),
        provideAuth( () => {
           if ( Capacitor.isNativePlatform() ) {
               return initializeAuth(getApp(), {
                   persistence: indexedDBLocalPersistence
               })
           } else {
               return getAuth(getApp('mydb'))
           }
        }),
        provideDatabase(() => getDatabase()),
        provideFirestore(() => getFirestore())
    ],
    providers: [
        {provide: RouteReuseStrategy, useClass: IonicRouteStrategy}
    ],
    bootstrap: [
        AppComponent
    ],
})
export class AppModule {
}

ng version

Angular CLI: 15.1.0
Node: 16.14.2
Package Manager: npm 8.6.0
OS: win32 x64

Angular: 15.1.0
... cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.0
@angular-devkit/build-angular   15.1.0
@angular-devkit/core            15.1.0
@angular-devkit/schematics      15.1.0
@angular/fire                   7.5.0
@schematics/angular             15.1.0
rxjs                            7.5.7
typescript                      4.8.4


问:
Single Cell RNA seq: top 10 genes
I am very new to single cell rna seq analysis, I used to biomaRt to get my gene names using this code

annot<-getBM(c("ensembl_gene_id", "chromosome_name","ensembl_transcript_id", "strand", "start_position", "end_position","gene_biotype","mgi_symbol"),values = cafs, mart=ensemblmart102)

where cafs is the data that I have downloaded in the form of csv.

then I was trying to get top10 genes in my data using

```<code> cafs.object <- FindVariableFeatures(cafs.object, selection.method = "vst", nfeatures = 2000)

top10 <- head(VariableFeatures(cafs.object), 10)
</code>```

but what I got

```<code>[1] "13208" "5685"  "2699"  "3184"  "2700"  "7137"
</code>```

and I was wondering if there is something wrong that I am doing

Title: Single Cell RNA seq: top 10 genes

Body:
I am very new to single cell rna seq analysis, I used to biomaRt to get my gene names using this code

annot<-getBM(c("ensembl_gene_id", "chromosome_name","ensembl_transcript_id", "strand", "start_position", "end_position","gene_biotype","mgi_symbol"),values = cafs, mart=ensemblmart102)

where cafs is the data that I have downloaded in the form of csv.

then I was trying to get top10 genes in my data using

 cafs.object <- FindVariableFeatures(cafs.object, selection.method = "vst", nfeatures = 2000)

top10 <- head(VariableFeatures(cafs.object), 10)

but what I got

[1] "13208" "5685"  "2699"  "3184"  "2700"  "7137"

and I was wondering if there is something wrong that I am doing


问:
picture element not showing correct media query
This should be super simple, but I cannot figure out what is going wrong.  I have a pictures element:

```<code>        <picture aria-hidden="true">
            <source media="(max-width: 1199px;)" srcset="/signup/images/blank.png">
            <source media="(min-width: 1200px;)" srcset="/signup/images/bigstock-houses-BC_56439806.avif" type="image/avif" alt="town house rentals">
            <source media="(min-width: 1200px;)" srcset="/signup/images/bigstock-houses-BC_56439806.webp" type="image/webp" alt="town house rentals">
            <img src="/signup/images/bigstock-houses-BC_56439806.jpg" alt="town house rentals">
        </picture>
</code>```

If window is below 1200px, first source image should be shown, which is a 1x1 transparent png.  If window is 1200px or greater, show any of the other sources or the default fallback img.  The problem is that it is only showing the default fallback img, at least 90% of the time.  Occasionally it will show the Avif, but I cannot get it to show the blank.png image.

I've tried about 50 other variations of this, using width and DPI in the srcset, using the size attribute, etc, but nothing makes it work.  Tested in both FF and Chrome, cleared the cache, incognito windows, and both behave the same.

I also have the image set to hide below 1200px in my CSS, but the issue is the image is still loading which is causing issues with load times, especially on mobile.

Thanks in advance.

Body:
This should be super simple, but I cannot figure out what is going wrong.  I have a pictures element:

        <picture aria-hidden="true">
            <source media="(max-width: 1199px;)" srcset="/signup/images/blank.png">
            <source media="(min-width: 1200px;)" srcset="/signup/images/bigstock-houses-BC_56439806.avif" type="image/avif" alt="town house rentals">
            <source media="(min-width: 1200px;)" srcset="/signup/images/bigstock-houses-BC_56439806.webp" type="image/webp" alt="town house rentals">

        </picture>

If window is below 1200px, first source image should be shown, which is a 1x1 transparent png.  If window is 1200px or greater, show any of the other sources or the default fallback img.  The problem is that it is only showing the default fallback img, at least 90% of the time.  Occasionally it will show the Avif, but I cannot get it to show the blank.png image.

I've tried about 50 other variations of this, using width and DPI in the srcset, using the size attribute, etc, but nothing makes it work.  Tested in both FF and Chrome, cleared the cache, incognito windows, and both behave the same.

I also have the image set to hide below 1200px in my CSS, but the issue is the image is still loading which is causing issues with load times, especially on mobile.

Thanks in advance.


问:
Determine count of locations within certain distance of each other
Good Morning/Afternoon,

Fairly new at SQL in general, but I've been able to put together a few queries that give me the output I need for a certain business case, but I have a new requirement that I am struggling with.

In a nutshell, I am extracting a list of "sites" (physical locations) for a given customer along with the lat/lon, and then feeding each location to Google Maps to plot a point for each site.  What I am trying to do is query for unique sites.  If there are multiple sites that are within 1/2 mile of each other, they are lumped as a single site.  For example, if a customer has 10 sites within 1/2 mile of each other, they technically have 1 site, not 10.

Here is an example of what I am doing:

```<code>select c.id, i.site_id, s.name, max(i.captured_at), s.center_lat, s.center_lng, CONCAT(s.center_lat, ','  , s.center_lng) AS LOCATION
from images i
 inner join sites s on s.id = i.site_id
 inner join customers c on c.id = s.customer_id
where i.hidden = 'false' and i.copied_from_id is null and i.status = 'complete' and c.id = '353'
group by c.id, i.site_id, s.name, s.center_lat, s.center_lng
order by max DESC
</code>```

Here is an example of the output:

As it stands now, it returns a count of 4 sites (I am rendering the results in Google Data Studio displaying the count of records returned), which works fine for another scenario.  However, since these sites are within 1/2 mile of each other, they are technically 1 site, not 4.  I am trying to determine how to come up with a count of 1 site vs. 4 in this scenario.  If there was another entry where the lat/lon (location) was more than 1/2 mile away, I would be looking for a count of 2 sites.  I hope this all makes sense.

Currently trying to research where to start so if there are any references, or a push in the right direction, that would be awesome.  Thanks very much.

Body:
Good Morning/Afternoon,

Fairly new at SQL in general, but I've been able to put together a few queries that give me the output I need for a certain business case, but I have a new requirement that I am struggling with.

In a nutshell, I am extracting a list of "sites" (physical locations) for a given customer along with the lat/lon, and then feeding each location to Google Maps to plot a point for each site.  What I am trying to do is query for unique sites.  If there are multiple sites that are within 1/2 mile of each other, they are lumped as a single site.  For example, if a customer has 10 sites within 1/2 mile of each other, they technically have 1 site, not 10.

Here is an example of what I am doing:

select c.id, i.site_id, s.name, max(i.captured_at), s.center_lat, s.center_lng, CONCAT(s.center_lat, ','  , s.center_lng) AS LOCATION
from images i
 inner join sites s on s.id = i.site_id
 inner join customers c on c.id = s.customer_id
where i.hidden = 'false' and i.copied_from_id is null and i.status = 'complete' and c.id = '353'
group by c.id, i.site_id, s.name, s.center_lat, s.center_lng
order by max DESC

Here is an example of the output:

As it stands now, it returns a count of 4 sites (I am rendering the results in Google Data Studio displaying the count of records returned), which works fine for another scenario.  However, since these sites are within 1/2 mile of each other, they are technically 1 site, not 4.  I am trying to determine how to come up with a count of 1 site vs. 4 in this scenario.  If there was another entry where the lat/lon (location) was more than 1/2 mile away, I would be looking for a count of 2 sites.  I hope this all makes sense.

Currently trying to research where to start so if there are any references, or a push in the right direction, that would be awesome.  Thanks very much.


问:
Laravel retrieve field value of a third model from extra field in pivot table
i am working with laravel 9.x.
I have three tables with the three respective models.

one:id | valueA | value2 | value3...

two: id: | valueB

three: id | valueC

The relationships between these models are many to many.

Instead of creating a 3way pivot table I created one for model one and two with the key of three as an extra field

one_id | two_id | three_id

My question is this:

how should i setup relationships between models to access valueC via many to many relationship between one and two?

For now the relationships of the models are

Model One

```<code>public function twos(){
   return $this->belongsToMany(Two::class)->withPivot('two_id');
}
</code>```

Model Two

```<code>public function ones(){
   return $this->belongsToMany(One::class)->withPivot('one_id');
}
</code>```

Can anyone help me

Body:
i am working with laravel 9.x.
I have three tables with the three respective models.

one:id | valueA | value2 | value3...

two: id: | valueB

three: id | valueC

The relationships between these models are many to many.

Instead of creating a 3way pivot table I created one for model one and two with the key of three as an extra field

one_id | two_id | three_id

My question is this:

how should i setup relationships between models to access valueC via many to many relationship between one and two?

For now the relationships of the models are

Model One

public function twos(){
   return $this->belongsToMany(Two::class)->withPivot('two_id');
}

Model Two

public function ones(){
   return $this->belongsToMany(One::class)->withPivot('one_id');
}

Can anyone help me


问:
Azure Functions- is the entire request logged by default?
Very new to Azure functions and not a professional developer. I created an Azure function with powershell code and it works as expected in testing: receives a request from a candidate tracking system and then creates an issue in Jira.

The issue: the function receives sensitive data from the CTS that can't be restricted on that side. Thus I need to verify that I'm not unintentionally logging this anywhere the function would log to by default. I don't need to worry about what could be turned on to potentially log.

Thanks

I've checked Kudu logfiles area, insight analytics and log analytics and I can't see anything that obviously logs the entire request body but I'm so new to Azure Functions I fear I may be missing something.


问:
React-select dropdown options slow on select
I have this function that gets data from an API to be shown for selection in react-select. It gets so slow/drags. I tried looking at the solutions given here on stackoverflow but haven't been able to modify them to suit my use case.

```<code>const getItems = async () => {
    await Axios.get(`http://127.0.0.1:5000/items/available/${myItem}`)
        .then((response) => {
            const items = response.data.map((item) => ({ label: item.name, value: item.id }));
            setItemOptions(items);
        }
}
</code>```

This is how I tried to make the modifications

```<code><Select filter={createFilter({ ignoreAccents: false })} filterOption={createFilter({ ignoreAccents: false })} isMulti options={itemOptions} />
</code>```

DISCLAIMER: I'm learning react doing a project, so I'm new to it.

Body:
I have this function that gets data from an API to be shown for selection in react-select. It gets so slow/drags. I tried looking at the solutions given here on stackoverflow but haven't been able to modify them to suit my use case.

const getItems = async () => {
    await Axios.get(`http://127.0.0.1:5000/items/available/${myItem}`)
        .then((response) => {
            const items = response.data.map((item) => ({ label: item.name, value: item.id }));
            setItemOptions(items);
        }
}

This is how I tried to make the modifications

<Select filter={createFilter({ ignoreAccents: false })} filterOption={createFilter({ ignoreAccents: false })} isMulti options={itemOptions} />

DISCLAIMER: I'm learning react doing a project, so I'm new to it.


问:
(python) Xlib.display.Display() throwing AttributeError module 'socket' has no attribute 'AF_UNIX'
I am running a Windows 10 machine with python 3.11 installed, and am facing an unexpected error.

The issue arose when I was attempting to lock my mouse, I've been tackling this issue for a while now, and I've finally found a good lead.

I tried this code:

from Xlib.display import Display
from Xlib import X
import contextlib
from time import sleep

DISPLAY=":0"

disp = Display(DISPLAY)
screen = disp.screen()
root = screen.root

@contextlib.contextmanager
root.grab_pointer(owner_events=True,
    event_mask=0,
    time=X.CurrentTime,
    pointer_mode=X.GrabModeAsync,
    keyboard_mode=X.GrabModeAsync,
    confine_to=0,
    cursor=0)

sleep(5)

disp.ungrab_pointer(time=X.CurrentTime)
```
<p>It seems to be Display(DISPLAY) causing the issue, the whole error being:</p>
```Exception has occurred: AttributeError
module 'socket' has no attribute 'AF_UNIX'
  File "G:\Downloads\PY SCRIPTS\mouselock.py", line 8, in <module>
    disp = Display(DISPLAY)
```

Leaving Display empty ( as "Display()" ) will not work, though I have seen it used in others' scripts- it does not work in my case. This has led me to believe this is an issue with me operating on Windows 10, and/or python 3.11.

Anything I can do to resolve this issue?

Any help is appreciated.

Body:
I am running a Windows 10 machine with python 3.11 installed, and am facing an unexpected error.

The issue arose when I was attempting to lock my mouse, I've been tackling this issue for a while now, and I've finally found a good lead.

I tried this code:

from Xlib.display import Display
from Xlib import X
import contextlib
from time import sleep

DISPLAY=":0"

disp = Display(DISPLAY)
screen = disp.screen()
root = screen.root

@contextlib.contextmanager
root.grab_pointer(owner_events=True,
    event_mask=0,
    time=X.CurrentTime,
    pointer_mode=X.GrabModeAsync,
    keyboard_mode=X.GrabModeAsync,
    confine_to=0,
    cursor=0)

sleep(5)

disp.ungrab_pointer(time=X.CurrentTime)

It seems to be Display(DISPLAY) causing the issue, the whole error being:

Exception has occurred: AttributeError
module 'socket' has no attribute 'AF_UNIX'
  File "G:\Downloads\PY SCRIPTS\mouselock.py", line 8, in <module>
    disp = Display(DISPLAY)

Leaving Display empty ( as "Display()" ) will not work, though I have seen it used in others' scripts- it does not work in my case. This has led me to believe this is an issue with me operating on Windows 10, and/or python 3.11.

Anything I can do to resolve this issue?

Any help is appreciated.


问:
Using Swift Code inside of a Nativescript Plugin
I'm new to Nativescript and Swift and I'm trying to use one of Nativescript's most useful feature. The Ability to use Swift/Objective C code directly inside of your Typescript code.

So in my plugin I have this swift File: /ios/src/TestClass.swift

```<code>open class TestClass {
   @objc public func testTestClass() {
        return "It Works!"
    }
}
</code>```

but when I try to generate type information for this class using ns typings ios, No types are generated for this class.

I've also tried annotating the class with @objc(TestClass) and still the same result.
I have some cocapod libraries for which types are being generated.
Is it possible in Nativescript to use Swift files directly? or have I misunderstood the documentation?.

Edit: Turning the package into a coca pod makes everything work.

Body:
I'm new to Nativescript and Swift and I'm trying to use one of Nativescript's most useful feature. The Ability to use Swift/Objective C code directly inside of your Typescript code.

So in my plugin I have this swift File: /ios/src/TestClass.swift

open class TestClass {
   @objc public func testTestClass() {
        return "It Works!"
    }
}

but when I try to generate type information for this class using ns typings ios, No types are generated for this class.

I've also tried annotating the class with @objc(TestClass) and still the same result.
I have some cocapod libraries for which types are being generated.
Is it possible in Nativescript to use Swift files directly? or have I misunderstood the documentation?.

Edit: Turning the package into a coca pod makes everything work.


问:
Jupyter lab is overwriting text when typing, how do I turn this off if I don't have an insert key or a numpad?
The whole program is erasing text when I type inbetween something, I can't figure out how to disable this. Previous answers were unhelpful since my keyboard has neither an insert key or a numpad, so I'm not sure how this accidentally happened. There must be some shortcut I accidentally pushed and can't find.

I tried searching the settings of jupyterlab and couldn't anything relevant to disable this typing mode

EDIT: An onscreen keyboard fixed the issue, but I'm wondering what setting in jupyterlab had this enabled


问:
Variable assignment not working with Bash -s and heredoc
When I run the following, $ echo 'ASD=123; echo $ASD hi' | bash -s, the output is exactly what I expect, 123 hi. But when I use a heredoc like so:

```<code>$ bash -s <<EOF
ASD=123; echo $ASD hi
EOF
</code>```

The output is hi, which is not what I expect. If I add single quotes around $ASD, it prints  hi. Why is the variable assignment not working when I use a heredoc?

Body:
When I run the following, $ echo 'ASD=123; echo $ASD hi' | bash -s, the output is exactly what I expect, 123 hi. But when I use a heredoc like so:

$ bash -s <<EOF
ASD=123; echo $ASD hi
EOF

The output is hi, which is not what I expect. If I add single quotes around $ASD, it prints  hi. Why is the variable assignment not working when I use a heredoc?


问:
Image native loses connection with DB spring-boot 3.0
I have two apps one build is native and other is normal image(*.jar) and the apps running on kubernetes. After a time running the native image lost connection with database and loses performance. I think this problem is image I use.
The source code is the same.

I'm using this dockefile.

```<code>FROM buildpack-deps:22.04
ENV LD_LIBRARY_PATH=/usr/local/freetype/2_12_1/lib
RUN mkdir /app/
ADD . /app
WORKDIR /app
COPY target/example-native /app
CMD ["./example-native"]

</code>```

Spring boot: 3.0.1

Mysql: 8.0.26

Kubernetes : 1.24

```<code>spring:
   datasource:
     url: ${JDBC_URL:jdbc:mysql://localhost:3306/database?allowPublicKeyRetrieval=true&useSSL=false}
     username: '${DATABASE_USER:root}'
     password: ${DATABASE_PASS:123456}
     hikari:
      maximumPoolSize: 5
      minimumIdle: 1
      keepaliveTime: 30000
</code>```

Log error:

```<code>Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
    at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:696) ~[na:na]
    at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:181) ~[na:na]
    at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:146) ~[na:na]
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128) ~[example-native:na]
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[na:na]
    at org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:38) ~[na:na]
    at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:107) ~[na:na]
    ... 131 common frames omitted
2023-01-12T16:21:00.989-03:00  WARN 1 --- [io-5000-exec-22] o.s.b.a.health.HealthEndpointSupport     : Health contributor org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator (db) took 11371ms to respond
2023-01-12T16:21:00.993-03:00  WARN 1 --- [o-5000-exec-142] o.s.b.a.health.HealthEndpointSupport     : Health contributor org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator (db) took 11139ms to respond
</code>```

I tried delete the native app from kubernetes and created again but the error happen yet.
I tested the native app running out of kubernetes in a normal vm and the problem does not happen.

Body:
I have two apps one build is native and other is normal image(*.jar) and the apps running on kubernetes. After a time running the native image lost connection with database and loses performance. I think this problem is image I use.
The source code is the same.

I'm using this dockefile.

FROM buildpack-deps:22.04
ENV LD_LIBRARY_PATH=/usr/local/freetype/2_12_1/lib
RUN mkdir /app/
ADD . /app
WORKDIR /app
COPY target/example-native /app
CMD ["./example-native"]

Spring boot: 3.0.1

Mysql: 8.0.26

Kubernetes : 1.24

spring:
   datasource:
     url: ${JDBC_URL:jdbc:mysql://localhost:3306/database?allowPublicKeyRetrieval=true&useSSL=false}
     username: '${DATABASE_USER:root}'
     password: ${DATABASE_PASS:123456}
     hikari:
      maximumPoolSize: 5
      minimumIdle: 1
      keepaliveTime: 30000

Log error:

Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
    at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:696) ~[na:na]
    at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:181) ~[na:na]
    at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:146) ~[na:na]
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128) ~[example-native:na]
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[na:na]
    at org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:38) ~[na:na]
    at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:107) ~[na:na]
    ... 131 common frames omitted
2023-01-12T16:21:00.989-03:00  WARN 1 --- [io-5000-exec-22] o.s.b.a.health.HealthEndpointSupport     : Health contributor org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator (db) took 11371ms to respond
2023-01-12T16:21:00.993-03:00  WARN 1 --- [o-5000-exec-142] o.s.b.a.health.HealthEndpointSupport     : Health contributor org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator (db) took 11139ms to respond

I tried delete the native app from kubernetes and created again but the error happen yet.
I tested the native app running out of kubernetes in a normal vm and the problem does not happen.


问:
Replicating ESPN win probability with line chart
I'm trying to figure out how to replicate an ESPN win probability chart with line chart but can't figure out how to scale the axis. Any ideas?


问:
Trying to do a xlookup equivalent with pd.merge but not working
I apologize in advance, this my first time asking a question.

I am trying to match 'City' & 'State' in two different data frames and then bring matching lat & long coordinates.  Both data sets have 'City' & 'State' spelled the same and both columns have matching dtypes.

The output as far as the column names is correct, but the row contents are null for lat & long.  But for a city like Itacha NY, it definitely is in the zip_codes dataframe with lat & long.

script i've written

```<code>df_zips = pd.merge(df, zip_codes,
                    on = ['City', 'State'],
                    how = 'left')
df_zips
</code>```

screenshot of code

Body:
I apologize in advance, this my first time asking a question.

I am trying to match 'City' & 'State' in two different data frames and then bring matching lat & long coordinates.  Both data sets have 'City' & 'State' spelled the same and both columns have matching dtypes.

The output as far as the column names is correct, but the row contents are null for lat & long.  But for a city like Itacha NY, it definitely is in the zip_codes dataframe with lat & long.

script i've written

df_zips = pd.merge(df, zip_codes,
                    on = ['City', 'State'],
                    how = 'left')
df_zips

screenshot of code


问:
Protecting a Parse Dashboard
I have a parse/mongoDB running locally and am wondering about putting the Dashboard live for my client to access online.

Currently the endpoint /dashboard shows all the user data with read/write access, how do I go about deploying this live and keeping the /dashboard endpoint password protected or the Dashboard object itself ?

For more context this is a simple React app that stores user data in the MongoDB using Parse and the client will be needing to access these data at any point.

Googling many variants with no luck

Title: Protecting a Parse Dashboard


问:
Model JSON input data for JDBC Sink Connector
My goal is to process an input stream that contains DB updates coming from a legacy system and replicate it into a different DB. The messages have the following format:

Insert - The after struct contains the state of the table entry after the insert operation is complete. No before struct present;

Update - The before struct contains the state of the table entry before the update operation and the after struct only lists the modified fields along with the table key;

Delete - The before struct contains the state of the table entry before the delete operation and the after struct is not present in the message;

Examples:

Insert

```<code>{"table":"SCHEMA.TEST_TABLE","op_type":"I","after":{"id_test":8934,"test_value_1":26910,"test_value_2":"XYZ","test_value_3":"2023-01-12T18:32:13.781217"}}
</code>```

Update

```<code>{"table":"SCHEMA.TEST_TABLE","op_type":"U","before":{"id_test":8934,"test_value_1":26910,"test_value_2":"XYZ","test_value_3":"2023-01-12T18:32:13.781217"},"after":{"id_test":8934,"test_value_1":null,"test_value_3":"2023-01-12T18:32:18.787337"}}
</code>```

Delete

```<code>{"table":"SCHEMA.TEST_TABLE","op_type":"D","before":{"id_test":8934,"test_value_1":1499,"test_value_2":"XYZ","test_value_3":"2023-01-12T18:32:18.787337"}}
</code>```

After struggling a lot with trying to deal with the lack of a schema in the input messages, I turned to kSQL to overcome this and was able - not sure if by the best approach - to get ksql to generate a output topic that can be processed by a Kafka JDBC Sink Connector using a JSON_SR format.

The problem is that the output format I get in the output topic from ksql does not allow for a correct interpretation of all the scenarios - Only the Insert scenario is correctly interpreted.

The flow in ksql was:

Process input topic to map it as a JSON object by defining a schema. Created a stream where the input object is defined TEST_TABLE_INPUT):

```<code>CREATE OR REPLACE STREAM TEST_TABLE_INPUT (
  "table" VARCHAR,
  op_type VARCHAR,
  after STRUCT<
    id_test INTEGER, test_value_1 INTEGER, test_value_2 VARCHAR, test_value_3 VARCHAR
  >,
  before STRUCT<
    id_test INTEGER
  >
) WITH (kafka_topic='input_topic', value_format='JSON');
</code>```

Process TEST_TABLE_INPUT to flatten the input structures (tried using the BEFORE->* and AFTER->* strategy instead but got a Caused by: line 3:11: mismatched input '*' expecting ... error):

```<code>CREATE OR REPLACE STREAM TEST_TABLE_INTERNAL
AS SELECT
    OP_TYPE,
    BEFORE->id_test AS B_id_test,
    AFTER->id_test AS A_id_test,
    AFTER
  FROM TEST_TABLE_INPUT;
</code>```

With this the output stream is created:

```<code>CREATE OR REPLACE STREAM TEST_TABLE_UPDATES
WITH (
  VALUE_FORMAT='JSON_SR',
  KEY_FORMAT='JSON_SR',
  KAFKA_TOPIC='T_TEST_UPDATES'
)
AS SELECT
    COALESCE(B_id_test, A_id_test) AS id_test,
    AFTER->test_value_1 AS test_value_1,
    AFTER->test_value_2 AS test_value_2,
    AFTER->test_value_3 AS test_value_3
  FROM TEST_TABLE_INTERNAL
  PARTITION BY COALESCE(B_id_test, A_id_test)
;
</code>```

When processing the example input topic messages below

```<code>{"table":"SCHEMA.TEST_TABLE","op_type":"I","after":{"id_test":0,"test_value_1":17315,"test_value_2":"XYZ","test_value_3":"2023-01-12T19:06:49.694383"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"U","before":{"id_test":0,"test_value_1":17315,"test_value_2":"XYZ","test_value_3":"2023-01-12T19:06:49.694383"},"after":{"id_test":0,"test_value_1":null,"test_value_3":"2023-01-12T19:06:54.702107"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"D","before":{"id_test":0,"test_value_1":28605,"test_value_2":"XYZ","test_value_3":"2023-01-12T19:06:54.702107"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"I","after":{"id_test":1,"test_value_1":15601,"test_value_2":"KLM","test_value_3":"2023-01-12T19:07:04.716303"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"U","before":{"id_test":1,"test_value_1":15601,"test_value_2":"KLM","test_value_3":"2023-01-12T19:07:04.716303"},"after":{"id_test":1,"test_value_1":null,"test_value_3":"2023-01-12T19:07:09.723473"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"I","after":{"id_test":2,"test_value_1":13386,"test_value_2":"ABC","test_value_3":"2023-01-12T19:14:23.633204"}}
</code>```

to simulate the I, I-U and I-U-D scenarios the output I get in KSQL is:

```<code>ksql> SELECT * FROM TEST_TABLE_UPDATES EMIT CHANGES;
+----------+-------------+--------------+----------------------------+
|ID_TEST   |TEST_VALUE_1 |TEST_VALUE_2  |TEST_VALUE_3                |
+----------+-------------+--------------+----------------------------+
|0         |17315        |XYZ           |2023-01-12T19:06:49.694383  |
|0         |null         |null          |2023-01-12T19:06:54.702107  |
|0         |null         |null          |null                        |
|1         |15601        |KLM           |2023-01-12T19:07:04.716303  |
|1         |null         |null          |2023-01-12T19:07:09.723473  |
|2         |13386        |ABC           |2023-01-12T19:14:23.633204  |
</code>```

And outside of ksQL:

```<code>kafka-console-consumer.sh --property print.key=true --topic TEST_TABLE_UPDATES --from-beginning --bootstrap-server localhost:9092
0       {"TEST_VALUE_1":17315,"TEST_VALUE_2":"XYZ","TEST_VALUE_3":"2023-01-12T19:06:49.694383"}
0       {"TEST_VALUE_1":null,"TEST_VALUE_2":null,"TEST_VALUE_3":"2023-01-12T19:06:54.702107"}
0       {"TEST_VALUE_1":null,"TEST_VALUE_2":null,"TEST_VALUE_3":null}
1       {"TEST_VALUE_1":15601,"TEST_VALUE_2":"KLM","TEST_VALUE_3":"2023-01-12T19:07:04.716303"}
1       {"TEST_VALUE_1":null,"TEST_VALUE_2":null,"TEST_VALUE_3":"2023-01-12T19:07:09.723473"}
2       {"TEST_VALUE_1":13386,"TEST_VALUE_2":"ABC","TEST_VALUE_3":"2023-01-12T19:14:23.633204"}
</code>```

On top of this the Connector with the configuration as mentioned below is instantiated:

```<code>{
  "name": "t_test_updates-v2",
  "config": {
    "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
    "tasks.max": "1",
    "errors.log.enable": true,
    "errors.log.include.messages": true,
    "topics": "TEST_TABLE_UPDATES",
    "key.converter": "io.confluent.connect.json.JsonSchemaConverter",
    "key.converter.schemas.enable": false,
    "key.converter.schema.registry.url": "http://schema-registry:8081",
    "value.converter": "io.confluent.connect.json.JsonSchemaConverter",
    "value.converter.schemas.enable": false,
    "value.converter.schema.registry.url": "http://schema-registry:8081",
    "connection.url": "jdbc:oracle:thin:@database:1521/xe",
    "connection.user": "<REDACTED>",
    "connection.password": "<REDACTED>",
    "dialect.name": "OracleDatabaseDialect",
    "insert.mode": "upsert",
    "delete.enabled": true,
    "table.name.format": "TEST_TABLE_REPL",
    "pk.mode": "record_key",
    "pk.fields": "ID_TEST",
    "auto.create": false,
    "error.tolerance": "all"
  }
}
</code>```

Which processes the topic - apparently - without a problem but the output in the DB does not match the expected result:

```<code>SQL> select * from test_table_repl;

   ID_TEST    TEST_VALUE_1 TEST_VALUE_2       TEST_VALUE_3
__________ _______________ __________________ _____________________________
         1                                    2023-01-12T19:07:09.723473
         0
         2           13386 ABC                2023-01-12T19:14:23.633204
</code>```

I would expect the DB query to return:

```<code>   ID_TEST    TEST_VALUE_1 TEST_VALUE_2       TEST_VALUE_3
__________ _______________ __________________ _____________________________
         1                 KLM                2023-01-12T19:07:09.723473
         2           13386 ABC                2023-01-12T19:14:23.633204
</code>```

As it can be seen, only the insert scenario is correctly working.
I cannot understand what I am doing wrong.

Is it the data format, the connector configuration, both or another thing I am missing?

Body:
My goal is to process an input stream that contains DB updates coming from a legacy system and replicate it into a different DB. The messages have the following format:

Insert - The after struct contains the state of the table entry after the insert operation is complete. No before struct present;

Update - The before struct contains the state of the table entry before the update operation and the after struct only lists the modified fields along with the table key;

Delete - The before struct contains the state of the table entry before the delete operation and the after struct is not present in the message;

Examples:

Insert

{"table":"SCHEMA.TEST_TABLE","op_type":"I","after":{"id_test":8934,"test_value_1":26910,"test_value_2":"XYZ","test_value_3":"2023-01-12T18:32:13.781217"}}

Update

{"table":"SCHEMA.TEST_TABLE","op_type":"U","before":{"id_test":8934,"test_value_1":26910,"test_value_2":"XYZ","test_value_3":"2023-01-12T18:32:13.781217"},"after":{"id_test":8934,"test_value_1":null,"test_value_3":"2023-01-12T18:32:18.787337"}}

Delete

{"table":"SCHEMA.TEST_TABLE","op_type":"D","before":{"id_test":8934,"test_value_1":1499,"test_value_2":"XYZ","test_value_3":"2023-01-12T18:32:18.787337"}}

After struggling a lot with trying to deal with the lack of a schema in the input messages, I turned to kSQL to overcome this and was able - not sure if by the best approach - to get ksql to generate a output topic that can be processed by a Kafka JDBC Sink Connector using a JSON_SR format.

The problem is that the output format I get in the output topic from ksql does not allow for a correct interpretation of all the scenarios - Only the Insert scenario is correctly interpreted.

The flow in ksql was:

Process input topic to map it as a JSON object by defining a schema. Created a stream where the input object is defined TEST_TABLE_INPUT):

CREATE OR REPLACE STREAM TEST_TABLE_INPUT (
  "table" VARCHAR,
  op_type VARCHAR,
  after STRUCT<
    id_test INTEGER, test_value_1 INTEGER, test_value_2 VARCHAR, test_value_3 VARCHAR
  >,
  before STRUCT<
    id_test INTEGER
  >
) WITH (kafka_topic='input_topic', value_format='JSON');

Process TEST_TABLE_INPUT to flatten the input structures (tried using the BEFORE->* and AFTER->* strategy instead but got a Caused by: line 3:11: mismatched input '*' expecting ... error):

CREATE OR REPLACE STREAM TEST_TABLE_INTERNAL
AS SELECT
    OP_TYPE,
    BEFORE->id_test AS B_id_test,
    AFTER->id_test AS A_id_test,
    AFTER
  FROM TEST_TABLE_INPUT;

With this the output stream is created:

CREATE OR REPLACE STREAM TEST_TABLE_UPDATES
WITH (
  VALUE_FORMAT='JSON_SR',
  KEY_FORMAT='JSON_SR',
  KAFKA_TOPIC='T_TEST_UPDATES'
)
AS SELECT
    COALESCE(B_id_test, A_id_test) AS id_test,
    AFTER->test_value_1 AS test_value_1,
    AFTER->test_value_2 AS test_value_2,
    AFTER->test_value_3 AS test_value_3
  FROM TEST_TABLE_INTERNAL
  PARTITION BY COALESCE(B_id_test, A_id_test)
;

When processing the example input topic messages below

{"table":"SCHEMA.TEST_TABLE","op_type":"I","after":{"id_test":0,"test_value_1":17315,"test_value_2":"XYZ","test_value_3":"2023-01-12T19:06:49.694383"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"U","before":{"id_test":0,"test_value_1":17315,"test_value_2":"XYZ","test_value_3":"2023-01-12T19:06:49.694383"},"after":{"id_test":0,"test_value_1":null,"test_value_3":"2023-01-12T19:06:54.702107"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"D","before":{"id_test":0,"test_value_1":28605,"test_value_2":"XYZ","test_value_3":"2023-01-12T19:06:54.702107"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"I","after":{"id_test":1,"test_value_1":15601,"test_value_2":"KLM","test_value_3":"2023-01-12T19:07:04.716303"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"U","before":{"id_test":1,"test_value_1":15601,"test_value_2":"KLM","test_value_3":"2023-01-12T19:07:04.716303"},"after":{"id_test":1,"test_value_1":null,"test_value_3":"2023-01-12T19:07:09.723473"}}
{"table":"SCHEMA.TEST_TABLE","op_type":"I","after":{"id_test":2,"test_value_1":13386,"test_value_2":"ABC","test_value_3":"2023-01-12T19:14:23.633204"}}

to simulate the I, I-U and I-U-D scenarios the output I get in KSQL is:

ksql> SELECT * FROM TEST_TABLE_UPDATES EMIT CHANGES;
+----------+-------------+--------------+----------------------------+
|ID_TEST   |TEST_VALUE_1 |TEST_VALUE_2  |TEST_VALUE_3                |
+----------+-------------+--------------+----------------------------+
|0         |17315        |XYZ           |2023-01-12T19:06:49.694383  |
|0         |null         |null          |2023-01-12T19:06:54.702107  |
|0         |null         |null          |null                        |
|1         |15601        |KLM           |2023-01-12T19:07:04.716303  |
|1         |null         |null          |2023-01-12T19:07:09.723473  |
|2         |13386        |ABC           |2023-01-12T19:14:23.633204  |

And outside of ksQL:

kafka-console-consumer.sh --property print.key=true --topic TEST_TABLE_UPDATES --from-beginning --bootstrap-server localhost:9092
0       {"TEST_VALUE_1":17315,"TEST_VALUE_2":"XYZ","TEST_VALUE_3":"2023-01-12T19:06:49.694383"}
0       {"TEST_VALUE_1":null,"TEST_VALUE_2":null,"TEST_VALUE_3":"2023-01-12T19:06:54.702107"}
0       {"TEST_VALUE_1":null,"TEST_VALUE_2":null,"TEST_VALUE_3":null}
1       {"TEST_VALUE_1":15601,"TEST_VALUE_2":"KLM","TEST_VALUE_3":"2023-01-12T19:07:04.716303"}
1       {"TEST_VALUE_1":null,"TEST_VALUE_2":null,"TEST_VALUE_3":"2023-01-12T19:07:09.723473"}
2       {"TEST_VALUE_1":13386,"TEST_VALUE_2":"ABC","TEST_VALUE_3":"2023-01-12T19:14:23.633204"}

On top of this the Connector with the configuration as mentioned below is instantiated:

{
  "name": "t_test_updates-v2",
  "config": {
    "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
    "tasks.max": "1",
    "errors.log.enable": true,
    "errors.log.include.messages": true,
    "topics": "TEST_TABLE_UPDATES",
    "key.converter": "io.confluent.connect.json.JsonSchemaConverter",
    "key.converter.schemas.enable": false,
    "key.converter.schema.registry.url": "http://schema-registry:8081",
    "value.converter": "io.confluent.connect.json.JsonSchemaConverter",
    "value.converter.schemas.enable": false,
    "value.converter.schema.registry.url": "http://schema-registry:8081",
    "connection.url": "jdbc:oracle:thin:@database:1521/xe",
    "connection.user": "<REDACTED>",
    "connection.password": "<REDACTED>",
    "dialect.name": "OracleDatabaseDialect",
    "insert.mode": "upsert",
    "delete.enabled": true,
    "table.name.format": "TEST_TABLE_REPL",
    "pk.mode": "record_key",
    "pk.fields": "ID_TEST",
    "auto.create": false,
    "error.tolerance": "all"
  }
}

Which processes the topic - apparently - without a problem but the output in the DB does not match the expected result:

SQL> select * from test_table_repl;

   ID_TEST    TEST_VALUE_1 TEST_VALUE_2       TEST_VALUE_3
__________ _______________ __________________ _____________________________
         1                                    2023-01-12T19:07:09.723473
         0
         2           13386 ABC                2023-01-12T19:14:23.633204

I would expect the DB query to return:

   ID_TEST    TEST_VALUE_1 TEST_VALUE_2       TEST_VALUE_3
__________ _______________ __________________ _____________________________
         1                 KLM                2023-01-12T19:07:09.723473
         2           13386 ABC                2023-01-12T19:14:23.633204

As it can be seen, only the insert scenario is correctly working.
I cannot understand what I am doing wrong.

Is it the data format, the connector configuration, both or another thing I am missing?


问:
Neural Networks valueError in model.fit
I am currently trying to train a model in order to do sentiment analysis on an IMDB database on kaggle.

When trying to use model fit

```<code>    train = model.fit(X_train, y_train, validation_data=(X_test,y_test),epochs=2)
</code>```

I encounter the following error:

ValueError: Input 0 of layer sequential_2 is incompatible with the layer: expected axis -1 of input shape to have value 34994 but received input with shape (None, 17576)

please note that i previously tried to convert the strings like that in order for it to be accepted by my model:

```<code>vectorizer = CountVectorizer()
vectorizer.fit(X)
X_train = vectorizer.fit_transform(X_train)
X_train = X_train.toarray()
X_test = vectorizer.fit_transform(X_test)
X_test = X_test.toarray()
</code>```

my guess is that something went wrong with y_train and y_test but i can't find what it is since the two only values that it can take are 0 and 1, I should not have problem ?

Title: Neural Networks valueError in model.fit

Body:
I am currently trying to train a model in order to do sentiment analysis on an IMDB database on kaggle.

When trying to use model fit

    train = model.fit(X_train, y_train, validation_data=(X_test,y_test),epochs=2)

I encounter the following error:

ValueError: Input 0 of layer sequential_2 is incompatible with the layer: expected axis -1 of input shape to have value 34994 but received input with shape (None, 17576)

please note that i previously tried to convert the strings like that in order for it to be accepted by my model:

vectorizer = CountVectorizer()
vectorizer.fit(X)
X_train = vectorizer.fit_transform(X_train)
X_train = X_train.toarray()
X_test = vectorizer.fit_transform(X_test)
X_test = X_test.toarray()

my guess is that something went wrong with y_train and y_test but i can't find what it is since the two only values that it can take are 0 and 1, I should not have problem ?


问:
getting error during convert audio blob to array buffer wav
I have to send audio stream from microphone with websocket as wav format,
during convert convert audio buffer array to wav I get this error:

DOMException: Failed to execute 'decodeAudioData' on 'BaseAudioContext': Unable to decode audio data

I tried javascript-processor-node for this but it was deprecated, I think audio worklet for sending simple converted format on websocket stream is too much for task like this!

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <button id="button">test</button>

```


问:
How to recover from OOM in WebGL in Safari when textures are too big?
Safari in iOS seems to be artificially more resource limited (smaller texture or geometry size limits) than any other browser, and crashes often with WebGL scenes I'm making.

aside:  For reference, I'm testing in Safari on iOS 13 Pro, comparing to Chrome on Pixel 6 Pro, both two of the best phones, and I have no problems loading my WebGL scenes in Chrome at all, but Safari always crashes

When such crashes happen in Safari, the web page is discarded, and the Safari tab shows the message a problem repeatedly occurred. There is no output to console, no error to catch.

How does one catch these problems, and for example, downgrade resources (for example, load smaller textures as needed)?

In my particular cases, these crashes happen when the resources loaded into WebGL are too big, f.e. lots of vertices in a geometry and/or large textures (f.e. large shadow map for light shadows).

The problem is, there does not seem to be any way to normally catch such errors (f.e. can't use try-catch), because nothing is thrown, the tab simply crashes.

How do you deal with this?


问:
Camera video not showing on iOS
I'm attempting to access the camera of a current user device and display the camera's video before they can take a picture. It works perfectly on Android and browsers, but not on iPhones for some strange reason. Even when the screen is black, I can still capture a picture. It's just a dark video camera.

Snippet of the code

  useEffect(() => {
    navigator.mediaDevices
      .enumerateDevices()
      .then(function (devices) {
        devices.forEach(function (device) {
          if (device.kind == "videoinput") {
            let temp = videoInputs;
            temp.push(
              device.kind + ": " + device.label + " id = " + device.deviceId
            );
            setVideoInputs(temp);
          }
        });
      })
      .catch(function (err) {
        console.log(err.name + ": " + err.message);
      });
  }, []);

  const getVideo = () => {
    navigator.mediaDevices
      .getUserMedia({
        video: {
          // width: 1920,
          // height: 1080,
          facingMode: orientation ? "environment" : "user",
        },
      })
      .then((stream) => {
        console.log(stream);
        setError("");
        setVideoStream(stream);
        let video = videoRef.current;
        video.srcObject = stream;
        video.play();
      })
      .catch((err) => {
        setError(err.toString())
        // setError("Permission denied. Turn on your camera to continue");
        console.error(err);
      });
  };

  useEffect(() => {
    getVideo();
    return () => {
      stopVideo();
    };
  }, [orientation]);

```

Title: Camera video not showing on iOS


问:
Add font awsome icons to a JavaScript file
I have created a webpage with this layout:

```<code><html>
    <head>
        <title>My Website</title>
        <script src="Link to Font Awesome Kit Code" crossorigin="anonymous"></script>
        <script src="header.js" type="text/javascript" defer></script>
    </head>
    <body>
        <header-component></header-component>
    </body>
</html>
</code>```

I have created a JavaScript file named "header.js" with this layout:

```<code>const headerTemplate = document.createElement('template');

headerTemplate.innerHTML = `
    <p>This font awesome icon has been put on this webpage using JavaScript</p>
    <i class="fa-solid fa-envelope"></i>
`

class Header extends HTMLElement {
  constructor() {
    super();
  }

  connectedCallback() {
    const shadowRoot = this.attachShadow({ mode: 'closed' });

    shadowRoot.appendChild(headerTemplate.content);
  }
}

customElements.define('header-component', Header);
</code>```

The paragraph tag showed up correctly.

I also expected the font awesome icon to show up correctly, as the script tag to font awesome has been written in the head of the HTML document. However, no icon has showed up. I have also tried to write the script tag at the top of the JavaScript document, as well as inside the innerHTML of the JavaScript document. However, this has not resulted in the font awesome icon showing. Instead, the output remains the same.

I wrote the 'i' tag inside the HTML document, to test if the error was inside the HTML code, rather than the JavaScript. However, inside the HTML document, the 'i' tag worked correctly.

Body:
I have created a webpage with this layout:

        <title>My Website</title>

I have created a JavaScript file named "header.js" with this layout:

const headerTemplate = document.createElement('template');

headerTemplate.innerHTML = `

This font awesome icon has been put on this webpage using JavaScript

`

class Header extends HTMLElement {
  constructor() {
    super();
  }

  connectedCallback() {
    const shadowRoot = this.attachShadow({ mode: 'closed' });

    shadowRoot.appendChild(headerTemplate.content);
  }
}

customElements.define('header-component', Header);

The paragraph tag showed up correctly.

I also expected the font awesome icon to show up correctly, as the script tag to font awesome has been written in the head of the HTML document. However, no icon has showed up. I have also tried to write the script tag at the top of the JavaScript document, as well as inside the innerHTML of the JavaScript document. However, this has not resulted in the font awesome icon showing. Instead, the output remains the same.

I wrote the 'i' tag inside the HTML document, to test if the error was inside the HTML code, rather than the JavaScript. However, inside the HTML document, the 'i' tag worked correctly.


问:
Why am I getting a 'wrong number of arguments (given 1, expected 2..3)' error when trying to execute a prepared statement in PostgreSQL using Ruby?
I am trying to execute a prepared statement in PostgreSQL using the pg gem in Ruby. I am using the conn.prepare method to prepare the statement, and exec_prepared to execute the statement with the parameters. However, I am getting the following error:

```<code>wrong number of arguments (given 1, expected 2..3) (ArgumentError)

</code>```

Here is the offending code:

```<code>conn = PG.connect(host: 'localhost', dbname: 'mydb', password: 'password')
stmt = conn.prepare("SELECT id FROM websites WHERE url = $1")
result = stmt.exec_prepared('myurl')
</code>```

I have checked and the table and column exist, and the user I am connecting to the database has the proper permissions to execute a SELECT statement on the table. Also, checked that the statement works in the PostgreSQL cli to be double sure. I am not sure why I am getting this error. Can anyone help me understand what is causing this and how to fix it?

Body:
I am trying to execute a prepared statement in PostgreSQL using the pg gem in Ruby. I am using the conn.prepare method to prepare the statement, and exec_prepared to execute the statement with the parameters. However, I am getting the following error:

wrong number of arguments (given 1, expected 2..3) (ArgumentError)

Here is the offending code:

conn = PG.connect(host: 'localhost', dbname: 'mydb', password: 'password')
stmt = conn.prepare("SELECT id FROM websites WHERE url = $1")
result = stmt.exec_prepared('myurl')

I have checked and the table and column exist, and the user I am connecting to the database has the proper permissions to execute a SELECT statement on the table. Also, checked that the statement works in the PostgreSQL cli to be double sure. I am not sure why I am getting this error. Can anyone help me understand what is causing this and how to fix it?