问:
Airflow prefix resulting in 404 EKS Fargate
Here is my set up: I have EKS where I have deployed Airflow using Helm chart. The pods are running on Fargate. I have ALB installed using helm as well.
When I set up the config using

```<code>web:
    path: "/"
    host: "k8s-dev-***************************.us-west-2.elb.amazonaws.com"
</code>```

The UI shows up when accessing the Ingress URL. The issue comes when I am setting up a prefix:

```<code>ingress:
  enabled: true

  apiVersion: networking.k8s.io/v1

  web:
    path: "/airflow-dev"
    host: "k8s-dev-*********************.us-west-2.elb.amazonaws.com"
</code>```

In the Airflow values as well, I am passing the following overrides to the pods:

```<code>extraEnv: |
  - name: "AIRFLOW_VAR_FOO"
    value: "Develp_foo"
  - name: "AIRFLOW__WEBSERVER__BASE_URL"
    value: "http://localhost:8080/"
</code>```

Here is part of the Ingress yaml file:

```<code>spec:
  ingressClassName: alb
  rules:
    - http:
        paths:
        - path: /airflow-dev/
          pathType: Prefix
          backend:
            service:
              name: airflow-dev-nodeport
              port:
                number: 8080`
</code>```

If I change the Base_Url value to locahost:8080/airflow-dev/ the webserver Pod keeps restarting. Any idea why I am getting the 404 page when accessing the Ingress URL ?
Here is the error that I get:

Ideally I want to access the Airflow using the ingress_url/airflow-dev/ .

Thanks

Body:
Here is my set up: I have EKS where I have deployed Airflow using Helm chart. The pods are running on Fargate. I have ALB installed using helm as well.
When I set up the config using

web:
    path: "/"
    host: "k8s-dev-***************************.us-west-2.elb.amazonaws.com"

The UI shows up when accessing the Ingress URL. The issue comes when I am setting up a prefix:

ingress:
  enabled: true

  apiVersion: networking.k8s.io/v1

  web:
    path: "/airflow-dev"
    host: "k8s-dev-*********************.us-west-2.elb.amazonaws.com"

In the Airflow values as well, I am passing the following overrides to the pods:

extraEnv: |
  - name: "AIRFLOW_VAR_FOO"
    value: "Develp_foo"
  - name: "AIRFLOW__WEBSERVER__BASE_URL"
    value: "http://localhost:8080/"

Here is part of the Ingress yaml file:

spec:
  ingressClassName: alb
  rules:
    - http:
        paths:
        - path: /airflow-dev/
          pathType: Prefix
          backend:
            service:
              name: airflow-dev-nodeport
              port:
                number: 8080`

If I change the Base_Url value to locahost:8080/airflow-dev/ the webserver Pod keeps restarting. Any idea why I am getting the 404 page when accessing the Ingress URL ?
Here is the error that I get:

Ideally I want to access the Airflow using the ingress_url/airflow-dev/ .

Thanks


来源: stackexchange

问:
How to get Authorization header value with swagger-generated java class
I'm following the guide on https://swagger.io/docs/specification/2-0/authentication/

I have securityDefinitions defined as

```<code>securityDefinitions:
  bearer_auth:
    type: apiKey
    in: header
    name: Authorization
</code>```

and the path is

```<code>/some-path:
  get:
    parameters:
      - description: cursor
        in: query
        name: cursor
        type: string
    produces:
      - application/json
    responses:
      ...
    tags:
      - ...
    security:
      - bearer_auth: []
</code>```

The generated method looks like

```<code>@GET
    @Produces({"application/json"})
    @ApiOperation(
        authorizations = {@Authorization("bearer_auth")},
        tags = {"..."}
    )
    @ApiResponses({@ApiResponse(
    code = 200,
    message = "...",
    response = Response.class
)})
Response foo(@QueryParam("cursor") @ApiParam("cursor") String cursor);
</code>```

I need to validate the bearer token specified by Authorization header on backend, but the header value is not part of the parameters.
How do I get it?

ContentLicense: CC BY-SA 4.0

Body:
I'm following the guide on https://swagger.io/docs/specification/2-0/authentication/

I have securityDefinitions defined as

securityDefinitions:
  bearer_auth:
    type: apiKey
    in: header
    name: Authorization

and the path is

/some-path:
  get:
    parameters:
      - description: cursor
        in: query
        name: cursor
        type: string
    produces:
      - application/json
    responses:
      ...
    tags:
      - ...
    security:
      - bearer_auth: []

The generated method looks like

@GET
    @Produces({"application/json"})
    @ApiOperation(
        authorizations = {@Authorization("bearer_auth")},
        tags = {"..."}
    )
    @ApiResponses({@ApiResponse(
    code = 200,
    message = "...",
    response = Response.class
)})
Response foo(@QueryParam("cursor") @ApiParam("cursor") String cursor);

I need to validate the bearer token specified by Authorization header on backend, but the header value is not part of the parameters.
How do I get it?


问:
Array of std::function with different argument type
I'm trying to design my own implementation of Signal Bus using C++.

To reach my goals I'm using a vector of std::function<void()> callbacks for free functions or lambdas. For example, if we need to subscribe to some event (just an empty struct) we can use lambda expression:

```<code>SignalBus->Subscribe<FirstSignal>([&] { MethodA(); });
</code>```

or we can pass function as sargument if we're speaking about static/free functions.

This case works great, but sometimes we need to send some data with event. This is the place where I'm stuck. My idea is to use structs to pass data to event-callback and my first approach was to declare an EventBase class and use polymorphism:

```<code>std::function<void(EventBase)>
</code>```

but it didn't work with derived structs/classes because there's no convertion between struct EventBase and struct DerivedEvent : public EventBase. It's obvious. Then I decided to use void pointer to function:

```<code>std::function<void(void*)>
</code>```

It works, but if you want to subscribe to some event using this method you need to type this weird code:

```<code>SignalBus->SubscribeWithData<SecondSignal>([&](void* signal) {
    auto data = (SecondSignal*) signal;
    MethodB(*data);} );
</code>```

So we're capturing object reference, take void* parameter and then make C-style cast to provide raw conversion of types.

It's ok, it works, but it's awful and it's not okay to type this everytime you need to subscribe, so here's my question: Is there any options to make it work better with easy-to-use for end user?

Different kinds of casting of std::function; std::any;

Body:
I'm trying to design my own implementation of Signal Bus using C++.

To reach my goals I'm using a vector of std::function<void()> callbacks for free functions or lambdas. For example, if we need to subscribe to some event (just an empty struct) we can use lambda expression:

SignalBus->Subscribe<FirstSignal>([&] { MethodA(); });

or we can pass function as sargument if we're speaking about static/free functions.

This case works great, but sometimes we need to send some data with event. This is the place where I'm stuck. My idea is to use structs to pass data to event-callback and my first approach was to declare an EventBase class and use polymorphism:

std::function<void(EventBase)>

but it didn't work with derived structs/classes because there's no convertion between struct EventBase and struct DerivedEvent : public EventBase. It's obvious. Then I decided to use void pointer to function:

std::function<void(void*)>

It works, but if you want to subscribe to some event using this method you need to type this weird code:

SignalBus->SubscribeWithData<SecondSignal>([&](void* signal) {
    auto data = (SecondSignal*) signal;
    MethodB(*data);} );

So we're capturing object reference, take void* parameter and then make C-style cast to provide raw conversion of types.

It's ok, it works, but it's awful and it's not okay to type this everytime you need to subscribe, so here's my question: Is there any options to make it work better with easy-to-use for end user?

Different kinds of casting of std::function; std::any;


问:
java servlet not connect or show with jsp
I write my jsp code which you can see in picenter image description here.I write my servlet code which you can see in pic enter image description here. I write xml code to connect jsp with java servletenter image description here.  when i conect to server and open my jsp code. It shows me jsp code but when i try to connect java servet it throughs me error 404.The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.enter image description here

Simply i wanted to connect my jsp form to java servlet to write backend on it


问:
AttributeError: partially initialized module 'fiona' has no attribute '_loading' (most likely due to a circular import)
I'm working with polygon data in Python and am having trouble importing packages fiona and geopandas. When I run:

import fiona

I receive the following:

```<code>---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_5540\1102285635.py in <module>
----> 1 import fiona

~\anaconda3\lib\site-packages\fiona\__init__.py in <module>
     83
     84 import fiona._loading
---> 85 with fiona._loading.add_gdal_dll_directories():
     86     from fiona.collection import BytesCollection, Collection
     87     from fiona.drvsupport import supported_drivers

AttributeError: partially initialized module 'fiona' has no attribute '_loading' (most likely due to a circular import)
</code>```

I've seen suggestions online that this is the result of incompatibilities between certain versions of packages, but as far as I can tell I've set my packages to the correct versions:

fiona: 1.8.22

geopandas: 0.9.0

Shapely: 1.8.5 (tried 2.0.0 as well)

GDAL: 3.4.1

Body:
I'm working with polygon data in Python and am having trouble importing packages fiona and geopandas. When I run:

import fiona

I receive the following:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_5540\1102285635.py in <module>
----> 1 import fiona

~\anaconda3\lib\site-packages\fiona\__init__.py in <module>
     83
     84 import fiona._loading
---> 85 with fiona._loading.add_gdal_dll_directories():
     86     from fiona.collection import BytesCollection, Collection
     87     from fiona.drvsupport import supported_drivers

AttributeError: partially initialized module 'fiona' has no attribute '_loading' (most likely due to a circular import)

I've seen suggestions online that this is the result of incompatibilities between certain versions of packages, but as far as I can tell I've set my packages to the correct versions:

fiona: 1.8.22

geopandas: 0.9.0

Shapely: 1.8.5 (tried 2.0.0 as well)

GDAL: 3.4.1


问:
Multi-level Dropdown Menu fully closing when I select an option
I have this dropdown menu which I want to not fully close when the user clicks an element of the main dropdown. Basically what happening is the menu opens fine, but if the user attempts to click an element of the main 3 dropdown lists, the whole dropdown closes, I don't want that to happen, I just want to opened list to close, and the list that was clicked on to open. I recognize the problem is somewhere in the blur event in the js but I am not sure what exactly is causing this to happen. The weird thing is, the menu works as intended when choosing the bottom element in the main list to the top, but when going from top to bottom, the aforementioned issue occurs.

