问:
Can the INIT OData Source Kafka Source Connector pull data from XSODATA services?
I'd like to preface this with the fact that I am completely new to SAP and SAP HANA, and OData.

I was tasked with pulling changes from a SAP HANA table and transfer those to Kafka.

I noticed there was a Kafka source connector already written, which can be found here.

For this task, I was given a URL, a username and a password.

The URL looks like this:

https://blablabla.companyName.com/companyName/Foo/Bar/Baz/Foo/Table/Resource.xsodata

And this is a sample of the source connector's configs:

```<code># The first few settings are required for all connectors:
# a name, the connector class to run, and the maximum number of
# tasks to create.
name = odatav4-source-connector
connector.class = org.init.ohja.kafka.connect.odatav4.source.OData4SourceConnector
tasks.max = 1

# The remaining configs are specific to the OData v4 source connector.
# OData server host as either DNS or IP
sap.odata.host.address = services.odata.org
# OData server port
sap.odata.host.port = 443
# OData protocol (supported values are http or https)
sap.odata.host.protocol = https
# OData user name for basic authentication
# For services not requiring authentication this can be set to any value
sap.odata.user.name = anonymous
# OData user password for basic authentication
# For services not requiring authentication this can be set to any value
sap.odata.user.pwd = anonymous
# Optional list of service URL query parameters in the form of "param1=value1,param2=value2", e.g. sap-client=200
#sap.odata.query-params=
# none(default): DECIMALs will be mapped to Connect Decimal data type
# primitive: DECIMALs will be mapped to INT64(id scale = 0) anf FLOAT64
#sap.odata.decimal.mapping = none
# maximum amount of retries in case of service connection/communication errors (e.g. HTTP status codes 400-599)
#sap.odata.max.retries = 30
# The backoff strategy applied will select a random number of milliseconds
# to wait between min.retry.backoff.ms and max.retry.backoff.ms before starting
# the next retry.
#sap.odata.min.retry.backoff.ms = 20000
#sap.odata.max.retry.backoff.ms = 180000
# Timeout in milliseconds for establishing http connections
#sap.odata.connection.connect.timeout.ms=3000
# Timeout in milliseconds for reading data from a http connection
#sap.odata.connection.read.timeout.ms=10000

# Individual configurations for each OData v4 service entity.
# service and entityset build up the primary key for each OData configuration.
# OData v4 URL service path
sap.odata#00.service = /V4/Northwind/Northwind.svc/
# OData v4 entity set name
# The entity set name can be queried from the /$metadata service URL
sap.odata#00.entityset = Order_Details
# Kafka topic name the data for this OData service entity set will be pushed to
sap.odata#00.topic = Order_Details
# Execution interval in seconds for the scheduled data extractions
# Set to -1 to process subscription events only
#sap.odata#00.exec-period = 900
# If changes to entities selected by the first query should be tracked and returned as deltas in subsequent polls
# Set to 1 to enable odata delta mode
#sap.odata#00.track-changes = 0
# Paging mode (server or client) determines the type of paging
# server: use HTTP prefer-headers to request a maximum package size from the odata server
# client: use query functions skip and top (not compatible to change tracking)
#sap.odata#00.paging.mode = server
# Packaging size in count of entity set records
#sap.odata#00.paging.size = 50000
# Optional: Hierarchy level up to which recommendations for the expand.list configuration (query option $expand) will
# be shown in the Confluent Control Center
#sap.odata#00.expand.level = 1
# Optional: List of expand query options that will define the deep structure of returned entity messages
#sap.odata#00.expand.list =
# Optional: comma separated list of selected non-key fields to be extracted
#sap.odata#00.projection =
# Optional: filter query options
# Supported logical operations/options are: eq, ne, le, lt, ge, gt, bt, nb, in
#sap.odata#00.select#00.fieldname =
#sap.odata#00.select#00.option =
#sap.odata#00.select#00.low =
#sap.odata#00.select#00.high =
# If set to 1 the connector will subscribe to push-notifications issued by the corresponding OData service entity
#sap.odata#00.subscription.enable = 0
</code>```

So I tried to create my own, like so:

```<code>{
    "name": "sap-hana-source-connector",
    "config": {
        "connector.class": "org.init.ohja.kafka.connect.odatav4.source.OData4SourceConnector",
        "sap.odata.user.name": "username",
        "sap.odata.host.address": "blablabla.companyName.com",
        "sap.odata.host.port": "443",
        "sap.odata.host.protocol": "https",
        "sap.odata#00.service": "/companyName/Foo/Bar/Baz/Foo/Table/Resource.xsodata",
        "sap.odata#00.entityset": "Resource",
        "sap.odata.user.pwd": "pwd"
    }
}
</code>```

The issue is that the only error I get is this:

```<code>{
    "error_code": 400,
    "message": "Connector configuration is invalid and contains the following 14 error(s):\nInvalid configuration sap.odata.host.address: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.host.protocol: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.host.port: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.user.name: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.user.pwd: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.max.retries: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.min.retry.backoff.ms: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.max.retry.backoff.ms: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.connection.connect.timeout.ms: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.connection.read.timeout.ms: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.query-params: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.trace.mode: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.trace.path: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.decimal.mapping: No configured service reachable. Maybe invalid destination configuration?\nYou can also find the above list of errors at the endpoint `/connector-plugins/{connectorType}/config/validate`"
}
</code>```

As someone who is completely new to OData and SAP, I don't know how I'd debug this.

I noticed that, in the OData's Kafka Source Connector documentation the services end in .svc and not .xsodata; so maybe it's something to do with that?

Also, what am I supposed to be for the sap.odata#00.entityset config?

Is there a way to get a more detailed error message?

Thanks.

Body:
I'd like to preface this with the fact that I am completely new to SAP and SAP HANA, and OData.

I was tasked with pulling changes from a SAP HANA table and transfer those to Kafka.

I noticed there was a Kafka source connector already written, which can be found here.

For this task, I was given a URL, a username and a password.

The URL looks like this:

https://blablabla.companyName.com/companyName/Foo/Bar/Baz/Foo/Table/Resource.xsodata

And this is a sample of the source connector's configs:

# The first few settings are required for all connectors:
# a name, the connector class to run, and the maximum number of
# tasks to create.
name = odatav4-source-connector
connector.class = org.init.ohja.kafka.connect.odatav4.source.OData4SourceConnector
tasks.max = 1

# The remaining configs are specific to the OData v4 source connector.
# OData server host as either DNS or IP
sap.odata.host.address = services.odata.org
# OData server port
sap.odata.host.port = 443
# OData protocol (supported values are http or https)
sap.odata.host.protocol = https
# OData user name for basic authentication
# For services not requiring authentication this can be set to any value
sap.odata.user.name = anonymous
# OData user password for basic authentication
# For services not requiring authentication this can be set to any value
sap.odata.user.pwd = anonymous
# Optional list of service URL query parameters in the form of "param1=value1,param2=value2", e.g. sap-client=200
#sap.odata.query-params=
# none(default): DECIMALs will be mapped to Connect Decimal data type
# primitive: DECIMALs will be mapped to INT64(id scale = 0) anf FLOAT64
#sap.odata.decimal.mapping = none
# maximum amount of retries in case of service connection/communication errors (e.g. HTTP status codes 400-599)
#sap.odata.max.retries = 30
# The backoff strategy applied will select a random number of milliseconds
# to wait between min.retry.backoff.ms and max.retry.backoff.ms before starting
# the next retry.
#sap.odata.min.retry.backoff.ms = 20000
#sap.odata.max.retry.backoff.ms = 180000
# Timeout in milliseconds for establishing http connections
#sap.odata.connection.connect.timeout.ms=3000
# Timeout in milliseconds for reading data from a http connection
#sap.odata.connection.read.timeout.ms=10000

