问:
I m trying to list a class object inside a class object in asp.net webservice using c#
I have to define class data and make it a list. I have a ItemDetails class,i have to define it's datamembers in InvoiceRoot Class. When i'm defining it's data seperately it's working fine and making list. But when I do it insidethe class object of InvoiceRoot class,it doesn't work the for loop doesn't work. So How can I make the list of ItemDetails datamembers

Here I make the list by initializing the class object separately:

```<code>  List<ItemDetails> ItemLists = new List<ItemDetails>();
        for (int i = 0; i < serial_no; i++)
        {

            ItemLists.Add(new ItemDetails
            {
                SlNo = (string)All_SerialNo[i],
                PrdDesc = null,
                IsServc = item_isservice,
                HsnCd = item_hsncode[i].ToString(),
                Barcde = null,
                Qty = Convert.ToDecimal(item_quantity[i].ToString()),
                FreeQty = Convert.ToDecimal(item_freeqty[i].ToString()),
                Unit = null,
                UnitPrice = Convert.ToDecimal(item_rate[i].ToString()),
                TotAmt = Convert.ToDecimal(item_total_price[i].ToString()),
                Discount = Convert.ToDecimal(item_discount[i].ToString()),
                PreTaxVal = Convert.ToDecimal(item_taxable_amount[i].ToString()),
                AssAmt = Convert.ToDecimal(item_taxable_amount[i].ToString()) - Convert.ToDecimal(item_discount[i].ToString()),
                GstRt = 9,
                IgstAmt = Convert.ToDecimal(item_IGST_Amt[i].ToString()),
                CgstAmt = Convert.ToDecimal(item_CGST_Amt[i].ToString()),
                SgstAmt = Convert.ToDecimal(item_SGST_Amt[i].ToString()),
                CesRt = 0,
                CesAmt = 0,
                OthChrg = 0,
                StateCesRt = 0,
                StateCesAmt = 0,
                StateCesNonAdvlAmt = 0,
                TotItemVal = item_totalvalue[i].ToString(),
                OrdLineRef = null,
                OrgCntry = null,
                PrdSlNo = null,
                BchDtls = null,
            });
        }

</code>```

Here I am trying make the list inside the InvoiceRoot class object

```<code>  InvoiceRoot invoice = new InvoiceRoot
        {
                Version = "1.1",
                DocDtls = new DocumentDetails
                {
                    Typ = "Invoice",
                    No = invoice_no.ToString(),
                    Dt = invoice_date
                },
               ItemList = new List<ItemDetails>
                {

                   new ItemDetails
                   {
                       for (int i = 0; i < serial_no; i++)
                          {

                            ItemLists.Add(new ItemDetails
                               {
                                 SlNo = (string)All_SerialNo[i],
                                 PrdDesc = null,
                                 IsServc = item_isservice,
                                 HsnCd = item_hsncode[i].ToString(),
                                 Barcde = null,
                                 Qty = Convert.ToDecimal(item_quantity[i].ToString()),
                                 FreeQty = Convert.ToDecimal(item_freeqty[i].ToString()),
                                 Unit = null,
                                 UnitPrice = Convert.ToDecimal(item_rate[i].ToString()),
                                 TotAmt = Convert.ToDecimal(item_total_price[i].ToString()),
                                 Discount = Convert.ToDecimal(item_discount[i].ToString()),
                                 PreTaxVal = Convert.ToDecimal(item_taxable_amount[i].ToString()),
                                 AssAmt = Convert.ToDecimal(item_taxable_amount[i].ToString()) - Convert.ToDecimal(item_discount[i].ToString()),
                                 GstRt = 9,
                                 IgstAmt = Convert.ToDecimal(item_IGST_Amt[i].ToString()),
                                 CgstAmt = Convert.ToDecimal(item_CGST_Amt[i].ToString()),
                                 SgstAmt = Convert.ToDecimal(item_SGST_Amt[i].ToString()),
                                 CesRt = 0,
                                 CesAmt = 0,
                                 OthChrg = 0,
                                 StateCesRt = 0,
                                 StateCesAmt = 0,
                                 StateCesNonAdvlAmt = 0,
                                 TotItemVal = item_totalvalue[i].ToString(),
                                 OrdLineRef = null,
                                 OrgCntry = null,
                                 PrdSlNo = null,
                                 BchDtls = null,
                              });
                           }
               }
</code>```

I Want Such Output:

```<code>
[
{
 "Version":"1.1",
 "DocDtls": {
    "Typ": "Invoice",
    "No": "6",
    "Dt": "4/1/2022"
  },
 "ItemList":[{
"SlNo": "9",
    "PrdDesc": null,
    "IsServc": "Y",
    "HsnCd": "22029030",
    "Barcde": null,
    "Qty": 1.0,
    "FreeQty": 0.0,
    "Unit": null,
    "UnitPrice": 600.84,
    "TotAmt": 600.84,
    "Discount": 0.00,
    "PreTaxVal": 600.84,
    "AssAmt": 600.84,
    "GstRt": 9,
    "IgstAmt": 0.0,
    "CgstAmt": 36.05,
    "SgstAmt": 36.05,
    "CesRt": 0,
    "CesAmt": 0,
    "OthChrg": 0,
    "StateCesRt": 0,
    "StateCesAmt": 0,
    "StateCesNonAdvlAmt": 0,
    "TotItemVal": "672.94",
    "OrdLineRef": null,
    "PrdSlNo": null,
    "OrgCntry": null,
    "BchDtls": null,
    "Attributedetails": null
  },
  {
    "SlNo": "10",
    "PrdDesc": null,
    "IsServc": "Y",
    "HsnCd": "22029090",
    "Barcde": null,
    "Qty": 3.0,
    "FreeQty": 0.0,
    "Unit": null,
    "UnitPrice": 1641.38,
    "TotAmt": 4924.14,
    "Discount": 0.00,
    "PreTaxVal": 4924.14,
    "AssAmt": 4924.14,
    "GstRt": 9,
    "IgstAmt": 0.0,
    "CgstAmt": 295.45,
    "SgstAmt": 295.45,
    "CesRt": 0,
    "CesAmt": 0,
    "OthChrg": 0,
    "StateCesRt": 0,
    "StateCesAmt": 0,
    "StateCesNonAdvlAmt": 0,
    "TotItemVal": "5515.04",
    "OrdLineRef": null,
    "PrdSlNo": null,
    "OrgCntry": null,
    "BchDtls": null,
    "Attributedetails": null
  }
]
}
]
</code>```

Body:
I have to define class data and make it a list. I have a ItemDetails class,i have to define it's datamembers in InvoiceRoot Class. When i'm defining it's data seperately it's working fine and making list. But when I do it insidethe class object of InvoiceRoot class,it doesn't work the for loop doesn't work. So How can I make the list of ItemDetails datamembers

Here I make the list by initializing the class object separately:

  List<ItemDetails> ItemLists = new List<ItemDetails>();
        for (int i = 0; i < serial_no; i++)
        {

            ItemLists.Add(new ItemDetails
            {
                SlNo = (string)All_SerialNo[i],
                PrdDesc = null,
                IsServc = item_isservice,
                HsnCd = item_hsncode[i].ToString(),
                Barcde = null,
                Qty = Convert.ToDecimal(item_quantity[i].ToString()),
                FreeQty = Convert.ToDecimal(item_freeqty[i].ToString()),
                Unit = null,
                UnitPrice = Convert.ToDecimal(item_rate[i].ToString()),
                TotAmt = Convert.ToDecimal(item_total_price[i].ToString()),
                Discount = Convert.ToDecimal(item_discount[i].ToString()),
                PreTaxVal = Convert.ToDecimal(item_taxable_amount[i].ToString()),
                AssAmt = Convert.ToDecimal(item_taxable_amount[i].ToString()) - Convert.ToDecimal(item_discount[i].ToString()),
                GstRt = 9,
                IgstAmt = Convert.ToDecimal(item_IGST_Amt[i].ToString()),
                CgstAmt = Convert.ToDecimal(item_CGST_Amt[i].ToString()),
                SgstAmt = Convert.ToDecimal(item_SGST_Amt[i].ToString()),
                CesRt = 0,
                CesAmt = 0,
                OthChrg = 0,
                StateCesRt = 0,
                StateCesAmt = 0,
                StateCesNonAdvlAmt = 0,
                TotItemVal = item_totalvalue[i].ToString(),
                OrdLineRef = null,
                OrgCntry = null,
                PrdSlNo = null,
                BchDtls = null,
            });
        }