Try clicking "Surface" then "Upper Air Dynamics" if my explanation wasn't good, the whole menu closes and I don't want that, I just want whatever is open at that time to close.

                 document.querySelectorAll(".dropdown-container-var ul li").forEach(d => {
                  d.addEventListener("click", e => {
                    const dropdown = e.target.closest(".dropdown-container-var ").querySelector("ul")
                    if(dropdown) {
                      dropdown.style.display = "block"
                      _ElementBlur2(e.target, () => {
                        dropdown.style.display = "none"
                      })
                    }
                  })
                })
                document.querySelectorAll(".dropdown-container-var").forEach(d => {
                  d.addEventListener("click", e => {
                    const dropdown = e.target.closest(".dropdown-container-var ").querySelector("ul")
                    if(dropdown) {
                      dropdown.style.display = "block"
                      _ElementBlur2(e.target, () => {
                        dropdown.style.display = "none"
                      })
                    }
                  })
                })

                document.querySelectorAll(".dropdown-container-var ul li").forEach(listItem => {
                  listItem.addEventListener("click", e => {
                    window.location.href = e.target.attributes.href.value;
                  })
                })
                document.querySelectorAll(".dropdown-container-var ul li").forEach(listItem => {
                  listItem.addEventListener("click", e => {
                    window.location.href = e.target.querySelector("a").getAttribute("href");
                  })
                })

                // Functions for getting a 'blur' event on an element
                const _ElementBlur2 = (el, f = false) => {
                  const ac = new AbortController()
                  document.body.addEventListener("click", _CheckBlur2(el, f, ac), { signal: ac.signal })
                }

                const _CheckBlur2 = (el, f = false, ac) => {
                  return e => {
                    if(!document.elementsFromPoint(e.clientX, e.clientY).filter(efp => efp == el).length || !document.elementsFromPoint(e.clientX, e.clientY).length) {
                      if(f && typeof(f) == "function") f()
                      ac.abort()
                    }
                  }
                }```
<pre class="snippet-code-css lang-css prettyprint-override"><code>  .headers {
    color: white;
    text-decoration: none;/* Change this to the desired color */
    transition: background-color 0.2s;
    margin: 0;
    }

    .sub-dropdown {
    color: black;
    text-decoration: none;/* Change this to the desired color */
    transition: background-color 0.2s;
    }

    .dropdown-container-var {
      position: relative; /* create a positioning context for the list items */
      background-color: #333;
        color: white;
        text-decoration: none;
    width: 600px;
    text-align: center;
        transition: background-color 0.2s;
        cursor: pointer;

        }

    .dropdown-container-var:hover { /* create a positioning context for the list items */
      background-color: #525252;
        transition: background-color 0.2s;
    }

    .dropdown-list-var {
      position: relative; /* position the list items absolutely */
     display: none; /* hide the list by default */

      list-style-type: none; /* remove the bullet points for the list items */
      padding: 0; /* remove the padding for the list */
      left: 0; /* position the list items at the left edge of the list */
      transition: border 0.2s; /* add a transition effect for the border */
      background-color: #b0b0b0;
      color: black;
      text-decoration: none;
    width: 600px;
        text-align: center;
        transition: background-color 0.2s;
        cursor: pointer;
    }

    .dropdown-list-var li:hover {
      background-color: #04AA6D;
        transition: background-color 0.2s;}/* change the background color of the list items
    to green when they are hovered over */
    }
    .dropdown-list-var li {
      color: black; /* set the color of the list items to black */
        text-align: center;
        transition: background-color 0.2s;
    }
    .main-dropdown {
      margin: 0;
    }

    .dropdown-list-var {
      margin: 0; /* <-- add this to the existing CSS code*/
      /* the rest */
    }
    optgroup {
      font-weight: bold;
      color: black;
      width: 520px;
        cursor: default;
    }</code>```

Surface and Precipitation

          <optgroup label="Surface">

2m Temperature

2m Dewpoint

Mean Sea Level Pressure

10m Wind Gust

          <optgroup label="Precipitation">

6-hr Precipitation Type/Rate

Categorical Precipitation Type

6-hr Precipitation

24-hr Precipitation

Total Precipitation

          <optgroup label="Winter">

Total Snowfall

Upper-Air: Dynamics

          <optgroup label="Vorticity">

500 hPa Height,Wind,Vorticity

700 hPa Height,Wind,Vorticity

850 hPa Height,Wind,Vorticity

          <optgroup label="Lift">

700 hPa Frontogenesis/Temperature Advection

700 hPa Omega

850 hPa Frontogenesis/Temperature Advection

850 hPa Omegan

Upper-Air: Temperature,Wind

          <optgroup label="Temperature">

700 hPa Temperature, Height, Wind

850 hPa Temperature, Height, Wind

925 hPa Temperature, Height, Wind

          <optgroup label="Wind">

250 hPa Height, Wind

850 hPa Height, Wind

          <optgroup label="Anomaly">

500 hPa Height Anomaly

```

Body:
I have this dropdown menu which I want to not fully close when the user clicks an element of the main dropdown. Basically what happening is the menu opens fine, but if the user attempts to click an element of the main 3 dropdown lists, the whole dropdown closes, I don't want that to happen, I just want to opened list to close, and the list that was clicked on to open. I recognize the problem is somewhere in the blur event in the js but I am not sure what exactly is causing this to happen. The weird thing is, the menu works as intended when choosing the bottom element in the main list to the top, but when going from top to bottom, the aforementioned issue occurs.

Try clicking "Surface" then "Upper Air Dynamics" if my explanation wasn't good, the whole menu closes and I don't want that, I just want whatever is open at that time to close.

                 document.querySelectorAll(".dropdown-container-var ul li").forEach(d => {
                  d.addEventListener("click", e => {
                    const dropdown = e.target.closest(".dropdown-container-var ").querySelector("ul")
                    if(dropdown) {
                      dropdown.style.display = "block"
                      _ElementBlur2(e.target, () => {
                        dropdown.style.display = "none"
                      })
                    }
                  })
                })
                document.querySelectorAll(".dropdown-container-var").forEach(d => {
                  d.addEventListener("click", e => {
                    const dropdown = e.target.closest(".dropdown-container-var ").querySelector("ul")
                    if(dropdown) {
                      dropdown.style.display = "block"
                      _ElementBlur2(e.target, () => {
                        dropdown.style.display = "none"
                      })
                    }
                  })
                })

                document.querySelectorAll(".dropdown-container-var ul li").forEach(listItem => {
                  listItem.addEventListener("click", e => {
                    window.location.href = e.target.attributes.href.value;
                  })
                })
                document.querySelectorAll(".dropdown-container-var ul li").forEach(listItem => {
                  listItem.addEventListener("click", e => {
                    window.location.href = e.target.querySelector("a").getAttribute("href");
                  })
                })

                // Functions for getting a 'blur' event on an element
                const _ElementBlur2 = (el, f = false) => {
                  const ac = new AbortController()
                  document.body.addEventListener("click", _CheckBlur2(el, f, ac), { signal: ac.signal })
                }

                const _CheckBlur2 = (el, f = false, ac) => {
                  return e => {
                    if(!document.elementsFromPoint(e.clientX, e.clientY).filter(efp => efp == el).length || !document.elementsFromPoint(e.clientX, e.clientY).length) {
                      if(f && typeof(f) == "function") f()
                      ac.abort()
                    }
                  }
                }

  .headers {
    color: white;
    text-decoration: none;/* Change this to the desired color */
    transition: background-color 0.2s;
    margin: 0;
    }

    .sub-dropdown {
    color: black;
    text-decoration: none;/* Change this to the desired color */
    transition: background-color 0.2s;
    }

    .dropdown-container-var {
      position: relative; /* create a positioning context for the list items */
      background-color: #333;
        color: white;
        text-decoration: none;
    width: 600px;
    text-align: center;
        transition: background-color 0.2s;
        cursor: pointer;

        }

    .dropdown-container-var:hover { /* create a positioning context for the list items */
      background-color: #525252;
        transition: background-color 0.2s;
    }

    .dropdown-list-var {
      position: relative; /* position the list items absolutely */
     display: none; /* hide the list by default */

      list-style-type: none; /* remove the bullet points for the list items */
      padding: 0; /* remove the padding for the list */
      left: 0; /* position the list items at the left edge of the list */
      transition: border 0.2s; /* add a transition effect for the border */
      background-color: #b0b0b0;
      color: black;
      text-decoration: none;
    width: 600px;
        text-align: center;
        transition: background-color 0.2s;
        cursor: pointer;
    }

    .dropdown-list-var li:hover {
      background-color: #04AA6D;
        transition: background-color 0.2s;}/* change the background color of the list items
    to green when they are hovered over */
    }
    .dropdown-list-var li {
      color: black; /* set the color of the list items to black */
        text-align: center;
        transition: background-color 0.2s;
    }
    .main-dropdown {
      margin: 0;
    }

    .dropdown-list-var {
      margin: 0; /* <-- add this to the existing CSS code*/
      /* the rest */
    }
    optgroup {
      font-weight: bold;
      color: black;
      width: 520px;
        cursor: default;
    }

Surface and Precipitation

          <optgroup label="Surface">

2m Temperature

2m Dewpoint

Mean Sea Level Pressure

10m Wind Gust

          <optgroup label="Precipitation">

6-hr Precipitation Type/Rate

Categorical Precipitation Type

6-hr Precipitation

24-hr Precipitation

Total Precipitation

          <optgroup label="Winter">

Total Snowfall

Upper-Air: Dynamics

          <optgroup label="Vorticity">

500 hPa Height,Wind,Vorticity

700 hPa Height,Wind,Vorticity

850 hPa Height,Wind,Vorticity

          <optgroup label="Lift">

700 hPa Frontogenesis/Temperature Advection

700 hPa Omega

850 hPa Frontogenesis/Temperature Advection

850 hPa Omegan

Upper-Air: Temperature,Wind

          <optgroup label="Temperature">

700 hPa Temperature, Height, Wind

850 hPa Temperature, Height, Wind

925 hPa Temperature, Height, Wind

          <optgroup label="Wind">

250 hPa Height, Wind

850 hPa Height, Wind

          <optgroup label="Anomaly">

500 hPa Height Anomaly


问:
cmd script that restarts explorer doesn't restore taskbar and desktop icons
The Win10 taskbar sometimes stops autohiding (due to conditions covered elsewhere).  A common fix is to start the Task mgr, kill Explorer, then File/Run new task/explorer.exe.

I'd like to do this via a batch script.  However, this code:

```<code>taskkill /f /IM explorer.exe
timeout <some number>  [if this was necessary]
c:\windows\explorer.exe  [or start explorer.exe]

</code>```

only starts the File Explorer.  It does not re-establish desktop icons nor the taskbar.  How can a batch script emulate what the taskmgr's run new task does?
Tnx

Body:
The Win10 taskbar sometimes stops autohiding (due to conditions covered elsewhere).  A common fix is to start the Task mgr, kill Explorer, then File/Run new task/explorer.exe.

I'd like to do this via a batch script.  However, this code:

taskkill /f /IM explorer.exe
timeout <some number>  [if this was necessary]
c:\windows\explorer.exe  [or start explorer.exe]

only starts the File Explorer.  It does not re-establish desktop icons nor the taskbar.  How can a batch script emulate what the taskmgr's run new task does?
Tnx


问:
how to align second column as max length of first column + 1 python
I'm trying to display two columns for a recipe, one with measurements and one with the ingredients.

```<code>ingredients = requests.get_ingredients_and_measurements(lookup_meal)
for i in range(len(ingredients)):
    ingredient = ingredients[i]
    item = ingredient.get_measure() + " " + ingredient.get_ingredient()
    print(item)