# Individual configurations for each OData v4 service entity.
# service and entityset build up the primary key for each OData configuration.
# OData v4 URL service path
sap.odata#00.service = /V4/Northwind/Northwind.svc/
# OData v4 entity set name
# The entity set name can be queried from the /$metadata service URL
sap.odata#00.entityset = Order_Details
# Kafka topic name the data for this OData service entity set will be pushed to
sap.odata#00.topic = Order_Details
# Execution interval in seconds for the scheduled data extractions
# Set to -1 to process subscription events only
#sap.odata#00.exec-period = 900
# If changes to entities selected by the first query should be tracked and returned as deltas in subsequent polls
# Set to 1 to enable odata delta mode
#sap.odata#00.track-changes = 0
# Paging mode (server or client) determines the type of paging
# server: use HTTP prefer-headers to request a maximum package size from the odata server
# client: use query functions skip and top (not compatible to change tracking)
#sap.odata#00.paging.mode = server
# Packaging size in count of entity set records
#sap.odata#00.paging.size = 50000
# Optional: Hierarchy level up to which recommendations for the expand.list configuration (query option $expand) will
# be shown in the Confluent Control Center
#sap.odata#00.expand.level = 1
# Optional: List of expand query options that will define the deep structure of returned entity messages
#sap.odata#00.expand.list =
# Optional: comma separated list of selected non-key fields to be extracted
#sap.odata#00.projection =
# Optional: filter query options
# Supported logical operations/options are: eq, ne, le, lt, ge, gt, bt, nb, in
#sap.odata#00.select#00.fieldname =
#sap.odata#00.select#00.option =
#sap.odata#00.select#00.low =
#sap.odata#00.select#00.high =
# If set to 1 the connector will subscribe to push-notifications issued by the corresponding OData service entity
#sap.odata#00.subscription.enable = 0

So I tried to create my own, like so:

{
    "name": "sap-hana-source-connector",
    "config": {
        "connector.class": "org.init.ohja.kafka.connect.odatav4.source.OData4SourceConnector",
        "sap.odata.user.name": "username",
        "sap.odata.host.address": "blablabla.companyName.com",
        "sap.odata.host.port": "443",
        "sap.odata.host.protocol": "https",
        "sap.odata#00.service": "/companyName/Foo/Bar/Baz/Foo/Table/Resource.xsodata",
        "sap.odata#00.entityset": "Resource",
        "sap.odata.user.pwd": "pwd"
    }
}

The issue is that the only error I get is this:

{
    "error_code": 400,
    "message": "Connector configuration is invalid and contains the following 14 error(s):\nInvalid configuration sap.odata.host.address: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.host.protocol: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.host.port: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.user.name: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.user.pwd: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.max.retries: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.min.retry.backoff.ms: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.max.retry.backoff.ms: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.connection.connect.timeout.ms: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.connection.read.timeout.ms: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.query-params: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.trace.mode: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.trace.path: No configured service reachable. Maybe invalid destination configuration?\nInvalid configuration sap.odata.decimal.mapping: No configured service reachable. Maybe invalid destination configuration?\nYou can also find the above list of errors at the endpoint `/connector-plugins/{connectorType}/config/validate`"
}

As someone who is completely new to OData and SAP, I don't know how I'd debug this.

I noticed that, in the OData's Kafka Source Connector documentation the services end in .svc and not .xsodata; so maybe it's something to do with that?

Also, what am I supposed to be for the sap.odata#00.entityset config?

Is there a way to get a more detailed error message?

Thanks.


来源: stackexchange

问:
Return all possible sorted lists when no tie-breaker is given
Suppose we have a list of tuples, say:

my_list = [(1, 100), (2, 100), (1, 101)]

Now we can sort this list in python based on the second element of each tuple using the following line of code:

sorted_list = sorted(my_list, key=lambda x: x[1])

This gives us a single sorted list:

[(1, 100), (2, 100), (1, 101)]

The first and the second elements in this list have the same value of the key (second element of tuple) that we sorted the list according to it.

But what if we actually wanted to get all possible sortings of the list, regardless of any tie-breaking rule. More precisely, I am looking for a function that produces the following result:

get_all_sorts(my_list)

# Result:

[[(1, 100), (2, 100), (1, 101)], [(2, 100), (1, 100), (1, 101)]]

Note that I am not simply looking for the permutations of the list, but the permutations that are also sorted. I know I can generate all permutations and pick the sorted ones but that is very time-consuming. Any better solution would be appreciated.

ContentLicense: CC BY-SA 4.0


问:
Optimization, global variables and memory-barriers
In the following example the variable v is not accessible from outside this TU. So the compiler can optimize the loop in main() to an empty loop. This is done with -O3, but with -Os it remains a loop with the load of v outside the loop, so that it is effectively an endless loop without effect.

The function isr() could be optimized away, but is not since it should resemble an ISR and therefore hast the used attribute.

If one changes v to an external visible global, the assemble code remains the same!

How can the compiler reason, that v remains unmodified in this case?

Inserting a memory-barrier sure fixes that in both cases. But why isn't it suffcient to make v external visible?

```<code>#include <avr/cpufunc.h>

//int v;
namespace {
    int v;
    void isr()
        __asm__("__vector_5")
        __attribute__ ((__signal__,
        __used__
        ));
    void isr() {
        v += 1;
    }
}

int main() {
    while(true) {
//        _MemoryBarrier();
        if (v == 42) {
            v += 1;
        }
    }
}
</code>```

https://godbolt.org/z/4j7En41sE

Body:
In the following example the variable v is not accessible from outside this TU. So the compiler can optimize the loop in main() to an empty loop. This is done with -O3, but with -Os it remains a loop with the load of v outside the loop, so that it is effectively an endless loop without effect.

The function isr() could be optimized away, but is not since it should resemble an ISR and therefore hast the used attribute.

If one changes v to an external visible global, the assemble code remains the same!

How can the compiler reason, that v remains unmodified in this case?

Inserting a memory-barrier sure fixes that in both cases. But why isn't it suffcient to make v external visible?

#include <avr/cpufunc.h>

//int v;
namespace {
    int v;
    void isr()
        __asm__("__vector_5")
        __attribute__ ((__signal__,
        __used__
        ));
    void isr() {
        v += 1;
    }
}

int main() {
    while(true) {
//        _MemoryBarrier();
        if (v == 42) {
            v += 1;
        }
    }
}

https://godbolt.org/z/4j7En41sE


问:
Single session enforcement using signalR/Long polling
I want to implement single session enforcement in my application. Meaning if another login activity found for the same user in different browser/different machine then then first session should get auto logoff. If I use the Ajax polling then unnecessary network traffic will happen. So am planning to use signalR.
For that i tried simple click event. Its working without refreshing the page from browser 1 to browser 2.

I created hubclass and my cshtml as follows

```<code>var myHub = $.connection.myHub;

$.connection.hub.logging = true;
$.connection.hub.start();

myHub.client.Postmessage = function (message) {
$('#message1').append('<li><strong>'+ htmlEncode(messaage) + '</li>')
$("btnClick").click(function () (

var message = $('message').val();
myHub.server.helloServer(message);
$('#message1').val('').focus();
</code>```

External service class to find the session details

```<code> private static ISSEnforcementSvc ssEnforcement;
 public static SSEnforcementSVC GetSSEnforcementService()
 {
   if (ssEnforcement == null)
   {
    var localService GetLocalizationsvc;
    var configurationSvc = GetConfigurationSvc();
    var cacheSvc = GetCacheSvc();
    ssessionEnforcement Service = new
    SinglesessionEnforcementService(localService,
                            configurationSvc,cacheSvc)
    }
   return ssEnforcement;
 }
</code>```

Please suggest how to implement same way to push the 1st browser to logoff.