Here I am trying make the list inside the InvoiceRoot class object

  InvoiceRoot invoice = new InvoiceRoot
        {
                Version = "1.1",
                DocDtls = new DocumentDetails
                {
                    Typ = "Invoice",
                    No = invoice_no.ToString(),
                    Dt = invoice_date
                },
               ItemList = new List<ItemDetails>
                {

                   new ItemDetails
                   {
                       for (int i = 0; i < serial_no; i++)
                          {

                            ItemLists.Add(new ItemDetails
                               {
                                 SlNo = (string)All_SerialNo[i],
                                 PrdDesc = null,
                                 IsServc = item_isservice,
                                 HsnCd = item_hsncode[i].ToString(),
                                 Barcde = null,
                                 Qty = Convert.ToDecimal(item_quantity[i].ToString()),
                                 FreeQty = Convert.ToDecimal(item_freeqty[i].ToString()),
                                 Unit = null,
                                 UnitPrice = Convert.ToDecimal(item_rate[i].ToString()),
                                 TotAmt = Convert.ToDecimal(item_total_price[i].ToString()),
                                 Discount = Convert.ToDecimal(item_discount[i].ToString()),
                                 PreTaxVal = Convert.ToDecimal(item_taxable_amount[i].ToString()),
                                 AssAmt = Convert.ToDecimal(item_taxable_amount[i].ToString()) - Convert.ToDecimal(item_discount[i].ToString()),
                                 GstRt = 9,
                                 IgstAmt = Convert.ToDecimal(item_IGST_Amt[i].ToString()),
                                 CgstAmt = Convert.ToDecimal(item_CGST_Amt[i].ToString()),
                                 SgstAmt = Convert.ToDecimal(item_SGST_Amt[i].ToString()),
                                 CesRt = 0,
                                 CesAmt = 0,
                                 OthChrg = 0,
                                 StateCesRt = 0,
                                 StateCesAmt = 0,
                                 StateCesNonAdvlAmt = 0,
                                 TotItemVal = item_totalvalue[i].ToString(),
                                 OrdLineRef = null,
                                 OrgCntry = null,
                                 PrdSlNo = null,
                                 BchDtls = null,
                              });
                           }
               }

I Want Such Output:

[
{
 "Version":"1.1",
 "DocDtls": {
    "Typ": "Invoice",
    "No": "6",
    "Dt": "4/1/2022"
  },
 "ItemList":[{
"SlNo": "9",
    "PrdDesc": null,
    "IsServc": "Y",
    "HsnCd": "22029030",
    "Barcde": null,
    "Qty": 1.0,
    "FreeQty": 0.0,
    "Unit": null,
    "UnitPrice": 600.84,
    "TotAmt": 600.84,
    "Discount": 0.00,
    "PreTaxVal": 600.84,
    "AssAmt": 600.84,
    "GstRt": 9,
    "IgstAmt": 0.0,
    "CgstAmt": 36.05,
    "SgstAmt": 36.05,
    "CesRt": 0,
    "CesAmt": 0,
    "OthChrg": 0,
    "StateCesRt": 0,
    "StateCesAmt": 0,
    "StateCesNonAdvlAmt": 0,
    "TotItemVal": "672.94",
    "OrdLineRef": null,
    "PrdSlNo": null,
    "OrgCntry": null,
    "BchDtls": null,
    "Attributedetails": null
  },
  {
    "SlNo": "10",
    "PrdDesc": null,
    "IsServc": "Y",
    "HsnCd": "22029090",
    "Barcde": null,
    "Qty": 3.0,
    "FreeQty": 0.0,
    "Unit": null,
    "UnitPrice": 1641.38,
    "TotAmt": 4924.14,
    "Discount": 0.00,
    "PreTaxVal": 4924.14,
    "AssAmt": 4924.14,
    "GstRt": 9,
    "IgstAmt": 0.0,
    "CgstAmt": 295.45,
    "SgstAmt": 295.45,
    "CesRt": 0,
    "CesAmt": 0,
    "OthChrg": 0,
    "StateCesRt": 0,
    "StateCesAmt": 0,
    "StateCesNonAdvlAmt": 0,
    "TotItemVal": "5515.04",
    "OrdLineRef": null,
    "PrdSlNo": null,
    "OrgCntry": null,
    "BchDtls": null,
    "Attributedetails": null
  }
]
}
]


来源: stackexchange

问:
getting Unable to read data from the transport connection: An established connection was aborted by the software in your host machine error
I am trying to upload data (Zip files) chunk by chunk (each chunk size is max 250 MB) to some third-party server by using API endpoint. However, occasionally, I am getting below error.

System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.

Sample code below

```<code>var httpClient = GetHttpClientFromFactory();
var filesList = UploadProcess.getFileList(“path”);
foreach (var file in filesList)
{

var byteArray = File.ReadAllBytes(filePath);
                    var form = new MultipartFormDataContent();
                    var fileContent = new ByteArrayContent(byteArray, 0, byteArray.Length);
                    fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
                    form.Add(fileContent, "zipFile", fileInfo.Name);
//first trigger the post method to initiate the batch as per the API Summary.
AsyncRetryPolicy<HttpResponseMessage> retryPolicyPost = Policy.Handle<HttpRequestException>().
                                   OrResult<HttpResponseMessage>(r => r != null &&
                                   (
!r.IsSuccessStatusCode))
                                 .WaitAndRetryAsync(3, times => TimeSpan.FromMilliseconds(times * retryTimespan),
                                  onRetry: (response, delay, retryCount, context) =>
                                  {
//log retry
}

HttpResponseMessage postResponse = await retryPolicyPost.ExecuteAsync(async () =>
                            {
                                httpClient.Timeout = TimeSpan.FromMinutes(10);

                                var request = new HttpRequestMessage(HttpMethod.Post, "URL");
                                request.Headers.Accept.Clear();
                                request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
                                request.Content = form;

                                var postBatchResponse = await httpClient.SendAsync(request);
                                return postBatchResponse;
                            });

if (postResponse.IsSuccessStatusCode)
                                {

                                    var readTask = postResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                                    var httpPostResponseResult = readTask.GetAwaiter().GetResult();
                                    postResponse.EnsureSuccessStatusCode();
                                    result = JsonConvert.DeserializeObject<FileUploadResult>(httpPostResponseResult);
                                }
</code>```
```<code>--------------------------------
private static void ConfigureServices(ServiceCollection services)
        {
            var proxy = new System.Net.WebProxy()
            {
                Address = new Uri($"@@@@@"), //proxy address
                UseDefaultCredentials = false,

            };
            services
            .AddHttpClient(NamedHttpClients.ProxiedClient)
            .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler()
            {
                UseProxy = true
                Proxy = proxy,
                SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls,
            });
        }
        public static HttpClient GetHttpClientFromFactory()
        {
            var serviceCollection = new ServiceCollection();
            ConfigureServices(serviceCollection);
            var service = serviceCollection.BuildServiceProvider();
            var httClientFactory = service.GetRequiredService<IHttpClientFactory>();
   var httpClient = httClientFactory.CreateClient(NamedHttpClients.ProxiedClient);
            return httpClient;
        }

--------------------------------
</code>```

I appreciate your response.

ContentLicense: CC BY-SA 4.0

Body:
I am trying to upload data (Zip files) chunk by chunk (each chunk size is max 250 MB) to some third-party server by using API endpoint. However, occasionally, I am getting below error.

System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.

Sample code below

var httpClient = GetHttpClientFromFactory();
var filesList = UploadProcess.getFileList(“path”);
foreach (var file in filesList)
{

var byteArray = File.ReadAllBytes(filePath);
                    var form = new MultipartFormDataContent();
                    var fileContent = new ByteArrayContent(byteArray, 0, byteArray.Length);
                    fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
                    form.Add(fileContent, "zipFile", fileInfo.Name);
//first trigger the post method to initiate the batch as per the API Summary.
AsyncRetryPolicy<HttpResponseMessage> retryPolicyPost = Policy.Handle<HttpRequestException>().
                                   OrResult<HttpResponseMessage>(r => r != null &&
                                   (
!r.IsSuccessStatusCode))
                                 .WaitAndRetryAsync(3, times => TimeSpan.FromMilliseconds(times * retryTimespan),
                                  onRetry: (response, delay, retryCount, context) =>
                                  {
//log retry
}

HttpResponseMessage postResponse = await retryPolicyPost.ExecuteAsync(async () =>
                            {
                                httpClient.Timeout = TimeSpan.FromMinutes(10);

                                var request = new HttpRequestMessage(HttpMethod.Post, "URL");
                                request.Headers.Accept.Clear();
                                request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
                                request.Content = form;

                                var postBatchResponse = await httpClient.SendAsync(request);
                                return postBatchResponse;
                            });

if (postResponse.IsSuccessStatusCode)
                                {

                                    var readTask = postResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                                    var httpPostResponseResult = readTask.GetAwaiter().GetResult();
                                    postResponse.EnsureSuccessStatusCode();
                                    result = JsonConvert.DeserializeObject<FileUploadResult>(httpPostResponseResult);
                                }

--------------------------------
private static void ConfigureServices(ServiceCollection services)
        {
            var proxy = new System.Net.WebProxy()
            {
                Address = new Uri($"@@@@@"), //proxy address
                UseDefaultCredentials = false,

            };
            services
            .AddHttpClient(NamedHttpClients.ProxiedClient)
            .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler()
            {
                UseProxy = true
                Proxy = proxy,
                SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls,
            });
        }
        public static HttpClient GetHttpClientFromFactory()
        {
            var serviceCollection = new ServiceCollection();
            ConfigureServices(serviceCollection);
            var service = serviceCollection.BuildServiceProvider();
            var httClientFactory = service.GetRequiredService<IHttpClientFactory>();
   var httpClient = httClientFactory.CreateClient(NamedHttpClients.ProxiedClient);
            return httpClient;
        }

--------------------------------

I appreciate your response.


问:
problem of variable assign to a column [3] in the problem
```<code>buy_traded_stock = ['TATACHEM-EQ', 'JINDALSTEL-EQ', 'UBL-EQ']

WeeklyExpiry = '2022-12-29'
bn = buy_traded_stock[1]
print(bn)
 if column[6] == PE_PRICE_2 and column[3] == bn and column[5] == WeeklyExpiry and column[9] == 'CE' :
                    orders.append(column[2])
                    print("\n CALL CONTRACT BUY EXECUTED :" , column[2])
                    order_id = (f"{exchange}:{column[2]}")
                    orders.append(order_id)
                    print(orders)

</code>```

column[3] = bn
its not working but when print(bn) its showing but when its assign to column its not working

Body:
buy_traded_stock = ['TATACHEM-EQ', 'JINDALSTEL-EQ', 'UBL-EQ']

WeeklyExpiry = '2022-12-29'
bn = buy_traded_stock[1]
print(bn)
 if column[6] == PE_PRICE_2 and column[3] == bn and column[5] == WeeklyExpiry and column[9] == 'CE' :
                    orders.append(column[2])
                    print("\n CALL CONTRACT BUY EXECUTED :" , column[2])
                    order_id = (f"{exchange}:{column[2]}")
                    orders.append(order_id)
                    print(orders)

column[3] = bn
its not working but when print(bn) its showing but when its assign to column its not working


问:
SpringBoot + JWT Filter : disable tracing managed ExpiredJwtException
I have a simple Spring Boot project where I implemented a JwtAuthenticationFilter. In case of an expired JWT token, the ExpiredJwtException is thrown and I managed the response accordingly.

While everything is working as expected, I continue to log the full stack trace of the ExpiredJwtException, which is not needed and pollutes my log files.

Here is the simple code :

```<code>    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
            throws ServletException, IOException {

        String authTokenStr = jwtBearerTokenExtractor.extractHeaderToken(request);

        try {
            // This can throw the ExpiredJwtException (child of JwtException, managed below)
            AppUserDetails userDetails = jwtTokenFactory.buildAuthFromToken(authTokenStr);

            // Do stuffwith userDetails and SecurityContextHolder
            ...
            chain.doFilter(request, response);

        } catch (JwtException | IllegalArgumentException e) {
            // If a token is present but is expired or any error in parsing it
            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
            return;
        }

    }
</code>```

It generates the following trace

```<code>2022-12-06 11:20:55.336 ERROR 2595 --- [http-nio-8080-exec-6] fr.test.aop.LoggingAspect               : Exception in fr.test.api.security.jwt.JwtTokenFactory.buildAuthFromToken() with cause = 'NULL' and exception = 'JWT expired at 2022-12-04T11:16:55+0000. Current time: 2022-12-06T11:20:55+0000'

io.jsonwebtoken.ExpiredJwtException: JWT expired at 2022-12-04T11:16:55+0000. Current time: 2022-12-06T11:20:55+0000
        at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:365) ~[jjwt-0.6.0.jar!/:0.6.0]
        at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:458) ~[jjwt-0.6.0.jar!/:0.6.0]
        at io.jsonwebtoken.impl.DefaultJwtParser.parseClaimsJws(DefaultJwtParser.java:518) ~[jjwt-0.6.0.jar!/:0.6.0]
        at fr.test.api.security.jwt.JwtTokenFactory.buildAuthFromToken(JwtTokenFactory.java:69) ~[classes!/:6.23]
        at fr.test.api.security.jwt.JwtTokenFactory$$FastClassBySpringCGLIB$$6a8b6ff3.invoke(<generated>) ~[classes!/:6.23]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at fr.test.aop.LoggingAspect.logAround(LoggingAspect.java:80) ~[classes!/:6.23]
        at jdk.internal.reflect.GeneratedMethodAccessor186.invoke(Unknown Source) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at fr.test.api.security.jwt.JwtTokenFactory$$EnhancerBySpringCGLIB$$d3875ed4.buildAuthFromToken(<generated>) ~[classes!/:6.23]
[...]
</code>```

Why does the stack trace is still logged while I take care of managing the JwtException ?

How can I disable this specific stack trace logging ?

Body:
I have a simple Spring Boot project where I implemented a JwtAuthenticationFilter. In case of an expired JWT token, the ExpiredJwtException is thrown and I managed the response accordingly.

While everything is working as expected, I continue to log the full stack trace of the ExpiredJwtException, which is not needed and pollutes my log files.

Here is the simple code :

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
            throws ServletException, IOException {

        String authTokenStr = jwtBearerTokenExtractor.extractHeaderToken(request);

        try {
            // This can throw the ExpiredJwtException (child of JwtException, managed below)
            AppUserDetails userDetails = jwtTokenFactory.buildAuthFromToken(authTokenStr);

            // Do stuffwith userDetails and SecurityContextHolder
            ...
            chain.doFilter(request, response);

        } catch (JwtException | IllegalArgumentException e) {
            // If a token is present but is expired or any error in parsing it
            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
            return;
        }

    }

It generates the following trace

2022-12-06 11:20:55.336 ERROR 2595 --- [http-nio-8080-exec-6] fr.test.aop.LoggingAspect               : Exception in fr.test.api.security.jwt.JwtTokenFactory.buildAuthFromToken() with cause = 'NULL' and exception = 'JWT expired at 2022-12-04T11:16:55+0000. Current time: 2022-12-06T11:20:55+0000'

io.jsonwebtoken.ExpiredJwtException: JWT expired at 2022-12-04T11:16:55+0000. Current time: 2022-12-06T11:20:55+0000
        at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:365) ~[jjwt-0.6.0.jar!/:0.6.0]
        at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:458) ~[jjwt-0.6.0.jar!/:0.6.0]
        at io.jsonwebtoken.impl.DefaultJwtParser.parseClaimsJws(DefaultJwtParser.java:518) ~[jjwt-0.6.0.jar!/:0.6.0]
        at fr.test.api.security.jwt.JwtTokenFactory.buildAuthFromToken(JwtTokenFactory.java:69) ~[classes!/:6.23]
        at fr.test.api.security.jwt.JwtTokenFactory$$FastClassBySpringCGLIB$$6a8b6ff3.invoke(<generated>) ~[classes!/:6.23]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at fr.test.aop.LoggingAspect.logAround(LoggingAspect.java:80) ~[classes!/:6.23]
        at jdk.internal.reflect.GeneratedMethodAccessor186.invoke(Unknown Source) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at fr.test.api.security.jwt.JwtTokenFactory$$EnhancerBySpringCGLIB$$d3875ed4.buildAuthFromToken(<generated>) ~[classes!/:6.23]
[...]

Why does the stack trace is still logged while I take care of managing the JwtException ?

How can I disable this specific stack trace logging ?


问:
Accessing a base vector member in a derived class
I solved solved as it is written in the comment.

The problem is

```<code>        Base b1(2), b2(10);

    b1.print();     // 2
    b2.print();     // 10
    for (int i = 0; i < 5; i++) {
        b1.setN(i, (i + 1) * 20);
        b2.setN(i, (i + 1) * 10);
    }
    b1.printData();  // 20 40
    b2.printData();  // 10 20 30 40 50 0 0 0 0 0

    Derived d(5);
    d.print();      // 5
    d.printData();      // 0 0 0 0 0
    for (int i = 0; i < 10; i++) {
        d.setN(i, (i + 1) * 3);
    }
    d.printData();  // 3 6 9 12 15
    d.insert(99);   // "Base" class does not have "insert" method.
    d.printData();  // 3 6 9 12 15 99 -> can't solve it..!
</code>```

so i made class Base And Derived class.

```<code>class Base {
    int x;
    vector<int> v1;
public:
    Base(int x) : x(x){
        vector<int>v2(x, 0);
        v1 = v2;
    }
 /* ...*/
    }
};
</code>```

I made it up to the base, but there's something I don't know.

```<code>class Derived : public Base {
public:
    Derived(int x) : Base(x) {}
    virtual void insert(int x) {
        //How can I Access on Base?
    }
};
</code>```

I encountered a difficulty because I didn't know how to accese vector of derived/ vector of base. How do I make it?

reading about overriding, inheritance but it was confused to me.

Body:
I solved solved as it is written in the comment.

The problem is

        Base b1(2), b2(10);

    b1.print();     // 2
    b2.print();     // 10
    for (int i = 0; i < 5; i++) {
        b1.setN(i, (i + 1) * 20);
        b2.setN(i, (i + 1) * 10);
    }
    b1.printData();  // 20 40
    b2.printData();  // 10 20 30 40 50 0 0 0 0 0

    Derived d(5);
    d.print();      // 5
    d.printData();      // 0 0 0 0 0
    for (int i = 0; i < 10; i++) {
        d.setN(i, (i + 1) * 3);
    }
    d.printData();  // 3 6 9 12 15
    d.insert(99);   // "Base" class does not have "insert" method.
    d.printData();  // 3 6 9 12 15 99 -> can't solve it..!

so i made class Base And Derived class.

class Base {
    int x;
    vector<int> v1;
public:
    Base(int x) : x(x){
        vector<int>v2(x, 0);
        v1 = v2;
    }
 /* ...*/
    }
};