</code>```

I'm getting my data from an API which is what the requests is for. I want each measurement and the corresponding ingredient to print on its own line which is why I have it going through and printing it each time.
The problem is that I need to align the column of Ingredients. I want it to print from the max length measure + 1

Body:
I'm trying to display two columns for a recipe, one with measurements and one with the ingredients.

ingredients = requests.get_ingredients_and_measurements(lookup_meal)
for i in range(len(ingredients)):
    ingredient = ingredients[i]
    item = ingredient.get_measure() + " " + ingredient.get_ingredient()
    print(item)

I'm getting my data from an API which is what the requests is for. I want each measurement and the corresponding ingredient to print on its own line which is why I have it going through and printing it each time.
The problem is that I need to align the column of Ingredients. I want it to print from the max length measure + 1


问:
Facing issues with SAM-CLI and GCC NODE installation using Homebrew
I tried to install aws-sam-cli and gcc, node installations via homebrew since am using a Linux red hat enterprise fedora which is a cent OS. For some reasons am facing issues when I try to install it using brew. The brew installation was successful however am unable to install node and sam-cli.

These are the following commands I used to install homebrew:
 1. git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
       2. mkdir ~/.linuxbrew/bin
       3. ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin
       4. eval $(~/.linuxbrew/bin/brew shellenv)
       5. brew --version
The above commands worked fine and was able to see the version

Steps taken to  install sam-cli:

brew tap aws/tap
       2.brew install aws-sam-cli
       3. sam --version

Steps to install node :
brew install gcc
brew install node
brew install node@14
export PATH="/home/linuxbrew/.linuxbrew/opt/node@14/bin:$PATH"
brew unlink node && brew link --overwrite node@14

When I run the commands : brew install aws-sam-cli  or brew install gcc . I am getting the same error in the end which is this:
Initializing Automake:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether ln -s works... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /tmp/xz-20221213-28533-ii4mh8/xz-5.2.9': configure: error: C compiler cannot create executables See config.log' for more details

Please help me to resolve this or I should use an alternative for brew.

These are the following commands I used to install homebrew:
 1. git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
       2. mkdir ~/.linuxbrew/bin
       3. ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin
       4. eval $(~/.linuxbrew/bin/brew shellenv)
       5. brew --version
The above commands worked fine and was able to see the version

Steps taken to  install sam-cli:

brew tap aws/tap
       2.brew install aws-sam-cli
       3. sam --version

Steps to install node :
brew install gcc
brew install node
brew install node@14
export PATH="/home/linuxbrew/.linuxbrew/opt/node@14/bin:$PATH"
brew unlink node && brew link --overwrite node@14

When I run the commands : brew install aws-sam-cli  or brew install gcc . I am getting the same error in the end which is this:
Initializing Automake:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether ln -s works... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /tmp/xz-20221213-28533-ii4mh8/xz-5.2.9': configure: error: C compiler cannot create executables See config.log' for more details

Please help me to resolve this or I should use an alternative for brew.


问:
AWS S3 trigger and MySQL LOAD DATA FROM S3 function
Is there a way to execute the LOAD DATA FROM S3 function everytime an object is created in an S3 bucket where the LOAD DATA FROM S3 function has a dynamic bucket/path and SET statements?  Something like this:

```<code>LOAD DATA FROM S3  's3://' + @bucket + '/' + @key
    INTO TABLE FisImportRows
    (RowData)
    SET
    FisImportRowsGUID = uuid(),
    FisImportGUID = @docId;
</code>```

If so, how?  What are the options for this?

Thank you.

Body:
Is there a way to execute the LOAD DATA FROM S3 function everytime an object is created in an S3 bucket where the LOAD DATA FROM S3 function has a dynamic bucket/path and SET statements?  Something like this:

LOAD DATA FROM S3  's3://' + @bucket + '/' + @key
    INTO TABLE FisImportRows
    (RowData)
    SET
    FisImportRowsGUID = uuid(),
    FisImportGUID = @docId;

If so, how?  What are the options for this?

Thank you.


问:
Cloudfront serves cache at 3rd request
I'm writing tests to make sure my objects are cached by cloudfront. If the object is not cached, I expect the second time I make the same request, it will be served from the cache. However I noticed some objects are only served from cache at the 3rd request.

Anyone knows why it happens? In production this is not an issue, because who cares. But I'd like to know why, also I have to adjust my test code.

A test looks like this. 10% of my requests break the loop at i=1, the rest at i=0:

```<code>  const client = axios.create({baseUrl: myUrl})
  let response = await client.get(myPath)

  expect(response.headers['x-cache']).toMatch(/Miss/)

  for (let i = 0; i < 20; i++) {
    response = await client.get(myPath)
    if (response.headers['x-cache'] && /Hit/.exec(response.headers['x-cache'])) {
      console.log('number of tests ', i + 1, path)
      break
    }
  }

  expect(response.headers['x-cache']).toMatch(/Hit/)