Body:
I want to implement single session enforcement in my application. Meaning if another login activity found for the same user in different browser/different machine then then first session should get auto logoff. If I use the Ajax polling then unnecessary network traffic will happen. So am planning to use signalR.
For that i tried simple click event. Its working without refreshing the page from browser 1 to browser 2.

I created hubclass and my cshtml as follows

var myHub = $.connection.myHub;

$.connection.hub.logging = true;
$.connection.hub.start();

myHub.client.Postmessage = function (message) {
$('#message1').append('
'+ htmlEncode(messaage) + '
')
$("btnClick").click(function () (

var message = $('message').val();
myHub.server.helloServer(message);
$('#message1').val('').focus();

External service class to find the session details

 private static ISSEnforcementSvc ssEnforcement;
 public static SSEnforcementSVC GetSSEnforcementService()
 {
   if (ssEnforcement == null)
   {
    var localService GetLocalizationsvc;
    var configurationSvc = GetConfigurationSvc();
    var cacheSvc = GetCacheSvc();
    ssessionEnforcement Service = new
    SinglesessionEnforcementService(localService,
                            configurationSvc,cacheSvc)
    }
   return ssEnforcement;
 }

Please suggest how to implement same way to push the 1st browser to logoff.


问:
Selenium webdriver same whatsapp window problem in c#
I am working on a C# project where I am trying to send a excel file by WhatsApp. The problem is that whenever I run the code a new instance of command window is open, and a new window is opened for chrome every time I ran the code. Before running the code, I have already log-in to my WhatsApp account and wants to use the same window and tab to avoid logging each time. I have tried to use several ways to stop this but failed to achieve the result. Please correct the code. Please don't mind my bad English.</p>
```<code> var options = new ChromeOptions();
        options.AddArguments(@"user-data-dir=C:\Users\Umesh Aggarwal\AppData\Local\Google\Chrome\User Data");
        IWebDriver driver = new ChromeDriver(@"C:\Users\Umesh Aggarwal\Desktop\chromedriver_win32", options);

        ////// Navigate to Whatsapp web
        driver.Navigate().GoToUrl("https://web.whatsapp.com/");
        IReadOnlyCollection<string> windowHandles = driver.WindowHandles;

        // Find already opened window with Chrome
        string chromeWindow = "";
        foreach (string window in windowHandles)
        {
            driver.SwitchTo().Window(window);
            if (driver.Title.Contains("Google Chrome"))
            {
                chromeWindow = window;
                break;
            }
        }

        // Switch to Chrome window
        driver.SwitchTo().Window(chromeWindow);

        // Get all open tabs in Chrome window
        IReadOnlyCollection<string> tabHandles = driver.WindowHandles;

        // Find already opened tab of Whatsapp web
        string whatsappTab = "";
        foreach (string tab in tabHandles)
        {
            driver.SwitchTo().Window(tab);
            if (driver.Title.Contains("Whatsapp"))
            {
                whatsappTab = tab;
                break;
            }
        }

        //// Switch to Whatsapp tab
        driver.SwitchTo().Window(whatsappTab);
</code>```

Body:
I am working on a C# project where I am trying to send a excel file by WhatsApp. The problem is that whenever I run the code a new instance of command window is open, and a new window is opened for chrome every time I ran the code. Before running the code, I have already log-in to my WhatsApp account and wants to use the same window and tab to avoid logging each time. I have tried to use several ways to stop this but failed to achieve the result. Please correct the code. Please don't mind my bad English.

 var options = new ChromeOptions();
        options.AddArguments(@"user-data-dir=C:\Users\Umesh Aggarwal\AppData\Local\Google\Chrome\User Data");
        IWebDriver driver = new ChromeDriver(@"C:\Users\Umesh Aggarwal\Desktop\chromedriver_win32", options);

        ////// Navigate to Whatsapp web
        driver.Navigate().GoToUrl("https://web.whatsapp.com/");
        IReadOnlyCollection<string> windowHandles = driver.WindowHandles;

        // Find already opened window with Chrome
        string chromeWindow = "";
        foreach (string window in windowHandles)
        {
            driver.SwitchTo().Window(window);
            if (driver.Title.Contains("Google Chrome"))
            {
                chromeWindow = window;
                break;
            }
        }

        // Switch to Chrome window
        driver.SwitchTo().Window(chromeWindow);

        // Get all open tabs in Chrome window
        IReadOnlyCollection<string> tabHandles = driver.WindowHandles;

        // Find already opened tab of Whatsapp web
        string whatsappTab = "";
        foreach (string tab in tabHandles)
        {
            driver.SwitchTo().Window(tab);
            if (driver.Title.Contains("Whatsapp"))
            {
                whatsappTab = tab;
                break;
            }
        }

        //// Switch to Whatsapp tab
        driver.SwitchTo().Window(whatsappTab);


问:
Pandas DF Index column causing issues in Selenium
I am attempting to automate a browser submission using Python and Selenium, part of this involves reading in a csv file and parsing these parameters into the browser element IDs - the problem is, the dataframe is attempting to parse the index column as part of any of the columns I am submitting - the main problem is affecting the text drop down fields.

Here is my read_csv:

```<code>df = pd.read_csv(r'C:\Users\xxx\xxx.csv', sep=';', dtype=str)
</code>```

when running a print(df.Color) it gives me:

```<code>0        Blue
</code>```

I then set a variable called color: Color = df.Color

My selenium variable parse looks like this:

```<code>Select(driver.find_element("id", "color")).select_by_visible_text(Color)
</code>```

The error I receive is:

```<code>selenium.common.exceptions.NoSuchElementException: Message: Could not locate element with visible text: 0    Blue
</code>```

This does not happen to any of the free text fields - they work perfectly but the select drop down is the issue - any advice?

Body:
I am attempting to automate a browser submission using Python and Selenium, part of this involves reading in a csv file and parsing these parameters into the browser element IDs - the problem is, the dataframe is attempting to parse the index column as part of any of the columns I am submitting - the main problem is affecting the text drop down fields.

Here is my read_csv:

df = pd.read_csv(r'C:\Users\xxx\xxx.csv', sep=';', dtype=str)

when running a print(df.Color) it gives me:

0        Blue

I then set a variable called color: Color = df.Color

My selenium variable parse looks like this:

Select(driver.find_element("id", "color")).select_by_visible_text(Color)

The error I receive is:

selenium.common.exceptions.NoSuchElementException: Message: Could not locate element with visible text: 0    Blue

This does not happen to any of the free text fields - they work perfectly but the select drop down is the issue - any advice?


问:
c# Passing array of objects with global namespace to WebMethod
I am not being able to generate the request for the following xml:

```<code><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sga="urn:erp-ws-schemas/codeunit/SGA"
xmlns:rec="RecogerAlbaranes">
<soapenv:Header/>
<soapenv:Body>
  <sga:RecogerAlbaranes>
    <sga:parametros>
      <!--1 or more repetitions:-->
      <Fila>
        <id>0001</id>
          ....
      </Fila>
      <Fila>
        <id>0002</id>
          ....
      </Fila>
       .....
    </sga:parametros>
  </sga:RecogerAlbaranes>
</soapenv:Body>
</soapenv:Envelope>
</code>```

The xml request that my webservice has is this one.
The problem is that Fila is using the wrong namespace.

```<code><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sga="urn:erp-ws-schemas/codeunit/SGA"
xmlns:rec="RecogerAlbaranes">
<soapenv:Header/>
<soapenv:Body>
  <sga:RecogerAlbaranes>
    <sga:parametros>
      <!--1 or more repetitions:-->
      <sga:Fila>
        <id></id>
        ...
      </sga:Fila>
       ....
    </sga:parametros>
  </sga:RecogerAlbaranes>
</soapenv:Body>
</soapenv:Envelope>
</code>```

My webmethod is like this

```<code>[WebMethod]
[SoapDocumentMethod(Action = "RecogerAlbaranes")]
[return: XmlElementAttribute("response")]
public XmlDocument RecogerAlbaranes(List<Fila> parametros)
{ ... }
</code>```

The class Fila:

```<code><XmlRoot([Namespace]:="">
Public Class Fila
{ ... }
</code>```

I tried to using the attribute xmlns inside Fila class but gives me an error becase its not allowed.

I also tried wrapping Fila array inside a class named cParameters, but that generates a nested <parametros>

```<code><XmlRoot([Namespace]:="">
Public Class cParametros
{
   [XmlArrayItem(ElementName = "Fila", Type = typeof(Fila))]
   [XmlArray(ElementName = "parametros")]
    public List<Fila> parametros { get; set; } = new List<Fila>();
}

public XmlDocument RecogerAlbaranes(cParametros parametros)
{ ... }
</code>```

I have also tried some parameters of [SoapDocumentMethod] but without success.

I'm starting to get desperate, is this even possible?

Body:
I am not being able to generate the request for the following xml:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sga="urn:erp-ws-schemas/codeunit/SGA"
xmlns:rec="RecogerAlbaranes">
<soapenv:Header/>
<soapenv:Body>
  <sga:RecogerAlbaranes>
    <sga:parametros>

      <Fila>
        <id>0001</id>
          ....
      </Fila>
      <Fila>
        <id>0002</id>
          ....
      </Fila>
       .....
    </sga:parametros>
  </sga:RecogerAlbaranes>
</soapenv:Body>
</soapenv:Envelope>

The xml request that my webservice has is this one.
The problem is that Fila is using the wrong namespace.

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sga="urn:erp-ws-schemas/codeunit/SGA"
xmlns:rec="RecogerAlbaranes">
<soapenv:Header/>
<soapenv:Body>
  <sga:RecogerAlbaranes>
    <sga:parametros>

      <sga:Fila>
        <id></id>
        ...
      </sga:Fila>
       ....
    </sga:parametros>
  </sga:RecogerAlbaranes>
</soapenv:Body>
</soapenv:Envelope>

My webmethod is like this

[WebMethod]
[SoapDocumentMethod(Action = "RecogerAlbaranes")]
[return: XmlElementAttribute("response")]
public XmlDocument RecogerAlbaranes(List<Fila> parametros)
{ ... }

The class Fila:

<XmlRoot([Namespace]:="">
Public Class Fila
{ ... }

I tried to using the attribute xmlns inside Fila class but gives me an error becase its not allowed.

I also tried wrapping Fila array inside a class named cParameters, but that generates a nested <parametros>

<XmlRoot([Namespace]:="">
Public Class cParametros
{
   [XmlArrayItem(ElementName = "Fila", Type = typeof(Fila))]
   [XmlArray(ElementName = "parametros")]
    public List<Fila> parametros { get; set; } = new List<Fila>();
}

public XmlDocument RecogerAlbaranes(cParametros parametros)
{ ... }

I have also tried some parameters of [SoapDocumentMethod] but without success.

I'm starting to get desperate, is this even possible?


问:
Diff values file using helm provider
I hope you can help me light some more light on my issue.

Currently I'm using:

Terraform v1.3.5

Helm provider v2.8.0

Kubernetes provider v2.16.1

Lately I've been adapting the helm provider on Terraform, to help me manage Helm releases with more resiliency. It helps a lot to be able to plan changes and see what has changed and what remains the same. It merges really well with the infrastructure details and I can manage everything with just one tool, it has been great.

There is one thing that bothers me a little. It's the terraform plan preview of the values file, it just shows you that some changes have been made, but not where or which. Let me add an example.

File main.tf:

```<code># I'm using the "manifest" setting to calculate manifest diffs
provider "helm" {
  kubernetes {
    config_path    = "~/.kube/config"
    config_context = "clusterconfig"
  }
  experiments {
    manifest = true
  }
}

# The helm chart lives locally on my repo. I'm passing the values file and an
#  override for the image tag.
resource "helm_release" "release" {
  name      = "example"
  chart     = "../../helm/chart"
  namespace = "example"
  wait      = true
  set {
    name  = "image.tag"
    value = "latest"
  }
  values = [
    file("helm/values-example.yaml")
  ]
}
</code>```

This works great, the problem comes when I make a change on the values file. It shows the whole file instead of just the changes. For example in my values file I change the replicas from 1 to 2:

File values-example.yaml:

replicaCount: 1
image:
  repository: test
  pullPolicy: ifNotPresent
```
<p>The execution:</p>
<pre class="lang-bash prettyprint-override"><code>$ terraform plan
(...)
Terraform will perform the following actions:

  # helm_release.example will be updated in-place
  ~ resource "helm_release" "example" {
      ~ manifest       = jsonencode(
          ~ {
              ~ "deployment.apps/apps/v1/deployname"      = {
                  ~ spec       = {
                      - replicas = 1 -> 2
                        }
                    }
                }
            }
        )
  ~ values                     = [
    - <<-EOT
    replicaCount: 1
    image:
      repository: test
      pullPolicy: ifNotPresent
    EOT,
    + <<-EOT
    replicaCount: 2
    image:
      repository: test
      pullPolicy: ifNotPresent
    EOT,
  ]
</code>```

This makes it very difficult to see which values settings have been changed, when the values file is bigger.

So then, my question, do you know if there is a way to diff the values? I would like to see only the changes instead of the whole file.

What I've seen online:

It's been asked for on GitHub, but closed https://github.com/hashicorp/terraform-provider-helm/issues/305

Maybe something like this can be implemented: Use diferent values in helm deploy through Terraform (for_each)

Thanks in advance for the help. Let me know if I can help with any more information.

Title: Diff values file using helm provider

Body:
I hope you can help me light some more light on my issue.

Currently I'm using:

Terraform v1.3.5

Helm provider v2.8.0

Kubernetes provider v2.16.1

Lately I've been adapting the helm provider on Terraform, to help me manage Helm releases with more resiliency. It helps a lot to be able to plan changes and see what has changed and what remains the same. It merges really well with the infrastructure details and I can manage everything with just one tool, it has been great.

There is one thing that bothers me a little. It's the terraform plan preview of the values file, it just shows you that some changes have been made, but not where or which. Let me add an example.

File main.tf:

# I'm using the "manifest" setting to calculate manifest diffs
provider "helm" {
  kubernetes {
    config_path    = "~/.kube/config"
    config_context = "clusterconfig"
  }
  experiments {
    manifest = true
  }
}

# The helm chart lives locally on my repo. I'm passing the values file and an
#  override for the image tag.
resource "helm_release" "release" {
  name      = "example"
  chart     = "../../helm/chart"
  namespace = "example"
  wait      = true
  set {
    name  = "image.tag"
    value = "latest"
  }
  values = [
    file("helm/values-example.yaml")
  ]
}

This works great, the problem comes when I make a change on the values file. It shows the whole file instead of just the changes. For example in my values file I change the replicas from 1 to 2:

File values-example.yaml:

replicaCount: 1
image:
  repository: test
  pullPolicy: ifNotPresent

The execution:

$ terraform plan
(...)
Terraform will perform the following actions:

  # helm_release.example will be updated in-place
  ~ resource "helm_release" "example" {
      ~ manifest       = jsonencode(
          ~ {
              ~ "deployment.apps/apps/v1/deployname"      = {
                  ~ spec       = {
                      - replicas = 1 -> 2
                        }
                    }
                }
            }
        )
  ~ values                     = [
    - <<-EOT
    replicaCount: 1
    image:
      repository: test
      pullPolicy: ifNotPresent
    EOT,
    + <<-EOT
    replicaCount: 2
    image:
      repository: test
      pullPolicy: ifNotPresent
    EOT,
  ]

This makes it very difficult to see which values settings have been changed, when the values file is bigger.

So then, my question, do you know if there is a way to diff the values? I would like to see only the changes instead of the whole file.

What I've seen online:

It's been asked for on GitHub, but closed https://github.com/hashicorp/terraform-provider-helm/issues/305

Maybe something like this can be implemented: Use diferent values in helm deploy through Terraform (for_each)

Thanks in advance for the help. Let me know if I can help with any more information.


问:
Generating report Dataframe without loop
There are two CSV files having same following schema, generated a month apart FILE20221105.csv and FILE20221205.csv.

```<code>Key:Int
Val1:String
Val2:String
Val3:String
Val4:String
</code>```

Some of the Key will have Val column with string “N/A”. I want to find percentage of “N/A” in each column. I can do that the following way after reading CSV file in the dataframe say df

```<code>((df.drop([‘Key’], axis=1))==”N/A”).mean()
</code>```

I will get say something like this (Example)

```<code>Val1:0.33
Val2:0.25
Val3:0.1
Val4:0.2
</code>```

But real ask has one more condition that I am trying to do without a loop
The requirement is to find percentage of “N/A” in each Val column in current month but not having “N/A” last month. Both CSV are joined based on column Key (Inner join). Column Key has unique value.

```<code>**Example**

FILE20221105.csv (All row with N/A in this month will not be considered)

Key    Val1    Val2    Val3    Val4
101    A1      B1      C1      N/A
102    N/A     B2      C2      D2
103    A3      N/A     C3      D3
104    A4      B4      N/A     D4
105    A5      B1      C1      N/A
106    A6      B2      C2      D2
107    A7      N/A     C3      D3
108    A8      B4      C4      D4

FILE20221205.csv (All row which previously is Non N/A but N/A this month will be considered)

Key    Val1    Val2    Val3    Val4
101    A1      B1      C1      D1
102    A2      B2      C2      D2
103    A3      B3      C3      D3
104    A4      N/A     C4      D4
105    A5      N/A     C1      D1
106    A6      N/A     C2      N/A
107    N/A     B3      C3      N/A
108    N/A     B4      N/A     D4

Output

Val1:5/7 (7 in denominator as 1 value in previous month row was N/A, in current month 2 out of remaining 7 are N/A therefore 5 in numerator)
Val2:3/6 (6 in denominator as 2 value in previous month row was N/A, in current month 3 out of remaining 6 are N/A therefore 3 in numerator)
Val2:6/7 (7 in denominator as 1 value in previous month row was N/A, in current month 1 out of remaining 7 are N/A therefore 5 in numerator)
Val2:4/6 (6 in denominator as 2 value in previous month row was N/A, in current month 2 out of remaining 6 are N/A therefore 4 in numerator)
</code>```

Body:
There are two CSV files having same following schema, generated a month apart FILE20221105.csv and FILE20221205.csv.

Key:Int
Val1:String
Val2:String
Val3:String
Val4:String

Some of the Key will have Val column with string “N/A”. I want to find percentage of “N/A” in each column. I can do that the following way after reading CSV file in the dataframe say df

((df.drop([‘Key’], axis=1))==”N/A”).mean()

I will get say something like this (Example)

Val1:0.33
Val2:0.25
Val3:0.1
Val4:0.2

But real ask has one more condition that I am trying to do without a loop
The requirement is to find percentage of “N/A” in each Val column in current month but not having “N/A” last month. Both CSV are joined based on column Key (Inner join). Column Key has unique value.

**Example**

FILE20221105.csv (All row with N/A in this month will not be considered)

Key    Val1    Val2    Val3    Val4
101    A1      B1      C1      N/A
102    N/A     B2      C2      D2
103    A3      N/A     C3      D3
104    A4      B4      N/A     D4
105    A5      B1      C1      N/A
106    A6      B2      C2      D2
107    A7      N/A     C3      D3
108    A8      B4      C4      D4

FILE20221205.csv (All row which previously is Non N/A but N/A this month will be considered)

Key    Val1    Val2    Val3    Val4
101    A1      B1      C1      D1
102    A2      B2      C2      D2
103    A3      B3      C3      D3
104    A4      N/A     C4      D4
105    A5      N/A     C1      D1
106    A6      N/A     C2      N/A
107    N/A     B3      C3      N/A
108    N/A     B4      N/A     D4

Output

Val1:5/7 (7 in denominator as 1 value in previous month row was N/A, in current month 2 out of remaining 7 are N/A therefore 5 in numerator)
Val2:3/6 (6 in denominator as 2 value in previous month row was N/A, in current month 3 out of remaining 6 are N/A therefore 3 in numerator)
Val2:6/7 (7 in denominator as 1 value in previous month row was N/A, in current month 1 out of remaining 7 are N/A therefore 5 in numerator)
Val2:4/6 (6 in denominator as 2 value in previous month row was N/A, in current month 2 out of remaining 6 are N/A therefore 4 in numerator)


问:
Swiper js - timeline section
I made a timeline section using swiper js.
When I swipe left or right my timeline is very synchronous and when I move the swiper the dates diverge. The new date overtakes the old date, etc.

Do you have any idea how to modify this timeline to make it work properly?
It should be in sync with each other and run smoothly
The carousel is faster than the top carousel

```<code>`https://jsfiddle.net/u8sLjbxn/1/`
</code>```

I have been struggling to create a timeline, but it is not working properly

Title: Swiper js - timeline section

Body:
I made a timeline section using swiper js.
When I swipe left or right my timeline is very synchronous and when I move the swiper the dates diverge. The new date overtakes the old date, etc.

Do you have any idea how to modify this timeline to make it work properly?
It should be in sync with each other and run smoothly
The carousel is faster than the top carousel

`https://jsfiddle.net/u8sLjbxn/1/`

I have been struggling to create a timeline, but it is not working properly


问:
history.back not working on bootstrap tabs using jQuery in asp.net c#
I'm working with bootstrap tabs on web page and placing custom back button(a tag) so if I click on the back button the previously loaded tabs should come order wise along with tabs data but here I'm facing one problem that is if I click on the back button the back arrow is hilighting (and local url is changing) but tabs data is not coming for that I have written logic in  jsfiddle

And also I have tried some different logics like below

```<code>  $("#button").click(function(event) {
         event.preventDefault();
         history.back(1);
     });
 <a href="javascript: history.go(1)" id="button">back</a>
 <a href="javascript: history.back(1)" id="button">back</a>
</code>```

But it doesn't work.

Suggest me how to achieve this.

If I did anything wrong please correct me.

Please help.

Body:
I'm working with bootstrap tabs on web page and placing custom back button(a tag) so if I click on the back button the previously loaded tabs should come order wise along with tabs data but here I'm facing one problem that is if I click on the back button the back arrow is hilighting (and local url is changing) but tabs data is not coming for that I have written logic in  jsfiddle

And also I have tried some different logics like below

  $("#button").click(function(event) {
         event.preventDefault();
         history.back(1);
     });
 back
 back

But it doesn't work.

Suggest me how to achieve this.

If I did anything wrong please correct me.

Please help.


问:
WebCam texture doesn't work on Build Windows - Unity 2022.1.17f1
WebCamTexture works fine on editor, but doesn't work on Build. I have tried: turn off antivirus and firewall, check authorization, put the webcamtexture on UI_RawImage and a plane gameObject, nothing works on build. There is no any real conclusion about the same bug on the forums (many are about Vuforia, and I just want to take a photo by a simple webcam on Windows). Any clues? Below the code. Tks in advance.

```<code>using UnityEngine;
 using System.Collections;
 using System.IO;
 using UnityEngine.UI;
 using System.Collections.Generic;

 // https://stackoverflow.com/questions/24496438/can-i-take-a-photo-in-unity-using-the-devices-camera

 public class GetCam2 : MonoBehaviour
 {
     WebCamTexture webCam;
     //string your_path = "D:\\Lixo\\FotosCam";// any path you want to save your image
     [SerializeField] string your_path = "";
     public RawImage display;
     public AspectRatioFitter fit;
     public int contadorFotos;
     [SerializeField] GameObject planoWeb;

     IEnumerator Start()
     {
         your_path = "" + Application.dataPath;

         yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
         if (Application.HasUserAuthorization(UserAuthorization.WebCam)) {
            LigaCamComeco1();
         }

     }

     void LigaCamComeco1() {
         if (WebCamTexture.devices.Length == 0)
         {
             Debug.LogError("can not found any camera!");
             return;
         }
         int index = -1;
         for (int i = 0; i < WebCamTexture.devices.Length; i++)
         {
             if (WebCamTexture.devices[i].name.ToLower().Contains("pc"))
             {
                 Debug.Log("WebCam Name:" + WebCamTexture.devices[i].name + "   Webcam Index:" + i);
                 index = i;
             }
         }

         if (index == -1)
         {
             Debug.LogError("can not found your camera name!");
             return;
         }

         WebCamDevice device = WebCamTexture.devices[index];
         webCam = new WebCamTexture(device.name);
         webCam.Play();
         display.texture = webCam;
         planoWeb.GetComponent<Renderer>().materials[0].mainTexture = webCam;
     }

 public void Update()
     {
         if (Input.GetKeyDown(KeyCode.PageUp)) {
             Ratio();
             callTakePhoto();
         }
     }

     void Ratio() {
         float ratio = (float)webCam.width / (float)webCam.height;
         fit.aspectRatio = ratio;

         float ScaleY = webCam.videoVerticallyMirrored ? -1f : 1f;
         display.rectTransform.localScale = new Vector3(1f, ScaleY, 1f);

         int orient = -webCam.videoRotationAngle;
         display.rectTransform.localEulerAngles = new Vector3(0, 0, orient);
     }

     public void callTakePhoto() // call this function in button click event
     {
         StartCoroutine(TakePhoto());
     }
     IEnumerator TakePhoto()  // Start this Coroutine on some button click
     {
         yield return new WaitForEndOfFrame();

         Texture2D photo = new Texture2D(webCam.width, webCam.height);
         photo.SetPixels(webCam.GetPixels());
         photo.Apply();

         byte[] bytes = photo.EncodeToJPG();
         File.WriteAllBytes(your_path + "\\ZaxisCam" + contadorFotos + ".jpg", bytes);
         contadorFotos++;

     }
 }
</code>```

I have tried: turn off antivirus and firewall, check authorization, put the webcamtexture on UI_RawImage and a plane gameObject, nothing works on build.

Body:
WebCamTexture works fine on editor, but doesn't work on Build. I have tried: turn off antivirus and firewall, check authorization, put the webcamtexture on UI_RawImage and a plane gameObject, nothing works on build. There is no any real conclusion about the same bug on the forums (many are about Vuforia, and I just want to take a photo by a simple webcam on Windows). Any clues? Below the code. Tks in advance.

using UnityEngine;
 using System.Collections;
 using System.IO;
 using UnityEngine.UI;
 using System.Collections.Generic;

 // https://stackoverflow.com/questions/24496438/can-i-take-a-photo-in-unity-using-the-devices-camera

 public class GetCam2 : MonoBehaviour
 {
     WebCamTexture webCam;
     //string your_path = "D:\\Lixo\\FotosCam";// any path you want to save your image
     [SerializeField] string your_path = "";
     public RawImage display;
     public AspectRatioFitter fit;
     public int contadorFotos;
     [SerializeField] GameObject planoWeb;

     IEnumerator Start()
     {
         your_path = "" + Application.dataPath;

         yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
         if (Application.HasUserAuthorization(UserAuthorization.WebCam)) {
            LigaCamComeco1();
         }

     }

     void LigaCamComeco1() {
         if (WebCamTexture.devices.Length == 0)
         {
             Debug.LogError("can not found any camera!");
             return;
         }
         int index = -1;
         for (int i = 0; i < WebCamTexture.devices.Length; i++)
         {
             if (WebCamTexture.devices[i].name.ToLower().Contains("pc"))
             {
                 Debug.Log("WebCam Name:" + WebCamTexture.devices[i].name + "   Webcam Index:" + i);
                 index = i;
             }
         }

         if (index == -1)
         {
             Debug.LogError("can not found your camera name!");
             return;
         }

         WebCamDevice device = WebCamTexture.devices[index];
         webCam = new WebCamTexture(device.name);
         webCam.Play();
         display.texture = webCam;
         planoWeb.GetComponent<Renderer>().materials[0].mainTexture = webCam;
     }

 public void Update()
     {
         if (Input.GetKeyDown(KeyCode.PageUp)) {
             Ratio();
             callTakePhoto();
         }
     }

     void Ratio() {
         float ratio = (float)webCam.width / (float)webCam.height;
         fit.aspectRatio = ratio;

         float ScaleY = webCam.videoVerticallyMirrored ? -1f : 1f;
         display.rectTransform.localScale = new Vector3(1f, ScaleY, 1f);

         int orient = -webCam.videoRotationAngle;
         display.rectTransform.localEulerAngles = new Vector3(0, 0, orient);
     }

     public void callTakePhoto() // call this function in button click event
     {
         StartCoroutine(TakePhoto());
     }
     IEnumerator TakePhoto()  // Start this Coroutine on some button click
     {
         yield return new WaitForEndOfFrame();

         Texture2D photo = new Texture2D(webCam.width, webCam.height);
         photo.SetPixels(webCam.GetPixels());
         photo.Apply();

         byte[] bytes = photo.EncodeToJPG();
         File.WriteAllBytes(your_path + "\\ZaxisCam" + contadorFotos + ".jpg", bytes);
         contadorFotos++;

     }
 }

I have tried: turn off antivirus and firewall, check authorization, put the webcamtexture on UI_RawImage and a plane gameObject, nothing works on build.


问:
Sleuth TraceId IllegalArgumentException Exception
Encountering the below exception, when using Sleuth along with Spring Boot

The Stack trace is as follows :

ZipkinHttpSpanExtractor.joinTrace 51 : Exception occurred while trying to extract span from carrier java.lang.IllegalArgumentException: Can't convert empty hex string to long at org.springframework.util.Assert.hasText(Assert.java:181) at org.springframework.cloud.sleuth.Span.hexToId(Span.java:583) at org.springframework.cloud.sleuth.instrument.web.ZipkinHttpSpanExtractor.buildParentSpan(ZipkinHttpSpanExtractor.java:91) at org.springframework.cloud.sleuth.instrument.web.ZipkinHttpSpanExtractor.joinTrace(ZipkinHttpSpanExtractor.java:49) at org.springframework.cloud.sleuth.instrument.web.ZipkinHttpSpanExtractor.joinTrace(ZipkinHttpSpanExtractor.java:19)

Using Sprint Boot version is 1.5.3 and spring-cloud-sleuth-core/1.3.1

Any pointers on the fix would be helpful... Thanks in advance.


问:
Dependency in pom refers to a parent pom which when running locally fails
I have a service where I have added dependency which contains relative path to a parent pom. When I try to build this locally, the local build fails complaining that its unable to find the parent pom.

Suggestion to overcome this issue so that I can build the project locally


问:
How to Get same Connection id in django for every file
Every time I run my Django webservice the connection (django and MySQL connector) is same for every python function that I call but Connection_id from MySQL workbench is different for every python function. My temporary table keeps dropping from the DB which was created from a python function A and has to be accessed by another independent python function B at a later point of time from a different webservice. I guess the temporary table is being dropped as a result of new instances(connection_id) getting generated in the MySQL DB everytime I run a webservice to call my python functions.

Example outputs of connections:

Mysql Connection ID: 18423

django connection: <django.utils.connection.ConnectionProxy object at 0x00000203C0C84340>        mysql connection: <mysql.connector.connection_cext.CMySQLConnection object at 0x00000203C1B7C070>

Mysql Connection ID: 18424

django connection: <django.utils.connection.ConnectionProxy object at 0x00000203C0C84340>        mysql connection: <mysql.connector.connection_cext.CMySQLConnection object at 0x00000203C1B7C070>

Expectation Example outputs of connections:

Mysql Connection ID: 18423

django connection: <django.utils.connection.ConnectionProxy object at 0x00000203C0C84340>        mysql connection: <mysql.connector.connection_cext.CMySQLConnection object at 0x00000203C1B7C070>

same nexttime

Mysql Connection ID: 18423

django connection: <django.utils.connection.ConnectionProxy object at 0x00000203C0C84340>        mysql connection: <mysql.connector.connection_cext.CMySQLConnection object at 0x00000203C1B7C070>

Please help me with this.


问:
NESTED IF-ELIF-ELSE structures in YACC (shift/reduce conflict)
I am trying to write a Yacc program that accepts assignment and if-elif-else statements. Also, if statements can be nested. In addition, it has to be tab sensitive.

However, I am getting 4 shift/reduce conflicts. Could you help me to find out what I am doing wrong?

Thank you all.

Here is my Yacc code:

IF_END-> :

ASSIGN-> =

COMPARISON-> == != < etc.

```<code>statements:

    statement
    |
    statement statements
    ;

statement:

    assignment_statement
    |
    if_else_statement
    ;

assignment_statement:

    VAR ASSIGN operand
    |
    VAR ASSIGN o_o_list
    ;

o_o_list:

    operand OPERATOR operand
    |
    operand OPERATOR o_o_list
    ;

operand:

    VAR
    |
    INTEGER
    |
    FLOAT
    |
    STRING
    ;

if_else_statement:

    if elif else
    |
    if
    |
    if else
    ;

if:

    IF comparison TAB statements
    ;

elif:

     ELIF comparison TAB statements
    ;

else:

    ELSE IF_END TAB statements
    ;

comparison:

    operand COMPARISON operand IF_END
    ;
</code>```

And this is my example input. I am getting an error at line 6 and it stops parsing.

```<code>x = 5
y = 7
z =  3.14
if x < z :
    if y < z :
        result = z * x - y      **//line 6**
        result = result / 2
    else:
        result = z * x + y
        result = result / 2
        if result > y :
            result = result / x
    y = x * 2
elif y < x :
    result = z
else:
    result = z * x * x * y
x = y
</code>```

Body:
I am trying to write a Yacc program that accepts assignment and if-elif-else statements. Also, if statements can be nested. In addition, it has to be tab sensitive.

However, I am getting 4 shift/reduce conflicts. Could you help me to find out what I am doing wrong?

Thank you all.

Here is my Yacc code:

IF_END-> :

ASSIGN-> =

COMPARISON-> == != < etc.

statements:

    statement
    |
    statement statements
    ;

statement:

    assignment_statement
    |
    if_else_statement
    ;

assignment_statement:

    VAR ASSIGN operand
    |
    VAR ASSIGN o_o_list
    ;

o_o_list:

    operand OPERATOR operand
    |
    operand OPERATOR o_o_list
    ;

operand:

    VAR
    |
    INTEGER
    |
    FLOAT
    |
    STRING
    ;

if_else_statement:

    if elif else
    |
    if
    |
    if else
    ;

if:

    IF comparison TAB statements
    ;

elif:

     ELIF comparison TAB statements
    ;

else:

    ELSE IF_END TAB statements
    ;

comparison:

    operand COMPARISON operand IF_END
    ;

And this is my example input. I am getting an error at line 6 and it stops parsing.

x = 5
y = 7
z =  3.14
if x < z :
    if y < z :
        result = z * x - y      **//line 6**
        result = result / 2
    else:
        result = z * x + y
        result = result / 2
        if result > y :
            result = result / x
    y = x * 2
elif y < x :
    result = z
else:
    result = z * x * x * y
x = y


问:
VoiceOver cursor not in sync with they keyboard focus
I'm having a hard time understanding the behavior of the VoiceOver cursor - even though I have the "sync keyboard focus and voice over cursor" option enabled, some elements are simply skipped by the VoiceOver when using Tab to navigate. When a problematic element is focused with a keyboard, the VoiceOver cursor simply stays on the previously focused element and moves further when the next element is focused.

There are also elements that are skipped by VO when going top to bottom of the page but they are focused when going in the other direction. The elements in question have appropriate roles and tabindexes and are visible in the accessibility tree.

What could be the reason for such behavior of the VoiceOver cursor?


问:
Vue.JS: Add Subfolder "index.html" pages when running "npm run build"
I recreated the problem with the vue-starter-project:
When I have routes with subfolders such aus "/about"

```<code>  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    }
  ]
</code>```

I only get the static "index.html" for the '/' route and not the subfolders, such as '/about' as you can see in the build process:

dist/assets/logo-da9b9095.svg        0.31 kB

dist/index.html                      0.42 kB

dist/assets/AboutView-4d995ba2.css   0.09 kB │ gzip:  0.10 kB

dist/assets/index-81e4655a.css       4.18 kB │ gzip:  1.31 kB

dist/assets/AboutView-10e3979e.js    0.23 kB │ gzip:  0.20 kB

dist/assets/index-415e8d46.js       83.95 kB │ gzip: 33.03 kB

How should I change what file to make it work?

I come from nuxt where all the files are normally build but have to work on this vue project and the new hosting provider is not a node.js provider and throws me a 404 when i try to access the subfolders (cause there are no subfolders generated). I searched already for hours and could not find the solution and it drives me mad.

Body:
I recreated the problem with the vue-starter-project:
When I have routes with subfolders such aus "/about"

  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    }
  ]

I only get the static "index.html" for the '/' route and not the subfolders, such as '/about' as you can see in the build process:

dist/assets/logo-da9b9095.svg        0.31 kB

dist/index.html                      0.42 kB

dist/assets/AboutView-4d995ba2.css   0.09 kB │ gzip:  0.10 kB

dist/assets/index-81e4655a.css       4.18 kB │ gzip:  1.31 kB

dist/assets/AboutView-10e3979e.js    0.23 kB │ gzip:  0.20 kB

dist/assets/index-415e8d46.js       83.95 kB │ gzip: 33.03 kB

How should I change what file to make it work?

I come from nuxt where all the files are normally build but have to work on this vue project and the new hosting provider is not a node.js provider and throws me a 404 when i try to access the subfolders (cause there are no subfolders generated). I searched already for hours and could not find the solution and it drives me mad.


问:
Inconsistent formatting of numbers (toLocaleString) when executing testcafe-e2e tests inside docker-image
I am using the testcafe docker image for e2e-testing react components.
When using Number.prototype.toLocaleString I am not receiving the expected results for different locales I am testing with.

Local test:

Container test:

As you can see the outcome is inconsistent and the containered test run does not seem to properly apply the localization.

Since this oddity can be reproduced with chromium and firefox I am suspecting that the problem derives from the system level.

I could hardly find any information about browser related issues when using them inside a alpine-linux based container.

I stumbled upon this article https://grrr.tech/posts/2020/add-locales-to-alpine-linux-docker-image/ but the issue cannot be redeemed:
I created a new image from testcafe/testcafe:latest with the mentioned steps an made sure locale was available.
Still numbers and dates are not formatted consistently.


问:
Visual Basic Express project is not (always) saved on disk
I'm a Visual Basic newbie, doing a quick'n'dirty VB app in Visual Studio 2010 Express (under Windows 7, 64-bit).

I save constantly. I have used the "Save All" option. I have rebuilt the app.
Still, the project is not always written to disk when I save! (sometimes, my changes are written to disk, but I haven't found out yet the pattern). This is really bugging me, since quite a few times I saved my project, closed VB, and then I realized all my changes had not been saved.

Is this some limitation of VB Express? I am using Visual C++ Express, too, and I had no such problems there.

EDIT: For even more clarification -- I am not getting any errors, and I am not having problems with version control. What I do is:

I make changes in source file.

I press save.

I rebuild, at a certain time hh:mm.

I look on the disk, and sometimes my source file's "last modified time" is not hh:mm, and if I open it, the changes from 1) are not in the source file. Sometimes it is there, but I can't say for sure when or why.

The config on my machine is nothing special as far as I know, just normal Windows 7, 64-bit. I guess if it were some access rights related issue, the saving would never happen, instead of what I'm experiencing now.
By now, I think one can safely assume that this is no Visual Studio Express issue (just installed it as it came, using it "out of the box").

ContentLicense: CC BY-SA 3.0


问:
how to free inode file usage in shared hosting
I have a website with limit of 600.000 inode file usage, and almost all of it is filled, but as I have mirror websites I know that there should NOT be as much files as there is, it should be approximately 300-350.000 files
So, how can i find out which files I can delete, i am sure that most of the files are images which wordpress generates automaticaly, but anyway, how can i know which files the website doesn't use so I can delete them and free the inode files space

I tried deleting old backups and caches


问:
Find strings in a C++ file with regex
I have a large project with many CPP files containing hardcoded english strings. The idea is now to enable translations, so I want to replace in each CPP file with a function call that will return the strings depending on the language.

The idea is to write another program that would detect the strings within the CPP code and replace them with a function that returns a const string based on some unique index that will be built automatically.

For example: std::cout << "Hello"; to std::cout << s(1); or MessageBox(0,L"You are wrong!",L"Error",MB_OK); to MessageBox(0,s(2),s(3),MB_OK);

The app then will create a new CPP file with those changes and build an index with the original english strings that would now be able to be translated.

The question is, what would be a good way to use regex to detect strings?

I 've thought of /(?:")(?=(?:[^"]|"[^]*")*$)/g (as I found online, I 'm not experienced with regex). Ideally it would catch L"" (since most of the strings are unicode), raw stuff like LR"(xxx)" (altough those are a few).

Of course, I plan to have my app present me a list which I can review the proposed changes so to not accidentally fail, but I 'd wish the manual intervention would be minimal.

Perhaps later I can build a VS extension for that.

Thanks for your comments.

Title: Find strings in a C++ file with regex


问:
calling an endpoint to get cookies
I am developing an application that calls an endpoint, on which I have to authenticate to get cookie[connect. ssid] and use that cookie each I will be POSTing some data,

problem is I tried but with no success at all.

I manually login to that page and got the cookies manually and put in my request as below, and it worked.

The problem is that cookies expire after a couple of requests, my application will be deployed and that will be  a huge problem.

I want that process to automatic,

request cookies

use it if still valid, if not request a new then proceed with the request

```<code>var url = "https:abcd";
var httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = "POST";
httpRequest.Headers["Cookie"] = "connect.sid=s%3AhM62pU-YeAJFQxlNuFxYS76Fy8keCzbO.rECFaOPEiK%2FoVDzbMQjXyYlNsuT0UEew%2FWGlC4An%2FZY"; //value of the cookies
httpRequest.ContentType = "application/json";

using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
{
    streamWriter.Write(carrierjson);
}
var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
    var result = streamReader.ReadToEnd();
}
HttpStatusCode statusCode;
statusCode = httpResponse.StatusCode;
if (statusCode == HttpStatusCode.OK)
{
    //somecode here
}
</code>```

I tried this

```<code>//REST API RestSharp but not working

var client = new RestClient("https://xxxxxxxxxxxxxx");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
var body = @"{" + "\n" +
@"  ""username"": ""username""," + "\n" +
@"  ""password"": ""password""" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
</code>```

Title: calling an endpoint to get cookies

Body:
I am developing an application that calls an endpoint, on which I have to authenticate to get cookie[connect. ssid] and use that cookie each I will be POSTing some data,

problem is I tried but with no success at all.

I manually login to that page and got the cookies manually and put in my request as below, and it worked.

The problem is that cookies expire after a couple of requests, my application will be deployed and that will be  a huge problem.

I want that process to automatic,

request cookies

use it if still valid, if not request a new then proceed with the request

var url = "https:abcd";
var httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = "POST";
httpRequest.Headers["Cookie"] = "connect.sid=s%3AhM62pU-YeAJFQxlNuFxYS76Fy8keCzbO.rECFaOPEiK%2FoVDzbMQjXyYlNsuT0UEew%2FWGlC4An%2FZY"; //value of the cookies
httpRequest.ContentType = "application/json";

using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
{
    streamWriter.Write(carrierjson);
}
var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
    var result = streamReader.ReadToEnd();
}
HttpStatusCode statusCode;
statusCode = httpResponse.StatusCode;
if (statusCode == HttpStatusCode.OK)
{
    //somecode here
}

I tried this

//REST API RestSharp but not working

var client = new RestClient("https://xxxxxxxxxxxxxx");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
var body = @"{" + "\n" +
@"  ""username"": ""username""," + "\n" +
@"  ""password"": ""password""" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);


问:
Not able to swipe over iframe with react-swiper
I am using the react-swiper library to render some youtube videos in a multi carousel format they look something like this:

Each one of these videos are rendered through a component the problem i am facing is that I am not able to swipe on these youtube card here is the code of the component which conatins the iframe:

```<code>import PropTypes from "prop-types";

import styles from "./YoutubeCardSlide.module.scss";
function YoutubeCardSlide(props) {
    return (
        <div className={styles.youtubeCardContainer}>
            <div className={styles.card}>
                <iframe
                    src={`https://www.youtube.com/embed/${props.data}`}
                    allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
                    allowFullScreen
                ></iframe>
            </div>
        </div>
    );
}