I made it up to the base, but there's something I don't know.

class Derived : public Base {
public:
    Derived(int x) : Base(x) {}
    virtual void insert(int x) {
        //How can I Access on Base?
    }
};

I encountered a difficulty because I didn't know how to accese vector of derived/ vector of base. How do I make it?

reading about overriding, inheritance but it was confused to me.


问:
Issue with options when trying to serve with webpack - React TS application
In the process of making a react-typescript with express/node backend.

Having an issue running 'webpack serve' and getting this error.  Not really sure what's going on here, I've tried removing/refactoring the options with no luck.

Error Image

webpack.config.js code below

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyPlugin = require('copy-webpack-plugin');

const outputDirectory = 'dist';

const isDevelopment = process.env.NODE_ENV === 'development';

module.exports = {
  entry: ['babel-polyfill', './src/client/index.tsx'],
  output: {
    path: path.join(__dirname, outputDirectory),
    filename: './js/[name].bundle.js'
  },
  devtool: 'source-map',
  module: {
    rules: [
      {
        test: /\.(ts|js)x?$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: [
              "@babel/preset-env",
              "@babel/preset-react",
              "@babel/preset-typescript",
            ],
          },
        },
      },
      {
        enforce: 'pre',
        test: /\.js$/,
        loader: 'source-map-loader'
      },
      {
        test: /\.module\.s(a|c)ss$/,
        use: [
          isDevelopment ? 'style-loader' : MiniCssExtractPlugin.loader,
          {
            loader: 'css-loader',
            options: {
              modules: true,
              sourceMap: isDevelopment
            }
          },
          {
            loader: 'sass-loader',
            options: {
              sourceMap: isDevelopment
            }
          }
        ]
      },
      {
        test: /\.s(a|c)ss$/,
        exclude: /\.module.(s(a|c)ss)$/,
        use: [
          isDevelopment ? 'style-loader' : MiniCssExtractPlugin.loader,
          'css-loader',
          {
            loader: 'sass-loader',
            options: {
              sourceMap: isDevelopment
            }
          }
        ]
      },
      {
        test: /\.(png|woff|woff2|eot|ttf|svg)$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 100000
            }
          }
        ]
        // loader: 'url-loader?limit=100000'
      },
    ]
  },
  resolve: {
    extensions: ['*', '.ts', '.tsx', '.js', '.jsx', '.json', '.scss']
  },
  devServer: {
    port: 3000,
    open: true,
    hot: true,
    proxy: {
      '/api/**': {
        target: 'http://localhost:8050',
        secure: false,
        changeOrigin: true
      }
    }
  },
  plugins: [
    new CleanWebpackPlugin([outputDirectory]),
    new HtmlWebpackPlugin({
      template: './public/index.html',
      favicon: './public/icon.png',
      title: 'Jakob\'s Site',
    }),
    // new MiniCssExtractPlugin({
    //   filename: './css/[name].css',
    //   chunkFilename: './css/[id].css',
    // }),
    new MiniCssExtractPlugin({
      filename: isDevelopment ? '[name].css' : '[name].[hash].css',
      chunkFilename: isDevelopment ? '[id].css' : '[id].[hash].css'
    }),
    new CopyPlugin([
      { from: './src/client/Assets', to: 'assets' },
    ])
  ],
};```

Any Help appreciated, thank you!

Body:
In the process of making a react-typescript with express/node backend.

Having an issue running 'webpack serve' and getting this error.  Not really sure what's going on here, I've tried removing/refactoring the options with no luck.

Error Image

webpack.config.js code below

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyPlugin = require('copy-webpack-plugin');

const outputDirectory = 'dist';

const isDevelopment = process.env.NODE_ENV === 'development';

module.exports = {
  entry: ['babel-polyfill', './src/client/index.tsx'],
  output: {
    path: path.join(__dirname, outputDirectory),
    filename: './js/[name].bundle.js'
  },
  devtool: 'source-map',
  module: {
    rules: [
      {
        test: /\.(ts|js)x?$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: [
              "@babel/preset-env",
              "@babel/preset-react",
              "@babel/preset-typescript",
            ],
          },
        },
      },
      {
        enforce: 'pre',
        test: /\.js$/,
        loader: 'source-map-loader'
      },
      {
        test: /\.module\.s(a|c)ss$/,
        use: [
          isDevelopment ? 'style-loader' : MiniCssExtractPlugin.loader,
          {
            loader: 'css-loader',
            options: {
              modules: true,
              sourceMap: isDevelopment
            }
          },
          {
            loader: 'sass-loader',
            options: {
              sourceMap: isDevelopment
            }
          }
        ]
      },
      {
        test: /\.s(a|c)ss$/,
        exclude: /\.module.(s(a|c)ss)$/,
        use: [
          isDevelopment ? 'style-loader' : MiniCssExtractPlugin.loader,
          'css-loader',
          {
            loader: 'sass-loader',
            options: {
              sourceMap: isDevelopment
            }
          }
        ]
      },
      {
        test: /\.(png|woff|woff2|eot|ttf|svg)$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 100000
            }
          }
        ]
        // loader: 'url-loader?limit=100000'
      },
    ]
  },
  resolve: {
    extensions: ['*', '.ts', '.tsx', '.js', '.jsx', '.json', '.scss']
  },
  devServer: {
    port: 3000,
    open: true,
    hot: true,
    proxy: {
      '/api/**': {
        target: 'http://localhost:8050',
        secure: false,
        changeOrigin: true
      }
    }
  },
  plugins: [
    new CleanWebpackPlugin([outputDirectory]),
    new HtmlWebpackPlugin({
      template: './public/index.html',
      favicon: './public/icon.png',
      title: 'Jakob\'s Site',
    }),
    // new MiniCssExtractPlugin({
    //   filename: './css/[name].css',
    //   chunkFilename: './css/[id].css',
    // }),
    new MiniCssExtractPlugin({
      filename: isDevelopment ? '[name].css' : '[name].[hash].css',
      chunkFilename: isDevelopment ? '[id].css' : '[id].[hash].css'
    }),
    new CopyPlugin([
      { from: './src/client/Assets', to: 'assets' },
    ])
  ],
};

Any Help appreciated, thank you!


问:
Make points on radar charts clickable and access data associated with the indicators. (Echarts)
The points on the radar charts are clickable but wherever we click on the complete one spiral returns the same data. I want to make points separately clickable and  get the data with respect to the indicators.

Specifically, I want to make red highlighted point and get the data associated with indicator 5.

I am using echarts for it.

https://echarts.apache.org/examples/en/editor.html?c=radar

I tried click events handling on charts and log the data wherever we click. It returns the same data associated with a complete one spiral but I expect to get separate data associated with the indicator.


问:
Using CrossEntropyLoss weights with ResNet18 (Pytorch)
I'm having a a problem with using weights in my Loss function. I have a really imbalanced dataset with 7 classes, so I calculated the weight for each class and put it in a tensor.
The list I Tensor'd looks like this [0.8901, 0.3295, 0.9885, 0.8887, 0.9858, 0.9486, 0.9673].

I want to use those weights in my CrossEntropyLoss function, but when I then train on the data using ResNet18 (model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet18').to(device)) I get an Error because apparently, the ResNet has 1000 channels (-> classes) in its final layer, so I am supposed to give 1000 weights in my tensor, which is nonsense.

So my main question is: How can I use ResNet with 7 weights in my CrossEntropyLoss?

Also an extra question: Say I don't use ResNet but my own CNN, which has 7 channels in its final layer. How does the CrossEntropyLoss function know which class to assign which weight to, since its a list and not a dictionary...?

What I tried:

```<code>class_weights = torch.Tensor([0.8901, 0.3295, 0.9885, 0.8887, 0.9858, 0.9486, 0.9673])
[...]
model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet18').to(device)
criterion = nn.CrossEntropyLoss(weight=class_weights).to(device)
</code>```

and when I started training, I got this error:

```<code>---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [15], in <cell line: 1>()
      1 if use_save==False:
----> 2     fn.trainNetwork(epochs=num_epochs, loader=train_loader, model=model, crt=criterion, opt=optimizer)
      3     fn.saveModel(model, data_dir, "HAM10000")
      4 else:

File ~/digitale-wirtschaft/src/functions/cnn_actions.py:26, in trainNetwork(epochs, loader, model, crt, opt, save)
     24 # forward
     25 scores = model(data)
---> 26 loss = crt(scores, targets)
     27 losses.append(loss.item())
     28 # backward

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1130, in Module._call_impl(self, *input, **kwargs)
   1126 # If we don't have any hooks, we want to skip the rest of the logic in
   1127 # this function, and just call forward.
   1128 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1129         or _global_forward_hooks or _global_forward_pre_hooks):
-> 1130     return forward_call(*input, **kwargs)
   1131 # Do not call functions when jit is used
   1132 full_backward_hooks, non_full_backward_hooks = [], []

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/loss.py:1164, in CrossEntropyLoss.forward(self, input, target)
   1163 def forward(self, input: Tensor, target: Tensor) -> Tensor:
-> 1164     return F.cross_entropy(input, target, weight=self.weight,
   1165                            ignore_index=self.ignore_index, reduction=self.reduction,
   1166                            label_smoothing=self.label_smoothing)

File /opt/conda/lib/python3.10/site-packages/torch/nn/functional.py:3014, in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction, label_smoothing)
   3012 if size_average is not None or reduce is not None:
   3013     reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 3014 return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)

RuntimeError: weight tensor should be defined either for all 1000 classes or no classes but got weight tensor of shape: [7]
</code>```

I also tried multiplying the list in the Tensor with my batch_size (=64), so:

```<code>class_weights = torch.Tensor([0.8901, 0.3295, 0.9885, 0.8887, 0.9858, 0.9486, 0.9673]*batch_size)
</code>```

but that led to the same error, only with a different number for weight tensor shape (=448) in the last sentence.

Body:
I'm having a a problem with using weights in my Loss function. I have a really imbalanced dataset with 7 classes, so I calculated the weight for each class and put it in a tensor.
The list I Tensor'd looks like this [0.8901, 0.3295, 0.9885, 0.8887, 0.9858, 0.9486, 0.9673].

I want to use those weights in my CrossEntropyLoss function, but when I then train on the data using ResNet18 (model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet18').to(device)) I get an Error because apparently, the ResNet has 1000 channels (-> classes) in its final layer, so I am supposed to give 1000 weights in my tensor, which is nonsense.

So my main question is: How can I use ResNet with 7 weights in my CrossEntropyLoss?

Also an extra question: Say I don't use ResNet but my own CNN, which has 7 channels in its final layer. How does the CrossEntropyLoss function know which class to assign which weight to, since its a list and not a dictionary...?

What I tried:

class_weights = torch.Tensor([0.8901, 0.3295, 0.9885, 0.8887, 0.9858, 0.9486, 0.9673])
[...]
model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet18').to(device)
criterion = nn.CrossEntropyLoss(weight=class_weights).to(device)

and when I started training, I got this error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [15], in <cell line: 1>()
      1 if use_save==False:
----> 2     fn.trainNetwork(epochs=num_epochs, loader=train_loader, model=model, crt=criterion, opt=optimizer)
      3     fn.saveModel(model, data_dir, "HAM10000")
      4 else:

File ~/digitale-wirtschaft/src/functions/cnn_actions.py:26, in trainNetwork(epochs, loader, model, crt, opt, save)
     24 # forward
     25 scores = model(data)
---> 26 loss = crt(scores, targets)
     27 losses.append(loss.item())
     28 # backward

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1130, in Module._call_impl(self, *input, **kwargs)
   1126 # If we don't have any hooks, we want to skip the rest of the logic in
   1127 # this function, and just call forward.
   1128 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1129         or _global_forward_hooks or _global_forward_pre_hooks):
-> 1130     return forward_call(*input, **kwargs)
   1131 # Do not call functions when jit is used
   1132 full_backward_hooks, non_full_backward_hooks = [], []

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/loss.py:1164, in CrossEntropyLoss.forward(self, input, target)
   1163 def forward(self, input: Tensor, target: Tensor) -> Tensor:
-> 1164     return F.cross_entropy(input, target, weight=self.weight,
   1165                            ignore_index=self.ignore_index, reduction=self.reduction,
   1166                            label_smoothing=self.label_smoothing)

File /opt/conda/lib/python3.10/site-packages/torch/nn/functional.py:3014, in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction, label_smoothing)
   3012 if size_average is not None or reduce is not None:
   3013     reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 3014 return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)

RuntimeError: weight tensor should be defined either for all 1000 classes or no classes but got weight tensor of shape: [7]

I also tried multiplying the list in the Tensor with my batch_size (=64), so:

class_weights = torch.Tensor([0.8901, 0.3295, 0.9885, 0.8887, 0.9858, 0.9486, 0.9673]*batch_size)

but that led to the same error, only with a different number for weight tensor shape (=448) in the last sentence.


问:
Mattermost mention highlighting does not working as expected
I want to trigger a mention anytime someone just type my first name. I have a new message in "recent mentions" but it does not highlight my first name (with yellow color if you use a default theme) but if I use normal mention with '@' symbol and select user from the list it does highlight @Nickname.

I tried to change settings but I can't get this working. In my team it works for some users but it doesnt work for my account.


问:
not creating new column in a for loop, why?
Hei,

I want loop through a list of dataframes to add a new column.
see the code:

```<code>List = [OPOO,OSOO,OHP,OHN,OLP,OLN,ODP,ODN,OBP,OBN,OSP,OSN,OTP,OTN]

for i in range(len(List)):
    List[i] = pd.merge(List[i],d_date, on = 'Date')
</code>```

the code runs without problems but a new column is not added.

To change OPOO dataframe from:

```<code>    Date        Yield  source  country  indicator_type  city  yield_type  cluster
0 2000-01-01  0.075       1        1               1     1           1        1
1 2000-02-01  0.075       1        1               1     1           1        1
2 2000-03-01  0.075       1        1               1     1           1        1
3 2000-04-01  0.075       1        1               1     1           1        1
</code>```

to

```<code>  Date          Yield  source  country  indicator_type  city   yield_type  cluster   day_key
0 2000-01-01  0.075       1        1               1     1           1        1        1
1 2000-02-01  0.075       1        1               1     1           1        1        2
2 2000-03-01  0.075       1        1               1     1           1        1        3
3 2000-04-01  0.075       1        1               1     1           1        1        4
</code>```

I need to

```<code>OPOO = pd.merge(OPOO,d_date, on = 'Date')
</code>```

What am I doing wrong here ?

Thanks!

Body:
Hei,

I want loop through a list of dataframes to add a new column.
see the code:

List = [OPOO,OSOO,OHP,OHN,OLP,OLN,ODP,ODN,OBP,OBN,OSP,OSN,OTP,OTN]

for i in range(len(List)):
    List[i] = pd.merge(List[i],d_date, on = 'Date')

the code runs without problems but a new column is not added.

To change OPOO dataframe from:

    Date        Yield  source  country  indicator_type  city  yield_type  cluster
0 2000-01-01  0.075       1        1               1     1           1        1
1 2000-02-01  0.075       1        1               1     1           1        1
2 2000-03-01  0.075       1        1               1     1           1        1
3 2000-04-01  0.075       1        1               1     1           1        1

to

  Date          Yield  source  country  indicator_type  city   yield_type  cluster   day_key
0 2000-01-01  0.075       1        1               1     1           1        1        1
1 2000-02-01  0.075       1        1               1     1           1        1        2
2 2000-03-01  0.075       1        1               1     1           1        1        3
3 2000-04-01  0.075       1        1               1     1           1        1        4

I need to

OPOO = pd.merge(OPOO,d_date, on = 'Date')

What am I doing wrong here ?

Thanks!


问:
R looping across variables repeatedly
I have two waves of data with variables x_3, y_3, z_3, w_3 for the first wave and x_4, y_4, z_4, w_4 for the second wave. I would like to create two new variables in the data frame as xyz_3 and xyz_4. In reality I have more than 10 waves of data of the same information. I would like to repeat the below script for each of the wave in the same data frame in a loop. How to perform this in R. Any help will be helpful. The below code is for wave 3.

I have tried with the following. But did not work

```<code> A toy data is
   w_3 w_4 x_3 x_4 y_3 y_4 z_3 z_4
 1:   2  NA   1  NA  60  NA  NA  NA
 2:   2   2   2   4  84  84  NA  NA
 3:   2   2   1   3  45  45  NA  NA
 4:   1   1   3   5  NA  NA  NA  NA
 5:   1   1   3   5  NA  NA  NA  NA
 6:   1   1   2   5  NA  NA  NA  NA
 7:   1   1   3   5  NA  NA  NA  NA
 8:  NA  NA  NA  NA  NA  NA   3  NA
 9:   1  NA   5  NA  NA  NA  NA  NA
10:   1   1   2   5  NA  NA  NA  NA

code
dta$xyz_3[(dta$x_3 == 1 & dta$y_3 >= 75 & !is.na(dta$x_3)) |
           ((dta$x_3 >= 2 & dta$x_3 <= 8) & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & dta$y_3 >= 75 & !is.na(dta$y_3)) |
           (dta$z_3 >= 30 & !is.na(dta$z_3))] <- 1