</code>```

Here I read that requests to different edge locations are cached separately. However, the response header "x-amz-cf-pop" is always the same.

Title: Cloudfront serves cache at 3rd request

Body:
I'm writing tests to make sure my objects are cached by cloudfront. If the object is not cached, I expect the second time I make the same request, it will be served from the cache. However I noticed some objects are only served from cache at the 3rd request.

Anyone knows why it happens? In production this is not an issue, because who cares. But I'd like to know why, also I have to adjust my test code.

A test looks like this. 10% of my requests break the loop at i=1, the rest at i=0:

  const client = axios.create({baseUrl: myUrl})
  let response = await client.get(myPath)

  expect(response.headers['x-cache']).toMatch(/Miss/)

  for (let i = 0; i < 20; i++) {
    response = await client.get(myPath)
    if (response.headers['x-cache'] && /Hit/.exec(response.headers['x-cache'])) {
      console.log('number of tests ', i + 1, path)
      break
    }
  }

  expect(response.headers['x-cache']).toMatch(/Hit/)

Here I read that requests to different edge locations are cached separately. However, the response header "x-amz-cf-pop" is always the same.


问:
SwiftUI programatic navigation loses binding
I'm building a "Charade-like-game" app with five screens and a simple GameModel class consisting of five objects, including teams, round, and scores.

Screen1 dynamically determines the number of teams playing via @StateObject.

Screen2 is a scoreboard that displays in a VStack the dynamic number of teams playing via @ObservedObject, alongside scores from two rounds of play.

Screen3 shows the Charade criteria, and Screen4 is a timer. Neither of these affect the GameModel.

Screen5 gives the other teams a chance to score the performance. That value is then passed back to the Screen2 scoreboard.

The navigation flow begins at 1 then moves to 2 > 3 > 4 > 5 then back to 2 to repeat the cycle until the users close the app, like this:

I got tangled up in the navigation because I wanted the back button on Screen2 to start the game over, rather than return to Screen5. When I used @Environment(\.presentationMode) and presentationMode.wrappedValue.dismiss(), it didn't navigate properly.

Therefore I tried building the navigation programmatically using a @State Boolean, to change the screen like this:

```<code>if playGamePressed {
    Screen2View()
} else {
    Screen1 code...

    Select # of teams binded via @StateObject (my source of truth)

    Button(action: {
        playGamePressed = true
    }
}
</code>```

Now, the @StateObject binding no longer passes the dynamic number of teams. Everything worked prior to changing the navigation to programmatic.

I used this as a reference: Swiftui nested navigation issue while using navigation link, but the solution was .presentationMode that didn't work for me.

What am I missing?

Body:
I'm building a "Charade-like-game" app with five screens and a simple GameModel class consisting of five objects, including teams, round, and scores.

Screen1 dynamically determines the number of teams playing via @StateObject.

Screen2 is a scoreboard that displays in a VStack the dynamic number of teams playing via @ObservedObject, alongside scores from two rounds of play.

Screen3 shows the Charade criteria, and Screen4 is a timer. Neither of these affect the GameModel.

Screen5 gives the other teams a chance to score the performance. That value is then passed back to the Screen2 scoreboard.

The navigation flow begins at 1 then moves to 2 > 3 > 4 > 5 then back to 2 to repeat the cycle until the users close the app, like this:

I got tangled up in the navigation because I wanted the back button on Screen2 to start the game over, rather than return to Screen5. When I used @Environment(\.presentationMode) and presentationMode.wrappedValue.dismiss(), it didn't navigate properly.

Therefore I tried building the navigation programmatically using a @State Boolean, to change the screen like this:

if playGamePressed {
    Screen2View()
} else {
    Screen1 code...

    Select # of teams binded via @StateObject (my source of truth)

    Button(action: {
        playGamePressed = true
    }
}

Now, the @StateObject binding no longer passes the dynamic number of teams. Everything worked prior to changing the navigation to programmatic.

I used this as a reference: Swiftui nested navigation issue while using navigation link, but the solution was .presentationMode that didn't work for me.

What am I missing?


问:
Code-Cleanup in VS2022 applies different tab/space formatting rules for closed solution files
Why would the VS2022 Code-Cleanup feature apply different keep-tabs formatting preferences depending on whether a source file is being viewed in VS2022 or is closed?

I have a new VS2022 install on a new Windows 11 dev machine and Resharper is not installed.

With all c-sharp source code windows closed, when I manually run Code-Cleanup all tab characters are converted to spaces. If I then open all source code files in VS2022 and run cleanup again, the spaces are converted back to tabs which is my Tools/Options keep-tabs preference.

I have 'view white-space' enabled and can see the indentation of my sourcde code flipping between tabs and spaces. This problem is repeatable.

Tools/Options 'Use adaptive formatting' is also disabled. I do not believe an .editorconfig settings file is applicable to my solution but even if there was a config file the open/close tabs/spaces formatting flip would be peculiar.


问:
Twilio Phone Tree not working on pythonanywhere
I have been trying to create a phone tree for my business.  I am really not a developer or coder.  I am a small business owner looking to implement some basic, cost effective automations and have found python to be pretty good for that.  Most things I've been able to resolve myself by reading and watching tutorials, but I am really struggling with this one.  I developed a phone tree using a twilio tutorial, an ngrok tunnel, and a flask server on my computer.  I got it all working flawlessly in just a couple hours.  Very happy with that part.  Then I tried to host it on pythonanywhere and I've had absolutely no success.  I have gotten various types of errors, but most recently, I don't even see any error in the log.  Here is my main code for the phone tree

```<code>from flask import Flask, request, session
from twilio.twiml.voice_response import VoiceResponse, Say, Gather, Dial, Record, Enqueue
import os
from twilio.rest import Client
import time

account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
twilio_number = os.environ['TWILIO_NUMBER']
RCL_number = '+-------'

app = Flask(__name__)
app.config['SECRET_KEY'] = 'top-secret!'

def enter_greeting():
    return Say('Welcome to MY BUSINESS.')

def enter_menu():
    gather = Gather(action_on_empty_result=True, num_digits=1)
    gather.say('Listen to the following menu options. '
               'For a quote for services, press one. '
               'For a list of services and our business hours, press two. '
               'To repeat these options, press nine. '
               'To speak with somebody, press zero. ')
    return gather

def exit_menu():
    transitions = {
        '1': 'sales',
        '2': 'hours',
        '9': 'menu',
        '0': 'reception',
    }
    selection = request.form.get('Digits')
    if selection in transitions:
        return enter_state(transitions[selection])
    else:
        return enter_state('error')

def transcribe():
    client = Client(account_sid, auth_token)
    transcription = client.transcriptions.list(limit=1)
    time.sleep(30)
    sid = transcription[0].sid
    t = client.transcriptions(sid).fetch()
    m = client.messages \
        .create(
            body = str(t.transcription_text),
            from_=twilio_number,
            to=RCL_number
        )
    print(m.sid)

def enter_sales():
    return [
        Say('All our sales representatives are currently busy, please leave us a detailed message.'),
        Record(transcribe=True),
    ]

def enter_support():
    return [
        Say('You are being transferred to the support line. A representative will be with you shortly.'),
        Enqueue('support'),
    ]

def enter_hours():
    gather = Gather(action_on_empty_result=True, num_digits=1)
    gather.say('We are open Mondays through Fridays from 8 AM to 5 PM.')
    gather.pause()
    gather.say('Press 1 to repeat this message or any other key to go back to the menu.')
    return gather

def exit_hours():
    selection = request.form.get('Digits')
    if selection == '1':
        return enter_state('hours')
    else:
        return enter_state('menu')

def enter_reception():
    return Dial('+-------')

def enter_error():
    return Say('The option that you selected is invalid.')

IVR = {
    'greeting': (enter_greeting, 'menu'),
    'menu': (enter_menu, exit_menu),
    'sales': (enter_sales, transcribe),
    'support': (enter_support, None),
    'hours': (enter_hours, exit_hours),
    'reception': (enter_reception, None),
    'error': (enter_error, 'menu'),
}

def enter_state(state):
    response = VoiceResponse()
    while True:
        # access the requested state
        session['ivr_state'] = state
        enter_handler, exit_handler = IVR[state]

        # invoke the "enter" action for the state
        actions = enter_handler()
        if isinstance(actions, list):
            for action in actions:
                response.append(action)
        else:
            response.append(actions)

        # if the state has a string exit handler, transition to that state
        # and continue building a response
        if isinstance(exit_handler, str):
            state = exit_handler
        else:
            # let the called hear the response for this state and provide input
            return response

def exit_state(state):
    _, exit_handler = IVR[state]
    return exit_handler()

@app.route('/webhook', methods=['POST'])
def ivr_webhook():
    state = session.get('ivr_state')
    if state is None:
        # this is a new call
        return str(enter_state('greeting'))
    else:
        # we received input an the current state, so we can now exit it and
        # transition to a new state
        return str(exit_state(state))

</code>```

And here is the code from my wsgi file

```<code>import sys

path = '/home/sapperpe/tree'
if path not in sys.path:
    sys.path.append(path)

import os
from dotenv import load_dotenv
project_folder = os.path.expanduser(path)
load_dotenv(os.path.join(project_folder, '.env'))

from tree import app as application
</code>```

Currently, I'm getting this error when running in a bash server... not sure how else to check for errors since nothing is coming up in the error logs for this particular issues:

```<code>Traceback (most recent call last):
  File "/home/sapperpe/tree/tree.py", line 7, in <module>
    account_sid = os.environ['TWILIO_ACCOUNT_SID']
  File "/usr/local/lib/python3.10/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'TWILIO_ACCOUNT_SID'
</code>```

Body:
I have been trying to create a phone tree for my business.  I am really not a developer or coder.  I am a small business owner looking to implement some basic, cost effective automations and have found python to be pretty good for that.  Most things I've been able to resolve myself by reading and watching tutorials, but I am really struggling with this one.  I developed a phone tree using a twilio tutorial, an ngrok tunnel, and a flask server on my computer.  I got it all working flawlessly in just a couple hours.  Very happy with that part.  Then I tried to host it on pythonanywhere and I've had absolutely no success.  I have gotten various types of errors, but most recently, I don't even see any error in the log.  Here is my main code for the phone tree

from flask import Flask, request, session
from twilio.twiml.voice_response import VoiceResponse, Say, Gather, Dial, Record, Enqueue
import os
from twilio.rest import Client
import time

account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
twilio_number = os.environ['TWILIO_NUMBER']
RCL_number = '+-------'

app = Flask(__name__)
app.config['SECRET_KEY'] = 'top-secret!'

def enter_greeting():
    return Say('Welcome to MY BUSINESS.')

def enter_menu():
    gather = Gather(action_on_empty_result=True, num_digits=1)
    gather.say('Listen to the following menu options. '
               'For a quote for services, press one. '
               'For a list of services and our business hours, press two. '
               'To repeat these options, press nine. '
               'To speak with somebody, press zero. ')
    return gather

def exit_menu():
    transitions = {
        '1': 'sales',
        '2': 'hours',
        '9': 'menu',
        '0': 'reception',
    }
    selection = request.form.get('Digits')
    if selection in transitions:
        return enter_state(transitions[selection])
    else:
        return enter_state('error')

def transcribe():
    client = Client(account_sid, auth_token)
    transcription = client.transcriptions.list(limit=1)
    time.sleep(30)
    sid = transcription[0].sid
    t = client.transcriptions(sid).fetch()
    m = client.messages \
        .create(
            body = str(t.transcription_text),
            from_=twilio_number,
            to=RCL_number
        )
    print(m.sid)

def enter_sales():
    return [
        Say('All our sales representatives are currently busy, please leave us a detailed message.'),
        Record(transcribe=True),
    ]

def enter_support():
    return [
        Say('You are being transferred to the support line. A representative will be with you shortly.'),
        Enqueue('support'),
    ]

def enter_hours():
    gather = Gather(action_on_empty_result=True, num_digits=1)
    gather.say('We are open Mondays through Fridays from 8 AM to 5 PM.')
    gather.pause()
    gather.say('Press 1 to repeat this message or any other key to go back to the menu.')
    return gather

def exit_hours():
    selection = request.form.get('Digits')
    if selection == '1':
        return enter_state('hours')
    else:
        return enter_state('menu')

def enter_reception():
    return Dial('+-------')

def enter_error():
    return Say('The option that you selected is invalid.')

IVR = {
    'greeting': (enter_greeting, 'menu'),
    'menu': (enter_menu, exit_menu),
    'sales': (enter_sales, transcribe),
    'support': (enter_support, None),
    'hours': (enter_hours, exit_hours),
    'reception': (enter_reception, None),
    'error': (enter_error, 'menu'),
}

def enter_state(state):
    response = VoiceResponse()
    while True:
        # access the requested state
        session['ivr_state'] = state
        enter_handler, exit_handler = IVR[state]

        # invoke the "enter" action for the state
        actions = enter_handler()
        if isinstance(actions, list):
            for action in actions:
                response.append(action)
        else:
            response.append(actions)

        # if the state has a string exit handler, transition to that state
        # and continue building a response
        if isinstance(exit_handler, str):
            state = exit_handler
        else:
            # let the called hear the response for this state and provide input
            return response

def exit_state(state):
    _, exit_handler = IVR[state]
    return exit_handler()

@app.route('/webhook', methods=['POST'])
def ivr_webhook():
    state = session.get('ivr_state')
    if state is None:
        # this is a new call
        return str(enter_state('greeting'))
    else:
        # we received input an the current state, so we can now exit it and
        # transition to a new state
        return str(exit_state(state))

And here is the code from my wsgi file

import sys

path = '/home/sapperpe/tree'
if path not in sys.path:
    sys.path.append(path)

import os
from dotenv import load_dotenv
project_folder = os.path.expanduser(path)
load_dotenv(os.path.join(project_folder, '.env'))

from tree import app as application

Currently, I'm getting this error when running in a bash server... not sure how else to check for errors since nothing is coming up in the error logs for this particular issues:

Traceback (most recent call last):
  File "/home/sapperpe/tree/tree.py", line 7, in <module>
    account_sid = os.environ['TWILIO_ACCOUNT_SID']
  File "/usr/local/lib/python3.10/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'TWILIO_ACCOUNT_SID'


问:
problem in interaction and equipment for mud game in python
hello i m new to the python and i m making a mud game i got stuck at a certain point where i need to make a code in which user can put a direction and game responds with saying can he go or not and also with inventory in which pick/drop items can be done i have tried to code in python help me with it.
there are 3 level in which player has to go every level to complete the game.</p>
```<code>
# steps to connect every level to other level.
level = {
        'level 1': {'North': 'level 2 door', 'East': 'dead end', 'West': 'dead end',"items":["Sword","Door key","coins"]},
        'level 2': {'South': 'level 1', 'East': 'dead end', 'West': 'secret mission','North': 'level 3 door' ,"items":["energy portion","Door key","coins"] },
        'secret mission': {'North': 'level 3 door', 'East': 'dead end', "items":["Bow&Arrow","Door key","coins"]},
        'level 3': {'South': 'level 2 door','North': 'door in which princess is kept',"items":["extra armor"]},
    }

directions = ['go North', 'go South', 'go East', 'go West']
pick_up_items = ['coins', 'door key', 'get Armor', 'get Sword', 'get bow&arrow', 'get energy portion']

print(instructions)
current_level = 'level1'
item_in_level = 'sword, door key, coins'
inventory = ['sword, door key, coins']

while True:
    if inventory == ['coins', 'door key', 'Armor', 'Sword', 'bow&arrow', 'energy portion']:
        print('Congratulations! You collected all the items, now you can go into'
              'level 3 and defeat the Dr.devil!')
    elif current_room == 'level 3':
        print('A bolt of lightning and thunder streaks towards you and your vision goes black..... Game Over!')
        break
    # displays the players current location
    print('You are in the {}.'.format(current_level))
    print('Inventory:', inventory)
    if item_in_level:                                        #checks to see if there is an item in the room
        print('You see a'.format(item_in_level))
    else:
        print("You don't see anything useful")

    # gets the users input
    command = input('\nWhat do you wish to do? ')  # this controls the movement
    if command in directions:
        command = command.split()[1]
        if command in level[current_level].keys():
            current_level = level[current_level][command]
           item_in_level =level[current_level]["item"]
        else:
            # if the player inputs a bad movement
            print('please write correct direction!')
    # Checks to see if the player types a 'get' command and adds the item in the room to the players inventory.
    if command in pick_up_items:
        command = command.split()[1]
        if command in level[current_level].keys():
            inventory.append(current_room['item'])
        else:
            # if the player inputs a item not in the room
            print('this item is not available here!')

</code>```

Body:
hello i m new to the python and i m making a mud game i got stuck at a certain point where i need to make a code in which user can put a direction and game responds with saying can he go or not and also with inventory in which pick/drop items can be done i have tried to code in python help me with it.
there are 3 level in which player has to go every level to complete the game.

# steps to connect every level to other level.
level = {
        'level 1': {'North': 'level 2 door', 'East': 'dead end', 'West': 'dead end',"items":["Sword","Door key","coins"]},
        'level 2': {'South': 'level 1', 'East': 'dead end', 'West': 'secret mission','North': 'level 3 door' ,"items":["energy portion","Door key","coins"] },
        'secret mission': {'North': 'level 3 door', 'East': 'dead end', "items":["Bow&Arrow","Door key","coins"]},
        'level 3': {'South': 'level 2 door','North': 'door in which princess is kept',"items":["extra armor"]},
    }

directions = ['go North', 'go South', 'go East', 'go West']
pick_up_items = ['coins', 'door key', 'get Armor', 'get Sword', 'get bow&arrow', 'get energy portion']

print(instructions)
current_level = 'level1'
item_in_level = 'sword, door key, coins'
inventory = ['sword, door key, coins']

while True:
    if inventory == ['coins', 'door key', 'Armor', 'Sword', 'bow&arrow', 'energy portion']:
        print('Congratulations! You collected all the items, now you can go into'
              'level 3 and defeat the Dr.devil!')
    elif current_room == 'level 3':
        print('A bolt of lightning and thunder streaks towards you and your vision goes black..... Game Over!')
        break
    # displays the players current location
    print('You are in the {}.'.format(current_level))
    print('Inventory:', inventory)
    if item_in_level:                                        #checks to see if there is an item in the room
        print('You see a'.format(item_in_level))
    else:
        print("You don't see anything useful")

    # gets the users input
    command = input('\nWhat do you wish to do? ')  # this controls the movement
    if command in directions:
        command = command.split()[1]
        if command in level[current_level].keys():
            current_level = level[current_level][command]
           item_in_level =level[current_level]["item"]
        else:
            # if the player inputs a bad movement
            print('please write correct direction!')
    # Checks to see if the player types a 'get' command and adds the item in the room to the players inventory.
    if command in pick_up_items:
        command = command.split()[1]
        if command in level[current_level].keys():
            inventory.append(current_room['item'])
        else:
            # if the player inputs a item not in the room
            print('this item is not available here!')


问:
Hopscotch tour is not working for second or third page
I have tried lot to work with multipage tour, but it does not working for second or third page. No tour is displayed on second page.
I have followed links to setup multipage tour:

https://linkedinattic.github.io/hopscotch/multipage1.html
Hopscotch multipage tour does not work

On first page, I have 6 steps and on second page, I have 2 steps. I have setup the steps as follows:

```<code>    steps = [
    {
        target: '#ele1',
        title: 'Welcome',
        content: 'Welcome to Tour',
        placement: 'top'
    },
    {
        target: '#quicktool_menu_button',
        title: 'Quick tools',
        content: 'With this, you can quickly select menu and perform action.',
        placement: 'bottom'
    },
    {
        target: '#topNavSearchButton',
        title: 'Global Search',
        content: 'With this, you can quickly search for detailed information of active contact.',
        placement: 'bottom'
    },
    {...}, {...},
    {
        target: '#elem6',
        title: 'Element 6',
        content: 'With this, you can quickly search for detailed information of active contact for this agency.',
        placement: 'bottom',
        multipage: true,
        onNext: function () {
           window.location = 'secondpage.php';
        },
        {
           target: '#second-page-elem',
           placement: 'top',
           title: 'Welcome to second page',
           content: 'Welcome to second page'
        }
    ];
</code>```

Any help will be highly appreciated.

Body:
I have tried lot to work with multipage tour, but it does not working for second or third page. No tour is displayed on second page.
I have followed links to setup multipage tour:

https://linkedinattic.github.io/hopscotch/multipage1.html
Hopscotch multipage tour does not work

On first page, I have 6 steps and on second page, I have 2 steps. I have setup the steps as follows:

    steps = [
    {
        target: '#ele1',
        title: 'Welcome',
        content: 'Welcome to Tour',
        placement: 'top'
    },
    {
        target: '#quicktool_menu_button',
        title: 'Quick tools',
        content: 'With this, you can quickly select menu and perform action.',
        placement: 'bottom'
    },
    {
        target: '#topNavSearchButton',
        title: 'Global Search',
        content: 'With this, you can quickly search for detailed information of active contact.',
        placement: 'bottom'
    },
    {...}, {...},
    {
        target: '#elem6',
        title: 'Element 6',
        content: 'With this, you can quickly search for detailed information of active contact for this agency.',
        placement: 'bottom',
        multipage: true,
        onNext: function () {
           window.location = 'secondpage.php';
        },
        {
           target: '#second-page-elem',
           placement: 'top',
           title: 'Welcome to second page',
           content: 'Welcome to second page'
        }
    ];

Any help will be highly appreciated.


问:
Automate SQL case statement and left joins
Looking to improve upon this code, it actually works as is but it isn't efficient. In these two pieces of SQL code, the case statement is manually updated to include new vehicles along with the multiple left joins. If I were to add another vehicle for instance, I would add:

,case when F.[vehicle] is null then 'Up' else 'Down' end as car_truck

If I wanted to update the left join after updating the case statement it would look like:

```<code>          (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='car_truck') F
             on A.entity_state=E.[entity_state_list]
             left outer join
</code>```

It is time consuming to add these every time there is a new vehicle. I am looking to have code that updates vehicles automatically and assigns an alias so no manual input needs to occur for both case statements and left joins.

```<code>select A.*
,case when B.[vehicle] is null then 'Up' else 'Down' end as cars
,case when C.[vehicles] is null then 'Up' else 'Down' end as trucks
,case when D.[vehicles] is null then 'Up' else 'Down' end as electric
,case when E.[vehicles] is null then 'Up' else 'Down' end as hybrid

 left outer join
             (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='cars') B
             on A.entity_state=B.entity_state_list
             left outer join
             (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='trucks') C
             on A.entity_state=C.[entity_state_list]
             left outer join
             (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='electric') D
             on A.entity_state=D.[entity_state_list]
             left outer join
            (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='hybrid') E
             on A.entity_state=E.[entity_state_list]
             left outer join
</code>```

The desired end result would be case statements and left joins that require no manual intervention. The code as it is today does work but isn't efficient. In another language like Python, my approach would to write a loop, but I do not know how to do that in SQL.

Body:
Looking to improve upon this code, it actually works as is but it isn't efficient. In these two pieces of SQL code, the case statement is manually updated to include new vehicles along with the multiple left joins. If I were to add another vehicle for instance, I would add:

,case when F.[vehicle] is null then 'Up' else 'Down' end as car_truck

If I wanted to update the left join after updating the case statement it would look like:

          (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='car_truck') F
             on A.entity_state=E.[entity_state_list]
             left outer join

It is time consuming to add these every time there is a new vehicle. I am looking to have code that updates vehicles automatically and assigns an alias so no manual input needs to occur for both case statements and left joins.

select A.*
,case when B.[vehicle] is null then 'Up' else 'Down' end as cars
,case when C.[vehicles] is null then 'Up' else 'Down' end as trucks
,case when D.[vehicles] is null then 'Up' else 'Down' end as electric
,case when E.[vehicles] is null then 'Up' else 'Down' end as hybrid

 left outer join
             (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='cars') B
             on A.entity_state=B.entity_state_list
             left outer join
             (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='trucks') C
             on A.entity_state=C.[entity_state_list]
             left outer join
             (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='electric') D
             on A.entity_state=D.[entity_state_list]
             left outer join
            (SELECT  [vehicles]
      ,[entity_state_list]
  FROM [SCDA].[Availablity].[vw_XEUS]
  where vehicles ='hybrid') E
             on A.entity_state=E.[entity_state_list]
             left outer join

The desired end result would be case statements and left joins that require no manual intervention. The code as it is today does work but isn't efficient. In another language like Python, my approach would to write a loop, but I do not know how to do that in SQL.


问:
Build TGUI basic example with CMake and g++?
I would like to build a basic example using TGUI, but I get thousands of errors. Note that I can build the project from this command:

```<code>g++ main.cpp -ltgui -lsfml-window -lsfml-graphics -lsfml-system
</code>```

Here the main.cpp:

```<code>#include <TGUI/TGUI.hpp>
#include <TGUI/Backend/SFML-Graphics.hpp>

bool runExample(tgui::BackendGui& gui)
{
    return true;
}

int main()
{
    sf::RenderWindow window{ {800, 600}, "TGUI example - SFML_GRAPHICS backend" };

    tgui::Gui gui{window};
    if (runExample(gui))
        gui.mainLoop();
}
</code>```

And my CMakeLists.txt:

```<code>cmake_minimum_required(VERSION 2.8)
project(TestProject)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
find_package(SFML 2 REQUIRED system window graphics network audio)
find_package(TGUI 0.10 REQUIRED)

if(NOT SFML_FOUND)
    message(FATAL_ERROR "Could not find SFML")
endif()

if(NOT TGUI_FOUND)
    message(FATAL_ERROR "Could not find TGUI")
endif()

add_executable(TestProject main.cpp)
target_link_libraries(TestProject ${TGUI_LIBRARY} ${SFML_LIBRARIES})
</code>```

I did:

```<code>$ mkdir build && cd build && cmake ..
-- Found SFML 2.5.1 in /usr/lib/x86_64-linux-gnu/cmake/SFML
-- Found TGUI 0.10.0 in /usr/lib/x86_64-linux-gnu/cmake/TGUI
-- Configuring done
-- Generating done
-- Build files have been written to: /home/canard/tgui-example/build
$ make
In file included from /usr/include/TGUI/Vector2.hpp:30,
             from /usr/include/TGUI/Layout.hpp:30,
             from /usr/include/TGUI/Animation.hpp:29,
             from /usr/include/TGUI/Core.hpp:30,
             from /usr/include/TGUI/TGUI.hpp:30,
             from /home/canard/tgui-example/main.cpp:1:
/usr/include/TGUI/String.hpp:86:39: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
   86 |         using IsStringViewType = std::enable_if_t<
      |                                       ^~~~~~~~~~~
/usr/include/TGUI/String.hpp:86:34: note: ‘std::enable_if_t’ is only available from C++14 onwards
   86 |         using IsStringViewType = std::enable_if_t<
...
</code>```

Body:
I would like to build a basic example using TGUI, but I get thousands of errors. Note that I can build the project from this command:

g++ main.cpp -ltgui -lsfml-window -lsfml-graphics -lsfml-system

Here the main.cpp:

#include <TGUI/TGUI.hpp>
#include <TGUI/Backend/SFML-Graphics.hpp>

bool runExample(tgui::BackendGui& gui)
{
    return true;
}

int main()
{
    sf::RenderWindow window{ {800, 600}, "TGUI example - SFML_GRAPHICS backend" };

    tgui::Gui gui{window};
    if (runExample(gui))
        gui.mainLoop();
}

And my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project(TestProject)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
find_package(SFML 2 REQUIRED system window graphics network audio)
find_package(TGUI 0.10 REQUIRED)

if(NOT SFML_FOUND)
    message(FATAL_ERROR "Could not find SFML")
endif()

if(NOT TGUI_FOUND)
    message(FATAL_ERROR "Could not find TGUI")
endif()

add_executable(TestProject main.cpp)
target_link_libraries(TestProject ${TGUI_LIBRARY} ${SFML_LIBRARIES})

I did:

$ mkdir build && cd build && cmake ..
-- Found SFML 2.5.1 in /usr/lib/x86_64-linux-gnu/cmake/SFML
-- Found TGUI 0.10.0 in /usr/lib/x86_64-linux-gnu/cmake/TGUI
-- Configuring done
-- Generating done
-- Build files have been written to: /home/canard/tgui-example/build
$ make
In file included from /usr/include/TGUI/Vector2.hpp:30,
             from /usr/include/TGUI/Layout.hpp:30,
             from /usr/include/TGUI/Animation.hpp:29,
             from /usr/include/TGUI/Core.hpp:30,
             from /usr/include/TGUI/TGUI.hpp:30,
             from /home/canard/tgui-example/main.cpp:1:
/usr/include/TGUI/String.hpp:86:39: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
   86 |         using IsStringViewType = std::enable_if_t<
      |                                       ^~~~~~~~~~~
/usr/include/TGUI/String.hpp:86:34: note: ‘std::enable_if_t’ is only available from C++14 onwards
   86 |         using IsStringViewType = std::enable_if_t<
...


问:
Prevent flutter from rebuild the page when using PageRouteBuilder
Every time the PageRouteBuilder is called the current Page is rebuild and during transition of the route the initial page is shown. Instead the route should not be rebuild and the current context of the page should be shown during transition.

Code of the PageRouteBuilder

```<code>class RouteChange extends PageRouteBuilder {

  final Widget enterPage;
  final Widget exitPage;
  final Offset beginOffsetExit;
  final Offset endOffsetExit;
  final Offset beginOffsetEnter;
  final Offset endOffsetEnter;
  final Offset beginOffsetButton;
  final Offset endOffsetButton;
  final Widget animatedWidget;

  RouteChange({
    required this.exitPage,
    required this.enterPage,
    required this.beginOffsetExit,
    required this.endOffsetExit,
    required this.beginOffsetEnter,
    required this.endOffsetEnter,
    required this.beginOffsetButton,
    required this.endOffsetButton,
    required this.animatedWidget,
  }) : super(
          transitionDuration: const Duration(milliseconds: 3000),
          pageBuilder: (
            BuildContext context,
            Animation<double> animation,
            Animation<double> secondaryAnimation,
          ) {
            return enterPage;
          },
          transitionsBuilder: (
            BuildContext context,
            Animation<double> animation,
            Animation<double> secondaryAnimation,
            Widget child,
          ) {
            return Stack(
              children: <Widget>[
                SlideTransition(
                  position: Tween<Offset>(
                    begin: beginOffsetExit, //const Offset(0.0, 0.0),
                    end: endOffsetExit, //const Offset(0.0, -1.0),
                  ).animate(
                    CurvedAnimation(
                      parent: animation,
                      curve: Curves.linearToEaseOut,
                      reverseCurve: Curves.easeInToLinear,
                    ),
                  ),
                  child: exitPage,
                ),
                SlideTransition(
                  position: Tween<Offset>(
                    begin: beginOffsetEnter, //const Offset(0.0, 1.0),
                    end: endOffsetEnter, // constOffset(0.0, 0.0),
                  ).animate(
                    CurvedAnimation(
                      parent: animation,
                      curve: Curves.linearToEaseOut,
                      reverseCurve: Curves.easeInToLinear,
                    ),
                  ),
                  child: enterPage,
                ),
                SlideTransition(
                  position: Tween<Offset>(
                          begin: beginOffsetButton, //const Offset(-0.215, 0.4),
                          end: endOffsetButton //const Offset(-0.215, -0.45),
                          )
                      .animate(
                    CurvedAnimation(
                      parent: animation,
                      curve: Curves.linearToEaseOut,
                      reverseCurve: Curves.easeInToLinear,
                    ),
                  ),
                  child: animatedWidget,
                )
              ],
            );
          },
        );
}
</code>```

I tried with keepAlive but it doesn't worked. Maybe I placed it in the wrong place.

Body:
Every time the PageRouteBuilder is called the current Page is rebuild and during transition of the route the initial page is shown. Instead the route should not be rebuild and the current context of the page should be shown during transition.

Code of the PageRouteBuilder

class RouteChange extends PageRouteBuilder {

  final Widget enterPage;
  final Widget exitPage;
  final Offset beginOffsetExit;
  final Offset endOffsetExit;
  final Offset beginOffsetEnter;
  final Offset endOffsetEnter;
  final Offset beginOffsetButton;
  final Offset endOffsetButton;
  final Widget animatedWidget;

  RouteChange({
    required this.exitPage,
    required this.enterPage,
    required this.beginOffsetExit,
    required this.endOffsetExit,
    required this.beginOffsetEnter,
    required this.endOffsetEnter,
    required this.beginOffsetButton,
    required this.endOffsetButton,
    required this.animatedWidget,
  }) : super(
          transitionDuration: const Duration(milliseconds: 3000),
          pageBuilder: (
            BuildContext context,
            Animation<double> animation,
            Animation<double> secondaryAnimation,
          ) {
            return enterPage;
          },
          transitionsBuilder: (
            BuildContext context,
            Animation<double> animation,
            Animation<double> secondaryAnimation,
            Widget child,
          ) {
            return Stack(
              children: <Widget>[
                SlideTransition(
                  position: Tween<Offset>(
                    begin: beginOffsetExit, //const Offset(0.0, 0.0),
                    end: endOffsetExit, //const Offset(0.0, -1.0),
                  ).animate(
                    CurvedAnimation(
                      parent: animation,
                      curve: Curves.linearToEaseOut,
                      reverseCurve: Curves.easeInToLinear,
                    ),
                  ),
                  child: exitPage,
                ),
                SlideTransition(
                  position: Tween<Offset>(
                    begin: beginOffsetEnter, //const Offset(0.0, 1.0),
                    end: endOffsetEnter, // constOffset(0.0, 0.0),
                  ).animate(
                    CurvedAnimation(
                      parent: animation,
                      curve: Curves.linearToEaseOut,
                      reverseCurve: Curves.easeInToLinear,
                    ),
                  ),
                  child: enterPage,
                ),
                SlideTransition(
                  position: Tween<Offset>(
                          begin: beginOffsetButton, //const Offset(-0.215, 0.4),
                          end: endOffsetButton //const Offset(-0.215, -0.45),
                          )
                      .animate(
                    CurvedAnimation(
                      parent: animation,
                      curve: Curves.linearToEaseOut,
                      reverseCurve: Curves.easeInToLinear,
                    ),
                  ),
                  child: animatedWidget,
                )
              ],
            );
          },
        );
}

I tried with keepAlive but it doesn't worked. Maybe I placed it in the wrong place.


问:
How do I hide built in controls?
I want to hide the paste button based on document chose . I have word vsto addin built in C#
enter image description here

I tried setting the visibility to false for Paste control but that didn't work . I just want user to use the Ctrl +V to paste for which I have I have set Action on command Paste .I want to hide all the other paste option(including the Paste options)  that is available in Home tab

Title: How do I hide built in controls?


问:
C++ Logic error: Instruction does not load data
COMPILER ONLINE TEST:www.onlinegdb.com

Update 14 Dez:FIND ERROR DONT SOLVE

for(az=0;az<=strlen(str);az++);  //<strlen OR <=strlen

Objetive output= ditado6:' CEM VINTE TRES REAIS E ONZE CENTAVOS'

```<code>bool insere_caracter(const char *digito[],int indice){
   voz.ditado[voz.posicao]=' '; //espaço inicial
   unsigned int az;
   char str[33];
   strcpy(str,digito[indice]);   //CHANGE FOR BELOW
      //for(az=0;az<strlen(str);az++
      for(az=0;az<=strlen(str);az++){
        voz.ditado[++voz.posicao]= digito[indice][az];
      }//for az
   return true;
}
</code>```

This code aims to decipher a number in expression (voice) of money.

Have error in code, dont have any warnings.
Please guide why and how to avoid this consequence.

According to brief inspection, the fault of the code is in the function "decoder_cardinal"

RUN CODE HERE: Compiler online CODECHEF

Output: have here the error

```<code>Inteiro:123
Fracionario:11
ditado1:' CEM VINTE TRES REAIS'
posicao 00:20
ditado2:' CEM VINTE TRES REAIS E '
posicao 01:23
posicao 02:28
ditado3:' CEM VINTE TRES REAIS E ONZE'
posicao 05:36
ditado6:' CEM VINTE TRES REAIS E ONZE' //HERE DONT INSERT WORD "CENTAVOS"
posicao 06:36
</code>```

Output after Disable line 228: //decoder_cardinal(voz.centavos);

```<code>Inteiro:123
Fracionario:11
ditado1:' CEM VINTE TRES REAIS'
posicao 00:20
ditado2:' CEM VINTE TRES REAIS E '
posicao 01:23
posicao 02:23
ditado3:' CEM VINTE TRES REAIS E '
posicao 05:31
ditado6:' CEM VINTE TRES REAIS E CENTAVOS' //HERE good write CENTAVOS;
posicao 06:31
</code>```

Output correct is (enable line 228)

```<code>Inteiro:123
Fracionario:11
ditado1:' CEM VINTE TRES REAIS'
posicao 00:20
ditado2:' CEM VINTE TRES REAIS E '
posicao 01:23
posicao 02:28
ditado3:' CEM VINTE TRES REAIS E ONZE'
posicao 05:36
ditado6:' CEM VINTE TRES REAIS E ONZE CENTAVOS' //Completed
posicao 06:36
</code>```

CODE COMPLETE
#ifndef TVP_AUDIO
#define TVP_AUDIO

```<code>    #define SIZE_DITADO  256
    #include <stdio.h>
    #include <string.h>
    #include <iostream>
    //#include <array>

    const char *romanos[] = {"HUM", "DOIS", "TRES", "QUATRO",
     "CINCO", "SEIS", "SETE", "OITO", "NOVE", "DEZ", "ONZE",
     "DOZE", "TREZE","CATORZE","QUINZE","DEZESSEIS",
     "DEZESSETE","DEZOITO","DEZENOVE","VINTE","TRINTA",
     "QUARENTA","CINQUENTA","SESSENTA","SETENTA","OITENTA",
     "NOVENTA","CEM","DUZENTOS","TREZENTOS","QUATROCENTOS",
     "QUINHENTOS","SEISCENTOS","SETECENTOS","OITOCENTOS",
     "NOVECENTOS","MIL","DOIS MIL","TRES MIL","QUATRO MIL",
     "CINCO MIL","SEIS MIL","SETE MIL","OITO MIL","NOVE MIL",
     "DEZ MIL","ONZE MIL","DOZE MIL","TREZE MIL",
     "CATORZE MIL","QUINZE MIL","DEZESSEIS MIL",
     "DEZESSETE MIL","DEZOITO MIL","DEZENOVE MIL"};
     const int arabicos[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
     12,13,14,15,16,17,18,19,20,30,40,50,60,70,80,90,100,200,300,
     400,500,600,700,800,900,1000,2000,3000,4000,5000,6000,7000,
     8000,9000,10000,11000,12000,13000,14000,15000,16000,17000,
     18000,19000};
     const char vozes[][20] =
     {"UM","HUM","DOIS","TRES","QUATRO","CINCO","SEIS","SETE",
     "OITO","NOVE","DEZ","ONZE","DOZE","TREZE","CATORZE",
     "QUINZE", "DEZESSEIS","DESESSETE","DEZOITO","DEZENOVE",
     "VINTE","TRINTA","QUARENTA","CINQUENTA","SESSENTA",
     "SETENTA","OITENTA","NOVENTA","CEM","DUZENTOS",
     "TREZENTOS","QUATROCENTOS","QUINHENTOS","SEISCENTOS",
     "SETECENTOS","OITOCENTOS","NOVECENTOS","MIL","E","REAIS",
     "CENTAVOS","ZERO","TANCAINFO","VERIFICADOR"};

     struct precifica{
        unsigned int reais;
        unsigned int centavos;
        unsigned int tamanho;
        unsigned int posicao;
        unsigned int c_size; //tamanho do array de cardinal
        unsigned int n_size; //tamanho do array de numeros
        unsigned int v_size; //tamanho do array de vozes
        int index[SIZE_DITADO/4];
        char ditado[SIZE_DITADO];
      }voz;

    bool decoder_preco(char alvo[]);
    void zerar();
    bool insere_caracter(const char *digito[],int indice);
    void decoder_cardinal(int numero);
    void find_word(std::string str);
    void splitstr(std::string str, std::string deli);
    void size_array();
    void insere_centavos();
    void monta_voz();

    bool decoder_preco(char alvo[]){

         unsigned int pos1=0, pos2=0;
         bool part1=false;
         bool part2=false;
         char p1[]={' ',' ',' ',' ',' ',' ','\0'};
         char p2[]={' ',' ',' ',' ','\0'};

         for(int az=0;az<=strlen(alvo);az++){

            if(part1==true && part2==false){
                if(isdigit(alvo[az]))p1[pos1++]=alvo[az];
            }
            if(part1==true && part2==true){
                 if(isdigit(alvo[az]))p2[pos2++]=alvo[az];
            }

          if(alvo[az]=='$' && alvo[az+1]!=' ')part1=true;
          if(alvo[az]==' ' && alvo[az+1]!=' ')part1=true;
          if(alvo[az]==',' || alvo[az]=='.')part2=true;
         }//for

         if(part1 == false && part2 == false)return false;
         if(pos1 ==  0 && pos2 == 0)return false;
         unsigned int inteira=0, fracionaria=0;
         //sscanf(myarray, "%d", &i);
         sscanf(p1, "%d", &inteira);
         sscanf(p2, "%d", &fracionaria);

         voz.reais=inteira;
         voz.centavos=fracionaria;

        return true;
       }//fim decoder_preco

      void zerar(){

           voz.ditado[voz.posicao]=' ';
           voz.ditado[++voz.posicao]='Z';
           voz.ditado[++voz.posicao]='E';
           voz.ditado[++voz.posicao]='R';
           voz.ditado[++voz.posicao]='O';
           voz.ditado[++voz.posicao]=' ';
       }

       bool insere_caracter(const char *digito[],int indice){

             voz.ditado[voz.posicao]=' ';
             unsigned int az;
             char str[33];
             //printf("digito[%d]=%s \n",indice, digito[indice]);
             strcpy(str,digito[indice]);

             //printf("strlen:%d \n",strlen(str));
             for(az=0;az<=strlen(str);az++){
                voz.ditado[++voz.posicao]= digito[indice][az];
                char caracter=voz.ditado[az];
             }//for az
          return true;
       }
       void decoder_cardinal(int numero){

           if(numero == 0){
           zerar();
           return;
           }
           // acha a quantidade de elementos no array
         int indice = (sizeof(arabicos) / sizeof(arabicos[0]))-1;
         while (numero > 0) {
              if (numero >= arabicos[indice]) {

                insere_caracter(romanos,indice);
                numero -= arabicos[indice];
               } else {
                        indice--;
                      }
         }//while
       }

    void find_word(std::string str){

      std::string s1;
      for (int i = 0 ; i < voz.v_size; i++)
      {
         s1=vozes[i];
         if (s1.compare(str) == 0)
            {
             voz.index[voz.posicao++]=i;
             break;
             }
       }//for
    }

    void splitstr(std::string str, std::string deli = " ")
    {
      voz.posicao=0;
      memset(&voz.index,-1,sizeof(voz.index));

      std::string res;
      int start = 0;
      int fim = str.find(deli);
        while (fim != -1){
          res=str.substr(start, fim - start);
          find_word(res);
          start = fim + deli.size();
          fim = str.find(deli, start);
        }//while
       res=str.substr(start, fim - start);
       find_word(res);
    }

    void size_array(){

        int len1 = *(&romanos + 1) - romanos;
        int len2 = *(&arabicos + 1) - arabicos;
        int len3 = *(&vozes + 1) - vozes;
        voz.v_size=len3;
        if(len1 == len2){
           voz.c_size=len1;
           voz.n_size=len2;
         }
         else printf("VERIFIQUE OS ARRAYS DE DECODIFICACAO");

    }

    void insere_centavos(){
         voz.ditado[++voz.posicao]=' ';
         voz.ditado[++voz.posicao]='C';
         voz.ditado[++voz.posicao]='E';
         voz.ditado[++voz.posicao]='N';
         voz.ditado[++voz.posicao]='T';
         voz.ditado[++voz.posicao]='A';
         voz.ditado[++voz.posicao]='V';
         voz.ditado[++voz.posicao]='O';
         voz.ditado[++voz.posicao]='S';
    }

    void monta_voz(){

       size_array();
       memset(&voz.ditado,'\0',sizeof(voz.ditado));
       voz.posicao=0;
       decoder_cardinal(voz.reais);
       printf("Inteiro:%d \n",voz.reais);
       printf("Fracionario:%d \n",voz.centavos);
       voz.ditado[voz.posicao]=' ';
       voz.ditado[++voz.posicao]='R';
       voz.ditado[++voz.posicao]='E';
       voz.ditado[++voz.posicao]='A';
       voz.ditado[++voz.posicao]='I';
       voz.ditado[++voz.posicao]='S';
       printf("ditado1:'%s' \n", voz.ditado);
       printf("posicao 00:%d \n", voz.posicao);
       if(voz.centavos != 0){
          voz.ditado[++voz.posicao]=' ';
          voz.ditado[++voz.posicao]='E';
          voz.ditado[++voz.posicao]=' ';
          printf("ditado2:'%s' \n", voz.ditado);
          printf("posicao 01:%d \n", voz.posicao);
          decoder_cardinal(voz.centavos);
          printf("posicao 02:%d \n", voz.posicao);
          //insere_centavos();
          printf("ditado3:'%s' \n", voz.ditado);
          voz.ditado[++voz.posicao]=' ';
          voz.ditado[++voz.posicao]='C';
          voz.ditado[++voz.posicao]='E';
          voz.ditado[++voz.posicao]='N';
          voz.ditado[++voz.posicao]='T';
          voz.ditado[++voz.posicao]='A';
          voz.ditado[++voz.posicao]='V';
          voz.ditado[++voz.posicao]='O';
          voz.ditado[++voz.posicao]='S';
          printf("posicao 05:%d \n", voz.posicao);
          printf("ditado6:'%s' \n", voz.ditado);
          printf("posicao 06:%d \n", voz.posicao);

        }else{
        //se for zero centavos
        }

      std::string s = voz.ditado;
      splitstr(s, " "); //separa em palavras
     }//monta_voz

     int main(){
         char alvo[]="R$123,11";
         decoder_preco(alvo);
         monta_voz();
     }
     #endif
</code>```

Body:
COMPILER ONLINE TEST:www.onlinegdb.com

Update 14 Dez:FIND ERROR DONT SOLVE

for(az=0;az<=strlen(str);az++);  //<strlen OR <=strlen

Objetive output= ditado6:' CEM VINTE TRES REAIS E ONZE CENTAVOS'

bool insere_caracter(const char *digito[],int indice){
   voz.ditado[voz.posicao]=' '; //espaço inicial
   unsigned int az;
   char str[33];
   strcpy(str,digito[indice]);   //CHANGE FOR BELOW
      //for(az=0;az<strlen(str);az++
      for(az=0;az<=strlen(str);az++){
        voz.ditado[++voz.posicao]= digito[indice][az];
      }//for az
   return true;
}

This code aims to decipher a number in expression (voice) of money.

Have error in code, dont have any warnings.
Please guide why and how to avoid this consequence.

According to brief inspection, the fault of the code is in the function "decoder_cardinal"

RUN CODE HERE: Compiler online CODECHEF

Output: have here the error

Inteiro:123
Fracionario:11
ditado1:' CEM VINTE TRES REAIS'
posicao 00:20
ditado2:' CEM VINTE TRES REAIS E '
posicao 01:23
posicao 02:28
ditado3:' CEM VINTE TRES REAIS E ONZE'
posicao 05:36
ditado6:' CEM VINTE TRES REAIS E ONZE' //HERE DONT INSERT WORD "CENTAVOS"
posicao 06:36

Output after Disable line 228: //decoder_cardinal(voz.centavos);

Inteiro:123
Fracionario:11
ditado1:' CEM VINTE TRES REAIS'
posicao 00:20
ditado2:' CEM VINTE TRES REAIS E '
posicao 01:23
posicao 02:23
ditado3:' CEM VINTE TRES REAIS E '
posicao 05:31
ditado6:' CEM VINTE TRES REAIS E CENTAVOS' //HERE good write CENTAVOS;
posicao 06:31

Output correct is (enable line 228)

Inteiro:123
Fracionario:11
ditado1:' CEM VINTE TRES REAIS'
posicao 00:20
ditado2:' CEM VINTE TRES REAIS E '
posicao 01:23
posicao 02:28
ditado3:' CEM VINTE TRES REAIS E ONZE'
posicao 05:36
ditado6:' CEM VINTE TRES REAIS E ONZE CENTAVOS' //Completed
posicao 06:36

CODE COMPLETE
#ifndef TVP_AUDIO
#define TVP_AUDIO

    #define SIZE_DITADO  256
    #include <stdio.h>
    #include <string.h>
    #include <iostream>
    //#include <array>

    const char *romanos[] = {"HUM", "DOIS", "TRES", "QUATRO",
     "CINCO", "SEIS", "SETE", "OITO", "NOVE", "DEZ", "ONZE",
     "DOZE", "TREZE","CATORZE","QUINZE","DEZESSEIS",
     "DEZESSETE","DEZOITO","DEZENOVE","VINTE","TRINTA",
     "QUARENTA","CINQUENTA","SESSENTA","SETENTA","OITENTA",
     "NOVENTA","CEM","DUZENTOS","TREZENTOS","QUATROCENTOS",
     "QUINHENTOS","SEISCENTOS","SETECENTOS","OITOCENTOS",
     "NOVECENTOS","MIL","DOIS MIL","TRES MIL","QUATRO MIL",
     "CINCO MIL","SEIS MIL","SETE MIL","OITO MIL","NOVE MIL",
     "DEZ MIL","ONZE MIL","DOZE MIL","TREZE MIL",
     "CATORZE MIL","QUINZE MIL","DEZESSEIS MIL",
     "DEZESSETE MIL","DEZOITO MIL","DEZENOVE MIL"};
     const int arabicos[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
     12,13,14,15,16,17,18,19,20,30,40,50,60,70,80,90,100,200,300,
     400,500,600,700,800,900,1000,2000,3000,4000,5000,6000,7000,
     8000,9000,10000,11000,12000,13000,14000,15000,16000,17000,
     18000,19000};
     const char vozes[][20] =
     {"UM","HUM","DOIS","TRES","QUATRO","CINCO","SEIS","SETE",
     "OITO","NOVE","DEZ","ONZE","DOZE","TREZE","CATORZE",
     "QUINZE", "DEZESSEIS","DESESSETE","DEZOITO","DEZENOVE",
     "VINTE","TRINTA","QUARENTA","CINQUENTA","SESSENTA",
     "SETENTA","OITENTA","NOVENTA","CEM","DUZENTOS",
     "TREZENTOS","QUATROCENTOS","QUINHENTOS","SEISCENTOS",
     "SETECENTOS","OITOCENTOS","NOVECENTOS","MIL","E","REAIS",
     "CENTAVOS","ZERO","TANCAINFO","VERIFICADOR"};

     struct precifica{
        unsigned int reais;
        unsigned int centavos;
        unsigned int tamanho;
        unsigned int posicao;
        unsigned int c_size; //tamanho do array de cardinal
        unsigned int n_size; //tamanho do array de numeros
        unsigned int v_size; //tamanho do array de vozes
        int index[SIZE_DITADO/4];
        char ditado[SIZE_DITADO];
      }voz;

    bool decoder_preco(char alvo[]);
    void zerar();
    bool insere_caracter(const char *digito[],int indice);
    void decoder_cardinal(int numero);
    void find_word(std::string str);
    void splitstr(std::string str, std::string deli);
    void size_array();
    void insere_centavos();
    void monta_voz();

    bool decoder_preco(char alvo[]){

         unsigned int pos1=0, pos2=0;
         bool part1=false;
         bool part2=false;
         char p1[]={' ',' ',' ',' ',' ',' ','\0'};
         char p2[]={' ',' ',' ',' ','\0'};

         for(int az=0;az<=strlen(alvo);az++){

            if(part1==true && part2==false){
                if(isdigit(alvo[az]))p1[pos1++]=alvo[az];
            }
            if(part1==true && part2==true){
                 if(isdigit(alvo[az]))p2[pos2++]=alvo[az];
            }

          if(alvo[az]=='$' && alvo[az+1]!=' ')part1=true;
          if(alvo[az]==' ' && alvo[az+1]!=' ')part1=true;
          if(alvo[az]==',' || alvo[az]=='.')part2=true;
         }//for

         if(part1 == false && part2 == false)return false;
         if(pos1 ==  0 && pos2 == 0)return false;
         unsigned int inteira=0, fracionaria=0;
         //sscanf(myarray, "%d", &i);
         sscanf(p1, "%d", &inteira);
         sscanf(p2, "%d", &fracionaria);

         voz.reais=inteira;
         voz.centavos=fracionaria;

        return true;
       }//fim decoder_preco

      void zerar(){

           voz.ditado[voz.posicao]=' ';
           voz.ditado[++voz.posicao]='Z';
           voz.ditado[++voz.posicao]='E';
           voz.ditado[++voz.posicao]='R';
           voz.ditado[++voz.posicao]='O';
           voz.ditado[++voz.posicao]=' ';
       }

       bool insere_caracter(const char *digito[],int indice){

             voz.ditado[voz.posicao]=' ';
             unsigned int az;
             char str[33];
             //printf("digito[%d]=%s \n",indice, digito[indice]);
             strcpy(str,digito[indice]);

             //printf("strlen:%d \n",strlen(str));
             for(az=0;az<=strlen(str);az++){
                voz.ditado[++voz.posicao]= digito[indice][az];
                char caracter=voz.ditado[az];
             }//for az
          return true;
       }
       void decoder_cardinal(int numero){

           if(numero == 0){
           zerar();
           return;
           }
           // acha a quantidade de elementos no array
         int indice = (sizeof(arabicos) / sizeof(arabicos[0]))-1;
         while (numero > 0) {
              if (numero >= arabicos[indice]) {

                insere_caracter(romanos,indice);
                numero -= arabicos[indice];
               } else {
                        indice--;
                      }
         }//while
       }

    void find_word(std::string str){

      std::string s1;
      for (int i = 0 ; i < voz.v_size; i++)
      {
         s1=vozes[i];
         if (s1.compare(str) == 0)
            {
             voz.index[voz.posicao++]=i;
             break;
             }
       }//for
    }

    void splitstr(std::string str, std::string deli = " ")
    {
      voz.posicao=0;
      memset(&voz.index,-1,sizeof(voz.index));

      std::string res;
      int start = 0;
      int fim = str.find(deli);
        while (fim != -1){
          res=str.substr(start, fim - start);
          find_word(res);
          start = fim + deli.size();
          fim = str.find(deli, start);
        }//while
       res=str.substr(start, fim - start);
       find_word(res);
    }

    void size_array(){

        int len1 = *(&romanos + 1) - romanos;
        int len2 = *(&arabicos + 1) - arabicos;
        int len3 = *(&vozes + 1) - vozes;
        voz.v_size=len3;
        if(len1 == len2){
           voz.c_size=len1;
           voz.n_size=len2;
         }
         else printf("VERIFIQUE OS ARRAYS DE DECODIFICACAO");

    }

    void insere_centavos(){
         voz.ditado[++voz.posicao]=' ';
         voz.ditado[++voz.posicao]='C';
         voz.ditado[++voz.posicao]='E';
         voz.ditado[++voz.posicao]='N';
         voz.ditado[++voz.posicao]='T';
         voz.ditado[++voz.posicao]='A';
         voz.ditado[++voz.posicao]='V';
         voz.ditado[++voz.posicao]='O';
         voz.ditado[++voz.posicao]='S';
    }

    void monta_voz(){

       size_array();
       memset(&voz.ditado,'\0',sizeof(voz.ditado));
       voz.posicao=0;
       decoder_cardinal(voz.reais);
       printf("Inteiro:%d \n",voz.reais);
       printf("Fracionario:%d \n",voz.centavos);
       voz.ditado[voz.posicao]=' ';
       voz.ditado[++voz.posicao]='R';
       voz.ditado[++voz.posicao]='E';
       voz.ditado[++voz.posicao]='A';
       voz.ditado[++voz.posicao]='I';
       voz.ditado[++voz.posicao]='S';
       printf("ditado1:'%s' \n", voz.ditado);
       printf("posicao 00:%d \n", voz.posicao);
       if(voz.centavos != 0){
          voz.ditado[++voz.posicao]=' ';
          voz.ditado[++voz.posicao]='E';
          voz.ditado[++voz.posicao]=' ';
          printf("ditado2:'%s' \n", voz.ditado);
          printf("posicao 01:%d \n", voz.posicao);
          decoder_cardinal(voz.centavos);
          printf("posicao 02:%d \n", voz.posicao);
          //insere_centavos();
          printf("ditado3:'%s' \n", voz.ditado);
          voz.ditado[++voz.posicao]=' ';
          voz.ditado[++voz.posicao]='C';
          voz.ditado[++voz.posicao]='E';
          voz.ditado[++voz.posicao]='N';
          voz.ditado[++voz.posicao]='T';
          voz.ditado[++voz.posicao]='A';
          voz.ditado[++voz.posicao]='V';
          voz.ditado[++voz.posicao]='O';
          voz.ditado[++voz.posicao]='S';
          printf("posicao 05:%d \n", voz.posicao);
          printf("ditado6:'%s' \n", voz.ditado);
          printf("posicao 06:%d \n", voz.posicao);

        }else{
        //se for zero centavos
        }

      std::string s = voz.ditado;
      splitstr(s, " "); //separa em palavras
     }//monta_voz

     int main(){
         char alvo[]="R$123,11";
         decoder_preco(alvo);
         monta_voz();
     }
     #endif


问:
Changing requested authentication scopes - Firebase OIDC Authentication Swift iOS
I am currently trying to implement the OpenID Connect Authentication via Firebase with my custom authentication provider. The problem is that when I try to specify the requested scopes in code with authProvider.scopes = ["roles"] my provider always shows that (instead of the scopes that I specified) the following scopes seem to be requested from my provider: ["roles", "email", "profile"]. The scopes "email" and "profile" just seem to appear in the process somehow with me not having any influence on that.

In the Google Developer Documentation it says the following before showing further details on changing the requested scopes: "Specify additional custom OAuth parameters that you want to send with the OAuth request." The problem I see here with this is that one can only specify additional scopes to the ones firebase provides you with by default but seems to not being able to change the default scopes that Firebase somehow automatically specifies for this process.

My authentication provider is a German education institute named "IServ". They support Single-Sign-On and OpenID Authentication (German Documentation: https://doku.iserv.de/development/oauth/).
I am not creating an access or identity token directly in my code, I just use the code that firebase has provided in their documentation for this:

```<code>var authProvider = OAuthProvider(providerID: "oidc.iserv")

authProvider.scopes = ["roles"]

authProvider.getCredentialWith(nil) { credential, error in
// No error or credential returned here, the error is shown in the WebView
}
</code>```

This leads to me having issues with my provider because my provider doesn't grant my application access to the scopes "email" and "profile" and I can't remove them with the help of my code.

I would really appreciate help regarding this problem.

Body:
I am currently trying to implement the OpenID Connect Authentication via Firebase with my custom authentication provider. The problem is that when I try to specify the requested scopes in code with authProvider.scopes = ["roles"] my provider always shows that (instead of the scopes that I specified) the following scopes seem to be requested from my provider: ["roles", "email", "profile"]. The scopes "email" and "profile" just seem to appear in the process somehow with me not having any influence on that.

In the Google Developer Documentation it says the following before showing further details on changing the requested scopes: "Specify additional custom OAuth parameters that you want to send with the OAuth request." The problem I see here with this is that one can only specify additional scopes to the ones firebase provides you with by default but seems to not being able to change the default scopes that Firebase somehow automatically specifies for this process.

My authentication provider is a German education institute named "IServ". They support Single-Sign-On and OpenID Authentication (German Documentation: https://doku.iserv.de/development/oauth/).
I am not creating an access or identity token directly in my code, I just use the code that firebase has provided in their documentation for this:

var authProvider = OAuthProvider(providerID: "oidc.iserv")

authProvider.scopes = ["roles"]

authProvider.getCredentialWith(nil) { credential, error in
// No error or credential returned here, the error is shown in the WebView
}

This leads to me having issues with my provider because my provider doesn't grant my application access to the scopes "email" and "profile" and I can't remove them with the help of my code.

I would really appreciate help regarding this problem.


问:
VBA - Reference a cells range inside a table
I want to use WorkSheetFunction.Match to find the value 0.002 value in the range compressed between two cells of a table named "Table". Here are the refferences of the cells.

ThisWorkbook.Sheets("Sheet").Range("Table").Cells(1,1) to ThisWorkbook.Sheets("Sheet").Range("Table").Cells(10,1)

I would like to write something like this:

WorkSheetFunction.Match(0.002, ThisWorkbook.Sheets("Sheet").Range("Table").Cells(1,1) : ThisWorkbook.Sheets("Sheet").Range("Table").Cells(10,1))

How can I make this work?

I tried

WorkSheetFunction.Match(0.002, ThisWorkbook.Sheets("Sheet").Range("Table").Cells(1,1) : ThisWorkbook.Sheets("Sheet").Range("Table").Cells(10,1))