YoutubeCardSlide.propTypes = {
    data: PropTypes.string,
};

export default YoutubeCardSlide;
</code>```

and this is the scss:

```<code>@import "styles/variables";
@import "styles/mixins";

.youtubeCardContainer {
    width: 100%;
    height: 100%;
    position: relative;
    @include max-query($md) {
        width: 100%;
    }

    .card {
        border: 1px solid #d8dfe8;
        border-radius: 10px;
        height: 100%;
        width: 100%;

        iframe {
            position: relative;
            z-index: 0;
            border: none;
            border-radius: 10px;
            height: 100%;
            width: 100%;
            outline: none;
        }
    }
}
</code>```

If I add the pointer-events: none to the iframe it allows the swipe to work but now i am not able to play the video

can someone suggest how can i achieve both of this functionality which are to be able to swipe and play the video

Body:
I am using the react-swiper library to render some youtube videos in a multi carousel format they look something like this:

Each one of these videos are rendered through a component the problem i am facing is that I am not able to swipe on these youtube card here is the code of the component which conatins the iframe:

import PropTypes from "prop-types";

import styles from "./YoutubeCardSlide.module.scss";
function YoutubeCardSlide(props) {
    return (

                <iframe
                    src={`https://www.youtube.com/embed/${props.data}`}
                    allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
                    allowFullScreen
                >

    );
}

YoutubeCardSlide.propTypes = {
    data: PropTypes.string,
};

export default YoutubeCardSlide;

and this is the scss:

@import "styles/variables";
@import "styles/mixins";

.youtubeCardContainer {
    width: 100%;
    height: 100%;
    position: relative;
    @include max-query($md) {
        width: 100%;
    }

    .card {
        border: 1px solid #d8dfe8;
        border-radius: 10px;
        height: 100%;
        width: 100%;

        iframe {
            position: relative;
            z-index: 0;
            border: none;
            border-radius: 10px;
            height: 100%;
            width: 100%;
            outline: none;
        }
    }
}

If I add the pointer-events: none to the iframe it allows the swipe to work but now i am not able to play the video

can someone suggest how can i achieve both of this functionality which are to be able to swipe and play the video