dta$xyz_3[(dta$x_3 == 1 & (dta$y_3 >= 25 & dta$y_3 < 75) & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & (dta$y_3 >= 25 & dta$y_3 < 75) & !is.na(dta$y_3)) |
           ((dta$z_3 >= 10 & dta$z_3 < 30) & !is.na(dta$z_3))] <- 2
dta$xyz_3[(dta$x_3 == 1 & dta$y_3 < 25 & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & dta$y_3 < 25 & !is.na(dta$y_3)) |
           (dta$z_3 < 10 & !is.na(dta$z_3))] <- 3
dta$xyz_3[is.na(dta$xyz_3) & dta$w_3 == 1] <- 1
dta$xyz_3[is.na(dta$xyz_3) & dta$w_3 == 2] <- 2

A <- dta[, c("newid", "hourwork_3", "percent_3", "payhr_3", "fulltime_3")]
B <- dta[, c("newid", "hourwork_4", "percent_4", "payhr_4", "fulltime_4")]
L <- list(A, B)

xyz_3 <- 0
for (i in seq_along(L)) {
  L[[i]][, dim(L[[i]])[2] + 1] = as.character(rep(xyz_3,dim(L[[i]])[1]))
dta$xyz_3[(dta$x_3 == 1 & dta$y_3 >= 75 & !is.na(dta$x_3)) |
           ((dta$x_3 >= 2 & dta$x_3 <= 8) & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & dta$y_3 >= 75 & !is.na(dta$y_3)) |
           (dta$z_3 >= 30 & !is.na(dta$z_3))] <- 1
dta$xyz_3[(dta$x_3 == 1 & (dta$y_3 >= 25 & dta$y_3 < 75) & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & (dta$y_3 >= 25 & dta$y_3 < 75) & !is.na(dta$y_3)) |
           ((dta$z_3 >= 10 & dta$z_3 < 30) & !is.na(dta$z_3))] <- 2
dta$xyz_3[(dta$x_3 == 1 & dta$y_3 < 25 & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & dta$y_3 < 25 & !is.na(dta$y_3)) |
           (dta$z_3 < 10 & !is.na(dta$z_3))] <- 3
dta$xyz_3[is.na(dta$xyz_3) & dta$w_3 == 1] <- 1
dta$xyz_3[is.na(dta$xyz_3) & dta$w_3 == 2] <- 2
}
</code>```

Title: R looping across variables repeatedly

Body:
I have two waves of data with variables x_3, y_3, z_3, w_3 for the first wave and x_4, y_4, z_4, w_4 for the second wave. I would like to create two new variables in the data frame as xyz_3 and xyz_4. In reality I have more than 10 waves of data of the same information. I would like to repeat the below script for each of the wave in the same data frame in a loop. How to perform this in R. Any help will be helpful. The below code is for wave 3.

I have tried with the following. But did not work

 A toy data is
   w_3 w_4 x_3 x_4 y_3 y_4 z_3 z_4
 1:   2  NA   1  NA  60  NA  NA  NA
 2:   2   2   2   4  84  84  NA  NA
 3:   2   2   1   3  45  45  NA  NA
 4:   1   1   3   5  NA  NA  NA  NA
 5:   1   1   3   5  NA  NA  NA  NA
 6:   1   1   2   5  NA  NA  NA  NA
 7:   1   1   3   5  NA  NA  NA  NA
 8:  NA  NA  NA  NA  NA  NA   3  NA
 9:   1  NA   5  NA  NA  NA  NA  NA
10:   1   1   2   5  NA  NA  NA  NA

code
dta$xyz_3[(dta$x_3 == 1 & dta$y_3 >= 75 & !is.na(dta$x_3)) |
           ((dta$x_3 >= 2 & dta$x_3 <= 8) & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & dta$y_3 >= 75 & !is.na(dta$y_3)) |
           (dta$z_3 >= 30 & !is.na(dta$z_3))] <- 1
dta$xyz_3[(dta$x_3 == 1 & (dta$y_3 >= 25 & dta$y_3 < 75) & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & (dta$y_3 >= 25 & dta$y_3 < 75) & !is.na(dta$y_3)) |
           ((dta$z_3 >= 10 & dta$z_3 < 30) & !is.na(dta$z_3))] <- 2
dta$xyz_3[(dta$x_3 == 1 & dta$y_3 < 25 & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & dta$y_3 < 25 & !is.na(dta$y_3)) |
           (dta$z_3 < 10 & !is.na(dta$z_3))] <- 3
dta$xyz_3[is.na(dta$xyz_3) & dta$w_3 == 1] <- 1
dta$xyz_3[is.na(dta$xyz_3) & dta$w_3 == 2] <- 2

A <- dta[, c("newid", "hourwork_3", "percent_3", "payhr_3", "fulltime_3")]
B <- dta[, c("newid", "hourwork_4", "percent_4", "payhr_4", "fulltime_4")]
L <- list(A, B)

xyz_3 <- 0
for (i in seq_along(L)) {
  L[[i]][, dim(L[[i]])[2] + 1] = as.character(rep(xyz_3,dim(L[[i]])[1]))
dta$xyz_3[(dta$x_3 == 1 & dta$y_3 >= 75 & !is.na(dta$x_3)) |
           ((dta$x_3 >= 2 & dta$x_3 <= 8) & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & dta$y_3 >= 75 & !is.na(dta$y_3)) |
           (dta$z_3 >= 30 & !is.na(dta$z_3))] <- 1
dta$xyz_3[(dta$x_3 == 1 & (dta$y_3 >= 25 & dta$y_3 < 75) & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & (dta$y_3 >= 25 & dta$y_3 < 75) & !is.na(dta$y_3)) |
           ((dta$z_3 >= 10 & dta$z_3 < 30) & !is.na(dta$z_3))] <- 2
dta$xyz_3[(dta$x_3 == 1 & dta$y_3 < 25 & !is.na(dta$x_3)) |
           (is.na(dta$x_3) & dta$y_3 < 25 & !is.na(dta$y_3)) |
           (dta$z_3 < 10 & !is.na(dta$z_3))] <- 3
dta$xyz_3[is.na(dta$xyz_3) & dta$w_3 == 1] <- 1
dta$xyz_3[is.na(dta$xyz_3) & dta$w_3 == 2] <- 2
}


问:
Scraping with python requests
I want to scrape from idealista, but so far, i have not been able to.

This is the request i'm doing and i'm getting a 403 status code.

```<code>base_url = "https://www.idealista.com"
headers = {
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "accept-encoding": "gzip, deflate, br",
    "accept-language": "es-ES,es;q=0.9,ca;q=0.8,en;q=0.7",
    "cache-control": "max-age=0",
    "referer": "https://www.idealista.com/venta-viviendas/lleida-lleida/",
    "sec-ch-ua": '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "Windows",
    "sec-fetch-dest": "document",
    "sec-fetch-mode": "navigate",
    "sec-fetch-site": "same-origin",
    "sec-fetch-user": "?1",
    "upgrade-insecure-requests": "12",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
    }

r = requests.get(base_url, headers=headers)
print(r.status_code)
</code>```

The code works when executing it in google collab, so it probably means that my ip is banned?
If so, i have tried to do the same request using a proxy, but it still doesn't work.

Since i can request to the page using chrome, i tryied to copy the same request as cURL:

```<code>curl 'https://www.idealista.com/' \
  -H 'authority: www.idealista.com' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'accept-language: es-ES,es;q=0.9,ca;q=0.8,en;q=0.7' \
  -H 'cookie: userUUID=de0646fd-460a-4659-be1b-fea266b710aa; SESSION=eea26d055b230b2a~f1acf58a-b28c-4e1c-b5ff-b3eadb4aa619; datadome=62aWa4Tl__lCpaBoAIaO8rd_iFMl_iYXg7oz3asmQOUAejHb0RS5asDOifz4q~t7NsJhvLIrJthkdM4ubdazswS0r9aGzCKIe8PKH5SpRufTNpSVDh_BgFCW9Y6Nr6LE; utag_main=v_id:0184e727b30a000636ad2a70c0be0506f001a06701328$_sn:1$_se:1$_ss:1$_st:1670327249483$ses_id:1670325449483%3Bexp-session$_pn:1%3Bexp-session; didomi_token=eyJ1c2VyX2lkIjoiMTg0ZTcyN2ItMzJkYS02MmQxLTg5OTUtZjczZGExOTQyNWVmIiwiY3JlYXRlZCI6IjIwMjItMTItMDZUMTE6NDA6NTIuMjc0WiIsInVwZGF0ZWQiOiIyMDIyLTEyLTA2VDExOjQwOjUyLjI3NFoiLCJ2ZW5kb3JzIjp7ImVuYWJsZWQiOlsiZ29vZ2xlIiwiYzpsaW5rZWRpbi1tYXJrZXRpbmctc29sdXRpb25zIiwiYzptaXhwYW5lbCIsImM6YWJ0YXN0eS1MTGtFQ0NqOCIsImM6aG90amFyIiwiYzp5YW5kZXhtZXRyaWNzIiwiYzpiZWFtZXItSDd0cjdIaXgiLCJjOmFwcHNmbHllci1HVVZQTHBZWSIsImM6dGVhbGl1bWNvLURWRENkOFpQIiwiYzp0aWt0b2stS1pBVVFMWjkiLCJjOmlkZWFsaXN0YS1MenRCZXFFMyIsImM6aWRlYWxpc3RhLWZlUkVqZTJjIl19LCJwdXJwb3NlcyI6eyJlbmFibGVkIjpbImFuYWx5dGljcy1IcEJKcnJLNyIsImdlb2xvY2F0aW9uX2RhdGEiLCJkZXZpY2VfY2hhcmFjdGVyaXN0aWNzIl19LCJ2ZXJzaW9uIjoyLCJhYyI6IkFGbUFDQUZrLkFBQUEifQ==; euconsent-v2=CPjkTwAPjkTwAAHABBENCtCsAP_AAAAAAAAAF5wBQAIAAtAC2AKQBeYAAACA0AGAAIJLEoAMAAQSWKQAYAAgksQgAwABBJYdABgACCSwSADAAEElhkAGAAIJLCoAMAAQSWAA.f_gAAAAAAAAA' \
  -H 'referer: https://www.idealista.com/' \
  -H 'sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: document' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-user: ?1' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' \
  --compressed
</code>```

Again, this also returned a 403.

By my surprise, if i copy the same request as PowerShell it works:

```<code>$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
$session.Cookies.Add((New-Object System.Net.Cookie("userUUID", "de0646fd-460a-4659-be1b-fea266b710aa", "/", "www.idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("SESSION", "eea26d055b230b2a~f1acf58a-b28c-4e1c-b5ff-b3eadb4aa619", "/", "www.idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("datadome", "62aWa4Tl__lCpaBoAIaO8rd_iFMl_iYXg7oz3asmQOUAejHb0RS5asDOifz4q~t7NsJhvLIrJthkdM4ubdazswS0r9aGzCKIe8PKH5SpRufTNpSVDh_BgFCW9Y6Nr6LE", "/", ".idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("utag_main", "v_id:0184e727b30a000636ad2a70c0be0506f001a06701328`$_sn:1`$_se:1`$_ss:1`$_st:1670327249483`$ses_id:1670325449483%3Bexp-session`$_pn:1%3Bexp-session", "/", ".idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("didomi_token", "eyJ1c2VyX2lkIjoiMTg0ZTcyN2ItMzJkYS02MmQxLTg5OTUtZjczZGExOTQyNWVmIiwiY3JlYXRlZCI6IjIwMjItMTItMDZUMTE6NDA6NTIuMjc0WiIsInVwZGF0ZWQiOiIyMDIyLTEyLTA2VDExOjQwOjUyLjI3NFoiLCJ2ZW5kb3JzIjp7ImVuYWJsZWQiOlsiZ29vZ2xlIiwiYzpsaW5rZWRpbi1tYXJrZXRpbmctc29sdXRpb25zIiwiYzptaXhwYW5lbCIsImM6YWJ0YXN0eS1MTGtFQ0NqOCIsImM6aG90amFyIiwiYzp5YW5kZXhtZXRyaWNzIiwiYzpiZWFtZXItSDd0cjdIaXgiLCJjOmFwcHNmbHllci1HVVZQTHBZWSIsImM6dGVhbGl1bWNvLURWRENkOFpQIiwiYzp0aWt0b2stS1pBVVFMWjkiLCJjOmlkZWFsaXN0YS1MenRCZXFFMyIsImM6aWRlYWxpc3RhLWZlUkVqZTJjIl19LCJwdXJwb3NlcyI6eyJlbmFibGVkIjpbImFuYWx5dGljcy1IcEJKcnJLNyIsImdlb2xvY2F0aW9uX2RhdGEiLCJkZXZpY2VfY2hhcmFjdGVyaXN0aWNzIl19LCJ2ZXJzaW9uIjoyLCJhYyI6IkFGbUFDQUZrLkFBQUEifQ==", "/", ".idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("euconsent-v2", "CPjkTwAPjkTwAAHABBENCtCsAP_AAAAAAAAAF5wBQAIAAtAC2AKQBeYAAACA0AGAAIJLEoAMAAQSWKQAYAAgksQgAwABBJYdABgACCSwSADAAEElhkAGAAIJLCoAMAAQSWAA.f_gAAAAAAAAA", "/", ".idealista.com")))
Invoke-WebRequest -UseBasicParsing -Uri "https://www.idealista.com/" `
-WebSession $session `
-Headers @{
"authority"="www.idealista.com"
  "method"="GET"
  "path"="/"
  "scheme"="https"
  "accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
  "accept-encoding"="gzip, deflate, br"
  "accept-language"="es-ES,es;q=0.9,ca;q=0.8,en;q=0.7"
  "referer"="https://www.idealista.com/"
  "sec-ch-ua"="`"Not?A_Brand`";v=`"8`", `"Chromium`";v=`"108`", `"Google Chrome`";v=`"108`""
  "sec-ch-ua-mobile"="?0"
  "sec-ch-ua-platform"="`"Windows`""
  "sec-fetch-dest"="document"
  "sec-fetch-mode"="navigate"
  "sec-fetch-site"="same-origin"
  "sec-fetch-user"="?1"
  "upgrade-insecure-requests"="1"
}
</code>```

Could anybody explain me why this behaves this way, i don't understand why the same request in google collab works, but in my local machine doesn't, why the same request using curl doesn't and using powershell does? How should i code my python request to make it work?

Title: Scraping with python requests

Body:
I want to scrape from idealista, but so far, i have not been able to.

This is the request i'm doing and i'm getting a 403 status code.

base_url = "https://www.idealista.com"
headers = {
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "accept-encoding": "gzip, deflate, br",
    "accept-language": "es-ES,es;q=0.9,ca;q=0.8,en;q=0.7",
    "cache-control": "max-age=0",
    "referer": "https://www.idealista.com/venta-viviendas/lleida-lleida/",
    "sec-ch-ua": '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "Windows",
    "sec-fetch-dest": "document",
    "sec-fetch-mode": "navigate",
    "sec-fetch-site": "same-origin",
    "sec-fetch-user": "?1",
    "upgrade-insecure-requests": "12",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
    }

r = requests.get(base_url, headers=headers)
print(r.status_code)

The code works when executing it in google collab, so it probably means that my ip is banned?
If so, i have tried to do the same request using a proxy, but it still doesn't work.

Since i can request to the page using chrome, i tryied to copy the same request as cURL:

curl 'https://www.idealista.com/' \
  -H 'authority: www.idealista.com' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'accept-language: es-ES,es;q=0.9,ca;q=0.8,en;q=0.7' \
  -H 'cookie: userUUID=de0646fd-460a-4659-be1b-fea266b710aa; SESSION=eea26d055b230b2a~f1acf58a-b28c-4e1c-b5ff-b3eadb4aa619; datadome=62aWa4Tl__lCpaBoAIaO8rd_iFMl_iYXg7oz3asmQOUAejHb0RS5asDOifz4q~t7NsJhvLIrJthkdM4ubdazswS0r9aGzCKIe8PKH5SpRufTNpSVDh_BgFCW9Y6Nr6LE; utag_main=v_id:0184e727b30a000636ad2a70c0be0506f001a06701328$_sn:1$_se:1$_ss:1$_st:1670327249483$ses_id:1670325449483%3Bexp-session$_pn:1%3Bexp-session; didomi_token=eyJ1c2VyX2lkIjoiMTg0ZTcyN2ItMzJkYS02MmQxLTg5OTUtZjczZGExOTQyNWVmIiwiY3JlYXRlZCI6IjIwMjItMTItMDZUMTE6NDA6NTIuMjc0WiIsInVwZGF0ZWQiOiIyMDIyLTEyLTA2VDExOjQwOjUyLjI3NFoiLCJ2ZW5kb3JzIjp7ImVuYWJsZWQiOlsiZ29vZ2xlIiwiYzpsaW5rZWRpbi1tYXJrZXRpbmctc29sdXRpb25zIiwiYzptaXhwYW5lbCIsImM6YWJ0YXN0eS1MTGtFQ0NqOCIsImM6aG90amFyIiwiYzp5YW5kZXhtZXRyaWNzIiwiYzpiZWFtZXItSDd0cjdIaXgiLCJjOmFwcHNmbHllci1HVVZQTHBZWSIsImM6dGVhbGl1bWNvLURWRENkOFpQIiwiYzp0aWt0b2stS1pBVVFMWjkiLCJjOmlkZWFsaXN0YS1MenRCZXFFMyIsImM6aWRlYWxpc3RhLWZlUkVqZTJjIl19LCJwdXJwb3NlcyI6eyJlbmFibGVkIjpbImFuYWx5dGljcy1IcEJKcnJLNyIsImdlb2xvY2F0aW9uX2RhdGEiLCJkZXZpY2VfY2hhcmFjdGVyaXN0aWNzIl19LCJ2ZXJzaW9uIjoyLCJhYyI6IkFGbUFDQUZrLkFBQUEifQ==; euconsent-v2=CPjkTwAPjkTwAAHABBENCtCsAP_AAAAAAAAAF5wBQAIAAtAC2AKQBeYAAACA0AGAAIJLEoAMAAQSWKQAYAAgksQgAwABBJYdABgACCSwSADAAEElhkAGAAIJLCoAMAAQSWAA.f_gAAAAAAAAA' \
  -H 'referer: https://www.idealista.com/' \
  -H 'sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: document' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-user: ?1' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' \
  --compressed

Again, this also returned a 403.

By my surprise, if i copy the same request as PowerShell it works:

$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
$session.Cookies.Add((New-Object System.Net.Cookie("userUUID", "de0646fd-460a-4659-be1b-fea266b710aa", "/", "www.idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("SESSION", "eea26d055b230b2a~f1acf58a-b28c-4e1c-b5ff-b3eadb4aa619", "/", "www.idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("datadome", "62aWa4Tl__lCpaBoAIaO8rd_iFMl_iYXg7oz3asmQOUAejHb0RS5asDOifz4q~t7NsJhvLIrJthkdM4ubdazswS0r9aGzCKIe8PKH5SpRufTNpSVDh_BgFCW9Y6Nr6LE", "/", ".idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("utag_main", "v_id:0184e727b30a000636ad2a70c0be0506f001a06701328`$_sn:1`$_se:1`$_ss:1`$_st:1670327249483`$ses_id:1670325449483%3Bexp-session`$_pn:1%3Bexp-session", "/", ".idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("didomi_token", "eyJ1c2VyX2lkIjoiMTg0ZTcyN2ItMzJkYS02MmQxLTg5OTUtZjczZGExOTQyNWVmIiwiY3JlYXRlZCI6IjIwMjItMTItMDZUMTE6NDA6NTIuMjc0WiIsInVwZGF0ZWQiOiIyMDIyLTEyLTA2VDExOjQwOjUyLjI3NFoiLCJ2ZW5kb3JzIjp7ImVuYWJsZWQiOlsiZ29vZ2xlIiwiYzpsaW5rZWRpbi1tYXJrZXRpbmctc29sdXRpb25zIiwiYzptaXhwYW5lbCIsImM6YWJ0YXN0eS1MTGtFQ0NqOCIsImM6aG90amFyIiwiYzp5YW5kZXhtZXRyaWNzIiwiYzpiZWFtZXItSDd0cjdIaXgiLCJjOmFwcHNmbHllci1HVVZQTHBZWSIsImM6dGVhbGl1bWNvLURWRENkOFpQIiwiYzp0aWt0b2stS1pBVVFMWjkiLCJjOmlkZWFsaXN0YS1MenRCZXFFMyIsImM6aWRlYWxpc3RhLWZlUkVqZTJjIl19LCJwdXJwb3NlcyI6eyJlbmFibGVkIjpbImFuYWx5dGljcy1IcEJKcnJLNyIsImdlb2xvY2F0aW9uX2RhdGEiLCJkZXZpY2VfY2hhcmFjdGVyaXN0aWNzIl19LCJ2ZXJzaW9uIjoyLCJhYyI6IkFGbUFDQUZrLkFBQUEifQ==", "/", ".idealista.com")))
$session.Cookies.Add((New-Object System.Net.Cookie("euconsent-v2", "CPjkTwAPjkTwAAHABBENCtCsAP_AAAAAAAAAF5wBQAIAAtAC2AKQBeYAAACA0AGAAIJLEoAMAAQSWKQAYAAgksQgAwABBJYdABgACCSwSADAAEElhkAGAAIJLCoAMAAQSWAA.f_gAAAAAAAAA", "/", ".idealista.com")))
Invoke-WebRequest -UseBasicParsing -Uri "https://www.idealista.com/" `
-WebSession $session `
-Headers @{
"authority"="www.idealista.com"
  "method"="GET"
  "path"="/"
  "scheme"="https"
  "accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
  "accept-encoding"="gzip, deflate, br"
  "accept-language"="es-ES,es;q=0.9,ca;q=0.8,en;q=0.7"
  "referer"="https://www.idealista.com/"
  "sec-ch-ua"="`"Not?A_Brand`";v=`"8`", `"Chromium`";v=`"108`", `"Google Chrome`";v=`"108`""
  "sec-ch-ua-mobile"="?0"
  "sec-ch-ua-platform"="`"Windows`""
  "sec-fetch-dest"="document"
  "sec-fetch-mode"="navigate"
  "sec-fetch-site"="same-origin"
  "sec-fetch-user"="?1"
  "upgrade-insecure-requests"="1"
}

Could anybody explain me why this behaves this way, i don't understand why the same request in google collab works, but in my local machine doesn't, why the same request using curl doesn't and using powershell does? How should i code my python request to make it work?


问:
how to call kedro pipline or nodes in Django framework
I have to call Kedro nodes or pipelines in Django API, and need to use Kedro pipelines or nodes output as input in Django API. Not getting any solution. Please suggest some solution for this.
How to call Kedro pipeline or nodes in Django APIs?</p>


问:
How to add rows to an existing tabel in Word with apche poi?
I want to add rows to an existing table in Word. The table is circulated to different classes or methods in classes and I want to dynamically add rows to the table when required. When I do the same thing on different tables it works perfectly fine. But when I try to perform the same tasks on the same table it is not visible. I debugged the code. I see that the rows are getting added while debugging but they dont feature in the generated Word document.

I am following the below method -

```<code>class A{

public XWPFTable b(){
//Create the main table to be shared by all
XWPFTable tableitem = document.createTable(items.size(),4); //This is the table for all the entries
//Add contents to the table and write them tot he word file

FileOutputStream fileOutputStream = new FileOutputStream(destination+endfilename+".docx");//Writing the //table to the word file

document.write(fileOutputStream);
fileOutputStream.close();
return tableitem; //Returning the table to be used by other classes

}
}

Class C{
//Row no is a static ariable and tracks the last row of the table
//New rows have to be added to the table in this method
void d(XWPFTable table,int row no){ //This function receives the same table again.

//Read the document again
    InputStream is = new FileInputStream(destination
                                         +endfilename+".docx");

    XWPFDocument document = new XWPFDocument(OPCPackage.open(is));
    is.close();

for(number of items in this class){

// add new row
//Getting the last row of the already existing table
XWPFTableRow oldRow = table.getRow(rowno-1);
CTRow ctrow = CTRow.Factory.parse(oldRow.getCtRow().newInputStream());
XWPFTableRow newRow = new XWPFTableRow(ctrow, table);

XWPFRun run10 = newRow.getCell(0).addParagraph().createRun();
run10.setBold(true);
run10.setText("xxxx");
run10.addBreak();
run10.setText("xxxx");
run10.setFontFamily("xxxx");
run10.setFontSize(8);

XWPFRun run11 = newRow.getCell(1).addParagraph().createRun();

//Add further contents and then add the row to the table
table.addRow(newRow);
rowno=rowno+1;

}
   //Write to the document again the updated table
    FileOutputStream fileOutputStream = new FileOutputStream(destination
    +endfilename+".docx");
    document.write(fileOutputStream);
    fileOutputStream.close();

}

}
</code>```

Body:
I want to add rows to an existing table in Word. The table is circulated to different classes or methods in classes and I want to dynamically add rows to the table when required. When I do the same thing on different tables it works perfectly fine. But when I try to perform the same tasks on the same table it is not visible. I debugged the code. I see that the rows are getting added while debugging but they dont feature in the generated Word document.

I am following the below method -

class A{

public XWPFTable b(){
//Create the main table to be shared by all
XWPFTable tableitem = document.createTable(items.size(),4); //This is the table for all the entries
//Add contents to the table and write them tot he word file

FileOutputStream fileOutputStream = new FileOutputStream(destination+endfilename+".docx");//Writing the //table to the word file

document.write(fileOutputStream);
fileOutputStream.close();
return tableitem; //Returning the table to be used by other classes

}
}

Class C{
//Row no is a static ariable and tracks the last row of the table
//New rows have to be added to the table in this method
void d(XWPFTable table,int row no){ //This function receives the same table again.

//Read the document again
    InputStream is = new FileInputStream(destination
                                         +endfilename+".docx");

    XWPFDocument document = new XWPFDocument(OPCPackage.open(is));
    is.close();

for(number of items in this class){

// add new row
//Getting the last row of the already existing table
XWPFTableRow oldRow = table.getRow(rowno-1);
CTRow ctrow = CTRow.Factory.parse(oldRow.getCtRow().newInputStream());
XWPFTableRow newRow = new XWPFTableRow(ctrow, table);

XWPFRun run10 = newRow.getCell(0).addParagraph().createRun();
run10.setBold(true);
run10.setText("xxxx");
run10.addBreak();
run10.setText("xxxx");
run10.setFontFamily("xxxx");
run10.setFontSize(8);

XWPFRun run11 = newRow.getCell(1).addParagraph().createRun();

//Add further contents and then add the row to the table
table.addRow(newRow);
rowno=rowno+1;

}
   //Write to the document again the updated table
    FileOutputStream fileOutputStream = new FileOutputStream(destination
    +endfilename+".docx");
    document.write(fileOutputStream);
    fileOutputStream.close();

}

}


问:
Vite build gives QSocketNotifier: Can only be used with threads started with QThread error
I created a react project with vite.

When i run vite build command, it gives QSocketNotifier: Can only be used with threads started with QThread error.

I haven't created any new files in my project. It is just a hello world react project created with vite.

Any idea how to resolve this?


问:
Installing symfony 5.4 fails
I following:

```<code>composer create-project symfony/skeleton:"^5.4" my_project_directory
cd my_project_directory
composer require webapp
</code>```

On this step:

```<code>composer require webapp
</code>```

I get this error:

Problem 1
- symfony/framework-bundle is locked to version v5.4.16 and an update of this package was not requested.
- symfony/webapp-pack v1.2.0 conflicts with symfony/webapp-pack v1.2.0.
- Root composer.json requires symfony/webapp-pack ^1.2 -> satisfiable by symfony/webapp-pack[v1.2.0].

Don't understand what this exactly means. Installing version 6.2 of symfony works fine. But as I need lower version for particular reasons I am trying to install the 5.4.
Plus this seems like no sense to me:

symfony/webapp-pack v1.2.0 conflicts with symfony/webapp-pack v1.2.0.

Title: Installing symfony 5.4 fails

Body:
I following:

composer create-project symfony/skeleton:"^5.4" my_project_directory
cd my_project_directory
composer require webapp

On this step:

composer require webapp

I get this error:

Problem 1
- symfony/framework-bundle is locked to version v5.4.16 and an update of this package was not requested.
- symfony/webapp-pack v1.2.0 conflicts with symfony/webapp-pack v1.2.0.
- Root composer.json requires symfony/webapp-pack ^1.2 -> satisfiable by symfony/webapp-pack[v1.2.0].

Don't understand what this exactly means. Installing version 6.2 of symfony works fine. But as I need lower version for particular reasons I am trying to install the 5.4.
Plus this seems like no sense to me:

symfony/webapp-pack v1.2.0 conflicts with symfony/webapp-pack v1.2.0.


问:
Tensorflow - TFLITE
I made a TFLite detect file but I can not run it on my Raspberry Pi, since it types me:
only size -1 arrays can be converted to Python scalars.

Detect tflite file downloaded from GitHub works perfectly. My detect file run on laptot but after conversion to TFLite it somehow converts badly and can be run.

Could you please help me?

Thanks for any help.

I tried different ways of conversion but up to now without succes.

Title: Tensorflow - TFLITE


问:
How to solve "Could not find module ‘Data.List.Split’" in GHCi?
I`ve tried to import the Module Data.List.Split which I found on hoogle.
But

import Data.List.Split (chunksOf)

does not work.

I always get this error:

```<code>ghci> :l AOC3.hs
[1 of 1] Compiling AOC3             ( AOC3.hs, interpreted )

AOC3.hs:17:1: error:
    Could not find module ‘Data.List.Split’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
17 | import Data.List.Split (chunskOf)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
</code>```

Body:
I`ve tried to import the Module Data.List.Split which I found on hoogle.
But

import Data.List.Split (chunksOf)

does not work.

I always get this error:

ghci> :l AOC3.hs
[1 of 1] Compiling AOC3             ( AOC3.hs, interpreted )

AOC3.hs:17:1: error:
    Could not find module ‘Data.List.Split’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
17 | import Data.List.Split (chunskOf)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.


问:
How to inherit from one parent or another one (not both)
I don't know if this isn't antipattern but I have two parent classes and I need a child class to inherit only from one of them. Example:

class ParA:
    def __init__(self) -> None:
        pass

    def f(self):
        print("method in parA")

class ParB:
    def __init__(self) -> None:
        pass

    def f(self):
        print("method in parB")

class Child(ParA, ParB):
    def __init__(self) -> None:
        if "some_condition":
            pass # inherit from ParA
        elif "some_other_condition":
            pass # inherit from ParB

child = Child()
child.f()
```

After some googling I've found it might be possible to achieve this with __getattribute__ method but I don't know how to implement it. Any help and explanations welcome!

Body:
I don't know if this isn't antipattern but I have two parent classes and I need a child class to inherit only from one of them. Example:

class ParA:
    def __init__(self) -> None:
        pass

    def f(self):
        print("method in parA")

class ParB:
    def __init__(self) -> None:
        pass

    def f(self):
        print("method in parB")

class Child(ParA, ParB):
    def __init__(self) -> None:
        if "some_condition":
            pass # inherit from ParA
        elif "some_other_condition":
            pass # inherit from ParB

child = Child()
child.f()

After some googling I've found it might be possible to achieve this with __getattribute__ method but I don't know how to implement it. Any help and explanations welcome!


问:
AWS RDS DbConnections monitoring - odd flat red line without much meaning
When I want to monitor DbConnections to my RDS cluster in AWS console, the whole chart is scaled oddly, as there's a flat red line at the top of the chart around value 35,000.

This line can't be hovered over (thus no idea what it is), and also it causes all meaningful values to be almost flat lines at the bottom of the chart.

Please see the image:

Questions:

What is the meaning of that line?

How to get rid of it?


问:
How print tickets with nodejs?
I want to create a REST service with Node.js using Express that prints tickets to ESC/POS bluetooth printer. I am using node-escpos.

The actual result my service print only the first time and I need to restart the bluetooth to print again.

I tried update my service to only look for the printer and return it but it only works a couple of times (like 5 times). I received this error in the console:

(node:16608) MaxListenersExceededWarning: Possible EventEmitter memory
leak detected. 11 error listeners added to [Device]. Use
emitter.setMaxListeners() to increase limit (Use node --trace-warnings ... to show where the warning was created)

The expected result print data multiple times

Here is my printerService.js :

```<code>const { Printer } = require("escpos");
const Bluetooth = require("escpos-bluetooth");

const foundPrinter = async (name, address, channel, printData) => {
  const PRINTER_NAME = name;
  const PRINTER_ADDRESS = address;
  const PRINTER_CHANNEL = channel;
  const preferredPrinterAddress = "(" + PRINTER_ADDRESS + ")" + PRINTER_NAME;
  const availablePrinters = await Bluetooth.findPrinters();
  console.log("availablePrinters", availablePrinters);
  const btPrinter =
    availablePrinters && availablePrinters.length > 0
      ? availablePrinters.filter(
          (p) =>
            p &&
            p.name === PRINTER_NAME &&
            p.address === preferredPrinterAddress
        )[0]
      : false;

  console.log("btPrinter", btPrinter);
  return new Promise((resolve, reject) => {
    if (btPrinter) {
      if (!printData) {
        resolve({ printer: btPrinter });
      } else {
        const device = new Bluetooth(PRINTER_ADDRESS, PRINTER_CHANNEL);
        const printer = new Printer(device);
        device.open(function (deviceError) {
          if (!deviceError) {
            printer
              .font("a")
              .align("ct")
              .style("bu")
              .size(1, 1)
              .text("Text1")
              .text("Text2")
              .barcode("1234567", "EAN8")
              .qrimage("qrImage", function (qrImageError) {
                if (!qrImageError) {
                  this.cut();
                  this.close();
                } else {
                  reject({
                    name: qrImageError.name,
                    message: qrImageError.message,
                  });
                }
              });
            resolve({ printer: btPrinter });
          } else {
            reject({ name: deviceError.name, message: deviceError.message });
          }
        });
      }
    } else {
      reject({
        errorType: "ERROR_PRINTER_NOT_FOUND",
        errorName: "PRINTER_NOT_FOUND",
        message: "printer not found",
        fullMessage:
          "printer not found, availablePrinters: " +
          availablePrinters.toString(),
      });
    }
  });
};
</code>```

Title: How print tickets with nodejs?

Body:
I want to create a REST service with Node.js using Express that prints tickets to ESC/POS bluetooth printer. I am using node-escpos.

The actual result my service print only the first time and I need to restart the bluetooth to print again.

I tried update my service to only look for the printer and return it but it only works a couple of times (like 5 times). I received this error in the console:

(node:16608) MaxListenersExceededWarning: Possible EventEmitter memory
leak detected. 11 error listeners added to [Device]. Use
emitter.setMaxListeners() to increase limit (Use node --trace-warnings ... to show where the warning was created)

The expected result print data multiple times

Here is my printerService.js :

const { Printer } = require("escpos");
const Bluetooth = require("escpos-bluetooth");

const foundPrinter = async (name, address, channel, printData) => {
  const PRINTER_NAME = name;
  const PRINTER_ADDRESS = address;
  const PRINTER_CHANNEL = channel;
  const preferredPrinterAddress = "(" + PRINTER_ADDRESS + ")" + PRINTER_NAME;
  const availablePrinters = await Bluetooth.findPrinters();
  console.log("availablePrinters", availablePrinters);
  const btPrinter =
    availablePrinters && availablePrinters.length > 0
      ? availablePrinters.filter(
          (p) =>
            p &&
            p.name === PRINTER_NAME &&
            p.address === preferredPrinterAddress
        )[0]
      : false;

  console.log("btPrinter", btPrinter);
  return new Promise((resolve, reject) => {
    if (btPrinter) {
      if (!printData) {
        resolve({ printer: btPrinter });
      } else {
        const device = new Bluetooth(PRINTER_ADDRESS, PRINTER_CHANNEL);
        const printer = new Printer(device);
        device.open(function (deviceError) {
          if (!deviceError) {
            printer
              .font("a")
              .align("ct")
              .style("bu")
              .size(1, 1)
              .text("Text1")
              .text("Text2")
              .barcode("1234567", "EAN8")
              .qrimage("qrImage", function (qrImageError) {
                if (!qrImageError) {
                  this.cut();
                  this.close();
                } else {
                  reject({
                    name: qrImageError.name,
                    message: qrImageError.message,
                  });
                }
              });
            resolve({ printer: btPrinter });
          } else {
            reject({ name: deviceError.name, message: deviceError.message });
          }
        });
      }
    } else {
      reject({
        errorType: "ERROR_PRINTER_NOT_FOUND",
        errorName: "PRINTER_NOT_FOUND",
        message: "printer not found",
        fullMessage:
          "printer not found, availablePrinters: " +
          availablePrinters.toString(),
      });
    }
  });
};


问:
MultiIndex: on 2nd level, drop first column from each column on 1st level
I have a MultiIndex dataframe where column names have two levels and I'd like to remove a certain column on the second level from each column on the first level (in the example below: remove the age column for each participant, but keep the score column). I don't know how to access it because the names on the first level are different but the name on the second level is always the same ("Age"). I tried different versions of df.drop(columns=[(:, 'Age')]) but of course that didn't work. Any help would be appreciated!</p>
```<code>cols = pd.MultiIndex.from_tuples([("F", "Age"),
                                  ("F", "Score"),
                                  ("A", "Age"),
                                  ("A", "Score"),
                                  ("X", "Age"),
                                  ("X", "Score")])
data=[[23,300,32,400,45,500], [11,500,54,600,23,400]]

df = pd.DataFrame(data, columns=cols)
</code>```

Body:
I have a MultiIndex dataframe where column names have two levels and I'd like to remove a certain column on the second level from each column on the first level (in the example below: remove the age column for each participant, but keep the score column). I don't know how to access it because the names on the first level are different but the name on the second level is always the same ("Age"). I tried different versions of df.drop(columns=[(:, 'Age')]) but of course that didn't work. Any help would be appreciated!

cols = pd.MultiIndex.from_tuples([("F", "Age"),
                                  ("F", "Score"),
                                  ("A", "Age"),
                                  ("A", "Score"),
                                  ("X", "Age"),
                                  ("X", "Score")])
data=[[23,300,32,400,45,500], [11,500,54,600,23,400]]

df = pd.DataFrame(data, columns=cols)


问:
Setting up CI/CD pipeline for Nextjs13
I am looking for example / tutorial how to set-up pipeline (gitlab runner) for Next.js 13 application.

It's a struggle because all resources and documentation are not helpful, I found older examples on the web but I can't make it work with latest version of Next.js.

Title: Setting up CI/CD pipeline for Nextjs13


问:
how to remove blank screen after splash screen in yocto
I am using yocto kirkstone , i tried setting-up splash screen on bootup using psplash and dietsplash , in both of the cases i get a blank screen after splash screen is shown , is there any way to eleminate this blank screen? I have already tried psplash and dietsplash but result  remains same.</p>


问:
Dart Analysis Server client: couldn't create connection to server
I opened the flutter project I'm working on and find this error message. Code completion is not working, no warning of any sort is displayed if I make mistakes/errors in my code. No red line is drawn under my code if I miss something on the line. In fact, nothing is working both on VS Code and Android studio. I have googled so much, but without solution. Please, I need help resolving this issue.
Also if I try to run any flutter code on cmd, like flutter doctor, another cmd will pop up briefly and disappear and the flutter doctor code will not run.

This is also the error:
"The Dart Analysis Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information."

This is the output message:
"[Error - 12:41:57 PM] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097 "

I've tried restarting the analysis server and it's still showing the error. Please I need help on this issue as the project I'm working on is halted because of this issue.


问:
how to get value inside the array result in python?
I have below code:

```<code>test1 = []
test11=yield context.task_all(result1)
test1.append(test11[0])
test1[0]

test2 = yield context.task_all(result2)
</code>```

test11 has below value:

```<code>['success']
special variables
function variables
0: 'success'
len(): 1
</code>```

I wanna get only 'success' from the variable test11. How can I get the value?
here is the data which get in variable:

Body:
I have below code:

test1 = []
test11=yield context.task_all(result1)
test1.append(test11[0])
test1[0]

test2 = yield context.task_all(result2)

test11 has below value:

['success']
special variables
function variables
0: 'success'
len(): 1

I wanna get only 'success' from the variable test11. How can I get the value?
here is the data which get in variable:


问:
What is the order of rebalansing different consumers group in kafka?
I have Spring Boot App - read from one kafka topic, do something with record, write new result to another topic.

Each topic for reading has different consumer groups. Each topic has different MassageListnerContainer with concurrency equal topic partitions number, for example 20.
I start all MessageListeners containers one by one. What I expected to see - each consumer group started to rebalance parallel, independent one from each other, but I see that next rebalancing is starting only after another consumer group was rebalanced.

Is it normal behaviour and is some way to customize this? Or maybe it's only my app problem?


问:
react native expo resolutionStrategy
i have this problem when i try to publish build:

```<code>[stderr] Execution failed for task ':app:mergeDebugNativeLibs'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
[stderr]    > 2 files found with path 'lib/arm64-v8a/libreact_nativemodule_core.so' from inputs:
[stderr]       - /home/expo/workingdir/build/node_modules/react-native-quick-crypto/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libreact_nativemodule_core.so
[stderr]       - /home/expo/.gradle/caches/transforms-3/a1f457d0144ca099e774cdc47135ea7a/transformed/jetified-react-native-0.69.6-debug/jni/arm64-v8a/libreact_nativemodule_core.so
</code>```

after some research community is suggesting to set something like:

```<code>allprojects {
 configurations.all {
  resolutionStrategy {
   force 'com.facebook.react:react-native:0.65.2' //select Version you used
  }
 }
}
</code>```

and to paste my project on force, but how do we set this from react-native-expo app in app.json or app.config.ts or package.json if any have experience please share

Title: react native expo resolutionStrategy

Body:
i have this problem when i try to publish build:

[stderr] Execution failed for task ':app:mergeDebugNativeLibs'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
[stderr]    > 2 files found with path 'lib/arm64-v8a/libreact_nativemodule_core.so' from inputs:
[stderr]       - /home/expo/workingdir/build/node_modules/react-native-quick-crypto/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libreact_nativemodule_core.so
[stderr]       - /home/expo/.gradle/caches/transforms-3/a1f457d0144ca099e774cdc47135ea7a/transformed/jetified-react-native-0.69.6-debug/jni/arm64-v8a/libreact_nativemodule_core.so

after some research community is suggesting to set something like:

allprojects {
 configurations.all {
  resolutionStrategy {
   force 'com.facebook.react:react-native:0.65.2' //select Version you used
  }
 }
}

and to paste my project on force, but how do we set this from react-native-expo app in app.json or app.config.ts or package.json if any have experience please share


问:
How to download the media content like images/videos from a tweet url using tweepy in python
Is it possible to fetch the images and videos that are posted in tweets using the tweet url in tweepy in python

extracting the media content


问:
How to make an "all application" "Clear Menu" keyboard shortcut?
MacOS nowadays has a "Clear Menu" item under the System ("") menu via "Recent Items". Before that it was possible to create a keyboard shortcut for "All Applications" activating "Clear Menu" for the current application:

Now, instead, MacOS always activates ("steals") the "Clear Menu" menu item under the Apple-menu, clearing "Recent Items":

My question is, is it still possible to create a keyboard shortcut for "All Applications" which clears the recently used document/file menu, without creating a keyboard short cut for each application separately? Say, by providing "path" specific information, e.g. "File | Open Recent | Clear Menu". Or something in that fashion.

Note that in the configuration for a keyboard shortcut, you can only specify the title of the menu item, but not its "parents" as it were.

Design Issue?
It is very strange that Apple would choose to add a menu item with exactly the same title as the application specific one in the application's file menu. The way things seem to work now, that makes it impossible to set an application specific keyboard shortcut for a menu item with the same title as a menu item from the System ("") Menu!